File tree Expand file tree Collapse file tree 1 file changed +33
-0
lines changed
Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Original file line number Diff line number Diff line change 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" ) ) ;
You can’t perform that action at this time.
0 commit comments