2 var supportsPlaceholder
= 'placeholder' in document
.createElement( 'input' );
4 // Break out of framesets
5 if ( mw
.config
.get( 'wgBreakFrames' ) ) {
6 // Note: In IE < 9 strict comparison to window is non-standard (the standard didn't exist yet)
7 // it works only comparing to window.self or window.window (http://stackoverflow.com/q/4850978/319266)
8 if ( window
.top
!== window
.self
) {
9 // Un-trap us from framesets
10 window
.top
.location
.href
= location
.href
;
14 mw
.hook( 'wikipage.content' ).add( function ( $content
) {
15 var $sortable
, $collapsible
;
17 // Run jquery.placeholder polyfill if placeholder is not supported
18 if ( !supportsPlaceholder
) {
19 $content
.find( 'input[placeholder]' ).placeholder();
22 $collapsible
= $content
.find( '.mw-collapsible' );
23 if ( $collapsible
.length
) {
24 // Preloaded by Skin::getDefaultModules()
25 mw
.loader
.using( 'jquery.makeCollapsible', function () {
26 $collapsible
.makeCollapsible();
30 $sortable
= $content
.find( 'table.sortable' );
31 if ( $sortable
.length
) {
32 // Preloaded by Skin::getDefaultModules()
33 mw
.loader
.using( 'jquery.tablesorter', function () {
34 $sortable
.tablesorter();
38 // Run jquery.checkboxShiftClick
39 $content
.find( 'input[type="checkbox"]:not(.noshiftselect)' ).checkboxShiftClick();
42 // Things outside the wikipage content
46 if ( !supportsPlaceholder
) {
47 // Exclude content to avoid hitting it twice for the (first) wikipage content
48 $( 'input[placeholder]' ).not( '#mw-content-text input' ).placeholder();
51 // Add accesskey hints to the tooltips
52 $( '[accesskey]' ).updateTooltipAccessKeys();
54 $nodes
= $( '.catlinks[data-mw="interface"]' );
55 if ( $nodes
.length
) {
57 * Fired when categories are being added to the DOM
59 * It is encouraged to fire it before the main DOM is changed (when $content
60 * is still detached). However, this order is not defined either way, so you
61 * should only rely on $content itself.
63 * This includes the ready event on a page load (including post-edit loads)
64 * and when content has been previewed with LivePreview.
66 * @event wikipage_categories
68 * @param {jQuery} $content The most appropriate element containing the content,
71 mw
.hook( 'wikipage.categories' ).fire( $nodes
);
75 }( mediaWiki
, jQuery
) );