Index: trunk/extensions/CentralNotice/special/SpecialBannerController.php |
— | — | @@ -51,10 +51,13 @@ |
52 | 52 | $.ajaxSetup({ cache: true }); |
53 | 53 | $.centralNotice = { |
54 | 54 | 'data': { |
55 | | - 'getVars': {} |
| 55 | + 'getVars': {}, |
| 56 | + 'bannerType': 'default' |
56 | 57 | }, |
57 | 58 | 'fn': { |
58 | 59 | '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; |
59 | 62 | // Get the requested banner |
60 | 63 | var bannerPageQuery = $.param( { |
61 | 64 | 'banner': bannerName, 'campaign': campaign, 'userlang': wgUserLanguage, |
— | — | @@ -159,7 +162,7 @@ |
160 | 163 | function getScriptFunctions() { |
161 | 164 | global $wgNoticeFundraisingUrl; |
162 | 165 | $script = <<<JAVASCRIPT |
163 | | -function insertBanner(bannerJson) { |
| 166 | +function insertBanner( bannerJson ) { |
164 | 167 | jQuery( 'div#centralNotice' ).prepend( bannerJson.bannerHtml ); |
165 | 168 | if ( bannerJson.autolink ) { |
166 | 169 | JAVASCRIPT; |
— | — | @@ -180,8 +183,9 @@ |
181 | 184 | } |
182 | 185 | } |
183 | 186 | } |
184 | | -function hideBanner( bannerType ) { |
| 187 | +function hideBanner() { |
185 | 188 | $( '#centralNotice' ).hide(); // Hide current banner |
| 189 | + var bannerType = $.centralNotice.data.bannerType; |
186 | 190 | if ( bannerType === undefined ) bannerType = 'default'; |
187 | 191 | setBannerHidingCookie( bannerType ); // Hide future banners of the same type |
188 | 192 | } |
— | — | @@ -191,6 +195,7 @@ |
192 | 196 | var work='centralnotice_'+bannerType+'=hide; expires=' + e.toGMTString() + '; path=/'; |
193 | 197 | document.cookie = work; |
194 | 198 | } |
| 199 | +// This function is deprecated |
195 | 200 | function toggleNotice() { |
196 | 201 | var notice = document.getElementById('centralNotice'); |
197 | 202 | if (!wgNoticeToggleState) { |
— | — | @@ -202,11 +207,7 @@ |
203 | 208 | } |
204 | 209 | wgNoticeToggleState = !wgNoticeToggleState; |
205 | 210 | } |
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 |
211 | 212 | function toggleNoticeCookie(state) { |
212 | 213 | var e = new Date(); |
213 | 214 | e.setTime( e.getTime() + (7*24*60*60*1000) ); // one week |