MediaWiki:Common.js: Difference between revisions
Jump to navigation
Jump to search
Content deleted Content added
sigh, lets try vanilla js again |
rm checkPaymentOutages |
||
Line 9: | Line 9: | ||
var qs = regex.exec( window.location.search ); |
var qs = regex.exec( window.location.search ); |
||
return qs == null ? '' : qs[1]; |
return qs == null ? '' : qs[1]; |
||
} |
|||
function checkPaymentOutages() { |
|||
/* Check against the scheduled payment method outages |
|||
* in global variable "outages" (loaded cross-wiki from meta) |
|||
* and hide the relevant button for any which are ongoing. |
|||
*/ |
|||
// var outages = outages || []; // don't die if it hasn't loaded... |
|||
var now = new Date(); |
|||
for (var i = outages.length - 1; i >= 0; i--) { |
|||
if ( now > outages[i]['start'] ) { |
|||
if ( now < outages[i]['end'] ) { |
|||
if ( (typeof outages[i]['country'] === 'undefined') || (outages[i]['country'] == country) ) { |
|||
$('.paymentmethod-' + outages[i]['method']).hide(); |
|||
} |
|||
} |
|||
} |
|||
} |
|||
} |
} |
||
Line 371: | Line 351: | ||
$('#actual-form-loading').hide(); |
$('#actual-form-loading').hide(); |
||
} |
} |
||
// Load list of payment outages from meta, and hide any which are current |
|||
$.getScript('//meta.wikimedia.org/w/index.php?' + $.param( { title:'MediaWiki:FR2013/Resources/PaymentOutages.js', action:'raw', ctype:'text/javascript' } ), |
|||
function() { |
|||
setTimeout(checkPaymentOutages(), 250); // allow time for script to have _executed_ (not just loaded) |
|||
}); |
|||
}); |
}); |