From 4ac9fa081a7c045f6a9f1cfc529d82423f485b2e Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Sun, 8 Dec 2013 09:55:49 +0100 Subject: Update to MediaWiki 1.22.0 --- resources/mediawiki.page/mediawiki.page.ready.js | 38 ++++++++++++++++-------- 1 file changed, 25 insertions(+), 13 deletions(-) (limited to 'resources/mediawiki.page/mediawiki.page.ready.js') diff --git a/resources/mediawiki.page/mediawiki.page.ready.js b/resources/mediawiki.page/mediawiki.page.ready.js index 684f582f..ee416d67 100644 --- a/resources/mediawiki.page/mediawiki.page.ready.js +++ b/resources/mediawiki.page/mediawiki.page.ready.js @@ -1,28 +1,40 @@ -( function ( mw, $ ) { - $( function () { +( function ( mw , $ ) { + var supportsPlaceholder = 'placeholder' in document.createElement( 'input' ); + + mw.hook( 'wikipage.content' ).add( function ( $content ) { var $sortableTables; - /* Emulate placeholder if not supported by browser */ - if ( !( 'placeholder' in document.createElement( 'input' ) ) ) { - $( 'input[placeholder]' ).placeholder(); + // Run jquery.placeholder polyfill if placeholder is not supported + if ( !supportsPlaceholder ) { + $content.find( 'input[placeholder]' ).placeholder(); } - /* Enable makeCollapsible */ - $( '.mw-collapsible' ).makeCollapsible(); + // Run jquery.makeCollapsible + $content.find( '.mw-collapsible' ).makeCollapsible(); - /* Lazy load jquery.tablesorter */ - $sortableTables = $( 'table.sortable' ); + // Lazy load jquery.tablesorter + $sortableTables = $content.find( 'table.sortable' ); if ( $sortableTables.length ) { mw.loader.using( 'jquery.tablesorter', function () { $sortableTables.tablesorter(); - }); + } ); } - /* Enable CheckboxShiftClick */ - $( 'input[type=checkbox]:not(.noshiftselect)' ).checkboxShiftClick(); + // Run jquery.checkboxShiftClick + $content.find( 'input[type="checkbox"]:not(.noshiftselect)' ).checkboxShiftClick(); + } ); + + // Things outside the wikipage content + $( function () { + + if ( !supportsPlaceholder ) { + // Exclude content to avoid hitting it twice for the (first) wikipage content + $( 'input[placeholder]' ).not( '#mw-content-text input' ).placeholder(); + } - /* Add accesskey hints to the tooltips */ + // Add accesskey hints to the tooltips mw.util.updateTooltipAccessKeys(); } ); + }( mediaWiki, jQuery ) ); -- cgit v1.2.2