r110978 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r110977‎ | r110978 | r110979 >
Date:23:08, 8 February 2012
Author:werdna
Status:ok
Tags:nodeploy 
Comment:
Add code for disabling interstitials
Modified paths:
  • /trunk/extensions/ArticleCreationWorkflow/modules/ext.articleCreation.user/ext.articleCreation.user.js (modified) (history)

Diff [purge]

Index: trunk/extensions/ArticleCreationWorkflow/modules/ext.articleCreation.user/ext.articleCreation.user.js
@@ -65,7 +65,9 @@
6666 .find('.mw-ac-interstitial')
6767 .hide();
6868
69 - if ( ! $(this).parent().find('.mw-ac-interstitial').length ) {
 69+ if ( ! $(this).parent().find('.mw-ac-interstitial').length ||
 70+ ac.isInterstitialDisabled($(this).data('ac-button'))
 71+ ) {
7072 ac.executeAction( $(this).data('ac-button' ) );
7173 return;
7274 }
@@ -121,6 +123,10 @@
122124 },
123125
124126 executeAction : function( action ) {
 127+ if ( $('#mw-ac-create-dismiss').is(':checked') ) {
 128+ ac.disableInterstitial( action );
 129+ }
 130+
125131 var article = wgPageName.substr( wgPageName.indexOf('/') + 1 );
126132 var urlTemplate = ac.config['action-url'][action];
127133
@@ -129,6 +135,19 @@
130136 urlTemplate = urlTemplate.replace( '{{SCRIPT}}', wgScript );
131137
132138 window.location.href = urlTemplate;
 139+ },
 140+
 141+ disableInterstitial : function(button) {
 142+ $.cookie( 'mw:ac:disabled-interstitial:'+button, 1,
 143+ { expires : 365, path : '/' } );
 144+ },
 145+
 146+ isInterstitialDisabled : function(button) {
 147+ if ( $.cookie('mw:ac:disabled-interstitial:'+button) ) {
 148+ return true;
 149+ }
 150+
 151+ return false;
133152 }
134153
135154 });

Status & tagging log