Index: trunk/phase3/resources/jquery/jquery.suggestions.js |
— | — | @@ -4,36 +4,36 @@ |
5 | 5 | * Usage: |
6 | 6 | * |
7 | 7 | * Set options: |
8 | | - * $('#textbox').suggestions( { option1: value1, option2: value2 } ); |
9 | | - * $('#textbox').suggestions( option, value ); |
| 8 | + * $( '#textbox' ).suggestions( { option1: value1, option2: value2 } ); |
| 9 | + * $( '#textbox' ).suggestions( option, value ); |
10 | 10 | * Get option: |
11 | | - * value = $('#textbox').suggestions( option ); |
| 11 | + * value = $( '#textbox' ).suggestions( option ); |
12 | 12 | * Initialize: |
13 | | - * $('#textbox').suggestions(); |
| 13 | + * $( '#textbox' ).suggestions(); |
14 | 14 | * |
15 | 15 | * Options: |
16 | 16 | * |
17 | 17 | * fetch(query): Callback that should fetch suggestions and set the suggestions property. Executed in the context of the |
18 | | - * textbox |
19 | | - * Type: Function |
| 18 | + * textbox |
| 19 | + * Type: Function |
20 | 20 | * cancel: Callback function to call when any pending asynchronous suggestions fetches should be canceled. |
21 | | - * Executed in the context of the textbox |
| 21 | + * Executed in the context of the textbox |
22 | 22 | * Type: Function |
23 | 23 | * special: Set of callbacks for rendering and selecting |
24 | 24 | * Type: Object of Functions 'render' and 'select' |
25 | 25 | * result: Set of callbacks for rendering and selecting |
26 | 26 | * Type: Object of Functions 'render' and 'select' |
27 | 27 | * $region: jQuery selection of element to place the suggestions below and match width of |
28 | | - * Type: jQuery Object, Default: $(this) |
| 28 | + * Type: jQuery Object, Default: $(this) |
29 | 29 | * suggestions: Suggestions to display |
30 | | - * Type: Array of strings |
| 30 | + * Type: Array of strings |
31 | 31 | * maxRows: Maximum number of suggestions to display at one time |
32 | | - * Type: Number, Range: 1 - 100, Default: 7 |
| 32 | + * Type: Number, Range: 1 - 100, Default: 7 |
33 | 33 | * delay: Number of ms to wait for the user to stop typing |
34 | | - * Type: Number, Range: 0 - 1200, Default: 120 |
| 34 | + * Type: Number, Range: 0 - 1200, Default: 120 |
35 | 35 | * submitOnClick: Whether to submit the form containing the textbox when a suggestion is clicked |
36 | 36 | * Type: Boolean, Default: false |
37 | | - * maxExpandFactor: Maximum suggestions box width relative to the textbox width. If set to e.g. 2, the suggestions box |
| 37 | + * maxExpandFactor: Maximum suggestions box width relative to the textbox width. If set to e.g. 2, the suggestions box |
38 | 38 | * will never be grown beyond 2 times the width of the textbox. |
39 | 39 | * Type: Number, Range: 1 - infinity, Default: 3 |
40 | 40 | * positionFromLeft: Whether to position the suggestion box with the left attribute or the right |
— | — | @@ -52,7 +52,7 @@ |
53 | 53 | if ( context.data.timerID != null ) { |
54 | 54 | clearTimeout( context.data.timerID ); |
55 | 55 | } |
56 | | - if ( typeof context.config.cancel == 'function' ) { |
| 56 | + if ( $.isFunction( context.config.cancel ) ) { |
57 | 57 | context.config.cancel.call( context.data.$textbox ); |
58 | 58 | } |
59 | 59 | }, |
— | — | @@ -66,7 +66,7 @@ |
67 | 67 | }, |
68 | 68 | /** |
69 | 69 | * Ask the user-specified callback for new suggestions. Any previous delayed call to this function still pending |
70 | | - * will be canceled. If the value in the textbox is empty or hasn't changed since the last time suggestions were fetched, this |
| 70 | + * will be canceled. If the value in the textbox is empty or hasn't changed since the last time suggestions were fetched, this |
71 | 71 | * function does nothing. |
72 | 72 | * @param {Boolean} delayed Whether or not to delay this by the currently configured amount of time |
73 | 73 | */ |
— | — | @@ -74,12 +74,12 @@ |
75 | 75 | // Only fetch if the value in the textbox changed and is not empty |
76 | 76 | // if the textbox is empty then clear the result div, but leave other settings intouched |
77 | 77 | function maybeFetch() { |
78 | | - if ( context.data.$textbox.val().length == 0 ) { |
| 78 | + if ( context.data.$textbox.val().length === 0 ) { |
79 | 79 | context.data.$container.hide(); |
80 | 80 | context.data.prevText = ''; |
81 | 81 | } else if ( context.data.$textbox.val() !== context.data.prevText ) { |
82 | | - if ( typeof context.config.fetch == 'function' ) { |
83 | | - context.data.prevText = context.data.$textbox.val(); |
| 82 | + if ( typeof context.config.fetch === 'function' ) { |
| 83 | + context.data.prevText = context.data.$textbox.val(); |
84 | 84 | context.config.fetch.call( context.data.$textbox, context.data.$textbox.val() ); |
85 | 85 | } |
86 | 86 | } |
— | — | @@ -99,7 +99,7 @@ |
100 | 100 | }, |
101 | 101 | special: function( context ) { |
102 | 102 | // Allow custom rendering - but otherwise don't do any rendering |
103 | | - if ( typeof context.config.special.render == 'function' ) { |
| 103 | + if ( typeof context.config.special.render === 'function' ) { |
104 | 104 | // Wait for the browser to update the value |
105 | 105 | setTimeout( function() { |
106 | 106 | // Render special |
— | — | @@ -126,8 +126,8 @@ |
127 | 127 | case 'suggestions': |
128 | 128 | context.config[property] = value; |
129 | 129 | // Update suggestions |
130 | | - if ( typeof context.data !== 'undefined' ) { |
131 | | - if ( context.data.$textbox.val().length == 0 ) { |
| 130 | + if ( context.data !== undefined ) { |
| 131 | + if ( context.data.$textbox.val().length === 0 ) { |
132 | 132 | // Hide the div when no suggestion exist |
133 | 133 | context.data.$container.hide(); |
134 | 134 | } else { |
— | — | @@ -135,17 +135,17 @@ |
136 | 136 | context.data.$container.show(); |
137 | 137 | // Update the size and position of the list |
138 | 138 | var newCSS = { |
139 | | - 'top': context.config.$region.offset().top + context.config.$region.outerHeight(), |
140 | | - 'bottom': 'auto', |
141 | | - 'width': context.config.$region.outerWidth(), |
142 | | - 'height': 'auto' |
| 139 | + top: context.config.$region.offset().top + context.config.$region.outerHeight(), |
| 140 | + bottom: 'auto', |
| 141 | + width: context.config.$region.outerWidth(), |
| 142 | + height: 'auto' |
143 | 143 | }; |
144 | 144 | if ( context.config.positionFromLeft ) { |
145 | | - newCSS['left'] = context.config.$region.offset().left; |
146 | | - newCSS['right'] = 'auto'; |
| 145 | + newCSS.left = context.config.$region.offset().left; |
| 146 | + newCSS.right = 'auto'; |
147 | 147 | } else { |
148 | | - newCSS['left'] = 'auto'; |
149 | | - newCSS['right'] = $( 'body' ).width() - ( context.config.$region.offset().left + context.config.$region.outerWidth() ); |
| 148 | + newCSS.left = 'auto'; |
| 149 | + newCSS.right = $( 'body' ).width() - ( context.config.$region.offset().left + context.config.$region.outerWidth() ); |
150 | 150 | } |
151 | 151 | context.data.$container.css( newCSS ); |
152 | 152 | var $results = context.data.$container.children( '.suggestions-results' ); |
— | — | @@ -155,7 +155,7 @@ |
156 | 156 | var matchedText = null; |
157 | 157 | for ( var i = 0; i < context.config.suggestions.length; i++ ) { |
158 | 158 | var text = context.config.suggestions[i]; |
159 | | - var $result = $( '<div />' ) |
| 159 | + var $result = $( '<div>' ) |
160 | 160 | .addClass( 'suggestions-result' ) |
161 | 161 | .attr( 'rel', i ) |
162 | 162 | .data( 'text', context.config.suggestions[i] ) |
— | — | @@ -167,18 +167,18 @@ |
168 | 168 | } ) |
169 | 169 | .appendTo( $results ); |
170 | 170 | // Allow custom rendering |
171 | | - if ( typeof context.config.result.render == 'function' ) { |
| 171 | + if ( typeof context.config.result.render === 'function' ) { |
172 | 172 | context.config.result.render.call( $result, context.config.suggestions[i] ); |
173 | 173 | } else { |
174 | 174 | // Add <span> with text |
175 | 175 | if( context.config.highlightInput ) { |
176 | 176 | matchedText = context.data.prevText; |
177 | 177 | } |
178 | | - $result.append( $( '<span />' ) |
| 178 | + $result.append( $( '<span>' ) |
179 | 179 | .css( 'whiteSpace', 'nowrap' ) |
180 | 180 | .text( text ) |
181 | 181 | ); |
182 | | - |
| 182 | + |
183 | 183 | // Widen results box if needed |
184 | 184 | // New width is only calculated here, applied later |
185 | 185 | var $span = $result.children( 'span' ); |
— | — | @@ -223,25 +223,25 @@ |
224 | 224 | highlight: function( context, result, updateTextbox ) { |
225 | 225 | var selected = context.data.$container.find( '.suggestions-result-current' ); |
226 | 226 | if ( !result.get || selected.get( 0 ) != result.get( 0 ) ) { |
227 | | - if ( result == 'prev' ) { |
| 227 | + if ( result === 'prev' ) { |
228 | 228 | if( selected.is( '.suggestions-special' ) ) { |
229 | | - result = context.data.$container.find( '.suggestions-result:last' ) |
| 229 | + result = context.data.$container.find( '.suggestions-result:last' ); |
230 | 230 | } else { |
231 | 231 | result = selected.prev(); |
232 | | - if ( selected.length == 0 ) { |
| 232 | + if ( selected.length === 0 ) { |
233 | 233 | // we are at the beginning, so lets jump to the last item |
234 | | - if ( context.data.$container.find( '.suggestions-special' ).html() != "" ) { |
| 234 | + if ( context.data.$container.find( '.suggestions-special' ).html() !== '' ) { |
235 | 235 | result = context.data.$container.find( '.suggestions-special' ); |
236 | 236 | } else { |
237 | 237 | result = context.data.$container.find( '.suggestions-results div:last' ); |
238 | 238 | } |
239 | 239 | } |
240 | 240 | } |
241 | | - } else if ( result == 'next' ) { |
242 | | - if ( selected.length == 0 ) { |
| 241 | + } else if ( result === 'next' ) { |
| 242 | + if ( selected.length === 0 ) { |
243 | 243 | // No item selected, go to the first one |
244 | 244 | result = context.data.$container.find( '.suggestions-results div:first' ); |
245 | | - if ( result.length == 0 && context.data.$container.find( '.suggestions-special' ).html() != "" ) { |
| 245 | + if ( result.length === 0 && context.data.$container.find( '.suggestions-special' ).html() !== '' ) { |
246 | 246 | // No suggestion exists, go to the special one directly |
247 | 247 | result = context.data.$container.find( '.suggestions-special' ); |
248 | 248 | } |
— | — | @@ -250,8 +250,8 @@ |
251 | 251 | if ( selected.is( '.suggestions-special' ) ) { |
252 | 252 | result = $( [] ); |
253 | 253 | } else if ( |
254 | | - result.length == 0 && |
255 | | - context.data.$container.find( '.suggestions-special' ).html() != "" |
| 254 | + result.length === 0 && |
| 255 | + context.data.$container.find( '.suggestions-special' ).html() !== '' |
256 | 256 | ) { |
257 | 257 | // We were at the last item, jump to the specials! |
258 | 258 | result = context.data.$container.find( '.suggestions-special' ); |
— | — | @@ -262,7 +262,7 @@ |
263 | 263 | result.addClass( 'suggestions-result-current' ); |
264 | 264 | } |
265 | 265 | if ( updateTextbox ) { |
266 | | - if ( result.length == 0 || result.is( '.suggestions-special' ) ) { |
| 266 | + if ( result.length === 0 || result.is( '.suggestions-special' ) ) { |
267 | 267 | $.suggestions.restore( context ); |
268 | 268 | } else { |
269 | 269 | context.data.$textbox.val( result.data( 'text' ) ); |
— | — | @@ -278,8 +278,8 @@ |
279 | 279 | * @param key Integer Code of key pressed |
280 | 280 | */ |
281 | 281 | keypress: function( e, context, key ) { |
282 | | - var wasVisible = context.data.$container.is( ':visible' ); |
283 | | - var preventDefault = false; |
| 282 | + var wasVisible = context.data.$container.is( ':visible' ), |
| 283 | + preventDefault = false; |
284 | 284 | switch ( key ) { |
285 | 285 | // Arrow down |
286 | 286 | case 40: |
— | — | @@ -312,17 +312,17 @@ |
313 | 313 | context.data.$container.hide(); |
314 | 314 | preventDefault = wasVisible; |
315 | 315 | selected = context.data.$container.find( '.suggestions-result-current' ); |
316 | | - if ( selected.size() == 0 || context.data.selectedWithMouse ) { |
317 | | - // if nothing is selected OR if something was selected with the mouse, |
| 316 | + if ( selected.length === 0 || context.data.selectedWithMouse ) { |
| 317 | + // if nothing is selected OR if something was selected with the mouse, |
318 | 318 | // cancel any current requests and submit the form |
319 | 319 | $.suggestions.cancel( context ); |
320 | 320 | context.config.$region.closest( 'form' ).submit(); |
321 | 321 | } else if ( selected.is( '.suggestions-special' ) ) { |
322 | | - if ( typeof context.config.special.select == 'function' ) { |
| 322 | + if ( typeof context.config.special.select === 'function' ) { |
323 | 323 | context.config.special.select.call( selected, context.data.$textbox ); |
324 | 324 | } |
325 | 325 | } else { |
326 | | - if ( typeof context.config.result.select == 'function' ) { |
| 326 | + if ( typeof context.config.result.select === 'function' ) { |
327 | 327 | $.suggestions.highlight( context, selected, true ); |
328 | 328 | context.config.result.select.call( selected, context.data.$textbox ); |
329 | 329 | } else { |
— | — | @@ -341,17 +341,17 @@ |
342 | 342 | } |
343 | 343 | }; |
344 | 344 | $.fn.suggestions = function() { |
345 | | - |
| 345 | + |
346 | 346 | // Multi-context fields |
347 | 347 | var returnValue = null; |
348 | 348 | var args = arguments; |
349 | | - |
| 349 | + |
350 | 350 | $(this).each( function() { |
351 | 351 | |
352 | 352 | /* Construction / Loading */ |
353 | | - |
| 353 | + |
354 | 354 | var context = $(this).data( 'suggestions-context' ); |
355 | | - if ( typeof context == 'undefined' || context == null ) { |
| 355 | + if ( context === undefined || context === null ) { |
356 | 356 | context = { |
357 | 357 | config: { |
358 | 358 | 'fetch' : function() {}, |
— | — | @@ -369,17 +369,17 @@ |
370 | 370 | } |
371 | 371 | }; |
372 | 372 | } |
373 | | - |
| 373 | + |
374 | 374 | /* API */ |
375 | | - |
| 375 | + |
376 | 376 | // Handle various calling styles |
377 | 377 | if ( args.length > 0 ) { |
378 | | - if ( typeof args[0] == 'object' ) { |
| 378 | + if ( typeof args[0] === 'object' ) { |
379 | 379 | // Apply set of properties |
380 | 380 | for ( var key in args[0] ) { |
381 | 381 | $.suggestions.configure( context, key, args[0][key] ); |
382 | 382 | } |
383 | | - } else if ( typeof args[0] == 'string' ) { |
| 383 | + } else if ( typeof args[0] === 'string' ) { |
384 | 384 | if ( args.length > 1 ) { |
385 | 385 | // Set property values |
386 | 386 | $.suggestions.configure( context, args[0], args[1] ); |
— | — | @@ -389,10 +389,10 @@ |
390 | 390 | } |
391 | 391 | } |
392 | 392 | } |
393 | | - |
| 393 | + |
394 | 394 | /* Initialization */ |
395 | | - |
396 | | - if ( typeof context.data == 'undefined' ) { |
| 395 | + |
| 396 | + if ( context.data === undefined ) { |
397 | 397 | context.data = { |
398 | 398 | // ID of running timer |
399 | 399 | 'timerID': null, |
— | — | @@ -407,23 +407,23 @@ |
408 | 408 | }; |
409 | 409 | // Setup the css for positioning the results box |
410 | 410 | var newCSS = { |
411 | | - 'top': Math.round( context.data.$textbox.offset().top + context.data.$textbox.outerHeight() ), |
412 | | - 'width': context.data.$textbox.outerWidth(), |
413 | | - 'display': 'none' |
| 411 | + top: Math.round( context.data.$textbox.offset().top + context.data.$textbox.outerHeight() ), |
| 412 | + width: context.data.$textbox.outerWidth(), |
| 413 | + display: 'none' |
414 | 414 | }; |
415 | 415 | if ( context.config.positionFromLeft ) { |
416 | | - newCSS['left'] = context.config.$region.offset().left; |
417 | | - newCSS['right'] = 'auto'; |
| 416 | + newCSS.left = context.config.$region.offset().left; |
| 417 | + newCSS.right = 'auto'; |
418 | 418 | } else { |
419 | | - newCSS['left'] = 'auto'; |
420 | | - newCSS['right'] = $( 'body' ).width() - ( context.config.$region.offset().left + context.config.$region.outerWidth() ); |
| 419 | + newCSS.left = 'auto'; |
| 420 | + newCSS.right = $( 'body' ).width() - ( context.config.$region.offset().left + context.config.$region.outerWidth() ); |
421 | 421 | } |
422 | | - |
423 | | - context.data.$container = $( '<div />' ) |
| 422 | + |
| 423 | + context.data.$container = $( '<div>' ) |
424 | 424 | .css( newCSS ) |
425 | 425 | .addClass( 'suggestions' ) |
426 | 426 | .append( |
427 | | - $( '<div />' ).addClass( 'suggestions-results' ) |
| 427 | + $( '<div>' ).addClass( 'suggestions-results' ) |
428 | 428 | // Can't use click() because the container div is hidden when the textbox loses focus. Instead, |
429 | 429 | // listen for a mousedown followed by a mouseup on the same div |
430 | 430 | .mousedown( function( e ) { |
— | — | @@ -438,14 +438,14 @@ |
439 | 439 | } |
440 | 440 | $.suggestions.highlight( context, $result, true ); |
441 | 441 | context.data.$container.hide(); |
442 | | - if ( typeof context.config.result.select == 'function' ) { |
| 442 | + if ( typeof context.config.result.select === 'function' ) { |
443 | 443 | context.config.result.select.call( $result, context.data.$textbox ); |
444 | 444 | } |
445 | 445 | context.data.$textbox.focus(); |
446 | 446 | } ) |
447 | 447 | ) |
448 | 448 | .append( |
449 | | - $( '<div />' ).addClass( 'suggestions-special' ) |
| 449 | + $( '<div>' ).addClass( 'suggestions-special' ) |
450 | 450 | // Can't use click() because the container div is hidden when the textbox loses focus. Instead, |
451 | 451 | // listen for a mousedown followed by a mouseup on the same div |
452 | 452 | .mousedown( function( e ) { |
— | — | @@ -459,7 +459,7 @@ |
460 | 460 | return; |
461 | 461 | } |
462 | 462 | context.data.$container.hide(); |
463 | | - if ( typeof context.config.special.select == 'function' ) { |
| 463 | + if ( typeof context.config.special.select === 'function' ) { |
464 | 464 | context.config.special.select.call( $special, context.data.$textbox ); |
465 | 465 | } |
466 | 466 | context.data.$textbox.focus(); |
— | — | @@ -477,9 +477,9 @@ |
478 | 478 | .attr( 'autocomplete', 'off') |
479 | 479 | .keydown( function( e ) { |
480 | 480 | // Store key pressed to handle later |
481 | | - context.data.keypressed = ( e.keyCode == undefined ) ? e.which : e.keyCode; |
| 481 | + context.data.keypressed = ( e.keyCode === undefined ) ? e.which : e.keyCode; |
482 | 482 | context.data.keypressedCount = 0; |
483 | | - |
| 483 | + |
484 | 484 | switch ( context.data.keypressed ) { |
485 | 485 | // This preventDefault logic is duplicated from |
486 | 486 | // $.suggestions.keypress(), which sucks |
— | — | @@ -503,7 +503,7 @@ |
504 | 504 | .keyup( function( e ) { |
505 | 505 | // Some browsers won't throw keypress() for arrow keys. If we got a keydown and a keyup without a |
506 | 506 | // keypress in between, solve it |
507 | | - if ( context.data.keypressedCount == 0 ) { |
| 507 | + if ( context.data.keypressedCount === 0 ) { |
508 | 508 | $.suggestions.keypress( e, context, context.data.keypressed ); |
509 | 509 | } |
510 | 510 | } ) |
Index: trunk/phase3/resources/jquery/jquery.messageBox.js |
— | — | @@ -11,7 +11,7 @@ |
12 | 12 | * @license CC-BY 3.0 <http://creativecommons.org/licenses/by/3.0> |
13 | 13 | * @license GPL2 <http://www.gnu.org/licenses/old-licenses/gpl-2.0.html> |
14 | 14 | */ |
15 | | -( function( $, mw ) { |
| 15 | +( function( $ ) { |
16 | 16 | // @return jQuery object of the message box |
17 | 17 | $.messageBoxNew = function( options ) { |
18 | 18 | options = $.extend( { |
— | — | @@ -19,16 +19,16 @@ |
20 | 20 | 'parent': 'body', // jQuery/CSS selector |
21 | 21 | 'insert': 'prepend' // 'prepend' or 'append' |
22 | 22 | }, options ); |
23 | | - var $curBox = $( '#'+ options.id ); |
| 23 | + var $curBox = $( '#' + options.id ); |
24 | 24 | // Only create a new box if it doesn't exist already |
25 | | - if ( $curBox.size() > 0 ) { |
| 25 | + if ( $curBox.length > 0 ) { |
26 | 26 | if ( $curBox.hasClass( 'js-messagebox' ) ) { |
27 | 27 | return $curBox; |
28 | 28 | } else { |
29 | 29 | return $curBox.addClass( 'js-messagebox' ); |
30 | 30 | } |
31 | 31 | } else { |
32 | | - var $newBox = $( '<div/>', { |
| 32 | + var $newBox = $( '<div>', { |
33 | 33 | 'id': options.id, |
34 | 34 | 'class': 'js-messagebox', |
35 | 35 | 'css': { |
— | — | @@ -63,8 +63,8 @@ |
64 | 64 | var groupID = options.target + '-' + options.group; |
65 | 65 | var $group = $( '#' + groupID ); |
66 | 66 | // Create group container if not existant |
67 | | - if ( $group.size() < 1 ) { |
68 | | - $group = $( '<div/>', { |
| 67 | + if ( $group.length < 1 ) { |
| 68 | + $group = $( '<div>', { |
69 | 69 | 'id': groupID, |
70 | 70 | 'class': 'js-messagebox-group' |
71 | 71 | }); |
— | — | @@ -79,12 +79,12 @@ |
80 | 80 | $group.hide(); |
81 | 81 | } else { |
82 | 82 | // Actual message addition |
83 | | - $group.prepend( $( '<p/>' ).append( options.message ) ).show(); |
| 83 | + $group.prepend( $( '<p>' ).append( options.message ) ).show(); |
84 | 84 | $target.slideDown(); |
85 | 85 | } |
86 | 86 | // If the last visible group was just hidden, slide the entire box up |
87 | 87 | // Othere wise slideDown (if already visible nothing will happen) |
88 | | - if ( $target.find( '> *:visible' ).size() === 0 ) { |
| 88 | + if ( $target.find( '> *:visible' ).length === 0 ) { |
89 | 89 | // to avoid a sudden dissapearance of the last group followed by |
90 | 90 | // a slide up of only the outline, show it for a second |
91 | 91 | $group.show(); |
— | — | @@ -95,4 +95,4 @@ |
96 | 96 | } |
97 | 97 | return $group; |
98 | 98 | }; |
99 | | -} )( jQuery, mediaWiki ); |
\ No newline at end of file |
| 99 | +} )( jQuery ); |
Index: trunk/phase3/resources/mediawiki/mediawiki.util.js |
— | — | @@ -84,15 +84,15 @@ |
85 | 85 | $tocTitle = $( '#toctitle' ), |
86 | 86 | $tocToggleLink = $( '#togglelink' ); |
87 | 87 | // Only add it if there is a TOC and there is no toggle added already |
88 | | - if ( $tocContainer.size() && $tocTitle.size() && !$tocToggleLink.size() ) { |
| 88 | + if ( $tocContainer.length && $tocTitle.length && !$tocToggleLink.length ) { |
89 | 89 | var hideTocCookie = $.cookie( 'mw_hidetoc' ); |
90 | | - $tocToggleLink = $( '<a href="#" class="internal" id="togglelink">' ) |
| 90 | + $tocToggleLink = $( '<a href="#" class="internal" id="togglelink"></a>' ) |
91 | 91 | .text( mw.msg( 'hidetoc' ) ) |
92 | 92 | .click( function(e){ |
93 | 93 | e.preventDefault(); |
94 | 94 | util.toggleToc( $(this) ); |
95 | 95 | } ); |
96 | | - $tocTitle.append( $tocToggleLink.wrap( '<span class="toctoggle">' ).parent().prepend( ' [' ).append( '] ' ) ); |
| 96 | + $tocTitle.append( $tocToggleLink.wrap( '<span class="toctoggle"></span>' ).parent().prepend( ' [' ).append( '] ' ) ); |
97 | 97 | |
98 | 98 | if ( hideTocCookie == '1' ) { |
99 | 99 | // Cookie says user want toc hidden |
— | — | @@ -187,7 +187,7 @@ |
188 | 188 | |
189 | 189 | // This function shouldn't be called if there's no TOC, |
190 | 190 | // but just in case... |
191 | | - if ( $tocList.size() ) { |
| 191 | + if ( $tocList.length ) { |
192 | 192 | if ( $tocList.is( ':hidden' ) ) { |
193 | 193 | $tocList.slideDown( 'fast', callback ); |
194 | 194 | $toggleLink.text( mw.msg( 'hidetoc' ) ); |
— | — | @@ -255,7 +255,7 @@ |
256 | 256 | 'updateTooltipAccessKeys' : function( nodeList ) { |
257 | 257 | var $nodes; |
258 | 258 | if ( !nodeList ) { |
259 | | - |
| 259 | + |
260 | 260 | // Rather than scanning all links, just the elements that |
261 | 261 | // contain the relevant links |
262 | 262 | this.updateTooltipAccessKeys( |