Created
November 29, 2019 22:30
-
-
Save johnrees/65217999c9e27b03bd517666d7055b6d to your computer and use it in GitHub Desktop.
js to make cargocollective a bit more accessibility friendly
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
try { | |
// add img alt tags using filename | |
document.addEventListener( | |
"DOMContentLoaded", | |
function() { | |
[...document.getElementsByTagName("img")].forEach(i => { | |
i.alt = i.src | |
.split("/") | |
.pop() | |
.split(".") | |
.slice(0, -1) | |
.join(""); | |
}); | |
}, | |
false | |
); | |
// replace meta tag | |
[...document.getElementsByTagName("meta")].forEach(m => { | |
if (m.name === "viewport") { | |
m.content = "initial-scale=1.0, maximum-scale=5.0, user-scalable=yes"; | |
} | |
}); | |
} catch (e) {} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment