Print: prefer JS print over printable version.
[lhc/web/wiklou.git] / resources / src / mediawiki / page / ready.js
index d228f3e..758e20a 100644 (file)
@@ -1,6 +1,4 @@
 ( function ( mw, $ ) {
-       var supportsPlaceholder = 'placeholder' in document.createElement( 'input' );
-
        // Break out of framesets
        if ( mw.config.get( 'wgBreakFrames' ) ) {
                // Note: In IE < 9 strict comparison to window is non-standard (the standard didn't exist yet)
        }
 
        mw.hook( 'wikipage.content' ).add( function ( $content ) {
-               var $sortableTables;
+               var $sortable, $collapsible;
 
-               // Run jquery.placeholder polyfill if placeholder is not supported
-               if ( !supportsPlaceholder ) {
-                       $content.find( 'input[placeholder]' ).placeholder();
+               $collapsible = $content.find( '.mw-collapsible' );
+               if ( $collapsible.length ) {
+                       // Preloaded by Skin::getDefaultModules()
+                       mw.loader.using( 'jquery.makeCollapsible', function () {
+                               $collapsible.makeCollapsible();
+                       } );
                }
 
-               // Run jquery.makeCollapsible
-               $content.find( '.mw-collapsible' ).makeCollapsible();
-
-               // Lazy load jquery.tablesorter
-               $sortableTables = $content.find( 'table.sortable' );
-               if ( $sortableTables.length ) {
+               $sortable = $content.find( 'table.sortable' );
+               if ( $sortable.length ) {
+                       // Preloaded by Skin::getDefaultModules()
                        mw.loader.using( 'jquery.tablesorter', function () {
-                               $sortableTables.tablesorter();
+                               $sortable.tablesorter();
                        } );
                }
 
        $( function () {
                var $nodes;
 
-               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
                $( '[accesskey]' ).updateTooltipAccessKeys();
 
                         */
                        mw.hook( 'wikipage.categories' ).fire( $nodes );
                }
+
+               $( '#t-print' ).click( function ( e ) {
+                       window.print();
+                       e.preventDefault();
+               } );
        } );
 
 }( mediaWiki, jQuery ) );