מדיה ויקי:Common.js: הבדלים בין גרסאות בדף
create search box .click events after the collapsible hook fires |
cleanup for readabiltiy in the search meta-strings function |
||
| שורה 229: | שורה 229: | ||
if ( mw.config.get( 'wgCanonicalSpecialPageName' ) === 'Search' ) { | if ( mw.config.get( 'wgCanonicalSpecialPageName' ) === 'Search' ) { | ||
mw.hook( 'he.wikipedia.collapsetables.loaded' ).add( function () { | mw.hook( 'he.wikipedia.collapsetables.loaded' ).add( function () { | ||
$( 'span.mw-search-meta-string' ).wrap( $( '<a>' ) | 'use strict'; | ||
var $searchBox = $( '#searchText input' ), | |||
$metaStringsTable = $( '#mw-search-meta-strings' ); | |||
$metaStringsTable.find( 'span.mw-search-meta-string' ).wrap( $( '<a>' ) | |||
.click( function( e ) { | .click( function( e ) { | ||
var currentText, newText; | |||
e.preventDefault(); | e.preventDefault(); | ||
searchBox.val ( | currentText = $searchBox.val(); | ||
newText = $( this ).text(); | |||
$searchBox.val( currentText + newText ); | |||
} ) | } ) | ||
); | ); | ||
| שורה 242: | שורה 249: | ||
// Make the table appear only after the collapsible styles are loaded, | // Make the table appear only after the collapsible styles are loaded, | ||
// so that it won't delay showing the search results | // so that it won't delay showing the search results | ||
$ | $metaStringsTable.css( 'display', 'table' ); | ||
} ); | } ); | ||
} | } | ||