Index: trunk/extensions/Nuke/Nuke_body.php |
— | — | @@ -123,19 +123,7 @@ |
124 | 124 | |
125 | 125 | $nuke = $this->getTitle(); |
126 | 126 | |
127 | | - $script = <<<JAVASCRIPT |
128 | | -<script type="text/javascript"> |
129 | | -function selectPages( bool ) { |
130 | | - var inputs = document.getElementsByTagName("input"); |
131 | | - for (i = 0; i < inputs.length; i++) { |
132 | | - if (inputs[i].type == "checkbox") { |
133 | | - inputs[i].checked = bool; |
134 | | - } |
135 | | - } |
136 | | -} |
137 | | -</script> |
138 | | -JAVASCRIPT; |
139 | | - $out->addScript( $script ); |
| 127 | + $out->addModules( 'ext.nuke' ); |
140 | 128 | |
141 | 129 | $out->addHTML( |
142 | 130 | Xml::openElement( 'form', array( |
— | — | @@ -154,9 +142,9 @@ |
155 | 143 | |
156 | 144 | // Select: All, None |
157 | 145 | $links = array(); |
158 | | - $links[] = '<a href="#" onclick="selectPages( true ); return false;">' . |
| 146 | + $links[] = '<a href="#" id="toggleall">' . |
159 | 147 | wfMsg( 'powersearch-toggleall' ) . '</a>'; |
160 | | - $links[] = '<a href="#" onclick="selectPages( false ); return false;">' . |
| 148 | + $links[] = '<a href="#" id="togglenone">' . |
161 | 149 | wfMsg( 'powersearch-togglenone' ) . '</a>'; |
162 | 150 | $out->addHTML( |
163 | 151 | Xml::tags( 'p', |
— | — | @@ -174,6 +162,7 @@ |
175 | 163 | |
176 | 164 | foreach( $pages as $info ) { |
177 | 165 | list( $title, $edits, $userName ) = $info; |
| 166 | + |
178 | 167 | $image = $title->getNamespace() == NS_IMAGE ? wfLocalFile( $title ) : false; |
179 | 168 | $thumb = $image && $image->exists() ? $image->transform( array( 'width' => 120, 'height' => 120 ), 0 ) : false; |
180 | 169 | |
Index: trunk/extensions/Nuke/Nuke.php |
— | — | @@ -4,7 +4,7 @@ |
5 | 5 | die( 'Not an entry point.' ); |
6 | 6 | } |
7 | 7 | |
8 | | -define( 'Nuke_VERSION', '1.1.1' ); |
| 8 | +define( 'Nuke_VERSION', '1.1.2' ); |
9 | 9 | |
10 | 10 | $dir = dirname(__FILE__) . '/'; |
11 | 11 | |
— | — | @@ -26,3 +26,19 @@ |
27 | 27 | $wgAutoloadClasses['SpecialNuke'] = $dir . 'Nuke_body.php'; |
28 | 28 | $wgSpecialPages['Nuke'] = 'SpecialNuke'; |
29 | 29 | $wgSpecialPageGroups['Nuke'] = 'pagetools'; |
| 30 | + |
| 31 | +// Resource loader modules |
| 32 | +$moduleTemplate = array( |
| 33 | + 'localBasePath' => dirname( __FILE__ ) . '/', |
| 34 | + 'remoteExtPath' => 'Nuke/' |
| 35 | +); |
| 36 | + |
| 37 | +$wgResourceModules['ext.nuke'] = $moduleTemplate + array( |
| 38 | + 'scripts' => array( |
| 39 | + 'ext.nuke.js' |
| 40 | + ), |
| 41 | + 'messages' => array( |
| 42 | + ) |
| 43 | +); |
| 44 | + |
| 45 | +unset( $moduleTemplate ); |
Index: trunk/extensions/Nuke/ext.nuke.js |
— | — | @@ -0,0 +1,18 @@ |
| 2 | +/** |
| 3 | + * JavasSript for the Nuke MediaWiki extension. |
| 4 | + * @see https://www.mediawiki.org/wiki/Extension:Nuke |
| 5 | + * |
| 6 | + * @licence GNU GPL v2 or later |
| 7 | + * @author Jeroen De Dauw <jeroendedauw at gmail dot com> |
| 8 | + */ |
| 9 | + |
| 10 | +(function( $, mw ) { $( document ).ready( function() { |
| 11 | + |
| 12 | + function selectPages( check ) { |
| 13 | + $( 'input[type=checkbox]' ).prop( 'checked', check ) |
| 14 | + } |
| 15 | + |
| 16 | + $( '#toggleall' ).click( function(){ selectPages( true ); } ); |
| 17 | + $( '#togglenone' ).click( function(){ selectPages( false ); } ); |
| 18 | + |
| 19 | +} ); })( window.jQuery, window.mediaWiki ); |
\ No newline at end of file |