TheDJ has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/350197 )

Change subject: Remove printable version in favor of JS print
......................................................................

Remove printable version in favor of JS print

Only add a print link for JS enhanced views, and directly use the JS
print option. Due to async loading of Javascript, we need to avoid the
user interacting too soon with the link. For now do this by adapting
the style. Ideally, we would add 'href' atttribute at a later moment,
but not sure if BaseTemplate has provisions for that.
Alternative to I7faecdbc2ddc0c15a9f31ca6414ede81fa93462a

Bug: T24256
Change-Id: Ic3dc15e578ce4a94959285c9ae579e9088423544
---
M includes/skins/BaseTemplate.php
M resources/src/mediawiki.skinning/interface.css
M resources/src/mediawiki/page/ready.js
3 files changed, 20 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/97/350197/1

diff --git a/includes/skins/BaseTemplate.php b/includes/skins/BaseTemplate.php
index 5868904..48301ed 100644
--- a/includes/skins/BaseTemplate.php
+++ b/includes/skins/BaseTemplate.php
@@ -91,10 +91,10 @@
                        }
                }
                if ( isset( $this->data['nav_urls']['print'] ) && 
$this->data['nav_urls']['print'] ) {
-                       $toolbox['print'] = $this->data['nav_urls']['print'];
+                       $toolbox['print'];// = $this->data['nav_urls']['print'];
                        $toolbox['print']['id'] = 't-print';
-                       $toolbox['print']['rel'] = 'alternate';
                        $toolbox['print']['msg'] = 'printableversion';
+                       $toolbox['print']['href'] = '';
                }
                if ( isset( $this->data['nav_urls']['permalink'] ) && 
$this->data['nav_urls']['permalink'] ) {
                        $toolbox['permalink'] = 
$this->data['nav_urls']['permalink'];
diff --git a/resources/src/mediawiki.skinning/interface.css 
b/resources/src/mediawiki.skinning/interface.css
index c6d5082..ac11858 100644
--- a/resources/src/mediawiki.skinning/interface.css
+++ b/resources/src/mediawiki.skinning/interface.css
@@ -79,3 +79,16 @@
 span.subpages {
        display: block;
 }
+
+.client-nojs #t-print {
+       display: none;
+}
+#t-print:not(.loaded) a,
+#t-print:not(.loaded) a:link,
+#t-print:not(.loaded) a:visited,
+#t-print:not(.loaded) a:active {
+       cursor: default;
+       opacity: 0.1;
+       text-decoration: none;
+       color: black !important;
+}
diff --git a/resources/src/mediawiki/page/ready.js 
b/resources/src/mediawiki/page/ready.js
index d5a667e..220658c 100644
--- a/resources/src/mediawiki/page/ready.js
+++ b/resources/src/mediawiki/page/ready.js
@@ -58,6 +58,11 @@
                         */
                        mw.hook( 'wikipage.categories' ).fire( $nodes );
                }
+
+               $( '#t-print' ).addClass( 'loaded' ).click( function( event ) {
+                       window.print();
+                       event.preventDefault();
+               } );
        } );
 
 }( mediaWiki, jQuery ) );

-- 
To view, visit https://gerrit.wikimedia.org/r/350197
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic3dc15e578ce4a94959285c9ae579e9088423544
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: TheDJ <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to