MediaWiki:FallbackTimer.js: различия между версиями
Перейти к навигации
Нет описания правки |
Нет описания правки |
||
Строка 1: | Строка 1: | ||
console.log('timer.js'); | !(function (timer, jQuery) { | ||
"use strict"; | |||
var date_regex = /^(\d{4})-(0\d|1[012])-([012]\d|3[01])?$/; | |||
jQuery(function () { | |||
console.log('timer.js', 'initialization...'); | |||
jQuery('.fallback-timer[data-end]').each(function () { | |||
var timer = jQuery(this); | |||
var end = timer.data('end'); | |||
var label = timer.data('label'); | |||
var _d = date_regex.exec(end); | |||
if (_d == null) return console.warn('Timer.js: fallback timer data-end field contains unexpected value'); | |||
var date = new Date(_d[1], (_d[2] - 0) + 1, _d[3]); | |||
var diff = date.getTime() - (new Date()).getTime(); | |||
}); | |||
}); | |||
})((window.WGTimer) || (window.WGTimer = {}), jQuery); |
Версия от 13:26, 15 февраля 2015
!(function (timer, jQuery) { "use strict"; var date_regex = /^(\d{4})-(0\d|1[012])-([012]\d|3[01])?$/; jQuery(function () { console.log('timer.js', 'initialization...'); jQuery('.fallback-timer[data-end]').each(function () { var timer = jQuery(this); var end = timer.data('end'); var label = timer.data('label'); var _d = date_regex.exec(end); if (_d == null) return console.warn('Timer.js: fallback timer data-end field contains unexpected value'); var date = new Date(_d[1], (_d[2] - 0) + 1, _d[3]); var diff = date.getTime() - (new Date()).getTime(); }); }); })((window.WGTimer) || (window.WGTimer = {}), jQuery);