Index: lams_central/web/includes/javascript/jquery.countdown.js
===================================================================
RCS file: /usr/local/cvsroot/lams_central/web/includes/javascript/jquery.countdown.js,v
diff -u -r1.1 -r1.1.2.1
--- lams_central/web/includes/javascript/jquery.countdown.js 25 Mar 2013 13:05:46 -0000 1.1
+++ lams_central/web/includes/javascript/jquery.countdown.js 12 Dec 2014 14:39:53 -0000 1.1.2.1
@@ -1,505 +1,6 @@
/* http://keith-wood.name/countdown.html
- Countdown for jQuery v1.4.3.
- Written by Keith Wood (kbwood@virginbroadband.com.au) January 2008.
- Dual licensed under the GPL (http://dev.jquery.com/browser/trunk/jquery/GPL-LICENSE.txt) and
- MIT (http://dev.jquery.com/browser/trunk/jquery/MIT-LICENSE.txt) licenses.
+ Countdown for jQuery v2.0.1.
+ Written by Keith Wood (kbwood{at}iinet.com.au) January 2008.
+ Available under the MIT (https://github.com/jquery/jquery/blob/master/MIT-LICENSE.txt) license.
Please attribute the author if you use it. */
-
-/* Display a countdown timer.
- Attach it with options like:
- $('div selector').countdown(
- {until: new Date(2009, 1 - 1, 1, 0, 0, 0), onExpiry: happyNewYear}); */
-
-(function($) { // Hide scope, no $ conflict
-
-/* Countdown manager. */
-function Countdown() {
- this.regional = []; // Available regional settings, indexed by language code
- this.regional[''] = { // Default regional settings
- // The display texts for the counters
- labels: ['Years', 'Months', 'Weeks', 'Days', 'Hours', 'Minutes', 'Seconds'],
- // The display texts for the counters if only one
- labels1: ['Year', 'Month', 'Week', 'Day', 'Hour', 'Minute', 'Second'],
- compactLabels: ['y', 'm', 'w', 'd'], // The compact texts for the counters
- timeSeparator: ':', // Separator for time periods
- isRTL: false // True for right-to-left languages, false for left-to-right
- };
- this._defaults = {
- format: 'dHMS', // Format for display - upper case for always, lower case only if non-zero,
- // 'Y' years, 'O' months, 'W' weeks, 'D' days, 'H' hours, 'M' minutes, 'S' seconds
- layout: '', // Build your own layout for the countdown
- compact: false, // True to display in a compact format, false for an expanded one
- description: '', // The description displayed for the countdown
- expiryUrl: null, // A URL to load upon expiry, replacing the current page
- alwaysExpire: false, // True to trigger onExpiry even if never counted down
- onExpiry: null, // Callback when the countdown expires -
- // receives no parameters and 'this' is the containing division
- onTick: null, // Callback when the countdown is updated -
- // receives int[7] being the breakdown by period (based on format)
- // and 'this' is the containing division
- serverTime: null // The current time on the server, to calculate an offset for other time zones
- };
- $.extend(this._defaults, this.regional['']);
-}
-
-var PROP_NAME = 'countdown';
-
-var Y = 0; // Years
-var O = 1; // Months
-var W = 2; // Weeks
-var D = 3; // Days
-var H = 4; // Hours
-var M = 5; // Minutes
-var S = 6; // Seconds
-
-$.extend(Countdown.prototype, {
- /* Class name added to elements to indicate already configured with countdown. */
- markerClassName: 'hasCountdown',
-
- /* Override the default settings for all instances of the countdown widget.
- @param options (object) the new settings to use as defaults */
- setDefaults: function(options) {
- this._resetExtraLabels(this._defaults, options);
- extendRemove(this._defaults, options || {});
- },
-
- /* Attach the countdown widget to a div.
- @param target (element) the containing division
- @param options (object) the initial settings for the countdown */
- _attachCountdown: function(target, options) {
- target = $(target);
- if (target.hasClass(this.markerClassName)) {
- return;
- }
- target.addClass(this.markerClassName);
- var inst = {};
- inst.options = $.extend({}, options);
- inst._periods = [0, 0, 0, 0, 0, 0, 0];
- this._adjustSettings(inst);
- $.data(target[0], PROP_NAME, inst);
- this._updateCountdown(target, inst);
- },
-
- /* Redisplay the countdown with an updated display.
- @param target (jQuery) the containing division
- @param inst (object) the current settings for this instance */
- _updateCountdown: function(target, inst) {
- var target = $(target);
- inst = inst || $.data(target[0], PROP_NAME);
- if (!inst) {
- return;
- }
- target.html(this._generateHTML(inst));
- target[(this._get(inst, 'isRTL') ? 'add' : 'remove') + 'Class']('countdown_rtl');
- var onTick = this._get(inst, 'onTick');
- if (onTick) {
- onTick.apply(target[0], [inst._hold != 'lap' ? inst._periods :
- this._calculatePeriods(inst, inst._show, new Date())]);
- }
- var expired = inst._hold != 'pause' &&
- (inst._since ? inst._now.getTime() <= inst._since.getTime() :
- inst._now.getTime() >= inst._until.getTime());
- if (expired) {
- if (inst._timer || this._get(inst, 'alwaysExpire')) {
- var onExpiry = this._get(inst, 'onExpiry');
- if (onExpiry) {
- onExpiry.apply(target[0], []);
- }
- var expiryUrl = this._get(inst, 'expiryUrl');
- if (expiryUrl) {
- window.location = expiryUrl;
- }
- }
- inst._timer = null;
- }
- else if (inst._hold == 'pause') {
- inst._timer = null;
- }
- else {
- var format = this._get(inst, 'format');
- inst._timer = setTimeout(function() { $.countdown._updateCountdown(target); },
- (format.match('s|S') ? 1 : (format.match('m|M') ? 30 : 600)) * 980); // just under the full time
- }
- $.data(target[0], PROP_NAME, inst);
- },
-
- /* Reconfigure the settings for a countdown div.
- @param target (element) the containing division
- @param options (object) the new settings for the countdown */
- _changeCountdown: function(target, options) {
- var inst = $.data(target, PROP_NAME);
- if (inst) {
- this._resetExtraLabels(inst.options, options);
- extendRemove(inst.options, options || {});
- this._adjustSettings(inst);
- $.data(target, PROP_NAME, inst);
- this._updateCountdown(target, inst);
- }
- },
-
- /* Reset any extra labelsn and compactLabelsn entries if changing labels.
- @param base (object) the options to be updated
- @param options (object) the new option values */
- _resetExtraLabels: function(base, options) {
- var changingLabels = false;
- for (var n in options) {
- if (n.match(/[Ll]abels/)) {
- changingLabels = true;
- break;
- }
- }
- if (changingLabels) {
- for (var n in base) { // Remove custom numbered labels
- if (n.match(/[Ll]abels[0-9]/)) {
- base[n] = null;
- }
- }
- }
- },
-
- /* Remove the countdown widget from a div.
- @param target (element) the containing division */
- _destroyCountdown: function(target) {
- target = $(target);
- if (!target.hasClass(this.markerClassName)) {
- return;
- }
- target.removeClass(this.markerClassName).empty();
- var inst = $.data(target[0], PROP_NAME);
- if (inst._timer) {
- clearTimeout(inst._timer);
- }
- $.removeData(target[0], PROP_NAME);
- },
-
- /* Pause a countdown widget at the current time.
- Stop it running but remember and display the current time.
- @param target (element) the containing division */
- _pauseCountdown: function(target) {
- this._hold(target, 'pause');
- },
-
- /* Pause a countdown widget at the current time.
- Stop the display but keep the countdown running.
- @param target (element) the containing division */
- _lapCountdown: function(target) {
- this._hold(target, 'lap');
- },
-
- /* Resume a paused countdown widget.
- @param target (element) the containing division */
- _resumeCountdown: function(target) {
- this._hold(target, null);
- },
-
- /* Pause or resume a countdown widget.
- @param target (element) the containing division
- @param hold (string) the new hold setting */
- _hold: function(target, hold) {
- var inst = $.data(target, PROP_NAME);
- if (inst) {
- if (inst._hold == 'pause' && !hold) {
- inst._periods = inst._savePeriods;
- var sign = (inst._since ? '-' : '+');
- inst[inst._since ? '_since' : '_until'] =
- this._determineTime(sign + inst._periods[0] + 'Y' +
- sign + inst._periods[1] + 'O' + sign + inst._periods[2] + 'W' +
- sign + inst._periods[3] + 'D' + sign + inst._periods[4] + 'H' +
- sign + inst._periods[5] + 'M' + sign + inst._periods[6] + 'S');
- }
- inst._hold = hold;
- inst._savePeriods = (hold == 'pause' ? inst._periods : null);
- $.data(target, PROP_NAME, inst);
- this._updateCountdown(target, inst);
- }
- },
-
- /* Return the current time periods.
- @param target (element) the containing division
- @return (number[7]) the current periods for the countdown */
- _getTimesCountdown: function(target) {
- var inst = $.data(target, PROP_NAME);
- return (!inst ? null : (!inst._hold ? inst._periods :
- this._calculatePeriods(inst, inst._show, new Date())));
- },
-
- /* Get a setting value, defaulting if necessary.
- @param inst (object) the current settings for this instance
- @param name (string) the name of the required setting
- @return (any) the setting's value or a default if not overridden */
- _get: function(inst, name) {
- return (inst.options[name] != null ?
- inst.options[name] : $.countdown._defaults[name]);
- },
-
- /* Calculate interal settings for an instance.
- @param inst (object) the current settings for this instance */
- _adjustSettings: function(inst) {
- var now = new Date();
- var serverTime = this._get(inst, 'serverTime');
- inst._offset = (serverTime ? serverTime.getTime() - now.getTime() : 0);
- inst._since = this._get(inst, 'since');
- if (inst._since) {
- inst._since = this._determineTime(inst._since, null);
- }
- inst._until = this._determineTime(this._get(inst, 'until'), now);
- inst._show = this._determineShow(inst);
- },
-
- /* A time may be specified as an exact value or a relative one.
- @param setting (string or number or Date) - the date/time value
- as a relative or absolute value
- @param defaultTime (Date) the date/time to use if no other is supplied
- @return (Date) the corresponding date/time */
- _determineTime: function(setting, defaultTime) {
- var offsetNumeric = function(offset) { // e.g. +300, -2
- var time = new Date();
- time.setTime(time.getTime() + offset * 1000);
- return time;
- };
- var getDaysInMonth = function(year, month) {
- return 32 - new Date(year, month, 32).getDate();
- };
- var offsetString = function(offset) { // e.g. '+2d', '-4w', '+3h +30m'
- var time = new Date();
- var year = time.getFullYear();
- var month = time.getMonth();
- var day = time.getDate();
- var hour = time.getHours();
- var minute = time.getMinutes();
- var second = time.getSeconds();
- var pattern = /([+-]?[0-9]+)\s*(s|S|m|M|h|H|d|D|w|W|o|O|y|Y)?/g;
- var matches = pattern.exec(offset);
- while (matches) {
- switch (matches[2] || 's') {
- case 's' : case 'S' :
- second += parseInt(matches[1], 10); break;
- case 'm' : case 'M' :
- minute += parseInt(matches[1], 10); break;
- case 'h' : case 'H' :
- hour += parseInt(matches[1], 10); break;
- case 'd' : case 'D' :
- day += parseInt(matches[1], 10); break;
- case 'w' : case 'W' :
- day += parseInt(matches[1], 10) * 7; break;
- case 'o' : case 'O' :
- month += parseInt(matches[1], 10);
- day = Math.min(day, getDaysInMonth(year, month));
- break;
- case 'y': case 'Y' :
- year += parseInt(matches[1], 10);
- day = Math.min(day, getDaysInMonth(year, month));
- break;
- }
- matches = pattern.exec(offset);
- }
- time = new Date(year, month, day, hour, minute, second, 0);
- return time;
- };
- var time = (setting == null ? defaultTime :
- (typeof setting == 'string' ? offsetString(setting) :
- (typeof setting == 'number' ? offsetNumeric(setting) : setting)));
- if (time) time.setMilliseconds(0);
- return time;
- },
-
- /* Generate the HTML to display the countdown widget.
- @param inst (object) the current settings for this instance
- @return (string) the new HTML for the countdown display */
- _generateHTML: function(inst) {
- // Determine what to show
- inst._periods = periods = (inst._hold ? inst._periods :
- this._calculatePeriods(inst, inst._show, new Date()));
- // Show all 'asNeeded' after first non-zero value
- var shownNonZero = false;
- var showCount = 0;
- for (var period = 0; period < inst._show.length; period++) {
- shownNonZero |= (inst._show[period] == '?' && periods[period] > 0);
- inst._show[period] = (inst._show[period] == '?' && !shownNonZero ? null : inst._show[period]);
- showCount += (inst._show[period] ? 1 : 0);
- }
- var compact = this._get(inst, 'compact');
- var layout = this._get(inst, 'layout');
- var labels = (compact ? this._get(inst, 'compactLabels') : this._get(inst, 'labels'));
- var timeSeparator = this._get(inst, 'timeSeparator');
- var description = this._get(inst, 'description') || '';
- var twoDigits = function(value) {
- return (value < 10 ? '0' : '') + value;
- };
- var showCompact = function(period) {
- var labelsNum = $.countdown._get(inst, 'compactLabels' + periods[period]);
- return (inst._show[period] ? periods[period] +
- (labelsNum ? labelsNum[period] : labels[period]) + ' ' : '');
- };
- var showFull = function(period) {
- var labelsNum = $.countdown._get(inst, 'labels' + periods[period]);
- return (inst._show[period] ?
- '
' +
- periods[period] + '
' +
- (labelsNum ? labelsNum[period] : labels[period]) + '
' : '');
- };
- return (layout ? this._buildLayout(inst, layout, compact) :
- ((compact ? // Compact version
- '' +
- showCompact(Y) + showCompact(O) + showCompact(W) + showCompact(D) +
- (inst._show[H] ? twoDigits(periods[H]) : '') +
- (inst._show[M] ? (inst._show[H] ? timeSeparator : '') + twoDigits(periods[M]) : '') +
- (inst._show[S] ? (inst._show[H] || inst._show[M] ? timeSeparator : '') +
- twoDigits(periods[S]) : '') :
- // Full version
- '
' +
- showFull(Y) + showFull(O) + showFull(W) + showFull(D) +
- showFull(H) + showFull(M) + showFull(S)) + '
' +
- (description ? '
' + description + '
' : '')));
- },
-
- /* Construct a custom layout.
- @param inst (object) the current settings for this instance
- @param layout (string) the customised layout
- @param compact (boolean) true if using compact labels
- @return (string) the custom HTML */
- _buildLayout: function(inst, layout, compact) {
- var labels = (compact ? this._get(inst, 'compactLabels') : this._get(inst, 'labels'));
- var html = layout;
- var processPeriod = function(period, index) {
- var pattern1 = new RegExp('%' + period + '.*%' + period);
- var pattern2 = new RegExp('%' + period + '.*');
- while (true) {
- var matches = pattern1.exec(html);
- if (!matches) {
- break;
- }
- matches[0] = matches[0].substr(0, 2) +
- matches[0].substr(2).replace(pattern2, '%' + period);
- html = html.replace(matches[0], inst._show[index] ?
- customisePeriod(matches[0], period, index) : '');
- }
- };
- var customisePeriod = function(text, period, index) {
- var labelsNum = $.countdown._get(inst,
- (compact ? 'compactLabels' : 'labels') + inst._periods[index]);
- return text.substr(2, text.length - 4).
- replace(/%nn/g, (inst._periods[index] < 10 ? '0' : '') +
- inst._periods[index]).
- replace(/%n/g, inst._periods[index]).
- replace(/%l/g, (labelsNum ? labelsNum[index] : labels[index]));
- };
- processPeriod('Y', Y);
- processPeriod('O', O);
- processPeriod('W', W);
- processPeriod('D', D);
- processPeriod('H', H);
- processPeriod('M', M);
- processPeriod('S', S);
- return html;
- },
-
- /* Translate the format into flags for each period.
- @param inst (object) the current settings for this instance
- @return (string[7]) flags indicating which periods are requested (?) or
- required (!) by year, month, week, day, hour, minute, second */
- _determineShow: function(inst) {
- var format = this._get(inst, 'format');
- var show = [];
- show[Y] = (format.match('y') ? '?' : (format.match('Y') ? '!' : null));
- show[O] = (format.match('o') ? '?' : (format.match('O') ? '!' : null));
- show[W] = (format.match('w') ? '?' : (format.match('W') ? '!' : null));
- show[D] = (format.match('d') ? '?' : (format.match('D') ? '!' : null));
- show[H] = (format.match('h') ? '?' : (format.match('H') ? '!' : null));
- show[M] = (format.match('m') ? '?' : (format.match('M') ? '!' : null));
- show[S] = (format.match('s') ? '?' : (format.match('S') ? '!' : null));
- return show;
- },
-
- /* Calculate the requested periods between now and the target time.
- @param inst (object) the current settings for this instance
- @param show (string[7]) flags indicating which periods are requested/required
- @param now (Date) the current date and time
- @return (number[7]) the current time periods (always positive)
- by year, month, week, day, hour, minute, second */
- _calculatePeriods: function(inst, show, now) {
- // Find endpoints
- inst._now = now;
- inst._now.setMilliseconds(0);
- var until = new Date(inst._now.getTime());
- if (inst._since && now.getTime() < inst._since.getTime()) {
- inst._now = now = until;
- }
- else if (inst._since) {
- now = inst._since;
- }
- else {
- until.setTime(inst._until.getTime());
- if (now.getTime() > inst._until.getTime()) {
- inst._now = now = until;
- }
- }
- until.setTime(until.getTime() - inst._offset); // Adjust for time zone
- // Calculate differences by period
- var periods = [0, 0, 0, 0, 0, 0, 0];
- if (show[Y] || show[O]) {
- var months = Math.max(0, (until.getFullYear() - now.getFullYear()) * 12 +
- until.getMonth() - now.getMonth() + (until.getDate() < now.getDate() ? -1 : 0));
- periods[Y] = (show[Y] ? Math.floor(months / 12) : 0);
- periods[O] = (show[O] ? months - periods[Y] * 12 : 0);
- if (inst._since) {
- until.setFullYear(until.getFullYear() - periods[Y]);
- until.setMonth(until.getMonth() - periods[O]);
- }
- else {
- now = new Date(now.getTime());
- now.setFullYear(now.getFullYear() + periods[Y]);
- now.setMonth(now.getMonth() + periods[O]);
- }
- }
- var diff = Math.floor((until.getTime() - now.getTime()) / 1000);
- var extractPeriod = function(period, numSecs) {
- periods[period] = (show[period] ? Math.floor(diff / numSecs) : 0);
- diff -= periods[period] * numSecs;
- };
- extractPeriod(W, 604800);
- extractPeriod(D, 86400);
- extractPeriod(H, 3600);
- extractPeriod(M, 60);
- extractPeriod(S, 1);
- return periods;
- }
-});
-
-/* jQuery extend now ignores nulls! */
-function extendRemove(target, props) {
- $.extend(target, props);
- for (var name in props) {
- if (props[name] == null) {
- target[name] = null;
- }
- }
- return target;
-}
-
-/* Attach the countdown functionality to a jQuery selection.
- @param command (string) the command to run (optional, default 'attach')
- @param options (object) the new settings to use for these countdown instances
- @return (jQuery) for chaining further calls */
-$.fn.countdown = function(options) {
- var otherArgs = Array.prototype.slice.call(arguments, 1);
- if (options == 'getTimes') {
- return $.countdown['_' + options + 'Countdown'].
- apply($.countdown, [this[0]].concat(otherArgs));
- }
- return this.each(function() {
- if (typeof options == 'string') {
- $.countdown['_' + options + 'Countdown'].apply($.countdown, [this].concat(otherArgs));
- }
- else {
- $.countdown._attachCountdown(this, options);
- }
- });
-};
-
-/* Initialise the countdown functionality. */
-$.countdown = new Countdown(); // singleton instance
-
-})(jQuery);
+(function($){var w='countdown';var Y=0;var O=1;var W=2;var D=3;var H=4;var M=5;var S=6;$.JQPlugin.createPlugin({name:w,defaultOptions:{until:null,since:null,timezone:null,serverSync:null,format:'dHMS',layout:'',compact:false,padZeroes:false,significant:0,description:'',expiryUrl:'',expiryText:'',alwaysExpire:false,onExpiry:null,onTick:null,tickInterval:1},regionalOptions:{'':{labels:['Years','Months','Weeks','Days','Hours','Minutes','Seconds'],labels1:['Year','Month','Week','Day','Hour','Minute','Second'],compactLabels:['y','m','w','d'],whichLabels:null,digits:['0','1','2','3','4','5','6','7','8','9'],timeSeparator:':',isRTL:false}},_getters:['getTimes'],_rtlClass:w+'-rtl',_sectionClass:w+'-section',_amountClass:w+'-amount',_periodClass:w+'-period',_rowClass:w+'-row',_holdingClass:w+'-holding',_showClass:w+'-show',_descrClass:w+'-descr',_timerElems:[],_init:function(){var c=this;this._super();this._serverSyncs=[];var d=(typeof Date.now=='function'?Date.now:function(){return new Date().getTime()});var e=(window.performance&&typeof window.performance.now=='function');function timerCallBack(a){var b=(a<1e12?(e?(performance.now()+performance.timing.navigationStart):d()):a||d());if(b-g>=1000){c._updateElems();g=b}f(timerCallBack)}var f=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||null;var g=0;if(!f||$.noRequestAnimationFrame){$.noRequestAnimationFrame=null;setInterval(function(){c._updateElems()},980)}else{g=window.animationStartTime||window.webkitAnimationStartTime||window.mozAnimationStartTime||window.oAnimationStartTime||window.msAnimationStartTime||d();f(timerCallBack)}},UTCDate:function(a,b,c,e,f,g,h,i){if(typeof b=='object'&&b.constructor==Date){i=b.getMilliseconds();h=b.getSeconds();g=b.getMinutes();f=b.getHours();e=b.getDate();c=b.getMonth();b=b.getFullYear()}var d=new Date();d.setUTCFullYear(b);d.setUTCDate(1);d.setUTCMonth(c||0);d.setUTCDate(e||1);d.setUTCHours(f||0);d.setUTCMinutes((g||0)-(Math.abs(a)<30?a*60:a));d.setUTCSeconds(h||0);d.setUTCMilliseconds(i||0);return d},periodsToSeconds:function(a){return a[0]*31557600+a[1]*2629800+a[2]*604800+a[3]*86400+a[4]*3600+a[5]*60+a[6]},_instSettings:function(a,b){return{_periods:[0,0,0,0,0,0,0]}},_addElem:function(a){if(!this._hasElem(a)){this._timerElems.push(a)}},_hasElem:function(a){return($.inArray(a,this._timerElems)>-1)},_removeElem:function(b){this._timerElems=$.map(this._timerElems,function(a){return(a==b?null:a)})},_updateElems:function(){for(var i=this._timerElems.length-1;i>=0;i--){this._updateCountdown(this._timerElems[i])}},_optionsChanged:function(a,b,c){if(c.layout){c.layout=c.layout.replace(/</g,'<').replace(/>/g,'>')}this._resetExtraLabels(b.options,c);var d=(b.options.timezone!=c.timezone);$.extend(b.options,c);this._adjustSettings(a,b,c.until!=null||c.since!=null||d);var e=new Date();if((b._since&&b._since
e)){this._addElem(a[0])}this._updateCountdown(a,b)},_updateCountdown:function(a,b){a=a.jquery?a:$(a);b=b||this._getInst(a);if(!b){return}a.html(this._generateHTML(b)).toggleClass(this._rtlClass,b.options.isRTL);if($.isFunction(b.options.onTick)){var c=b._hold!='lap'?b._periods:this._calculatePeriods(b,b._show,b.options.significant,new Date());if(b.options.tickInterval==1||this.periodsToSeconds(c)%b.options.tickInterval==0){b.options.onTick.apply(a[0],[c])}}var d=b._hold!='pause'&&(b._since?b._now.getTime()=b._until.getTime());if(d&&!b._expiring){b._expiring=true;if(this._hasElem(a[0])||b.options.alwaysExpire){this._removeElem(a[0]);if($.isFunction(b.options.onExpiry)){b.options.onExpiry.apply(a[0],[])}if(b.options.expiryText){var e=b.options.layout;b.options.layout=b.options.expiryText;this._updateCountdown(a[0],b);b.options.layout=e}if(b.options.expiryUrl){window.location=b.options.expiryUrl}}b._expiring=false}else if(b._hold=='pause'){this._removeElem(a[0])}},_resetExtraLabels:function(a,b){for(var n in b){if(n.match(/[Ll]abels[02-9]|compactLabels1/)){a[n]=b[n]}}for(var n in a){if(n.match(/[Ll]abels[02-9]|compactLabels1/)&&typeof b[n]==='undefined'){a[n]=null}}},_adjustSettings:function(a,b,c){var d;var e=0;var f=null;for(var i=0;i0);h[i]=(c._show[i]=='?'&&!e?null:c._show[i]);f+=(h[i]?1:0);g-=(c._periods[i]>0?1:0)}var j=[false,false,false,false,false,false,false];for(var i=S;i>=Y;i--){if(c._show[i]){if(c._periods[i]){j[i]=true}else{j[i]=g>0;g--}}}var k=(c.options.compact?c.options.compactLabels:c.options.labels);var l=c.options.whichLabels||this._normalLabels;var m=function(a){var b=c.options['compactLabels'+l(c._periods[a])];return(h[a]?d._translateDigits(c,c._periods[a])+(b?b[a]:k[a])+' ':'')};var n=(c.options.padZeroes?2:1);var o=function(a){var b=c.options['labels'+l(c._periods[a])];return((!c.options.significant&&h[a])||(c.options.significant&&j[a])?''+''+d._minDigits(c,c._periods[a],n)+''+''+(b?b[a]:k[a])+'':'')};return(c.options.layout?this._buildLayout(c,h,c.options.layout,c.options.compact,c.options.significant,j):((c.options.compact?''+m(Y)+m(O)+m(W)+m(D)+(h[H]?this._minDigits(c,c._periods[H],2):'')+(h[M]?(h[H]?c.options.timeSeparator:'')+this._minDigits(c,c._periods[M],2):'')+(h[S]?(h[H]||h[M]?c.options.timeSeparator:'')+this._minDigits(c,c._periods[S],2):''):''+o(Y)+o(O)+o(W)+o(D)+o(H)+o(M)+o(S))+''+(c.options.description?''+c.options.description+'':'')))},_buildLayout:function(c,d,e,f,g,h){var j=c.options[f?'compactLabels':'labels'];var k=c.options.whichLabels||this._normalLabels;var l=function(a){return(c.options[(f?'compactLabels':'labels')+k(c._periods[a])]||j)[a]};var m=function(a,b){return c.options.digits[Math.floor(a/b)%10]};var o={desc:c.options.description,sep:c.options.timeSeparator,yl:l(Y),yn:this._minDigits(c,c._periods[Y],1),ynn:this._minDigits(c,c._periods[Y],2),ynnn:this._minDigits(c,c._periods[Y],3),y1:m(c._periods[Y],1),y10:m(c._periods[Y],10),y100:m(c._periods[Y],100),y1000:m(c._periods[Y],1000),ol:l(O),on:this._minDigits(c,c._periods[O],1),onn:this._minDigits(c,c._periods[O],2),onnn:this._minDigits(c,c._periods[O],3),o1:m(c._periods[O],1),o10:m(c._periods[O],10),o100:m(c._periods[O],100),o1000:m(c._periods[O],1000),wl:l(W),wn:this._minDigits(c,c._periods[W],1),wnn:this._minDigits(c,c._periods[W],2),wnnn:this._minDigits(c,c._periods[W],3),w1:m(c._periods[W],1),w10:m(c._periods[W],10),w100:m(c._periods[W],100),w1000:m(c._periods[W],1000),dl:l(D),dn:this._minDigits(c,c._periods[D],1),dnn:this._minDigits(c,c._periods[D],2),dnnn:this._minDigits(c,c._periods[D],3),d1:m(c._periods[D],1),d10:m(c._periods[D],10),d100:m(c._periods[D],100),d1000:m(c._periods[D],1000),hl:l(H),hn:this._minDigits(c,c._periods[H],1),hnn:this._minDigits(c,c._periods[H],2),hnnn:this._minDigits(c,c._periods[H],3),h1:m(c._periods[H],1),h10:m(c._periods[H],10),h100:m(c._periods[H],100),h1000:m(c._periods[H],1000),ml:l(M),mn:this._minDigits(c,c._periods[M],1),mnn:this._minDigits(c,c._periods[M],2),mnnn:this._minDigits(c,c._periods[M],3),m1:m(c._periods[M],1),m10:m(c._periods[M],10),m100:m(c._periods[M],100),m1000:m(c._periods[M],1000),sl:l(S),sn:this._minDigits(c,c._periods[S],1),snn:this._minDigits(c,c._periods[S],2),snnn:this._minDigits(c,c._periods[S],3),s1:m(c._periods[S],1),s10:m(c._periods[S],10),s100:m(c._periods[S],100),s1000:m(c._periods[S],1000)};var p=e;for(var i=Y;i<=S;i++){var q='yowdhms'.charAt(i);var r=new RegExp('\\{'+q+'<\\}([\\s\\S]*)\\{'+q+'>\\}','g');p=p.replace(r,((!g&&d[i])||(g&&h[i])?'$1':''))}$.each(o,function(n,v){var a=new RegExp('\\{'+n+'\\}','g');p=p.replace(a,v)});return p},_minDigits:function(a,b,c){b=''+b;if(b.length>=c){return this._translateDigits(a,b)}b='0000000000'+b;return this._translateDigits(a,b.substr(b.length-c))},_translateDigits:function(b,c){return(''+c).replace(/[0-9]/g,function(a){return b.options.digits[a]})},_determineShow:function(a){var b=a.options.format;var c=[];c[Y]=(b.match('y')?'?':(b.match('Y')?'!':null));c[O]=(b.match('o')?'?':(b.match('O')?'!':null));c[W]=(b.match('w')?'?':(b.match('W')?'!':null));c[D]=(b.match('d')?'?':(b.match('D')?'!':null));c[H]=(b.match('h')?'?':(b.match('H')?'!':null));c[M]=(b.match('m')?'?':(b.match('M')?'!':null));c[S]=(b.match('s')?'?':(b.match('S')?'!':null));return c},_calculatePeriods:function(c,d,e,f){c._now=f;c._now.setMilliseconds(0);var g=new Date(c._now.getTime());if(c._since){if(f.getTime()c._until.getTime()){c._now=f=g}}var h=[0,0,0,0,0,0,0];if(d[Y]||d[O]){var i=this._getDaysInMonth(f.getFullYear(),f.getMonth());var j=this._getDaysInMonth(g.getFullYear(),g.getMonth());var k=(g.getDate()==f.getDate()||(g.getDate()>=Math.min(i,j)&&f.getDate()>=Math.min(i,j)));var l=function(a){return(a.getHours()*60+a.getMinutes())*60+a.getSeconds()};var m=Math.max(0,(g.getFullYear()-f.getFullYear())*12+g.getMonth()-f.getMonth()+((g.getDate()o){f.setDate(o)}f.setFullYear(f.getFullYear()+h[Y]);f.setMonth(f.getMonth()+h[O]);if(n){f.setDate(o)}}var p=Math.floor((g.getTime()-f.getTime())/1000);var q=function(a,b){h[a]=(d[a]?Math.floor(p/b):0);p-=h[a]*b};q(W,604800);q(D,86400);q(H,3600);q(M,60);q(S,1);if(p>0&&!c._since){var r=[1,12,4.3482,7,24,60,60];var s=S;var t=1;for(var u=S;u>=Y;u--){if(d[u]){if(h[s]>=t){h[s]=0;p=1}if(p>0){h[u]++;p=0;s=u;t=1}}t*=r[u]}}if(e){for(var u=Y;u<=S;u++){if(e&&h[u]){e--}else if(!e){h[u]=0}}}return h}})})(jQuery);
\ No newline at end of file