jenkins-bot has submitted this change and it was merged.
Change subject: Make dismissable SiteNotices hidden by default so they don't
flash
......................................................................
Make dismissable SiteNotices hidden by default so they don't flash
Note this does not affect the accessibility of the SiteNotices.
Besides T108513, this also fixes the dismiss button jumping from the
top of the notice to the side during page load.
Also, updating a bug number in a comment to the Phabricator ID.
Bug: T108513
Change-Id: I7e5a4bedc30e3bfa32995ad38eaef729cca9c362
(cherry picked from commit 4479c9f309c0baec44b1955038fdab76968bbfa4)
---
M DismissableSiteNotice.hooks.php
M extension.json
M modules/ext.dismissableSiteNotice.css
M modules/ext.dismissableSiteNotice.js
4 files changed, 19 insertions(+), 3 deletions(-)
Approvals:
Krinkle: Looks good to me, approved
jenkins-bot: Verified
diff --git a/DismissableSiteNotice.hooks.php b/DismissableSiteNotice.hooks.php
index 86a739b..d5b5c91 100644
--- a/DismissableSiteNotice.hooks.php
+++ b/DismissableSiteNotice.hooks.php
@@ -21,6 +21,7 @@
$minor = (int) $skin->msg( 'sitenotice_id'
)->inContentLanguage()->text();
$out = $skin->getOutput();
+ $out->addModuleStyles(
'ext.dismissableSiteNotice.styles' );
$out->addModules( 'ext.dismissableSiteNotice' );
$out->addJsConfigVars( 'wgSiteNoticeId',
"$major.$minor" );
@@ -37,7 +38,7 @@
}
if ( $skin->getUser()->isAnon() ) {
- // Hide the sitenotice from search engines (see bug
9209 comment 4)
+ // Hide the sitenotice from search engines (see bug
T11209 comment 4)
// XXX: Does this actually work?
$notice = Html::inlineScript( Xml::encodeJsCall(
'document.write', array( $notice ) ) );
}
diff --git a/extension.json b/extension.json
index 223a23b..661cddb 100644
--- a/extension.json
+++ b/extension.json
@@ -27,7 +27,6 @@
"ResourceModules": {
"ext.dismissableSiteNotice": {
"scripts": "ext.dismissableSiteNotice.js",
- "styles": "ext.dismissableSiteNotice.css",
"dependencies": [
"jquery.cookie",
"mediawiki.util"
@@ -35,6 +34,13 @@
"targets": [
"desktop",
"mobile"
+ ]
+ },
+ "ext.dismissableSiteNotice.styles": {
+ "styles": "ext.dismissableSiteNotice.css",
+ "targets": [
+ "desktop",
+ "mobile"
],
"position": "top"
}
diff --git a/modules/ext.dismissableSiteNotice.css
b/modules/ext.dismissableSiteNotice.css
index bce13f6..c0cd490 100644
--- a/modules/ext.dismissableSiteNotice.css
+++ b/modules/ext.dismissableSiteNotice.css
@@ -1,3 +1,7 @@
+.client-js .mw-dismissable-notice {
+ display: none;
+}
+
.mw-dismissable-notice-close {
visibility: hidden;
}
diff --git a/modules/ext.dismissableSiteNotice.js
b/modules/ext.dismissableSiteNotice.js
index ba7e1de..4f11ff6 100644
--- a/modules/ext.dismissableSiteNotice.js
+++ b/modules/ext.dismissableSiteNotice.js
@@ -3,15 +3,20 @@
var cookieName = 'dismissSiteNotice',
siteNoticeId = mw.config.get( 'wgSiteNoticeId' );
+ // If no siteNoticeId is set, exit.
if ( !siteNoticeId ) {
return;
}
+ // If the user has the notice dismissal cookie set, exit.
if ( $.cookie( cookieName ) === siteNoticeId ) {
- mw.util.addCSS( '.mw-dismissable-notice { display: none; }' );
return;
}
+ // Otherwise, show the notice ...
+ mw.util.addCSS( '.client-js .mw-dismissable-notice { display: block; }'
);
+
+ // ... and enable the dismiss button.
$( function () {
$( '.mw-dismissable-notice-close' )
.css( 'visibility', 'visible' )
--
To view, visit https://gerrit.wikimedia.org/r/250157
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I7e5a4bedc30e3bfa32995ad38eaef729cca9c362
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/DismissableSiteNotice
Gerrit-Branch: wmf/1.27.0-wmf.4
Gerrit-Owner: Krinkle <[email protected]>
Gerrit-Reviewer: Kaldari <[email protected]>
Gerrit-Reviewer: Krinkle <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits