Mattflaschen has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/80336


Change subject: Hide thank link when there is no JavaScript
......................................................................

Hide thank link when there is no JavaScript

This is a quick fix, so users without JavaScript will not see a
completely broken link.

A known issue with the change is that it shows a dangling pipe.
Solutions are discussed at bug 49161.

Bug: 49161
Change-Id: I8b2988e9391a77a2a011dd9952ec6b5ad488e8ce
---
M Thanks.hooks.php
M Thanks.php
A modules/ext.thanks.thank.css
3 files changed, 13 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Thanks 
refs/changes/36/80336/1

diff --git a/Thanks.hooks.php b/Thanks.hooks.php
index 0733cbc..362113a 100644
--- a/Thanks.hooks.php
+++ b/Thanks.hooks.php
@@ -87,7 +87,8 @@
                        && $context->getUser()->isLoggedIn()
                ) {
                        // Load the module for the thank links
-                       $context->getOutput()->addModules( array( 'ext.thanks' 
) );
+                       $context->getOutput()->addModuleStyles( array( 
'ext.thanks' ) );
+                       $context->getOutput()->addModules( array( 
'ext.thanks.js' ) );
                        $context->getOutput()->addJsConfigVars( 
'thanks-confirmation-required',
                                $wgThanksConfirmationRequired );
                }
@@ -108,7 +109,8 @@
                        && $diff->getUser()->isLoggedIn()
                ) {
                        // Load the module for the thank link
-                       $diff->getOutput()->addModules( array( 'ext.thanks' ) );
+                       $diff->getOutput()->addModuleStyles( array( 
'ext.thanks' ) );
+                       $diff->getOutput()->addModules( array( 'ext.thanks.js' 
) );
                        $diff->getOutput()->addJsConfigVars( 
'thanks-confirmation-required',
                                $wgThanksConfirmationRequired );
                }
diff --git a/Thanks.php b/Thanks.php
index 64d50b8..c55cde9 100644
--- a/Thanks.php
+++ b/Thanks.php
@@ -61,6 +61,12 @@
 
 // Register modules
 $wgResourceModules['ext.thanks'] = array(
+       'styles' => 'ext.thanks.thank.css',
+       'localBasePath' => $dir . '/modules',
+       'remoteExtPath' => 'Thanks/modules',
+);
+
+$wgResourceModules['ext.thanks.js'] = array(
        'scripts' => array(
                'ext.thanks.thank.js',
        ),
diff --git a/modules/ext.thanks.thank.css b/modules/ext.thanks.thank.css
new file mode 100644
index 0000000..4469d6b
--- /dev/null
+++ b/modules/ext.thanks.thank.css
@@ -0,0 +1,3 @@
+.client-nojs .mw-thanks-thank-link {
+       display: none;
+}

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I8b2988e9391a77a2a011dd9952ec6b5ad488e8ce
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Thanks
Gerrit-Branch: master
Gerrit-Owner: Mattflaschen <[email protected]>
Gerrit-Reviewer: jenkins-bot

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

Reply via email to