Index: trunk/phase3/resources/mediawiki/mediawiki.js |
— | — | @@ -879,8 +879,27 @@ |
880 | 880 | } |
881 | 881 | return arr.join( '|' ).replace( /\./g, '!' ); |
882 | 882 | } |
883 | | - |
884 | 883 | |
| 884 | + /** |
| 885 | + * Adds a script tag to the body, either using document.write or low-level DOM manipulation, |
| 886 | + * depending on whether document-ready has occured yet. |
| 887 | + */ |
| 888 | + function addScript( src ) { |
| 889 | + if ( ready ) { |
| 890 | + // jQuery's getScript method is NOT better than doing this the old-fassioned way |
| 891 | + // because jQuery will eval the script's code, and errors will not have sane |
| 892 | + // line numbers. |
| 893 | + var script = document.createElement( 'script' ); |
| 894 | + script.setAttribute( 'src', src ); |
| 895 | + script.setAttribute( 'type', 'text/javascript' ); |
| 896 | + document.body.appendChild( script ); |
| 897 | + } else { |
| 898 | + document.write( mw.html.element( |
| 899 | + 'script', { 'type': 'text/javascript', 'src': src }, '' |
| 900 | + ) ); |
| 901 | + } |
| 902 | + } |
| 903 | + |
885 | 904 | /* Public Methods */ |
886 | 905 | |
887 | 906 | /** |
— | — | @@ -979,23 +998,14 @@ |
980 | 999 | // include modules which are already loaded |
981 | 1000 | batch = []; |
982 | 1001 | // Asynchronously append a script tag to the end of the body |
983 | | - var html = ''; |
984 | 1002 | for ( var r = 0; r < requests.length; r++ ) { |
985 | 1003 | requests[r] = sortQuery( requests[r] ); |
986 | | - // Build out the HTML |
987 | 1004 | var src = mw.config.get( 'wgLoadScript' ) + '?' + $.param( requests[r] ); |
988 | | - html += mw.html.element( 'script', |
989 | | - { 'type': 'text/javascript', 'src': src }, '' ); |
| 1005 | + addScript( src ); |
990 | 1006 | } |
991 | | - // Load asynchronously after documument ready |
992 | | - if ( ready ) { |
993 | | - setTimeout( function() { $( 'body' ).append( html ); }, 0 ); |
994 | | - } else { |
995 | | - document.write( html ); |
996 | | - } |
997 | 1007 | } |
998 | 1008 | }; |
999 | | - |
| 1009 | + |
1000 | 1010 | /** |
1001 | 1011 | * Registers a module, letting the system know about it and its |
1002 | 1012 | * dependencies. loader.js files contain calls to this function. |
— | — | @@ -1156,13 +1166,7 @@ |
1157 | 1167 | } ) ); |
1158 | 1168 | return true; |
1159 | 1169 | } else if ( type === 'text/javascript' || typeof type === 'undefined' ) { |
1160 | | - var script = mw.html.element( 'script', |
1161 | | - { type: 'text/javascript', src: modules }, '' ); |
1162 | | - if ( ready ) { |
1163 | | - $( 'body' ).append( script ); |
1164 | | - } else { |
1165 | | - document.write( script ); |
1166 | | - } |
| 1170 | + addScript( modules ); |
1167 | 1171 | return true; |
1168 | 1172 | } |
1169 | 1173 | // Unknown type |
— | — | @@ -1322,7 +1326,6 @@ |
1323 | 1327 | }; |
1324 | 1328 | } )(); |
1325 | 1329 | |
1326 | | - |
1327 | 1330 | /* Extension points */ |
1328 | 1331 | |
1329 | 1332 | this.legacy = {}; |
Index: trunk/extensions/ArticleFeedback/modules/ext.articleFeedback/ext.articleFeedback.js |
— | — | @@ -29,8 +29,6 @@ |
30 | 30 | return $.cookie( prefix( 'pitches-' + pitch ) ) != 'hide'; |
31 | 31 | } |
32 | 32 | |
33 | | -dknvlsdnvlsknvlsekvnseoivleskmvleskmvlesjk + 1 = sdsd(); |
34 | | - |
35 | 33 | /** |
36 | 34 | * Ensures a pitch will be muted for a given duration of time |
37 | 35 | * |