r99194 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r99193‎ | r99194 | r99195 >
Date:05:14, 7 October 2011
Author:kaldari
Status:ok
Tags:
Comment:
fix for Bug 31488 - hideBanner() no longer requires bannerType parameter, also removing ancient js function no longer used anywhere
Modified paths:
  • /trunk/extensions/CentralNotice/special/SpecialBannerController.php (modified) (history)

Diff [purge]

Index: trunk/extensions/CentralNotice/special/SpecialBannerController.php
@@ -51,10 +51,13 @@
5252 $.ajaxSetup({ cache: true });
5353 $.centralNotice = {
5454 'data': {
55 - 'getVars': {}
 55+ 'getVars': {},
 56+ 'bannerType': 'default'
5657 },
5758 'fn': {
5859 'loadBanner': function( bannerName, campaign, bannerType ) {
 60+ // Store the bannerType in case we need to set a banner hiding cookie later
 61+ $.centralNotice.data.bannerType = bannerType;
5962 // Get the requested banner
6063 var bannerPageQuery = $.param( {
6164 'banner': bannerName, 'campaign': campaign, 'userlang': wgUserLanguage,
@@ -159,7 +162,7 @@
160163 function getScriptFunctions() {
161164 global $wgNoticeFundraisingUrl;
162165 $script = <<<JAVASCRIPT
163 -function insertBanner(bannerJson) {
 166+function insertBanner( bannerJson ) {
164167 jQuery( 'div#centralNotice' ).prepend( bannerJson.bannerHtml );
165168 if ( bannerJson.autolink ) {
166169 JAVASCRIPT;
@@ -180,8 +183,9 @@
181184 }
182185 }
183186 }
184 -function hideBanner( bannerType ) {
 187+function hideBanner() {
185188 $( '#centralNotice' ).hide(); // Hide current banner
 189+ var bannerType = $.centralNotice.data.bannerType;
186190 if ( bannerType === undefined ) bannerType = 'default';
187191 setBannerHidingCookie( bannerType ); // Hide future banners of the same type
188192 }
@@ -191,6 +195,7 @@
192196 var work='centralnotice_'+bannerType+'=hide; expires=' + e.toGMTString() + '; path=/';
193197 document.cookie = work;
194198 }
 199+// This function is deprecated
195200 function toggleNotice() {
196201 var notice = document.getElementById('centralNotice');
197202 if (!wgNoticeToggleState) {
@@ -202,11 +207,7 @@
203208 }
204209 wgNoticeToggleState = !wgNoticeToggleState;
205210 }
206 -function toggleNoticeStyle(elems, display) {
207 - if(elems)
208 - for(var i=0;i<elems.length;i++)
209 - elems[i].style.display = display;
210 -}
 211+// This function is deprecated
211212 function toggleNoticeCookie(state) {
212213 var e = new Date();
213214 e.setTime( e.getTime() + (7*24*60*60*1000) ); // one week

Follow-up revisions

RevisionCommit summaryAuthorDate
r100100MFT r92510, r92676, r96496, r97304, r99160, r99165, r99169, r99176, r99178, r...awjrichards23:56, 17 October 2011

Status & tagging log