| @@ -1 +1,359 @@ | ||
| 1 | -if(!Object.prototype.watchChange){var isFunction=function(e){return e&&"[object Function]"==={}.toString.call(e)};Object.defineProperty(Object.prototype,"watchChange",{enumerable:!1,configurable:!0,writable:!1,value:function(e,t){var n=this;function o(e,t){var o=n[e],s=o;delete n[e]&&Object.defineProperty(n,e,{get:function(){return s},set:function(r){return s=t.call(n,e,o,r)},enumerable:!0,configurable:!0})}if(isFunction(e))for(var s in this)new o(s,e);else new o(e,t)}})}Object.prototype.unwatchChange||Object.defineProperty(Object.prototype,"unwatchChange",{enumerable:!1,configurable:!0,writable:!1,value:function(e){var t=this[e];delete this[e],this[e]=t}}),function(e){"use strict";"function"==typeof define&&define.amd?define(["jquery"],e):"undefined"!=typeof module&&module.exports?module.exports=e(require("jquery")):e(jQuery)}((function(e){"use strict";var t=e.scrollTo=function(t,n,o){return e(window).scrollTo(t,n,o)};function n(t){return!t.nodeName||-1!==e.inArray(t.nodeName.toLowerCase(),["iframe","#document","html","body"])}function o(t){return e.isFunction(t)||e.isPlainObject(t)?t:{top:t,left:t}}return t.defaults={axis:"xy",duration:0,limit:!0},e.fn.scrollTo=function(s,r,i){"object"==typeof r&&(i=r,r=0),"function"==typeof i&&(i={onAfter:i}),"max"===s&&(s=9e9),i=e.extend({},t.defaults,i),r=r||i.duration;var a=i.queue&&i.axis.length>1;return a&&(r/=2),i.offset=o(i.offset),i.over=o(i.over),this.each((function(){if(null!==s){var c,u=n(this),l=u?this.contentWindow||window:this,f=e(l),d=s,h={};switch(typeof d){case"number":case"string":if(/^([+-]=?)?\d+(\.\d+)?(px|%)?$/.test(d)){d=o(d);break}d=u?e(d):e(d,l);case"object":if(0===d.length)return;(d.is||d.style)&&(c=(d=e(d)).offset())}var m=e.isFunction(i.offset)&&i.offset(l,d)||i.offset;e.each(i.axis.split(""),(function(e,n){var o="x"===n?"Left":"Top",s=o.toLowerCase(),r="scroll"+o,p=f[r](),g=t.max(l,n);if(c)h[r]=c[s]+(u?0:p-f.offset()[s]),i.margin&&(h[r]-=parseInt(d.css("margin"+o),10)||0,h[r]-=parseInt(d.css("border"+o+"Width"),10)||0),h[r]+=m[s]||0,i.over[s]&&(h[r]+=d["x"===n?"width":"height"]()*i.over[s]);else{var v=d[s];h[r]=v.slice&&"%"===v.slice(-1)?parseFloat(v)/100*g:v}i.limit&&/^\d+$/.test(h[r])&&(h[r]=h[r]<=0?0:Math.min(h[r],g)),!e&&i.axis.length>1&&(p===h[r]?h={}:a&&(_(i.onAfterFirst),h={}))})),_(i.onAfter)}function _(t){var n=e.extend({},i,{queue:!0,duration:r,complete:t&&function(){t.call(l,d,i)}});f.animate(h,n)}}))},t.max=function(t,o){var s="x"===o?"Width":"Height",r="scroll"+s;if(!n(t))return t[r]-e(t)[s.toLowerCase()]();var i="client"+s,a=t.ownerDocument||t.document,c=a.documentElement,u=a.body;return Math.max(c[r],u[r])-Math.min(c[i],u[i])},e.Tween.propHooks.scrollLeft=e.Tween.propHooks.scrollTop={get:function(t){return e(t.elem)[t.prop]()},set:function(t){var n=this.get(t);if(t.options.interrupt&&t._last&&t._last!==n)return e(t.elem).stop();var o=Math.round(t.now);n!==o&&(e(t.elem)[t.prop](o),t._last=this.get(t))}},t})),function(e){e.backward_timer=function(t){var n={seconds:5,step:1,format:"h%:m%:s%",value_setter:void 0,on_exhausted:function(e){},on_tick:function(e){}},o=this;o.seconds_left=0,o.target=e(t),o.timeout=void 0,o.settings={},o.methods={init:function(t){o.settings=e.extend({},n,t),null==o.settings.value_setter&&(o.target.is("input")?o.settings.value_setter="val":o.settings.value_setter="text"),o.methods.reset()},start:function(){if(null==o.timeout){var e=o.seconds_left==o.settings.seconds?0:1e3*o.settings.step;setTimeout(o.methods._on_tick,e,e)}},cancel:function(){null!=o.timeout&&(clearTimeout(o.timeout),o.timeout=void 0)},reset:function(){o.seconds_left=o.settings.seconds,o.methods._render_seconds()},_on_tick:function(e){if(0!=e&&o.settings.on_tick(o),o.methods._render_seconds(),o.seconds_left>0){if(o.seconds_left<o.settings.step)var t=o.seconds_left;else t=o.settings.step;o.seconds_left-=t;var n=1e3*t;o.timeout=setTimeout(o.methods._on_tick,n,n)}else o.timeout=void 0,o.settings.on_exhausted(o)},_render_seconds:function(){var e=o.methods._seconds_to_dhms(o.seconds_left),t=o.settings.format;t=(t=-1!==t.indexOf("d%")?t.replace("d%",e.d).replace("h%",o.methods._check_leading_zero(e.h)):t.replace("h%",24*e.d+e.h)).replace("m%",o.methods._check_leading_zero(e.m)).replace("s%",o.methods._check_leading_zero(e.s)),o.target[o.settings.value_setter](t)},_seconds_to_dhms:function(e){var t=Math.floor(e/86400),n=(e-=24*t*3600,Math.floor(e/3600)),o=(e-=3600*n,Math.floor(e/60));return{d:t,h:n,m:o,s:Math.floor(e-60*o)}},_check_leading_zero:function(e){return e<10?"0"+e:""+e}}},e.fn.backward_timer=function(t){var n=arguments;return this.each((function(){var o=e(this).data("backward_timer");return null==o&&(o=new e.backward_timer(this),e(this).data("backward_timer",o)),o.methods[t]?o.methods[t].apply(this,Array.prototype.slice.call(n,1)):"object"!=typeof t&&t?void e.error("Method "+t+" does not exist on jQuery.backward_timer"):o.methods.init.apply(this,n)}))}}(jQuery); | |
| 1 | +if (!Object.prototype.watchChange) { | |
| 2 | + var isFunction = function (fn) { | |
| 3 | + return fn && {}.toString.call(fn) === '[object Function]'; | |
| 4 | + }; | |
| 5 | + Object.defineProperty( | |
| 6 | + Object.prototype, | |
| 7 | + 'watchChange', | |
| 8 | + { | |
| 9 | + enumerable: false, | |
| 10 | + configurable: true, | |
| 11 | + writable: false, | |
| 12 | + value: function (prop, handler) { | |
| 13 | + var obj = this; | |
| 14 | + | |
| 15 | + function x(prop, handler) { | |
| 16 | + var oldval = obj[prop], | |
| 17 | + newval = oldval, | |
| 18 | + getter = function () { | |
| 19 | + return newval; | |
| 20 | + }, | |
| 21 | + setter = function (val) { | |
| 22 | + return newval = handler.call(obj, prop, oldval, val); | |
| 23 | + }; | |
| 24 | + | |
| 25 | + if (delete obj[prop]) { | |
| 26 | + Object.defineProperty( | |
| 27 | + obj, | |
| 28 | + prop, | |
| 29 | + { | |
| 30 | + get: getter, | |
| 31 | + set: setter, | |
| 32 | + enumerable: true, | |
| 33 | + configurable: true | |
| 34 | + } | |
| 35 | + ); | |
| 36 | + } | |
| 37 | + } | |
| 38 | + | |
| 39 | + if (isFunction(prop)) { | |
| 40 | + for (var k in this) { | |
| 41 | + new x(k, prop); | |
| 42 | + } | |
| 43 | + } else { | |
| 44 | + new x(prop, handler) | |
| 45 | + } | |
| 46 | + } | |
| 47 | + }); | |
| 48 | +} | |
| 49 | + | |
| 50 | +if (!Object.prototype.unwatchChange) { | |
| 51 | + Object.defineProperty( | |
| 52 | + Object.prototype, | |
| 53 | + 'unwatchChange', | |
| 54 | + { | |
| 55 | + enumerable: false, | |
| 56 | + configurable: true, | |
| 57 | + writable: false, | |
| 58 | + value: function (prop) { | |
| 59 | + var val = this[prop]; | |
| 60 | + delete this[prop]; | |
| 61 | + this[prop] = val; | |
| 62 | + } | |
| 63 | + } | |
| 64 | + ); | |
| 65 | +} | |
| 66 | +/*! | |
| 67 | + * jQuery.scrollTo | |
| 68 | + * Copyright (c) 2007-2015 Ariel Flesler - aflesler ○ gmail • com | http://flesler.blogspot.com | |
| 69 | + * Licensed under MIT | |
| 70 | + * http://flesler.blogspot.com/2007/10/jqueryscrollto.html | |
| 71 | + * @projectDescription Lightweight, cross-browser and highly customizable animated scrolling with jQuery | |
| 72 | + * @author Ariel Flesler | |
| 73 | + * @version 2.1.2 | |
| 74 | + */ | |
| 75 | +;(function(factory) { | |
| 76 | + 'use strict'; | |
| 77 | + if (typeof define === 'function' && define.amd) { | |
| 78 | + // AMD | |
| 79 | + define(['jquery'], factory); | |
| 80 | + } else if (typeof module !== 'undefined' && module.exports) { | |
| 81 | + // CommonJS | |
| 82 | + module.exports = factory(require('jquery')); | |
| 83 | + } else { | |
| 84 | + // Global | |
| 85 | + factory(jQuery); | |
| 86 | + } | |
| 87 | +})(function($) { | |
| 88 | + 'use strict'; | |
| 89 | + | |
| 90 | + var $scrollTo = $.scrollTo = function(target, duration, settings) { | |
| 91 | + return $(window).scrollTo(target, duration, settings); | |
| 92 | + }; | |
| 93 | + | |
| 94 | + $scrollTo.defaults = { | |
| 95 | + axis:'xy', | |
| 96 | + duration: 0, | |
| 97 | + limit:true | |
| 98 | + }; | |
| 99 | + | |
| 100 | + function isWin(elem) { | |
| 101 | + return !elem.nodeName || | |
| 102 | + $.inArray(elem.nodeName.toLowerCase(), ['iframe','#document','html','body']) !== -1; | |
| 103 | + } | |
| 104 | + | |
| 105 | + $.fn.scrollTo = function(target, duration, settings) { | |
| 106 | + if (typeof duration === 'object') { | |
| 107 | + settings = duration; | |
| 108 | + duration = 0; | |
| 109 | + } | |
| 110 | + if (typeof settings === 'function') { | |
| 111 | + settings = { onAfter:settings }; | |
| 112 | + } | |
| 113 | + if (target === 'max') { | |
| 114 | + target = 9e9; | |
| 115 | + } | |
| 116 | + | |
| 117 | + settings = $.extend({}, $scrollTo.defaults, settings); | |
| 118 | + // Speed is still recognized for backwards compatibility | |
| 119 | + duration = duration || settings.duration; | |
| 120 | + // Make sure the settings are given right | |
| 121 | + var queue = settings.queue && settings.axis.length > 1; | |
| 122 | + if (queue) { | |
| 123 | + // Let's keep the overall duration | |
| 124 | + duration /= 2; | |
| 125 | + } | |
| 126 | + settings.offset = both(settings.offset); | |
| 127 | + settings.over = both(settings.over); | |
| 128 | + | |
| 129 | + return this.each(function() { | |
| 130 | + // Null target yields nothing, just like jQuery does | |
| 131 | + if (target === null) return; | |
| 132 | + | |
| 133 | + var win = isWin(this), | |
| 134 | + elem = win ? this.contentWindow || window : this, | |
| 135 | + $elem = $(elem), | |
| 136 | + targ = target, | |
| 137 | + attr = {}, | |
| 138 | + toff; | |
| 139 | + | |
| 140 | + switch (typeof targ) { | |
| 141 | + // A number will pass the regex | |
| 142 | + case 'number': | |
| 143 | + case 'string': | |
| 144 | + if (/^([+-]=?)?\d+(\.\d+)?(px|%)?$/.test(targ)) { | |
| 145 | + targ = both(targ); | |
| 146 | + // We are done | |
| 147 | + break; | |
| 148 | + } | |
| 149 | + // Relative/Absolute selector | |
| 150 | + targ = win ? $(targ) : $(targ, elem); | |
| 151 | + /* falls through */ | |
| 152 | + case 'object': | |
| 153 | + if (targ.length === 0) return; | |
| 154 | + // DOMElement / jQuery | |
| 155 | + if (targ.is || targ.style) { | |
| 156 | + // Get the real position of the target | |
| 157 | + toff = (targ = $(targ)).offset(); | |
| 158 | + } | |
| 159 | + } | |
| 160 | + | |
| 161 | + var offset = $.isFunction(settings.offset) && settings.offset(elem, targ) || settings.offset; | |
| 162 | + | |
| 163 | + $.each(settings.axis.split(''), function(i, axis) { | |
| 164 | + var Pos = axis === 'x' ? 'Left' : 'Top', | |
| 165 | + pos = Pos.toLowerCase(), | |
| 166 | + key = 'scroll' + Pos, | |
| 167 | + prev = $elem[key](), | |
| 168 | + max = $scrollTo.max(elem, axis); | |
| 169 | + | |
| 170 | + if (toff) {// jQuery / DOMElement | |
| 171 | + attr[key] = toff[pos] + (win ? 0 : prev - $elem.offset()[pos]); | |
| 172 | + | |
| 173 | + // If it's a dom element, reduce the margin | |
| 174 | + if (settings.margin) { | |
| 175 | + attr[key] -= parseInt(targ.css('margin'+Pos), 10) || 0; | |
| 176 | + attr[key] -= parseInt(targ.css('border'+Pos+'Width'), 10) || 0; | |
| 177 | + } | |
| 178 | + | |
| 179 | + attr[key] += offset[pos] || 0; | |
| 180 | + | |
| 181 | + if (settings.over[pos]) { | |
| 182 | + // Scroll to a fraction of its width/height | |
| 183 | + attr[key] += targ[axis === 'x'?'width':'height']() * settings.over[pos]; | |
| 184 | + } | |
| 185 | + } else { | |
| 186 | + var val = targ[pos]; | |
| 187 | + // Handle percentage values | |
| 188 | + attr[key] = val.slice && val.slice(-1) === '%' ? | |
| 189 | + parseFloat(val) / 100 * max | |
| 190 | + : val; | |
| 191 | + } | |
| 192 | + | |
| 193 | + // Number or 'number' | |
| 194 | + if (settings.limit && /^\d+$/.test(attr[key])) { | |
| 195 | + // Check the limits | |
| 196 | + attr[key] = attr[key] <= 0 ? 0 : Math.min(attr[key], max); | |
| 197 | + } | |
| 198 | + | |
| 199 | + // Don't waste time animating, if there's no need. | |
| 200 | + if (!i && settings.axis.length > 1) { | |
| 201 | + if (prev === attr[key]) { | |
| 202 | + // No animation needed | |
| 203 | + attr = {}; | |
| 204 | + } else if (queue) { | |
| 205 | + // Intermediate animation | |
| 206 | + animate(settings.onAfterFirst); | |
| 207 | + // Don't animate this axis again in the next iteration. | |
| 208 | + attr = {}; | |
| 209 | + } | |
| 210 | + } | |
| 211 | + }); | |
| 212 | + | |
| 213 | + animate(settings.onAfter); | |
| 214 | + | |
| 215 | + function animate(callback) { | |
| 216 | + var opts = $.extend({}, settings, { | |
| 217 | + // The queue setting conflicts with animate() | |
| 218 | + // Force it to always be true | |
| 219 | + queue: true, | |
| 220 | + duration: duration, | |
| 221 | + complete: callback && function() { | |
| 222 | + callback.call(elem, targ, settings); | |
| 223 | + } | |
| 224 | + }); | |
| 225 | + $elem.animate(attr, opts); | |
| 226 | + } | |
| 227 | + }); | |
| 228 | + }; | |
| 229 | + | |
| 230 | + // Max scrolling position, works on quirks mode | |
| 231 | + // It only fails (not too badly) on IE, quirks mode. | |
| 232 | + $scrollTo.max = function(elem, axis) { | |
| 233 | + var Dim = axis === 'x' ? 'Width' : 'Height', | |
| 234 | + scroll = 'scroll'+Dim; | |
| 235 | + | |
| 236 | + if (!isWin(elem)) | |
| 237 | + return elem[scroll] - $(elem)[Dim.toLowerCase()](); | |
| 238 | + | |
| 239 | + var size = 'client' + Dim, | |
| 240 | + doc = elem.ownerDocument || elem.document, | |
| 241 | + html = doc.documentElement, | |
| 242 | + body = doc.body; | |
| 243 | + | |
| 244 | + return Math.max(html[scroll], body[scroll]) - Math.min(html[size], body[size]); | |
| 245 | + }; | |
| 246 | + | |
| 247 | + function both(val) { | |
| 248 | + return $.isFunction(val) || $.isPlainObject(val) ? val : { top:val, left:val }; | |
| 249 | + } | |
| 250 | + | |
| 251 | + // Add special hooks so that window scroll properties can be animated | |
| 252 | + $.Tween.propHooks.scrollLeft = | |
| 253 | + $.Tween.propHooks.scrollTop = { | |
| 254 | + get: function(t) { | |
| 255 | + return $(t.elem)[t.prop](); | |
| 256 | + }, | |
| 257 | + set: function(t) { | |
| 258 | + var curr = this.get(t); | |
| 259 | + // If interrupt is true and user scrolled, stop animating | |
| 260 | + if (t.options.interrupt && t._last && t._last !== curr) { | |
| 261 | + return $(t.elem).stop(); | |
| 262 | + } | |
| 263 | + var next = Math.round(t.now); | |
| 264 | + // Don't waste CPU | |
| 265 | + // Browsers don't render floating point scroll | |
| 266 | + if (curr !== next) { | |
| 267 | + $(t.elem)[t.prop](next); | |
| 268 | + t._last = this.get(t); | |
| 269 | + } | |
| 270 | + } | |
| 271 | + }; | |
| 272 | + | |
| 273 | + // AMD requirement | |
| 274 | + return $scrollTo; | |
| 275 | +}); | |
| 276 | +(function (e) { | |
| 277 | + e.backward_timer = function (t) { | |
| 278 | + var n = {seconds: 5, step: 1, format: "h%:m%:s%", value_setter: undefined, on_exhausted: function (e) { | |
| 279 | + }, on_tick : function (e) { | |
| 280 | + }}, r = this; | |
| 281 | + r.seconds_left = 0; | |
| 282 | + r.target = e(t); | |
| 283 | + r.timeout = undefined; | |
| 284 | + r.settings = {}; | |
| 285 | + r.methods = {init : function (t) { | |
| 286 | + r.settings = e.extend({}, n, t); | |
| 287 | + if (r.settings.value_setter == undefined) { | |
| 288 | + if (r.target.is("input")) { | |
| 289 | + r.settings.value_setter = "val" | |
| 290 | + } else { | |
| 291 | + r.settings.value_setter = "text" | |
| 292 | + } | |
| 293 | + } | |
| 294 | + r.methods.reset() | |
| 295 | + }, start : function () { | |
| 296 | + if (r.timeout == undefined) { | |
| 297 | + var e = r.seconds_left == r.settings.seconds ? 0 : r.settings.step * 1e3; | |
| 298 | + setTimeout(r.methods._on_tick, e, e) | |
| 299 | + } | |
| 300 | + }, cancel : function () { | |
| 301 | + if (r.timeout != undefined) { | |
| 302 | + clearTimeout(r.timeout); | |
| 303 | + r.timeout = undefined | |
| 304 | + } | |
| 305 | + }, reset : function () { | |
| 306 | + r.seconds_left = r.settings.seconds; | |
| 307 | + r.methods._render_seconds() | |
| 308 | + }, _on_tick : function (e) { | |
| 309 | + if (e != 0) { | |
| 310 | + r.settings.on_tick(r) | |
| 311 | + } | |
| 312 | + r.methods._render_seconds(); | |
| 313 | + if (r.seconds_left > 0) { | |
| 314 | + if (r.seconds_left < r.settings.step) { | |
| 315 | + var t = r.seconds_left | |
| 316 | + } else { | |
| 317 | + var t = r.settings.step | |
| 318 | + } | |
| 319 | + r.seconds_left -= t; | |
| 320 | + var n = t * 1e3; | |
| 321 | + r.timeout = setTimeout(r.methods._on_tick, n, n) | |
| 322 | + } else { | |
| 323 | + r.timeout = undefined; | |
| 324 | + r.settings.on_exhausted(r) | |
| 325 | + } | |
| 326 | + }, _render_seconds : function () { | |
| 327 | + var e = r.methods._seconds_to_dhms(r.seconds_left), t = r.settings.format; | |
| 328 | + if (t.indexOf("d%") !== -1) { | |
| 329 | + t = t.replace("d%", e.d).replace("h%", r.methods._check_leading_zero(e.h)) | |
| 330 | + } else { | |
| 331 | + t = t.replace("h%", e.d * 24 + e.h) | |
| 332 | + } | |
| 333 | + t = t.replace("m%", r.methods._check_leading_zero(e.m)).replace("s%", r.methods._check_leading_zero(e.s)); | |
| 334 | + r.target[r.settings.value_setter](t) | |
| 335 | + }, _seconds_to_dhms : function (e) { | |
| 336 | + var t = Math.floor(e / (24 * 3600)), e = e - t * 24 * 3600, n = Math.floor(e / 3600), e = e - n * 3600, r = Math.floor(e / 60), i = Math.floor(e - r * 60); | |
| 337 | + return{d: t, h: n, m: r, s: i} | |
| 338 | + }, _check_leading_zero: function (e) { | |
| 339 | + return e < 10 ? "0" + e : "" + e | |
| 340 | + }} | |
| 341 | + }; | |
| 342 | + e.fn.backward_timer = function (t) { | |
| 343 | + var n = arguments; | |
| 344 | + return this.each(function () { | |
| 345 | + var r = e(this).data("backward_timer"); | |
| 346 | + if (r == undefined) { | |
| 347 | + r = new e.backward_timer(this); | |
| 348 | + e(this).data("backward_timer", r) | |
| 349 | + } | |
| 350 | + if (r.methods[t]) { | |
| 351 | + return r.methods[t].apply(this, Array.prototype.slice.call(n, 1)) | |
| 352 | + } else if (typeof t === "object" || !t) { | |
| 353 | + return r.methods.init.apply(this, n) | |
| 354 | + } else { | |
| 355 | + e.error("Method " + t + " does not exist on jQuery.backward_timer") | |
| 356 | + } | |
| 357 | + }) | |
| 358 | + } | |
| 359 | +})(jQuery); | |