vendor: 49,895 bytes, lines 1-517
1/* 2 _ _ _ _ 3 ___| (_) ___| | __ (_)___ 4 / __| | |/ __| |/ / | / __| 5 \__ \ | | (__| < _ | \__ \ 6 |___/_|_|\___|_|\_(_)/ |___/ 7 |__/ 8 9 Version: 1.5.9 10 Author: Ken Wheeler 11 Website: http://kenwheeler.github.io 12 Docs: http://kenwheeler.github.io/slick 13 Repo: http://github.com/kenwheeler/slick 14 Issues: http://github.com/kenwheeler/slick/issues 15 16 */ 17!function (a) { 18 "use strict"; 19 "function" == typeof define && define.amd ? define(["jquery"], a) : "undefined" != typeof exports ? module.exports = a(require("jquery")) : a(jQuery) 20}(function (a) { 21 "use strict"; 22 var b = window.Slick || {}; 23 b = function () { 24 function c(c, d) { 25 var f, e = this; 26 e.defaults = { 27 accessibility: !0, 28 adaptiveHeight: !1, 29 appendArrows: a(c), 30 appendDots: a(c), 31 arrows: !0, 32 asNavFor: null, 33 prevArrow: '<button type="button" data-role="none" class="slick-prev" aria-label="Previous" tabindex="0" role="button">Previous</button>', 34 nextArrow: '<button type="button" data-role="none" class="slick-next" aria-label="Next" tabindex="0" role="button">Next</button>', 35 autoplay: !1, 36 autoplaySpeed: 3e3, 37 centerMode: !1, 38 centerPadding: "50px", 39 cssEase: "ease", 40 customPaging: function (a, b) { 41 return '<button type="button" data-role="none" role="button" aria-required="false" tabindex="0">' + (b + 1) + "</button>" 42 }, 43 dots: !1, 44 dotsClass: "slick-dots", 45 draggable: !0, 46 easing: "linear", 47 edgeFriction: .35, 48 fade: !1, 49 focusOnSelect: !1, 50 infinite: !0, 51 initialSlide: 0, 52 lazyLoad: "ondemand", 53 mobileFirst: !1, 54 pauseOnHover: !0, 55 pauseOnDotsHover: !1, 56 respondTo: "window", 57 responsive: null, 58 rows: 1, 59 rtl: !1, 60 slide: "", 61 slidesPerRow: 1, 62 slidesToShow: 1, 63 slidesToScroll: 1, 64 speed: 500, 65 swipe: !0, 66 swipeToSlide: !1, 67 touchMove: !0, 68 touchThreshold: 5, 69 useCSS: !0, 70 useTransform: !1, 71 variableWidth: !1, 72 vertical: !1, 73 verticalSwiping: !1, 74 waitForAnimate: !0, 75 zIndex: 1e3 76 }, e.initials = { 77 animating: !1, 78 dragging: !1, 79 autoPlayTimer: null, 80 currentDirection: 0, 81 currentLeft: null, 82 currentSlide: 0, 83 direction: 1, 84 $dots: null, 85 listWidth: null, 86 listHeight: null, 87 loadIndex: 0, 88 $nextArrow: null, 89 $prevArrow: null, 90 slideCount: null, 91 slideWidth: null, 92 $slideTrack: null, 93 $slides: null, 94 sliding: !1, 95 slideOffset: 0, 96 swipeLeft: null, 97 $list: null, 98 touchObject: {}, 99 transformsEnabled: !1, 100 unslicked: !1 101 }, a.extend(e, e.initials), e.activeBreakpoint = null, e.animType = null, e.animProp = null, e.breakpoints = [], e.breakpointSettings = [], e.cssTransitions = !1, e.hidden = "hidden", e.paused = !1, e.positionProp = null, e.respondTo = null, e.rowCount = 1, e.shouldClick = !0, e.$slider = a(c), e.$slidesCache = null, e.transformType = null, e.transitionType = null, e.visibilityChange = "visibilitychange", e.windowWidth = 0, e.windowTimer = null, f = a(c).data("slick") || {}, e.options = a.extend({}, e.defaults, f, d), e.currentSlide = e.options.initialSlide, e.originalSettings = e.options, "undefined" != typeof document.mozHidden ? (e.hidden = "mozHidden", e.visibilityChange = "mozvisibilitychange") : "undefined" != typeof document.webkitHidden && (e.hidden = "webkitHidden", e.visibilityChange = "webkitvisibilitychange"), e.autoPlay = a.proxy(e.autoPlay, e), e.autoPlayClear = a.proxy(e.autoPlayClear, e), e.changeSlide = a.proxy(e.changeSlide, e), e.clickHandler = a.proxy(e.clickHandler, e), e.selectHandler = a.proxy(e.selectHandler, e), e.setPosition = a.proxy(e.setPosition, e), e.swipeHandler = a.proxy(e.swipeHandler, e), e.dragHandler = a.proxy(e.dragHandler, e), e.keyHandler = a.proxy(e.keyHandler, e), e.autoPlayIterator = a.proxy(e.autoPlayIterator, e), e.instanceUid = b++, e.htmlExpr = /^(?:\s*(<[\w\W]+>)[^>]*)$/, e.registerBreakpoints(), e.init(!0), e.checkResponsive(!0) 102 } 103 104 var b = 0; 105 return c 106 }(), b.prototype.addSlide = b.prototype.slickAdd = function (b, c, d) { 107 var e = this; 108 if ("boolean" == typeof c) d = c, c = null; else if (0 > c || c >= e.slideCount)return !1; 109 e.unload(), "number" == typeof c ? 0 === c && 0 === e.$slides.length ? a(b).appendTo(e.$slideTrack) : d ? a(b).insertBefore(e.$slides.eq(c)) : a(b).insertAfter(e.$slides.eq(c)) : d === !0 ? a(b).prependTo(e.$slideTrack) : a(b).appendTo(e.$slideTrack), e.$slides = e.$slideTrack.children(this.options.slide), e.$slideTrack.children(this.options.slide).detach(), e.$slideTrack.append(e.$slides), e.$slides.each(function (b, c) { 110 a(c).attr("data-slick-index", b) 111 }), e.$slidesCache = e.$slides, e.reinit() 112 }, b.prototype.animateHeight = function () { 113 var a = this; 114 if (1 === a.options.slidesToShow && a.options.adaptiveHeight === !0 && a.options.vertical === !1) { 115 var b = a.$slides.eq(a.currentSlide).outerHeight(!0); 116 a.$list.animate({height: b}, a.options.speed) 117 } 118 }, b.prototype.animateSlide = function (b, c) { 119 var d = {}, e = this; 120 e.animateHeight(), e.options.rtl === !0 && e.options.vertical === !1 && (b = -b), e.transformsEnabled === !1 ? e.options.vertical === !1 ? e.$slideTrack.animate({left: b}, e.options.speed, e.options.easing, c) : e.$slideTrack.animate({top: b}, e.options.speed, e.options.easing, c) : e.cssTransitions === !1 ? (e.options.rtl === !0 && (e.currentLeft = -e.currentLeft), a({animStart: e.currentLeft}).animate({animStart: b}, { 121 duration: e.options.speed, 122 easing: e.options.easing, 123 step: function (a) { 124 a = Math.ceil(a), e.options.vertical === !1 ? (d[e.animType] = "translate(" + a + "px, 0px)", e.$slideTrack.css(d)) : (d[e.animType] = "translate(0px," + a + "px)", e.$slideTrack.css(d)) 125 }, 126 complete: function () { 127 c && c.call() 128 } 129 })) : (e.applyTransition(), b = Math.ceil(b), e.options.vertical === !1 ? d[e.animType] = "translate3d(" + b + "px, 0px, 0px)" : d[e.animType] = "translate3d(0px," + b + "px, 0px)", e.$slideTrack.css(d), c && setTimeout(function () { 130 e.disableTransition(), c.call() 131 }, e.options.speed)) 132 }, b.prototype.asNavFor = function (b) { 133 var c = this, d = c.options.asNavFor; 134 d && null !== d && (d = a(d).not(c.$slider)), null !== d && "object" == typeof d && d.each(function () { 135 var c = a(this).slick("getSlick"); 136 c.unslicked || c.slideHandler(b, !0) 137 }) 138 }, b.prototype.applyTransition = function (a) { 139 var b = this, c = {}; 140 b.options.fade === !1 ? c[b.transitionType] = b.transformType + " " + b.options.speed + "ms " + b.options.cssEase : c[b.transitionType] = "opacity " + b.options.speed + "ms " + b.options.cssEase, b.options.fade === !1 ? b.$slideTrack.css(c) : b.$slides.eq(a).css(c) 141 }, b.prototype.autoPlay = function () { 142 var a = this; 143 a.autoPlayTimer && clearInterval(a.autoPlayTimer), a.slideCount > a.options.slidesToShow && a.paused !== !0 && (a.autoPlayTimer = setInterval(a.autoPlayIterator, a.options.autoplaySpeed)) 144 }, b.prototype.autoPlayClear = function () { 145 var a = this; 146 a.autoPlayTimer && clearInterval(a.autoPlayTimer) 147 }, b.prototype.autoPlayIterator = function () { 148 var a = this; 149 a.options.infinite === !1 ? 1 === a.direction ? (a.currentSlide + 1 === a.slideCount - 1 && (a.direction = 0), a.slideHandler(a.currentSlide + a.options.slidesToScroll)) : (a.currentSlide - 1 === 0 && (a.direction = 1), a.slideHandler(a.currentSlide - a.options.slidesToScroll)) : a.slideHandler(a.currentSlide + a.options.slidesToScroll) 150 }, b.prototype.buildArrows = function () { 151 var b = this; 152 b.options.arrows === !0 && (b.$prevArrow = a(b.options.prevArrow).addClass("slick-arrow"), b.$nextArrow = a(b.options.nextArrow).addClass("slick-arrow"), b.slideCount > b.options.slidesToShow ? (b.$prevArrow.removeClass("slick-hidden").removeAttr("aria-hidden tabindex"), b.$nextArrow.removeClass("slick-hidden").removeAttr("aria-hidden tabindex"), b.htmlExpr.test(b.options.prevArrow) && b.$prevArrow.prependTo(b.options.appendArrows), b.htmlExpr.test(b.options.nextArrow) && b.$nextArrow.appendTo(b.options.appendArrows), b.options.infinite !== !0 && b.$prevArrow.addClass("slick-disabled").attr("aria-disabled", "true")) : b.$prevArrow.add(b.$nextArrow).addClass("slick-hidden").attr({ 153 "aria-disabled": "true", 154 tabindex: "-1" 155 })) 156 }, b.prototype.buildDots = function () { 157 var c, d, b = this; 158 if (b.options.dots === !0 && b.slideCount > b.options.slidesToShow) { 159 for (d = '<ul class="' + b.options.dotsClass + '">', c = 0; c <= b.getDotCount(); c += 1)d += "<li>" + b.options.customPaging.call(this, b, c) + "</li>"; 160 d += "</ul>", b.$dots = a(d).appendTo(b.options.appendDots), b.$dots.find("li").first().addClass("slick-active").attr("aria-hidden", "false") 161 } 162 }, b.prototype.buildOut = function () { 163 var b = this; 164 b.$slides = b.$slider.children(b.options.slide + ":not(.slick-cloned)").addClass("slick-slide"), b.slideCount = b.$slides.length, b.$slides.each(function (b, c) { 165 a(c).attr("data-slick-index", b).data("originalStyling", a(c).attr("style") || "") 166 }), b.$slider.addClass("slick-slider"), b.$slideTrack = 0 === b.slideCount ? a('<div class="slick-track"/>').appendTo(b.$slider) : b.$slides.wrapAll('<div class="slick-track"/>').parent(), b.$list = b.$slideTrack.wrap('<div aria-live="polite" class="slick-list"/>').parent(), b.$slideTrack.css("opacity", 0), (b.options.centerMode === !0 || b.options.swipeToSlide === !0) && (b.options.slidesToScroll = 1), a("img[data-lazy]", b.$slider).not("[src]").addClass("slick-loading"), b.setupInfinite(), b.buildArrows(), b.buildDots(), b.updateDots(), b.setSlideClasses("number" == typeof b.currentSlide ? b.currentSlide : 0), b.options.draggable === !0 && b.$list.addClass("draggable") 167 }, b.prototype.buildRows = function () { 168 var b, c, d, e, f, g, h, a = this; 169 if (e = document.createDocumentFragment(), g = a.$slider.children(), a.options.rows > 1) { 170 for (h = a.options.slidesPerRow * a.options.rows, f = Math.ceil(g.length / h), b = 0; f > b; b++) { 171 var i = document.createElement("div"); 172 for (c = 0; c < a.options.rows; c++) { 173 var j = document.createElement("div"); 174 for (d = 0; d < a.options.slidesPerRow; d++) { 175 var k = b * h + (c * a.options.slidesPerRow + d); 176 g.get(k) && j.appendChild(g.get(k)) 177 } 178 i.appendChild(j) 179 } 180 e.appendChild(i) 181 } 182 a.$slider.html(e), a.$slider.children().children().children().css({ 183 width: 100 / a.options.slidesPerRow + "%", 184 display: "inline-block" 185 }) 186 } 187 }, b.prototype.checkResponsive = function (b, c) { 188 var e, f, g, d = this, h = !1, i = d.$slider.width(), j = window.innerWidth || a(window).width(); 189 if ("window" === d.respondTo ? g = j : "slider" === d.respondTo ? g = i : "min" === d.respondTo && (g = Math.min(j, i)), d.options.responsive && d.options.responsive.length && null !== d.options.responsive) { 190 f = null; 191 for (e in d.breakpoints)d.breakpoints.hasOwnProperty(e) && (d.originalSettings.mobileFirst === !1 ? g < d.breakpoints[e] && (f = d.breakpoints[e]) : g > d.breakpoints[e] && (f = d.breakpoints[e])); 192 null !== f ? null !== d.activeBreakpoint ? (f !== d.activeBreakpoint || c) && (d.activeBreakpoint = f, "unslick" === d.breakpointSettings[f] ? d.unslick(f) : (d.options = a.extend({}, d.originalSettings, d.breakpointSettings[f]), b === !0 && (d.currentSlide = d.options.initialSlide), d.refresh(b)), h = f) : (d.activeBreakpoint = f, "unslick" === d.breakpointSettings[f] ? d.unslick(f) : (d.options = a.extend({}, d.originalSettings, d.breakpointSettings[f]), b === !0 && (d.currentSlide = d.options.initialSlide), d.refresh(b)), h = f) : null !== d.activeBreakpoint && (d.activeBreakpoint = null, d.options = d.originalSettings, b === !0 && (d.currentSlide = d.options.initialSlide), d.refresh(b), h = f), b || h === !1 || d.$slider.trigger("breakpoint", [d, h]) 193 } 194 }, b.prototype.changeSlide = function (b, c) { 195 var f, g, h, d = this, e = a(b.target); 196 switch (e.is("a") && b.preventDefault(), e.is("li") || (e = e.closest("li")), h = d.slideCount % d.options.slidesToScroll !== 0, f = h ? 0 : (d.slideCount - d.currentSlide) % d.options.slidesToScroll, b.data.message) { 197 case"previous": 198 g = 0 === f ? d.options.slidesToScroll : d.options.slidesToShow - f, d.slideCount > d.options.slidesToShow && d.slideHandler(d.currentSlide - g, !1, c); 199 break; 200 case"next": 201 g = 0 === f ? d.options.slidesToScroll : f, d.slideCount > d.options.slidesToShow && d.slideHandler(d.currentSlide + g, !1, c); 202 break; 203 case"index": 204 var i = 0 === b.data.index ? 0 : b.data.index || e.index() * d.options.slidesToScroll; 205 d.slideHandler(d.checkNavigable(i), !1, c), e.children().trigger("focus"); 206 break; 207 default: 208 return 209 } 210 }, b.prototype.checkNavigable = function (a) { 211 var c, d, b = this; 212 if (c = b.getNavigableIndexes(), d = 0, a > c[c.length - 1]) a = c[c.length - 1]; else for (var e in c) { 213 if (a < c[e]) { 214 a = d; 215 break 216 } 217 d = c[e] 218 } 219 return a 220 }, b.prototype.cleanUpEvents = function () { 221 var b = this; 222 b.options.dots && null !== b.$dots && (a("li", b.$dots).off("click.slick", b.changeSlide), b.options.pauseOnDotsHover === !0 && b.options.autoplay === !0 && a("li", b.$dots).off("mouseenter.slick", a.proxy(b.setPaused, b, !0)).off("mouseleave.slick", a.proxy(b.setPaused, b, !1))), b.options.arrows === !0 && b.slideCount > b.options.slidesToShow && (b.$prevArrow && b.$prevArrow.off("click.slick", b.changeSlide), b.$nextArrow && b.$nextArrow.off("click.slick", b.changeSlide)), b.$list.off("touchstart.slick mousedown.slick", b.swipeHandler), b.$list.off("touchmove.slick mousemove.slick", b.swipeHandler), b.$list.off("touchend.slick mouseup.slick", b.swipeHandler), b.$list.off("touchcancel.slick mouseleave.slick", b.swipeHandler), b.$list.off("click.slick", b.clickHandler), a(document).off(b.visibilityChange, b.visibility), b.$list.off("mouseenter.slick", a.proxy(b.setPaused, b, !0)), b.$list.off("mouseleave.slick", a.proxy(b.setPaused, b, !1)), b.options.accessibility === !0 && b.$list.off("keydown.slick", b.keyHandler), b.options.focusOnSelect === !0 && a(b.$slideTrack).children().off("click.slick", b.selectHandler), a(window).off("orientationchange.slick.slick-" + b.instanceUid, b.orientationChange), a(window).off("resize.slick.slick-" + b.instanceUid, b.resize), a("[draggable!=true]", b.$slideTrack).off("dragstart", b.preventDefault), a(window).off("load.slick.slick-" + b.instanceUid, b.setPosition), a(document).off("ready.slick.slick-" + b.instanceUid, b.setPosition) 223 }, b.prototype.cleanUpRows = function () { 224 var b, a = this; 225 a.options.rows > 1 && (b = a.$slides.children().children(), b.removeAttr("style"), a.$slider.html(b)) 226 }, b.prototype.clickHandler = function (a) { 227 var b = this; 228 b.shouldClick === !1 && (a.stopImmediatePropagation(), a.stopPropagation(), a.preventDefault()) 229 }, b.prototype.destroy = function (b) { 230 var c = this; 231 c.autoPlayClear(), c.touchObject = {}, c.cleanUpEvents(), a(".slick-cloned", c.$slider).detach(), c.$dots && c.$dots.remove(), c.$prevArrow && c.$prevArrow.length && (c.$prevArrow.removeClass("slick-disabled slick-arrow slick-hidden").removeAttr("aria-hidden aria-disabled tabindex").css("display", ""), c.htmlExpr.test(c.options.prevArrow) && c.$prevArrow.remove()), c.$nextArrow && c.$nextArrow.length && (c.$nextArrow.removeClass("slick-disabled slick-arrow slick-hidden").removeAttr("aria-hidden aria-disabled tabindex").css("display", ""), c.htmlExpr.test(c.options.nextArrow) && c.$nextArrow.remove()), c.$slides && (c.$slides.removeClass("slick-slide slick-active slick-center slick-visible slick-current").removeAttr("aria-hidden").removeAttr("data-slick-index").each(function () { 232 a(this).attr("style", a(this).data("originalStyling")) 233 }), c.$slideTrack.children(this.options.slide).detach(), c.$slideTrack.detach(), c.$list.detach(), c.$slider.append(c.$slides)), c.cleanUpRows(), c.$slider.removeClass("slick-slider"), c.$slider.removeClass("slick-initialized"), c.unslicked = !0, b || c.$slider.trigger("destroy", [c]) 234 }, b.prototype.disableTransition = function (a) { 235 var b = this, c = {}; 236 c[b.transitionType] = "", b.options.fade === !1 ? b.$slideTrack.css(c) : b.$slides.eq(a).css(c) 237 }, b.prototype.fadeSlide = function (a, b) { 238 var c = this; 239 c.cssTransitions === !1 ? (c.$slides.eq(a).css({zIndex: c.options.zIndex}), c.$slides.eq(a).animate({opacity: 1}, c.options.speed, c.options.easing, b)) : (c.applyTransition(a), c.$slides.eq(a).css({ 240 opacity: 1, 241 zIndex: c.options.zIndex 242 }), b && setTimeout(function () { 243 c.disableTransition(a), b.call() 244 }, c.options.speed)) 245 }, b.prototype.fadeSlideOut = function (a) { 246 var b = this; 247 b.cssTransitions === !1 ? b.$slides.eq(a).animate({ 248 opacity: 0, 249 zIndex: b.options.zIndex - 2 250 }, b.options.speed, b.options.easing) : (b.applyTransition(a), b.$slides.eq(a).css({ 251 opacity: 0, 252 zIndex: b.options.zIndex - 2 253 })) 254 }, b.prototype.filterSlides = b.prototype.slickFilter = function (a) { 255 var b = this; 256 null !== a && (b.$slidesCache = b.$slides, b.unload(), b.$slideTrack.children(this.options.slide).detach(), b.$slidesCache.filter(a).appendTo(b.$slideTrack), b.reinit()) 257 }, b.prototype.getCurrent = b.prototype.slickCurrentSlide = function () { 258 var a = this; 259 return a.currentSlide 260 }, b.prototype.getDotCount = function () { 261 var a = this, b = 0, c = 0, d = 0; 262 if (a.options.infinite === !0)for (; b < a.slideCount;)++d, b = c + a.options.slidesToScroll, c += a.options.slidesToScroll <= a.options.slidesToShow ? a.options.slidesToScroll : a.options.slidesToShow; else if (a.options.centerMode === !0) d = a.slideCount; else for (; b < a.slideCount;)++d, b = c + a.options.slidesToScroll, c += a.options.slidesToScroll <= a.options.slidesToShow ? a.options.slidesToScroll : a.options.slidesToShow; 263 return d - 1 264 }, b.prototype.getLeft = function (a) { 265 var c, d, f, b = this, e = 0; 266 return b.slideOffset = 0, d = b.$slides.first().outerHeight(!0), b.options.infinite === !0 ? (b.slideCount > b.options.slidesToShow && (b.slideOffset = b.slideWidth * b.options.slidesToShow * -1, e = d * b.options.slidesToShow * -1), b.slideCount % b.options.slidesToScroll !== 0 && a + b.options.slidesToScroll > b.slideCount && b.slideCount > b.options.slidesToShow && (a > b.slideCount ? (b.slideOffset = (b.options.slidesToShow - (a - b.slideCount)) * b.slideWidth * -1, e = (b.options.slidesToShow - (a - b.slideCount)) * d * -1) : (b.slideOffset = b.slideCount % b.options.slidesToScroll * b.slideWidth * -1, e = b.slideCount % b.options.slidesToScroll * d * -1))) : a + b.options.slidesToShow > b.slideCount && (b.slideOffset = (a + b.options.slidesToShow - b.slideCount) * b.slideWidth, e = (a + b.options.slidesToShow - b.slideCount) * d), b.slideCount <= b.options.slidesToShow && (b.slideOffset = 0, e = 0), b.options.centerMode === !0 && b.options.infinite === !0 ? b.slideOffset += b.slideWidth * Math.floor(b.options.slidesToShow / 2) - b.slideWidth : b.options.centerMode === !0 && (b.slideOffset = 0, b.slideOffset += b.slideWidth * Math.floor(b.options.slidesToShow / 2)), c = b.options.vertical === !1 ? a * b.slideWidth * -1 + b.slideOffset : a * d * -1 + e, b.options.variableWidth === !0 && (f = b.slideCount <= b.options.slidesToShow || b.options.infinite === !1 ? b.$slideTrack.children(".slick-slide").eq(a) : b.$slideTrack.children(".slick-slide").eq(a + b.options.slidesToShow), c = b.options.rtl === !0 ? f[0] ? -1 * (b.$slideTrack.width() - f[0].offsetLeft - f.width()) : 0 : f[0] ? -1 * f[0].offsetLeft : 0, b.options.centerMode === !0 && (f = b.slideCount <= b.options.slidesToShow || b.options.infinite === !1 ? b.$slideTrack.children(".slick-slide").eq(a) : b.$slideTrack.children(".slick-slide").eq(a + b.options.slidesToShow + 1), c = b.options.rtl === !0 ? f[0] ? -1 * (b.$slideTrack.width() - f[0].offsetLeft - f.width()) : 0 : f[0] ? -1 * f[0].offsetLeft : 0, c += (b.$list.width() - f.outerWidth()) / 2)), c 267 }, b.prototype.getOption = b.prototype.slickGetOption = function (a) { 268 var b = this; 269 return b.options[a] 270 }, b.prototype.getNavigableIndexes = function () { 271 var e, a = this, b = 0, c = 0, d = []; 272 for (a.options.infinite === !1 ? e = a.slideCount : (b = -1 * a.options.slidesToScroll, c = -1 * a.options.slidesToScroll, e = 2 * a.slideCount); e > b;)d.push(b), b = c + a.options.slidesToScroll, c += a.options.slidesToScroll <= a.options.slidesToShow ? a.options.slidesToScroll : a.options.slidesToShow; 273 return d 274 }, b.prototype.getSlick = function () { 275 return this 276 }, b.prototype.getSlideCount = function () { 277 var c, d, e, b = this; 278 return e = b.options.centerMode === !0 ? b.slideWidth * Math.floor(b.options.slidesToShow / 2) : 0, b.options.swipeToSlide === !0 ? (b.$slideTrack.find(".slick-slide").each(function (c, f) { 279 return f.offsetLeft - e + a(f).outerWidth() / 2 > -1 * b.swipeLeft ? (d = f, !1) : void 0 280 }), c = Math.abs(a(d).attr("data-slick-index") - b.currentSlide) || 1) : b.options.slidesToScroll 281 }, b.prototype.goTo = b.prototype.slickGoTo = function (a, b) { 282 var c = this; 283 c.changeSlide({data: {message: "index", index: parseInt(a)}}, b) 284 }, b.prototype.init = function (b) { 285 var c = this; 286 a(c.$slider).hasClass("slick-initialized") || (a(c.$slider).addClass("slick-initialized"), c.buildRows(), c.buildOut(), c.setProps(), c.startLoad(), c.loadSlider(), c.initializeEvents(), c.updateArrows(), c.updateDots()), b && c.$slider.trigger("init", [c]), c.options.accessibility === !0 && c.initADA() 287 }, b.prototype.initArrowEvents = function () { 288 var a = this; 289 a.options.arrows === !0 && a.slideCount > a.options.slidesToShow && (a.$prevArrow.on("click.slick", {message: "previous"}, a.changeSlide), a.$nextArrow.on("click.slick", {message: "next"}, a.changeSlide)) 290 }, b.prototype.initDotEvents = function () { 291 var b = this; 292 b.options.dots === !0 && b.slideCount > b.options.slidesToShow && a("li", b.$dots).on("click.slick", {message: "index"}, b.changeSlide), b.options.dots === !0 && b.options.pauseOnDotsHover === !0 && b.options.autoplay === !0 && a("li", b.$dots).on("mouseenter.slick", a.proxy(b.setPaused, b, !0)).on("mouseleave.slick", a.proxy(b.setPaused, b, !1)) 293 }, b.prototype.initializeEvents = function () { 294 var b = this; 295 b.initArrowEvents(), b.initDotEvents(), b.$list.on("touchstart.slick mousedown.slick", {action: "start"}, b.swipeHandler), b.$list.on("touchmove.slick mousemove.slick", {action: "move"}, b.swipeHandler), b.$list.on("touchend.slick mouseup.slick", {action: "end"}, b.swipeHandler), b.$list.on("touchcancel.slick mouseleave.slick", {action: "end"}, b.swipeHandler), b.$list.on("click.slick", b.clickHandler), a(document).on(b.visibilityChange, a.proxy(b.visibility, b)), b.$list.on("mouseenter.slick", a.proxy(b.setPaused, b, !0)), b.$list.on("mouseleave.slick", a.proxy(b.setPaused, b, !1)), b.options.accessibility === !0 && b.$list.on("keydown.slick", b.keyHandler), b.options.focusOnSelect === !0 && a(b.$slideTrack).children().on("click.slick", b.selectHandler), a(window).on("orientationchange.slick.slick-" + b.instanceUid, a.proxy(b.orientationChange, b)), a(window).on("resize.slick.slick-" + b.instanceUid, a.proxy(b.resize, b)), a("[draggable!=true]", b.$slideTrack).on("dragstart", b.preventDefault), a(window).on("load.slick.slick-" + b.instanceUid, b.setPosition), a(document).on("ready.slick.slick-" + b.instanceUid, b.setPosition) 296 }, b.prototype.initUI = function () { 297 var a = this; 298 a.options.arrows === !0 && a.slideCount > a.options.slidesToShow && (a.$prevArrow.show(), a.$nextArrow.show()), a.options.dots === !0 && a.slideCount > a.options.slidesToShow && a.$dots.show(), a.options.autoplay === !0 && a.autoPlay() 299 }, b.prototype.keyHandler = function (a) { 300 var b = this; 301 a.target.tagName.match("TEXTAREA|INPUT|SELECT") || (37 === a.keyCode && b.options.accessibility === !0 ? b.changeSlide({data: {message: "previous"}}) : 39 === a.keyCode && b.options.accessibility === !0 && b.changeSlide({data: {message: "next"}})) 302 }, b.prototype.lazyLoad = function () { 303 function g(b) { 304 a("img[data-lazy]", b).each(function () { 305 var b = a(this), c = a(this).attr("data-lazy"), d = document.createElement("img"); 306 d.onload = function () { 307 b.animate({opacity: 0}, 100, function () { 308 b.attr("src", c).animate({opacity: 1}, 200, function () { 309 b.removeAttr("data-lazy").removeClass("slick-loading") 310 }) 311 }) 312 }, d.src = c 313 }) 314 } 315 316 var c, d, e, f, b = this; 317 b.options.centerMode === !0 ? b.options.infinite === !0 ? (e = b.currentSlide + (b.options.slidesToShow / 2 + 1), f = e + b.options.slidesToShow + 2) : (e = Math.max(0, b.currentSlide - (b.options.slidesToShow / 2 + 1)), f = 2 + (b.options.slidesToShow / 2 + 1) + b.currentSlide) : (e = b.options.infinite ? b.options.slidesToShow + b.currentSlide : b.currentSlide, f = e + b.options.slidesToShow, b.options.fade === !0 && (e > 0 && e--, f <= b.slideCount && f++)), c = b.$slider.find(".slick-slide").slice(e, f), g(c), b.slideCount <= b.options.slidesToShow ? (d = b.$slider.find(".slick-slide"), g(d)) : b.currentSlide >= b.slideCount - b.options.slidesToShow ? (d = b.$slider.find(".slick-cloned").slice(0, b.options.slidesToShow), g(d)) : 0 === b.currentSlide && (d = b.$slider.find(".slick-cloned").slice(-1 * b.options.slidesToShow), g(d)) 318 }, b.prototype.loadSlider = function () { 319 var a = this; 320 a.setPosition(), a.$slideTrack.css({opacity: 1}), a.$slider.removeClass("slick-loading"), a.initUI(), "progressive" === a.options.lazyLoad && a.progressiveLazyLoad() 321 }, b.prototype.next = b.prototype.slickNext = function () { 322 var a = this; 323 a.changeSlide({data: {message: "next"}}) 324 }, b.prototype.orientationChange = function () { 325 var a = this; 326 a.checkResponsive(), a.setPosition() 327 }, b.prototype.pause = b.prototype.slickPause = function () { 328 var a = this; 329 a.autoPlayClear(), a.paused = !0 330 }, b.prototype.play = b.prototype.slickPlay = function () { 331 var a = this; 332 a.paused = !1, a.autoPlay() 333 }, b.prototype.postSlide = function (a) { 334 var b = this; 335 b.$slider.trigger("afterChange", [b, a]), b.animating = !1, b.setPosition(), b.swipeLeft = null, b.options.autoplay === !0 && b.paused === !1 && b.autoPlay(), b.options.accessibility === !0 && b.initADA() 336 }, b.prototype.prev = b.prototype.slickPrev = function () { 337 var a = this; 338 a.changeSlide({data: {message: "previous"}}) 339 }, b.prototype.preventDefault = function (a) { 340 a.preventDefault() 341 }, b.prototype.progressiveLazyLoad = function () { 342 var c, d, b = this; 343 c = a("img[data-lazy]", b.$slider).length, c > 0 && (d = a("img[data-lazy]", b.$slider).first(), d.attr("src", null), d.attr("src", d.attr("data-lazy")).removeClass("slick-loading").load(function () { 344 d.removeAttr("data-lazy"), b.progressiveLazyLoad(), b.options.adaptiveHeight === !0 && b.setPosition() 345 }).error(function () { 346 d.removeAttr("data-lazy"), b.progressiveLazyLoad() 347 })) 348 }, b.prototype.refresh = function (b) { 349 var d, e, c = this; 350 e = c.slideCount - c.options.slidesToShow, c.options.infinite || (c.slideCount <= c.options.slidesToShow ? c.currentSlide = 0 : c.currentSlide > e && (c.currentSlide = e)), d = c.currentSlide, c.destroy(!0), a.extend(c, c.initials, {currentSlide: d}), c.init(), b || c.changeSlide({ 351 data: { 352 message: "index", 353 index: d 354 } 355 }, !1) 356 }, b.prototype.registerBreakpoints = function () { 357 var c, d, e, b = this, f = b.options.responsive || null; 358 if ("array" === a.type(f) && f.length) { 359 b.respondTo = b.options.respondTo || "window"; 360 for (c in f)if (e = b.breakpoints.length - 1, d = f[c].breakpoint, f.hasOwnProperty(c)) { 361 for (; e >= 0;)b.breakpoints[e] && b.breakpoints[e] === d && b.breakpoints.splice(e, 1), e--; 362 b.breakpoints.push(d), b.breakpointSettings[d] = f[c].settings 363 } 364 b.breakpoints.sort(function (a, c) { 365 return b.options.mobileFirst ? a - c : c - a 366 }) 367 } 368 }, b.prototype.reinit = function () { 369 var b = this; 370 b.$slides = b.$slideTrack.children(b.options.slide).addClass("slick-slide"), b.slideCount = b.$slides.length, b.currentSlide >= b.slideCount && 0 !== b.currentSlide && (b.currentSlide = b.currentSlide - b.options.slidesToScroll), b.slideCount <= b.options.slidesToShow && (b.currentSlide = 0), b.registerBreakpoints(), b.setProps(), b.setupInfinite(), b.buildArrows(), b.updateArrows(), b.initArrowEvents(), b.buildDots(), b.updateDots(), b.initDotEvents(), b.checkResponsive(!1, !0), b.options.focusOnSelect === !0 && a(b.$slideTrack).children().on("click.slick", b.selectHandler), b.setSlideClasses(0), b.setPosition(), b.$slider.trigger("reInit", [b]), b.options.autoplay === !0 && b.focusHandler() 371 }, b.prototype.resize = function () { 372 var b = this; 373 a(window).width() !== b.windowWidth && (clearTimeout(b.windowDelay), b.windowDelay = window.setTimeout(function () { 374 b.windowWidth = a(window).width(), b.checkResponsive(), b.unslicked || b.setPosition() 375 }, 50)) 376 }, b.prototype.removeSlide = b.prototype.slickRemove = function (a, b, c) { 377 var d = this; 378 return "boolean" == typeof a ? (b = a, a = b === !0 ? 0 : d.slideCount - 1) : a = b === !0 ? --a : a, d.slideCount < 1 || 0 > a || a > d.slideCount - 1 ? !1 : (d.unload(), c === !0 ? d.$slideTrack.children().remove() : d.$slideTrack.children(this.options.slide).eq(a).remove(), d.$slides = d.$slideTrack.children(this.options.slide), d.$slideTrack.children(this.options.slide).detach(), d.$slideTrack.append(d.$slides), d.$slidesCache = d.$slides, void d.reinit()) 379 }, b.prototype.setCSS = function (a) { 380 var d, e, b = this, c = {}; 381 b.options.rtl === !0 && (a = -a), d = "left" == b.positionProp ? Math.ceil(a) + "px" : "0px", e = "top" == b.positionProp ? Math.ceil(a) + "px" : "0px", c[b.positionProp] = a, b.transformsEnabled === !1 ? b.$slideTrack.css(c) : (c = {}, b.cssTransitions === !1 ? (c[b.animType] = "translate(" + d + ", " + e + ")", b.$slideTrack.css(c)) : (c[b.animType] = "translate3d(" + d + ", " + e + ", 0px)", b.$slideTrack.css(c))) 382 }, b.prototype.setDimensions = function () { 383 var a = this; 384 a.options.vertical === !1 ? a.options.centerMode === !0 && a.$list.css({padding: "0px " + a.options.centerPadding}) : (a.$list.height(a.$slides.first().outerHeight(!0) * a.options.slidesToShow), a.options.centerMode === !0 && a.$list.css({padding: a.options.centerPadding + " 0px"})), a.listWidth = a.$list.width(), a.listHeight = a.$list.height(), a.options.vertical === !1 && a.options.variableWidth === !1 ? (a.slideWidth = Math.ceil(a.listWidth / a.options.slidesToShow), a.$slideTrack.width(Math.ceil(a.slideWidth * a.$slideTrack.children(".slick-slide").length))) : a.options.variableWidth === !0 ? a.$slideTrack.width(5e3 * a.slideCount) : (a.slideWidth = Math.ceil(a.listWidth), a.$slideTrack.height(Math.ceil(a.$slides.first().outerHeight(!0) * a.$slideTrack.children(".slick-slide").length))); 385 var b = a.$slides.first().outerWidth(!0) - a.$slides.first().width(); 386 a.options.variableWidth === !1 && a.$slideTrack.children(".slick-slide").width(a.slideWidth - b) 387 }, b.prototype.setFade = function () { 388 var c, b = this; 389 b.$slides.each(function (d, e) { 390 c = b.slideWidth * d * -1, b.options.rtl === !0 ? a(e).css({ 391 position: "relative", 392 right: c, 393 top: 0, 394 zIndex: b.options.zIndex - 2, 395 opacity: 0 396 }) : a(e).css({position: "relative", left: c, top: 0, zIndex: b.options.zIndex - 2, opacity: 0}) 397 }), b.$slides.eq(b.currentSlide).css({zIndex: b.options.zIndex - 1, opacity: 1}) 398 }, b.prototype.setHeight = function () { 399 var a = this; 400 if (1 === a.options.slidesToShow && a.options.adaptiveHeight === !0 && a.options.vertical === !1) { 401 var b = a.$slides.eq(a.currentSlide).outerHeight(!0); 402 a.$list.css("height", b) 403 } 404 }, b.prototype.setOption = b.prototype.slickSetOption = function (b, c, d) { 405 var f, g, e = this; 406 if ("responsive" === b && "array" === a.type(c))for (g in c)if ("array" !== a.type(e.options.responsive)) e.options.responsive = [c[g]]; else { 407 for (f = e.options.responsive.length - 1; f >= 0;)e.options.responsive[f].breakpoint === c[g].breakpoint && e.options.responsive.splice(f, 1), f--; 408 e.options.responsive.push(c[g]) 409 } else e.options[b] = c; 410 d === !0 && (e.unload(), e.reinit()) 411 }, b.prototype.setPosition = function () { 412 var a = this; 413 a.setDimensions(), a.setHeight(), a.options.fade === !1 ? a.setCSS(a.getLeft(a.currentSlide)) : a.setFade(), a.$slider.trigger("setPosition", [a]) 414 }, b.prototype.setProps = function () { 415 var a = this, b = document.body.style; 416 a.positionProp = a.options.vertical === !0 ? "top" : "left", "top" === a.positionProp ? a.$slider.addClass("slick-vertical") : a.$slider.removeClass("slick-vertical"), (void 0 !== b.WebkitTransition || void 0 !== b.MozTransition || void 0 !== b.msTransition) && a.options.useCSS === !0 && (a.cssTransitions = !0), a.options.fade && ("number" == typeof a.options.zIndex ? a.options.zIndex < 3 && (a.options.zIndex = 3) : a.options.zIndex = a.defaults.zIndex), void 0 !== b.OTransform && (a.animType = "OTransform", a.transformType = "-o-transform", a.transitionType = "OTransition", void 0 === b.perspectiveProperty && void 0 === b.webkitPerspective && (a.animType = !1)), void 0 !== b.MozTransform && (a.animType = "MozTransform", a.transformType = "-moz-transform", a.transitionType = "MozTransition", void 0 === b.perspectiveProperty && void 0 === b.MozPerspective && (a.animType = !1)), void 0 !== b.webkitTransform && (a.animType = "webkitTransform", a.transformType = "-webkit-transform", a.transitionType = "webkitTransition", void 0 === b.perspectiveProperty && void 0 === b.webkitPerspective && (a.animType = !1)), void 0 !== b.msTransform && (a.animType = "msTransform", a.transformType = "-ms-transform", a.transitionType = "msTransition", void 0 === b.msTransform && (a.animType = !1)), void 0 !== b.transform && a.animType !== !1 && (a.animType = "transform", a.transformType = "transform", a.transitionType = "transition"), a.transformsEnabled = a.options.useTransform && null !== a.animType && a.animType !== !1 417 }, b.prototype.setSlideClasses = function (a) { 418 var c, d, e, f, b = this; 419 d = b.$slider.find(".slick-slide").removeClass("slick-active slick-center slick-current").attr("aria-hidden", "true"), b.$slides.eq(a).addClass("slick-current"), b.options.centerMode === !0 ? (c = Math.floor(b.options.slidesToShow / 2), b.options.infinite === !0 && (a >= c && a <= b.slideCount - 1 - c ? b.$slides.slice(a - c, a + c + 1).addClass("slick-active").attr("aria-hidden", "false") : (e = b.options.slidesToShow + a, d.slice(e - c + 1, e + c + 2).addClass("slick-active").attr("aria-hidden", "false")), 0 === a ? d.eq(d.length - 1 - b.options.slidesToShow).addClass("slick-center") : a === b.slideCount - 1 && d.eq(b.options.slidesToShow).addClass("slick-center")), b.$slides.eq(a).addClass("slick-center")) : a >= 0 && a <= b.slideCount - b.options.slidesToShow ? b.$slides.slice(a, a + b.options.slidesToShow).addClass("slick-active").attr("aria-hidden", "false") : d.length <= b.options.slidesToShow ? d.addClass("slick-active").attr("aria-hidden", "false") : (f = b.slideCount % b.options.slidesToShow, e = b.options.infinite === !0 ? b.options.slidesToShow + a : a, b.options.slidesToShow == b.options.slidesToScroll && b.slideCount - a < b.options.slidesToShow ? d.slice(e - (b.options.slidesToShow - f), e + f).addClass("slick-active").attr("aria-hidden", "false") : d.slice(e, e + b.options.slidesToShow).addClass("slick-active").attr("aria-hidden", "false")), "ondemand" === b.options.lazyLoad && b.lazyLoad() 420 }, b.prototype.setupInfinite = function () { 421 var c, d, e, b = this; 422 if (b.options.fade === !0 && (b.options.centerMode = !1), b.options.infinite === !0 && b.options.fade === !1 && (d = null, b.slideCount > b.options.slidesToShow)) { 423 for (e = b.options.centerMode === !0 ? b.options.slidesToShow + 1 : b.options.slidesToShow, c = b.slideCount; c > b.slideCount - e; c -= 1)d = c - 1, a(b.$slides[d]).clone(!0).attr("id", "").attr("data-slick-index", d - b.slideCount).prependTo(b.$slideTrack).addClass("slick-cloned"); 424 for (c = 0; e > c; c += 1)d = c, a(b.$slides[d]).clone(!0).attr("id", "").attr("data-slick-index", d + b.slideCount).appendTo(b.$slideTrack).addClass("slick-cloned"); 425 b.$slideTrack.find(".slick-cloned").find("[id]").each(function () { 426 a(this).attr("id", "") 427 }) 428 } 429 }, b.prototype.setPaused = function (a) { 430 var b = this; 431 b.options.autoplay === !0 && b.options.pauseOnHover === !0 && (b.paused = a, a ? b.autoPlayClear() : b.autoPlay()) 432 }, b.prototype.selectHandler = function (b) { 433 var c = this, d = a(b.target).is(".slick-slide") ? a(b.target) : a(b.target).parents(".slick-slide"), 434 e = parseInt(d.attr("data-slick-index")); 435 return e || (e = 0), c.slideCount <= c.options.slidesToShow ? (c.setSlideClasses(e), void c.asNavFor(e)) : void c.slideHandler(e) 436 }, b.prototype.slideHandler = function (a, b, c) { 437 var d, e, f, g, h = null, i = this; 438 return b = b || !1, i.animating === !0 && i.options.waitForAnimate === !0 || i.options.fade === !0 && i.currentSlide === a || i.slideCount <= i.options.slidesToShow ? void 0 : (b === !1 && i.asNavFor(a), d = a, h = i.getLeft(d), g = i.getLeft(i.currentSlide), i.currentLeft = null === i.swipeLeft ? g : i.swipeLeft, i.options.infinite === !1 && i.options.centerMode === !1 && (0 > a || a > i.getDotCount() * i.options.slidesToScroll) ? void(i.options.fade === !1 && (d = i.currentSlide, c !== !0 ? i.animateSlide(g, function () { 439 i.postSlide(d); 440 }) : i.postSlide(d))) : i.options.infinite === !1 && i.options.centerMode === !0 && (0 > a || a > i.slideCount - i.options.slidesToScroll) ? void(i.options.fade === !1 && (d = i.currentSlide, c !== !0 ? i.animateSlide(g, function () { 441 i.postSlide(d) 442 }) : i.postSlide(d))) : (i.options.autoplay === !0 && clearInterval(i.autoPlayTimer), e = 0 > d ? i.slideCount % i.options.slidesToScroll !== 0 ? i.slideCount - i.slideCount % i.options.slidesToScroll : i.slideCount + d : d >= i.slideCount ? i.slideCount % i.options.slidesToScroll !== 0 ? 0 : d - i.slideCount : d, i.animating = !0, i.$slider.trigger("beforeChange", [i, i.currentSlide, e]), f = i.currentSlide, i.currentSlide = e, i.setSlideClasses(i.currentSlide), i.updateDots(), i.updateArrows(), i.options.fade === !0 ? (c !== !0 ? (i.fadeSlideOut(f), i.fadeSlide(e, function () { 443 i.postSlide(e) 444 })) : i.postSlide(e), void i.animateHeight()) : void(c !== !0 ? i.animateSlide(h, function () { 445 i.postSlide(e) 446 }) : i.postSlide(e)))) 447 }, b.prototype.startLoad = function () { 448 var a = this; 449 a.options.arrows === !0 && a.slideCount > a.options.slidesToShow && (a.$prevArrow.hide(), a.$nextArrow.hide()), a.options.dots === !0 && a.slideCount > a.options.slidesToShow && a.$dots.hide(), a.$slider.addClass("slick-loading") 450 }, b.prototype.swipeDirection = function () { 451 var a, b, c, d, e = this; 452 return a = e.touchObject.startX - e.touchObject.curX, b = e.touchObject.startY - e.touchObject.curY, c = Math.atan2(b, a), d = Math.round(180 * c / Math.PI), 0 > d && (d = 360 - Math.abs(d)), 45 >= d && d >= 0 ? e.options.rtl === !1 ? "left" : "right" : 360 >= d && d >= 315 ? e.options.rtl === !1 ? "left" : "right" : d >= 135 && 225 >= d ? e.options.rtl === !1 ? "right" : "left" : e.options.verticalSwiping === !0 ? d >= 35 && 135 >= d ? "left" : "right" : "vertical" 453 }, b.prototype.swipeEnd = function (a) { 454 var c, b = this; 455 if (b.dragging = !1, b.shouldClick = b.touchObject.swipeLength > 10 ? !1 : !0, void 0 === b.touchObject.curX)return !1; 456 if (b.touchObject.edgeHit === !0 && b.$slider.trigger("edge", [b, b.swipeDirection()]), b.touchObject.swipeLength >= b.touchObject.minSwipe)switch (b.swipeDirection()) { 457 case"left": 458 c = b.options.swipeToSlide ? b.checkNavigable(b.currentSlide + b.getSlideCount()) : b.currentSlide + b.getSlideCount(), b.slideHandler(c), b.currentDirection = 0, b.touchObject = {}, b.$slider.trigger("swipe", [b, "left"]); 459 break; 460 case"right": 461 c = b.options.swipeToSlide ? b.checkNavigable(b.currentSlide - b.getSlideCount()) : b.currentSlide - b.getSlideCount(), b.slideHandler(c), b.currentDirection = 1, b.touchObject = {}, b.$slider.trigger("swipe", [b, "right"]) 462 } else b.touchObject.startX !== b.touchObject.curX && (b.slideHandler(b.currentSlide), b.touchObject = {}) 463 }, b.prototype.swipeHandler = function (a) { 464 var b = this; 465 if (!(b.options.swipe === !1 || "ontouchend" in document && b.options.swipe === !1 || b.options.draggable === !1 && -1 !== a.type.indexOf("mouse")))switch (b.touchObject.fingerCount = a.originalEvent && void 0 !== a.originalEvent.touches ? a.originalEvent.touches.length : 1, b.touchObject.minSwipe = b.listWidth / b.options.touchThreshold, b.options.verticalSwiping === !0 && (b.touchObject.minSwipe = b.listHeight / b.options.touchThreshold), a.data.action) { 466 case"start": 467 b.swipeStart(a); 468 break; 469 case"move": 470 b.swipeMove(a); 471 break; 472 case"end": 473 b.swipeEnd(a) 474 } 475 }, b.prototype.swipeMove = function (a) { 476 var d, e, f, g, h, b = this; 477 return h = void 0 !== a.originalEvent ? a.originalEvent.touches : null, !b.dragging || h && 1 !== h.length ? !1 : (d = b.getLeft(b.currentSlide), b.touchObject.curX = void 0 !== h ? h[0].pageX : a.clientX, b.touchObject.curY = void 0 !== h ? h[0].pageY : a.clientY, b.touchObject.swipeLength = Math.round(Math.sqrt(Math.pow(b.touchObject.curX - b.touchObject.startX, 2))), b.options.verticalSwiping === !0 && (b.touchObject.swipeLength = Math.round(Math.sqrt(Math.pow(b.touchObject.curY - b.touchObject.startY, 2)))), e = b.swipeDirection(), "vertical" !== e ? (void 0 !== a.originalEvent && b.touchObject.swipeLength > 4 && a.preventDefault(), g = (b.options.rtl === !1 ? 1 : -1) * (b.touchObject.curX > b.touchObject.startX ? 1 : -1), b.options.verticalSwiping === !0 && (g = b.touchObject.curY > b.touchObject.startY ? 1 : -1), f = b.touchObject.swipeLength, b.touchObject.edgeHit = !1, b.options.infinite === !1 && (0 === b.currentSlide && "right" === e || b.currentSlide >= b.getDotCount() && "left" === e) && (f = b.touchObject.swipeLength * b.options.edgeFriction, b.touchObject.edgeHit = !0), b.options.vertical === !1 ? b.swipeLeft = d + f * g : b.swipeLeft = d + f * (b.$list.height() / b.listWidth) * g, b.options.verticalSwiping === !0 && (b.swipeLeft = d + f * g), b.options.fade === !0 || b.options.touchMove === !1 ? !1 : b.animating === !0 ? (b.swipeLeft = null, !1) : void b.setCSS(b.swipeLeft)) : void 0) 478 }, b.prototype.swipeStart = function (a) { 479 var c, b = this; 480 return 1 !== b.touchObject.fingerCount || b.slideCount <= b.options.slidesToShow ? (b.touchObject = {}, !1) : (void 0 !== a.originalEvent && void 0 !== a.originalEvent.touches && (c = a.originalEvent.touches[0]), b.touchObject.startX = b.touchObject.curX = void 0 !== c ? c.pageX : a.clientX, b.touchObject.startY = b.touchObject.curY = void 0 !== c ? c.pageY : a.clientY, void(b.dragging = !0)) 481 }, b.prototype.unfilterSlides = b.prototype.slickUnfilter = function () { 482 var a = this; 483 null !== a.$slidesCache && (a.unload(), a.$slideTrack.children(this.options.slide).detach(), a.$slidesCache.appendTo(a.$slideTrack), a.reinit()) 484 }, b.prototype.unload = function () { 485 var b = this; 486 a(".slick-cloned", b.$slider).remove(), b.$dots && b.$dots.remove(), b.$prevArrow && b.htmlExpr.test(b.options.prevArrow) && b.$prevArrow.remove(), b.$nextArrow && b.htmlExpr.test(b.options.nextArrow) && b.$nextArrow.remove(), b.$slides.removeClass("slick-slide slick-active slick-visible slick-current").attr("aria-hidden", "true").css("width", "") 487 }, b.prototype.unslick = function (a) { 488 var b = this; 489 b.$slider.trigger("unslick", [b, a]), b.destroy() 490 }, b.prototype.updateArrows = function () { 491 var b, a = this; 492 b = Math.floor(a.options.slidesToShow / 2), a.options.arrows === !0 && a.slideCount > a.options.slidesToShow && !a.options.infinite && (a.$prevArrow.removeClass("slick-disabled").attr("aria-disabled", "false"), a.$nextArrow.removeClass("slick-disabled").attr("aria-disabled", "false"), 0 === a.currentSlide ? (a.$prevArrow.addClass("slick-disabled").attr("aria-disabled", "true"), a.$nextArrow.removeClass("slick-disabled").attr("aria-disabled", "false")) : a.currentSlide >= a.slideCount - a.options.slidesToShow && a.options.centerMode === !1 ? (a.$nextArrow.addClass("slick-disabled").attr("aria-disabled", "true"), a.$prevArrow.removeClass("slick-disabled").attr("aria-disabled", "false")) : a.currentSlide >= a.slideCount - 1 && a.options.centerMode === !0 && (a.$nextArrow.addClass("slick-disabled").attr("aria-disabled", "true"), a.$prevArrow.removeClass("slick-disabled").attr("aria-disabled", "false"))) 493 }, b.prototype.updateDots = function () { 494 var a = this; 495 null !== a.$dots && (a.$dots.find("li").removeClass("slick-active").attr("aria-hidden", "true"), a.$dots.find("li").eq(Math.floor(a.currentSlide / a.options.slidesToScroll)).addClass("slick-active").attr("aria-hidden", "false")) 496 }, b.prototype.visibility = function () { 497 var a = this; 498 document[a.hidden] ? (a.paused = !0, a.autoPlayClear()) : a.options.autoplay === !0 && (a.paused = !1, a.autoPlay()) 499 }, b.prototype.initADA = function () { 500 var b = this; 501 b.$slides.add(b.$slideTrack.find(".slick-cloned")).attr({ 502 "aria-hidden": "true", 503 tabindex: "-1" 504 }).find("a, input, button, select").attr({tabindex: "-1"}), b.$slideTrack.attr("role", "listbox"), b.$slides.not(b.$slideTrack.find(".slick-cloned")).each(function (c) { 505 a(this).attr({role: "option", "aria-describedby": "slick-slide" + b.instanceUid + c}) 506 }), null !== b.$dots && b.$dots.attr("role", "tablist").find("li").each(function (c) { 507 a(this).attr({ 508 role: "presentation", 509 "aria-selected": "false", 510 "aria-controls": "navigation" + b.instanceUid + c, 511 id: "slick-slide" + b.instanceUid + c 512 }) 513 }).first().attr("aria-selected", "true").end().find("button").attr("role", "button").end().closest("div").attr("role", "toolbar"), b.activateADA() 514 }, b.prototype.activateADA = function () { 515 var a = this; 516 a.$slideTrack.find(".slick-active").attr({"aria-hidden": "false"}).find("a, input, button, select").attr({tabindex: "0"}) 517 }
517, b.prototype.focusHandler = function () { 518 var b = this; 519 b.$slider.on("focus.slick blur.slick", "*", function (c) { 520 c.stopImmediatePropagation(); 521 var d = a(this); 522 setTimeout(function () { 523 b.isPlay && (d.is(":focus") ? (b.autoPlayClear(), b.paused = !0) : (b.paused = !1, b.autoPlay())) 524 }, 0) 525 }) 526 }, a.fn.slick = function () { 527 var f, g, a = this, c = arguments[0], d = Array.prototype.slice.call(arguments, 1), e = a.length; 528 for (f = 0; e > f; f++)if ("object" == typeof c || "undefined" == typeof c ? a[f].slick = new b(a[f], c) : g = a[f].slick[c].apply(a[f].slick, d), "undefined" != typeof g)return g; 529 return a 530 } 531}); 532 533 534/*! Magnific Popup - v1.1.0 - 2016-02-20 535 * http://dimsemenov.com/plugins/magnific-popup/ 536 * Copyright (c) 2016 Dmitry Semenov; */ 537!function (a) { 538 "function" == typeof define && define.amd ? define(["jquery"], a) : a("object" == typeof exports ? require("jquery") : window.jQuery || window.Zepto) 539}(function (a) { 540 var b, c, d, e, f, g, h = "Close", i = "BeforeClose", j = "AfterClose", k = "BeforeAppend", l = "MarkupParse", 541 m = "Open", n = "Change", o = "mfp", p = "." + o, q = "mfp-ready", r = "mfp-removing", s = "mfp-prevent-close", 542 t = function () { 543 }, u = !!window.jQuery, v = a(window), w = function (a, c) { 544 b.ev.on(o + a + p, c) 545 }, x = function (b, c, d, e) { 546 var f = document.createElement("div"); 547 return f.className = "mfp-" + b, d && (f.innerHTML = d), e ? c && c.appendChild(f) : (f = a(f), c && f.appendTo(c)), f 548 }, y = function (c, d) { 549 b.ev.triggerHandler(o + c, d), b.st.callbacks && (c = c.charAt(0).toLowerCase() + c.slice(1), b.st.callbacks[c] && b.st.callbacks[c].apply(b, a.isArray(d) ? d : [d])) 550 }, z = function (c) { 551 return c === g && b.currTemplate.closeBtn || (b.currTemplate.closeBtn = a(b.st.closeMarkup.replace("%title%", b.st.tClose)), g = c), b.currTemplate.closeBtn 552 }, A = function () { 553 a.magnificPopup.instance || (b = new t, b.init(), a.magnificPopup.instance = b) 554 }, B = function () { 555 var a = document.createElement("p").style, b = ["ms", "O", "Moz", "Webkit"]; 556 if (void 0 !== a.transition)return !0; 557 for (; b.length;)if (b.pop() + "Transition" in a)return !0; 558 return !1 559 }; 560 t.prototype = { 561 constructor: t, init: function () { 562 var c = navigator.appVersion; 563 b.isLowIE = b.isIE8 = document.all && !document.addEventListener, b.isAndroid = /android/gi.test(c), b.isIOS = /iphone|ipad|ipod/gi.test(c), b.supportsTransition = B(), b.probablyMobile = b.isAndroid || b.isIOS || /(Opera Mini)|Kindle|webOS|BlackBerry|(Opera Mobi)|(Windows Phone)|IEMobile/i.test(navigator.userAgent), d = a(document), b.popupsCache = {} 564 }, open: function (c) { 565 var e; 566 if (c.isObj === !1) { 567 b.items = c.items.toArray(), b.index = 0; 568 var g, h = c.items; 569 for (e = 0; e < h.length; e++)if (g = h[e], g.parsed && (g = g.el[0]), g === c.el[0]) { 570 b.index = e; 571 break 572 } 573 } else b.items = a.isArray(c.items) ? c.items : [c.items], b.index = c.index || 0; 574 if (b.isOpen)return void b.updateItemHTML(); 575 b.types = [], f = "", c.mainEl && c.mainEl.length ? b.ev = c.mainEl.eq(0) : b.ev = d, c.key ? (b.popupsCache[c.key] || (b.popupsCache[c.key] = {}), b.currTemplate = b.popupsCache[c.key]) : b.currTemplate = {}, b.st = a.extend(!0, {}, a.magnificPopup.defaults, c), b.fixedContentPos = "auto" === b.st.fixedContentPos ? !b.probablyMobile : b.st.fixedContentPos, b.st.modal && (b.st.closeOnContentClick = !1, b.st.closeOnBgClick = !1, b.st.showCloseBtn = !1, b.st.enableEscapeKey = !1), b.bgOverlay || (b.bgOverlay = x("bg").on("click" + p, function () { 576 b.close() 577 }), b.wrap = x("wrap").attr("tabindex", -1).on("click" + p, function (a) { 578 b._checkIfClose(a.target) && b.close() 579 }), b.container = x("container", b.wrap)), b.contentContainer = x("content"), b.st.preloader && (b.preloader = x("preloader", b.container, b.st.tLoading)); 580 var i = a.magnificPopup.modules; 581 for (e = 0; e < i.length; e++) { 582 var j = i[e]; 583 j = j.charAt(0).toUpperCase() + j.slice(1), b["init" + j].call(b) 584 } 585 y("BeforeOpen"), b.st.showCloseBtn && (b.st.closeBtnInside ? (w(l, function (a, b, c, d) { 586 c.close_replaceWith = z(d.type) 587 }), f += " mfp-close-btn-in") : b.wrap.append(z())), b.st.alignTop && (f += " mfp-align-top"), b.fixedContentPos ? b.wrap.css({ 588 overflow: b.st.overflowY, 589 overflowX: "hidden", 590 overflowY: b.st.overflowY 591 }) : b.wrap.css({ 592 top: v.scrollTop(), 593 position: "absolute" 594 }), (b.st.fixedBgPos === !1 || "auto" === b.st.fixedBgPos && !b.fixedContentPos) && b.bgOverlay.css({ 595 height: d.height(), 596 position: "absolute" 597 }), b.st.enableEscapeKey && d.on("keyup" + p, function (a) { 598 27 === a.keyCode && b.close() 599 }), v.on("resize" + p, function () { 600 b.updateSize() 601 }), b.st.closeOnContentClick || (f += " mfp-auto-cursor"), f && b.wrap.addClass(f); 602 var k = b.wH = v.height(), n = {}; 603 if (b.fixedContentPos && b._hasScrollBar(k)) { 604 var o = b._getScrollbarSize(); 605 o && (n.marginRight = o) 606 } 607 b.fixedContentPos && (b.isIE7 ? a("body, html").css("overflow", "hidden") : n.overflow = "hidden"); 608 var r = b.st.mainClass; 609 return b.isIE7 && (r += " mfp-ie7"), r && b._addClassToMFP(r), b.updateItemHTML(), y("BuildControls"), a("html").css(n), b.bgOverlay.add(b.
609wrap).prependTo(b.st.prependTo || a(document.body)), b._lastFocusedEl = document.activeElement, setTimeout(function () { 610 b.content ? (b._addClassToMFP(q), b._setFocus()) : b.bgOverlay.addClass(q), d.on("focusin" + p, b._onFocusIn) 611 }, 16), b.isOpen = !0, b.updateSize(k), y(m), c 612 }, close: function () { 613 b.isOpen && (y(i), b.isOpen = !1, b.st.removalDelay && !b.isLowIE && b.supportsTransition ? (b._addClassToMFP(r), setTimeout(function () { 614 b._close() 615 }, b.st.removalDelay)) : b._close()) 616 }, _close: function () { 617 y(h); 618 var c = r + " " + q + " "; 619 if (b.bgOverlay.detach(), b.wrap.detach(), b.container.empty(), b.st.mainClass && (c += b.st.mainClass + " "), b._removeClassFromMFP(c), b.fixedContentPos) { 620 var e = {marginRight: ""}; 621 b.isIE7 ? a("body, html").css("overflow", "") : e.overflow = "", a("html").css(e) 622 } 623 d.off("keyup" + p + " focusin" + p), b.ev.off(p), b.wrap.attr("class", "mfp-wrap").removeAttr("style"), b.bgOverlay.attr("class", "mfp-bg"), b.container.attr("class", "mfp-container"), !b.st.showCloseBtn || b.st.closeBtnInside && b.currTemplate[b.currItem.type] !== !0 || b.currTemplate.closeBtn && b.currTemplate.closeBtn.detach(), b.st.autoFocusLast && b._lastFocusedEl && a(b._lastFocusedEl).focus(), b.currItem = null, b.content = null, b.currTemplate = null, b.prevHeight = 0, y(j) 624 }, updateSize: function (a) { 625 if (b.isIOS) { 626 var c = document.documentElement.clientWidth / window.innerWidth, d = window.innerHeight * c; 627 b.wrap.css("height", d), b.wH = d 628 } else b.wH = a || v.height(); 629 b.fixedContentPos || b.wrap.css("height", b.wH), y("Resize") 630 }, updateItemHTML: function () { 631 var c = b.items[b.index]; 632 b.contentContainer.detach(), b.content && b.content.detach(), c.parsed || (c = b.parseEl(b.index)); 633 var d = c.type; 634 if (y("BeforeChange", [b.currItem ? b.currItem.type : "", d]), b.currItem = c, !b.currTemplate[d]) { 635 var f = b.st[d] ? b.st[d].markup : !1; 636 y("FirstMarkupParse", f), f ? b.currTemplate[d] = a(f) : b.currTemplate[d] = !0 637 } 638 e && e !== c.type && b.container.removeClass("mfp-" + e + "-holder"); 639 var g = b["get" + d.charAt(0).toUpperCase() + d.slice(1)](c, b.currTemplate[d]); 640 b.appendContent(g, d), c.preloaded = !0, y(n, c), e = c.type, b.container.prepend(b.contentContainer), y("AfterChange") 641 }, appendContent: function (a, c) { 642 b.content = a, a ? b.st.showCloseBtn && b.st.closeBtnInside && b.currTemplate[c] === !0 ? b.content.find(".mfp-close").length || b.content.append(z()) : b.content = a : b.content = "", y(k), b.container.addClass("mfp-" + c + "-holder"), b.contentContainer.append(b.content) 643 }, parseEl: function (c) { 644 var d, e = b.items[c]; 645 if (e.tagName ? e = {el: a(e)} : (d = e.type, e = {data: e, src: e.src}), e.el) { 646 for (var f = b.types, g = 0; g < f.length; g++)if (e.el.hasClass("mfp-" + f[g])) { 647 d = f[g]; 648 break 649 } 650 e.src = e.el.attr("data-mfp-src"), e.src || (e.src = e.el.attr("href")) 651 } 652 return e.type = d || b.st.type || "inline", e.index = c, e.parsed = !0, b.items[c] = e, y("ElementParse", e), b.items[c] 653 }, addGroup: function (a, c) { 654 var d = function (d) { 655 d.mfpEl = this, b._openClick(d, a, c) 656 }; 657 c || (c = {}); 658 var e = "click.magnificPopup"; 659 c.mainEl = a, c.items ? (c.isObj = !0, a.off(e).on(e, d)) : (c.isObj = !1, c.delegate ? a.off(e).on(e, c.delegate, d) : (c.items = a, a.off(e).on(e, d))) 660 }, _openClick: function (c, d, e) { 661 var f = void 0 !== e.midClick ? e.midClick : a.magnificPopup.defaults.midClick; 662 if (f || !(2 === c.which || c.ctrlKey || c.metaKey || c.altKey || c.shift
662Key)) { 663 var g = void 0 !== e.disableOn ? e.disableOn : a.magnificPopup.defaults.disableOn; 664 if (g)if (a.isFunction(g)) { 665 if (!g.call(b))return !0 666 } else if (v.width() < g)return !0; 667 c.type && (c.preventDefault(), b.isOpen && c.stopPropagation()), e.el = a(c.mfpEl), e.delegate && (e.items = d.find(e.delegate)), b.open(e) 668 } 669 }, updateStatus: function (a, d) { 670 if (b.preloader) { 671 c !== a && b.container.removeClass("mfp-s-" + c), d || "loading" !== a || (d = b.st.tLoading); 672 var e = {status: a, text: d}; 673 y("UpdateStatus", e), a = e.status, d = e.text, b.preloader.html(d), b.preloader.find("a").on("click", function (a) { 674 a.stopImmediatePropagation() 675 }), b.container.addClass("mfp-s-" + a), c = a 676 } 677 }, _checkIfClose: function (c) { 678 if (!a(c).hasClass(s)) { 679 var d = b.st.closeOnContentClick, e = b.st.closeOnBgClick; 680 if (d && e)return !0; 681 if (!b.content || a(c).hasClass("mfp-close") || b.preloader && c === b.preloader[0])return !0; 682 if (c === b.content[0] || a.contains(b.content[0], c)) { 683 if (d)return !0 684 } else if (e && a.contains(document, c))return !0; 685 return !1 686 } 687 }, _addClassToMFP: function (a) { 688 b.bgOverlay.addClass(a), b.wrap.addClass(a) 689 }, _removeClassFromMFP: function (a) { 690 this.bgOverlay.removeClass(a), b.wrap.removeClass(a) 691 }, _hasScrollBar: function (a) { 692 return (b.isIE7 ? d.height() : document.body.scrollHeight) > (a || v.height()) 693 }, _setFocus: function () { 694 (b.st.focus ? b.content.find(b.st.focus).eq(0) : b.wrap).focus() 695 }, _onFocusIn: function (c) { 696 return c.target === b.wrap[0] || a.contains(b.wrap[0], c.target) ? void 0 : (b._setFocus(), !1) 697 }, _parseMarkup: function (b, c, d) { 698 var e; 699 d.data && (c = a.extend(d.data, c)), y(l, [b, c, d]), a.each(c, function (c, d) { 700 if (void 0 === d || d === !1)return !0; 701 if (e = c.split("_"), e.length > 1) { 702 var f = b.find(p + "-" + e[0]); 703 if (f.length > 0) { 704 var g = e[1]; 705 "replaceWith" === g ? f[0] !== d[0] && f.replaceWith(d) : "img" === g ? f.is("img") ? f.attr("src", d) : f.replaceWith(a("<img>").attr("src", d).attr("class", f.attr("class"))) : f.attr(e[1], d) 706 } 707 } else b.find(p + "-" + c).html(d) 708 }) 709 }, _getScrollbarSize: function () { 710 if (void 0 === b.scrollbarSize) { 711 var a = document.createElement("div"); 712 a.style.cssText = "width: 99px; height: 99px; overflow: scroll; position: absolute; top: -9999px;", document.body.appendChild(a), b.scrollbarSize = a.offsetWidth - a.clientWidth, document.body.removeChild(a) 713 } 714 return b.scrollbarSize 715 } 716 }, a.magnificPopup = { 717 instance: null, 718 proto: t.prototype, 719 modules: [], 720 open: function (b, c) { 721 return A(), b = b ? a.extend(!0, {}, b) : {}, b.isObj = !0, b.index = c || 0, this.instance.open(b) 722 }, 723 close: function () { 724 return a.magnificPopup.instance && a.magnificPopup.instance.close() 725 }, 726 registerModule: function (b, c) { 727 c.options && (a.magnificPopup.defaults[b] = c.options), a.extend(this.proto, c.proto), this.modules.push(b) 728 }, 729 defaults: { 730 disableOn: 0, 731 key: null, 732 midClick: !1, 733 mainClass: "", 734 preloader: !0, 735 focus: "", 736 closeOnContentClick: !1, 737 closeOnBgClick: !0, 738 closeBtnInside: !0, 739 showCloseBtn: !0, 740 enableEscapeKey: !0, 741 modal: !1, 742 alignTop: !1, 743 removalDelay: 0, 744 prependTo: null, 745 fixedContentPos: "auto", 746 fixedBgPos: "auto", 747 overflowY: "auto", 748 closeMarkup: '<button title="%title%" type="button" class="mfp-close">×</button>', 749 tClose: "Close (Esc)", 750 tLoading: "Loading...", 751 autoFocusLast: !0 752 } 753 }, a.fn.magnificPopup = function (c) { 754 A(); 755 var d = a(this); 756 if ("string" == typeof c)if ("open" === c) { 757 var e, f = u ? d.data("magnificPopup") : d[0].magnificPopup, g = parseInt(arguments[1], 10) || 0; 758 f.items ? e = f.items[g] : (e = d, f.delegate && (e = e.find(f.delegate)), e = e.eq(g)), b._openClick({mfpEl: e}, d, f) 759 } else b.isOpen && b[c].apply(b, Array.prototype.slice.call(arguments, 1)); else c = a.extend(!0, {}, c), u ? d.data("magnificPopup", c) : d[0].magnificPopup = c, b.addGroup(d, c); 760 return d 761 }; 762 var C, D, E, F = "inline", G = function () { 763 E && (D.after(E.addClass(C)).detach(), E = null) 764 }; 765 a.magnificPopup.registerModule(F, { 766 options: {hiddenClass: "hide", markup: "", tNotFound: "Content not found"}, 767 proto: { 768 initInline: function () { 769 b.types.push(F), w(h + "." + F, function () { 770 G() 771 }) 772 }, getInline: function (c, d) { 773 if (G(), c.src) { 774 var e = b.st.inline, f = a(c.src); 775 if (f.length) { 776 var g = f[0].parentNode; 777 g && g.tagName && (D || (C = e.hiddenClass, D = x(C), C = "mfp-" + C), E = f.after(D).detach().removeClass(C)), b.updateStatus("ready") 778 } else b.updateStatus("error", e.tNotFound), f = a("<div>"); 779 return c.inlineElement = f, f 780 } 781 return b.updateStatus("ready"), b._parseMarkup(d, {}, c), d 782 } 783 } 784 }); 785 var H, I = "ajax", J = function () { 786 H && a(document.body).removeClass(H) 787 }, K = function () { 788 J(), b.req && b.req.abort() 789 }; 790 a.magnificPopup.registerModule(I, { 791 options: { 792 settings: null, 793 cursor: "mfp-ajax-cur", 794 tError: '<a href="%url%">The content</a> could not be loaded.' 795 }, proto: { 796 initAjax: function () { 797 b.types.push(I), H = b.st.ajax.cursor, w(h + "." + I, K), w("BeforeChange." + I, K) 798 }, getAjax: function (c) { 799 H && a(document.body).addClass(H), b.updateStatus("loading"); 800 var d = a.extend({ 801 url: c.src, success: function (d, e, f) { 802 var g = {data: d, xhr: f}; 803 y("ParseAjax", g), b.appendContent(a(g.data), I), c.finished = !0, J(), b._setFocus(), setTimeout(function () { 804 b.wrap.addClass(q) 805 }, 16), b.updateStatus("ready"), y("AjaxContentAdded") 806 }, error: function () { 807 J(), c.finished = c.loadError = !0, b.updateStatus("error", b.st.ajax.tError.replace("%url%", c.src)) 808 } 809 }, b.st.ajax.settings); 810 return b.req = a.ajax(d), "" 811 } 812 } 813 }); 814 var L, M = function (c) { 815 if (c.data && void 0 !== c.data.title)return c.data.title;
816 var d = b.st.image.titleSrc; 817 if (d) { 818 if (a.isFunction(d))return d.call(b, c); 819 if (c.el)return c.el.attr(d) || "" 820 } 821 return "" 822 }; 823 a.magnificPopup.registerModule("image", { 824 options: { 825 markup: '<div class="mfp-figure"><div class="mfp-close"></div><figure><div class="mfp-img"></div><figcaption><div class="mfp-bottom-bar"><div class="mfp-title"></div><div class="mfp-counter"></div></div></figcaption></figure></div>', 826 cursor: "mfp-zoom-out-cur", 827 titleSrc: "title", 828 verticalFit: !0, 829 tError: '<a href="%url%">The image</a> could not be loaded.' 830 }, proto: { 831 initImage: function () { 832 var c = b.st.image, d = ".image"; 833 b.types.push("image"), w(m + d, function () { 834 "image" === b.currItem.type && c.cursor && a(document.body).addClass(c.cursor) 835 }), w(h + d, function () { 836 c.cursor && a(document.body).removeClass(c.cursor), v.off("resize" + p) 837 }), w("Resize" + d, b.resizeImage), b.isLowIE && w("AfterChange", b.resizeImage) 838 }, resizeImage: function () { 839 var a = b.currItem; 840 if (a && a.img && b.st.image.verticalFit) { 841 var c = 0; 842 b.isLowIE && (c = parseInt(a.img.css("padding-top"), 10) + parseInt(a.img.css("padding-bottom"), 10)), a.img.css("max-height", b.wH - c) 843 } 844 }, _onImageHasSize: function (a) { 845 a.img && (a.hasSize = !0, L && clearInterval(L), a.isCheckingImgSize = !1, y("ImageHasSize", a), a.imgHidden && (b.content && b.content.removeClass("mfp-loading"), a.imgHidden = !1)) 846 }, findImageSize: function (a) { 847 var c = 0, d = a.img[0], e = function (f) { 848 L && clearInterval(L), L = setInterval(function () { 849 return d.naturalWidth > 0 ? void b._onImageHasSize(a) : (c > 200 && clearInterval(L), c++, void(3 === c ? e(10) : 40 === c ? e(50) : 100 === c && e(500))) 850 }, f) 851 }; 852 e(1) 853 }, getImage: function (c, d) { 854 var e = 0, f = function () { 855 c && (c.img[0].complete ? (c.img.off(".mfploader"), c === b.currItem && (b._onImageHasSize(c), b.updateStatus("ready")), c.hasSize = !0, c.loaded = !0, y("ImageLoadComplete")) : (e++, 200 > e ? setTimeout(f, 100) : g())) 856 }, g = function () { 857 c && (c.img.off(".mfploader"), c === b.currItem && (b._onImageHasSize(c), b.updateStatus("error", h.tError.replace("%url%", c.src))), c.hasSize = !0, c.loaded = !0, c.loadError = !0) 858 }, h = b.st.image, i = d.find(".mfp-img"); 859 if (i.length) { 860 var j = document.createElement("img"); 861 j.className = "mfp-img", c.el && c.el.find("img").length && (j.alt = c.el.find("img").attr("alt")), c.img = a(j).on("load.mfploader", f).on("error.mfploader", g), j.src = c.src, i.is("img") && (c.img = c.img.clone()), j = c.img[0], j.naturalWidth > 0 ? c.hasSize = !0 : j.width || (c.hasSize = !1) 862 } 863 return b._parseMarkup(d, { 864 title: M(c), 865 img_replaceWith: c.img 866 }, c), b.resizeImage(), c.hasSize ? (L && clearInterval(L), c.loadError ? (d.addClass("mfp-loading"), b.updateStatus("error", h.tError.replace("%url%", c.src))) : (d.removeClass("mfp-loading"), b.updateStatus("ready")), d) : (b.updateStatus("loading"), c.loading = !0, c.hasSize || (c.imgHidden = !0, d.addClass("mfp-loading"), b.findImageSize(c)), d) 867 } 868 } 869 }); 870 var N, O = function () { 871 return void 0 === N && (N = void 0 !== document.createElement("p").style.MozTransform), N 872 }; 873 a.magnificPopup.registerModule("zoom", { 874 options: { 875 enabled: !1, 876 easing: "ease-in-out", 877 duration: 300, 878 opener: function (a) { 879 return a.is("img") ? a : a.find("img") 880 } 881 }, proto: { 882 initZoom: function () { 883 var a, c = b.st.zoom, d = ".zoom"; 884 if (c.enabled && b.supportsTransition) { 885 var e, f, g = c.duration, j = function (a) { 886 var b = a.clone().removeAttr("style").removeAttr("class").addClass("mfp-animated-image"), 887 d = "all " + c.duration / 1e3 + "s " + c.easing, e = { 888 position: "fixed", 889 zIndex: 9999, 890 left: 0, 891 top: 0, 892 "-webkit-backface-visibility": "hidden" 893 }, f = "transition"; 894 return e["-webkit-" + f] = e["-moz-" + f] = e["-o-" + f] = e[f] = d, b.css(e), b 895 }, k = function () { 896 b.content.css("visibility", "visible") 897 }; 898 w("BuildControls" + d, function () { 899 if (b._allowZoom()) { 900 if (clearTimeout(e), b.content.css("visibility", "hidden"), a = b._getItemToZoom(), !a)return void k(); 901 f = j(a), f.css(b._getOffset()), b.wrap.append(f), e = setTimeout(function () { 902 f.css(b._getOffset(!0)), e = setTimeout(function () { 903 k(), setTimeout(function () { 904 f.remove(), a = f = null, y("ZoomAnimationEnded") 905 }, 16) 906 }, g) 907 }, 16) 908 } 909 }), w(i + d, function () { 910 if (b._allowZoom()) { 911 if (clearTimeout(e), b.st.removalDelay = g, !a) { 912 if (a = b._getItemToZoom(), !a)return; 913 f = j(a) 914 } 915 f.css(b._getOffset(!0)), b.wrap.append(f), b.content.css("visibility", "hidden"), setTimeout(function () { 916 f.css(b._getOffset()) 917 }, 16) 918 } 919 }), w(h + d, function () { 920 b._allowZoom() && (k(), f && f.remove(), a = null) 921 }) 922 } 923 }, _allowZoom: function () { 924 return "image" === b.currItem.type 925 }, _getItemToZoom: function () { 926 return b.currItem.hasSize ? b.currItem.img : !1 927 }, _getOffset: function (c) { 928 var d; 929 d = c ? b.currItem.img : b.st.zoom.opener(b.currItem.el || b.currItem); 930 var e = d.offset(), f = parseInt(d.css("padding-top"), 10), g = parseInt(d.css("padding-bottom"), 10); 931 e.top -= a(window).scrollTop() - f; 932 var h = {width: d.width(), height: (u ? d.innerHeight() : d[0].offsetHeight) - g - f}; 933 return O() ? h["-moz-transform"] = h.transform = "translate(" + e.left + "px," + e.top + "px)" : (h.left = e.left, h.top = e.top), h 934 } 935 } 936 }); 937 var P = "iframe", Q = "//about:blank", R = function (a) { 938 if (b.currTemplate[P]) { 939 var c = b.currTemplate[P].find("iframe"); 940 c.length && (a || (c[0].src = Q), b.isIE8 && c.css("display", a ? "block" : "none")) 941 } 942 }; 943 a.magnificPopup.registerModule(P, { 944 options: { 945 markup: '<div class="mfp-iframe-scaler"><div class="mfp-close"></div><iframe class="mfp-iframe" src="//about:blank" frameborder="0" allowfullscreen></iframe></div>', 946 srcAction: "iframe_src", 947 patterns: { 948 youtube: {index: "youtube.com", id: "/", src: "//www.youtube.com/embed/%id%?autoplay=1"}, 949 vimeo: {index: "vimeo.com/", id: "/", src: "//player.vimeo.com/video/%id%?autoplay=1"}, 950 gmaps: {index: "//maps.google.", src: "%id%&output=embed"} 951 } 952 }, proto: { 953 initIframe: function () { 954 b.types.push(P), w("BeforeChange", function (a, b, c) { 955 b !== c && (b === P ? R() : c === P && R(!0)) 956 }), w(h + "." + P, function () { 957 R() 958 }) 959 }, getIframe: function (c, d) { 960 var e = c.src, f = b.st.iframe; 961 a.each(f.patterns, function () { 962 return e.indexOf(this.index) > -1 ? (this.id && (e = "string" == typeof this.id ? e.substr(e.lastIndexOf(this.id
962) + this.id.length, e.length) : this.id.call(this, e)), e = this.src.replace("%id%", e), !1) : void 0 963 }); 964 var g = {}; 965 return f.srcAction && (g[f.srcAction] = e), b._parseMarkup(d, g, c), b.updateStatus("ready"), d 966 } 967 } 968 }); 969 var S = function (a) { 970 var c = b.items.length; 971 return a > c - 1 ? a - c : 0 > a ? c + a : a 972 }, T = function (a, b, c) { 973 return a.replace(/%curr%/gi, b + 1).replace(/%total%/gi, c) 974 }; 975 a.magnificPopup.registerModule("gallery", { 976 options: { 977 enabled: !1, 978 arrowMarkup: '<button title="%title%" type="button" class="mfp-arrow mfp-arrow-%dir%"></button>', 979 preload: [0, 2], 980 navigateByImgClick: !0, 981 arrows: !0, 982 tPrev: "Previous (Left arrow key)", 983 tNext: "Next (Right arrow key)", 984 tCounter: "%curr% of %total%" 985 }, proto: { 986 initGallery: function () { 987 var c = b.st.gallery, e = ".mfp-gallery"; 988 return b.direction = !0, c && c.enabled ? (f += " mfp-gallery", w(m + e, function () { 989 c.navigateByImgClick && b.wrap.on("click" + e, ".mfp-img", function () { 990 return b.items.length > 1 ? (b.next(), !1) : void 0 991 }), d.on("keydown" + e, function (a) { 992 37 === a.keyCode ? b.prev() : 39 === a.keyCode && b.next() 993 }) 994 }), w("UpdateStatus" + e, function (a, c) { 995 c.text && (c.text = T(c.text, b.currItem.index, b.items.length)) 996 }), w(l + e, function (a, d, e, f) { 997 var g = b.items.length; 998 e.counter = g > 1 ? T(c.tCounter, f.index, g) : "" 999 }), w("BuildControls" + e, function () { 1000 if (b.items.length > 1 && c.arrows && !b.arrowLeft) { 1001 var d = c.arrowMarkup, 1002 e = b.arrowLeft = a(d.replace(/%title%/gi, c.tPrev).replace(/%dir%/gi, "left")).addClass(s), 1003 f = b.arrowRight = a(d.replace(/%title%/gi, c.tNext).replace(/%dir%/gi, "right")).addClass(s); 1004 e.click(function () { 1005 b.prev() 1006 }), f.click(function () { 1007 b.next() 1008 }), b.container.append(e.add(f)) 1009 } 1010 }), w(n + e, function () { 1011 b._preloadTimeout && clearTimeout(b._preloadTimeout), b._preloadTimeout = setTimeout(function () { 1012 b.preloadNearbyImages(), b._preloadTimeout = null 1013 }, 16) 1014 }), void w(h + e, function () { 1015 d.off(e), b.wrap.off("click" + e), b.arrowRight = b.arrowLeft = null 1016 })) : !1 1017 }, next: function () { 1018 b.direction = !0, b.index = S(b.index + 1), b.updateItemHTML() 1019 }, prev: function () { 1020 b.direction = !1, b.index = S(b.index - 1), b.updateItemHTML() 1021 }, goTo: function (a) { 1022 b.direction = a >= b.index, b.index = a, b.updateItemHTML() 1023 }, preloadNearbyImages: function () { 1024 var a, c = b.st.gallery.preload, d = Math.min(c[0], b.items.length), e = Math.min(c[1], b.items.length); 1025 for (a = 1; a <= (b.direction ? e : d); a++)b._preloadItem(b.index + a); 1026 for (a = 1; a <= (b.direction ? d : e); a++)b._preloadItem(b.index - a) 1027 }, _preloadItem: function (c) { 1028 if (c = S(c), !b.items[c].preloaded) { 1029 var d = b.items[c]; 1030 d.parsed || (d = b.parseEl(c)), y("LazyLoad", d), "image" === d.type && (d.img = a('<img class="mfp-img" />').on("load.mfploader", function () { 1031 d.hasSize = !0 1032 }).on("error.mfploader", function () { 1033 d.hasSize = !0, d.loadError = !0, y("LazyLoadError", d) 1034 }).attr("src", d.src)), d.preloaded = !0 1035 } 1036 } 1037 } 1038 }); 1039 var U = "retina"; 1040 a.magnificPopup.registerModule(U, { 1041 options: { 1042 replaceSrc: function (a) { 1043 return a.src.replace(/\.\w+$/, function (a) { 1044 return "@2x" + a 1045 }) 1046 }, ratio: 1 1047 }, proto: { 1048 initRetina: function () { 1049 if (window.devicePixelRatio > 1) { 1050 var a = b.st.retina, c = a.ratio; 1051 c = isNaN(c) ? c() : c, c > 1 && (w("ImageHasSize." + U, function (a, b) { 1052 b.img.css({"max-width": b.img[0].naturalWi
vendor: 13,270 bytes, lines 1052-1373
1052dth / c, width: "100%"}) 1053 }), w("ElementParse." + U, function (b, d) { 1054 d.src = a.replaceSrc(d, c) 1055 })) 1056 } 1057 } 1058 } 1059 }), A() 1060}); 1061 1062 1063/*! 1064 * Masonry PACKAGED v4.0.0 1065 * Cascading grid layout library 1066 * http://masonry.desandro.com 1067 * MIT License 1068 * by David DeSandro 1069 */ 1070 1071!function (t, e) { 1072 "use strict"; 1073 "function" == typeof define && define.amd ? define("jquery-bridget/jquery-bridget", ["jquery"], function (i) { 1074 e(t, i) 1075 }) : "object" == typeof module && module.exports ? module.exports = e(t, require("jquery")) : t.jQueryBridget = e(t, t.jQuery) 1076}(window, function (t, e) { 1077 "use strict"; 1078 function i(i, r, a) { 1079 function h(t, e, n) { 1080 var o, r = "$()." + i + '("' + e + '")'; 1081 return t.each(function (t, h) { 1082 var u = a.data(h, i); 1083 if (!u)return void s(i + " not initialized. Cannot call methods, i.e. " + r); 1084 var d = u[e]; 1085 if (!d || "_" == e.charAt(0))return void s(r + " is not a valid method"); 1086 var c = d.apply(u, n); 1087 o = void 0 === o ? c : o 1088 }), void 0 !== o ? o : t 1089 } 1090 1091 function u(t, e) { 1092 t.each(function (t, n) { 1093 var o = a.data(n, i); 1094 o ? (o.option(e), o._init()) : (o = new r(n, e), a.data(n, i, o)) 1095 }) 1096 } 1097 1098 a = a || e || t.jQuery, a && (r.prototype.option || (r.prototype.option = function (t) { 1099 a.isPlainObject(t) && (this.options = a.extend(!0, this.options, t)) 1100 }), a.fn[i] = function (t) { 1101 if ("string" == typeof t) { 1102 var e = o.call(arguments, 1); 1103 return h(this, t, e) 1104 } 1105 return u(this, t), this 1106 }, n(a)) 1107 } 1108 1109 function n(t) { 1110 !t || t && t.bridget || (t.bridget = i) 1111 } 1112 1113 var o = Array.prototype.slice, r = t.console, s = "undefined" == typeof r ? function () { 1114 } : function (t) { 1115 r.error(t) 1116 }; 1117 return n(e || t.jQuery), i 1118}), function (t, e) { 1119 "function" == typeof define && define.amd ? define("ev-emitter/ev-emitter", e) : "object" == typeof module && module.exports ? module.exports = e() : t.EvEmitter = e() 1120}(this, function () { 1121 function t() { 1122 } 1123 1124 var e = t.prototype; 1125 return e.on = function (t, e) { 1126 if (t && e) { 1127 var i = this._events = this._events || {}, n = i[t] = i[t] || []; 1128 return -1 == n.indexOf(e) && n.push(e), this 1129 } 1130 }, e.once = function (t, e) { 1131 if (t && e) { 1132 this.on(t, e); 1133 var i = this._onceEvents = this._onceEvents || {}, n = i[t] = i[t] || []; 1134 return n[e] = !0, this 1135 } 1136 }, e.off = function (t, e) { 1137 var i = this._events && this._events[t]; 1138 if (i && i.length) { 1139 var n = i.indexOf(e); 1140 return -1 != n && i.splice(n, 1), this 1141 } 1142 }, e.emitEvent = function (t, e) { 1143 var i = this._events && this._events[t]; 1144 if (i && i.length) { 1145 var n = 0, o = i[n]; 1146 e = e || []; 1147 for (var r = this._onceEvents && this._onceEvents[t]; o;) { 1148 var s = r && r[o]; 1149 s && (this.off(t, o), delete r[o]), o.apply(this, e), n += s ? 0 : 1, o = i[n] 1150 } 1151 return this 1152 } 1153 }, t 1154}), function (t, e) { 1155 "use strict"; 1156 "function" == typeof define && define.amd ? define("get-size/get-size", [], function () { 1157 return e() 1158 }) : "object" == typeof module && module.exports ? module.exports = e() : t.getSize = e() 1159}(window, function () { 1160 "use strict"; 1161 function t(t) { 1162 var e = parseFloat(t), i = -1 == t.indexOf("%") && !isNaN(e); 1163 return i && e 1164 } 1165 1166 function e() { 1167 } 1168 1169 function i() { 1170 for (var t = { 1171 width: 0, 1172 height: 0, 1173 innerWidth: 0, 1174 innerHeight: 0, 1175 outerWidth: 0, 1176 outerHeight: 0 1177 }, e = 0; u > e; e++) { 1178 var i = h[e]; 1179 t[i] = 0 1180 } 1181 return t 1182 } 1183 1184 function n(t) { 1185 var e = getComputedStyle(t); 1186 return e || a("Style returned " + e + ". Are you running this code in a hidden iframe on Firefox? See http://bit.ly/getsizebug1"), e 1187 } 1188 1189 function o() { 1190 if (!d) { 1191 d = !0; 1192 var e = document.createElement("div"); 1193 e.style.width = "200px", e.style.padding = "1px 2px 3px 4px", e.style.borderStyle = "solid", e.style.borderWidth = "1px 2px 3px 4px", e.style.boxSizing = "border-box"; 1194 var i = document.body || document.documentElement; 1195 i.appendChild(e); 1196 var o = n(e); 1197 r.isBoxSizeOuter = s = 200 == t(o.width), i.removeChild(e) 1198 } 1199 } 1200 1201 function r(e) { 1202 if (o(), "string" == typeof e && (e = document.querySelector(e)), e && "object" == typeof e && e.nodeType) { 1203 var r = n(e); 1204 if ("none" == r.display)return i(); 1205 var a = {}; 1206 a.width = e.offsetWidth, a.height = e.offsetHeight; 1207 for (var d = a.isBorderBox = "border-box" == r.boxSizing, c = 0; u > c; c++) { 1208 var l = h[c], f = r[l], m = parseFloat(f); 1209 a[l] = isNaN(m) ? 0 : m 1210 } 1211 var p = a.paddingLeft + a.paddingRight, g = a.paddingTop + a.paddingBottom, 1212 y = a.marginLeft + a.marginRight, v = a.marginTop + a.marginBottom, 1213 _ = a.borderLeftWidth + a.borderRightWidth, E = a.borderTopWidth + a.borderBottomWidth, z = d && s, 1214 b = t(r.width); 1215 b !== !1 && (a.width = b + (z ? 0 : p + _)); 1216 var x = t(r.height); 1217 return x !== !1 && (a.height = x + (z ? 0 : g + E)), a.innerWidth = a.width - (p + _), a.innerHeight = a.height - (g + E), a.outerWidth = a.width + y, a.outerHeight = a.height + v, a 1218 } 1219 } 1220 1221 var s, a = "undefined" == typeof console ? e : function (t) { 1222 console.error(t) 1223 }, 1224 h = ["paddingLeft", "paddingRight", "paddingTop", "paddingBottom", "marginLeft", "marginRight", "marginTop", "marginBottom", "borderLeftWidth", "borderRightWidth", "borderTopWidth", "borderBottomWidth"], 1225 u = h.length, d = !1; 1226 return r 1227}), function (t, e) { 1228 "use strict"; 1229 "function" == typeof define && define.amd ? define("matches-selector/matches-selector", e) : "object" == typeof module && module.exports ? module.exports = e() : t.matchesSelector = e() 1230}(window, function () { 1231 "use strict"; 1232 var t = function () { 1233 var t = Element.prototype; 1234 if (t.matches)return "matches"; 1235 if (t.matchesSelector)return "matchesSelector"; 1236 for (var e = ["webkit", "moz", "ms", "o"], i = 0; i < e.length; i++) { 1237 var n = e[i], o = n + "MatchesSelector"; 1238 if (t[o])return o 1239 } 1240 }(); 1241 return function (e, i) { 1242 return e[t](i) 1243 } 1244}), function (t, e) { 1245 "use strict"; 1246 "function" == typeof define && define.amd ? define("fizzy-ui-utils/utils", ["matches-selector/matches-selector"], function (i) { 1247 return e(t, i) 1248 }) : "object" == typeof module && module.exports ? module.exports = e(t, require("desandro-matches-selector")) : t.fizzyUIUtils = e(t, t.matchesSelector) 1249}(window, function (t, e) { 1250 var i = {}; 1251 i.extend = function (t, e) { 1252 for (var i in e)t[i] = e[i]; 1253 return t 1254 }, i.modulo = function (t, e) { 1255 return (t % e + e) % e 1256 }, i.makeArray = function (t) { 1257 var e = []; 1258 if (Array.isArray(t)) e = t; else if (t && "number" == typeof t.length)for (var i = 0; i < t.length; i++)e.push(t[i]); else e.push(t); 1259 return e 1260 }, i.removeFrom = function (t, e) { 1261 var i = t.indexOf(e); 1262 -1 != i && t.splice(i, 1) 1263 }, i.getParent = function (t, i) { 1264 for (; t != document.body;)if (t = t.parentNode, e(t, i))return t 1265 }, i.getQueryElement = function (t) { 1266 return "string" == typeof t ? document.querySelector(t) : t 1267 }, i.handleEvent = function (t) { 1268 var e = "on" + t.type; 1269 this[e] && this[e](t) 1270 }, i.filterFindElements = function (t, n) { 1271 t = i.makeArray(t); 1272 var o = []; 1273 return t.forEach(function (t) { 1274 if (t instanceof HTMLElement) { 1275 if (!n)return void o.push(t); 1276 e(t, n) && o.push(t); 1277 for (var i = t.querySelectorAll(n), r = 0; r < i.length; r++)o.push(i[r]) 1278 } 1279 }), o 1280 }, i.debounceMethod = function (t, e, i) { 1281 var n = t.prototype[e], o = e + "Timeout"; 1282 t.prototype[e] = function () { 1283 var t = this[o]; 1284 t && clearTimeout(t); 1285 var e = arguments, r = this; 1286 this[o] = setTimeout(function () { 1287 n.apply(r, e), delete r[o] 1288 }, i || 100) 1289 } 1290 }, i.docReady = function (t) { 1291 "complete" == document.readyState ? t() : document.addEventListener("DOMContentLoaded", t) 1292 }, i.toDashed = function (t) { 1293 return t.replace(/(.)([A-Z])/g, function (t, e, i) { 1294 return e + "-" + i 1295 }).toLowerCase() 1296 }; 1297 var n = t.console; 1298 return i.htmlInit = function (e, o) { 1299 i.docReady(function () { 1300 var r = i.toDashed(o), s = "data-" + r, a = document.querySelectorAll("[" + s + "]"), 1301 h = document.querySelectorAll(".js-" + r), u = i.makeArray(a).concat(i.makeArray(h)), 1302 d = s + "-options", c = t.jQuery; 1303 u.forEach(function (t) { 1304 var i, r = t.getAttribute(s) || t.getAttribute(d); 1305 try { 1306 i = r && JSON.parse(r) 1307 } catch (a) { 1308 return void(n && n.error("Error parsing " + s + " on " + t.className + ": " + a)) 1309 } 1310 var h = new e(t, i); 1311 c && c.data(t, o, h) 1312 }) 1313 }) 1314 }, i 1315}), function (t, e) { 1316 "function" == typeof define && define.amd ? define("outlayer/item", ["ev-emitter/ev-emitter", "get-size/get-size"], function (i, n) { 1317 return e(t, i, n) 1318 }) : "object" == typeof module && module.exports ? module.exports = e(t, require("ev-emitter"), require("get-size")) : (t.Outlayer = {}, t.Outlayer.Item = e(t, t.EvEmitter, t.getSize)) 1319}(window, function (t, e, i) { 1320 "use strict"; 1321 function n(t) { 1322 for (var e in t)return !1; 1323 return e = null, !0 1324 } 1325 1326 function o(t, e) { 1327 t && (this.element = t, this.layout = e, this.position = {x: 0, y: 0}, this._create()) 1328 } 1329 1330 function r(t) { 1331 return t.replace(/([A-Z])/g, function (t) { 1332 return "-" + t.toLowerCase() 1333 }) 1334 } 1335 1336 var s = document.documentElement.style, a = "string" == typeof s.transition ? "transition" : "WebkitTransition", 1337 h = "string" == typeof s.transform ? "transform" : "WebkitTransform", 1338 u = {WebkitTransition: "webkitTransitionEnd", transition: "transitionend"}[a], 1339 d = [h, a, a + "Duration", a + "Property"], c = o.prototype = Object.create(e.prototype); 1340 c.constructor = o, c._create = function () { 1341 this._transn = {ingProperties: {}, clean: {}, onEnd: {}}, this.css({position: "absolute"}) 1342 }, c.handleEvent = function (t) { 1343 var e = "on" + t.type; 1344 this[e] && this[e](t) 1345 }, c.getSize = function () { 1346 this.size = i(this.element) 1347 }, c.css = function (t) { 1348 var e = this.element.style; 1349 for (var i in t) { 1350 var n = d[i] || i; 1351 e[n] = t[i] 1352 } 1353 }, c.getPosition = function () { 1354 var t = getComputedStyle(this.element), e = this.layout._getOption("originLeft"), 1355 i = this.layout._getOption("originTop"), n = t[e ? "left" : "right"], o = t[i ? "top" : "bottom"], 1356 r = this.layout.size, s = -1 != n.indexOf("%") ? parseFloat(n) / 100 * r.width : parseInt(n, 10), 1357 a = -1 != o.indexOf("%") ? parseFloat(o) / 100 * r.height : parseInt(o, 10); 1358 s = isNaN(s) ? 0 : s, a = isNaN(a) ? 0 : a, s -= e ? r.paddingLeft : r.paddingRight, a -= i ? r.paddingTop : r.paddingBottom, this.position.x = s, this.position.y = a 1359 }, c.layoutPosition = function () { 1360 var t = this.layout.size, e = {}, i = this.layout._getOption("originLeft"), 1361 n = this.layout._getOption("originTop"), o = i ? "paddingLeft" : "paddingRight", r = i ? "left" : "right", 1362 s = i ? "right" : "left", a = this.position.x + t[o]; 1363 e[r] = this.getXValue(a), e[s] = ""; 1364 var h = n ? "paddingTop" : "paddingBottom", u = n ? "top" : "bottom", d = n ? "bottom" : "top", 1365 c = this.position.y + t[h]; 1366 e[u] = this.getYValue(c), e[d] = "", this.css(e), this.emitEvent("layout", [this]) 1367 }, c.getXValue = function (t) { 1368 var e = this.layout._getOption("horizontal"); 1369 return this.layout.options.percentPosition && !e ? t / this.layout.size.width * 100 + "%" : t + "px" 1370 }, c.getYValue = function (t) { 1371 var e = this.layout._getOption("horizontal"); 1372 return this.layout.options.percentPosition && e ? t / this.layout.size.height * 100 + "%" : t + "px" 1373 }
vendor: 8,318 bytes, lines 1373-1546
1373, c._transitionTo = function (t, e) { 1374 this.getPosition(); 1375 var i = this.position.x, n = this.position.y, o = parseInt(t, 10), r = parseInt(e, 10), 1376 s = o === this.position.x && r === this.position.y; 1377 if (this.setPosition(t, e), s && !this.isTransitioning)return void this.layoutPosition(); 1378 var a = t - i, h = e - n, u = {}; 1379 u.transform = this.getTranslate(a, h), this.transition({ 1380 to: u, 1381 onTransitionEnd: {transform: this.layoutPosition}, 1382 isCleaning: !0 1383 }) 1384 }, c.getTranslate = function (t, e) { 1385 var i = this.layout._getOption("originLeft"), n = this.layout._getOption("originTop"); 1386 return t = i ? t : -t, e = n ? e : -e, "translate3d(" + t + "px, " + e + "px, 0)" 1387 }, c.goTo = function (t, e) { 1388 this.setPosition(t, e), this.layoutPosition() 1389 }, c.moveTo = c._transitionTo, c.setPosition = function (t, e) { 1390 this.position.x = parseInt(t, 10), this.position.y = parseInt(e, 10) 1391 }, c._nonTransition = function (t) { 1392 this.css(t.to), t.isCleaning && this._removeStyles(t.to); 1393 for (var e in t.onTransitionEnd)t.onTransitionEnd[e].call(this) 1394 }, c._transition = function (t) { 1395 if (!parseFloat(this.layout.options.transitionDuration))return void this._nonTransition(t); 1396 var e = this._transn; 1397 for (var i in t.onTransitionEnd)e.onEnd[i] = t.onTransitionEnd[i]; 1398 for (i in t.to)e.ingProperties[i] = !0, t.isCleaning && (e.clean[i] = !0); 1399 if (t.from) { 1400 this.css(t.from); 1401 var n = this.element.offsetHeight; 1402 n = null 1403 } 1404 this.enableTransition(t.to), this.css(t.to), this.isTransitioning = !0 1405 }; 1406 var l = "opacity," + r(d.transform || "transform"); 1407 c.enableTransition = function () { 1408 this.isTransitioning || (this.css({ 1409 transitionProperty: l, 1410 transitionDuration: this.layout.options.transitionDuration 1411 }), this.element.addEventListener(u, this, !1)) 1412 }, c.transition = o.prototype[a ? "_transition" : "_nonTransition"], c.onwebkitTransitionEnd = function (t) { 1413 this.ontransitionend(t) 1414 }, c.onotransitionend = function (t) { 1415 this.ontransitionend(t) 1416 }; 1417 var f = {"-webkit-transform": "transform"}; 1418 c.ontransitionend = function (t) { 1419 if (t.target === this.element) { 1420 var e = this._transn, i = f[t.propertyName] || t.propertyName; 1421 if (delete e.ingProperties[i], n(e.ingProperties) && this.disableTransition(), i in e.clean && (this.element.style[t.propertyName] = "", delete e.clean[i]), i in e.onEnd) { 1422 var o = e.onEnd[i]; 1423 o.call(this), delete e.onEnd[i] 1424 } 1425 this.emitEvent("transitionEnd", [this]) 1426 } 1427 }, c.disableTransition = function () { 1428 this.removeTransitionStyles(), this.element.removeEventListener(u, this, !1), this.isTransitioning = !1 1429 }, c._removeStyles = function (t) { 1430 var e = {}; 1431 for (var i in t)e[i] = ""; 1432 this.css(e) 1433 }; 1434 var m = {transitionProperty: "", transitionDuration: ""}; 1435 return c.removeTransitionStyles = function () { 1436 this.css(m) 1437 }, c.removeElem = function () { 1438 this.element.parentNode.removeChild(this.element), this.css({display: ""}), this.emitEvent("remove", [this]) 1439 }, c.remove = function () { 1440 return a && parseFloat(this.layout.options.transitionDuration) ? (this.once("transitionEnd", function () { 1441 this.removeElem() 1442 }), void this.hide()) : void this.removeElem() 1443 }, c.reveal = function () { 1444 delete this.isHidden, this.css({display: ""}); 1445 var t = this.layout.options, e = {}, i = this.getHideRevealTransitionEndProperty("visibleStyle"); 1446 e[i] = this.onRevealTransitionEnd, this.transition({ 1447 from: t.hiddenStyle, 1448 to: t.visibleStyle, 1449 isCleaning: !0, 1450 onTransitionEnd: e 1451 }) 1452 }, c.onRevealTransitionEnd = function () { 1453 this.isHidden || this.emitEvent("reveal") 1454 }, c.getHideRevealTransitionEndProperty = function (t) { 1455 var e = this.layout.options[t]; 1456 if (e.opacity)return "opacity"; 1457 for (var i in e)return i 1458 }, c.hide = function () { 1459 this.isHidden = !0, this.css({display: ""}); 1460 var t = this.layout.options, e = {}, i = this.getHideRevealTransitionEndProperty("hiddenStyle"); 1461 e[i] = this.onHideTransitionEnd, this.transition({ 1462 from: t.visibleStyle, 1463 to: t.hiddenStyle, 1464 isCleaning: !0, 1465 onTransitionEnd: e 1466 }) 1467 }, c.onHideTransitionEnd = function () { 1468 this.isHidden && (this.css({display: "none"}), this.emitEvent("hide")) 1469 }, c.destroy = function () { 1470 this.css({position: "", left: "", right: "", top: "", bottom: "", transition: "", transform: ""}) 1471 }, o 1472}), function (t, e) { 1473 "use strict"; 1474 "function" == typeof define && define.amd ? define("outlayer/outlayer", ["ev-emitter/ev-emitter", "get-size/get-size", "fizzy-ui-utils/utils", "./item"], function (i, n, o, r) { 1475 return e(t, i, n, o, r) 1476 }) : "object" == typeof module && module.exports ? module.exports = e(t, require("ev-emitter"), require("get-size"), require("fizzy-ui-utils"), require("./item")) : t.Outlayer = e(t, t.EvEmitter, t.getSize, t.fizzyUIUtils, t.Outlayer.Item) 1477}(window, function (t, e, i, n, o) { 1478 "use strict"; 1479 function r(t, e) { 1480 var i = n.getQueryElement(t); 1481 if (!i)return void(a && a.error("Bad element for " + this.constructor.namespace + ": " + (i || t))); 1482 this.element = i, h && (this.$element = h(this.element)), this.options = n.extend({}, this.constructor.defaults), this.option(e); 1483 var o = ++d; 1484 this.element.outlayerGUID = o, c[o] = this, this._create(); 1485 var r = this._getOption("initLayout"); 1486 r && this.layout() 1487 } 1488 1489 function s(t) { 1490 function e() { 1491 t.apply(this, arguments) 1492 } 1493 1494 return e.prototype = Object.create(t.prototype), e.prototype.constructor = e, e 1495 } 1496 1497 var a = t.console, h = t.jQuery, u = function () { 1498 }, d = 0, c = {}; 1499 r.namespace = "outlayer", r.Item = o, r.defaults = { 1500 containerStyle: {position: "relative"}, 1501 initLayout: !0, 1502 originLeft: !0, 1503 originTop: !0, 1504 resize: !0, 1505 resizeContainer: !0, 1506 transitionDuration: "0.4s", 1507 hiddenStyle: {opacity: 0, transform: "scale(0.001)"}, 1508 visibleStyle: {opacity: 1, transform: "scale(1)"} 1509 }; 1510 var l = r.prototype; 1511 return n.extend(l, e.prototype), l.option = function (t) { 1512 n.extend(this.options, t) 1513 }, l._getOption = function (t) { 1514 var e = this.constructor.compatOptions[t]; 1515 return e && void 0 !== this.options[e] ? this.options[e] : this.options[t] 1516 }, r.compatOptions = { 1517 initLayout: "isInitLayout", 1518 horizontal: "isHorizontal", 1519 layoutInstant: "isLayoutInstant", 1520 originLeft: "isOriginLeft", 1521 originTop: "isOriginTop", 1522 resize: "isResizeBound", 1523 resizeContainer: "isResizingContainer" 1524 }, l._create = function () { 1525 this.reloadItems(), this.stamps = [], this.stamp(this.options.stamp), n.extend(this.element.style, this.options.containerStyle); 1526 var t = this._getOption("resize"); 1527 t && this.bindResize() 1528 }, l.reloadItems = function () { 1529 this.items = this._itemize(this.element.children) 1530 }, l._itemize = function (t) { 1531 for (var e = this._filterFindItemElements(t), i = this.constructor.Item, n = [], o = 0; o < e.length; o++) { 1532 var r = e[o], s = new i(r, this); 1533 n.push(s) 1534 } 1535 return n 1536 }, l._filterFindItemElements = function (t) { 1537 return n.filterFindElements(t, this.options.itemSelector) 1538 }, l.getItemElements = function () { 1539 return this.items.map(function (t) { 1540 return t.element 1541 }) 1542 }, l.layout = function () { 1543 this._resetLayout(), this._manageStamps(); 1544 var t = this._getOption("layoutInstant"), e = void 0 !== t ? t : !this._isLayoutInited; 1545 this.layoutItems(this.items, e), this._isLayoutInited = !0 1546 }, l._init = l.layout, l._resetLayout = function () {
vendor: 6,669 bytes, lines 1547-1697
1547 this.getSize() 1548 }, l.getSize = function () { 1549 this.size = i(this.element) 1550 }, l._getMeasurement = function (t, e) { 1551 var n, o = this.options[t]; 1552 o ? ("string" == typeof o ? n = this.element.querySelector(o) : o instanceof HTMLElement && (n = o), this[t] = n ? i(n)[e] : o) : this[t] = 0 1553 }, l.layoutItems = function (t, e) { 1554 t = this._getItemsForLayout(t), this._layoutItems(t, e), this._postLayout() 1555 }, l._getItemsForLayout = function (t) { 1556 return t.filter(function (t) { 1557 return !t.isIgnored 1558 }) 1559 }, l._layoutItems = function (t, e) { 1560 if (this._emitCompleteOnItems("layout", t), t && t.length) { 1561 var i = []; 1562 t.forEach(function (t) { 1563 var n = this._getItemLayoutPosition(t); 1564 n.item = t, n.isInstant = e || t.isLayoutInstant, i.push(n) 1565 }, this), this._processLayoutQueue(i) 1566 } 1567 }, l._getItemLayoutPosition = function () { 1568 return {x: 0, y: 0} 1569 }, l._processLayoutQueue = function (t) { 1570 t.forEach(function (t) { 1571 this._positionItem(t.item, t.x, t.y, t.isInstant) 1572 }, this) 1573 }, l._positionItem = function (t, e, i, n) { 1574 n ? t.goTo(e, i) : t.moveTo(e, i) 1575 }, l._postLayout = function () { 1576 this.resizeContainer() 1577 }, l.resizeContainer = function () { 1578 var t = this._getOption("resizeContainer"); 1579 if (t) { 1580 var e = this._getContainerSize(); 1581 e && (this._setContainerMeasure(e.width, !0), this._setContainerMeasure(e.height, !1)) 1582 } 1583 }, l._getContainerSize = u, l._setContainerMeasure = function (t, e) { 1584 if (void 0 !== t) { 1585 var i = this.size; 1586 i.isBorderBox && (t += e ? i.paddingLeft + i.paddingRight + i.borderLeftWidth + i.borderRightWidth : i.paddingBottom + i.paddingTop + i.borderTopWidth + i.borderBottomWidth), t = Math.max(t, 0), this.element.style[e ? "width" : "height"] = t + "px" 1587 } 1588 }, l._emitCompleteOnItems = function (t, e) { 1589 function i() { 1590 o.dispatchEvent(t + "Complete", null, [e]) 1591 } 1592 1593 function n() { 1594 s++, s == r && i() 1595 } 1596 1597 var o = this, r = e.length; 1598 if (!e || !r)return void i(); 1599 var s = 0; 1600 e.forEach(function (e) { 1601 e.once(t, n) 1602 }) 1603 }, l.dispatchEvent = function (t, e, i) { 1604 var n = e ? [e].concat(i) : i; 1605 if (this.emitEvent(t, n), h)if (this.$element = this.$element || h(this.element), e) { 1606 var o = h.Event(e); 1607 o.type = t, this.$element.trigger(o, i) 1608 } else this.$element.trigger(t, i) 1609 }, l.ignore = function (t) { 1610 var e = this.getItem(t); 1611 e && (e.isIgnored = !0) 1612 }, l.unignore = function (t) { 1613 var e = this.getItem(t); 1614 e && delete e.isIgnored 1615 }, l.stamp = function (t) { 1616 t = this._find(t), t && (this.stamps = this.stamps.concat(t), t.forEach(this.ignore, this)) 1617 }, l.unstamp = function (t) { 1618 t = this._find(t), t && t.forEach(function (t) { 1619 n.removeFrom(this.stamps, t), this.unignore(t) 1620 }, this) 1621 }, l._find = function (t) { 1622 return t ? ("string" == typeof t && (t = this.element.querySelectorAll(t)), t = n.makeArray(t)) : void 0 1623 }, l._manageStamps = function () { 1624 this.stamps && this.stamps.length && (this._getBoundingRect(), this.stamps.forEach(this._manageStamp, this)) 1625 }, l._getBoundingRect = function () { 1626 var t = this.element.getBoundingClientRect(), e = this.size; 1627 this._boundingRect = { 1628 left: t.left + e.paddingLeft + e.borderLeftWidth, 1629 top: t.top + e.paddingTop + e.borderTopWidth, 1630 right: t.right - (e.paddingRight + e.borderRightWidth), 1631 bottom: t.bottom - (e.paddingBottom + e.borderBottomWidth) 1632 } 1633 }, l._manageStamp = u, l._getElementOffset = function (t) { 1634 var e = t.getBoundingClientRect(), n = this._boundingRect, o = i(t), r = { 1635 left: e.left - n.left - o.marginLeft, 1636 top: e.top - n.top - o.marginTop, 1637 right: n.right - e.right - o.marginRight, 1638 bottom: n.bottom - e.bottom - o.marginBottom 1639 }; 1640 return r 1641 }, l.handleEvent = n.handleEvent, l.bindResize = function () { 1642 t.addEventListener("resize", this), this.isResizeBound = !0 1643 }, l.unbindResize = function () { 1644 t.removeEventListener("resize", this), this.isResizeBound = !1 1645 }, l.onresize = function () { 1646 this.resize() 1647 }, n.debounceMethod(r, "onresize", 100), l.resize = function () { 1648 this.isResizeBound && this.needsResizeLayout() && this.layout() 1649 }, l.needsResizeLayout = function () { 1650 var t = i(this.element), e = this.size && t; 1651 return e && t.innerWidth !== this.size.innerWidth 1652 }, l.addItems = function (t) { 1653 var e = this._itemize(t); 1654 return e.length && (this.items = this.items.concat(e)), e 1655 }, l.appended = function (t) { 1656 var e = this.addItems(t); 1657 e.length && (this.layoutItems(e, !0), this.reveal(e)) 1658 }, l.prepended = function (t) { 1659 var e = this._itemize(t); 1660 if (e.length) { 1661 var i = this.items.slice(0); 1662 this.items = e.concat(i), this._resetLayout(), this._manageStamps(), this.layoutItems(e, !0), this.reveal(e), this.layoutItems(i) 1663 } 1664 }, l.reveal = function (t) { 1665 this._emitCompleteOnItems("reveal", t), t && t.length && t.forEach(function (t) { 1666 t.reveal() 1667 }) 1668 }, l.hide = function (t) { 1669 this._emitCompleteOnItems("hide", t), t && t.length && t.forEach(function (t) { 1670 t.hide() 1671 }) 1672 }, l.revealItemElements = function (t) { 1673 var e = this.getItems(t); 1674 this.reveal(e) 1675 }, l.hideItemElements = function (t) { 1676 var e = this.getItems(t); 1677 this.hide(e) 1678 }, l.getItem = function (t) { 1679 for (var e = 0; e < this.items.length; e++) { 1680 var i = this.items[e]; 1681 if (i.element == t)return i 1682 } 1683 }, l.getItems = function (t) { 1684 t = n.makeArray(t); 1685 var e = []; 1686 return t.forEach(function (t) { 1687 var i = this.getItem(t); 1688 i && e.push(i) 1689 }, this), e 1690 }, l.remove = function (t) { 1691 var e = this.getItems(t); 1692 this._emitCompleteOnItems("remove", e), e && e.length && e.forEach(function (t) { 1693 t.remove(), n.removeFrom(this.items, t) 1694 }, this) 1695 }, l.destroy = function () { 1696 var t = this.element.style; 1697 t.height = "", t.position = "", t.width = "", this.items.forEac
1697h(function (t) { 1698 t.destroy() 1699 }), this.unbindResize(); 1700 var e = this.element.outlayerGUID; 1701 delete c[e], delete this.element.outlayerGUID, h && h.removeData(this.element, this.constructor.namespace) 1702 }, r.data = function (t) { 1703 t = n.getQueryElement(t); 1704 var e = t && t.outlayerGUID; 1705 return e && c[e] 1706 }, r.create = function (t, e) { 1707 var i = s(r); 1708 return i.defaults = n.extend({}, r.defaults), n.extend(i.defaults, e), i.compatOptions = n.extend({}, r.compatOptions), i.namespace = t, i.data = r.data, i.Item = s(o), n.htmlInit(i, t), h && h.bridget && h.bridget(t, i), i 1709 }, r.Item = o, r 1710}), function (t, e) { 1711 "function" == typeof define && define.amd ? define(["outlayer/outlayer", "get-size/get-size"], e) : "object" == typeof module && module.exports ? module.exports = e(require("outlayer"), require("get-size")) : t.Masonry = e(t.Outlayer, t.getSize) 1712}(window, function (t, e) { 1713 var i = t.create("masonry"); 1714 return i.compatOptions.fitWidth = "isFitWidth", i.prototype._resetLayout = function () {
1715 this.getSize(), this._getMeasurement("columnWidth", "outerWidth"), this._getMeasurement("gutter", "outerWidth"), this.measureColumns(), this.colYs = []; 1716 for (var t = 0; t < this.cols; t++)this.colYs.push(0); 1717 this.maxY = 0 1718 }, i.prototype.measureColumns = function () { 1719 if (this.getContainerWidth(), !this.columnWidth) { 1720 var t = this.items[0], i = t && t.element; 1721 this.columnWidth = i && e(i).outerWidth || this.containerWidth 1722 } 1723 var n = this.columnWidth += this.gutter, o = this.containerWidth + this.gutter, r = o / n, s = n - o % n, 1724 a = s && 1 > s ? "round" : "floor"; 1725 r = Math[a](r), this.cols = Math.max(r, 1) 1726 }, i.prototype.getContainerWidth = function () { 1727 var t = this._getOption("fitWidth"), i = t ? this.element.parentNode : this.element, n = e(i); 1728 this.containerWidth = n && n.innerWidth 1729 }, i.prototype._getItemLayoutPosition = function (t) { 1730 t.getSize(); 1731 var e = t.size.outerWidth % this.columnWidth, i = e && 1 > e ? "round" : "ceil", 1732 n = Math[i](t.size.outerWidth / this.columnWidth); 1733 n = Math.min(n, this.cols); 1734 for (var o = this._getColGroup(n), r = Math.min.apply(Math, o), s = o.indexOf(r), a = { 1735 x: this.columnWidth * s, 1736 y: r 1737 }, h = r + t.size.outerHeight, u = this.cols + 1 - o.length, d = 0; u > d; d++)this.colYs[s + d] = h; 1738 return a 1739 }, i.prototype._getColGroup = function (t) { 1740 if (2 > t)return this.colYs; 1741 for (var e = [], i = this.cols + 1 - t, n = 0; i > n; n++) { 1742 var o = this.colYs.slice(n, n + t); 1743 e[n] = Math.max.apply(Math, o) 1744 } 1745 return e 1746 }, i.prototype._manageStamp = function (t) { 1747 var i = e(t), n = this._getElementOffset(t), o = this._getOption("originLeft"), r = o ? n.left : n.right, 1748 s = r + i.outerWidth, a = Math.floor(r / this.columnWidth); 1749 a = Math.max(0, a); 1750 var h = Math.floor(s / this.columnWidth); 1751 h -= s % this.columnWidth ? 0 : 1, h = Math.min(this.cols - 1, h); 1752 for (var u = this._getOption("originTop"), d = (u ? n.top : n.bottom) + i.outerHeight, c = a; h >= c; c++)this.colYs[c] = Math.max(d, this.colYs[c]) 1753 }, i.prototype._getContainerSize = function () { 1754 this.maxY = Math.max.apply(Math, this.colYs); 1755 var t = {height: this.maxY}; 1756 return this._getOption("fitWidth") && (t.width = this._getContainerFitWidth()), t 1757 }, i.prototype._getContainerFitWidth = function () { 1758 for (var t = 0, e = this.cols; --e && 0 === this.colYs[e];)t++; 1759 return (this.cols - t) * this.columnWidth - this.gutter 1760 }, i.prototype.needsResizeLayout = function () { 1761 var t = this.containerWidth; 1762 return this.getContainerWidth(), t != this.containerWidth 1763 }, i 1764}); 1765 1766 1767/* 1768 PDFObject v2.0.20160414 1769 https://github.com/pipwerks/PDFObject 1770 Copyright (c) 2008-2016 Philip Hutchison 1771 MIT-style license: http://pipwerks.mit-license.org/ 1772 UMD module pattern from https://github.com/umdjs/umd/blob/master/templates/returnExports.js 1773 */ 1774(function (root, factory) { 1775 if (typeof define === "function" && define.amd) { 1776 define([], factory) 1777 } else if (typeof module === "object" && module.exports) { 1778 module.exports = factory() 1779 } else { 1780 root.PDFObject = factory() 1781 } 1782})(this, function () { 1783 return function () { 1784 "use strict"; 1785 var pdfobjectversion = "2.0.20160414", supportsPDFs, createAXO, isIE, 1786 supportsPdfMimeType = typeof navigator.mimeTypes["application/pdf"] !== "undefined", supportsPdfActiveX, 1787 buildQueryString, log, embedError, embed, getTargetElement, generatePDFJSiframe, isIOS = function () { 1788 return /iphone|ipad|ipod/i.test(navigator.userAgent.toLowerCase()) 1789 }(), generateEmbedElement; 1790 createAXO = function (type) { 1791 var ax; 1792 try { 1793 ax = new ActiveXObject(type) 1794 } catch (e) { 1795 ax = null 1796 } 1797 return ax 1798 }; 1799 isIE = function () { 1800 return !!(window.ActiveXObject || "ActiveXObject" in window) 1801 }; 1802 supportsPdfActiveX = function () { 1803 return !!(createAXO("AcroPDF.PDF") || createAXO("PDF.PdfCtrl")) 1804 }; 1805 supportsPDFs = supportsPdfMimeType || isIE() && supportsPdfActiveX();
1806 buildQueryString = function (pdfParams) { 1807 var string = "", prop; 1808 if (pdfParams) { 1809 for (prop in pdfParams) { 1810 if (pdfParams.hasOwnProperty(prop)) { 1811 string += encodeURIComponent(prop) + "=" + encodeURIComponent(pdfParams[prop]) + "&" 1812 } 1813 } 1814 if (string) { 1815 string = "#" + string; 1816 string = string.slice(0, string.length - 1) 1817 } 1818 } 1819 return string 1820 }; 1821 log = function (msg) { 1822 if (typeof console !== "undefined" && console.log) { 1823 console.log("[PDFObject] " + msg) 1824 } 1825 }; 1826 embedError = function (msg) { 1827 log(msg); 1828 return false 1829 }; 1830 getTargetElement = function (targetSelector) { 1831 var targetNode = document.body; 1832 if (typeof targetSelector === "string") { 1833 targetNode = document.querySelector(targetSelector) 1834 } else if (typeof jQuery !== "undefined" && targetSelector instanceof jQuery && targetSelector.length) { 1835 targetNode = targetSelector.get(0) 1836 } else if (typeof targetSelector.nodeType !== "undefined" && targetSelector.nodeType === 1) { 1837 targetNode = targetSelector 1838 } 1839 return targetNode 1840 }; 1841 generatePDFJSiframe = function (targetNode, url, PDFJS_URL, id) { 1842 var querystring = PDFJS_URL + "?file=" + url; 1843 var scrollfix = isIOS ? "-webkit-overflow-scrolling: touch; overflow-y: scroll; " : "overflow: hidden; "; 1844 var iframe = "<div style='" + scrollfix + "position: absolute; top: 0; right: 0; bottom: 0; left: 0;'><iframe " + id + " src='" + querystring + "' style='border: none; width: 100%; height: 100%;' frameborder='0'></iframe></div>"; 1845 targetNode.className += " pdfobject-container"; 1846 targetNode.style.position = "relative"; 1847 targetNode.style.overflow = "auto"; 1848 targetNode.innerHTML = iframe; 1849 return targetNode.getElementsByTagName("iframe")[0] 1850 }; 1851 generateEmbedElement = function (targetNode, targetSelector, url, width, height, id) { 1852 var style = ""; 1853 if (targetSelector && targetSelector !== document.body) { 1854 style = "width: " + width + "; height: " + height + ";" 1855 } else { 1856 style = "position: absolute; top: 0; right: 0; bottom: 0; left: 0; width: 100%; height: 100%;" 1857 } 1858 targetNode.className += " pdfobject-container"; 1859 targetNode.innerHTML = "<embed " + id + " class='pdfobject' src='" + url + "' type='application/pdf' style='overflow: auto; " + style + "'/>"; 1860 return targetNode.getElementsByTagName("embed")[0] 1861 }; 1862 embed = function (url, targetSelector, options) { 1863 if (typeof url !== "string") { 1864 return embedError("URL is not valid") 1865 } 1866 targetSelector = typeof targetSelector !== "undefined" ? targetSelector : false; 1867 options = typeof options !== "undefined" ? options : {}; 1868 var id = options.id && typeof options.id === "string" ? "id='" + options.id + "'" : "", 1869 page = options.page ? options.page : false, 1870 pdfOpenParams = options.pdfOpenParams ? options.pdfOpenParams : {}, 1871 fallbackLink = typeof options.fallbackLink !== "undefined" ? options.fallbackLink : true, 1872 width = options.width ? options.width : "100%", height = options.height ? options.height : "100%", 1873 forcePDFJS = typeof options.forcePDFJS === "boolean" ? options.forcePDFJS : false, 1874 PDFJS_URL = options.PDFJS_URL ? options.PDFJS_URL : false, 1875 targetNode = getTargetElement(targetSelector), fallbackHTML = "", 1876 fallbackHTML_default = "<p>This browser does not support inline PDFs. Please download the PDF to view it: <a href='[url]'>Download PDF</a></p>"; 1877 if (!targetNode) { 1878 return embedError("Target element cannot be determined") 1879 } 1880 if (page) { 1881 pdfOpenParams.page = page 1882 } 1883 url = encodeURI(url) + buildQueryString(pdfOpenParams); 1884 if (forcePDFJS && PDFJS_URL) { 1885 return generatePDFJSiframe(targetNode, url, PDFJS_URL, id) 1886 } else if (supportsPDFs) { 1887 return generateEmbedElement(targetNode, targetSelector, url, width, height, id) 1888 } else { 1889 if (PDFJS_URL) { 1890 return generatePDFJSiframe(targetNode, url, PDFJS_URL, id) 1891 } else if (fallbackLink) { 1892 fallbackHTML = typeof fallbackLink === "string" ? fallbackLink : fallbackHTML_default; 1893 targetNode.innerHTML = fallbackHTML.replace(/\[url\]/g, url) 1894 } 1895 return embedError("This browser does not support embedded PDFs") 1896 } 1897 }; 1898 return { 1899 embed: function (a, b, c) { 1900 return embed(a, b, c) 1901 }, pdfobjectversion: function () { 1902 return pdfobjectversion 1903 }(), supportsPDFs: function () { 1904 return supportsPDFs 1905 }() 1906 } 1907 }() 1908}); 1909 1910 1911/* 1912 * jQuery-Simple-Timer 1913 * 1914 * Creates a countdown timer. 1915 * 1916 * Example: 1917 * $('.timer').startTimer(); 1918 * 1919 */ 1920 1921(function (factory) { 1922 // Using as a CommonJS module 1923 if (typeof module === "object" && typeof module.exports === "object") { 1924 // jQuery must be provided as argument when used 1925 // as a CommonJS module. 1926 // 1927 // For example: 1928 // let $ = require("jquery"); 1929 // require("jquery-simple-timer")($); 1930 module.exports = function (jq) { 1931 factory(jq, window, document); 1932 } 1933 } else { 1934 // Using as script tag 1935 // 1936 // For example: 1937 // <script src="jquery.simple.timer.js"></script> 1938 factory(jQuery, window, document); 1939 } 1940}(function ($, window, document, undefined) { 1941 1942 var timer; 1943 var _options = {}; 1944 1945 var Timer = function (targetElement) { 1946 this.targetElement = targetElement; 1947 return this; 1948 }; 1949 1950 Timer.start = function (userOptions, targetElement) { 1951 timer = new Timer(targetElement); 1952 mergeOptions(userOptions); 1953 return timer.start(userOptions); 1954 }; 1955 1956 // Writes to `_options` object so that other 1957 // functions can access it without having to 1958 // pass this object as argument multiple times. 1959 function mergeOptions(opts) { 1960 opts = opts || {}; 1961 var classNames = opts.classNames || {}; 1962 1963 _options.classNameSeconds = classNames.seconds || 'jst-seconds' 1964 , _options.classNameMinutes = classNames.minutes || 'jst-minutes' 1965 , _options.classNameHours = classNames.hours || 'jst-hours' 1966 , _options.classNameClearDiv = classNames.clearDiv || 'jst-clearDiv' 1967 , _options.classNameTimeout = classNames.timeout || 'jst-timeout'; 1968 } 1969 1970 Timer.prototype.start = function (options) { 1971 1972 var createSubDivs = function (timerBoxElement) { 1973 var seconds = document.createElement('div'); 1974 seconds.className = _options.classNameSeconds; 1975 1976 var minutes = document.createElement('div'); 1977 minutes.className = _options.classNameMinutes; 1978 1979 var hours = document.createElement('div'); 1980 hours.className = _options.classNameHours; 1981 1982 var clearDiv = document.createElement('div'); 1983 clearDiv.className = _options.classNameClearDiv; 1984
1985 return timerBoxElement.append(hours).append(minutes).append(seconds).append(clearDiv); 1986 }; 1987 1988 this.targetElement.each(function (_index, timerBox) { 1989 var that = this; 1990 var timerBoxElement = $(timerBox); 1991 var cssClassSnapshot = timerBoxElement.attr('class'); 1992 1993 timerBoxElement.on('complete', function () { 1994 clearInterval(timerBoxElement.intervalId); 1995 }); 1996 1997 timerBoxElement.on('complete', function () { 1998 timerBoxElement.onComplete(timerBoxElement); 1999 }); 2000 2001 timerBoxElement.on('complete', function () { 2002 timerBoxElement.addClass(_options.classNameTimeout); 2003 }); 2004 2005 timerBoxElement.on('complete', function () { 2006 if (options && options.loop === true) { 2007 timer.resetTimer(timerBoxElement, options, cssClassSnapshot); 2008 } 2009 }); 2010 2011 timerBoxElement.on('pause', function () { 2012 clearInterval(timerBoxElement.intervalId); 2013 timerBoxElement.paused = true; 2014 }); 2015 2016 timerBoxElement.on('resume', function () { 2017 timerBoxElement.paused = false; 2018 that.startCountdown(timerBoxElement, {secondsLeft: timerBoxElement.data('timeLeft')}); 2019 }); 2020 2021 createSubDivs(timerBoxElement); 2022 return this.startCountdown(timerBoxElement, options); 2023 }.bind(this)); 2024 }; 2025 2026 /** 2027 * Resets timer and add css class 'loop' to indicate the timer is in a loop. 2028 * $timerBox {jQuery object} - The timer element 2029 * options {object} - The options for the timer 2030 * css - The original css of the element 2031 */ 2032 Timer.prototype.resetTimer = function ($timerBox, options, css) { 2033 var interval = 0; 2034 if (options.loopInterval) { 2035 interval = parseInt(options.loopInterval, 10) * 1000; 2036 } 2037 setTimeout(function () { 2038 $timerBox.trigger('reset'); 2039 $timerBox.attr('class', css + ' loop'); 2040 timer.startCountdown($timerBox, options); 2041 }, interval); 2042 } 2043 2044 Timer.prototype.fetchSecondsLeft = function (element) { 2045 var secondsLeft = element.data('seconds-left'); 2046 var minutesLeft = element.data('minutes-left'); 2047 2048 if (Number.isFinite(secondsLeft)) { 2049 return parseInt(secondsLeft, 10); 2050 } else if (Number.isFinite(minutesLeft)) { 2051 return parseFloat(minutesLeft) * 60; 2052 } else { 2053 throw 'Missing time data'; 2054 } 2055 }; 2056 2057 Timer.prototype.startCountdown = function (element, options) { 2058 options = options || {}; 2059 2060 var intervalId = null; 2061 var defaultComplete = function () { 2062 clearInterval(intervalId); 2063 return this.clearTimer(element); 2064 }.bind(this); 2065 2066 element.onComplete = options.onComplete || defaultComplete; 2067 element.allowPause = options.allowPause || false; 2068 if (element.allowPause) { 2069 element.on('click', function () { 2070 if (element.paused) { 2071 element.trigger('resume'); 2072 } else { 2073 element.trigger('pause'); 2074 } 2075 }); 2076 } 2077 2078 var secondsLeft = options.secondsLeft || this.fetchSecondsLeft(element); 2079 2080 var refreshRate = options.refreshRate || 1000; 2081 var endTime = secondsLeft + this.currentTime(); 2082 var timeLeft = endTime - this.currentTime(); 2083 2084 this.setFinalValue(this.formatTimeLeft(timeLeft), element); 2085 2086 intervalId = setInterval((function () { 2087 timeLeft = endTime - this.currentTime(); 2088 // When timer has been idle and only resumed past timeout, 2089 // then we immediatelly complete the timer. 2090 if (timeLeft < 0) { 2091 timeLeft = 0; 2092 } 2093 element.data('timeLeft', timeLeft); 2094 this.setFinalValue(this.formatTimeLeft(timeLeft), element); 2095 }.bind(this)), refreshRate); 2096 2097 element.intervalId = intervalId; 2098 }; 2099 2100 Timer.prototype.clearTimer = function (element) { 2101 element.find('.jst-seconds').text('00'); 2102 element.find('.jst-minutes').text('00:'); 2103 element.find('.jst-hours').text('00:'); 2104 }; 2105 2106 Timer.prototype.currentTime = function () { 2107 return Math.round((new Date()).getTime() / 1000); 2108 }; 2109 2110 Timer.prototype.formatTimeLeft = function (timeLeft) { 2111 2112 var lpad = function (n, width) { 2113 width = width || 2; 2114 n = n + ''; 2115 2116 var padded = null; 2117 2118 if (n.length >= width) { 2119 padded = n; 2120 } else { 2121 padded = Array(width - n.length + 1).join(0) + n; 2122 } 2123 2124 return padded; 2125 }; 2126 2127 var hours = Math.floor(timeLeft / 3600); 2128 timeLeft -= hours * 3600; 2129 2130 var minutes = Math.floor(timeLeft / 60); 2131 timeLeft -= minutes * 60; 2132 2133 var seconds = parseInt(timeLeft % 60, 10); 2134 2135 if (+hours === 0 && +minutes === 0 && +seconds === 0) { 2136 return []; 2137 } else { 2138 return [lpad(hours), lpad(minutes), lpad(seconds)]; 2139 } 2140 }; 2141 2142 Timer.prototype.setFinalValue = function (finalValues, element) { 2143 2144 if (finalValues.length === 0) { 2145 this.clearTimer(element); 2146 element.trigger('complete'); 2147 return false;
2148 } 2149 2150 element.find('.' + _options.classNameSeconds).text(finalValues.pop()); 2151 element.find('.' + _options.classNameMinutes).text(finalValues.pop() + ':'); 2152 element.find('.' + _options.classNameHours).text(finalValues.pop() + ':'); 2153 }; 2154 2155 2156 $.fn.startTimer = function (options) { 2157 this.TimerObject = Timer; 2158 Timer.start(options, this); 2159 return this; 2160 }; 2161 2162})); 2163 2164 2165/** 2166 * @preserve jQuery DateTimePicker plugin v2.4.5 2167 * @homepage http://xdsoft.net/jqplugins/datetimepicker/ 2168 * (c) 2014, Chupurnov Valeriy. 2169 */ 2170/*global document,window,jQuery,setTimeout,clearTimeout,HighlightedDate,getCurrentValue*/ 2171(function ($) { 2172 'use strict'; 2173 var default_options = { 2174 i18n: { 2175 ar: { // Arabic 2176 months: [ 2177 "ÙØ§ÙÙÙ Ø§ÙØ«Ø§ÙÙ", "شباط", "آذار", "ÙÙØ³Ø§Ù", "٠اÙÙ", "ØØ²ÙراÙ", "ØªÙ ÙØ²", "آب", "Ø£ÙÙÙÙ", "تشرÙÙ Ø§ÙØ£ÙÙ", "تشرÙÙ Ø§ÙØ«Ø§ÙÙ", "ÙØ§ÙÙÙ Ø§ÙØ£ÙÙ" 2178 ], 2179 dayOfWeek: [ 2180 "Ù", "Ø«", "ع", "Ø®", "ج", "س", "Ø" 2181 ] 2182 }, 2183 ro: { // Romanian 2184 months: [ 2185 "ianuarie", "februarie", "martie", "aprilie", "mai", "iunie", "iulie", "august", "septembrie", "octombrie", "noiembrie", "decembrie" 2186 ], 2187 dayOfWeek: [ 2188 "l", "ma", "mi", "j", "v", "s", "d" 2189 ] 2190 }, 2191 id: { // Indonesian 2192 months: [ 2193 "Januari", "Februari", "Maret", "April", "Mei", "Juni", "Juli", "Agustus", "September", "Oktober", "November", "Desember" 2194 ], 2195 dayOfWeek: [ 2196 "Min", "Sen", "Sel", "Rab", "Kam", "Jum", "Sab" 2197 ] 2198 }, 2199 is: { // Icelandic 2200 months: [ 2201 "Janúar", "Febrúar", "Mars", "AprÃl", "MaÃ", "JúnÃ", "JúlÃ", "Ãgúst", "September", "Október", "Nóvember", "Desember" 2202 ], 2203 dayOfWeek: [ 2204 "Sun", "Mán", "Ãrið", "Mið", "Fim", "Fös", "Lau" 2205 ] 2206 }, 2207 bg: { // Bulgarian 2208 months: [ 2209 "ЯнÑаÑи", "ФевÑÑаÑи", "ÐаÑÑ", "ÐпÑил", "Ðай", "Юни", "Юли", "ÐвгÑÑÑ", "СепÑемвÑи", "ÐкÑомвÑи", "ÐоемвÑи", "ÐекемвÑи" 2210 ], 2211 dayOfWeek: [ 2212 "Ðд", "Ðн", "ÐÑ", "СÑ", "ЧÑ", "ÐÑ", "Сб" 2213 ] 2214 }, 2215 fa: { // Persian/Farsi 2216 months: [ 2217 'ÙØ±ÙردÛÙ', 'Ø§Ø±Ø¯ÛØ¨Ùشت', 'خرداد', 'ØªÛØ±', '٠رداد', 'Ø´ÙØ±ÛÙØ±', 'Ù ÙØ±', 'آباÙ', 'آذر', 'دÛ', 'بÙÙ Ù', 'اسÙÙØ¯' 2218 ], 2219 dayOfWeek: [ 2220 'ÛÚ©Ø´ÙØ¨Ù', 'Ø¯ÙØ´ÙبÙ', 'Ø³Ù Ø´ÙØ¨Ù', 'ÚÙØ§Ø±Ø´ÙبÙ', 'Ù¾ÙØ¬Ø´ÙبÙ', 'ج٠عÙ', 'Ø´ÙØ¨Ù' 2221 ] 2222 }, 2223 ru: { // Russian 2224 months: [ 2225 'ЯнваÑÑ', 'ФевÑалÑ', 'ÐаÑÑ', 'ÐпÑелÑ', 'Ðай', 'ÐÑнÑ', 'ÐÑлÑ', 'ÐвгÑÑÑ', 'СенÑÑбÑÑ', 'ÐкÑÑбÑÑ', 'ÐоÑбÑÑ', 'ÐекабÑÑ' 2226 ], 2227 dayOfWeek: [ 2228 "ÐÑк", "Ðн", "ÐÑ", "СÑ", "ЧÑ", "ÐÑ", "Сб" 2229 ] 2230 }, 2231 uk: { // Ukrainian 2232 months: [ 2233 'СÑÑенÑ', 'ÐÑÑий', 'ÐеÑезенÑ', 'ÐвÑÑенÑ', 'ТÑавенÑ', 'ЧеÑвенÑ', 'ÐипенÑ', 'СеÑпенÑ', 'ÐеÑеÑенÑ', 'ÐовÑенÑ', 'ÐиÑÑопад', 'ÐÑÑденÑ' 2234 ], 2235 dayOfWeek: [ 2236 "Ðдл", "Ðнд", "ÐÑÑ", "СÑд", "ЧÑв", "ÐÑн", "СбÑ" 2237 ] 2238 }, 2239 en: { // English 2240 months: [ 2241 "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "
2241November", "December" 2242 ], 2243 dayOfWeek: [ 2244 "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" 2245 ] 2246 }, 2247 el: { // Îλληνικά 2248 months: [ 2249 "ÎÎ±Î½Î¿Ï Î¬ÏιοÏ", "ΦεβÏÎ¿Ï Î¬ÏιοÏ", "ÎάÏÏιοÏ", "ÎÏÏίλιοÏ", "ÎάιοÏ", "ÎοÏνιοÏ", "ÎοÏλιοÏ", "ÎÏÎ³Î¿Ï ÏÏοÏ", "ΣεÏÏÎμβÏιοÏ", "ÎκÏÏβÏιοÏ", "ÎοÎμβÏιοÏ", "ÎεκÎμβÏιοÏ" 2250 ], 2251 dayOfWeek: [ 2252 "ÎÏ Ï", "ÎÎµÏ ", "ΤÏι", "ΤεÏ", "Πεμ", "ΠαÏ", "Σαβ" 2253 ] 2254 }, 2255 de: { // German 2256 months: [ 2257 'Januar', 'Februar', 'März', 'April', 'Mai', 'Juni', 'Juli', 'August', 'September', 'Oktober', 'November', 'Dezember' 2258 ], 2259 dayOfWeek: [ 2260 "So", "Mo", "Di", "Mi", "Do", "Fr", "Sa" 2261 ] 2262 }, 2263 nl: { // Dutch 2264 months: [ 2265 "januari", "februari", "maart", "april", "mei", "juni", "juli", "augustus", "september", "oktober", "november", "december" 2266 ], 2267 dayOfWeek: [ 2268 "zo", "ma", "di", "wo", "do", "vr", "za" 2269 ] 2270 }, 2271 tr: { // Turkish 2272 months: [ 2273 "Ocak", "Åubat", "Mart", "Nisan", "Mayıs", "Haziran", "Temmuz", "AÄustos", "Eylül", "Ekim", "Kasım", "Aralık" 2274 ], 2275 dayOfWeek: [ 2276 "Paz", "Pts", "Sal", "Ãar", "Per", "Cum", "Cts" 2277 ] 2278 }, 2279 fr: { //French 2280 months: [ 2281 "Janvier", "Février", "Mars", "Avril", "Mai", "Juin", "Juillet", "Août", "Septembre", "Octobre", "Novembre", "Décembre" 2282 ], 2283 dayOfWeek: [ 2284 "Dim", "Lun", "Mar", "Mer", "Jeu", "Ven", "Sam" 2285 ] 2286 }, 2287 es: { // Spanish 2288 months: [ 2289 "Enero", "Febrero", "Marzo", "Abril", "Mayo", "Junio", "Julio", "Agosto", "Septiembre", "Octubre", "Noviembre", "Diciembre" 2290 ], 2291 dayOfWeek: [ 2292 "Dom", "Lun", "Mar", "Mié", "Jue", "Vie", "Sáb" 2293 ] 2294 }, 2295 th: { // Thai 2296 months: [ 2297 'มà¸à¸£à¸²à¸à¸¡', 'à¸à¸¸à¸¡à¸ าà¸à¸±à¸à¸à¹', 'มีà¸à¸²à¸à¸¡', 'à¹à¸¡à¸©à¸²à¸¢à¸', 'à¸à¸¤à¸©à¸ าà¸à¸¡', 'มิà¸à¸¸à¸à¸²à¸¢à¸', 'à¸à¸£à¸à¸à¸²à¸à¸¡', 'สิà¸à¸«à¸²à¸à¸¡', 'à¸à¸±à¸à¸¢à¸²à¸¢à¸', 'à¸à¸¸à¸¥à¸²à¸à¸¡', 'à¸à¸¤à¸¨à¸à¸´à¸à¸²à¸¢à¸', 'à¸à¸±à¸à¸§à¸²à¸à¸¡' 2298 ], 2299 dayOfWeek: [ 2300 'à¸à¸².', 'à¸.', 'à¸.', 'à¸.', 'à¸à¸¤.', 'ศ.', 'ส.' 2301 ] 2302 }, 2303 pl: { // Polish 2304 months: [ 2305 "styczeÅ", "luty", "marzec", "kwiecieÅ", "maj", "czerwiec", "lipiec", "sierpieÅ", "wrzesieÅ", "październik", "listopad", "grudzieÅ" 2306 ], 2307 dayOfWeek: [ 2308 "nd", "pn", "wt", "År", "cz", "pt", "sb" 2309 ] 2310 }, 2311 pt: { // Portuguese 2312 months: [ 2313 "Janeiro", "Fevereiro", "Março", "Abril", "Maio", "Junho", "Julho", "Agosto", "Setembro", "Outubro", "Novembro", "Dezembro" 2314 ], 2315 dayOfWeek: [ 2316 "Dom", "Seg", "Ter", "Qua", "Qui", "Sex", "Sab" 2317 ] 2318 }, 2319 ch: { // Simplified Chinese 2320 months: [ 2321 "䏿", "äºæ", "䏿", "åæ", "äºæ", "å æ", "䏿", "å «æ", "乿", "åæ", "å䏿", "åäºæ" 2322 ], 2323 dayOfWeek: [ 2324 "æ¥", "ä¸", "äº", "ä¸", "å", "äº", "å " 2325 ] 2326 }, 2327 se: { // Swedish 2328 months: [ 2329 "Januari", "Februari", "Mars", "April", "Maj", "Juni", "Juli", "Augusti", "September", "Oktober", "
2329November", "December" 2330 ], 2331 dayOfWeek: [ 2332 "Sön", "MÃ¥n", "Tis", "Ons", "Tor", "Fre", "Lör" 2333 ] 2334 }, 2335 kr: { // Korean 2336 months: [ 2337 "1ì", "2ì", "3ì", "4ì", "5ì", "6ì", "7ì", "8ì", "9ì", "10ì", "11ì", "12ì" 2338 ], 2339 dayOfWeek: [ 2340 "ì¼", "ì", "í", "ì", "목", "ê¸", "í " 2341 ] 2342 }, 2343 it: { // Italian 2344 months: [ 2345 "Gennaio", "Febbraio", "Marzo", "Aprile", "Maggio", "Giugno", "Luglio", "Agosto", "Settembre", "Ottobre", "Novembre", "Dicembre" 2346 ], 2347 dayOfWeek: [ 2348 "Dom", "Lun", "Mar", "Mer", "Gio", "Ven", "Sab" 2349 ] 2350 }, 2351 da: { // Dansk 2352 months: [ 2353 "January", "Februar", "Marts", "April", "Maj", "Juni", "July", "August", "September", "Oktober", "November", "December" 2354 ], 2355 dayOfWeek: [ 2356 "Søn", "Man", "Tir", "Ons", "Tor", "Fre", "Lør" 2357 ] 2358 }, 2359 no: { // Norwegian 2360 months: [ 2361 "Januar", "Februar", "Mars", "April", "Mai", "Juni", "Juli", "August", "September", "Oktober", "November", "Desember" 2362 ], 2363 dayOfWeek: [ 2364 "Søn", "Man", "Tir", "Ons", "Tor", "Fre", "Lør" 2365 ] 2366 }, 2367 ja: { // Japanese 2368 months: [ 2369 "1æ", "2æ", "3æ", "4æ", "5æ", "6æ", "7æ", "8æ", "9æ", "10æ", "11æ", "12æ" 2370 ], 2371 dayOfWeek: [ 2372 "æ¥", "æ", "ç«", "æ°´", "æ¨", "é", "å" 2373 ] 2374 }, 2375 vi: { // Vietnamese 2376 months: [ 2377 "Tháng 1", "Tháng 2", "Tháng 3", "Tháng 4", "Tháng 5", "Tháng 6", "Tháng 7", "Tháng 8", "Tháng 9", "Tháng 10", "Tháng 11", "Tháng 12" 2378 ], 2379 dayOfWeek: [ 2380 "CN", "T2", "T3", "T4", "T5", "T6", "T7" 2381 ] 2382 }, 2383 sl: { // SlovenÅ¡Äina 2384 months: [ 2385 "Januar", "Februar", "Marec", "April", "Maj", "Junij", "Julij", "Avgust", "September", "Oktober", "November", "December" 2386 ], 2387 dayOfWeek: [ 2388 "Ned", "Pon", "Tor", "Sre", "Äet", "Pet", "Sob" 2389 ] 2390 }, 2391 cs: { // ÄeÅ¡tina 2392 months: [ 2393 "Leden", "Ãnor", "BÅezen", "Duben", "KvÄten", "Äerven", "Äervenec", "Srpen", "ZáÅÃ", "ÅÃjen", "Listopad", "Prosinec" 2394 ], 2395 dayOfWeek: [ 2396 "Ne", "Po", "Ãt", "St", "Ät", "Pá", "So" 2397 ] 2398 }, 2399 hu: { // Hungarian 2400 months: [ 2401 "Január", "Február", "Március", "Ãprilis", "Május", "Június", "Július", "Augusztus", "Szeptember", "Október", "November", "December" 2402 ], 2403 dayOfWeek: [ 2404 "Va", "Hé", "Ke", "Sze", "Cs", "Pé", "Szo" 2405 ] 2406 }, 2407 az: { //Azerbaijanian (Azeri) 2408 months: [ 2409 "Yanvar", "Fevral", "Mart", "Aprel", "May", "Iyun", "Iyul", "Avqust", "Sentyabr", "Oktyabr", "Noyabr", "Dekabr" 2410 ], 2411 dayOfWeek: [ 2412 "B", "Be", "Ãa", "Ã", "Ca", "C", "Å" 2413 ] 2414 }, 2415 bs: { //Bosanski 2416 months: [ 2417 "Januar", "Februar", "Mart", "April", "Maj", "Jun", "Jul", "Avgust", "Septembar", "Oktobar", "Novembar", "Decembar" 2418 ], 2419 dayOfWeek: [ 2420 "Ned", "Pon", "Uto", "Sri", "Äet", "Pet", "Sub" 2421 ] 2422 }, 2423 ca: { //Català 2424 months: [ 2425 "Gener", "Febrer", "Març", "Abril", "Maig", "Juny", "Juliol", "Agost", "Setembre", "Octubre", "Novembre", "Desembre" 2426 ], 2427 dayOfWeek: [ 2428 "Dg", "Dl", "Dt", "Dc", "Dj", "Dv", "Ds" 2429 ] 2430 }, 2431 'en-GB': { //English (British) 2432 months: [ 2433 "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "
2433November", "December" 2434 ], 2435 dayOfWeek: [ 2436 "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" 2437 ] 2438 }, 2439 et: { //"Eesti" 2440 months: [ 2441 "Jaanuar", "Veebruar", "Märts", "Aprill", "Mai", "Juuni", "Juuli", "August", "September", "Oktoober", "November", "Detsember" 2442 ], 2443 dayOfWeek: [ 2444 "P", "E", "T", "K", "N", "R", "L" 2445 ] 2446 }, 2447 eu: { //Euskara 2448 months: [ 2449 "Urtarrila", "Otsaila", "Martxoa", "Apirila", "Maiatza", "Ekaina", "Uztaila", "Abuztua", "Iraila", "Urria", "Azaroa", "Abendua" 2450 ], 2451 dayOfWeek: [ 2452 "Ig.", "Al.", "Ar.", "Az.", "Og.", "Or.", "La." 2453 ] 2454 }, 2455 fi: { //Finnish (Suomi) 2456 months: [ 2457 "Tammikuu", "Helmikuu", "Maaliskuu", "Huhtikuu", "Toukokuu", "Kesäkuu", "Heinäkuu", "Elokuu", "Syyskuu", "Lokakuu", "Marraskuu", "Joulukuu" 2458 ], 2459 dayOfWeek: [ 2460 "Su", "Ma", "Ti", "Ke", "To", "Pe", "La" 2461 ] 2462 }, 2463 gl: { //Galego 2464 months: [ 2465 "Xan", "Feb", "Maz", "Abr", "Mai", "Xun", "Xul", "Ago", "Set", "Out", "Nov", "Dec" 2466 ], 2467 dayOfWeek: [ 2468 "Dom", "Lun", "Mar", "Mer", "Xov", "Ven", "Sab" 2469 ] 2470 }, 2471 hr: { //Hrvatski 2472 months: [ 2473 "SijeÄanj", "VeljaÄa", "Ožujak", "Travanj", "Svibanj", "Lipanj", "Srpanj", "Kolovoz", "Rujan", "Listopad", "Studeni", "Prosinac" 2474 ], 2475 dayOfWeek: [ 2476 "Ned", "Pon", "Uto", "Sri", "Äet", "Pet", "Sub" 2477 ] 2478 }, 2479 ko: { //Korean (íêµì´) 2480 months: [ 2481 "1ì", "2ì", "3ì", "4ì", "5ì", "6ì", "7ì", "8ì", "9ì", "10ì", "11ì", "12ì" 2482 ], 2483 dayOfWeek: [ 2484 "ì¼", "ì", "í", "ì", "목", "ê¸", "í " 2485 ] 2486 }, 2487 lt: { //Lithuanian (lietuvių) 2488 months: [ 2489 "Sausio", "Vasario", "Kovo", "Balandžio", "GegužÄs", "Birželio", "Liepos", "RugpjÅ«Äio", "RugsÄjo", "Spalio", "LapkriÄio", "Gruodžio" 2490 ], 2491 dayOfWeek: [ 2492 "Sek", "Pir", "Ant", "Tre", "Ket", "Pen", "Å eÅ¡" 2493 ] 2494 }, 2495 lv: { //Latvian (LatvieÅ¡u) 2496 months: [ 2497 "JanvÄris", "FebruÄris", "Marts", "AprÄ«lis ", "Maijs", "JÅ«nijs", "JÅ«lijs", "Augusts", "Septembris", "Oktobris", "Novembris", "Decembris" 2498 ], 2499 dayOfWeek: [ 2500 "Sv", "Pr", "Ot", "Tr", "Ct", "Pk", "St" 2501 ] 2502 }, 2503 mk: { //Macedonian (ÐакедонÑки) 2504 months: [ 2505 "ÑанÑаÑи", "ÑевÑÑаÑи", "маÑÑ", "апÑил", "маÑ", "ÑÑни", "ÑÑли", "авгÑÑÑ", "ÑепÑемвÑи", "окÑомвÑи", "ноемвÑи", "декемвÑи" 2506 ], 2507 dayOfWeek: [ 2508 "нед", "пон", "вÑо", "ÑÑе", "ÑеÑ", "пеÑ", "Ñаб" 2509 ] 2510 }, 2511 mn: { //Mongolian (Ðонгол) 2512 months: [ 2513 "1-Ñ ÑаÑ", "2-Ñ ÑаÑ", "3-Ñ ÑаÑ", "4-Ñ ÑаÑ", "5-Ñ ÑаÑ", "6-Ñ ÑаÑ", "7-Ñ ÑаÑ", "8-Ñ ÑаÑ", "9-Ñ ÑаÑ", "10-Ñ ÑаÑ", "11-Ñ ÑаÑ", "12-Ñ ÑаÑ" 2514 ], 2515 dayOfWeek: [ 2516 "Ðав", "ÐÑг", "ÐÑ Ð°", "ÐÒ¯Ñ", "ÐÑн", "ÐÑм", "ÐÑм" 2517 ] 2518 }, 2519 'pt-BR': { //Português(Brasil) 2520 months: [ 2521 "Janeiro", "Fevereiro", "Março", "Abril", "Maio", "Junho", "Julho", "Agosto", "Setembro", "Outubro", "Novembro", "Dezembro" 2522 ], 2523 dayOfWeek: [ 2524 "Dom", "Seg", "Ter", "Qua", "Qui", "Sex", "Sáb" 2525 ] 2526 }, 2527 sk: { //SlovenÄina 2528 months: [ 2529 "Január", "Február", "Marec", "AprÃl", "Máj", "Jún", "Júl", "August", "September", "Október", "
2529November", "December" 2530 ], 2531 dayOfWeek: [ 2532 "Ne", "Po", "Ut", "St", "Å t", "Pi", "So" 2533 ] 2534 }, 2535 sq: { //Albanian (Shqip) 2536 months: [ 2537 "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" 2538 ], 2539 dayOfWeek: [ 2540 "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" 2541 ] 2542 }, 2543 'sr-YU': { //Serbian (Srpski) 2544 months: [ 2545 "Januar", "Februar", "Mart", "April", "Maj", "Jun", "Jul", "Avgust", "Septembar", "Oktobar", "Novembar", "Decembar" 2546 ], 2547 dayOfWeek: [ 2548 "Ned", "Pon", "Uto", "Sre", "Äet", "Pet", "Sub" 2549 ] 2550 }, 2551 sr: { //Serbian Cyrillic (СÑпÑки) 2552 months: [ 2553 "ÑанÑаÑ", "ÑебÑÑаÑ", "маÑÑ", "апÑил", "маÑ", "ÑÑн", "ÑÑл", "авгÑÑÑ", "ÑепÑембаÑ", "окÑобаÑ", "новембаÑ", "деÑембаÑ" 2554 ], 2555 dayOfWeek: [ 2556 "нед", "пон", "ÑÑо", "ÑÑе", "ÑеÑ", "пеÑ", "ÑÑб" 2557 ] 2558 }, 2559 sv: { //Svenska 2560 months: [ 2561 "Januari", "Februari", "Mars", "April", "Maj", "Juni", "Juli", "Augusti", "September", "Oktober", "November", "December" 2562 ], 2563 dayOfWeek: [ 2564 "Sön", "MÃ¥n", "Tis", "Ons", "Tor", "Fre", "Lör" 2565 ] 2566 }, 2567 'zh-TW': { //Traditional Chinese (ç¹é«ä¸æ) 2568 months: [ 2569 "䏿", "äºæ", "䏿", "åæ", "äºæ", "å æ", "䏿", "å «æ", "乿", "åæ", "å䏿", "åäºæ" 2570 ], 2571 dayOfWeek: [ 2572 "æ¥", "ä¸", "äº", "ä¸", "å", "äº", "å " 2573 ] 2574 }, 2575 zh: { //Simplified Chinese (ç®ä½ä¸æ) 2576 months: [ 2577 "䏿", "äºæ", "䏿", "åæ", "äºæ", "å æ", "䏿", "å «æ", "乿", "åæ", "å䏿", "åäºæ" 2578 ], 2579 dayOfWeek: [ 2580 "æ¥", "ä¸", "äº", "ä¸", "å", "äº", "å " 2581 ] 2582 }, 2583 he: { //Hebrew (×¢×ר×ת) 2584 months: [ 2585 '×× ××ר', 'פ×ר××ר', '×רץ', '×פר××', '×××', '××× ×', '××××', '××××ס×', 'ספ×××ר', '×××§×××ר', '× ××××ר', '×צ××ר' 2586 ], 2587 dayOfWeek: [ 2588 '×\'', '×\'', '×\'', '×\'', '×\'', '×\'', 'ש×ת' 2589 ] 2590 }, 2591 hy: { // Armenian 2592 months: [ 2593 "ÕÕ¸ÖÕ¶Õ¾Õ¡Ö", "ÕÕ¥Õ¿ÖÕ¾Õ¡Ö", "ÕÕ¡ÖÕ¿", "Ô±ÕºÖÕ«Õ¬", "ÕÕ¡ÕµÕ«Õ½", "ÕÕ¸ÖÕ¶Õ«Õ½", "ÕÕ¸ÖÕ¬Õ«Õ½", "ÕÕ£Õ¸Õ½Õ¿Õ¸Õ½", "ÕÕ¥ÕºÕ¿Õ¥Õ´Õ¢Õ¥Ö", "ÕÕ¸Õ¯Õ¿Õ¥Õ´Õ¢Õ¥Ö", "ÕÕ¸ÕµÕ¥Õ´Õ¢Õ¥Ö", "Ô´Õ¥Õ¯Õ¿Õ¥Õ´Õ¢Õ¥Ö" 2594 ], 2595 dayOfWeek: [ 2596 "Ô¿Õ«", "ÔµÖÕ¯", "ÔµÖÖ", "ÕÕ¸Ö", "ÕÕ¶Õ£", "ÕÖÖÕ¢", "ÕÕ¢Õ©" 2597 ] 2598 }, 2599 kg: { // Kyrgyz 2600 months: [ 2601 'Ò®ÑÑүн айÑ', 'ÐиÑдин айÑ', 'Ðалган ÐÑÑан', 'ЧÑн ÐÑÑан', 'ÐÑгÑ', 'ÐÑлжа', 'Теке', 'ÐÐ°Ñ Ðона', 'ÐÑк Ðона', 'ТогÑздÑн айÑ', 'ÐеÑинин айÑ', 'ÐеÑÑин айÑ' 2602 ], 2603 dayOfWeek: [ 2604 "Ðек", "Ðүй", "Шей", "ШаÑ", "Ðей", "ÐÑм", "ÐÑе" 2605 ] 2606 } 2607 }, 2608 value: '', 2609 lang: 'en', 2610 2611 format: 'Y/m/d H:i', 2612 formatTime: 'H:i', 2613 formatDate: 'Y/m/d', 2614 2615 startDate: false, // new Date(), '1986/12/08', '-1970/01/05','-1970/01/05', 2616 step: 60, 2617 monthChangeSpinner: true, 2618 2619 closeOnDateSelect: false, 2620 closeOnTimeSelect: true, 2621 closeOnWithoutClick: true, 2622 closeOnInputClick: true, 2623 2624 timepicker: true, 2625 datepicker: true, 2626 weeks: false, 2627 2628 defaultTime: false, // use formatTime format (ex. '10:00' for formatTime: 'H:i') 2629 defaultDate: false, // use formatDate format (ex new Date() or '1986/12/08' or '-1970/01/05' or '-1970/01/05') 2630 2631 minDate: false, 2632 maxDate: false, 2633 minTime: false, 2634 maxTime: false, 2635 disabledMinTime: false, 2636 disabledMaxTime: false, 2637 2638 allowTimes: [], 2639 opened: false, 2640 initTime: true, 2641 inline: false, 2642 theme: '', 2643 2644 onSelectDate: function () { 2645 }, 2646 onSelectTime: function () { 2647 }, 2648 onChangeMonth: function () { 2649 }, 2650 onChangeYear: function () { 2651 }, 2652 onChangeDateTime: function () { 2653 }, 2654 onShow: function () { 2655 }, 2656 onClose: function () { 2657 }, 2658 onGenerate: function () { 2659 }, 2660 2661 withoutCopyright: true,
vendor: 9,533 bytes, lines 2662-2886
2662 inverseButton: false, 2663 hours12: false, 2664 next: 'xdsoft_next', 2665 prev: 'xdsoft_prev', 2666 dayOfWeekStart: 0, 2667 parentID: 'body', 2668 timeHeightInTimePicker: 25, 2669 timepickerScrollbar: true, 2670 todayButton: true, 2671 prevButton: true, 2672 nextButton: true, 2673 defaultSelect: true, 2674 2675 scrollMonth: true, 2676 scrollTime: true, 2677 scrollInput: true, 2678 2679 lazyInit: false, 2680 mask: false, 2681 validateOnBlur: true, 2682 allowBlank: true, 2683 yearStart: 1950, 2684 yearEnd: 2050, 2685 monthStart: 0, 2686 monthEnd: 11, 2687 style: '', 2688 id: '', 2689 fixed: false, 2690 roundTime: 'round', // ceil, floor 2691 className: '', 2692 weekends: [], 2693 highlightedDates: [], 2694 highlightedPeriods: [], 2695 disabledDates: [], 2696 disabledWeekDays: [], 2697 yearOffset: 0, 2698 beforeShowDay: null, 2699 2700 enterLikeTab: true, 2701 showApplyButton: false 2702 }; 2703 // fix for ie8 2704 if (!window.getComputedStyle) { 2705 window.getComputedStyle = function (el, pseudo) { 2706 this.el = el; 2707 this.getPropertyValue = function (prop) { 2708 var re = /(\-([a-z]){1})/g; 2709 if (prop === 'float') { 2710 prop = 'styleFloat'; 2711 } 2712 if (re.test(prop)) { 2713 prop = prop.replace(re, function (a, b, c) { 2714 return c.toUpperCase(); 2715 }); 2716 } 2717 return el.currentStyle[prop] || null; 2718 }; 2719 return this; 2720 }; 2721 } 2722 if (!Array.prototype.indexOf) { 2723 Array.prototype.indexOf = function (obj, start) { 2724 var i, j; 2725 for (i = (start || 0), j = this.length; i < j; i += 1) { 2726 if (this[i] === obj) { 2727 return i; 2728 } 2729 } 2730 return -1; 2731 }; 2732 } 2733 Date.prototype.countDaysInMonth = function () { 2734 return new Date(this.getFullYear(), this.getMonth() + 1, 0).getDate(); 2735 }; 2736 $.fn.xdsoftScroller = function (percent) { 2737 return this.each(function () { 2738 var timeboxparent = $(this), 2739 pointerEventToXY = function (e) { 2740 var out = {x: 0, y: 0}, 2741 touch; 2742 if (e.type === 'touchstart' || e.type === 'touchmove' || e.type === 'touchend' || e.type === 'touchcancel') { 2743 touch = e.originalEvent.touches[0] || e.originalEvent.changedTouches[0]; 2744 out.x = touch.clientX; 2745 out.y = touch.clientY; 2746 } else if (e.type === 'mousedown' || e.type === 'mouseup' || e.type === 'mousemove' || e.type === 'mouseover' || e.type === 'mouseout' || e.type === 'mouseenter' || e.type === 'mouseleave') { 2747 out.x = e.clientX; 2748 out.y = e.clientY; 2749 } 2750 return out; 2751 }, 2752 move = 0, 2753 timebox, 2754 parentHeight, 2755 height, 2756 scrollbar, 2757 scroller, 2758 maximumOffset = 100, 2759 start = false, 2760 startY = 0, 2761 startTop = 0, 2762 h1 = 0, 2763 touchStart = false, 2764 startTopScroll = 0, 2765 calcOffset = function () { 2766 }; 2767 if (percent === 'hide') { 2768 timeboxparent.find('.xdsoft_scrollbar').hide(); 2769 return; 2770 } 2771 if (!$(this).hasClass('xdsoft_scroller_box')) { 2772 timebox = timeboxparent.children().eq(0); 2773 parentHeight = timeboxparent[0].clientHeight; 2774 height = timebox[0].offsetHeight; 2775 scrollbar = $('<div class="xdsoft_scrollbar"></div>'); 2776 scroller = $('<div class="xdsoft_scroller"></div>'); 2777 scrollbar.append(scroller); 2778 2779 timeboxparent.addClass('xdsoft_scroller_box').append(scrollbar); 2780 calcOffset = function calcOffset(event) { 2781 var offset = pointerEventToXY(event).y - startY + startTopScroll; 2782 if (offset < 0) { 2783 offset = 0; 2784 } 2785 if (offset + scroller[0].offsetHeight > h1) { 2786 offset = h1 - scroller[0].offsetHeight; 2787 } 2788 timeboxparent.trigger('scroll_element.xdsoft_scroller', [maximumOffset ? offset / maximumOffset : 0]); 2789 }; 2790 2791 scroller 2792 .on('touchstart.xdsoft_scroller mousedown.xdsoft_scroller', function (event) { 2793 if (!parentHeight) { 2794 timeboxparent.trigger('resize_scroll.xdsoft_scroller', [percent]); 2795 } 2796 2797 startY = pointerEventToXY(event).y; 2798 startTopScroll = parseInt(scroller.css('margin-top'), 10); 2799 h1 = scrollbar[0].offsetHeight; 2800 2801 if (event.type === 'mousedown') { 2802 if (document) { 2803 $(document.body).addClass('xdsoft_noselect'); 2804 } 2805 $([document.body, window]).on('mouseup.xdsoft_scroller', function arguments_callee() { 2806 $([document.body, window]).off('mouseup.xdsoft_scroller', arguments_callee) 2807 .off('mousemove.xdsoft_scroller', calcOffset) 2808 .removeClass('xdsoft_noselect'); 2809 }); 2810 $(document.body).on('mousemove.xdsoft_scroller', calcOffset); 2811 } else { 2812 touchStart = true; 2813 event.stopPropagation(); 2814 event.preventDefault(); 2815 } 2816 }) 2817 .on('touchmove', function (event) { 2818 if (touchStart) { 2819 event.preventDefault(); 2820 calcOffset(event); 2821 } 2822 }) 2823 .on('touchend touchcancel', function (event) { 2824 touchStart = false; 2825 startTopScroll = 0; 2826 }); 2827 2828 timeboxparent 2829 .on('scroll_element.xdsoft_scroller', function (event, percentage) { 2830 if (!parentHeight) { 2831 timeboxparent.trigger('resize_scroll.xdsoft_scroller', [percentage, true]); 2832 } 2833 percentage = percentage > 1 ? 1 : (percentage < 0 || isNaN(percentage)) ? 0 : percentage; 2834 2835 scroller.css('margin-top', maximumOffset * percentage); 2836 2837 setTimeout(function () { 2838 timebox.css('marginTop', -parseInt((timebox[0].offsetHeight - parentHeight) * percentage, 10)); 2839 }, 10); 2840 }) 2841 .on('resize_scroll.xdsoft_scroller', function (event, percentage, noTriggerScroll) { 2842 var percent, sh; 2843 parentHeight = timeboxparent[0].clientHeight; 2844 height = timebox[0].offsetHeight; 2845 percent = parentHeight / height; 2846 sh = percent * scrollbar[0].offsetHeight; 2847 if (percent > 1) { 2848 scroller.hide(); 2849 } else { 2850 scroller.show(); 2851 scroller.css('height', parseInt(sh > 10 ? sh : 10, 10)); 2852 maximumOffset = scrollbar[0].offsetHeight - scroller[0].offsetHeight; 2853 if (noTriggerScroll !== true) { 2854 timeboxparent.trigger('scroll_element.xdsoft_scroller', [percentage || Math.abs(parseInt(timebox.css('marginTop'), 10)) / (height - parentHeight)]); 2855 } 2856 } 2857 }); 2858 2859 timeboxparent.on('mousewheel', function (event) { 2860 var top = Math.abs(parseInt(timebox.css('marginTop'), 10)); 2861 2862 top = top - (event.deltaY * 20); 2863 if (top < 0) { 2864 top = 0; 2865 } 2866 2867 timeboxparent.trigger('scroll_element.xdsoft_scroller', [top / (height - parentHeight)]); 2868 event.stopPropagation(); 2869 return false; 2870 }); 2871 2872 timeboxparent.on('touchstart', function (event) { 2873 start = pointerEventToXY(event); 2874 startTop = Math.abs(parseInt(timebox.css('marginTop'), 10)); 2875 }); 2876 2877 timeboxparent.on('touchmove', function (event) { 2878 if (start) { 2879 event.preventDefault(); 2880 var coord = pointerEventToXY(event); 2881 timeboxparent.trigger('scroll_element.xdsoft_scroller', [(startTop - (coord.y - start.y)) / (height - parentHeight)]); 2882 } 2883 }); 2884 2885 timeboxparent.on('touchend touchcancel', function (event) { 2886 start = false;
vendor: 4,361 bytes, lines 2887-2982
2887 startTop = 0; 2888 }); 2889 } 2890 timeboxparent.trigger('resize_scroll.xdsoft_scroller', [percent]); 2891 }); 2892 }; 2893 2894 $.fn.datetimepicker = function (opt) { 2895 var KEY0 = 48, 2896 KEY9 = 57, 2897 _KEY0 = 96, 2898 _KEY9 = 105, 2899 CTRLKEY = 17, 2900 DEL = 46, 2901 ENTER = 13, 2902 ESC = 27, 2903 BACKSPACE = 8, 2904 ARROWLEFT = 37, 2905 ARROWUP = 38, 2906 ARROWRIGHT = 39, 2907 ARROWDOWN = 40, 2908 TAB = 9, 2909 F5 = 116, 2910 AKEY = 65, 2911 CKEY = 67, 2912 VKEY = 86, 2913 ZKEY = 90, 2914 YKEY = 89, 2915 ctrlDown = false, 2916 options = ($.isPlainObject(opt) || !opt) ? $.extend(true, {}, default_options, opt) : $.extend(true, {}, default_options), 2917 2918 lazyInitTimer = 0, 2919 createDateTimePicker, 2920 destroyDateTimePicker, 2921 2922 lazyInit = function (input) { 2923 input 2924 .on('open.xdsoft focusin.xdsoft mousedown.xdsoft', function initOnActionCallback(event) { 2925 if (input.is(':disabled') || input.data('xdsoft_datetimepicker')) { 2926 return; 2927 } 2928 clearTimeout(lazyInitTimer); 2929 lazyInitTimer = setTimeout(function () { 2930 2931 if (!input.data('xdsoft_datetimepicker')) { 2932 createDateTimePicker(input); 2933 } 2934 input 2935 .off('open.xdsoft focusin.xdsoft mousedown.xdsoft', initOnActionCallback) 2936 .trigger('open.xdsoft'); 2937 }, 100); 2938 }); 2939 }; 2940 2941 createDateTimePicker = function (input) { 2942 var datetimepicker = $('<div class="xdsoft_datetimepicker xdsoft_noselect"></div>'), 2943 xdsoft_copyright = $('<div class="xdsoft_copyright"><a target="_blank" href="http://xdsoft.net/jqplugins/datetimepicker/">xdsoft.net</a></div>'), 2944 datepicker = $('<div class="xdsoft_datepicker active"></div>'), 2945 mounth_picker = $('<div class="xdsoft_mounthpicker"><button type="button" class="xdsoft_prev"></button><button type="button" class="xdsoft_today_button"></button>' + 2946 '<div class="xdsoft_label xdsoft_month"><span></span><i></i></div>' + 2947 '<div class="xdsoft_label xdsoft_year"><span></span><i></i></div>' + 2948 '<button type="button" class="xdsoft_next"></button></div>'), 2949 calendar = $('<div class="xdsoft_calendar"></div>'), 2950 timepicker = $('<div class="xdsoft_timepicker active"><button type="button" class="xdsoft_prev"></button><div class="xdsoft_time_box"></div><button type="button" class="xdsoft_next"></button></div>'), 2951 timeboxparent = timepicker.find('.xdsoft_time_box').eq(0), 2952 timebox = $('<div class="xdsoft_time_variant"></div>'), 2953 applyButton = $('<button type="button" class="xdsoft_save_selected blue-gradient-button">Save Selected</button>'), 2954 /*scrollbar = $('<div class="xdsoft_scrollbar"></div>'), 2955 scroller = $('<div class="xdsoft_scroller"></div>'),*/ 2956 monthselect = $('<div class="xdsoft_select xdsoft_monthselect"><div></div></div>'), 2957 yearselect = $('<div class="xdsoft_select xdsoft_yearselect"><div></div></div>'), 2958 triggerAfterOpen = false, 2959 XDSoft_datetime, 2960 //scroll_element, 2961 xchangeTimer, 2962 timerclick, 2963 current_time_index, 2964 setPos, 2965 timer = 0, 2966 timer1 = 0, 2967 _xdsoft_datetime; 2968 2969 if (options.id) { 2970 datetimepicker.attr('id', options.id); 2971 } 2972 if (options.style) { 2973 datetimepicker.attr('style', options.style); 2974 } 2975 if (options.weeks) { 2976 datetimepicker.addClass('xdsoft_showweeks'); 2977 } 2978 2979 datetimepicker.addClass('xdsoft_' + options.theme); 2980 datetimepicker.addClass(options.className); 2981 2982 mounth_picker
vendor: 1,295 bytes, lines 2983-3014
2983 .find('.xdsoft_month span') 2984 .after(monthselect); 2985 mounth_picker 2986 .find('.xdsoft_year span') 2987 .after(yearselect); 2988 2989 mounth_picker 2990 .find('.xdsoft_month,.xdsoft_year') 2991 .on('mousedown.xdsoft', function (event) { 2992 var select = $(this).find('.xdsoft_select').eq(0), 2993 val = 0, 2994 top = 0, 2995 visible = select.is(':visible'), 2996 items, 2997 i; 2998 2999 mounth_picker 3000 .find('.xdsoft_select') 3001 .hide(); 3002 if (_xdsoft_datetime.currentTime) { 3003 val = _xdsoft_datetime.currentTime[$(this).hasClass('xdsoft_month') ? 'getMonth' : 'getFullYear'](); 3004 } 3005 3006 select[visible ? 'hide' : 'show'](); 3007 for (items = select.find('div.xdsoft_option'), i = 0; i < items.length; i += 1) { 3008 if (items.eq(i).data('value') === val) { 3009 break; 3010 } else { 3011 top += items[0].offsetHeight; 3012 } 3013 } 3014
3015 select.xdsoftScroller(top / (select.children()[0].offsetHeight - (select[0].clientHeight))); 3016 event.stopPropagation(); 3017 return false; 3018 }); 3019 3020 mounth_picker 3021 .find('.xdsoft_select') 3022 .xdsoftScroller() 3023 .on('mousedown.xdsoft', function (event) { 3024 event.stopPropagation(); 3025 event.preventDefault(); 3026 }) 3027 .on('mousedown.xdsoft', '.xdsoft_option', function (event) { 3028 3029 if (_xdsoft_datetime.currentTime === undefined || _xdsoft_datetime.currentTime === null) { 3030 _xdsoft_datetime.currentTime = _xdsoft_datetime.now(); 3031 } 3032 3033 var year = _xdsoft_datetime.currentTime.getFullYear(); 3034 if (_xdsoft_datetime && _xdsoft_datetime.currentTime) { 3035 _xdsoft_datetime.currentTime[$(this).parent().parent().hasClass('xdsoft_monthselect') ? 'setMonth' : 'setFullYear']($(this).data('value')); 3036 } 3037 3038 $(this).parent().parent().hide(); 3039 3040 datetimepicker.trigger('xchange.xdsoft'); 3041 if (options.onChangeMonth && $.isFunction(options.onChangeMonth)) { 3042 options.onChangeMonth.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input')); 3043 } 3044 3045 if (year !== _xdsoft_datetime.currentTime.getFullYear() && $.isFunction(options.onChangeYear)) { 3046 options.onChangeYear.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input')); 3047 } 3048 }); 3049 3050 datetimepicker.setOptions = function (_options) { 3051 var highlightedDates = {}, 3052 getCaretPos = function (input) { 3053 try { 3054 if (document.selection && document.selection.createRange) { 3055 var range = document.selection.createRange(); 3056 return range.getBookmark().charCodeAt(2) - 2; 3057 } 3058 if (input.setSelectionRange) { 3059 return input.selectionStart; 3060 } 3061 } catch (e) { 3062 return 0; 3063 } 3064 }, 3065 setCaretPos = function (node, pos) { 3066 node = (typeof node === "string" || node instanceof String) ? document.getElementById(node) : node; 3067 if (!node) { 3068 return false; 3069 } 3070 if (node.createTextRange) { 3071 var textRange = node.createTextRange(); 3072 textRange.collapse(true); 3073 textRange.moveEnd('character', pos); 3074 textRange.moveStart('character', pos); 3075 textRange.select(); 3076 return true; 3077 } 3078 if (node.setSelectionRange) { 3079 node.setSelectionRange(pos, pos); 3080 return true; 3081 } 3082 return false; 3083 }, 3084 isValidValue = function (mask, value) { 3085 var reg = mask 3086 .replace(/([\[\]\/\{\}\(\)\-\.\+]{1})/g, '\\$1') 3087 .replace(/_/g, '{digit+}') 3088 .replace(/([0-9]{1})/g, '{digit$1}') 3089 .replace(/\{digit([0-9]{1})\}/g, '[0-$1_]{1}') 3090 .replace(/\{digit[\+]\}/g, '[0-9_]{1}'); 3091 return (new RegExp(reg)).test(value); 3092 }; 3093 options = $.extend(true, {}, options, _options); 3094 3095 if (_options.allowTimes && $.isArray(_options.allowTimes) && _options.allowTimes.length) { 3096 options.allowTimes = $.extend(true, [], _options.allowTimes); 3097 } 3098 3099 if (_options.weekends && $.isArray(_options.weekends) && _options.weekends.length) { 3100 options.weekends = $.extend(true, [], _options.weekends); 3101 } 3102 3103 if (_options.highlightedDates && $.isArray(_options.highlightedDates) && _options.highlightedDates.length) { 3104 $.each(_options.highlightedDates, function (index, value) { 3105 var splitData = $.map(value.split(','), $.trim), 3106 exDesc,
3107 hDate = new HighlightedDate(Date.parseDate(splitData[0], options.formatDate), splitData[1], splitData[2]), // date, desc, style 3108 keyDate = hDate.date.dateFormat(options.formatDate); 3109 if (highlightedDates[keyDate] !== undefined) { 3110 exDesc = highlightedDates[keyDate].desc; 3111 if (exDesc && exDesc.length && hDate.desc && hDate.desc.length) { 3112 highlightedDates[keyDate].desc = exDesc + "\n" + hDate.desc; 3113 } 3114 } else { 3115 highlightedDates[keyDate] = hDate; 3116 } 3117 }); 3118 3119 options.highlightedDates = $.extend(true, [], highlightedDates); 3120 } 3121 3122 if (_options.highlightedPeriods && $.isArray(_options.highlightedPeriods) && _options.highlightedPeriods.length) { 3123 highlightedDates = $.extend(true, [], options.highlightedDates); 3124 $.each(_options.highlightedPeriods, function (index, value) { 3125 var splitData = $.map(value.split(','), $.trim), 3126 dateTest = Date.parseDate(splitData[0], options.formatDate), // start date 3127 dateEnd = Date.parseDate(splitData[1], options.formatDate), 3128 desc = splitData[2], 3129 hDate, 3130 keyDate, 3131 exDesc, 3132 style = splitData[3]; 3133 3134 while (dateTest <= dateEnd) { 3135 hDate = new HighlightedDate(dateTest, desc, style); 3136 keyDate = dateTest.dateFormat(options.formatDate); 3137 dateTest.setDate(dateTest.getDate() + 1); 3138 if (highlightedDates[keyDate] !== undefined) { 3139 exDesc = highlightedDates[keyDate].desc; 3140 if (exDesc && exDesc.length && hDate.desc && hDate.desc.length) { 3141 highlightedDates[keyDate].desc = exDesc + "\n" + hDate.desc; 3142 } 3143 } else { 3144 highlightedDates[keyDate] = hDate; 3145 } 3146 } 3147 }); 3148 3149 options.highlightedDates = $.extend(true, [], highlightedDates); 3150 } 3151 3152 if (_options.disabledDates && $.isArray(_options.disabledDates) && _options.disabledDates.length) { 3153 options.disabledDates = $.extend(true, [], _options.disabledDates); 3154 } 3155 3156 if (_options.disabledWeekDays && $.isArray(_options.disabledWeekDays) && _options.disabledWeekDays.length) { 3157 options.disabledWeekDays = $.extend(true, [], _options.disabledWeekDays); 3158 } 3159 3160 if ((options.open || options.opened) && (!options.inline)) { 3161 input.trigger('open.xdsoft'); 3162 } 3163 3164 if (options.inline) { 3165 triggerAfterOpen = true; 3166 datetimepicker.addClass('xdsoft_inline'); 3167 input.after(datetimepicker).hide(); 3168 } 3169 3170 if (options.inverseButton) { 3171 options.next = 'xdsoft_prev'; 3172 options.prev = 'xdsoft_next'; 3173 } 3174 3175 if (options.datepicker) { 3176 datepicker.addClass('active'); 3177 } else { 3178 datepicker.removeClass('active'); 3179 } 3180 3181 if (options.timepicker) { 3182 timepicker.addClass('active'); 3183 } else { 3184 timepicker.removeClass('active'); 3185 } 3186 3187 if (options.value) { 3188 _xdsoft_datetime.setCurrentTime(options.value); 3189 if (input && input.val) { 3190 input.val(_xdsoft_datetime.str); 3191 } 3192 } 3193 3194 if (isNaN(options.dayOfWeekStart)) { 3195 options.dayOfWeekStart = 0; 3196 } else { 3197 options.dayOfWeekStart = parseInt(options.dayOfWeekStart, 10) % 7; 3198 } 3199 3200 if (!options.timepickerScrollbar) {
vendor: 4,695 bytes, lines 3201-3294
3201 timeboxparent.xdsoftScroller('hide'); 3202 } 3203 3204 if (options.minDate && /^-(.*)$/.test(options.minDate)) { 3205 options.minDate = _xdsoft_datetime.strToDateTime(options.minDate).dateFormat(options.formatDate); 3206 } 3207 3208 if (options.maxDate && /^\+(.*)$/.test(options.maxDate)) { 3209 options.maxDate = _xdsoft_datetime.strToDateTime(options.maxDate).dateFormat(options.formatDate); 3210 } 3211 3212 applyButton.toggle(options.showApplyButton); 3213 3214 mounth_picker 3215 .find('.xdsoft_today_button') 3216 .css('visibility', !options.todayButton ? 'hidden' : 'visible'); 3217 3218 mounth_picker 3219 .find('.' + options.prev) 3220 .css('visibility', !options.prevButton ? 'hidden' : 'visible'); 3221 3222 mounth_picker 3223 .find('.' + options.next) 3224 .css('visibility', !options.nextButton ? 'hidden' : 'visible'); 3225 3226 if (options.mask) { 3227 input.off('keydown.xdsoft'); 3228 3229 if (options.mask === true) { 3230 options.mask = options.format 3231 .replace(/Y/g, '9999') 3232 .replace(/F/g, '9999') 3233 .replace(/m/g, '19') 3234 .replace(/d/g, '39') 3235 .replace(/H/g, '29') 3236 .replace(/i/g, '59') 3237 .replace(/s/g, '59'); 3238 } 3239 3240 if ($.type(options.mask) === 'string') { 3241 if (!isValidValue(options.mask, input.val())) { 3242 input.val(options.mask.replace(/[0-9]/g, '_')); 3243 } 3244 3245 input.on('keydown.xdsoft', function (event) { 3246 var val = this.value, 3247 key = event.which, 3248 pos, 3249 digit; 3250 3251 if (((key >= KEY0 && key <= KEY9) || (key >= _KEY0 && key <= _KEY9)) || (key === BACKSPACE || key === DEL)) { 3252 pos = getCaretPos(this); 3253 digit = (key !== BACKSPACE && key !== DEL) ? String.fromCharCode((_KEY0 <= key && key <= _KEY9) ? key - KEY0 : key) : '_'; 3254 3255 if ((key === BACKSPACE || key === DEL) && pos) { 3256 pos -= 1; 3257 digit = '_'; 3258 } 3259 3260 while (/[^0-9_]/.test(options.mask.substr(pos, 1)) && pos < options.mask.length && pos > 0) { 3261 pos += (key === BACKSPACE || key === DEL) ? -1 : 1; 3262 } 3263 3264 val = val.substr(0, pos) + digit + val.substr(pos + 1); 3265 if ($.trim(val) === '') { 3266 val = options.mask.replace(/[0-9]/g, '_'); 3267 } else { 3268 if (pos === options.mask.length) { 3269 event.preventDefault(); 3270 return false; 3271 } 3272 } 3273 3274 pos += (key === BACKSPACE || key === DEL) ? 0 : 1; 3275 while (/[^0-9_]/.test(options.mask.substr(pos, 1)) && pos < options.mask.length && pos > 0) { 3276 pos += (key === BACKSPACE || key === DEL) ? -1 : 1; 3277 } 3278 3279 if (isValidValue(options.mask, val)) { 3280 this.value = val; 3281 setCaretPos(this, pos); 3282 } else if ($.trim(val) === '') { 3283 this.value = options.mask.replace(/[0-9]/g, '_'); 3284 } else { 3285 input.trigger('error_input.xdsoft'); 3286 } 3287 } else { 3288 if (([AKEY, CKEY, VKEY, ZKEY, YKEY].indexOf(key) !== -1 && ctrlDown) || [ESC, ARROWUP, ARROWDOWN, ARROWLEFT, ARROWRIGHT, F5, CTRLKEY, TAB, ENTER].indexOf(key) !== -1) { 3289 return true; 3290 } 3291 } 3292 3293 event.preventDefault(); 3294 return false;
3295 }); 3296 } 3297 } 3298 if (options.validateOnBlur) { 3299 input 3300 .off('blur.xdsoft') 3301 .on('blur.xdsoft', function () { 3302 if (options.allowBlank && !$.trim($(this).val()).length) { 3303 $(this).val(null); 3304 datetimepicker.data('xdsoft_datetime').empty(); 3305 } else if (!Date.parseDate($(this).val(), options.format)) { 3306 var splittedHours = +([$(this).val()[0], $(this).val()[1]].join('')), 3307 splittedMinutes = +([$(this).val()[2], $(this).val()[3]].join('')); 3308 3309 // parse the numbers as 0312 => 03:12 3310 if (!options.datepicker && options.timepicker && splittedHours >= 0 && splittedHours < 24 && splittedMinutes >= 0 && splittedMinutes < 60) { 3311 $(this).val([splittedHours, splittedMinutes].map(function (item) { 3312 return item > 9 ? item : '0' + item; 3313 }).join(':')); 3314 } else { 3315 $(this).val((_xdsoft_datetime.now()).dateFormat(options.format)); 3316 } 3317 3318 datetimepicker.data('xdsoft_datetime').setCurrentTime($(this).val()); 3319 } else { 3320 datetimepicker.data('xdsoft_datetime').setCurrentTime($(this).val()); 3321 } 3322 3323 datetimepicker.trigger('changedatetime.xdsoft'); 3324 }); 3325 } 3326 options.dayOfWeekStartPrev = (options.dayOfWeekStart === 0) ? 6 : options.dayOfWeekStart - 1; 3327 3328 datetimepicker 3329 .trigger('xchange.xdsoft') 3330 .trigger('afterOpen.xdsoft'); 3331 }; 3332 3333 datetimepicker 3334 .data('options', options) 3335 .on('mousedown.xdsoft', function (event) { 3336 event.stopPropagation(); 3337 event.preventDefault(); 3338 yearselect.hide(); 3339 monthselect.hide(); 3340 return false; 3341 }); 3342 3343 //scroll_element = timepicker.find('.xdsoft_time_box'); 3344 timeboxparent.append(timebox); 3345 timeboxparent.xdsoftScroller(); 3346 3347 datetimepicker.on('afterOpen.xdsoft', function () { 3348 timeboxparent.xdsoftScroller(); 3349 }); 3350 3351 datetimepicker 3352 .append(datepicker) 3353 .append(timepicker); 3354 3355 if (options.withoutCopyright !== true) { 3356 datetimepicker 3357 .append(xdsoft_copyright); 3358 } 3359 3360 datepicker 3361 .append(mounth_picker) 3362 .append(calendar) 3363 .append(applyButton); 3364 3365 $(options.parentID) 3366 .append(datetimepicker); 3367 3368 XDSoft_datetime = function () { 3369 var _this = this; 3370 _this.now = function (norecursion) { 3371 var d = new Date(), 3372 date, 3373 time; 3374 3375 if (!norecursion && options.defaultDate) { 3376 date = _this.strToDateTime(options.defaultDate); 3377 d.setFullYear(date.getFullYear()); 3378 d.setMonth(date.getMonth()); 3379 d.setDate(date.getDate()); 3380 } 3381 3382 if (options.yearOffset) { 3383 d.setFullYear(d.getFullYear() + options.yearOffset); 3384 } 3385 3386 if (!norecursion && options.defaultTime) { 3387 time = _this.strtotime(options.defaultTime); 3388 d.setHours(time.getHours()); 3389 d.setMinutes(time.getMinutes()); 3390 } 3391 return d; 3392 }; 3393 3394 _this.isValidDate = function (d) { 3395 if (Object.prototype.toString.call(d) !== "[object Date]") { 3396 return false;
vendor: 7,709 bytes, lines 3397-3569
3397 } 3398 return !isNaN(d.getTime()); 3399 }; 3400 3401 _this.setCurrentTime = function (dTime) { 3402 _this.currentTime = (typeof dTime === 'string') ? _this.strToDateTime(dTime) : _this.isValidDate(dTime) ? dTime : _this.now(); 3403 datetimepicker.trigger('xchange.xdsoft'); 3404 }; 3405 3406 _this.empty = function () { 3407 _this.currentTime = null; 3408 }; 3409 3410 _this.getCurrentTime = function (dTime) { 3411 return _this.currentTime; 3412 }; 3413 3414 _this.nextMonth = function () { 3415 3416 if (_this.currentTime === undefined || _this.currentTime === null) { 3417 _this.currentTime = _this.now(); 3418 } 3419 3420 var month = _this.currentTime.getMonth() + 1, 3421 year; 3422 if (month === 12) { 3423 _this.currentTime.setFullYear(_this.currentTime.getFullYear() + 1); 3424 month = 0; 3425 } 3426 3427 year = _this.currentTime.getFullYear(); 3428 3429 _this.currentTime.setDate( 3430 Math.min( 3431 new Date(_this.currentTime.getFullYear(), month + 1, 0).getDate(), 3432 _this.currentTime.getDate() 3433 ) 3434 ); 3435 _this.currentTime.setMonth(month); 3436 3437 if (options.onChangeMonth && $.isFunction(options.onChangeMonth)) { 3438 options.onChangeMonth.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input')); 3439 } 3440 3441 if (year !== _this.currentTime.getFullYear() && $.isFunction(options.onChangeYear)) { 3442 options.onChangeYear.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input')); 3443 } 3444 3445 datetimepicker.trigger('xchange.xdsoft'); 3446 return month; 3447 }; 3448 3449 _this.prevMonth = function () { 3450 3451 if (_this.currentTime === undefined || _this.currentTime === null) { 3452 _this.currentTime = _this.now(); 3453 } 3454 3455 var month = _this.currentTime.getMonth() - 1; 3456 if (month === -1) { 3457 _this.currentTime.setFullYear(_this.currentTime.getFullYear() - 1); 3458 month = 11; 3459 } 3460 _this.currentTime.setDate( 3461 Math.min( 3462 new Date(_this.currentTime.getFullYear(), month + 1, 0).getDate(), 3463 _this.currentTime.getDate() 3464 ) 3465 ); 3466 _this.currentTime.setMonth(month); 3467 if (options.onChangeMonth && $.isFunction(options.onChangeMonth)) { 3468 options.onChangeMonth.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input')); 3469 } 3470 datetimepicker.trigger('xchange.xdsoft'); 3471 return month; 3472 }; 3473 3474 _this.getWeekOfYear = function (datetime) { 3475 var onejan = new Date(datetime.getFullYear(), 0, 1); 3476 return Math.ceil((((datetime - onejan) / 86400000) + onejan.getDay() + 1) / 7); 3477 }; 3478 3479 _this.strToDateTime = function (sDateTime) { 3480 var tmpDate = [], timeOffset, currentTime; 3481 3482 if (sDateTime && sDateTime instanceof Date && _this.isValidDate(sDateTime)) { 3483 return sDateTime; 3484 } 3485 3486 tmpDate = /^(\+|\-)(.*)$/.exec(sDateTime); 3487 if (tmpDate) { 3488 tmpDate[2] = Date.parseDate(tmpDate[2], options.formatDate); 3489 } 3490 if (tmpDate && tmpDate[2]) { 3491 timeOffset = tmpDate[2].getTime() - (tmpDate[2].getTimezoneOffset()) * 60000; 3492 currentTime = new Date((_this.now(true)).getTime() + parseInt(tmpDate[1] + '1', 10) * timeOffset); 3493 } else { 3494 currentTime = sDateTime ? Date.parseDate(sDateTime, options.format) : _this.now(); 3495 } 3496 3497 if (!_this.isValidDate(currentTime)) { 3498 currentTime = _this.now(); 3499 } 3500 3501 return currentTime; 3502 }; 3503 3504 _this.strToDate = function (sDate) { 3505 if (sDate && sDate instanceof Date && _this.isValidDate(sDate)) { 3506 return sDate; 3507 } 3508 3509 var currentTime = sDate ? Date.parseDate(sDate, options.formatDate) : _this.now(true); 3510 if (!_this.isValidDate(currentTime)) { 3511 currentTime = _this.now(true); 3512 } 3513 return currentTime; 3514 }; 3515 3516 _this.strtotime = function (sTime) { 3517 if (sTime && sTime instanceof Date && _this.isValidDate(sTime)) { 3518 return sTime; 3519 } 3520 var currentTime = sTime ? Date.parseDate(sTime, options.formatTime) : _this.now(true); 3521 if (!_this.isValidDate(currentTime)) { 3522 currentTime = _this.now(true); 3523 } 3524 return currentTime; 3525 }; 3526 3527 _this.str = function () { 3528 return _this.currentTime.dateFormat(options.format); 3529 }; 3530 _this.currentTime = this.now(); 3531 }; 3532 3533 _xdsoft_datetime = new XDSoft_datetime(); 3534 3535 applyButton.on('click', function (e) {//pathbrite 3536 e.preventDefault(); 3537 datetimepicker.data('changed', true); 3538 _xdsoft_datetime.setCurrentTime(getCurrentValue()); 3539 input.val(_xdsoft_datetime.str()); 3540 datetimepicker.trigger('close.xdsoft'); 3541 }); 3542 mounth_picker 3543 .find('.xdsoft_today_button') 3544 .on('mousedown.xdsoft', function () { 3545 datetimepicker.data('changed', true); 3546 _xdsoft_datetime.setCurrentTime(0); 3547 datetimepicker.trigger('afterOpen.xdsoft'); 3548 }).on('dblclick.xdsoft', function () { 3549 var currentDate = _xdsoft_datetime.getCurrentTime(), minDate, maxDate; 3550 currentDate = new Date(currentDate.getFullYear(), currentDate.getMonth(), currentDate.getDate()); 3551 minDate = _xdsoft_datetime.strToDate(options.minDate); 3552 minDate = new Date(minDate.getFullYear(), minDate.getMonth(), minDate.getDate()); 3553 if (currentDate < minDate) { 3554 return; 3555 } 3556 maxDate = _xdsoft_datetime.strToDate(options.maxDate); 3557 maxDate = new Date(maxDate.getFullYear(), maxDate.getMonth(), maxDate.getDate()); 3558 if (currentDate > maxDate) { 3559 return; 3560 } 3561 input.val(_xdsoft_datetime.str()); 3562 datetimepicker.trigger('close.xdsoft'); 3563 }); 3564 mounth_picker 3565 .find('.xdsoft_prev,.xdsoft_next') 3566 .on('mousedown.xdsoft', function () { 3567 var $this = $(this), 3568 timer = 0, 3569 stop = false;
vendor: 21,064 bytes, lines 3570-3960
3570 3571 (function arguments_callee1(v) { 3572 if ($this.hasClass(options.next)) { 3573 _xdsoft_datetime.nextMonth(); 3574 } else if ($this.hasClass(options.prev)) { 3575 _xdsoft_datetime.prevMonth(); 3576 } 3577 if (options.monthChangeSpinner) { 3578 if (!stop) { 3579 timer = setTimeout(arguments_callee1, v || 100); 3580 } 3581 } 3582 }(500)); 3583 3584 $([document.body, window]).on('mouseup.xdsoft', function arguments_callee2() { 3585 clearTimeout(timer); 3586 stop = true; 3587 $([document.body, window]).off('mouseup.xdsoft', arguments_callee2); 3588 }); 3589 }); 3590 3591 timepicker 3592 .find('.xdsoft_prev,.xdsoft_next') 3593 .on('mousedown.xdsoft', function () { 3594 var $this = $(this), 3595 timer = 0, 3596 stop = false, 3597 period = 110; 3598 (function arguments_callee4(v) { 3599 var pheight = timeboxparent[0].clientHeight, 3600 height = timebox[0].offsetHeight, 3601 top = Math.abs(parseInt(timebox.css('marginTop'), 10)); 3602 if ($this.hasClass(options.next) && (height - pheight) - options.timeHeightInTimePicker >= top) { 3603 timebox.css('marginTop', '-' + (top + options.timeHeightInTimePicker) + 'px'); 3604 } else if ($this.hasClass(options.prev) && top - options.timeHeightInTimePicker >= 0) { 3605 timebox.css('marginTop', '-' + (top - options.timeHeightInTimePicker) + 'px'); 3606 } 3607 timeboxparent.trigger('scroll_element.xdsoft_scroller', [Math.abs(parseInt(timebox.css('marginTop'), 10) / (height - pheight))]); 3608 period = (period > 10) ? 10 : period - 10; 3609 if (!stop) { 3610 timer = setTimeout(arguments_callee4, v || period); 3611 } 3612 }(500)); 3613 $([document.body, window]).on('mouseup.xdsoft', function arguments_callee5() { 3614 clearTimeout(timer); 3615 stop = true; 3616 $([document.body, window]) 3617 .off('mouseup.xdsoft', arguments_callee5); 3618 }); 3619 }); 3620 3621 xchangeTimer = 0; 3622 // base handler - generating a calendar and timepicker 3623 datetimepicker 3624 .on('xchange.xdsoft', function (event) { 3625 clearTimeout(xchangeTimer); 3626 xchangeTimer = setTimeout(function () { 3627 3628 if (_xdsoft_datetime.currentTime === undefined || _xdsoft_datetime.currentTime === null) { 3629 _xdsoft_datetime.currentTime = _xdsoft_datetime.now(); 3630 } 3631 3632 var table = '', 3633 start = new Date(_xdsoft_datetime.currentTime.getFullYear(), _xdsoft_datetime.currentTime.getMonth(), 1, 12, 0, 0), 3634 i = 0, 3635 j, 3636 today = _xdsoft_datetime.now(), 3637 maxDate = false, 3638 minDate = false, 3639 hDate, 3640 day, 3641 d, 3642 y, 3643 m, 3644 w, 3645 classes = [], 3646 customDateSettings, 3647 newRow = true, 3648 time = '', 3649 h = '', 3650 line_time, 3651 description; 3652 3653 while (start.getDay() !== options.dayOfWeekStart) { 3654 start.setDate(start.getDate() - 1); 3655 } 3656 3657 table += '<table><thead><tr>'; 3658 3659 if (options.weeks) { 3660 table += '<th></th>'; 3661 } 3662 3663 for (j = 0; j < 7; j += 1) { 3664 table += '<th>' + options.i18n[options.lang].dayOfWeek[(j + options.dayOfWeekStart) % 7] + '</th>'; 3665 } 3666 3667 table += '</tr></thead>'; 3668 table += '<tbody>'; 3669 3670 if (options.maxDate !== false) { 3671 maxDate = _xdsoft_datetime.strToDate(options.maxDate); 3672 maxDate = new Date(maxDate.getFullYear(), maxDate.getMonth(), maxDate.getDate(), 23, 59, 59, 999); 3673 } 3674 3675 if (options.minDate !== false) { 3676 minDate = _xdsoft_datetime.strToDate(options.minDate); 3677 minDate = new Date(minDate.getFullYear(), minDate.getMonth(), minDate.getDate()); 3678 } 3679 3680 while (i < _xdsoft_datetime.currentTime.countDaysInMonth() || start.getDay() !== options.dayOfWeekStart || _xdsoft_datetime.currentTime.getMonth() === start.getMonth()) { 3681 classes = []; 3682 i += 1; 3683 3684 day = start.getDay(); 3685 d = start.getDate(); 3686 y = start.getFullYear(); 3687 m = start.getMonth(); 3688 w = _xdsoft_datetime.getWeekOfYear(start); 3689 description = ''; 3690 3691 classes.push('xdsoft_date'); 3692 3693 if (options.beforeShowDay && $.isFunction(options.beforeShowDay.call)) { 3694 customDateSettings = options.beforeShowDay.call(datetimepicker, start); 3695 } else { 3696 customDateSettings = null; 3697 } 3698 3699 if ((maxDate !== false && start > maxDate) || (minDate !== false && start < minDate) || (customDateSettings && customDateSettings[0] === false)) { 3700 classes.push('xdsoft_disabled'); 3701 } else if (options.disabledDates.indexOf(start.dateFormat(options.formatDate)) !== -1) { 3702 classes.push('xdsoft_disabled'); 3703 } else if (options.disabledWeekDays.indexOf(day) !== -1) { 3704 classes.push('xdsoft_disabled'); 3705 } 3706 3707 if (customDateSettings && customDateSettings[1] !== "") { 3708 classes.push(customDateSettings[1]); 3709 } 3710 3711 if (_xdsoft_datetime.currentTime.getMonth() !== m) { 3712 classes.push('xdsoft_other_month'); 3713 } 3714 3715 if ((options.defaultSelect || datetimepicker.data('changed')) && _xdsoft_datetime.currentTime.dateFormat(options.formatDate) === start.dateFormat(options.formatDate)) { 3716 classes.push('xdsoft_current'); 3717 } 3718 3719 if (today.dateFormat(options.formatDate) === start.dateFormat(options.formatDate)) { 3720 classes.push('xdsoft_today'); 3721 } 3722 3723 if (start.getDay() === 0 || start.getDay() === 6 || options.weekends.indexOf(start.dateFormat(options.formatDate)) !== -1) { 3724 classes.push('xdsoft_weekend'); 3725 } 3726 3727 if (options.highlightedDates[start.dateFormat(options.formatDate)] !== undefined) { 3728 hDate = options.highlightedDates[start.dateFormat(options.formatDate)]; 3729 classes.push(hDate.style === undefined ? 'xdsoft_highlighted_default' : hDate.style); 3730 description = hDate.desc === undefined ? '' : hDate.desc; 3731 } 3732 3733 if (options.beforeShowDay && $.isFunction(options.beforeShowDay)) { 3734 classes.push(options.beforeShowDay(start)); 3735 } 3736 3737 if (newRow) { 3738 table += '<tr>'; 3739 newRow = false; 3740 if (options.weeks) { 3741 table += '<th>' + w + '</th>'; 3742 } 3743 } 3744 3745 table += '<td data-date="' + d + '" data-month="' + m + '" data-year="' + y + '"' + ' class="xdsoft_date xdsoft_day_of_week' + start.getDay() + ' ' + classes.join(' ') + '" title="' + description + '">' + 3746 '<div>' + d + '</div>' + 3747 '</td>'; 3748 3749 if (start.getDay() === options.dayOfWeekStartPrev) { 3750 table += '</tr>'; 3751 newRow = true; 3752 } 3753 3754 start.setDate(d + 1); 3755 } 3756 table += '</tbody></table>'; 3757 3758 calendar.html(table); 3759 3760 mounth_picker.find('.xdsoft_label span').eq(0).text(options.i18n[options.lang].months[_xdsoft_datetime.currentTime.getMonth()]); 3761 mounth_picker.find('.xdsoft_label span').eq(1).text(_xdsoft_datetime.currentTime.getFullYear()); 3762 3763 // generate timebox 3764 time = ''; 3765 h = ''; 3766 m = ''; 3767 line_time = function line_time(h, m) { 3768 var now = _xdsoft_datetime.now(), optionDateTime, current_time; 3769 now.setHours(h); 3770 h = parseInt(now.getHours(), 10); 3771 now.setMinutes(m); 3772 m = parseInt(now.getMinutes(), 10); 3773 optionDateTime = new Date(_xdsoft_datetime.currentTime); 3774 optionDateTime.setHours(h); 3775 optionDateTime.setMinutes(m); 3776 classes = []; 3777 if ((options.minDateTime !== false && options.minDateTime > optionDateTime) || (options.maxTime !== false && _xdsoft_datetime.strtotime(options.maxTime).getTime() < now.getTime()) || (options.minTime !== false && _xdsoft_datetime.strtotime(options.minTime).getTime() > now.getTime())) { 3778 classes.push('xdsoft_disabled'); 3779 } 3780 if ((options.minDateTime !== false && options.minDateTime > optionDateTime) || ((options.disabledMinTime !== false && now.getTime() > _xdsoft_datetime.strtotime(options.disabledMinTime).getTime()) && (options.disabledMaxTime !== false && now.getTime() < _xdsoft_datetime.strtotime(options.disabledMaxTime).getTime()))) { 3781 classes.push('xdsoft_disabled'); 3782 } 3783 3784 current_time = new Date(_xdsoft_datetime.currentTime); 3785 current_time.setHours(parseInt(_xdsoft_datetime.currentTime.getHours(), 10)); 3786 current_time.setMinutes(Math[options.roundTime](_xdsoft_datetime.currentTime.getMinutes() / options.step) * options.step); 3787 3788 if ((options.initTime || options.defaultSelect || datetimepicker.data('changed')) && current_time.getHours() === parseInt(h, 10) && (options.step > 59 || current_time.getMinutes() === parseInt(m, 10))) { 3789 if (options.defaultSelect || datetimepicker.data('changed')) { 3790 classes.push('xdsoft_current'); 3791 } else if (options.initTime) { 3792 classes.push('xdsoft_init_time'); 3793 } 3794 } 3795 if (parseInt(today.getHours(), 10) === parseInt(h, 10) && parseInt(today.getMinutes(), 10) === parseInt(m, 10)) { 3796 classes.push('xdsoft_today'); 3797 } 3798 time += '<div class="xdsoft_time ' + classes.join(' ') + '" data-hour="' + h + '" data-minute="' + m + '">' + now.dateFormat(options.formatTime) + '</div>'; 3799 }; 3800 3801 if (!options.allowTimes || !$.isArray(options.allowTimes) || !options.allowTimes.length) { 3802 for (i = 0, j = 0; i < (options.hours12 ? 12 : 24); i += 1) { 3803 for (j = 0; j < 60; j += options.step) { 3804 h = (i < 10 ? '0' : '') + i; 3805 m = (j < 10 ? '0' : '') + j; 3806 line_time(h, m); 3807 } 3808 } 3809 } else { 3810 for (i = 0; i < options.allowTimes.length; i += 1) { 3811 h = _xdsoft_datetime.strtotime(options.allowTimes[i]).getHours(); 3812 m = _xdsoft_datetime.strtotime(options.allowTimes[i]).getMinutes(); 3813 line_time(h, m); 3814 } 3815 } 3816 3817 timebox.html(time); 3818 3819 opt = ''; 3820 i = 0; 3821 3822 for (i = parseInt(options.yearStart, 10) + options.yearOffset; i <= parseInt(options.yearEnd, 10) + options.yearOffset; i += 1) { 3823 opt += '<div class="xdsoft_option ' + (_xdsoft_datetime.currentTime.getFullYear() === i ? 'xdsoft_current' : '') + '" data-value="' + i + '">' + i + '</div>'; 3824 } 3825 yearselect.children().eq(0) 3826 .html(opt); 3827 3828 for (i = parseInt(options.monthStart, 10), opt = ''; i <= parseInt(options.monthEnd, 10); i += 1) { 3829 opt += '<div class="xdsoft_option ' + (_xdsoft_datetime.currentTime.getMonth() === i ? 'xdsoft_current' : '') + '" data-value="' + i + '">' + options.i18n[options.lang].months[i] + '</div>'; 3830 } 3831 monthselect.children().eq(0).html(opt); 3832 $(datetimepicker) 3833 .trigger('generate.xdsoft'); 3834 }, 10); 3835 event.stopPropagation(); 3836 }) 3837 .on('afterOpen.xdsoft', function () { 3838 if (options.timepicker) { 3839 var classType, pheight, height, top; 3840 if (timebox.find('.xdsoft_current').length) { 3841 classType = '.xdsoft_current'; 3842 } else if (timebox.find('.xdsoft_init_time').length) { 3843 classType = '.xdsoft_init_time'; 3844 } 3845 if (classType) { 3846 pheight = timeboxparent[0].clientHeight; 3847 height = timebox[0].offsetHeight; 3848 top = timebox.find(classType).index() * options.timeHeightInTimePicker + 1; 3849 if ((height - pheight) < top) { 3850 top = height - pheight; 3851 } 3852 timeboxparent.trigger('scroll_element.xdsoft_scroller', [parseInt(top, 10) / (height - pheight)]); 3853 } else { 3854 timeboxparent.trigger('scroll_element.xdsoft_scroller', [0]); 3855 } 3856 } 3857 }); 3858 3859 timerclick = 0; 3860 calendar 3861 .on('click.xdsoft', 'td', function (xdevent) { 3862 xdevent.stopPropagation(); // Prevents closing of Pop-ups, Modals and Flyouts in Bootstrap 3863 timerclick += 1; 3864 var $this = $(this), 3865 currentTime = _xdsoft_datetime.currentTime; 3866 3867 if (currentTime === undefined || currentTime === null) { 3868 _xdsoft_datetime.currentTime = _xdsoft_datetime.now(); 3869 currentTime = _xdsoft_datetime.currentTime; 3870 } 3871 3872 if ($this.hasClass('xdsoft_disabled')) { 3873 return false; 3874 } 3875 3876 currentTime.setDate(1); 3877 currentTime.setFullYear($this.data('year')); 3878 currentTime.setMonth($this.data('month')); 3879 currentTime.setDate($this.data('date')); 3880 3881 datetimepicker.trigger('select.xdsoft', [currentTime]); 3882 3883 input.val(_xdsoft_datetime.str()); 3884 if ((timerclick > 1 || (options.closeOnDateSelect === true || (options.closeOnDateSelect === false && !options.timepicker))) && !options.inline) { 3885 datetimepicker.trigger('close.xdsoft'); 3886 } 3887 3888 if (options.onSelectDate && $.isFunction(options.onSelectDate)) { 3889 options.onSelectDate.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input'), xdevent); 3890 } 3891 3892 datetimepicker.data('changed', true); 3893 datetimepicker.trigger('xchange.xdsoft'); 3894 datetimepicker.trigger('changedatetime.xdsoft'); 3895 setTimeout(function () { 3896 timerclick = 0; 3897 }, 200); 3898 }); 3899 3900 timebox 3901 .on('click.xdsoft', 'div', function (xdevent) { 3902 xdevent.stopPropagation(); 3903 var $this = $(this), 3904 currentTime = _xdsoft_datetime.currentTime; 3905 3906 if (currentTime === undefined || currentTime === null) { 3907 _xdsoft_datetime.currentTime = _xdsoft_datetime.now(); 3908 currentTime = _xdsoft_datetime.currentTime; 3909 } 3910 3911 if ($this.hasClass('xdsoft_disabled')) { 3912 return false; 3913 } 3914 currentTime.setHours($this.data('hour')); 3915 currentTime.setMinutes($this.data('minute')); 3916 datetimepicker.trigger('select.xdsoft', [currentTime]); 3917 3918 datetimepicker.data('input').val(_xdsoft_datetime.str()); 3919 3920 if (options.inline !== true && options.closeOnTimeSelect === true) { 3921 datetimepicker.trigger('close.xdsoft'); 3922 } 3923 3924 if (options.onSelectTime && $.isFunction(options.onSelectTime)) { 3925 options.onSelectTime.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input'), xdevent); 3926 } 3927 datetimepicker.data('changed', true); 3928 datetimepicker.trigger('xchange.xdsoft'); 3929 datetimepicker.trigger('changedatetime.xdsoft'); 3930 }); 3931 3932 3933 datepicker 3934 .on('mousewheel.xdsoft', function (event) { 3935 if (!options.scrollMonth) { 3936 return true; 3937 } 3938 if (event.deltaY < 0) { 3939 _xdsoft_datetime.nextMonth(); 3940 } else { 3941 _xdsoft_datetime.prevMonth(); 3942 } 3943 return false; 3944 }); 3945 3946 input 3947 .on('mousewheel.xdsoft', function (event) { 3948 if (!options.scrollInput) { 3949 return true; 3950 } 3951 if (!options.datepicker && options.timepicker) { 3952 current_time_index = timebox.find('.xdsoft_current').length ? timebox.find('.xdsoft_current').eq(0).index() : 0; 3953 if (current_time_index + event.deltaY >= 0 && current_time_index + event.deltaY < timebox.children().length) { 3954 current_time_index += event.deltaY; 3955 } 3956 if (timebox.children().eq(current_time_index).length) { 3957 timebox.children().eq(current_time_index).trigger('mousedown'); 3958 } 3959 return false; 3960 }
3961 if (options.datepicker && !options.timepicker) { 3962 datepicker.trigger(event, [event.deltaY, event.deltaX, event.deltaY]); 3963 if (input.val) { 3964 input.val(_xdsoft_datetime.str()); 3965 } 3966 datetimepicker.trigger('changedatetime.xdsoft'); 3967 return false; 3968 } 3969 }); 3970 3971 datetimepicker 3972 .on('changedatetime.xdsoft', function (event) { 3973 if (options.onChangeDateTime && $.isFunction(options.onChangeDateTime)) { 3974 var $input = datetimepicker.data('input'); 3975 options.onChangeDateTime.call(datetimepicker, _xdsoft_datetime.currentTime, $input, event); 3976 delete options.value; 3977 $input.trigger('change'); 3978 } 3979 }) 3980 .on('generate.xdsoft', function () { 3981 if (options.onGenerate && $.isFunction(options.onGenerate)) { 3982 options.onGenerate.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input')); 3983 } 3984 if (triggerAfterOpen) { 3985 datetimepicker.trigger('afterOpen.xdsoft'); 3986 triggerAfterOpen = false; 3987 } 3988 }) 3989 .on('click.xdsoft', function (xdevent) { 3990 xdevent.stopPropagation(); 3991 }); 3992 3993 current_time_index = 0; 3994 3995 setPos = function () { 3996 var offset = datetimepicker.data('input').offset(), 3997 top = offset.top + datetimepicker.data('input')[0].offsetHeight - 1, left = offset.left, 3998 position = "absolute", node; 3999 if (options.fixed) { 4000 top -= $(window).scrollTop(); 4001 left -= $(window).scrollLeft(); 4002 position = "fixed"; 4003 } else { 4004 if (top + datetimepicker[0].offsetHeight > $(window).height() + $(window).scrollTop()) { 4005 top = offset.top - datetimepicker[0].offsetHeight + 1; 4006 } 4007 if (top < 0) { 4008 top = 0; 4009 } 4010 if (left + datetimepicker[0].offsetWidth > $(window).width()) { 4011 left = $(window).width() - datetimepicker[0].offsetWidth; 4012 } 4013 } 4014 4015 node = datetimepicker[0]; 4016 do { 4017 node = node.parentNode; 4018 if (window.getComputedStyle(node).getPropertyValue('position') === 'relative' && $(window).width() >= node.offsetWidth) { 4019 left = left - (($(window).width() - node.offsetWidth) / 2); 4020 break; 4021 } 4022 } while (node.nodeName !== 'HTML'); 4023 datetimepicker.css({ 4024 left: left, 4025 top: top, 4026 position: position 4027 }); 4028 }; 4029 datetimepicker 4030 .on('open.xdsoft', function (event) { 4031 var onShow = true; 4032 if (options.onShow && $.isFunction(options.onShow)) { 4033 onShow = options.onShow.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input'), event); 4034 } 4035 if (onShow !== false) { 4036 datetimepicker.show(); 4037 setPos(); 4038 $(window) 4039 .off('resize.xdsoft', setPos) 4040 .on('resize.xdsoft', setPos); 4041 4042 if (options.closeOnWithoutClick) { 4043 $([document.body, window]).on('mousedown.xdsoft', function arguments_callee6() { 4044 datetimepicker.trigger('close.xdsoft'); 4045 $([document.body, window]).off('mousedown.xdsoft', arguments_callee6); 4046 }); 4047 } 4048 } 4049 }) 4050 .on('close.xdsoft', function (event) { 4051 var onClose = true; 4052 mounth_picker 4053 .find('.xdsoft_month,.xdsoft_year') 4054 .find('.xdsoft_select') 4055 .hide(); 4056 if (options.onClose && $.isFunction(options.onClose)) { 4057 onClose = options.onClose.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input'), event); 4058 }
4059 if (onClose !== false && !options.opened && !options.inline) { 4060 datetimepicker.hide(); 4061 } 4062 event.stopPropagation(); 4063 }) 4064 .on('toggle.xdsoft', function (event) { 4065 if (datetimepicker.is(':visible')) { 4066 datetimepicker.trigger('close.xdsoft'); 4067 } else { 4068 datetimepicker.trigger('open.xdsoft'); 4069 } 4070 }) 4071 .data('input', input); 4072 4073 timer = 0; 4074 timer1 = 0; 4075 4076 datetimepicker.data('xdsoft_datetime', _xdsoft_datetime); 4077 datetimepicker.setOptions(options); 4078 4079 function getCurrentValue() { 4080 var ct = false, time; 4081 4082 if (options.startDate) { 4083 ct = _xdsoft_datetime.strToDate(options.startDate); 4084 } else { 4085 ct = options.value || ((input && input.val && input.val()) ? input.val() : ''); 4086 if (ct) { 4087 ct = _xdsoft_datetime.strToDateTime(ct); 4088 } else if (options.defaultDate) { 4089 ct = _xdsoft_datetime.strToDateTime(options.defaultDate); 4090 if (options.defaultTime) { 4091 time = _xdsoft_datetime.strtotime(options.defaultTime); 4092 ct.setHours(time.getHours()); 4093 ct.setMinutes(time.getMinutes()); 4094 } 4095 } 4096 } 4097 4098 if (ct && _xdsoft_datetime.isValidDate(ct)) { 4099 datetimepicker.data('changed', true); 4100 } else { 4101 ct = ''; 4102 } 4103 4104 return ct || 0; 4105 } 4106 4107 _xdsoft_datetime.setCurrentTime(getCurrentValue()); 4108 4109 input 4110 .data('xdsoft_datetimepicker', datetimepicker) 4111 .on('open.xdsoft focusin.xdsoft mousedown.xdsoft', function (event) { 4112 if (input.is(':disabled') || (input.data('xdsoft_datetimepicker').is(':visible') && options.closeOnInputClick)) { 4113 return; 4114 } 4115 clearTimeout(timer); 4116 timer = setTimeout(function () { 4117 if (input.is(':disabled')) { 4118 return; 4119 } 4120 4121 triggerAfterOpen = true; 4122 _xdsoft_datetime.setCurrentTime(getCurrentValue()); 4123 4124 datetimepicker.trigger('open.xdsoft'); 4125 }, 100); 4126 }) 4127 .on('keydown.xdsoft', function (event) { 4128 var val = this.value, elementSelector, 4129 key = event.which; 4130 if ([ENTER].indexOf(key) !== -1 && options.enterLikeTab) { 4131 elementSelector = $("input:visible,textarea:visible"); 4132 datetimepicker.trigger('close.xdsoft'); 4133 elementSelector.eq(elementSelector.index(this) + 1).focus(); 4134 return false; 4135 } 4136 if ([TAB].indexOf(key) !== -1) { 4137 datetimepicker.trigger('close.xdsoft'); 4138 return true; 4139 } 4140 }); 4141 }; 4142 destroyDateTimePicker = function (input) { 4143 var datetimepicker = input.data('xdsoft_datetimepicker'); 4144 if (datetimepicker) { 4145 datetimepicker.data('xdsoft_datetime', null); 4146 datetimepicker.remove(); 4147 input 4148 .data('xdsoft_datetimepicker', null) 4149 .off('.xdsoft'); 4150 $(window).off('resize.xdsoft'); 4151 $([window, document.body]).off('mousedown.xdsoft'); 4152 if (input.unmousewheel) { 4153 input.unmousewheel(); 4154 } 4155 } 4156 }; 4157 $(document) 4158 .off('keydown.xdsoftctrl keyup.xdsoftctrl') 4159 .on('keydown.xdsoftctrl', function (e) { 4160 if (e.keyCode === CTRLKEY) { 4161 ctrlDown = true; 4162 } 4163 }) 4164 .on('keyup.xdsoftctrl', function (e) { 4165 if (e.keyCode === CTRLKEY) { 4166 ctrlDown = false;
4167 } 4168 }); 4169 return this.each(function () { 4170 var datetimepicker = $(this).data('xdsoft_datetimepicker'), $input; 4171 if (datetimepicker) { 4172 if ($.type(opt) === 'string') { 4173 switch (opt) { 4174 case 'show': 4175 $(this).select().focus(); 4176 datetimepicker.trigger('open.xdsoft'); 4177 break; 4178 case 'hide': 4179 datetimepicker.trigger('close.xdsoft'); 4180 break; 4181 case 'toggle': 4182 datetimepicker.trigger('toggle.xdsoft'); 4183 break; 4184 case 'destroy': 4185 destroyDateTimePicker($(this)); 4186 break; 4187 case 'reset': 4188 this.value = this.defaultValue; 4189 if (!this.value || !datetimepicker.data('xdsoft_datetime').isValidDate(Date.parseDate(this.value, options.format))) { 4190 datetimepicker.data('changed', false); 4191 } 4192 datetimepicker.data('xdsoft_datetime').setCurrentTime(this.value); 4193 break; 4194 case 'validate': 4195 $input = datetimepicker.data('input'); 4196 $input.trigger('blur.xdsoft'); 4197 break; 4198 } 4199 } else { 4200 datetimepicker 4201 .setOptions(opt); 4202 } 4203 return 0; 4204 } 4205 if ($.type(opt) !== 'string') { 4206 if (!options.lazyInit || options.open || options.inline) { 4207 createDateTimePicker($(this)); 4208 } else { 4209 lazyInit($(this)); 4210 } 4211 } 4212 }); 4213 }; 4214 $.fn.datetimepicker.defaults = default_options; 4215}(jQuery)); 4216 4217function HighlightedDate(date, desc, style) { 4218 "use strict"; 4219 this.date = date; 4220 this.desc = desc; 4221 this.style = style; 4222} 4223 4224(function () { 4225 4226 /*! Copyright (c) 2013 Brandon Aaron (http://brandon.aaron.sh) 4227 * Licensed under the MIT License (LICENSE.txt). 4228 * 4229 * Version: 3.1.12 4230 * 4231 * Requires: jQuery 1.2.2+ 4232 */ 4233 !function (a) { 4234 "function" == typeof define && define.amd ? define(["jquery"], a) : "object" == typeof exports ? module.exports = a : a(jQuery) 4235 }(function (a) { 4236 function b(b) { 4237 var g = b || window.event, h = i.call(arguments, 1), j = 0, l = 0, m = 0, n = 0, o = 0, p = 0; 4238 if (b = a.event.fix(g), b.type = "mousewheel", "detail" in g && (m = -1 * g.detail), "wheelDelta" in g && (m = g.wheelDelta), "wheelDeltaY" in g && (m = g.wheelDeltaY), "wheelDeltaX" in g && (l = -1 * g.wheelDeltaX), "axis" in g && g.axis === g.HORIZONTAL_AXIS && (l = -1 * m, m = 0), j = 0 === m ? l : m, "deltaY" in g && (m = -1 * g.deltaY, j = m), "deltaX" in g && (l = g.deltaX, 0 === m && (j = -1 * l)), 0 !== m || 0 !== l) { 4239 if (1 === g.deltaMode) { 4240 var q = a.data(this, "mousewheel-line-height"); 4241 j *= q, m *= q, l *= q 4242 } else if (2 === g.deltaMode) { 4243 var r = a.data(this, "mousewheel-page-height"); 4244 j *= r, m *= r, l *= r 4245 } 4246 if (n = Math.max(Math.abs(m), Math.abs(l)), (!f || f > n) && (f = n, d(g, n) && (f /= 40)), d(g, n) && (j /= 40, l /= 40, m /= 40), j = Math[j >= 1 ? "floor" : "ceil"](j / f), l = Math[l >= 1 ? "floor" : "ceil"](l / f), m = Math[m >= 1 ? "floor" : "ceil"](m / f), k.settings.normalizeOffset && this.getBoundingClientRect) { 4247 var s = this.getBoundingClientRect(); 4248 o = b.clientX - s.left, p = b.clientY - s.top 4249 } 4250 return b.deltaX = l, b.deltaY = m, b.deltaFactor = f, b.offsetX = o, b.offsetY = p, b.deltaMode = 0, h.unshift(b, j, l, m), e && clearTimeout(e), e = setTimeout(c, 200), (a.event.dispatch || a.event.handle).apply(this, h) 4251 } 4252 } 4253 4254 function c() { 4255 f = null 4256 } 4257 4258 function d(a, b) { 4259 return k.settings.adjustOldDeltas && "mousewheel" === a.type && b % 120 === 0 4260 } 4261 4262 var e, f, g = ["wheel", "mousewheel", "DOMMouseScroll", "MozMousePixelScroll"], 4263 h = "onwheel" in document || document.documentMode >= 9 ? ["wheel"] : ["mousewheel", "DomMouseScroll", "MozMousePixelScroll"], 4264 i = Array.prototype.slice; 4265 if (a.event.fixHooks)for (var j = g.length; j;)a.event.fixHooks[g[--j]] = a.event.mouseHooks; 4266 var k = a.event.special.mousewheel = { 4267 version: "3.1.12", setup: function () { 4268 if (this.addEventListener)for (var c = h.length; c;)this.addEventListener(h[--c], b, !1); else this.onmousewheel = b; 4269 a.data(this, "mousewheel-line-height", k.getLineHeight(this)), a.data(this, "mousewheel-page-height", k.getPageHeight(this)) 4270 }, teardown: function () { 4271 if (this.removeEventListener)for (var c = h.length; c;)this.removeEventListener(h[--c], b, !1); else this.onmousewheel = null; 4272 a.removeData(this, "mousewheel-line-height"), a.removeData(this, "mousewheel-page-height") 4273 }, getLineHeight: function (b) { 4274 var c = a(b), d = c["offsetParent" in a.fn ? "offsetParent" : "parent"](); 4275 return d.length || (d = a("body")), parseInt(d.css("fontSize"), 10) || parseInt(c.css("fontSize"), 10) || 16 4276 }, getPageHeight: function (b) { 4277 return a(b).height() 4278 }, settings: {adjustOldDeltas: !0, normalizeOffset: !0} 4279 }; 4280 a.fn.extend({ 4281 mousewheel: function (a) { 4282 return a ? this.bind("mousewheel", a) : this.trigger("mousewheel") 4283 }, unmousewheel: function (a) { 4284 return this.unbind("mousewheel", a) 4285 } 4286 }) 4287 }); 4288 4289// Parse and Format Library 4290//http://www.xaprb.com/blog/2005/12/12/javascript-closures-for-runtime-efficiency/ 4291 /* 4292 * Copyright (C) 2004 Baron Schwartz <baron at sequent dot org> 4293 * 4294 * This program is free software; you can redistribute it and/or modify it 4295 * under the terms of the GNU Lesser General Public License as published by the
4296 * Free Software Foundation, version 2.1. 4297 * 4298 * This program is distributed in the hope that it will be useful, but WITHOUT 4299 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 4300 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 4301 * details. 4302 */ 4303 Date.parseFunctions = {count: 0}; 4304 Date.parseRegexes = []; 4305 Date.formatFunctions = {count: 0}; 4306 Date.prototype.dateFormat = function (b) { 4307 if (b == "unixtime") { 4308 return parseInt(this.getTime() / 1000); 4309 } 4310 if (Date.formatFunctions[b] == null) { 4311 Date.createNewFormat(b); 4312 } 4313 var a = Date.formatFunctions[b]; 4314 return this[a](); 4315 }; 4316 Date.createNewFormat = function (format) { 4317 var funcName = "format" + Date.formatFunctions.count++; 4318 Date.formatFunctions[format] = funcName; 4319 var codePrefix = "Date.prototype." + funcName + " = function() {return "; 4320 var code = ""; 4321 var special = false;
4322 var ch = ""; 4323 for (var i = 0; i < format.length; ++i) { 4324 ch = format.charAt(i); 4325 if (!special && ch == "\\") { 4326 special = true; 4327 } else { 4328 if (special) { 4329 special = false; 4330 code += "'" + String.escape(ch) + "' + "; 4331 } else { 4332 code += Date.getFormatCode(ch); 4333 } 4334 } 4335 } 4336 if (code.length == 0) { 4337 code = "\"\""; 4338 } else { 4339 code = code.substring(0, code.length - 3); 4340 } 4341 eval(codePrefix + code + ";}"); 4342 }; 4343 Date.getFormatCode = function (a) { 4344 switch (a) { 4345 case"d": 4346 return "String.leftPad(this.getDate(), 2, '0') + "; 4347 case"D": 4348 return "Date.dayNames[this.getDay()].substring(0, 3) + "; 4349 case"j": 4350 return "this.getDate() + "; 4351 case"l": 4352 return "Date.dayNames[this.getDay()] + "; 4353 case"S": 4354 return "this.getSuffix() + "; 4355 case"w": 4356 return "this.getDay() + "; 4357 case"z": 4358 return "this.getDayOfYear() + "; 4359 case"W": 4360 return "this.getWeekOfYear() + "; 4361 case"F": 4362 return "Date.monthNames[this.getMonth()] + "; 4363 case"m": 4364 return "String.leftPad(this.getMonth() + 1, 2, '0') + "; 4365 case"M": 4366 return "Date.monthNames[this.getMonth()].substring(0, 3) + "; 4367 case"n": 4368 return "(this.getMonth() + 1) + "; 4369 case"t": 4370 return "this.getDaysInMonth() + "; 4371 case"L": 4372 return "(this.isLeapYear() ? 1 : 0) + "; 4373 case"Y": 4374 return "this.getFullYear() + "; 4375 case"y": 4376 return "('' + this.getFullYear()).substring(2, 4) + "; 4377 case"a": 4378 return "(this.getHours() < 12 ? 'am' : 'pm') + "; 4379 case"A": 4380 return "(this.getHours() < 12 ? 'AM' : 'PM') + "; 4381 case"g": 4382 return "((this.getHours() %12) ? this.getHours() % 12 : 12) + "; 4383 case"G": 4384 return "this.getHours() + "; 4385 case"h": 4386 return "String.leftPad((this.getHours() %12) ? this.getHours() % 12 : 12, 2, '0') + "; 4387 case"H": 4388 return "String.leftPad(this.getHours(), 2, '0') + "; 4389 case"i": 4390 return "String.leftPad(this.getMinutes(), 2, '0') + "; 4391 case"s": 4392 return "String.leftPad(this.getSeconds(), 2, '0') + "; 4393 case"O": 4394 return "this.getGMTOffset() + "; 4395 case"T": 4396 return "this.getTimezone() + "; 4397 case"Z": 4398 return "(this.getTimezoneOffset() * -60) + "; 4399 default: 4400 return "'" + String.escape(a) + "' + "; 4401 } 4402 }; 4403 Date.parseDate = function (a, c) { 4404 if (c == "unixtime") { 4405 return new Date(!isNaN(parseInt(a)) ? parseInt(a) * 1000 : 0); 4406 } 4407 if (Date.parseFunctions[c] == null) { 4408 Date.createParser(c); 4409 } 4410 var b = Date.parseFunctions[c]; 4411 return Date[b](a); 4412 }; 4413 Date.createParser = function (format) { 4414 var funcName = "parse" + Date.parseFunctions.count++; 4415 var regexNum = Date.parseRegexes.length; 4416 var currentGroup = 1; 4417 Date.parseFunctions[format] = funcName; 4418 var code = "Date." + funcName + " = function(input) {\nvar y = -1, m = -1, d = -1, h = -1, i = -1, s = -1, z = -1;\nvar d = new Date();\ny = d.getFullYear();\nm = d.getMonth();\nd = d.getDate();\nvar results = input.match(Date.parseRegexes[" + regexNum + "]);\nif (results && results.length > 0) {"; 4419 var regex = ""; 4420 var special = false;
4421 var ch = ""; 4422 for (var i = 0; i < format.length; ++i) { 4423 ch = format.charAt(i); 4424 if (!special && ch == "\\") { 4425 special = true; 4426 } else { 4427 if (special) { 4428 special = false; 4429 regex += String.escape(ch); 4430 } else { 4431 obj = Date.formatCodeToRegex(ch, currentGroup); 4432 currentGroup += obj.g; 4433 regex += obj.s; 4434 if (obj.g && obj.c) { 4435 code += obj.c; 4436 } 4437 } 4438 } 4439 } 4440 code += "if (y > 0 && z > 0){\nvar doyDate = new Date(y,0);\ndoyDate.setDate(z);\nm = doyDate.getMonth();\nd = doyDate.getDate();\n}"; 4441 code += "if (y > 0 && m >= 0 && d > 0 && h >= 0 && i >= 0 && s >= 0)\n{return new Date(y, m, d, h, i, s);}\nelse if (y > 0 && m >= 0 && d > 0 && h >= 0 && i >= 0)\n{return new Date(y, m, d, h, i);}\nelse if (y > 0 && m >= 0 && d > 0 && h >= 0)\n{return new Date(y, m, d, h);}\nelse if (y > 0 && m >= 0 && d > 0)\n{return new Date(y, m, d);}\nelse if (y > 0 && m >= 0)\n{return new Date(y, m);}\nelse if (y > 0)\n{return new Date(y);}\n}return null;}"; 4442 Date.parseRegexes[regexNum] = new RegExp("^" + regex + "$", 'i'); 4443 eval(code); 4444 }; 4445 Date.formatCodeToRegex = function (b, a) { 4446 switch (b) { 4447 case"D": 4448 return {g: 0, c: null, s: "(?:Sun|Mon|Tue|Wed|Thu|Fri|Sat)"}; 4449 case"j": 4450 case"d": 4451 return {g: 1, c: "d = parseInt(results[" + a + "], 10);\n", s: "(\\d{1,2})"}; 4452 case"l": 4453 return {g: 0, c: null, s: "(?:" + Date.dayNames.join("|") + ")"}; 4454 case"S": 4455 return {g: 0, c: null, s: "(?:st|nd|rd|th)"}; 4456 case"w": 4457 return {g: 0, c: null, s: "\\d"}; 4458 case"z": 4459 return {g: 1, c: "z = parseInt(results[" + a + "], 10);\n", s: "(\\d{1,3})"}; 4460 case"W": 4461 return {g: 0, c: null, s: "(?:\\d{2})"}; 4462 case"F": 4463 return { 4464 g: 1, 4465 c: "m = parseInt(Date.monthNumbers[results[" + a + "].substring(0, 3)], 10);\n", 4466 s: "(" + Date.monthNames.join("|") + ")" 4467 }; 4468 case"M": 4469 return { 4470 g: 1, 4471 c: "m = parseInt(Date.monthNumbers[results[" + a + "]], 10);\n", 4472 s: "(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)" 4473 }; 4474 case"n": 4475 case"m": 4476 return {g: 1, c: "m = parseInt(results[" + a + "], 10) - 1;\n", s: "(\\d{1,2})"}; 4477 case"t": 4478 return {g: 0, c: null, s: "\\d{1,2}"}; 4479 case"L": 4480 return {g: 0, c: null, s: "(?:1|0)"}; 4481 case"Y": 4482 return {g: 1, c: "y = parseInt(results[" + a + "], 10);\n", s: "(\\d{4})"}; 4483 case"y": 4484 return { 4485 g: 1, 4486 c: "var ty = parseInt(results[" + a + "], 10);\ny = ty > Date.y2kYear ? 1900 + ty : 2000 + ty;\n", 4487 s: "(\\d{1,2})" 4488 }; 4489 case"a": 4490 return { 4491 g: 1, 4492 c: "if (results[" + a + "] == 'am') {\nif (h == 12) { h = 0; }\n} else { if (h < 12) { h += 12; }}", 4493 s: "(am|pm)" 4494 }; 4495 case"A": 4496 return { 4497 g: 1, 4498 c: "if (results[" + a + "] == 'AM') {\nif (h == 12) { h = 0; }\n} else { if (h < 12) { h += 12; }}", 4499 s: "(AM|PM)" 4500 }; 4501 case"g": 4502 case"G": 4503 case"h": 4504 case"H": 4505 return {g: 1, c: "h = parseInt(results[" + a + "], 10);\n", s: "(\\d{1,2})"}; 4506 case"i": 4507 return {g: 1, c: "i = parseInt(results[" + a + "], 10);\n", s: "(\\d{2})"}; 4508 case"s": 4509 return {g: 1, c: "s = parseInt(results[" + a + "], 10);\n", s: "(\\d{2})"}; 4510 case"O": 4511 return {g: 0, c: null, s: "[+-]\\d{4}"}; 4512 case"T": 4513 return {g: 0, c: null, s: "[A-Z]{3}"}; 4514 case"Z": 4515 return {g: 0, c: null, s: "[+-]\\d{1,5}"}; 4516 default: 4517 return {g: 0, c: null, s: String.escape(b)}; 4518 } 4519 }; 4520 Date.prototype.getTimezone = function () { 4521 return this.toString().replace(/^.*? ([A-Z]{3}) [0-9]{4}.*$/, "$1").replace(/^.*?\(([A-Z])[a-z]+ ([A-Z])[a-z]+ ([A-Z])[a-z]+\)$/, "$1$2$3"); 4522 }; 4523 Date.prototype.getGMTOffset = function () { 4524 return (this.getTimezoneOffset() > 0 ? "-" : "+") + String.leftPad(Math.floor(Math.abs(this.getTimezoneOffset()) / 60), 2, "0") + String.leftPad(Math.abs(this.getTimezoneOffset()) % 60, 2, "0"); 4525 }; 4526 Date.prototype.getDayOfYear = function () { 4527 var a = 0; 4528 Date.daysInMonth[1] = this.isLeapYear() ? 29 : 28; 4529 for (var b = 0; b < this.getMonth(); ++b) { 4530 a += Date.daysInMonth[b]; 4531 } 4532 return a + this.getDate(); 4533 }; 4534 Date.prototype.getWeekOfYear = function () { 4535 var b = this.getDayOfYear() + (4 - this.getDay()); 4536 var a = new Date(this.getFullYear(), 0, 1); 4537 var c = (7 - a.getDay() + 4); 4538 return String.leftPad(Math.ceil((b - c) / 7) + 1, 2, "0"); 4539 }; 4540 Date.prototype.isLeapYear = function () { 4541 var a = this.getFullYear(); 4542 return ((a & 3) == 0 && (a % 100 || (a % 400 == 0 && a))); 4543 }; 4544 Date.prototype.getFirstDayOfMonth = function () { 4545 var a = (this.getDay() - (this.getDate() - 1)) % 7; 4546 return (a < 0) ? (a + 7) : a; 4547 }; 4548 Date.prototype.getLastDayOfMonth = function () { 4549 var a = (this.getDay() + (Date.daysInMonth[this.getMonth()] - this.getDate())) % 7; 4550 return (a < 0) ? (a + 7) : a; 4551 }; 4552 Date.prototype.getDaysInMonth = function () { 4553 Date.daysInMonth[1] = this.isLeapYear() ? 29 : 28; 4554 return Date.daysInMonth[this.getMonth()]; 4555 }; 4556 Date.prototype.getSuffix = function () { 4557 switch (this.getDate()) { 4558 case 1: 4559 case 21: 4560 case 31: 4561 return "st"; 4562 case 2: 4563 case 22: 4564 return "nd"; 4565 case 3: 4566 case 23: 4567 return "rd"; 4568 default: 4569 return "th"; 4570 } 4571 }; 4572 String.escape = function (a) { 4573 return a.replace(/('|\\)/g, "\\$1"); 4574 }; 4575 String.leftPad = function (d, b, c) { 4576 var a = new String(d); 4577 if (c == null) { 4578 c = " "; 4579 } 4580 while (a.length < b) { 4581 a = c + a; 4582 } 4583 return a; 4584 }; 4585 Date.daysInMonth = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]; 4586 Date.monthNames = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "
vendor: 8,743 bytes, lines 4586-4808
4586November", "December"]; 4587 Date.dayNames = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]; 4588 Date.y2kYear = 50; 4589 Date.monthNumbers = { 4590 Jan: 0, 4591 Feb: 1, 4592 Mar: 2, 4593 Apr: 3, 4594 May: 4, 4595 Jun: 5, 4596 Jul: 6, 4597 Aug: 7, 4598 Sep: 8, 4599 Oct: 9, 4600 Nov: 10, 4601 Dec: 11 4602 }; 4603 Date.patterns = { 4604 ISO8601LongPattern: "Y-m-d H:i:s", 4605 ISO8601ShortPattern: "Y-m-d", 4606 ShortDatePattern: "n/j/Y", 4607 LongDatePattern: "l, F d, Y", 4608 FullDateTimePattern: "l, F d, Y g:i:s A", 4609 MonthDayPattern: "F d", 4610 ShortTimePattern: "g:i A", 4611 LongTimePattern: "g:i:s A", 4612 SortableDateTimePattern: "Y-m-d\\TH:i:s", 4613 UniversalSortableDateTimePattern: "Y-m-d H:i:sO", 4614 YearMonthPattern: "F, Y" 4615 }; 4616}()); 4617 4618 4619/** 4620 * Bootstrap Multiselect (https://github.com/davidstutz/bootstrap-multiselect) 4621 */ 4622!function ($) { 4623 "use strict";// jshint ;_; 4624 4625 if (typeof ko !== 'undefined' && ko.bindingHandlers && !ko.bindingHandlers.multiselect) { 4626 ko.bindingHandlers.multiselect = { 4627 after: ['options', 'value', 'selectedOptions', 'enable', 'disable'], 4628 4629 init: function (element, valueAccessor, allBindings, viewModel, bindingContext) { 4630 var $element = $(element); 4631 var config = ko.toJS(valueAccessor()); 4632 4633 $element.multiselect(config); 4634 4635 if (allBindings.has('options')) { 4636 var options = allBindings.get('options'); 4637 if (ko.isObservable(options)) { 4638 ko.computed({ 4639 read: function () { 4640 options(); 4641 setTimeout(function () { 4642 var ms = $element.data('multiselect'); 4643 if (ms) 4644 ms.updateOriginalOptions();//Not sure how beneficial this is. 4645 $element.multiselect('rebuild'); 4646 }, 1); 4647 }, 4648 disposeWhenNodeIsRemoved: element 4649 }); 4650 } 4651 } 4652 4653 //value and selectedOptions are two-way, so these will be triggered even by our own actions. 4654 //It needs some way to tell if they are triggered because of us or because of outside change. 4655 //It doesn't loop but it's a waste of processing. 4656 if (allBindings.has('value')) { 4657 var value = allBindings.get('value'); 4658 if (ko.isObservable(value)) { 4659 ko.computed({ 4660 read: function () { 4661 value(); 4662 setTimeout(function () { 4663 $element.multiselect('refresh'); 4664 }, 1); 4665 }, 4666 disposeWhenNodeIsRemoved: element 4667 }).extend({rateLimit: 100, notifyWhenChangesStop: true}); 4668 } 4669 } 4670 4671 //Switched from arrayChange subscription to general subscription using 'refresh'. 4672 //Not sure performance is any better using 'select' and 'deselect'. 4673 if (allBindings.has('selectedOptions')) { 4674 var selectedOptions = allBindings.get('selectedOptions'); 4675 if (ko.isObservable(selectedOptions)) { 4676 ko.computed({ 4677 read: function () { 4678 selectedOptions(); 4679 setTimeout(function () { 4680 $element.multiselect('refresh'); 4681 }, 1); 4682 }, 4683 disposeWhenNodeIsRemoved: element 4684 }).extend({rateLimit: 100, notifyWhenChangesStop: true}); 4685 } 4686 } 4687 4688 var setEnabled = function (enable) { 4689 setTimeout(function () { 4690 if (enable) 4691 $element.multiselect('enable'); 4692 else 4693 $element.multiselect('disable'); 4694 }); 4695 }; 4696 4697 if (allBindings.has('enable')) { 4698 var enable = allBindings.get('enable'); 4699 if (ko.isObservable(enable)) { 4700 ko.computed({ 4701 read: function () { 4702 setEnabled(enable()); 4703 }, 4704 disposeWhenNodeIsRemoved: element 4705 }).extend({rateLimit: 100, notifyWhenChangesStop: true}); 4706 } else { 4707 setEnabled(enable); 4708 } 4709 } 4710 4711 if (allBindings.has('disable')) { 4712 var disable = allBindings.get('disable'); 4713 if (ko.isObservable(disable)) { 4714 ko.computed({ 4715 read: function () { 4716 setEnabled(!disable()); 4717 }, 4718 disposeWhenNodeIsRemoved: element 4719 }).extend({rateLimit: 100, notifyWhenChangesStop: true}); 4720 } else { 4721 setEnabled(!disable); 4722 } 4723 } 4724 4725 ko.utils.domNodeDisposal.addDisposeCallback(element, function () { 4726 $element.multiselect('destroy'); 4727 }); 4728 }, 4729 4730 update: function (element, valueAccessor, allBindings, viewModel, bindingContext) { 4731 var $element = $(element); 4732 var config = ko.toJS(valueAccessor()); 4733 4734 $element.multiselect('setOptions', config); 4735 $element.multiselect('rebuild'); 4736 } 4737 }; 4738 } 4739 4740 function forEach(array, callback) { 4741 for (var index = 0; index < array.length; ++index) { 4742 callback(array[index], index); 4743 } 4744 } 4745 4746 /** 4747 * Constructor to create a new multiselect using the given select. 4748 * 4749 * @param {jQuery} select 4750 * @param {Object} options 4751 * @returns {Multiselect} 4752 */ 4753 function Multiselect(select, options) { 4754 4755 this.$select = $(select); 4756 this.options = this.mergeOptions($.extend({}, options, this.$select.data())); 4757 4758 // Placeholder via data attributes 4759 if (this.$select.attr("data-placeholder")) { 4760 this.options.nonSelectedText = this.$select.data("placeholder"); 4761 } 4762 4763 // Initialization. 4764 // We have to clone to create a new reference. 4765 this.originalOptions = this.$select.clone()[0].options; 4766 this.query = ''; 4767 this.searchTimeout = null; 4768 this.lastToggledInput = null; 4769 4770 this.options.multiple = this.$select.attr('multiple') === "multiple"; 4771 this.options.onChange = $.proxy(this.options.onChange, this); 4772 this.options.onSelectAll = $.proxy(this.options.onSelectAll, this); 4773 this.options.onDeselectAll = $.proxy(this.options.onDeselectAll, this); 4774 this.options.onDropdownShow = $.proxy(this.options.onDropdownShow, this); 4775 this.options.onDropdownHide = $.proxy(this.options.onDropdownHide, this); 4776 this.options.onDropdownShown = $.proxy(this.options.onDropdownShown, this); 4777 this.options.onDropdownHidden = $.proxy(this.options.onDropdownHidden, this); 4778 this.options.onInitialized = $.proxy(this.options.onInitialized, this); 4779 this.options.onFiltering = $.proxy(this.options.onFiltering, this); 4780 4781 // Build select all if enabled. 4782 this.buildContainer(); 4783 this.buildButton(); 4784 this.buildDropdown(); 4785 this.buildSelectAll(); 4786 this.buildDropdownOptions(); 4787 this.buildFilter(); 4788 4789 this.updateButtonText(); 4790 this.updateSelectAll(true); 4791 4792 if (this.options.enableClickableOptGroups && this.options.multiple) { 4793 this.updateOptGroups(); 4794 } 4795 4796 this.options.wasDisabled = this.$select.prop('disabled'); 4797 if (this.options.disableIfEmpty && $('option', this.$select).length <= 0) { 4798 this.disable(); 4799 } 4800 4801 this.$select.wrap('<span class="multiselect-native-select" />').after(this.$container); 4802 this.options.onInitialized(this.$select, this.$container); 4803 } 4804 4805 Multiselect.prototype = { 4806 4807 defaults: { 4808 /**
4809 * Default text function will either print 'None selected' in case no 4810 * option is selected or a list of the selected options up to a length 4811 * of 3 selected options. 4812 * 4813 * @param {jQuery} options 4814 * @param {jQuery} select 4815 * @returns {String} 4816 */ 4817 buttonText: function (options, select) { 4818 if (this.disabledText.length > 0 4819 && (select.prop('disabled') || (options.length == 0 && this.disableIfEmpty))) { 4820 4821 return this.disabledText; 4822 } 4823 else if (options.length === 0) { 4824 return this.nonSelectedText; 4825 } 4826 else if (this.allSelectedText 4827 && options.length === $('option', $(select)).length 4828 && $('option', $(select)).length !== 1 4829 && this.multiple) { 4830 4831 if (this.selectAllNumber) { 4832 return this.allSelectedText + ' (' + options.length + ')'; 4833 } 4834 else { 4835 return this.allSelectedText; 4836 } 4837 } 4838 else if (options.length > this.numberDisplayed) { 4839 return options.length + ' ' + this.nSelectedText; 4840 } 4841 else { 4842 var selected = ''; 4843 var delimiter = this.delimiterText; 4844 4845 options.each(function () { 4846 var label = ($(this).attr('label') !== undefined) ? $(this).attr('label') : $(this).text(); 4847 selected += label + delimiter; 4848 }); 4849 4850 return selected.substr(0, selected.length - this.delimiterText.length); 4851 } 4852 }, 4853 /** 4854 * Updates the title of the button similar to the buttonText function. 4855 * 4856 * @param {jQuery} options 4857 * @param {jQuery} select 4858 * @returns {@exp;selected@call;substr} 4859 */ 4860 buttonTitle: function (options, select) { 4861 if (options.length === 0) { 4862 return this.nonSelectedText; 4863 } 4864 else { 4865 var selected = ''; 4866 var delimiter = this.delimiterText; 4867 4868 options.each(function () { 4869 var label = ($(this).attr('label') !== undefined) ? $(this).attr('label') : $(this).text(); 4870 selected += label + delimiter; 4871 }); 4872 return selected.substr(0, selected.length - this.delimiterText.length); 4873 } 4874 }, 4875 checkboxName: function (option) { 4876 return false; // no checkbox name 4877 }, 4878 /** 4879 * Create a label. 4880 * 4881 * @param {jQuery} element 4882 * @returns {String} 4883 */ 4884 optionLabel: function (element) { 4885 return $(element).attr('label') || $(element).text(); 4886 }, 4887 /** 4888 * Create a class. 4889 * 4890 * @param {jQuery} element 4891 * @returns {String} 4892 */ 4893 optionClass: function (element) { 4894 return $(element).attr('class') || ''; 4895 }, 4896 /** 4897 * Triggered on change of the multiselect. 4898 * 4899 * Not triggered when selecting/deselecting options manually. 4900 * 4901 * @param {jQuery} option 4902 * @param {Boolean} checked 4903 */ 4904 onChange: function (option, checked) { 4905 4906 }, 4907 /** 4908 * Triggered when the dropdown is shown. 4909 * 4910 * @param {jQuery} event 4911 */ 4912 onDropdownShow: function (event) { 4913 4914 }, 4915 /** 4916 * Triggered when the dropdown is hidden. 4917 * 4918 * @param {jQuery} event 4919 */ 4920 onDropdownHide: function (event) { 4921 4922 }, 4923 /** 4924 * Triggered after the dropdown is shown.
4925 * 4926 * @param {jQuery} event 4927 */ 4928 onDropdownShown: function (event) { 4929 4930 }, 4931 /** 4932 * Triggered after the dropdown is hidden. 4933 * 4934 * @param {jQuery} event 4935 */ 4936 onDropdownHidden: function (event) { 4937 4938 }, 4939 /** 4940 * Triggered on select all. 4941 */ 4942 onSelectAll: function () { 4943 4944 }, 4945 /** 4946 * Triggered on deselect all. 4947 */ 4948 onDeselectAll: function () { 4949 4950 }, 4951 /** 4952 * Triggered after initializing. 4953 * 4954 * @param {jQuery} $select 4955 * @param {jQuery} $container 4956 */ 4957 onInitialized: function ($select, $container) { 4958 4959 }, 4960 /** 4961 * Triggered on filtering. 4962 * 4963 * @param {jQuery} $filter 4964 */ 4965 onFiltering: function ($filter) { 4966 4967 }, 4968 enableHTML: false, 4969 buttonClass: 'btn btn-default', 4970 inheritClass: false, 4971 buttonWidth: 'auto', 4972 buttonContainer: '<div class="btn-group" />', 4973 dropRight: false, 4974 dropUp: false, 4975 selectedClass: 'active', 4976 // Maximum height of the dropdown menu. 4977 // If maximum height is exceeded a scrollbar will be displayed. 4978 maxHeight: false, 4979 includeSelectAllOption: false, 4980 includeSelectAllIfMoreThan: 0, 4981 selectAllText: ' Select all', 4982 selectAllValue: 'multiselect-all', 4983 selectAllName: false, 4984 selectAllNumber: true, 4985 selectAllJustVisible: true, 4986 enableFiltering: false, 4987 enableCaseInsensitiveFiltering: false, 4988 enableFullValueFiltering: false, 4989 enableClickableOptGroups: false, 4990 enableCollapsibleOptGroups: false, 4991 filterPlaceholder: 'Search', 4992 // possible options: 'text', 'value', 'both' 4993 filterBehavior: 'text', 4994 includeFilterClearBtn: true, 4995 preventInputChangeEvent: false, 4996 nonSelectedText: 'None selected', 4997 nSelectedText: 'selected', 4998 allSelectedText: 'All selected', 4999 numberDisplayed: 3, 5000 disableIfEmpty: false, 5001 disabledText: '', 5002 delimiterText: ', ', 5003 templates: { 5004 button: '<button type="button" class="multiselect dropdown-toggle" data-toggle="dropdown"><span class="multiselect-selected-text"></span> <b class="caret"></b></button>', 5005 ul: '<ul class="multiselect-container dropdown-menu"></ul>', 5006 filter: '<li class="multiselect-item multiselect-filter"><div class="input-group"><span class="input-group-addon"><i class="glyphicon glyphicon-search"></i></span><input class="form-control multiselect-search" type="text"></div></li>', 5007 filterClearBtn: '<span class="input-group-btn"><button class="btn btn-default multiselect-clear-filter" type="button"><i class="glyphicon glyphicon-remove-circle"></i></button></span>', 5008 li: '<li><a tabindex="0"><label></label></a></li>', 5009 divider: '<li class="multiselect-item divider"></li>', 5010 liGroup: '<li class="multiselect-item multiselect-group"><label></label></li>' 5011 } 5012 }, 5013 5014 constructor: Multiselect, 5015 5016 /** 5017 * Builds the container of the multiselect. 5018 */ 5019 buildContainer: function () { 5020 this.$container = $(this.options.buttonContainer); 5021 this.$container.on('show.bs.dropdown', this.options.onDropdownShow); 5022 this.$container.on('hide.bs.dropdown', this.options.onDropdownHide); 5023 this.$container.on('shown.bs.dropdown', this.options.onDropdownShown); 5024 this.$container.on('hidden.bs.dropdown', this.options.onDropdownHidden); 5025 }, 5026 5027 /** 5028 * Builds the button of the multiselect. 5029 */ 5030 buildButton: function () { 5031 this.$button = $(this.options.templates.button).addClass(this.options.buttonClass); 5032 if (this.$select.attr('class') && this.options.inheritClass) { 5033 this.$button.addClass(this.$select.attr('class')); 5034 } 5035 // Adopt active state. 5036 if (this.$select.prop('disabled')) { 5037 this.disable(); 5038 } 5039 else { 5040 this.enable(); 5041 } 5042 5043 // Manually add button width if set. 5044 if (this.options.buttonWidth && this.options.buttonWidth !== 'auto') { 5045 this.$button.css({ 5046 'width': '100%', //this.options.buttonWidth, 5047 'overflow': 'hidden', 5048 'text-overflow': 'ellipsis' 5049 }); 5050 this.$container.css({ 5051 'width': this.options.buttonWidth 5052 }); 5053 } 5054 5055 // Keep the tab index from the select. 5056 var tabindex = this.$select.attr('tabindex'); 5057 if (tabindex) { 5058 this.$button.attr('tabindex', tabindex); 5059 } 5060 5061 this.$container.prepend(this.$button); 5062 }, 5063 5064 /** 5065 * Builds the ul representing the dropdown menu. 5066 */ 5067 buildDropdown: function () { 5068 5069 // Build ul. 5070 this.$ul = $(this.options.templates.ul); 5071 5072 if (this.options.dropRight) { 5073 this.$ul.addClass('pull-right'); 5074 } 5075 5076 // Set max height of dropdown menu to activate auto scrollbar. 5077 if (this.options.maxHeight) { 5078 // TODO: Add a class for this option to move the css declarations. 5079 this.$ul.css({ 5080 'max-height': this.options.maxHeight + 'px', 5081 'overflow-y': 'auto', 5082 'overflow-x': 'hidden' 5083 }); 5084 } 5085 5086 if (this.options.dropUp) { 5087 5088 var height = Math.min(this.options.maxHeight, $('option[data-role!="divider"]', this.$select).length * 26 + $('option[data-role="divider"]', this.$select).length * 19 + (this.options.includeSelectAllOption ? 26 : 0) + (this.options.enableFiltering || this.options.enableCaseInsensitiveFiltering ? 44 : 0)); 5089 var moveCalc = height + 34; 5090 5091 this.$ul.css({ 5092 'max-height': height + 'px', 5093 'overflow-y': 'auto', 5094 'overflow-x': 'hidden', 5095 'margin-top': "-" + moveCalc + 'px' 5096 }); 5097 } 5098 5099 this.$container.append(this.$ul); 5100 }, 5101 5102 /** 5103 * Build the dropdown options and binds all necessary events. 5104 * 5105 * Uses createDivider and createOptionValue to create the necessary options. 5106 */ 5107 buildDropdownOptions: function () { 5108 5109 this.$select.children().each($.proxy(function (index, element) { 5110 5111 var $element = $(element);
vendor: 4,154 bytes, lines 5112-5217
5112 // Support optgroups and options without a group simultaneously. 5113 var tag = $element.prop('tagName') 5114 .toLowerCase(); 5115 5116 if ($element.prop('value') === this.options.selectAllValue) { 5117 return; 5118 } 5119 5120 if (tag === 'optgroup') { 5121 this.createOptgroup(element); 5122 } 5123 else if (tag === 'option') { 5124 5125 if ($element.data('role') === 'divider') { 5126 this.createDivider(); 5127 } 5128 else { 5129 this.createOptionValue(element); 5130 } 5131 5132 } 5133 5134 // Other illegal tags will be ignored. 5135 }, this)); 5136 5137 // Bind the change event on the dropdown elements. 5138 $('li:not(.multiselect-group) input', this.$ul).on('change', $.proxy(function (event) { 5139 var $target = $(event.target); 5140 5141 var checked = $target.prop('checked') || false; 5142 var isSelectAllOption = $target.val() === this.options.selectAllValue; 5143 5144 // Apply or unapply the configured selected class. 5145 if (this.options.selectedClass) { 5146 if (checked) { 5147 $target.closest('li') 5148 .addClass(this.options.selectedClass); 5149 } 5150 else { 5151 $target.closest('li') 5152 .removeClass(this.options.selectedClass); 5153 } 5154 } 5155 5156 // Get the corresponding option. 5157 var value = $target.val(); 5158 var $option = this.getOptionByValue(value); 5159 5160 var $optionsNotThis = $('option', this.$select).not($option); 5161 var $checkboxesNotThis = $('input', this.$container).not($target); 5162 5163 if (isSelectAllOption) { 5164 5165 if (checked) { 5166 this.selectAll(this.options.selectAllJustVisible, true); 5167 } 5168 else { 5169 this.deselectAll(this.options.selectAllJustVisible, true); 5170 } 5171 } 5172 else { 5173 if (checked) { 5174 $option.prop('selected', true); 5175 5176 if (this.options.multiple) { 5177 // Simply select additional option. 5178 $option.prop('selected', true); 5179 } 5180 else { 5181 // Unselect all other options and corresponding checkboxes. 5182 if (this.options.selectedClass) { 5183 $($checkboxesNotThis).closest('li').removeClass(this.options.selectedClass); 5184 } 5185 5186 $($checkboxesNotThis).prop('checked', false); 5187 $optionsNotThis.prop('selected', false); 5188 5189 // It's a single selection, so close. 5190 this.$button.click(); 5191 } 5192 5193 if (this.options.selectedClass === "active") { 5194 $optionsNotThis.closest("a").css("outline", ""); 5195 } 5196 } 5197 else { 5198 // Unselect option. 5199 $option.prop('selected', false); 5200 } 5201 5202 // To prevent select all from firing onChange: #575 5203 this.options.onChange($option, checked); 5204 5205 // Do not update select all or optgroups on select all change! 5206 this.updateSelectAll(); 5207 5208 if (this.options.enableClickableOptGroups && this.options.multiple) { 5209 this.updateOptGroups(); 5210 } 5211 } 5212 5213 this.$select.change(); 5214 this.updateButtonText(); 5215 5216 if (this.options.preventInputChangeEvent) { 5217 return false;
5218 } 5219 }, this)); 5220 5221 $('li a', this.$ul).on('mousedown', function (e) { 5222 if (e.shiftKey) { 5223 // Prevent selecting text by Shift+click 5224 return false; 5225 } 5226 }); 5227 5228 $('li a', this.$ul).on('touchstart click', $.proxy(function (event) { 5229 event.stopPropagation(); 5230 5231 var $target = $(event.target); 5232 5233 if (event.shiftKey && this.options.multiple) { 5234 if ($target.is("label")) { // Handles checkbox selection manually (see https://github.com/davidstutz/bootstrap-multiselect/issues/431) 5235 event.preventDefault(); 5236 $target = $target.find("input"); 5237 $target.prop("checked", !$target.prop("checked")); 5238 } 5239 var checked = $target.prop('checked') || false; 5240 5241 if (this.lastToggledInput !== null && this.lastToggledInput !== $target) { // Make sure we actually have a range 5242 var from = $target.closest("li").index(); 5243 var to = this.lastToggledInput.closest("li").index(); 5244 5245 if (from > to) { // Swap the indices 5246 var tmp = to; 5247 to = from; 5248 from = tmp; 5249 } 5250 5251 // Make sure we grab all elements since slice excludes the last index 5252 ++to; 5253 5254 // Change the checkboxes and underlying options 5255 var range = this.$ul.find("li").slice(from, to).find("input"); 5256 5257 range.prop('checked', checked); 5258 5259 if (this.options.selectedClass) { 5260 range.closest('li') 5261 .toggleClass(this.options.selectedClass, checked); 5262 } 5263 5264 for (var i = 0, j = range.length; i < j; i++) { 5265 var $checkbox = $(range[i]); 5266 5267 var $option = this.getOptionByValue($checkbox.val()); 5268 5269 $option.prop('selected', checked); 5270 } 5271 } 5272 5273 // Trigger the select "change" event 5274 $target.trigger("change"); 5275 } 5276 5277 // Remembers last clicked option 5278 if ($target.is("input") && !$target.closest("li").is(".multiselect-item")) { 5279 this.lastToggledInput = $target; 5280 } 5281 5282 $target.blur(); 5283 }, this)); 5284 5285 // Keyboard support. 5286 this.$container.off('keydown.multiselect').on('keydown.multiselect', $.proxy(function (event) { 5287 if ($('input[type="text"]', this.$container).is(':focus')) { 5288 return; 5289 } 5290 5291 if (event.keyCode === 9 && this.$container.hasClass('open')) { 5292 this.$button.click(); 5293 } 5294 else { 5295 var $items = $(this.$container).find("li:not(.divider):not(.disabled) a").filter(":visible"); 5296 5297 if (!$items.length) { 5298 return; 5299 } 5300 5301 var index = $items.index($items.filter(':focus')); 5302 5303 // Navigation up. 5304 if (event.keyCode === 38 && index > 0) { 5305 index--; 5306 } 5307 // Navigate down. 5308 else if (event.keyCode === 40 && index < $items.length - 1) { 5309 index++; 5310 } 5311 else if (!~index) { 5312 index = 0; 5313 } 5314 5315 var $current = $items.eq(index); 5316 $current.focus(); 5317 5318 if (event.keyCode === 32 || event.keyCode === 13) { 5319 var $checkbox = $current.find('input'); 5320 5321 $checkbox.prop("checked", !$checkbox.prop("checked")); 5322 $checkbox.change(); 5323 } 5324 5325 event.stopPropagation(); 5326 event.preventDefault(); 5327 } 5328 }, this)); 5329 5330 if (this.options.enableClickableOptGroups && this.options.multiple) { 5331 $("li.multiselect-group input", this.$ul).on("change", $.proxy(function (event) { 5332 event.stopPropagation(); 5333 5334 var $target = $(event.target); 5335 var checked = $target.prop('checked') || false; 5336 5337 var $li = $(event.target).closest('li'); 5338 var $group = $li.nextUntil("li.multiselect-group") 5339 .not('.multiselect-filter-hidden') 5340 .not('.disabled'); 5341
5342 var $inputs = $group.find("input"); 5343 5344 var values = []; 5345 var $options = []; 5346 5347 if (this.options.selectedClass) { 5348 if (checked) { 5349 $li.addClass(this.options.selectedClass); 5350 } 5351 else { 5352 $li.removeClass(this.options.selectedClass); 5353 } 5354 } 5355 5356 $.each($inputs, $.proxy(function (index, input) { 5357 var value = $(input).val(); 5358 var $option = this.getOptionByValue(value); 5359 5360 if (checked) { 5361 $(input).prop('checked', true); 5362 $(input).closest('li') 5363 .addClass(this.options.selectedClass); 5364 5365 $option.prop('selected', true); 5366 } 5367 else { 5368 $(input).prop('checked', false); 5369 $(input).closest('li') 5370 .removeClass(this.options.selectedClass); 5371 5372 $option.prop('selected', false); 5373 } 5374 5375 $options.push(this.getOptionByValue(value)); 5376 }, this)) 5377 5378 // Cannot use select or deselect here because it would call updateOptGroups again. 5379 5380 this.options.onChange($options, checked); 5381 5382 this.updateButtonText(); 5383 this.updateSelectAll(); 5384 }, this)); 5385 } 5386 5387 if (this.options.enableCollapsibleOptGroups && this.options.multiple) { 5388 $("li.multiselect-group .caret-container", this.$ul).on("click", $.proxy(function (event) { 5389 var $li = $(event.target).closest('li'); 5390 var $inputs = $li.nextUntil("li.multiselect-group") 5391 .not('.multiselect-filter-hidden'); 5392 5393 var visible = true; 5394 $inputs.each(function () { 5395 visible = visible && $(this).is(':visible'); 5396 }); 5397 5398 if (visible) { 5399 $inputs.hide() 5400 .addClass('multiselect-collapsible-hidden'); 5401 } 5402 else { 5403 $inputs.show() 5404 .removeClass('multiselect-collapsible-hidden'); 5405 } 5406 }, this)); 5407 5408 $("li.multiselect-all", this.$ul).css('background', '#f3f3f3').css('border-bottom', '1px solid #eaeaea'); 5409 $("li.multiselect-all > a > label.checkbox", this.$ul).css('padding', '3px 20px 3px 35px'); 5410 $("li.multiselect-group > a > input", this.$ul).css('margin', '4px 0px 5px -20px'); 5411 } 5412 }, 5413 5414 /** 5415 * Create an option using the given select option. 5416 * 5417 * @param {jQuery} element 5418 */ 5419 createOptionValue: function (element) { 5420 var $element = $(element); 5421 if ($element.is(':selected')) { 5422 $element.prop('selected', true); 5423 } 5424 5425 // Support the label attribute on options. 5426 var label = this.options.optionLabel(element); 5427 var classes = this.options.optionClass(element); 5428 var value = $element.val(); 5429 var inputType = this.options.multiple ? "checkbox" : "radio"; 5430 5431 var $li = $(this.options.templates.li); 5432 var $label = $('label', $li); 5433 $label.addClass(inputType);
5434 $li.addClass(classes); 5435 5436 if (this.options.enableHTML) { 5437 $label.html(" " + label); 5438 } 5439 else { 5440 $label.text(" " + label); 5441 } 5442 5443 var $checkbox = $('<input/>').attr('type', inputType); 5444 5445 var name = this.options.checkboxName($element); 5446 if (name) { 5447 $checkbox.attr('name', name); 5448 } 5449 5450 $label.prepend($checkbox); 5451 5452 var selected = $element.prop('selected') || false; 5453 $checkbox.val(value); 5454 5455 if (value === this.options.selectAllValue) { 5456 $li.addClass("multiselect-item multiselect-all"); 5457 $checkbox.parent().parent() 5458 .addClass('multiselect-all'); 5459 } 5460 5461 $label.attr('title', $element.attr('title')); 5462 5463 this.$ul.append($li); 5464 5465 if ($element.is(':disabled')) { 5466 $checkbox.attr('disabled', 'disabled') 5467 .prop('disabled', true) 5468 .closest('a') 5469 .attr("tabindex", "-1") 5470 .closest('li') 5471 .addClass('disabled'); 5472 } 5473 5474 $checkbox.prop('checked', selected); 5475 5476 if (selected && this.options.selectedClass) { 5477 $checkbox.closest('li') 5478 .addClass(this.options.selectedClass); 5479 } 5480 }, 5481 5482 /** 5483 * Creates a divider using the given select option. 5484 * 5485 * @param {jQuery} element 5486 */ 5487 createDivider: function (element) { 5488 var $divider = $(this.options.templates.divider); 5489 this.$ul.append($divider); 5490 }, 5491 5492 /** 5493 * Creates an optgroup. 5494 * 5495 * @param {jQuery} group 5496 */ 5497 createOptgroup: function (group) { 5498 var label = $(group).attr("label"); 5499 var value = $(group).attr("value"); 5500 var $li = $('<li class="multiselect-item multiselect-group"><a href="javascript:void(0);"><label><b></b></label></a></li>'); 5501 5502 var classes = this.options.optionClass(group);
5503 $li.addClass(classes); 5504 5505 if (this.options.enableHTML) { 5506 $('label b', $li).html(" " + label); 5507 } 5508 else { 5509 $('label b', $li).text(" " + label); 5510 } 5511 5512 if (this.options.enableCollapsibleOptGroups && this.options.multiple) { 5513 $('a', $li).append('<span class="caret-container"><b class="caret"></b></span>'); 5514 } 5515 5516 if (this.options.enableClickableOptGroups && this.options.multiple) { 5517 $('a label', $li).prepend('<input type="checkbox" value="' + value + '"/>'); 5518 } 5519 5520 if ($(group).is(':disabled')) { 5521 $li.addClass('disabled'); 5522 } 5523 5524 this.$ul.append($li); 5525 5526 $("option", group).each($.proxy(function ($, group) { 5527 this.createOptionValue(group); 5528 }, this)) 5529 }, 5530 5531 /** 5532 * Build the select all. 5533 * 5534 * Checks if a select all has already been created. 5535 */ 5536 buildSelectAll: function () { 5537 if (typeof this.options.selectAllValue === 'number') { 5538 this.options.selectAllValue = this.options.selectAllValue.toString(); 5539 } 5540 5541 var alreadyHasSelectAll = this.hasSelectAll(); 5542 5543 if (!alreadyHasSelectAll && this.options.includeSelectAllOption && this.options.multiple 5544 && $('option', this.$select).length > this.options.includeSelectAllIfMoreThan) { 5545 5546 // Check whether to add a divider after the select all. 5547 if (this.options.includeSelectAllDivider) { 5548 this.$ul.prepend($(this.options.templates.divider)); 5549 } 5550 5551 var $li = $(this.options.templates.li); 5552 $('label', $li).addClass("checkbox"); 5553 5554 if (this.options.enableHTML) { 5555 $('label', $li).html(" " + this.options.selectAllText); 5556 } 5557 else { 5558 $('label', $li).text(" " + this.options.selectAllText); 5559 } 5560 5561 if (this.options.selectAllName) { 5562 $('label', $li).prepend('<input type="checkbox" name="' + this.options.selectAllName + '" />'); 5563 } 5564 else { 5565 $('label', $li).prepend('<input type="checkbox" />'); 5566 } 5567 5568 var $checkbox = $('input', $li); 5569 $checkbox.val(this.options.selectAllValue); 5570 5571 $li.addClass("multiselect-item multiselect-all"); 5572 $checkbox.parent().parent() 5573 .addClass('multiselect-all'); 5574 5575 this.$ul.prepend($li); 5576 5577 $checkbox.prop('checked', false); 5578 } 5579 }, 5580 5581 /** 5582 * Builds the filter. 5583 */ 5584 buildFilter: function () { 5585 5586 // Build filter if filtering OR case insensitive filtering is enabled and the number of options exceeds (or equals) enableFilterLength. 5587 if (this.options.enableFiltering || this.options.enableCaseInsensitiveFiltering) { 5588 var enableFilterLength = Math.max(this.options.enableFiltering, this.options.enableCaseInsensitiveFiltering); 5589 5590 if (this.$select.find('option').length >= enableFilterLength) { 5591 5592 this.$filter = $(this.options.templates.filter); 5593 $('input', this.$filter).attr('placeholder', this.options.filterPlaceholder); 5594 5595 // Adds optional filter clear button 5596 if (this.options.includeFilterClearBtn) { 5597 var clearBtn = $(this.options.templates.filterClearBtn); 5598 clearBtn.on('click', $.proxy(function (event) { 5599 clearTimeout(this.searchTimeout); 5600 5601 this.$filter.find('.multiselect-search').val(''); 5602 $('li', this.$ul).show().removeClass('multiselect-filter-hidden'); 5603 5604 this.updateSelectAll(); 5605 5606 if (this.options.enableClickableOptGroups && this.options.multiple) { 5607 this.updateOptGroups(); 5608 } 5609 5610 }, this)); 5611 this.$filter.find('.input-group').append(clearBtn); 5612 } 5613 5614 this.$ul.prepend(this.$filter); 5615 5616 this.$filter.val(this.query).on('click', function (event) { 5617 event.stopPropagation(); 5618 }).on('input keydown', $.proxy(function (event) { 5619 // Cancel enter key default behaviour 5620 if (event.which === 13) { 5621 event.preventDefault(); 5622 } 5623 5624 // This is useful to catch "keydown" events after the browser has updated the control. 5625 clearTimeout(this.searchTimeout); 5626 5627 this.searchTimeout = this.asyncFunction($.proxy(function () { 5628 5629 if (this.query !== event.target.value) { 5630 this.query = event.target.value; 5631 5632 var currentGroup, currentGroupVisible; 5633 $.each($('li', this.$ul), $.proxy(function (index, element) { 5634 var value = $('input', element).length > 0 ? $('input', element).val() : ""; 5635 var text = $('label', element).text(); 5636 5637 var filterCandidate = ''; 5638 if ((this.options.filterBehavior === 'text')) { 5639 filterCandidate = text; 5640 } 5641 else if ((this.options.filterBehavior === 'value')) { 5642 filterCandidate = value; 5643 } 5644 else if (this.options.filterBehavior === 'both') { 5645 filterCandidate = text + '\n' + value; 5646 } 5647 5648 if (value !== this.options.selectAllValue && text) { 5649 5650 // By default lets assume that element is not 5651 // interesting for this search. 5652 var showElement = false;
5653 5654 if (this.options.enableCaseInsensitiveFiltering) { 5655 filterCandidate = filterCandidate.toLowerCase(); 5656 this.query = this.query.toLowerCase(); 5657 } 5658 5659 if (this.options.enableFullValueFiltering && this.options.filterBehavior !== 'both') { 5660 var valueToMatch = filterCandidate.trim().substring(0, this.query.length); 5661 if (this.query.indexOf(valueToMatch) > -1) { 5662 showElement = true; 5663 } 5664 } 5665 else if (filterCandidate.indexOf(this.query) > -1) { 5666 showElement = true; 5667 } 5668 5669 // Toggle current element (group or group item) according to showElement boolean. 5670 $(element).toggle(showElement) 5671 .toggleClass('multiselect-filter-hidden', !showElement); 5672 5673 // Differentiate groups and group items. 5674 if ($(element).hasClass('multiselect-group')) { 5675 // Remember group status. 5676 currentGroup = element; 5677 currentGroupVisible = showElement; 5678 } 5679 else { 5680 // Show group name when at least one of its items is visible. 5681 if (showElement) { 5682 $(currentGroup).show() 5683 .removeClass('multiselect-filter-hidden'); 5684 } 5685 5686 // Show all group items when group name satisfies filter. 5687 if (!showElement && currentGroupVisible) { 5688 $(element).show() 5689 .removeClass('multiselect-filter-hidden'); 5690 } 5691 } 5692 } 5693 }, this)); 5694 } 5695 5696 this.updateSelectAll(); 5697 5698 if (this.options.enableClickableOptGroups && this.options.multiple) { 5699 this.updateOptGroups(); 5700 } 5701 5702 this.options.onFiltering(event.target); 5703 5704 }, this), 300, this); 5705 }, this)); 5706 } 5707 } 5708 }, 5709 5710 /** 5711 * Unbinds the whole plugin. 5712 */ 5713 destroy: function () { 5714 this.$container.remove(); 5715 this.$select.show(); 5716 5717 // reset original state 5718 this.$select.prop('disabled', this.options.wasDisabled); 5719 5720 this.$select.data('multiselect', null); 5721 }, 5722 5723 /** 5724 * Refreshs the multiselect based on the selected options of the select. 5725 */ 5726 refresh: function () { 5727 var inputs = $.map($('li input', this.$ul), $); 5728 5729 $('option', this.$select).each($.proxy(function (index, element) { 5730 var $elem = $(element); 5731 var value = $elem.val(); 5732 var $input; 5733 for (var i = inputs.length; 0 < i--; /**/) { 5734 if (value !== ($input = inputs[i]).val()) 5735 continue; // wrong li 5736 5737 if ($elem.is(':selected')) { 5738 $input.prop('checked', true); 5739 5740 if (this.options.selectedClass) { 5741 $input.closest('li') 5742 .addClass(this.options.selectedClass); 5743 } 5744 } 5745 else { 5746 $input.prop('checked', false); 5747 5748 if (this.options.selectedClass) { 5749 $input.closest('li') 5750 .removeClass(this.options.selectedClass); 5751 } 5752 } 5753 5754 if ($elem.is(":disabled")) { 5755 $input.attr('disabled', 'disabled') 5756 .prop('disabled', true) 5757 .closest('li') 5758 .addClass('disabled'); 5759 } 5760 else { 5761 $input.prop('disabled', false) 5762 .closest('li') 5763 .removeClass('disabled'); 5764 } 5765 break; // assumes unique values 5766 } 5767 }, this)); 5768 5769 this.updateButtonText(); 5770 this.updateSelectAll(); 5771 5772 if (this.options.enableClickableOptGroups && this.options.multiple) { 5773 this.updateOptGroups(); 5774 } 5775 }, 5776 5777 /** 5778 * Select all options of the given values. 5779 * 5780 * If triggerOnChange is set to true, the on change event is triggered if 5781 * and only if one value is passed. 5782 * 5783 * @param {Array} selectValues 5784 * @param {Boolean} triggerOnChange 5785 */ 5786 select: function (selectValues, triggerOnChange) { 5787 if (!$.isArray(selectValues)) { 5788 selectValues = [selectValues]; 5789 } 5790 5791 for (var i = 0; i < selectValues.length; i++) { 5792 var value = selectValues[i]; 5793 5794 if (value === null || value === undefined) { 5795 continue; 5796 } 5797 5798 var $option = this.getOptionByValue(value); 5799 var $checkbox = this.getInputByValue(value); 5800 5801 if ($option === undefined || $checkbox === undefined) { 5802 continue; 5803 } 5804 5805 if (!this.options.multiple) { 5806 this.deselectAll(false); 5807 } 5808 5809 if (this.options.selectedClass) { 5810 $checkbox.closest('li') 5811 .addClass(this.options.selectedClass); 5812 } 5813 5814 $checkbox.prop('checked', true); 5815 $option.prop('selected', true); 5816 5817 if (triggerOnChange) { 5818 this.options.onChange($option, true); 5819 } 5820 } 5821 5822 this.updateButtonText(); 5823 this.updateSelectAll(); 5824 5825 if (this.options.enableClickableOptGroups && this.options.multiple) { 5826 this.updateOptGroups(); 5827 } 5828 }, 5829 5830 /** 5831 * Clears all selected items. 5832 */ 5833 clearSelection: function () { 5834 this.deselectAll(false); 5835 this.updateButtonText(); 5836 this.updateSelectAll(); 5837 5838 if (this.options.enableClickableOptGroups && this.options.multiple) { 5839 this.updateOptGroups(); 5840 } 5841 }, 5842 5843 /** 5844 * Deselects all options of the given values. 5845 * 5846 * If triggerOnChange is set to true, the on change event is triggered, if 5847 * and only if one value is passed. 5848 * 5849 * @param {Array} deselectValues 5850 * @param {Boolean} triggerOnChange 5851 */ 5852 deselect: function (deselectValues, triggerOnChange) { 5853 if (!$.isArray(deselectValues)) { 5854 deselectValues = [deselectValues]; 5855 } 5856 5857 for (var i = 0; i < deselectValues.length; i++) { 5858 var value = deselectValues[i]; 5859 5860 if (value === null || value === undefined) { 5861 continue; 5862 } 5863 5864 var $option = this.getOptionByValue(value); 5865 var $checkbox = this.getInputByValue(value); 5866 5867 if ($option === undefined || $checkbox === undefined) { 5868 continue; 5869 } 5870 5871 if (this.options.selectedClass) { 5872 $checkbox.closest('li') 5873 .removeClass(this.options.selectedClass); 5874 } 5875 5876 $checkbox.prop('checked', false); 5877 $option.prop('selected', false); 5878 5879 if (triggerOnChange) { 5880 this.options.onChange($option, false); 5881 } 5882 } 5883 5884 this.updateButtonText(); 5885 this.updateSelectAll(); 5886 5887 if (this.options.enableClickableOptGroups && this.options.multiple) { 5888 this.updateOptGroups(); 5889 } 5890 }, 5891 5892 /** 5893 * Selects all enabled & visible options. 5894 * 5895 * If justVisible is true or not specified, only visible options are selected. 5896 * 5897 * @param {Boolean} justVisible 5898 * @param {Boolean} triggerOnSelectAll 5899 */ 5900 selectAll: function (justVisible, triggerOnSelectAll) { 5901 5902 var justVisible = typeof justVisible === 'undefined' ? true : justVisible; 5903 var allLis = $("li:not(.divider):not(.disabled):not(.multiselect-group)", this.$ul); 5904 var visibleLis = $("li:not(.divider):not(.disabled):not(.multiselect-group):not(.multiselect-filter-hidden):not(.multiselect-collapisble-hidden)", this.$ul).filter(':visible'); 5905 5906 if (justVisible) { 5907 $('input:enabled', visibleLis).prop('checked', true); 5908 visibleLis.addClass(this.options.selectedClass); 5909 5910 $('input:enabled', visibleLis).each($.proxy(function (index, element) { 5911 var value = $(element).val(); 5912 var option = this.getOptionByValue(value); 5913 $(option).prop('selected', true); 5914 }, this)); 5915 } 5916 else { 5917 $('input:enabled', allLis).prop('checked', true); 5918 allLis.addClass(this.options.selectedClass); 5919 5920 $('input:enabled', allLis).each($.proxy(function (index, element) { 5921 var value = $(element).val(); 5922 var option = this.getOptionByValue(value); 5923 $(option).prop('selected', true); 5924 }, this)); 5925 } 5926 5927 $('li input[value="' + this.options.selectAllValue + '"]', this.$ul).prop('checked', true); 5928 5929 if (this.options.enableClickableOptGroups && this.options.multiple) { 5930 this.updateOptGroups(); 5931 } 5932 5933 if (triggerOnSelectAll) { 5934 this.options.onSelectAll(); 5935 } 5936 }, 5937 5938 /** 5939 * Deselects all options. 5940 * 5941 * If justVisible is true or not specified, only visible options are deselected. 5942 * 5943 * @param {Boolean} justVisible 5944 */ 5945 deselectAll: function (justVisible, triggerOnDeselectAll) { 5946 5947 var justVisible = typeof justVisible === 'undefined' ? true : justVisible; 5948 var allLis = $("li:not(.divider):not(.disabled):not(.multiselect-group)", this.$ul); 5949 var visibleLis = $("li:not(.divider):not(.disabled):not(.multiselect-group):not(.multiselect-filter-hidden):not(.multiselect-collapisble-hidden)", this.$ul).filter(':visible'); 5950 5951 if (justVisible) { 5952 $('input[type="checkbox"]:enabled', visibleLis).prop('checked', false); 5953 visibleLis.removeClass(this.options.selectedClass); 5954 5955 $('input[type="checkbox"]:enabled', visibleLis).each($.proxy(function (index, element) { 5956 var value = $(element).val(); 5957 var option = this.getOptionByValue(value); 5958 $(option).prop('selected', false); 5959 }, this)); 5960 } 5961 else { 5962 $('input[type="checkbox"]:enabled', allLis).prop('checked', false); 5963 allLis.removeClass(this.options.selectedClass); 5964 5965 $('input[type="checkbox"]:enabled', allLis).each($.proxy(function (index, element) { 5966 var value = $(element).val(); 5967 var option = this.getOptionByValue(value); 5968 $(option).prop('selected', false); 5969 }, this)); 5970 } 5971 5972 $('li input[value="' + this.options.selectAllValue + '"]', this.$ul).prop('checked', false); 5973 5974 if (this.options.enableClickableOptGroups && this.options.multiple) { 5975 this.updateOptGroups(); 5976 } 5977 5978 if (triggerOnDeselectAll) { 5979 this.options.onDeselectAll(); 5980 } 5981 }, 5982 5983 /** 5984 * Rebuild the plugin. 5985 * 5986 * Rebuilds the dropdown, the filter and the select all option. 5987 */ 5988 rebuild: function () { 5989 this.$ul.html(''); 5990 5991 // Important to distinguish between radios and checkboxes. 5992 this.options.multiple = this.$select.attr('multiple') === "multiple"; 5993 5994 this.buildSelectAll(); 5995 this.buildDropdownOptions(); 5996 this.buildFilter(); 5997 5998 this.updateButtonText(); 5999 this.updateSelectAll(true); 6000 6001 if (this.options.enableClickableOptGroups && this.options.multiple) { 6002 this.updateOptGroups(); 6003 } 6004 6005 if (this.options.disableIfEmpty && $('option', this.$select).length <= 0) { 6006 this.disable(); 6007 } 6008 else { 6009 this.enable(); 6010 } 6011 6012 if (this.options.dropRight) { 6013 this.$ul.addClass('pull-right'); 6014 } 6015 }, 6016 6017 /** 6018 * The provided data will be used to build the dropdown. 6019 */ 6020 dataprovider: function (dataprovider) { 6021 6022 var groupCounter = 0; 6023 var $select = this.$select.empty(); 6024 6025 $.each(dataprovider, function (index, option) { 6026 var $tag; 6027 6028 if ($.isArray(option.children)) { // create optiongroup tag 6029 groupCounter++; 6030 6031 $tag = $('<optgroup/>').attr({ 6032 label: option.label || 'Group ' + groupCounter, 6033 disabled: !!option.disabled 6034 }); 6035
vendor: 5,389 bytes, lines 6036-6184
6036 forEach(option.children, function (subOption) { // add children option tags 6037 var attributes = { 6038 value: subOption.value, 6039 label: subOption.label || subOption.value, 6040 title: subOption.title, 6041 selected: !!subOption.selected, 6042 disabled: !!subOption.disabled 6043 }; 6044 6045 //Loop through attributes object and add key-value for each attribute 6046 for (var key in subOption.attributes) { 6047 attributes['data-' + key] = subOption.attributes[key]; 6048 } 6049 //Append original attributes + new data attributes to option 6050 $tag.append($('<option/>').attr(attributes)); 6051 }); 6052 } 6053 else { 6054 6055 var attributes = { 6056 'value': option.value, 6057 'label': option.label || option.value, 6058 'title': option.title, 6059 'class': option.class, 6060 'selected': !!option.selected, 6061 'disabled': !!option.disabled 6062 }; 6063 //Loop through attributes object and add key-value for each attribute 6064 for (var key in option.attributes) { 6065 attributes['data-' + key] = option.attributes[key]; 6066 } 6067 //Append original attributes + new data attributes to option 6068 $tag = $('<option/>').attr(attributes); 6069 6070 $tag.text(option.label || option.value); 6071 } 6072 6073 $select.append($tag); 6074 }); 6075 6076 this.rebuild(); 6077 }, 6078 6079 /** 6080 * Enable the multiselect. 6081 */ 6082 enable: function () { 6083 this.$select.prop('disabled', false); 6084 this.$button.prop('disabled', false) 6085 .removeClass('disabled'); 6086 }, 6087 6088 /** 6089 * Disable the multiselect. 6090 */ 6091 disable: function () { 6092 this.$select.prop('disabled', true); 6093 this.$button.prop('disabled', true) 6094 .addClass('disabled'); 6095 }, 6096 6097 /** 6098 * Set the options. 6099 * 6100 * @param {Array} options 6101 */ 6102 setOptions: function (options) { 6103 this.options = this.mergeOptions(options); 6104 }, 6105 6106 /** 6107 * Merges the given options with the default options. 6108 * 6109 * @param {Array} options 6110 * @returns {Array} 6111 */ 6112 mergeOptions: function (options) { 6113 return $.extend(true, {}, this.defaults, this.options, options); 6114 }, 6115 6116 /** 6117 * Checks whether a select all checkbox is present. 6118 * 6119 * @returns {Boolean} 6120 */ 6121 hasSelectAll: function () { 6122 return $('li.multiselect-all', this.$ul).length > 0; 6123 }, 6124 6125 /** 6126 * Update opt groups. 6127 */ 6128 updateOptGroups: function () { 6129 var $groups = $('li.multiselect-group', this.$ul) 6130 var selectedClass = this.options.selectedClass; 6131 6132 $groups.each(function () { 6133 var $options = $(this).nextUntil('li.multiselect-group') 6134 .not('.multiselect-filter-hidden') 6135 .not('.disabled'); 6136 6137 var checked = true; 6138 $options.each(function () { 6139 var $input = $('input', this); 6140 6141 if (!$input.prop('checked')) { 6142 checked = false; 6143 } 6144 }); 6145 6146 if (selectedClass) { 6147 if (checked) { 6148 $(this).addClass(selectedClass); 6149 } 6150 else { 6151 $(this).removeClass(selectedClass); 6152 } 6153 } 6154 6155 $('input', this).prop('checked', checked); 6156 }); 6157 }, 6158 6159 /** 6160 * Updates the select all checkbox based on the currently displayed and selected checkboxes. 6161 */ 6162 updateSelectAll: function (notTriggerOnSelectAll) { 6163 if (this.hasSelectAll()) { 6164 var allBoxes = $("li:not(.multiselect-item):not(.multiselect-filter-hidden):not(.multiselect-group):not(.disabled) input:enabled", this.$ul); 6165 var allBoxesLength = allBoxes.length; 6166 var checkedBoxesLength = allBoxes.filter(":checked").length; 6167 var selectAllLi = $("li.multiselect-all", this.$ul); 6168 var selectAllInput = selectAllLi.find("input"); 6169 6170 if (checkedBoxesLength > 0 && checkedBoxesLength === allBoxesLength) { 6171 selectAllInput.prop("checked", true); 6172 selectAllLi.addClass(this.options.selectedClass); 6173 } 6174 else { 6175 selectAllInput.prop("checked", false); 6176 selectAllLi.removeClass(this.options.selectedClass); 6177 } 6178 } 6179 }, 6180 6181 /** 6182 * Update the button text and its title based on the currently selected options. 6183 */ 6184 updateButtonText: function () {
6185 var options = this.getSelected(); 6186 6187 // First update the displayed button text. 6188 if (this.options.enableHTML) { 6189 $('.multiselect .multiselect-selected-text', this.$container).html(this.options.buttonText(options, this.$select)); 6190 } 6191 else { 6192 $('.multiselect .multiselect-selected-text', this.$container).text(this.options.buttonText(options, this.$select)); 6193 } 6194 6195 // Now update the title attribute of the button. 6196 $('.multiselect', this.$container).attr('title', this.options.buttonTitle(options, this.$select)); 6197 }, 6198 6199 /** 6200 * Get all selected options. 6201 * 6202 * @returns {jQUery} 6203 */ 6204 getSelected: function () { 6205 return $('option', this.$select).filter(":selected"); 6206 }, 6207 6208 /** 6209 * Gets a select option by its value. 6210 * 6211 * @param {String} value 6212 * @returns {jQuery} 6213 */ 6214 getOptionByValue: function (value) { 6215 6216 var options = $('option', this.$select); 6217 var valueToCompare = value.toString(); 6218 6219 for (var i = 0; i < options.length; i = i + 1) { 6220 var option = options[i]; 6221 if (option.value === valueToCompare) { 6222 return $(option); 6223 } 6224 } 6225 }, 6226 6227 /** 6228 * Get the input (radio/checkbox) by its value. 6229 * 6230 * @param {String} value 6231 * @returns {jQuery} 6232 */ 6233 getInputByValue: function (value) { 6234 6235 var checkboxes = $('li input:not(.multiselect-search)', this.$ul); 6236 var valueToCompare = value.toString(); 6237 6238 for (var i = 0; i < checkboxes.length; i = i + 1) { 6239 var checkbox = checkboxes[i]; 6240 if (checkbox.value === valueToCompare) { 6241 return $(checkbox); 6242 } 6243 } 6244 }, 6245 6246 /** 6247 * Used for knockout integration. 6248 */ 6249 updateOriginalOptions: function () { 6250 this.originalOptions = this.$select.clone()[0].options; 6251 }, 6252 6253 asyncFunction: function (callback, timeout, self) { 6254 var args = Array.prototype.slice.call(arguments, 3); 6255 return setTimeout(function () { 6256 callback.apply(self || window, args); 6257 }, timeout); 6258 }, 6259 6260 setAllSelectedText: function (allSelectedText) { 6261 this.options.allSelectedText = allSelectedText; 6262 this.updateButtonText(); 6263 } 6264 }; 6265 6266 $.fn.multiselect = function (option, parameter, extraOptions) { 6267 return this.each(function () { 6268 var data = $(this).data('multiselect'); 6269 var options = typeof option === 'object' && option; 6270 6271 // Initialize the multiselect. 6272 if (!data) { 6273 data = new Multiselect(this, options); 6274 $(this).data('multiselect', data); 6275 } 6276 6277 // Call multiselect method. 6278 if (typeof option === 'string') { 6279 data[option](parameter, extraOptions); 6280 6281 if (option === 'destroy') { 6282 $(this).data('multiselect', false); 6283 } 6284 } 6285 }); 6286 }; 6287 6288 $.fn.multiselect.Constructor = Multiselect; 6289 6290 $(function () { 6291 $("select[data-role=multiselect]").multiselect(); 6292 }); 6293 6294}(window.jQuery);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.