Skip to content

Commit 881d149

Browse files
committed
Initial import of GoogleCodeA11yFixes.
For now, this just makes it possible to tell when an issue is starred or not.
1 parent 28be1e0 commit 881d149

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

GoogleCodeA11yFixes.user.js

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
// ==UserScript==
2+
// @name Google Code Accessibility Fixes
3+
// @namespace http://www.jantrid.net/axSGrease/
4+
// @description Improves the accessibility of Google Code.
5+
// @author James Teh <jamie@nvaccess.org>
6+
// @copyright 2014 James Teh
7+
// @license GNU General Public License version 2.0
8+
// @version 0.20140214.01
9+
// @include https://code.google.com/p/*/issues/*
10+
// ==/UserScript==
11+
12+
function fixStar(node) {
13+
node.setAttribute("role", "checkbox");
14+
node.setAttribute("aria-checked",
15+
(node.src.indexOf("star_on.gif") == -1) ? "false" : "true");
16+
}
17+
18+
var observer = new MutationObserver(function(mutations) {
19+
mutations.forEach(function(mutation) {
20+
try {
21+
if (mutation.type === "attributes") {
22+
if (mutation.attributeName == "src" && mutation.target.id == "star")
23+
fixStar(mutation.target);
24+
}
25+
} catch (e) {
26+
// Catch exceptions for individual mutations so other mutations are still handled.
27+
GM_log("Exception while handling mutation: " + e);
28+
}
29+
});
30+
});
31+
observer.observe(document, {attributes: true,
32+
subtree: true, attributeFilter: ["src"]});
33+
fixStar(document.getElementById("star"));

0 commit comments

Comments
 (0)