r83157 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r83156‎ | r83157 | r83158 >
Date:18:39, 3 March 2011
Author:catrope
Status:deferred
Tags:
Comment:
Narayam: Move setting the scheme cookie to setScheme(), and make sure the enabled cookie is always refreshed
Modified paths:
  • /trunk/extensions/Narayam/ext.narayam.core.js (modified) (history)

Diff [purge]

Index: trunk/extensions/Narayam/ext.narayam.core.js
@@ -225,7 +225,6 @@
226226 function updateSchemeFromSelect() {
227227 var scheme = $( this ).val();
228228 that.setScheme( scheme );
229 - $.cookie( 'narayam-scheme', scheme, { 'path': '/', 'expires': 30 } );
230229 }
231230
232231 /* Public functions */
@@ -305,6 +304,7 @@
306305 this.setScheme = function( name ) {
307306 if ( name in schemes ) {
308307 currentScheme = schemes[name];
 308+ $.cookie( 'narayam-scheme', scheme, { 'path': '/', 'expires': 30 } );
309309 $select.val( name );
310310 }
311311 };
@@ -372,6 +372,11 @@
373373 if ( enabledCookie == '1' || ( mw.config.get( 'wgNarayamEnableByDefault' ) && enabledCookie !== '0' ) ) {
374374 that.enable();
375375 }
 376+ // Renew the narayam-enabled cookie. naraym-scheme is renewed by setScheme()
 377+ if ( enabledCookie ) {
 378+ $.cookie( 'narayam-enabled', enabledCookie, { 'path': '/', 'expires': 30 } );
 379+ }
 380+
376381 };
377382
378383 } )();

Status & tagging log