Make permalink button work in IE8.

IE8 doesn't have addEventListener, so use attachEvent if that doesn't exist.

Auditors: alpert
This commit is contained in:
Emily Eisenberg 2014-08-26 14:50:38 -07:00
parent efaf8b57b9
commit fa3df2db6f

View File

@ -9,9 +9,15 @@ function init() {
input.attachEvent("onkeyup", reprocess);
}
permalink.addEventListener("click", function() {
window.location.search = "?text=" + encodeURIComponent(input.value);
});
if ("addEventListener" in permalink) {
permalink.addEventListener("click", function() {
window.location.search = "?text=" + encodeURIComponent(input.value);
});
} else {
permalink.attachEvent("click", function() {
window.location.search = "?text=" + encodeURIComponent(input.value);
});
}
var match = (/(?:^\?|&)text=([^&]+)/).exec(window.location.search);
if (match) {