Jdlrobson has uploaded a new change for review.
https://gerrit.wikimedia.org/r/57554
Change subject: Moving zero specific code over to Zero
......................................................................
Moving zero specific code over to Zero
Change-Id: I1f0fe8ad1ea2b52031079f52d6e25b5fcf44d7af
---
M MobileFrontend.php
M includes/MobileFrontend.hooks.php
D javascripts/modules/mf-banner.js
D stylesheets/modules/mf-banner.css
D tests/js/test_banner.js
5 files changed, 0 insertions(+), 139 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/MobileFrontend
refs/changes/54/57554/1
diff --git a/MobileFrontend.php b/MobileFrontend.php
index 1067575..979d64f 100644
--- a/MobileFrontend.php
+++ b/MobileFrontend.php
@@ -219,7 +219,6 @@
'javascripts/common/mf-application.js',
'javascripts/common/mf-history.js',
'javascripts/common/mf-settings.js',
- 'javascripts/modules/mf-banner.js',
'javascripts/modules/mf-stop-mobile-redirect.js',
),
'position' => 'bottom',
@@ -387,7 +386,6 @@
$wgResourceModules['mobile.stable.styles'] = $wgMFMobileResourceBoilerplate +
array(
'styles' => array(
'stylesheets/modules/mf-search.css',
- 'stylesheets/modules/mf-banner.css',
'stylesheets/modules/mf-toggle.css',
'stylesheets/modules/mf-references.css',
'stylesheets/modules/mf-cleanuptemplates.css',
diff --git a/includes/MobileFrontend.hooks.php
b/includes/MobileFrontend.hooks.php
index ce11dfa..1c80708 100644
--- a/includes/MobileFrontend.hooks.php
+++ b/includes/MobileFrontend.hooks.php
@@ -208,7 +208,6 @@
'javascripts/widgets/progress-bar.js',
'tests/js/widgets/test_progress-bar.js',
'javascripts/modules/mf-search.js',
'tests/js/test_beta_opensearch.js',
'javascripts/common/mf-settings.js',
'tests/js/test_settings.js',
- 'javascripts/modules/mf-banner.js',
'tests/js/test_banner.js',
'javascripts/modules/mf-toggle.js',
'tests/js/test_toggle.js',
'javascripts/modules/mf-toggle-dynamic.js',
'javascripts/actions/mf-edit.js',
'tests/js/test_mf-edit.js',
diff --git a/javascripts/modules/mf-banner.js b/javascripts/modules/mf-banner.js
deleted file mode 100644
index c705831..0000000
--- a/javascripts/modules/mf-banner.js
+++ /dev/null
@@ -1,48 +0,0 @@
-( function( M ) {
-var m = ( function() {
- var $ = M.jQuery;
-
- function initBanner( banner ) {
- var cookieNameZeroVisibility = banner.getAttribute( 'id' ),
- settings = M.settings,
- saveUserSetting = settings.saveUserSetting,
- getUserSetting = settings.getUserSetting,
- visibility,
- dismissNotification = banner.getElementsByTagName(
'button' )[ 0 ];
-
- if ( dismissNotification ) {
- visibility = getUserSetting( cookieNameZeroVisibility );
-
- if ( visibility === 'off' ) {
- banner.style.display = 'none';
- }
-
- dismissNotification.onclick = function() {
- banner.parentNode.removeChild( banner );
- saveUserSetting( cookieNameZeroVisibility,
'off',
- // FIXME: currently we only resort to
cookie saving for the zero rated banners to avoid cache fragmentation
- // (this has side effect that any
banners shown on pages which do not support localStorage are not supported)
- 'zeroRatedBannerVisibility' ===
cookieNameZeroVisibility );
- };
- }
- }
-
- function init() {
- if ( $ ) {
- $( '.mw-mf-banner' ).each( function() {
- if ( $( this ).find( 'button.notify-close'
).length === 0 &&
- !$( this ).hasClass(
'mw-mf-banner-undismissable' ) ) {
- $( '<button class="notify-close">'
).text( '×' ).appendTo( this );
- }
- initBanner( this );
- } );
- }
- }
-
- return {
- init: init,
- initBanner: initBanner
- };
-}());
-M.define( 'banner', m );
-}( mw.mobileFrontend ));
diff --git a/stylesheets/modules/mf-banner.css
b/stylesheets/modules/mf-banner.css
deleted file mode 100644
index 90fbdb6..0000000
--- a/stylesheets/modules/mf-banner.css
+++ /dev/null
@@ -1,58 +0,0 @@
-/* ZERO-RATED BANNERS
-moved from beta_common.css in
-Change-Id: Ia25126d950ee87cbc76f2e91d679cdd27405ee51
-*/
-.mw-mf-banner {
- position: relative;
- width: 100%;
- z-index: 99;
- background: #F4A83D;
- display: block;
- border-bottom: 1px solid #D6800C;
- font-weight: bold;
- padding: 0;
- text-align: center;
- color: #735005;
- font-family: Tahoma, sans-serif;
-}
-.mw-mf-banner .mw-mf-message,
-.mw-mf-banner button {
- padding-top: 10px;
- padding-bottom: 10px;
-}
-.android.mw-mf-banner {
- display: none;
-}
-html.android .android.mw-mf-banner {
- display: block;
-}
-.mw-mf-banner a {
- text-decoration: underline;
- color: #735005;
-}
-.mw-mf-banner button.notify-close {
- position: absolute;
- right: 2px;
- top: 2px;
- background-color: #FAD163;
- margin-right: 0;
- border: 2px solid #735005;
-}
-.mw-mf-banner p {
- line-height: normal;
-}
-.mw-mf-banner .mw-mf-message {
- margin: 0;
- color: #ffffff;
- font-weight: bold;
- text-align: center;
- display: block;
-}
-.mw-mf-banner.mw-mf-banner-undismissable {
- color: #ffffff;
- background-color: red;
-}
-.mw-mf-banner.mw-mf-banner-undismissable a {
- text-decoration: underline;
- color: #ffffff;
-}
diff --git a/tests/js/test_banner.js b/tests/js/test_banner.js
deleted file mode 100644
index aa6be4c..0000000
--- a/tests/js/test_banner.js
+++ /dev/null
@@ -1,30 +0,0 @@
-( function ( $, MFEB, settings ) {
-var BANNER_COOKIE_NAME = "zero-rated-banner";
-QUnit.module("MobileFrontend banner.js: notifications", {
- setup: function() {
- localStorage.clear();
- settings.removeCookie(BANNER_COOKIE_NAME);
- $( '<div id="zero-rated-banner"
class="mw-mf-banner"><button></div>' ).appendTo( document.body );
- },
- teardown: function() {
- $( '#zero-rated-banner' ).remove();
- settings.removeCookie(BANNER_COOKIE_NAME);
- }
-});
-
-QUnit.test( 'MobileFrontend banner.js: dismiss notification', 5, function() {
- var cookieStart, cookieEnd;
- MFEB.init();
- cookieStart = settings.getUserSetting( BANNER_COOKIE_NAME );
- strictEqual(cookieStart, null, "no cookie set at start");
- strictEqual($("#zero-rated-banner").is(":visible"), true, "banner
should be on show");
-
- // trigger dismiss event
- $( '#zero-rated-banner button' ).trigger( 'click' );
-
- cookieEnd = settings.getUserSetting( BANNER_COOKIE_NAME );
- strictEqual(cookieStart, null, "no cookie set at start");
- strictEqual($("#zero-rated-banner").is(":visible"), false, "banner
should now be hidden");
- strictEqual(cookieEnd, "off", "banner now set for dismissal");
-});
-}( jQuery, mw.mobileFrontend.require( 'banner' ), mw.mobileFrontend.settings)
);
--
To view, visit https://gerrit.wikimedia.org/r/57554
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I1f0fe8ad1ea2b52031079f52d6e25b5fcf44d7af
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: master
Gerrit-Owner: Jdlrobson <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits