Path: blob/master/sites/bitcoin/themes/default/js/ui-plugins.js
777 views
/*!1* FitVids 1.02* Copyright 2011, Chris Coyier - http://css-tricks.com + Dave Rupert - http://daverupert.com3* Credit to Thierry Koblentz - http://www.alistapart.com/articles/creating-intrinsic-ratios-for-video/4* Released under the WTFPL license - http://sam.zoy.org/wtfpl/5*/6(function(a) {7a.fn.fitVids = function(b) {8var c = {9customSelector: null10};11var e = document.createElement("div"),12d = document.getElementsByTagName("base")[0] || document.getElementsByTagName("script")[0];13e.className = "fit-vids-style";14e.innerHTML = "­<style> .fluid-width-video-wrapper { width: 100%; position: relative; padding: 0; } .fluid-width-video-wrapper iframe, .fluid-width-video-wrapper object, .fluid-width-video-wrapper embed { position: absolute; top: 0; left: 0; width: 100%; height: 100%; } </style>";15d.parentNode.insertBefore(e, d);16if (b) {17a.extend(c, b)18}19return this.each(function() {20var f = ["iframe[src*='player.vimeo.com']", "iframe[src*='youtube.com']", "iframe[src*='youtube-nocookie.com']", "iframe[src*='kickstarter.com']", "object", "embed"];21if (c.customSelector) {22f.push(c.customSelector)23}24var g = a(this).find(f.join(","));25g.each(function() {26var l = a(this);27if (this.tagName.toLowerCase() === "embed" && l.parent("object").length || l.parent(".fluid-width-video-wrapper").length) {28return29}30var h = (this.tagName.toLowerCase() === "object" || (l.attr("height") && !isNaN(parseInt(l.attr("height"), 10)))) ? parseInt(l.attr("height"), 10) : l.height(),31i = !isNaN(parseInt(l.attr("width"), 10)) ? parseInt(l.attr("width"), 10) : l.width(),32j = h / i;33if (!l.attr("id")) {34var k = "fitvid" + Math.floor(Math.random() * 999999);35l.attr("id", k)36}37l.wrap('<div class="fluid-width-video-wrapper"></div>').parent(".fluid-width-video-wrapper").css("padding-top", (j * 100) + "%");38l.removeAttr("height").removeAttr("width")39})40})41}42})(jQuery);43/*44* jQuery Superfish Menu Plugin - v1.7.445* Copyright (c) 2013 Joel Birch46*47* Dual licensed under the MIT and GPL licenses:48* http://www.opensource.org/licenses/mit-license.php49* http://www.gnu.org/licenses/gpl.html50*/5152;53(function(e) {54"use strict";55var s = function() {56var s = {57bcClass: "sf-breadcrumb",58menuClass: "sf-js-enabled",59anchorClass: "sf-with-ul",60menuArrowClass: "sf-arrows"61},62o = function() {63var s = /iPhone|iPad|iPod/i.test(navigator.userAgent);64return s && e(window).load(function() {65e("body").children().on("click", e.noop)66}), s67}(),68n = function() {69var e = document.documentElement.style;70return "behavior" in e && "fill" in e && /iemobile/i.test(navigator.userAgent)71}(),72t = function(e, o) {73var n = s.menuClass;74o.cssArrows && (n += " " + s.menuArrowClass), e.toggleClass(n)75},76i = function(o, n) {77return o.find("li." + n.pathClass).slice(0, n.pathLevels).addClass(n.hoverClass + " " + s.bcClass).filter(function() {78return e(this).children(n.popUpSelector).hide().show().length79}).removeClass(n.pathClass)80},81r = function(e) {82e.children("a").toggleClass(s.anchorClass)83},84a = function(e) {85var s = e.css("ms-touch-action");86s = "pan-y" === s ? "auto" : "pan-y", e.css("ms-touch-action", s)87},88l = function(s, t) {89var i = "li:has(" + t.popUpSelector + ")";90e.fn.hoverIntent && !t.disableHI ? s.hoverIntent(u, p, i) : s.on("mouseenter.superfish", i, u).on("mouseleave.superfish", i, p);91var r = "MSPointerDown.superfish";92o || (r += " touchend.superfish"), n && (r += " mousedown.superfish"), s.on("focusin.superfish", "li", u).on("focusout.superfish", "li", p).on(r, "a", t, h)93},94h = function(s) {95var o = e(this),96n = o.siblings(s.data.popUpSelector);97n.length > 0 && n.is(":hidden") && (o.one("click.superfish", !1), "MSPointerDown" === s.type ? o.trigger("focus") : e.proxy(u, o.parent("li"))())98},99u = function() {100var s = e(this),101o = d(s);102clearTimeout(o.sfTimer), s.siblings().superfish("hide").end().superfish("show")103},104p = function() {105var s = e(this),106n = d(s);107o ? e.proxy(f, s, n)() : (clearTimeout(n.sfTimer), n.sfTimer = setTimeout(e.proxy(f, s, n), n.delay))108},109f = function(s) {110s.retainPath = e.inArray(this[0], s.$path) > -1, this.superfish("hide"), this.parents("." + s.hoverClass).length || (s.onIdle.call(c(this)), s.$path.length && e.proxy(u, s.$path)())111},112c = function(e) {113return e.closest("." + s.menuClass)114},115d = function(e) {116return c(e).data("sf-options")117};118return {119hide: function(s) {120if (this.length) {121var o = this,122n = d(o);123if (!n) return this;124var t = n.retainPath === !0 ? n.$path : "",125i = o.find("li." + n.hoverClass).add(this).not(t).removeClass(n.hoverClass).children(n.popUpSelector),126r = n.speedOut;127s && (i.show(), r = 0), n.retainPath = !1, n.onBeforeHide.call(i), i.stop(!0, !0).animate(n.animationOut, r, function() {128var s = e(this);129n.onHide.call(s)130})131}132return this133},134show: function() {135var e = d(this);136if (!e) return this;137var s = this.addClass(e.hoverClass),138o = s.children(e.popUpSelector);139return e.onBeforeShow.call(o), o.stop(!0, !0).animate(e.animation, e.speed, function() {140e.onShow.call(o)141}), this142},143destroy: function() {144return this.each(function() {145var o, n = e(this),146i = n.data("sf-options");147return i ? (o = n.find(i.popUpSelector).parent("li"), clearTimeout(i.sfTimer), t(n, i), r(o), a(n), n.off(".superfish").off(".hoverIntent"), o.children(i.popUpSelector).attr("style", function(e, s) {148return s.replace(/display[^;]+;?/g, "")149}), i.$path.removeClass(i.hoverClass + " " + s.bcClass).addClass(i.pathClass), n.find("." + i.hoverClass).removeClass(i.hoverClass), i.onDestroy.call(n), n.removeData("sf-options"), void 0) : !1150})151},152init: function(o) {153return this.each(function() {154var n = e(this);155if (n.data("sf-options")) return !1;156var h = e.extend({}, e.fn.superfish.defaults, o),157u = n.find(h.popUpSelector).parent("li");158h.$path = i(n, h), n.data("sf-options", h), t(n, h), r(u), a(n), l(n, h), u.not("." + s.bcClass).superfish("hide", !0), h.onInit.call(this)159})160}161}162}();163e.fn.superfish = function(o) {164return s[o] ? s[o].apply(this, Array.prototype.slice.call(arguments, 1)) : "object" != typeof o && o ? e.error("Method " + o + " does not exist on jQuery.fn.superfish") : s.init.apply(this, arguments)165}, e.fn.superfish.defaults = {166popUpSelector: "ul,.sf-mega",167hoverClass: "sfHover",168pathClass: "overrideThisToUse",169pathLevels: 1,170delay: 800,171animation: {172opacity: "show"173},174animationOut: {175opacity: "hide"176},177speed: "normal",178speedOut: "fast",179cssArrows: !0,180disableHI: !1,181onInit: e.noop,182onBeforeShow: e.noop,183onShow: e.noop,184onBeforeHide: e.noop,185onHide: e.noop,186onIdle: e.noop,187onDestroy: e.noop188}, e.fn.extend({189hideSuperfishUl: s.hide,190showSuperfishUl: s.show191})192})(jQuery);193194/**195* jQuery ScrollTo196* Copyright (c) 2007-2012 Ariel Flesler - aflesler(at)gmail(dot)com | http://flesler.blogspot.com197* Dual licensed under MIT and GPL.198* @author Ariel Flesler199* @version 1.4.3200*/201202;203(function($) {204var h = $.scrollTo = function(a, b, c) {205$(window).scrollTo(a, b, c)206};207h.defaults = {208axis: 'xy',209duration: parseFloat($.fn.jquery) >= 1.3 ? 0 : 1,210limit: true211};212h.window = function(a) {213return $(window)._scrollable()214};215$.fn._scrollable = function() {216return this.map(function() {217var a = this,218isWin = !a.nodeName || $.inArray(a.nodeName.toLowerCase(), ['iframe', '#document', 'html', 'body']) != -1;219if (!isWin) return a;220var b = (a.contentWindow || a).document || a.ownerDocument || a;221return /webkit/i.test(navigator.userAgent) || b.compatMode == 'BackCompat' ? b.body : b.documentElement222})223};224$.fn.scrollTo = function(e, f, g) {225if (typeof f == 'object') {226g = f;227f = 0228}229if (typeof g == 'function') g = {230onAfter: g231};232if (e == 'max') e = 9e9;233g = $.extend({}, h.defaults, g);234f = f || g.duration;235g.queue = g.queue && g.axis.length > 1;236if (g.queue) f /= 2;237g.offset = both(g.offset);238g.over = both(g.over);239return this._scrollable().each(function() {240if (!e) return;241var d = this,242$elem = $(d),243targ = e,244toff, attr = {},245win = $elem.is('html,body');246switch (typeof targ) {247case 'number':248case 'string':249if (/^([+-]=)?\d+(\.\d+)?(px|%)?$/.test(targ)) {250targ = both(targ);251break252}253targ = $(targ, this);254if (!targ.length) return;255case 'object':256if (targ.is || targ.style) toff = (targ = $(targ)).offset()257}258$.each(g.axis.split(''), function(i, a) {259var b = a == 'x' ? 'Left' : 'Top',260pos = b.toLowerCase(),261key = 'scroll' + b,262old = d[key],263max = h.max(d, a);264if (toff) {265attr[key] = toff[pos] + (win ? 0 : old - $elem.offset()[pos]);266if (g.margin) {267attr[key] -= parseInt(targ.css('margin' + b)) || 0;268attr[key] -= parseInt(targ.css('border' + b + 'Width')) || 0269}270attr[key] += g.offset[pos] || 0;271if (g.over[pos]) attr[key] += targ[a == 'x' ? 'width' : 'height']() * g.over[pos]272} else {273var c = targ[pos];274attr[key] = c.slice && c.slice(-1) == '%' ? parseFloat(c) / 100 * max : c275}276if (g.limit && /^\d+$/.test(attr[key])) attr[key] = attr[key] <= 0 ? 0 : Math.min(attr[key], max);277if (!i && g.queue) {278if (old != attr[key]) animate(g.onAfterFirst);279delete attr[key]280}281});282animate(g.onAfter);283284function animate(a) {285$elem.animate(attr, f, g.easing, a && function() {286a.call(this, e, g)287})288}289}).end()290};291h.max = function(a, b) {292var c = b == 'x' ? 'Width' : 'Height',293scroll = 'scroll' + c;294if (!$(a).is('html,body')) return a[scroll] - $(a)[c.toLowerCase()]();295var d = 'client' + c,296html = a.ownerDocument.documentElement,297body = a.ownerDocument.body;298return Math.max(html[scroll], body[scroll]) - Math.min(html[d], body[d])299};300301function both(a) {302return typeof a == 'object' ? a : {303top: a,304left: a305}306}307})(jQuery);308/*309Plugin Name: Count To310Written by: Matt Huggins - https://github.com/mhuggins/jquery-countTo311312*/313(function($) {314$.fn.countTo = function(options) {315options = options || {};316317return $(this).each(function() {318// set options for current element319var settings = $.extend({}, $.fn.countTo.defaults, {320from: $(this).data('from'),321to: $(this).data('to'),322speed: $(this).data('speed'),323refreshInterval: $(this).data('refresh-interval'),324decimals: $(this).data('decimals')325}, options);326327// how many times to update the value, and how much to increment the value on each update328var loops = Math.ceil(settings.speed / settings.refreshInterval),329increment = (settings.to - settings.from) / loops;330331// references & variables that will change with each update332var self = this,333$self = $(this),334loopCount = 0,335value = settings.from,336data = $self.data('countTo') || {};337338$self.data('countTo', data);339340// if an existing interval can be found, clear it first341if (data.interval) {342clearInterval(data.interval);343}344data.interval = setInterval(updateTimer, settings.refreshInterval);345346// initialize the element with the starting value347render(value);348349function updateTimer() {350value += increment;351loopCount++;352353render(value);354355if (typeof(settings.onUpdate) == 'function') {356settings.onUpdate.call(self, value);357}358359if (loopCount >= loops) {360// remove the interval361$self.removeData('countTo');362clearInterval(data.interval);363value = settings.to;364365if (typeof(settings.onComplete) == 'function') {366settings.onComplete.call(self, value);367}368}369}370371function render(value) {372var formattedValue = settings.formatter.call(self, value, settings);373$self.html(formattedValue);374}375});376};377378$.fn.countTo.defaults = {379from: 0, // the number the element should start at380to: 0, // the number the element should end at381speed: 1000, // how long it should take to count between the target numbers382refreshInterval: 100, // how often the element should be updated383decimals: 0, // the number of decimal places to show384formatter: formatter, // handler for formatting the value before rendering385onUpdate: null, // callback method for every time the element is updated386onComplete: null // callback method for when the element finishes updating387};388389function formatter(value, settings) {390return value.toFixed(settings.decimals);391}392}(jQuery));393394/*!395* Bootstrap-select v1.6.0 (http://silviomoreto.github.io/bootstrap-select/)396*397* Copyright 2013-2014 bootstrap-select398* Licensed under MIT (https://github.com/silviomoreto/bootstrap-select/blob/master/LICENSE)399*/400! function(a) {401"use strict";402a.expr[":"].icontains = function(b, c, d) {403return a(b).text().toUpperCase().indexOf(d[3].toUpperCase()) >= 0404};405var b = function(c, d, e) {406e && (e.stopPropagation(), e.preventDefault()), this.$element = a(c), this.$newElement = null, this.$button = null, this.$menu = null, this.$lis = null, this.options = d, null === this.options.title && (this.options.title = this.$element.attr("title")), this.val = b.prototype.val, this.render = b.prototype.render, this.refresh = b.prototype.refresh, this.setStyle = b.prototype.setStyle, this.selectAll = b.prototype.selectAll, this.deselectAll = b.prototype.deselectAll, this.destroy = b.prototype.destroy, this.remove = b.prototype.destroy, this.show = b.prototype.show, this.hide = b.prototype.hide, this.init()407};408b.VERSION = "1.6.0", b.DEFAULTS = {409style: "btn-default",410size: "auto",411title: null,412selectedTextFormat: "values",413noneSelectedText: "Nothing selected",414noneResultsText: "No results match",415countSelectedText: "{0} of {1} selected",416maxOptionsText: ["Limit reached ({n} {var} max)", "Group limit reached ({n} {var} max)", ["items", "item"]],417width: !1,418container: !1,419hideDisabled: !1,420showSubtext: !1,421showIcon: !0,422showContent: !0,423dropupAuto: !0,424header: !1,425liveSearch: !1,426actionsBox: !1,427multipleSeparator: ", ",428iconBase: "glyphicon",429tickIcon: "glyphicon-ok",430maxOptions: !1,431mobile: !1432}, b.prototype = {433constructor: b,434init: function() {435var b = this,436c = this.$element.attr("id");437this.$element.hide(), this.multiple = this.$element.prop("multiple"), this.autofocus = this.$element.prop("autofocus"), this.$newElement = this.createView(), this.$element.after(this.$newElement), this.$menu = this.$newElement.find("> .dropdown-menu"), this.$button = this.$newElement.find("> button"), this.$searchbox = this.$newElement.find("input"), void 0 !== c && (this.$button.attr("data-id", c), a('label[for="' + c + '"]').click(function(a) {438a.preventDefault(), b.$button.focus()439})), this.checkDisabled(), this.clickListener(), this.options.liveSearch && this.liveSearchListener(), this.render(), this.liHeight(), this.setStyle(), this.setWidth(), this.options.container && this.selectPosition(), this.$menu.data("this", this), this.$newElement.data("this", this), this.options.mobile && this.mobile()440},441createDropdown: function() {442var b = this.multiple ? " show-tick" : "",443c = this.$element.parent().hasClass("input-group") ? " input-group-btn" : "",444d = this.autofocus ? " autofocus" : "",445e = this.options.header ? '<div class="popover-title"><button type="button" class="close" aria-hidden="true">×</button>' + this.options.header + "</div>" : "",446f = this.options.liveSearch ? '<div class="bootstrap-select-searchbox"><input type="text" class="input-block-level form-control" autocomplete="off" /></div>' : "",447g = this.options.actionsBox ? '<div class="bs-actionsbox"><div class="btn-group btn-block"><button class="actions-btn bs-select-all btn btn-sm btn-default">Select All</button><button class="actions-btn bs-deselect-all btn btn-sm btn-default">Deselect All</button></div></div>' : "",448h = '<div class="btn-group bootstrap-select' + b + c + '"><button type="button" class="btn dropdown-toggle selectpicker" data-toggle="dropdown"' + d + '><span class="filter-option pull-left"></span> <span class="caret"></span></button><div class="dropdown-menu open">' + e + f + g + '<ul class="dropdown-menu inner selectpicker" role="menu"></ul></div></div>';449return a(h)450},451createView: function() {452var a = this.createDropdown(),453b = this.createLi();454return a.find("ul").append(b), a455},456reloadLi: function() {457this.destroyLi();458var a = this.createLi();459this.$menu.find("ul").append(a)460},461destroyLi: function() {462this.$menu.find("li").remove()463},464createLi: function() {465var b = this,466c = [],467d = "",468e = 0;469return this.$element.find("option").each(function() {470var d = a(this),471f = d.attr("class") || "",472g = d.attr("style") || "",473h = d.data("content") ? d.data("content") : d.html(),474i = void 0 !== d.data("subtext") ? '<small class="muted text-muted">' + d.data("subtext") + "</small>" : "",475j = void 0 !== d.data("icon") ? '<i class="' + b.options.iconBase + " " + d.data("icon") + '"></i> ' : "";476if ("" !== j && (d.is(":disabled") || d.parent().is(":disabled")) && (j = "<span>" + j + "</span>"), d.data("content") || (h = j + '<span class="text">' + h + i + "</span>"), b.options.hideDisabled && (d.is(":disabled") || d.parent().is(":disabled"))) c.push('<a style="min-height: 0; padding: 0"></a>');477else if (d.parent().is("optgroup") && d.data("divider") !== !0)478if (0 === d.index()) {479var k = d.parent().attr("label"),480l = void 0 !== d.parent().data("subtext") ? '<small class="muted text-muted">' + d.parent().data("subtext") + "</small>" : "",481m = d.parent().data("icon") ? '<i class="' + b.options.iconBase + " " + d.parent().data("icon") + '"></i> ' : "";482k = m + '<span class="text">' + k + l + "</span>", e += 1, c.push(0 !== d[0].index ? '<div class="div-contain"><div class="divider"></div></div><dt>' + k + "</dt>" + b.createA(h, "opt " + f, g, e) : "<dt>" + k + "</dt>" + b.createA(h, "opt " + f, g, e))483} else c.push(b.createA(h, "opt " + f, g, e));484else c.push(d.data("divider") === !0 ? '<div class="div-contain"><div class="divider"></div></div>' : a(this).data("hidden") === !0 ? "<a></a>" : b.createA(h, f, g))485}), a.each(c, function(a, b) {486var c = "<a></a>" === b ? 'class="hide is-hidden"' : "";487d += '<li rel="' + a + '"' + c + ">" + b + "</li>"488}), this.multiple || 0 !== this.$element.find("option:selected").length || this.options.title || this.$element.find("option").eq(0).prop("selected", !0).attr("selected", "selected"), a(d)489},490createA: function(a, b, c, d) {491return '<a tabindex="0" class="' + b + '" style="' + c + '"' + ("undefined" != typeof d ? 'data-optgroup="' + d + '"' : "") + ">" + a + '<i class="' + this.options.iconBase + " " + this.options.tickIcon + ' icon-ok check-mark"></i></a>'492},493render: function(b) {494var c = this;495b !== !1 && this.$element.find("option").each(function(b) {496c.setDisabled(b, a(this).is(":disabled") || a(this).parent().is(":disabled")), c.setSelected(b, a(this).is(":selected"))497}), this.tabIndex();498var d = this.$element.find("option:selected").map(function() {499var b, d = a(this),500e = d.data("icon") && c.options.showIcon ? '<i class="' + c.options.iconBase + " " + d.data("icon") + '"></i> ' : "";501return b = c.options.showSubtext && d.attr("data-subtext") && !c.multiple ? ' <small class="muted text-muted">' + d.data("subtext") + "</small>" : "", d.data("content") && c.options.showContent ? d.data("content") : void 0 !== d.attr("title") ? d.attr("title") : e + d.html() + b502}).toArray(),503e = this.multiple ? d.join(this.options.multipleSeparator) : d[0];504if (this.multiple && this.options.selectedTextFormat.indexOf("count") > -1) {505var f = this.options.selectedTextFormat.split(">"),506g = this.options.hideDisabled ? ":not([disabled])" : "";507(f.length > 1 && d.length > f[1] || 1 == f.length && d.length >= 2) && (e = this.options.countSelectedText.replace("{0}", d.length).replace("{1}", this.$element.find('option:not([data-divider="true"], [data-hidden="true"])' + g).length))508}509this.options.title = this.$element.attr("title"), "static" == this.options.selectedTextFormat && (e = this.options.title), e || (e = void 0 !== this.options.title ? this.options.title : this.options.noneSelectedText), this.$button.attr("title", a.trim(a("<div/>").html(e).text()).replace(/\s\s+/g, " ")), this.$newElement.find(".filter-option").html(e)510},511setStyle: function(a, b) {512this.$element.attr("class") && this.$newElement.addClass(this.$element.attr("class").replace(/selectpicker|mobile-device|validate\[.*\]/gi, ""));513var c = a ? a : this.options.style;514"add" == b ? this.$button.addClass(c) : "remove" == b ? this.$button.removeClass(c) : (this.$button.removeClass(this.options.style), this.$button.addClass(c))515},516liHeight: function() {517if (this.options.size !== !1) {518var a = this.$menu.parent().clone().find("> .dropdown-toggle").prop("autofocus", !1).end().appendTo("body"),519b = a.addClass("open").find("> .dropdown-menu"),520c = b.find("li > a").outerHeight(),521d = this.options.header ? b.find(".popover-title").outerHeight() : 0,522e = this.options.liveSearch ? b.find(".bootstrap-select-searchbox").outerHeight() : 0,523f = this.options.actionsBox ? b.find(".bs-actionsbox").outerHeight() : 0;524a.remove(), this.$newElement.data("liHeight", c).data("headerHeight", d).data("searchHeight", e).data("actionsHeight", f)525}526},527setSize: function() {528var b, c, d, e = this,529f = this.$menu,530g = f.find(".inner"),531h = this.$newElement.outerHeight(),532i = this.$newElement.data("liHeight"),533j = this.$newElement.data("headerHeight"),534k = this.$newElement.data("searchHeight"),535l = this.$newElement.data("actionsHeight"),536m = f.find("li .divider").outerHeight(!0),537n = parseInt(f.css("padding-top")) + parseInt(f.css("padding-bottom")) + parseInt(f.css("border-top-width")) + parseInt(f.css("border-bottom-width")),538o = this.options.hideDisabled ? ":not(.disabled)" : "",539p = a(window),540q = n + parseInt(f.css("margin-top")) + parseInt(f.css("margin-bottom")) + 2,541r = function() {542c = e.$newElement.offset().top - p.scrollTop(), d = p.height() - c - h543};544if (r(), this.options.header && f.css("padding-top", 0), "auto" == this.options.size) {545var s = function() {546var a, h = e.$lis.not(".hide");547r(), b = d - q, e.options.dropupAuto && e.$newElement.toggleClass("dropup", c > d && b - q < f.height()), e.$newElement.hasClass("dropup") && (b = c - q), a = h.length + h.find("dt").length > 3 ? 3 * i + q - 2 : 0, f.css({548"max-height": b + "px",549overflow: "hidden",550"min-height": a + j + k + l + "px"551}), g.css({552"max-height": b - j - k - l - n + "px",553"overflow-y": "auto",554"min-height": Math.max(a - n, 0) + "px"555})556};557s(), this.$searchbox.off("input.getSize propertychange.getSize").on("input.getSize propertychange.getSize", s), a(window).off("resize.getSize").on("resize.getSize", s), a(window).off("scroll.getSize").on("scroll.getSize", s)558} else if (this.options.size && "auto" != this.options.size && f.find("li" + o).length > this.options.size) {559var t = f.find("li" + o + " > *").not(".div-contain").slice(0, this.options.size).last().parent().index(),560u = f.find("li").slice(0, t + 1).find(".div-contain").length;561b = i * this.options.size + u * m + n, e.options.dropupAuto && this.$newElement.toggleClass("dropup", c > d && b < f.height()), f.css({562"max-height": b + j + k + l + "px",563overflow: "hidden"564}), g.css({565"max-height": b - n + "px",566"overflow-y": "auto"567})568}569},570setWidth: function() {571if ("auto" == this.options.width) {572this.$menu.css("min-width", "0");573var a = this.$newElement.clone().appendTo("body"),574b = a.find("> .dropdown-menu").css("width"),575c = a.css("width", "auto").find("> button").css("width");576a.remove(), this.$newElement.css("width", Math.max(parseInt(b), parseInt(c)) + "px")577} else "fit" == this.options.width ? (this.$menu.css("min-width", ""), this.$newElement.css("width", "").addClass("fit-width")) : this.options.width ? (this.$menu.css("min-width", ""), this.$newElement.css("width", this.options.width)) : (this.$menu.css("min-width", ""), this.$newElement.css("width", ""));578this.$newElement.hasClass("fit-width") && "fit" !== this.options.width && this.$newElement.removeClass("fit-width")579},580selectPosition: function() {581var b, c, d = this,582e = "<div />",583f = a(e),584g = function(a) {585f.addClass(a.attr("class").replace(/form-control/gi, "")).toggleClass("dropup", a.hasClass("dropup")), b = a.offset(), c = a.hasClass("dropup") ? 0 : a[0].offsetHeight, f.css({586top: b.top + c,587left: b.left,588width: a[0].offsetWidth,589position: "absolute"590})591};592this.$newElement.on("click", function() {593d.isDisabled() || (g(a(this)), f.appendTo(d.options.container), f.toggleClass("open", !a(this).hasClass("open")), f.append(d.$menu))594}), a(window).resize(function() {595g(d.$newElement)596}), a(window).on("scroll", function() {597g(d.$newElement)598}), a("html").on("click", function(b) {599a(b.target).closest(d.$newElement).length < 1 && f.removeClass("open")600})601},602mobile: function() {603this.$element.addClass("mobile-device").appendTo(this.$newElement), this.options.container && this.$menu.hide()604},605refresh: function() {606this.$lis = null, this.reloadLi(), this.render(), this.setWidth(), this.setStyle(), this.checkDisabled(), this.liHeight()607},608update: function() {609this.reloadLi(), this.setWidth(), this.setStyle(), this.checkDisabled(), this.liHeight()610},611setSelected: function(b, c) {612null == this.$lis && (this.$lis = this.$menu.find("li")), a(this.$lis[b]).toggleClass("selected", c)613},614setDisabled: function(b, c) {615null == this.$lis && (this.$lis = this.$menu.find("li")), c ? a(this.$lis[b]).addClass("disabled").find("a").attr("href", "#").attr("tabindex", -1) : a(this.$lis[b]).removeClass("disabled").find("a").removeAttr("href").attr("tabindex", 0)616},617isDisabled: function() {618return this.$element.is(":disabled")619},620checkDisabled: function() {621var a = this;622this.isDisabled() ? this.$button.addClass("disabled").attr("tabindex", -1) : (this.$button.hasClass("disabled") && this.$button.removeClass("disabled"), -1 == this.$button.attr("tabindex") && (this.$element.data("tabindex") || this.$button.removeAttr("tabindex"))), this.$button.click(function() {623return !a.isDisabled()624})625},626tabIndex: function() {627this.$element.is("[tabindex]") && (this.$element.data("tabindex", this.$element.attr("tabindex")), this.$button.attr("tabindex", this.$element.data("tabindex")))628},629clickListener: function() {630var b = this;631this.$newElement.on("touchstart.dropdown", ".dropdown-menu", function(a) {632a.stopPropagation()633}), this.$newElement.on("click", function() {634b.setSize(), b.options.liveSearch || b.multiple || setTimeout(function() {635b.$menu.find(".selected a").focus()636}, 10)637}), this.$menu.on("click", "li a", function(c) {638var d = a(this).parent().index(),639e = b.$element.val(),640f = b.$element.prop("selectedIndex");641if (b.multiple && c.stopPropagation(), c.preventDefault(), !b.isDisabled() && !a(this).parent().hasClass("disabled")) {642var g = b.$element.find("option"),643h = g.eq(d),644i = h.prop("selected"),645j = h.parent("optgroup"),646k = b.options.maxOptions,647l = j.data("maxOptions") || !1;648if (b.multiple) {649if (h.prop("selected", !i), b.setSelected(d, !i), a(this).blur(), k !== !1 || l !== !1) {650var m = k < g.filter(":selected").length,651n = l < j.find("option:selected").length,652o = b.options.maxOptionsText,653p = o[0].replace("{n}", k),654q = o[1].replace("{n}", l),655r = a('<div class="notify"></div>');656if (k && m || l && n)657if (k && 1 == k) g.prop("selected", !1), h.prop("selected", !0), b.$menu.find(".selected").removeClass("selected"), b.setSelected(d, !0);658else if (l && 1 == l) {659j.find("option:selected").prop("selected", !1), h.prop("selected", !0);660var s = a(this).data("optgroup");661b.$menu.find(".selected").has('a[data-optgroup="' + s + '"]').removeClass("selected"), b.setSelected(d, !0)662} else o[2] && (p = p.replace("{var}", o[2][k > 1 ? 0 : 1]), q = q.replace("{var}", o[2][l > 1 ? 0 : 1])), h.prop("selected", !1), b.$menu.append(r), k && m && (r.append(a("<div>" + p + "</div>")), b.$element.trigger("maxReached.bs.select")), l && n && (r.append(a("<div>" + q + "</div>")), b.$element.trigger("maxReachedGrp.bs.select")), setTimeout(function() {663b.setSelected(d, !1)664}, 10), r.delay(750).fadeOut(300, function() {665a(this).remove()666})667}668} else g.prop("selected", !1), h.prop("selected", !0), b.$menu.find(".selected").removeClass("selected"), b.setSelected(d, !0);669b.multiple ? b.options.liveSearch && b.$searchbox.focus() : b.$button.focus(), (e != b.$element.val() && b.multiple || f != b.$element.prop("selectedIndex") && !b.multiple) && b.$element.change()670}671}), this.$menu.on("click", "li.disabled a, li dt, li .div-contain, .popover-title, .popover-title :not(.close)", function(a) {672a.target == this && (a.preventDefault(), a.stopPropagation(), b.options.liveSearch ? b.$searchbox.focus() : b.$button.focus())673}), this.$menu.on("click", ".popover-title .close", function() {674b.$button.focus()675}), this.$searchbox.on("click", function(a) {676a.stopPropagation()677}), this.$menu.on("click", ".actions-btn", function(c) {678b.options.liveSearch ? b.$searchbox.focus() : b.$button.focus(), c.preventDefault(), c.stopPropagation(), a(this).is(".bs-select-all") ? b.selectAll() : b.deselectAll(), b.$element.change()679}), this.$element.change(function() {680b.render(!1)681})682},683liveSearchListener: function() {684var b = this,685c = a('<li class="no-results"></li>');686this.$newElement.on("click.dropdown.data-api", function() {687b.$menu.find(".active").removeClass("active"), b.$searchbox.val() && (b.$searchbox.val(""), b.$lis.not(".is-hidden").removeClass("hide"), c.parent().length && c.remove()), b.multiple || b.$menu.find(".selected").addClass("active"), setTimeout(function() {688b.$searchbox.focus()689}, 10)690}), this.$searchbox.on("input propertychange", function() {691b.$searchbox.val() ? (b.$lis.not(".is-hidden").removeClass("hide").find("a").not(":icontains(" + b.$searchbox.val() + ")").parent().addClass("hide"), b.$menu.find("li").filter(":visible:not(.no-results)").length ? c.parent().length && c.remove() : (c.parent().length && c.remove(), c.html(b.options.noneResultsText + ' "' + b.$searchbox.val() + '"').show(), b.$menu.find("li").last().after(c))) : (b.$lis.not(".is-hidden").removeClass("hide"), c.parent().length && c.remove()), b.$menu.find("li.active").removeClass("active"), b.$menu.find("li").filter(":visible:not(.divider)").eq(0).addClass("active").find("a").focus(), a(this).focus()692}), this.$menu.on("mouseenter", "a", function(c) {693b.$menu.find(".active").removeClass("active"), a(c.currentTarget).parent().not(".disabled").addClass("active")694}), this.$menu.on("mouseleave", "a", function() {695b.$menu.find(".active").removeClass("active")696})697},698val: function(a) {699return void 0 !== a ? (this.$element.val(a), this.$element.change(), this.render(), this.$element) : this.$element.val()700},701selectAll: function() {702null == this.$lis && (this.$lis = this.$menu.find("li")), this.$element.find("option:enabled").prop("selected", !0), a(this.$lis).not(".disabled").addClass("selected"), this.render(!1)703},704deselectAll: function() {705null == this.$lis && (this.$lis = this.$menu.find("li")), this.$element.find("option:enabled").prop("selected", !1), a(this.$lis).not(".disabled").removeClass("selected"), this.render(!1)706},707keydown: function(b) {708var c, d, e, f, g, h, i, j, k, l, m, n, o = {70932: " ",71048: "0",71149: "1",71250: "2",71351: "3",71452: "4",71553: "5",71654: "6",71755: "7",71856: "8",71957: "9",72059: ";",72165: "a",72266: "b",72367: "c",72468: "d",72569: "e",72670: "f",72771: "g",72872: "h",72973: "i",73074: "j",73175: "k",73276: "l",73377: "m",73478: "n",73579: "o",73680: "p",73781: "q",73882: "r",73983: "s",74084: "t",74185: "u",74286: "v",74387: "w",74488: "x",74589: "y",74690: "z",74796: "0",74897: "1",74998: "2",75099: "3",751100: "4",752101: "5",753102: "6",754103: "7",755104: "8",756105: "9"757};758if (c = a(this), e = c.parent(), c.is("input") && (e = c.parent().parent()), l = e.data("this"), l.options.liveSearch && (e = c.parent().parent()), l.options.container && (e = l.$menu), d = a("[role=menu] li:not(.divider) a", e), n = l.$menu.parent().hasClass("open"), !n && /([0-9]|[A-z])/.test(String.fromCharCode(b.keyCode)) && (l.options.container ? l.$newElement.trigger("click") : (l.setSize(), l.$menu.parent().addClass("open"), n = !0), l.$searchbox.focus()), l.options.liveSearch && (/(^9$|27)/.test(b.keyCode.toString(10)) && n && 0 === l.$menu.find(".active").length && (b.preventDefault(), l.$menu.parent().removeClass("open"), l.$button.focus()), d = a("[role=menu] li:not(.divider):visible", e), c.val() || /(38|40)/.test(b.keyCode.toString(10)) || 0 === d.filter(".active").length && (d = l.$newElement.find("li").filter(":icontains(" + o[b.keyCode] + ")"))), d.length) {759if (/(38|40)/.test(b.keyCode.toString(10))) f = d.index(d.filter(":focus")), h = d.parent(":not(.disabled):visible").first().index(), i = d.parent(":not(.disabled):visible").last().index(), g = d.eq(f).parent().nextAll(":not(.disabled):visible").eq(0).index(), j = d.eq(f).parent().prevAll(":not(.disabled):visible").eq(0).index(), k = d.eq(g).parent().prevAll(":not(.disabled):visible").eq(0).index(), l.options.liveSearch && (d.each(function(b) {760a(this).is(":not(.disabled)") && a(this).data("index", b)761}), f = d.index(d.filter(".active")), h = d.filter(":not(.disabled):visible").first().data("index"), i = d.filter(":not(.disabled):visible").last().data("index"), g = d.eq(f).nextAll(":not(.disabled):visible").eq(0).data("index"), j = d.eq(f).prevAll(":not(.disabled):visible").eq(0).data("index"), k = d.eq(g).prevAll(":not(.disabled):visible").eq(0).data("index")), m = c.data("prevIndex"), 38 == b.keyCode && (l.options.liveSearch && (f -= 1), f != k && f > j && (f = j), h > f && (f = h), f == m && (f = i)), 40 == b.keyCode && (l.options.liveSearch && (f += 1), -1 == f && (f = 0), f != k && g > f && (f = g), f > i && (f = i), f == m && (f = h)), c.data("prevIndex", f), l.options.liveSearch ? (b.preventDefault(), c.is(".dropdown-toggle") || (d.removeClass("active"), d.eq(f).addClass("active").find("a").focus(), c.focus())) : d.eq(f).focus();762else if (!c.is("input")) {763var p, q, r = [];764d.each(function() {765a(this).parent().is(":not(.disabled)") && a.trim(a(this).text().toLowerCase()).substring(0, 1) == o[b.keyCode] && r.push(a(this).parent().index())766}), p = a(document).data("keycount"), p++, a(document).data("keycount", p), q = a.trim(a(":focus").text().toLowerCase()).substring(0, 1), q != o[b.keyCode] ? (p = 1, a(document).data("keycount", p)) : p >= r.length && (a(document).data("keycount", 0), p > r.length && (p = 1)), d.eq(r[p - 1]).focus()767}768/(13|32)/.test(b.keyCode.toString(10)) && n && (/(32)/.test(b.keyCode.toString(10)) || b.preventDefault(), l.options.liveSearch ? /(32)/.test(b.keyCode.toString(10)) || (l.$menu.find(".active a").click(), c.focus()) : a(":focus").click(), a(document).data("keycount", 0)), (/(^9$|27)/.test(b.keyCode.toString(10)) && n && (l.multiple || l.options.liveSearch) || /(27)/.test(b.keyCode.toString(10)) && !n) && (l.$menu.parent().removeClass("open"), l.$button.focus())769}770},771hide: function() {772this.$newElement.hide()773},774show: function() {775this.$newElement.show()776},777destroy: function() {778this.$newElement.remove(), this.$element.remove()779}780}, a.fn.selectpicker = function(c, d) {781var e, f = arguments,782g = this.each(function() {783if (a(this).is("select")) {784var g = a(this),785h = g.data("selectpicker"),786i = "object" == typeof c && c;787if (h) {788if (i)789for (var j in i) i.hasOwnProperty(j) && (h.options[j] = i[j])790} else g.data("selectpicker", h = new b(this, a.extend({}, b.DEFAULTS, a.fn.selectpicker.defaults || {}, g.data(), i), d));791if ("string" == typeof c) {792var k = c;793h[k] instanceof Function ? ([].shift.apply(f), e = h[k].apply(h, f)) : e = h.options[k]794}795}796});797return "undefined" != typeof e ? e : g798}, a.fn.selectpicker.Constructor = b, a(document).data("keycount", 0).on("keydown", ".bootstrap-select [data-toggle=dropdown], .bootstrap-select [role=menu], .bootstrap-select-searchbox input", b.prototype.keydown).on("focusin.modal", ".bootstrap-select [data-toggle=dropdown], .bootstrap-select [role=menu], .bootstrap-select-searchbox input", function(a) {799a.stopPropagation()800})801}(jQuery);802803804// Bootstrap DatePicker805! function($) {806function UTCDate() {807return new Date(Date.UTC.apply(Date, arguments))808}809810function UTCToday() {811var today = new Date();812return UTCDate(today.getUTCFullYear(), today.getUTCMonth(), today.getUTCDate())813}814var Datepicker = function(element, options) {815var that = this;816this.element = $(element);817this.language = options.language || this.element.data('date-language') || "en";818this.language = this.language in dates ? this.language : "en";819this.isRTL = dates[this.language].rtl || false;820this.format = DPGlobal.parseFormat(options.format || this.element.data('date-format') || 'mm/dd/yyyy');821this.isInline = false;822this.isInput = this.element.is('input');823this.component = this.element.is('.date') ? this.element.find('.add-on') : false;824this.hasInput = this.component && this.element.find('input').length;825if (this.component && this.component.length === 0) this.component = false;826this._attachEvents();827this.forceParse = true;828if ('forceParse' in options) {829this.forceParse = options.forceParse830} else if ('dateForceParse' in this.element.data()) {831this.forceParse = this.element.data('date-force-parse')832}833this.picker = $(DPGlobal.template).appendTo(this.isInline ? this.element : 'body').on({834click: $.proxy(this.click, this),835mousedown: $.proxy(this.mousedown, this)836});837if (this.isInline) {838this.picker.addClass('datepicker-inline')839} else {840this.picker.addClass('datepicker-dropdown dropdown-menu')841}842if (this.isRTL) {843this.picker.addClass('datepicker-rtl');844this.picker.find('.prev i, .next i').toggleClass('icon-arrow-left icon-arrow-right')845}846$(document).on('mousedown', function(e) {847if ($(e.target).closest('.datepicker').length === 0) {848that.hide()849}850});851this.autoclose = false;852if ('autoclose' in options) {853this.autoclose = options.autoclose854} else if ('dateAutoclose' in this.element.data()) {855this.autoclose = this.element.data('date-autoclose')856}857this.keyboardNavigation = true;858if ('keyboardNavigation' in options) {859this.keyboardNavigation = options.keyboardNavigation860} else if ('dateKeyboardNavigation' in this.element.data()) {861this.keyboardNavigation = this.element.data('date-keyboard-navigation')862}863this.viewMode = this.startViewMode = 0;864switch (options.startView || this.element.data('date-start-view')) {865case 2:866case 'decade':867this.viewMode = this.startViewMode = 2;868break;869case 1:870case 'year':871this.viewMode = this.startViewMode = 1;872break873}874this.todayBtn = (options.todayBtn || this.element.data('date-today-btn') || false);875this.todayHighlight = (options.todayHighlight || this.element.data('date-today-highlight') || false);876this.weekStart = ((options.weekStart || this.element.data('date-weekstart') || dates[this.language].weekStart || 0) % 7);877this.weekEnd = ((this.weekStart + 6) % 7);878this.startDate = -Infinity;879this.endDate = Infinity;880this.daysOfWeekDisabled = [];881this.setStartDate(options.startDate || this.element.data('date-startdate'));882this.setEndDate(options.endDate || this.element.data('date-enddate'));883this.setDaysOfWeekDisabled(options.daysOfWeekDisabled || this.element.data('date-days-of-week-disabled'));884this.fillDow();885this.fillMonths();886this.update();887this.showMode();888if (this.isInline) {889this.show()890}891};892Datepicker.prototype = {893constructor: Datepicker,894_events: [],895_attachEvents: function() {896this._detachEvents();897if (this.isInput) {898this._events = [899[this.element, {900focus: $.proxy(this.show, this),901keyup: $.proxy(this.update, this),902keydown: $.proxy(this.keydown, this)903}]904]905} else if (this.component && this.hasInput) {906this._events = [907[this.element.find('input'), {908focus: $.proxy(this.show, this),909keyup: $.proxy(this.update, this),910keydown: $.proxy(this.keydown, this)911}],912[this.component, {913click: $.proxy(this.show, this)914}]915]916} else if (this.element.is('div')) {917this.isInline = true918} else {919this._events = [920[this.element, {921click: $.proxy(this.show, this)922}]923]924}925for (var i = 0, el, ev; i < this._events.length; i++) {926el = this._events[i][0];927ev = this._events[i][1];928el.on(ev)929}930},931_detachEvents: function() {932for (var i = 0, el, ev; i < this._events.length; i++) {933el = this._events[i][0];934ev = this._events[i][1];935el.off(ev)936}937this._events = []938},939show: function(e) {940this.picker.show();941this.height = this.component ? this.component.outerHeight() : this.element.outerHeight();942this.update();943this.place();944$(window).on('resize', $.proxy(this.place, this));945if (e) {946e.stopPropagation();947e.preventDefault()948}949this.element.trigger({950type: 'show',951date: this.date952})953},954hide: function(e) {955if (this.isInline) return;956this.picker.hide();957$(window).off('resize', this.place);958this.viewMode = this.startViewMode;959this.showMode();960if (!this.isInput) {961$(document).off('mousedown', this.hide)962}963if (this.forceParse && (this.isInput && this.element.val() || this.hasInput && this.element.find('input').val())) this.setValue();964this.element.trigger({965type: 'hide',966date: this.date967})968},969remove: function() {970this._detachEvents();971this.picker.remove();972delete this.element.data().datepicker973},974getDate: function() {975var d = this.getUTCDate();976return new Date(d.getTime() + (d.getTimezoneOffset() * 60000))977},978getUTCDate: function() {979return this.date980},981setDate: function(d) {982this.setUTCDate(new Date(d.getTime() - (d.getTimezoneOffset() * 60000)))983},984setUTCDate: function(d) {985this.date = d;986this.setValue()987},988setValue: function() {989var formatted = this.getFormattedDate();990if (!this.isInput) {991if (this.component) {992this.element.find('input').val(formatted)993}994this.element.data('date', formatted)995} else {996this.element.val(formatted)997}998},999getFormattedDate: function(format) {1000if (format === undefined) format = this.format;1001return DPGlobal.formatDate(this.date, format, this.language)1002},1003setStartDate: function(startDate) {1004this.startDate = startDate || -Infinity;1005if (this.startDate !== -Infinity) {1006this.startDate = DPGlobal.parseDate(this.startDate, this.format, this.language)1007}1008this.update();1009this.updateNavArrows()1010},1011setEndDate: function(endDate) {1012this.endDate = endDate || Infinity;1013if (this.endDate !== Infinity) {1014this.endDate = DPGlobal.parseDate(this.endDate, this.format, this.language)1015}1016this.update();1017this.updateNavArrows()1018},1019setDaysOfWeekDisabled: function(daysOfWeekDisabled) {1020this.daysOfWeekDisabled = daysOfWeekDisabled || [];1021if (!$.isArray(this.daysOfWeekDisabled)) {1022this.daysOfWeekDisabled = this.daysOfWeekDisabled.split(/,\s*/)1023}1024this.daysOfWeekDisabled = $.map(this.daysOfWeekDisabled, function(d) {1025return parseInt(d, 10)1026});1027this.update();1028this.updateNavArrows()1029},1030place: function() {1031if (this.isInline) return;1032var zIndex = parseInt(this.element.parents().filter(function() {1033return $(this).css('z-index') != 'auto'1034}).first().css('z-index')) + 10;1035var offset = this.component ? this.component.offset() : this.element.offset();1036var height = this.component ? this.component.outerHeight(true) : this.element.outerHeight(true);1037this.picker.css({1038top: offset.top + height,1039left: offset.left,1040zIndex: zIndex1041})1042},1043update: function() {1044var date, fromArgs = false;1045if (arguments && arguments.length && (typeof arguments[0] === 'string' || arguments[0] instanceof Date)) {1046date = arguments[0];1047fromArgs = true1048} else {1049date = this.isInput ? this.element.val() : this.element.data('date') || this.element.find('input').val()1050}1051this.date = DPGlobal.parseDate(date, this.format, this.language);1052if (fromArgs) this.setValue();1053var oldViewDate = this.viewDate;1054if (this.date < this.startDate) {1055this.viewDate = new Date(this.startDate)1056} else if (this.date > this.endDate) {1057this.viewDate = new Date(this.endDate)1058} else {1059this.viewDate = new Date(this.date)1060}1061if (oldViewDate && oldViewDate.getTime() != this.viewDate.getTime()) {1062this.element.trigger({1063type: 'changeDate',1064date: this.viewDate1065})1066}1067this.fill()1068},1069fillDow: function() {1070var dowCnt = this.weekStart,1071html = '<tr>';1072while (dowCnt < this.weekStart + 7) {1073html += '<th class="dow">' + dates[this.language].daysMin[(dowCnt++) % 7] + '</th>'1074}1075html += '</tr>';1076this.picker.find('.datepicker-days thead').append(html)1077},1078fillMonths: function() {1079var html = '',1080i = 0;1081while (i < 12) {1082html += '<span class="month">' + dates[this.language].monthsShort[i++] + '</span>'1083}1084this.picker.find('.datepicker-months td').html(html)1085},1086fill: function() {1087var d = new Date(this.viewDate),1088year = d.getUTCFullYear(),1089month = d.getUTCMonth(),1090startYear = this.startDate !== -Infinity ? this.startDate.getUTCFullYear() : -Infinity,1091startMonth = this.startDate !== -Infinity ? this.startDate.getUTCMonth() : -Infinity,1092endYear = this.endDate !== Infinity ? this.endDate.getUTCFullYear() : Infinity,1093endMonth = this.endDate !== Infinity ? this.endDate.getUTCMonth() : Infinity,1094currentDate = this.date && this.date.valueOf(),1095today = new Date();1096this.picker.find('.datepicker-days thead th:eq(1)').text(dates[this.language].months[month] + ' ' + year);1097this.picker.find('tfoot th.today').text(dates[this.language].today).toggle(this.todayBtn !== false);1098this.updateNavArrows();1099this.fillMonths();1100var prevMonth = UTCDate(year, month - 1, 28, 0, 0, 0, 0),1101day = DPGlobal.getDaysInMonth(prevMonth.getUTCFullYear(), prevMonth.getUTCMonth());1102prevMonth.setUTCDate(day);1103prevMonth.setUTCDate(day - (prevMonth.getUTCDay() - this.weekStart + 7) % 7);1104var nextMonth = new Date(prevMonth);1105nextMonth.setUTCDate(nextMonth.getUTCDate() + 42);1106nextMonth = nextMonth.valueOf();1107var html = [];1108var clsName;1109while (prevMonth.valueOf() < nextMonth) {1110if (prevMonth.getUTCDay() == this.weekStart) {1111html.push('<tr>')1112}1113clsName = '';1114if (prevMonth.getUTCFullYear() < year || (prevMonth.getUTCFullYear() == year && prevMonth.getUTCMonth() < month)) {1115clsName += ' old'1116} else if (prevMonth.getUTCFullYear() > year || (prevMonth.getUTCFullYear() == year && prevMonth.getUTCMonth() > month)) {1117clsName += ' new'1118}1119if (this.todayHighlight && prevMonth.getUTCFullYear() == today.getFullYear() && prevMonth.getUTCMonth() == today.getMonth() && prevMonth.getUTCDate() == today.getDate()) {1120clsName += ' today'1121}1122if (currentDate && prevMonth.valueOf() == currentDate) {1123clsName += ' active'1124}1125if (prevMonth.valueOf() < this.startDate || prevMonth.valueOf() > this.endDate || $.inArray(prevMonth.getUTCDay(), this.daysOfWeekDisabled) !== -1) {1126clsName += ' disabled'1127}1128html.push('<td class="day' + clsName + '">' + prevMonth.getUTCDate() + '</td>');1129if (prevMonth.getUTCDay() == this.weekEnd) {1130html.push('</tr>')1131}1132prevMonth.setUTCDate(prevMonth.getUTCDate() + 1)1133}1134this.picker.find('.datepicker-days tbody').empty().append(html.join(''));1135var currentYear = this.date && this.date.getUTCFullYear();1136var months = this.picker.find('.datepicker-months').find('th:eq(1)').text(year).end().find('span').removeClass('active');1137if (currentYear && currentYear == year) {1138months.eq(this.date.getUTCMonth()).addClass('active')1139}1140if (year < startYear || year > endYear) {1141months.addClass('disabled')1142}1143if (year == startYear) {1144months.slice(0, startMonth).addClass('disabled')1145}1146if (year == endYear) {1147months.slice(endMonth + 1).addClass('disabled')1148}1149html = '';1150year = parseInt(year / 10, 10) * 10;1151var yearCont = this.picker.find('.datepicker-years').find('th:eq(1)').text(year + '-' + (year + 9)).end().find('td');1152year -= 1;1153for (var i = -1; i < 11; i++) {1154html += '<span class="year' + (i == -1 || i == 10 ? ' old' : '') + (currentYear == year ? ' active' : '') + (year < startYear || year > endYear ? ' disabled' : '') + '">' + year + '</span>';1155year += 11156}1157yearCont.html(html)1158},1159updateNavArrows: function() {1160var d = new Date(this.viewDate),1161year = d.getUTCFullYear(),1162month = d.getUTCMonth();1163switch (this.viewMode) {1164case 0:1165if (this.startDate !== -Infinity && year <= this.startDate.getUTCFullYear() && month <= this.startDate.getUTCMonth()) {1166this.picker.find('.prev').css({1167visibility: 'hidden'1168})1169} else {1170this.picker.find('.prev').css({1171visibility: 'visible'1172})1173}1174if (this.endDate !== Infinity && year >= this.endDate.getUTCFullYear() && month >= this.endDate.getUTCMonth()) {1175this.picker.find('.next').css({1176visibility: 'hidden'1177})1178} else {1179this.picker.find('.next').css({1180visibility: 'visible'1181})1182}1183break;1184case 1:1185case 2:1186if (this.startDate !== -Infinity && year <= this.startDate.getUTCFullYear()) {1187this.picker.find('.prev').css({1188visibility: 'hidden'1189})1190} else {1191this.picker.find('.prev').css({1192visibility: 'visible'1193})1194}1195if (this.endDate !== Infinity && year >= this.endDate.getUTCFullYear()) {1196this.picker.find('.next').css({1197visibility: 'hidden'1198})1199} else {1200this.picker.find('.next').css({1201visibility: 'visible'1202})1203}1204break1205}1206},1207click: function(e) {1208e.stopPropagation();1209e.preventDefault();1210var target = $(e.target).closest('span, td, th');1211if (target.length == 1) {1212switch (target[0].nodeName.toLowerCase()) {1213case 'th':1214switch (target[0].className) {1215case 'switch':1216this.showMode(1);1217break;1218case 'prev':1219case 'next':1220var dir = DPGlobal.modes[this.viewMode].navStep * (target[0].className == 'prev' ? -1 : 1);1221switch (this.viewMode) {1222case 0:1223this.viewDate = this.moveMonth(this.viewDate, dir);1224break;1225case 1:1226case 2:1227this.viewDate = this.moveYear(this.viewDate, dir);1228break1229}1230this.fill();1231break;1232case 'today':1233var date = new Date();1234date = UTCDate(date.getFullYear(), date.getMonth(), date.getDate(), 0, 0, 0);1235this.showMode(-2);1236var which = this.todayBtn == 'linked' ? null : 'view';1237this._setDate(date, which);1238break1239}1240break;1241case 'span':1242if (!target.is('.disabled')) {1243this.viewDate.setUTCDate(1);1244if (target.is('.month')) {1245var month = target.parent().find('span').index(target);1246this.viewDate.setUTCMonth(month);1247this.element.trigger({1248type: 'changeMonth',1249date: this.viewDate1250})1251} else {1252var year = parseInt(target.text(), 10) || 0;1253this.viewDate.setUTCFullYear(year);1254this.element.trigger({1255type: 'changeYear',1256date: this.viewDate1257})1258}1259this.showMode(-1);1260this.fill()1261}1262break;1263case 'td':1264if (target.is('.day') && !target.is('.disabled')) {1265var day = parseInt(target.text(), 10) || 1;1266var year = this.viewDate.getUTCFullYear(),1267month = this.viewDate.getUTCMonth();1268if (target.is('.old')) {1269if (month === 0) {1270month = 11;1271year -= 11272} else {1273month -= 11274}1275} else if (target.is('.new')) {1276if (month == 11) {1277month = 0;1278year += 11279} else {1280month += 11281}1282}1283this._setDate(UTCDate(year, month, day, 0, 0, 0, 0))1284}1285break1286}1287}1288},1289_setDate: function(date, which) {1290if (!which || which == 'date') this.date = date;1291if (!which || which == 'view') this.viewDate = date;1292this.fill();1293this.setValue();1294this.element.trigger({1295type: 'changeDate',1296date: this.date1297});1298var element;1299if (this.isInput) {1300element = this.element1301} else if (this.component) {1302element = this.element.find('input')1303}1304if (element) {1305element.change();1306if (this.autoclose && (!which || which == 'date')) {1307this.hide()1308}1309}1310},1311moveMonth: function(date, dir) {1312if (!dir) return date;1313var new_date = new Date(date.valueOf()),1314day = new_date.getUTCDate(),1315month = new_date.getUTCMonth(),1316mag = Math.abs(dir),1317new_month, test;1318dir = dir > 0 ? 1 : -1;1319if (mag == 1) {1320test = dir == -1 ? function() {1321return new_date.getUTCMonth() == month1322} : function() {1323return new_date.getUTCMonth() != new_month1324};1325new_month = month + dir;1326new_date.setUTCMonth(new_month);1327if (new_month < 0 || new_month > 11) new_month = (new_month + 12) % 121328} else {1329for (var i = 0; i < mag; i++) new_date = this.moveMonth(new_date, dir);1330new_month = new_date.getUTCMonth();1331new_date.setUTCDate(day);1332test = function() {1333return new_month != new_date.getUTCMonth()1334}1335}1336while (test()) {1337new_date.setUTCDate(--day);1338new_date.setUTCMonth(new_month)1339}1340return new_date1341},1342moveYear: function(date, dir) {1343return this.moveMonth(date, dir * 12)1344},1345dateWithinRange: function(date) {1346return date >= this.startDate && date <= this.endDate1347},1348keydown: function(e) {1349if (this.picker.is(':not(:visible)')) {1350if (e.keyCode == 27) this.show();1351return1352}1353var dateChanged = false,1354dir, day, month, newDate, newViewDate;1355switch (e.keyCode) {1356case 27:1357this.hide();1358e.preventDefault();1359break;1360case 37:1361case 39:1362if (!this.keyboardNavigation) break;1363dir = e.keyCode == 37 ? -1 : 1;1364if (e.ctrlKey) {1365newDate = this.moveYear(this.date, dir);1366newViewDate = this.moveYear(this.viewDate, dir)1367} else if (e.shiftKey) {1368newDate = this.moveMonth(this.date, dir);1369newViewDate = this.moveMonth(this.viewDate, dir)1370} else {1371newDate = new Date(this.date);1372newDate.setUTCDate(this.date.getUTCDate() + dir);1373newViewDate = new Date(this.viewDate);1374newViewDate.setUTCDate(this.viewDate.getUTCDate() + dir)1375}1376if (this.dateWithinRange(newDate)) {1377this.date = newDate;1378this.viewDate = newViewDate;1379this.setValue();1380this.update();1381e.preventDefault();1382dateChanged = true1383}1384break;1385case 38:1386case 40:1387if (!this.keyboardNavigation) break;1388dir = e.keyCode == 38 ? -1 : 1;1389if (e.ctrlKey) {1390newDate = this.moveYear(this.date, dir);1391newViewDate = this.moveYear(this.viewDate, dir)1392} else if (e.shiftKey) {1393newDate = this.moveMonth(this.date, dir);1394newViewDate = this.moveMonth(this.viewDate, dir)1395} else {1396newDate = new Date(this.date);1397newDate.setUTCDate(this.date.getUTCDate() + dir * 7);1398newViewDate = new Date(this.viewDate);1399newViewDate.setUTCDate(this.viewDate.getUTCDate() + dir * 7)1400}1401if (this.dateWithinRange(newDate)) {1402this.date = newDate;1403this.viewDate = newViewDate;1404this.setValue();1405this.update();1406e.preventDefault();1407dateChanged = true1408}1409break;1410case 13:1411this.hide();1412e.preventDefault();1413break;1414case 9:1415this.hide();1416break1417}1418if (dateChanged) {1419this.element.trigger({1420type: 'changeDate',1421date: this.date1422});1423var element;1424if (this.isInput) {1425element = this.element1426} else if (this.component) {1427element = this.element.find('input')1428}1429if (element) {1430element.change()1431}1432}1433},1434showMode: function(dir) {1435if (dir) {1436this.viewMode = Math.max(0, Math.min(2, this.viewMode + dir))1437}1438this.picker.find('>div').hide().filter('.datepicker-' + DPGlobal.modes[this.viewMode].clsName).css('display', 'block');1439this.updateNavArrows()1440}1441};1442$.fn.datepicker = function(option) {1443var args = Array.apply(null, arguments);1444args.shift();1445return this.each(function() {1446var $this = $(this),1447data = $this.data('datepicker'),1448options = typeof option == 'object' && option;1449if (!data) {1450$this.data('datepicker', (data = new Datepicker(this, $.extend({}, $.fn.datepicker.defaults, options))))1451}1452if (typeof option == 'string' && typeof data[option] == 'function') {1453data[option].apply(data, args)1454}1455})1456};1457$.fn.datepicker.defaults = {};1458$.fn.datepicker.Constructor = Datepicker;1459var dates = $.fn.datepicker.dates = {1460en: {1461days: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"],1462daysShort: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"],1463daysMin: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa", "Su"],1464months: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"],1465monthsShort: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"],1466today: "Today"1467}1468};1469var DPGlobal = {1470modes: [{1471clsName: 'days',1472navFnc: 'Month',1473navStep: 11474}, {1475clsName: 'months',1476navFnc: 'FullYear',1477navStep: 11478}, {1479clsName: 'years',1480navFnc: 'FullYear',1481navStep: 101482}],1483isLeapYear: function(year) {1484return (((year % 4 === 0) && (year % 100 !== 0)) || (year % 400 === 0))1485},1486getDaysInMonth: function(year, month) {1487return [31, (DPGlobal.isLeapYear(year) ? 29 : 28), 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][month]1488},1489validParts: /dd?|DD?|mm?|MM?|yy(?:yy)?/g,1490nonpunctuation: /[^ -\/:-@\[\u3400-\u9fff-`{-~\t\n\r]+/g,1491parseFormat: function(format) {1492var separators = format.replace(this.validParts, '\0').split('\0'),1493parts = format.match(this.validParts);1494if (!separators || !separators.length || !parts || parts.length === 0) {1495throw new Error("Invalid date format.");1496}1497return {1498separators: separators,1499parts: parts1500}1501},1502parseDate: function(date, format, language) {1503if (date instanceof Date) return date;1504if (/^[\-+]\d+[dmwy]([\s,]+[\-+]\d+[dmwy])*$/.test(date)) {1505var part_re = /([\-+]\d+)([dmwy])/,1506parts = date.match(/([\-+]\d+)([dmwy])/g),1507part, dir;1508date = new Date();1509for (var i = 0; i < parts.length; i++) {1510part = part_re.exec(parts[i]);1511dir = parseInt(part[1]);1512switch (part[2]) {1513case 'd':1514date.setUTCDate(date.getUTCDate() + dir);1515break;1516case 'm':1517date = Datepicker.prototype.moveMonth.call(Datepicker.prototype, date, dir);1518break;1519case 'w':1520date.setUTCDate(date.getUTCDate() + dir * 7);1521break;1522case 'y':1523date = Datepicker.prototype.moveYear.call(Datepicker.prototype, date, dir);1524break1525}1526}1527return UTCDate(date.getUTCFullYear(), date.getUTCMonth(), date.getUTCDate(), 0, 0, 0)1528}1529var parts = date && date.match(this.nonpunctuation) || [],1530date = new Date(),1531parsed = {},1532setters_order = ['yyyy', 'yy', 'M', 'MM', 'm', 'mm', 'd', 'dd'],1533setters_map = {1534yyyy: function(d, v) {1535return d.setUTCFullYear(v)1536},1537yy: function(d, v) {1538return d.setUTCFullYear(2000 + v)1539},1540m: function(d, v) {1541v -= 1;1542while (v < 0) v += 12;1543v %= 12;1544d.setUTCMonth(v);1545while (d.getUTCMonth() != v) d.setUTCDate(d.getUTCDate() - 1);1546return d1547},1548d: function(d, v) {1549return d.setUTCDate(v)1550}1551},1552val, filtered, part;1553setters_map['M'] = setters_map['MM'] = setters_map['mm'] = setters_map['m'];1554setters_map['dd'] = setters_map['d'];1555date = UTCDate(date.getFullYear(), date.getMonth(), date.getDate(), 0, 0, 0);1556var fparts = format.parts.slice();1557if (parts.length != fparts.length) {1558fparts = $(fparts).filter(function(i, p) {1559return $.inArray(p, setters_order) !== -11560}).toArray()1561}1562if (parts.length == fparts.length) {1563for (var i = 0, cnt = fparts.length; i < cnt; i++) {1564val = parseInt(parts[i], 10);1565part = fparts[i];1566if (isNaN(val)) {1567switch (part) {1568case 'MM':1569filtered = $(dates[language].months).filter(function() {1570var m = this.slice(0, parts[i].length),1571p = parts[i].slice(0, m.length);1572return m == p1573});1574val = $.inArray(filtered[0], dates[language].months) + 1;1575break;1576case 'M':1577filtered = $(dates[language].monthsShort).filter(function() {1578var m = this.slice(0, parts[i].length),1579p = parts[i].slice(0, m.length);1580return m == p1581});1582val = $.inArray(filtered[0], dates[language].monthsShort) + 1;1583break1584}1585}1586parsed[part] = val1587}1588for (var i = 0, s; i < setters_order.length; i++) {1589s = setters_order[i];1590if (s in parsed && !isNaN(parsed[s])) setters_map[s](date, parsed[s])1591}1592}1593return date1594},1595formatDate: function(date, format, language) {1596var val = {1597d: date.getUTCDate(),1598D: dates[language].daysShort[date.getUTCDay()],1599DD: dates[language].days[date.getUTCDay()],1600m: date.getUTCMonth() + 1,1601M: dates[language].monthsShort[date.getUTCMonth()],1602MM: dates[language].months[date.getUTCMonth()],1603yy: date.getUTCFullYear().toString().substring(2),1604yyyy: date.getUTCFullYear()1605};1606val.dd = (val.d < 10 ? '0' : '') + val.d;1607val.mm = (val.m < 10 ? '0' : '') + val.m;1608var date = [],1609seps = $.extend([], format.separators);1610for (var i = 0, cnt = format.parts.length; i < cnt; i++) {1611if (seps.length) date.push(seps.shift());1612date.push(val[format.parts[i]])1613}1614return date.join('')1615},1616headTemplate: '<thead>' + '<tr>' + '<th class="prev"><i class="icon-arrow-left"/></th>' + '<th colspan="5" class="switch"></th>' + '<th class="next"><i class="icon-arrow-right"/></th>' + '</tr>' + '</thead>',1617contTemplate: '<tbody><tr><td colspan="7"></td></tr></tbody>',1618footTemplate: '<tfoot><tr><th colspan="7" class="today"></th></tr></tfoot>'1619};1620DPGlobal.template = '<div class="datepicker">' + '<div class="datepicker-days">' + '<table class=" table-condensed">' + DPGlobal.headTemplate + '<tbody></tbody>' + DPGlobal.footTemplate + '</table>' + '</div>' + '<div class="datepicker-months">' + '<table class="table-condensed">' + DPGlobal.headTemplate + DPGlobal.contTemplate + DPGlobal.footTemplate + '</table>' + '</div>' + '<div class="datepicker-years">' + '<table class="table-condensed">' + DPGlobal.headTemplate + DPGlobal.contTemplate + DPGlobal.footTemplate + '</table>' + '</div>' + '</div>';1621$.fn.datepicker.DPGlobal = DPGlobal1622}(window.jQuery);1623162416251626// Jquery Equal height (http://brm.io/jquery-match-height-demo/)1627(function(e) {1628var t = -1,1629n = -1;1630var r = function(t) {1631var n = 1,1632r = e(t),1633s = null,1634o = [];1635r.each(function() {1636var t = e(this),1637r = t.offset().top - i(t.css("margin-top")),1638u = o.length > 0 ? o[o.length - 1] : null;1639if (u === null) {1640o.push(t)1641} else {1642if (Math.floor(Math.abs(s - r)) <= n) {1643o[o.length - 1] = u.add(t)1644} else {1645o.push(t)1646}1647}1648s = r1649});1650return o1651};1652var i = function(e) {1653return parseFloat(e) || 01654};1655var s = function(t) {1656var n = {1657byRow: true,1658remove: false,1659property: "height"1660};1661if (typeof t === "object") {1662return e.extend(n, t)1663}1664if (typeof t === "boolean") {1665n.byRow = t1666} else if (t === "remove") {1667n.remove = true1668}1669return n1670};1671var o = e.fn.matchHeight = function(t) {1672var n = s(t);1673if (n.remove) {1674var r = this;1675this.css(n.property, "");1676e.each(o._groups, function(e, t) {1677t.elements = t.elements.not(r)1678});1679return this1680}1681if (this.length <= 1) return this;1682o._groups.push({1683elements: this,1684options: n1685});1686o._apply(this, n);1687return this1688};1689o._groups = [];1690o._throttle = 80;1691o._maintainScroll = false;1692o._beforeUpdate = null;1693o._afterUpdate = null;1694o._apply = function(t, n) {1695var u = s(n),1696a = e(t),1697f = [a];1698var l = e(window).scrollTop(),1699c = e("html").outerHeight(true);1700var h = a.parents().filter(":hidden");1701h.each(function() {1702var t = e(this);1703t.data("style-cache", t.attr("style"))1704});1705h.css("display", "block");1706if (u.byRow) {1707a.each(function() {1708var t = e(this),1709n = t.css("display") === "inline-block" ? "inline-block" : "block";1710t.data("style-cache", t.attr("style"));1711t.css({1712display: n,1713"padding-top": "0",1714"padding-bottom": "0",1715"margin-top": "0",1716"margin-bottom": "0",1717"border-top-width": "0",1718"border-bottom-width": "0",1719height: "100px"1720})1721});1722f = r(a);1723a.each(function() {1724var t = e(this);1725t.attr("style", t.data("style-cache") || "")1726})1727}1728e.each(f, function(t, n) {1729var r = e(n),1730s = 0;1731if (u.byRow && r.length <= 1) {1732r.css(u.property, "");1733return1734}1735r.each(function() {1736var t = e(this),1737n = t.css("display") === "inline-block" ? "inline-block" : "block";1738var r = {1739display: n1740};1741r[u.property] = "";1742t.css(r);1743if (t.outerHeight(false) > s) s = t.outerHeight(false);1744t.css("display", "")1745});1746r.each(function() {1747var t = e(this),1748n = 0;1749if (t.css("box-sizing") !== "border-box") {1750n += i(t.css("border-top-width")) + i(t.css("border-bottom-width"));1751n += i(t.css("padding-top")) + i(t.css("padding-bottom"))1752}1753t.css(u.property, s - n)1754})1755});1756h.each(function() {1757var t = e(this);1758t.attr("style", t.data("style-cache") || null)1759});1760if (o._maintainScroll) e(window).scrollTop(l / c * e("html").outerHeight(true));1761return this1762};1763o._applyDataApi = function() {1764var t = {};1765e("[data-match-height], [data-mh]").each(function() {1766var n = e(this),1767r = n.attr("data-match-height") || n.attr("data-mh");1768if (r in t) {1769t[r] = t[r].add(n)1770} else {1771t[r] = n1772}1773});1774e.each(t, function() {1775this.matchHeight(true)1776})1777};1778var u = function(t) {1779if (o._beforeUpdate) o._beforeUpdate(t, o._groups);1780e.each(o._groups, function() {1781o._apply(this.elements, this.options)1782});1783if (o._afterUpdate) o._afterUpdate(t, o._groups)1784};1785o._update = function(r, i) {1786if (i && i.type === "resize") {1787var s = e(window).width();1788if (s === t) return;1789t = s1790}1791if (!r) {1792u(i)1793} else if (n === -1) {1794n = setTimeout(function() {1795u(i);1796n = -11797}, o._throttle)1798}1799};1800e(o._applyDataApi);1801e(window).bind("load", function(e) {1802o._update(false, e)1803});1804e(window).bind("resize orientationchange", function(e) {1805o._update(true, e)1806})1807})(jQuery);18081809