Line 11,527: | Line 11,527: | ||
} | } | ||
</style> | </style> | ||
+ | |||
+ | <script type="text/javascript"> | ||
+ | /*! | ||
+ | * Bootstrap v3.3.6 (http://getbootstrap.com) | ||
+ | * Copyright 2011-2015 Twitter, Inc. | ||
+ | * Licensed under the MIT license | ||
+ | */ | ||
+ | if("undefined"==typeof jQuery)throw new Error("Bootstrap's JavaScript requires jQuery");+function(a){"use strict";var b=a.fn.jquery.split(" ")[0].split(".");if(b[0]<2&&b[1]<9||1==b[0]&&9==b[1]&&b[2]<1||b[0]>2)throw new Error("Bootstrap's JavaScript requires jQuery version 1.9.1 or higher, but lower than version 3")}(jQuery),+function(a){"use strict";function b(){var a=document.createElement("bootstrap"),b={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"};for(var c in b)if(void 0!==a.style[c])return{end:b[c]};return!1}a.fn.emulateTransitionEnd=function(b){var c=!1,d=this;a(this).one("bsTransitionEnd",function(){c=!0});var e=function(){c||a(d).trigger(a.support.transition.end)};return setTimeout(e,b),this},a(function(){a.support.transition=b(),a.support.transition&&(a.event.special.bsTransitionEnd={bindType:a.support.transition.end,delegateType:a.support.transition.end,handle:function(b){return a(b.target).is(this)?b.handleObj.handler.apply(this,arguments):void 0}})})}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var c=a(this),e=c.data("bs.alert");e||c.data("bs.alert",e=new d(this)),"string"==typeof b&&e[b].call(c)})}var c='[data-dismiss="alert"]',d=function(b){a(b).on("click",c,this.close)};d.VERSION="3.3.6",d.TRANSITION_DURATION=150,d.prototype.close=function(b){function c(){g.detach().trigger("closed.bs.alert").remove()}var e=a(this),f=e.attr("data-target");f||(f=e.attr("href"),f=f&&f.replace(/.*(?=#[^\s]*$)/,""));var g=a(f);b&&b.preventDefault(),g.length||(g=e.closest(".alert")),g.trigger(b=a.Event("close.bs.alert")),b.isDefaultPrevented()||(g.removeClass("in"),a.support.transition&&g.hasClass("fade")?g.one("bsTransitionEnd",c).emulateTransitionEnd(d.TRANSITION_DURATION):c())};var e=a.fn.alert;a.fn.alert=b,a.fn.alert.Constructor=d,a.fn.alert.noConflict=function(){return a.fn.alert=e,this},a(document).on("click.bs.alert.data-api",c,d.prototype.close)}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.button"),f="object"==typeof b&&b;e||d.data("bs.button",e=new c(this,f)),"toggle"==b?e.toggle():b&&e.setState(b)})}var c=function(b,d){this.$element=a(b),this.options=a.extend({},c.DEFAULTS,d),this.isLoading=!1};c.VERSION="3.3.6",c.DEFAULTS={loadingText:"loading..."},c.prototype.setState=function(b){var c="disabled",d=this.$element,e=d.is("input")?"val":"html",f=d.data();b+="Text",null==f.resetText&&d.data("resetText",d[e]()),setTimeout(a.proxy(function(){d[e](null==f[b]?this.options[b]:f[b]),"loadingText"==b?(this.isLoading=!0,d.addClass(c).attr(c,c)):this.isLoading&&(this.isLoading=!1,d.removeClass(c).removeAttr(c))},this),0)},c.prototype.toggle=function(){var a=!0,b=this.$element.closest('[data-toggle="buttons"]');if(b.length){var c=this.$element.find("input");"radio"==c.prop("type")?(c.prop("checked")&&(a=!1),b.find(".active").removeClass("active"),this.$element.addClass("active")):"checkbox"==c.prop("type")&&(c.prop("checked")!==this.$element.hasClass("active")&&(a=!1),this.$element.toggleClass("active")),c.prop("checked",this.$element.hasClass("active")),a&&c.trigger("change")}else this.$element.attr("aria-pressed",!this.$element.hasClass("active")),this.$element.toggleClass("active")};var d=a.fn.button;a.fn.button=b,a.fn.button.Constructor=c,a.fn.button.noConflict=function(){return a.fn.button=d,this},a(document).on("click.bs.button.data-api",'[data-toggle^="button"]',function(c){var d=a(c.target);d.hasClass("btn")||(d=d.closest(".btn")),b.call(d,"toggle"),a(c.target).is('input[type="radio"]')||a(c.target).is('input[type="checkbox"]')||c.preventDefault()}).on("focus.bs.button.data-api blur.bs.button.data-api",'[data-toggle^="button"]',function(b){a(b.target).closest(".btn").toggleClass("focus",/^focus(in)?$/.test(b.type))})}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.carousel"),f=a.extend({},c.DEFAULTS,d.data(),"object"==typeof b&&b),g="string"==typeof b?b:f.slide;e||d.data("bs.carousel",e=new c(this,f)),"number"==typeof b?e.to(b):g?e[g]():f.interval&&e.pause().cycle()})}var c=function(b,c){this.$element=a(b),this.$indicators=this.$element.find(".carousel-indicators"),this.options=c,this.paused=null,this.sliding=null,this.interval=null,this.$active=null,this.$items=null,this.options.keyboard&&this.$element.on("keydown.bs.carousel",a.proxy(this.keydown,this)),"hover"==this.options.pause&&!("ontouchstart"in document.documentElement)&&this.$element.on("mouseenter.bs.carousel",a.proxy(this.pause,this)).on("mouseleave.bs.carousel",a.proxy(this.cycle,this))};c.VERSION="3.3.6",c.TRANSITION_DURATION=600,c.DEFAULTS={interval:5e3,pause:"hover",wrap:!0,keyboard:!0},c.prototype.keydown=function(a){if(!/input|textarea/i.test(a.target.tagName)){switch(a.which){case 37:this.prev();break;case 39:this.next();break;default:return}a.preventDefault()}},c.prototype.cycle=function(b){return b||(this.paused=!1),this.interval&&clearInterval(this.interval),this.options.interval&&!this.paused&&(this.interval=setInterval(a.proxy(this.next,this),this.options.interval)),this},c.prototype.getItemIndex=function(a){return this.$items=a.parent().children(".item"),this.$items.index(a||this.$active)},c.prototype.getItemForDirection=function(a,b){var c=this.getItemIndex(b),d="prev"==a&&0===c||"next"==a&&c==this.$items.length-1;if(d&&!this.options.wrap)return b;var e="prev"==a?-1:1,f=(c+e)%this.$items.length;return this.$items.eq(f)},c.prototype.to=function(a){var b=this,c=this.getItemIndex(this.$active=this.$element.find(".item.active"));return a>this.$items.length-1||0>a?void 0:this.sliding?this.$element.one("slid.bs.carousel",function(){b.to(a)}):c==a?this.pause().cycle():this.slide(a>c?"next":"prev",this.$items.eq(a))},c.prototype.pause=function(b){return b||(this.paused=!0),this.$element.find(".next, .prev").length&&a.support.transition&&(this.$element.trigger(a.support.transition.end),this.cycle(!0)),this.interval=clearInterval(this.interval),this},c.prototype.next=function(){return this.sliding?void 0:this.slide("next")},c.prototype.prev=function(){return this.sliding?void 0:this.slide("prev")},c.prototype.slide=function(b,d){var e=this.$element.find(".item.active"),f=d||this.getItemForDirection(b,e),g=this.interval,h="next"==b?"left":"right",i=this;if(f.hasClass("active"))return this.sliding=!1;var j=f[0],k=a.Event("slide.bs.carousel",{relatedTarget:j,direction:h});if(this.$element.trigger(k),!k.isDefaultPrevented()){if(this.sliding=!0,g&&this.pause(),this.$indicators.length){this.$indicators.find(".active").removeClass("active");var l=a(this.$indicators.children()[this.getItemIndex(f)]);l&&l.addClass("active")}var m=a.Event("slid.bs.carousel",{relatedTarget:j,direction:h});return a.support.transition&&this.$element.hasClass("slide")?(f.addClass(b),f[0].offsetWidth,e.addClass(h),f.addClass(h),e.one("bsTransitionEnd",function(){f.removeClass([b,h].join(" ")).addClass("active"),e.removeClass(["active",h].join(" ")),i.sliding=!1,setTimeout(function(){i.$element.trigger(m)},0)}).emulateTransitionEnd(c.TRANSITION_DURATION)):(e.removeClass("active"),f.addClass("active"),this.sliding=!1,this.$element.trigger(m)),g&&this.cycle(),this}};var d=a.fn.carousel;a.fn.carousel=b,a.fn.carousel.Constructor=c,a.fn.carousel.noConflict=function(){return a.fn.carousel=d,this};var e=function(c){var d,e=a(this),f=a(e.attr("data-target")||(d=e.attr("href"))&&d.replace(/.*(?=#[^\s]+$)/,""));if(f.hasClass("carousel")){var g=a.extend({},f.data(),e.data()),h=e.attr("data-slide-to");h&&(g.interval=!1),b.call(f,g),h&&f.data("bs.carousel").to(h),c.preventDefault()}};a(document).on("click.bs.carousel.data-api","[data-slide]",e).on("click.bs.carousel.data-api","[data-slide-to]",e),a(window).on("load",function(){a('[data-ride="carousel"]').each(function(){var c=a(this);b.call(c,c.data())})})}(jQuery),+function(a){"use strict";function b(b){var c,d=b.attr("data-target")||(c=b.attr("href"))&&c.replace(/.*(?=#[^\s]+$)/,"");return a(d)}function c(b){return this.each(function(){var c=a(this),e=c.data("bs.collapse"),f=a.extend({},d.DEFAULTS,c.data(),"object"==typeof b&&b);!e&&f.toggle&&/show|hide/.test(b)&&(f.toggle=!1),e||c.data("bs.collapse",e=new d(this,f)),"string"==typeof b&&e[b]()})}var d=function(b,c){this.$element=a(b),this.options=a.extend({},d.DEFAULTS,c),this.$trigger=a('[data-toggle="collapse"][href="#'+b.id+'"],[data-toggle="collapse"][data-target="#'+b.id+'"]'),this.transitioning=null,this.options.parent?this.$parent=this.getParent():this.addAriaAndCollapsedClass(this.$element,this.$trigger),this.options.toggle&&this.toggle()};d.VERSION="3.3.6",d.TRANSITION_DURATION=350,d.DEFAULTS={toggle:!0},d.prototype.dimension=function(){var a=this.$element.hasClass("width");return a?"width":"height"},d.prototype.show=function(){if(!this.transitioning&&!this.$element.hasClass("in")){var b,e=this.$parent&&this.$parent.children(".panel").children(".in, .collapsing");if(!(e&&e.length&&(b=e.data("bs.collapse"),b&&b.transitioning))){var f=a.Event("show.bs.collapse");if(this.$element.trigger(f),!f.isDefaultPrevented()){e&&e.length&&(c.call(e,"hide"),b||e.data("bs.collapse",null));var g=this.dimension();this.$element.removeClass("collapse").addClass("collapsing")[g](0).attr("aria-expanded",!0),this.$trigger.removeClass("collapsed").attr("aria-expanded",!0),this.transitioning=1;var h=function(){this.$element.removeClass("collapsing").addClass("collapse in")[g](""),this.transitioning=0,this.$element.trigger("shown.bs.collapse")};if(!a.support.transition)return h.call(this);var i=a.camelCase(["scroll",g].join("-"));this.$element.one("bsTransitionEnd",a.proxy(h,this)).emulateTransitionEnd(d.TRANSITION_DURATION)[g](this.$element[0][i])}}}},d.prototype.hide=function(){if(!this.transitioning&&this.$element.hasClass("in")){var b=a.Event("hide.bs.collapse");if(this.$element.trigger(b),!b.isDefaultPrevented()){var c=this.dimension();this.$element[c](this.$element[c]())[0].offsetHeight,this.$element.addClass("collapsing").removeClass("collapse in").attr("aria-expanded",!1),this.$trigger.addClass("collapsed").attr("aria-expanded",!1),this.transitioning=1;var e=function(){this.transitioning=0,this.$element.removeClass("collapsing").addClass("collapse").trigger("hidden.bs.collapse")};return a.support.transition?void this.$element[c](0).one("bsTransitionEnd",a.proxy(e,this)).emulateTransitionEnd(d.TRANSITION_DURATION):e.call(this)}}},d.prototype.toggle=function(){this[this.$element.hasClass("in")?"hide":"show"]()},d.prototype.getParent=function(){return a(this.options.parent).find('[data-toggle="collapse"][data-parent="'+this.options.parent+'"]').each(a.proxy(function(c,d){var e=a(d);this.addAriaAndCollapsedClass(b(e),e)},this)).end()},d.prototype.addAriaAndCollapsedClass=function(a,b){var c=a.hasClass("in");a.attr("aria-expanded",c),b.toggleClass("collapsed",!c).attr("aria-expanded",c)};var e=a.fn.collapse;a.fn.collapse=c,a.fn.collapse.Constructor=d,a.fn.collapse.noConflict=function(){return a.fn.collapse=e,this},a(document).on("click.bs.collapse.data-api",'[data-toggle="collapse"]',function(d){var e=a(this);e.attr("data-target")||d.preventDefault();var f=b(e),g=f.data("bs.collapse"),h=g?"toggle":e.data();c.call(f,h)})}(jQuery),+function(a){"use strict";function b(b){var c=b.attr("data-target");c||(c=b.attr("href"),c=c&&/#[A-Za-z]/.test(c)&&c.replace(/.*(?=#[^\s]*$)/,""));var d=c&&a(c);return d&&d.length?d:b.parent()}function c(c){c&&3===c.which||(a(e).remove(),a(f).each(function(){var d=a(this),e=b(d),f={relatedTarget:this};e.hasClass("open")&&(c&&"click"==c.type&&/input|textarea/i.test(c.target.tagName)&&a.contains(e[0],c.target)||(e.trigger(c=a.Event("hide.bs.dropdown",f)),c.isDefaultPrevented()||(d.attr("aria-expanded","false"),e.removeClass("open").trigger(a.Event("hidden.bs.dropdown",f)))))}))}function d(b){return this.each(function(){var c=a(this),d=c.data("bs.dropdown");d||c.data("bs.dropdown",d=new g(this)),"string"==typeof b&&d[b].call(c)})}var e=".dropdown-backdrop",f='[data-toggle="dropdown"]',g=function(b){a(b).on("click.bs.dropdown",this.toggle)};g.VERSION="3.3.6",g.prototype.toggle=function(d){var e=a(this);if(!e.is(".disabled, :disabled")){var f=b(e),g=f.hasClass("open");if(c(),!g){"ontouchstart"in document.documentElement&&!f.closest(".navbar-nav").length&&a(document.createElement("div")).addClass("dropdown-backdrop").insertAfter(a(this)).on("click",c);var h={relatedTarget:this};if(f.trigger(d=a.Event("show.bs.dropdown",h)),d.isDefaultPrevented())return;e.trigger("focus").attr("aria-expanded","true"),f.toggleClass("open").trigger(a.Event("shown.bs.dropdown",h))}return!1}},g.prototype.keydown=function(c){if(/(38|40|27|32)/.test(c.which)&&!/input|textarea/i.test(c.target.tagName)){var d=a(this);if(c.preventDefault(),c.stopPropagation(),!d.is(".disabled, :disabled")){var e=b(d),g=e.hasClass("open");if(!g&&27!=c.which||g&&27==c.which)return 27==c.which&&e.find(f).trigger("focus"),d.trigger("click");var h=" li:not(.disabled):visible a",i=e.find(".dropdown-menu"+h);if(i.length){var j=i.index(c.target);38==c.which&&j>0&&j--,40==c.which&&j<i.length-1&&j++,~j||(j=0),i.eq(j).trigger("focus")}}}};var h=a.fn.dropdown;a.fn.dropdown=d,a.fn.dropdown.Constructor=g,a.fn.dropdown.noConflict=function(){return a.fn.dropdown=h,this},a(document).on("click.bs.dropdown.data-api",c).on("click.bs.dropdown.data-api",".dropdown form",function(a){a.stopPropagation()}).on("click.bs.dropdown.data-api",f,g.prototype.toggle).on("keydown.bs.dropdown.data-api",f,g.prototype.keydown).on("keydown.bs.dropdown.data-api",".dropdown-menu",g.prototype.keydown)}(jQuery),+function(a){"use strict";function b(b,d){return this.each(function(){var e=a(this),f=e.data("bs.modal"),g=a.extend({},c.DEFAULTS,e.data(),"object"==typeof b&&b);f||e.data("bs.modal",f=new c(this,g)),"string"==typeof b?f[b](d):g.show&&f.show(d)})}var c=function(b,c){this.options=c,this.$body=a(document.body),this.$element=a(b),this.$dialog=this.$element.find(".modal-dialog"),this.$backdrop=null,this.isShown=null,this.originalBodyPad=null,this.scrollbarWidth=0,this.ignoreBackdropClick=!1,this.options.remote&&this.$element.find(".modal-content").load(this.options.remote,a.proxy(function(){this.$element.trigger("loaded.bs.modal")},this))};c.VERSION="3.3.6",c.TRANSITION_DURATION=300,c.BACKDROP_TRANSITION_DURATION=150,c.DEFAULTS={backdrop:!0,keyboard:!0,show:!0},c.prototype.toggle=function(a){return this.isShown?this.hide():this.show(a)},c.prototype.show=function(b){var d=this,e=a.Event("show.bs.modal",{relatedTarget:b});this.$element.trigger(e),this.isShown||e.isDefaultPrevented()||(this.isShown=!0,this.checkScrollbar(),this.setScrollbar(),this.$body.addClass("modal-open"),this.escape(),this.resize(),this.$element.on("click.dismiss.bs.modal",'[data-dismiss="modal"]',a.proxy(this.hide,this)),this.$dialog.on("mousedown.dismiss.bs.modal",function(){d.$element.one("mouseup.dismiss.bs.modal",function(b){a(b.target).is(d.$element)&&(d.ignoreBackdropClick=!0)})}),this.backdrop(function(){var e=a.support.transition&&d.$element.hasClass("fade");d.$element.parent().length||d.$element.appendTo(d.$body),d.$element.show().scrollTop(0),d.adjustDialog(),e&&d.$element[0].offsetWidth,d.$element.addClass("in"),d.enforceFocus();var f=a.Event("shown.bs.modal",{relatedTarget:b});e?d.$dialog.one("bsTransitionEnd",function(){d.$element.trigger("focus").trigger(f)}).emulateTransitionEnd(c.TRANSITION_DURATION):d.$element.trigger("focus").trigger(f)}))},c.prototype.hide=function(b){b&&b.preventDefault(),b=a.Event("hide.bs.modal"),this.$element.trigger(b),this.isShown&&!b.isDefaultPrevented()&&(this.isShown=!1,this.escape(),this.resize(),a(document).off("focusin.bs.modal"),this.$element.removeClass("in").off("click.dismiss.bs.modal").off("mouseup.dismiss.bs.modal"),this.$dialog.off("mousedown.dismiss.bs.modal"),a.support.transition&&this.$element.hasClass("fade")?this.$element.one("bsTransitionEnd",a.proxy(this.hideModal,this)).emulateTransitionEnd(c.TRANSITION_DURATION):this.hideModal())},c.prototype.enforceFocus=function(){a(document).off("focusin.bs.modal").on("focusin.bs.modal",a.proxy(function(a){this.$element[0]===a.target||this.$element.has(a.target).length||this.$element.trigger("focus")},this))},c.prototype.escape=function(){this.isShown&&this.options.keyboard?this.$element.on("keydown.dismiss.bs.modal",a.proxy(function(a){27==a.which&&this.hide()},this)):this.isShown||this.$element.off("keydown.dismiss.bs.modal")},c.prototype.resize=function(){this.isShown?a(window).on("resize.bs.modal",a.proxy(this.handleUpdate,this)):a(window).off("resize.bs.modal")},c.prototype.hideModal=function(){var a=this;this.$element.hide(),this.backdrop(function(){a.$body.removeClass("modal-open"),a.resetAdjustments(),a.resetScrollbar(),a.$element.trigger("hidden.bs.modal")})},c.prototype.removeBackdrop=function(){this.$backdrop&&this.$backdrop.remove(),this.$backdrop=null},c.prototype.backdrop=function(b){var d=this,e=this.$element.hasClass("fade")?"fade":"";if(this.isShown&&this.options.backdrop){var f=a.support.transition&&e;if(this.$backdrop=a(document.createElement("div")).addClass("modal-backdrop "+e).appendTo(this.$body),this.$element.on("click.dismiss.bs.modal",a.proxy(function(a){return this.ignoreBackdropClick?void(this.ignoreBackdropClick=!1):void(a.target===a.currentTarget&&("static"==this.options.backdrop?this.$element[0].focus():this.hide()))},this)),f&&this.$backdrop[0].offsetWidth,this.$backdrop.addClass("in"),!b)return;f?this.$backdrop.one("bsTransitionEnd",b).emulateTransitionEnd(c.BACKDROP_TRANSITION_DURATION):b()}else if(!this.isShown&&this.$backdrop){this.$backdrop.removeClass("in");var g=function(){d.removeBackdrop(),b&&b()};a.support.transition&&this.$element.hasClass("fade")?this.$backdrop.one("bsTransitionEnd",g).emulateTransitionEnd(c.BACKDROP_TRANSITION_DURATION):g()}else b&&b()},c.prototype.handleUpdate=function(){this.adjustDialog()},c.prototype.adjustDialog=function(){var a=this.$element[0].scrollHeight>document.documentElement.clientHeight;this.$element.css({paddingLeft:!this.bodyIsOverflowing&&a?this.scrollbarWidth:"",paddingRight:this.bodyIsOverflowing&&!a?this.scrollbarWidth:""})},c.prototype.resetAdjustments=function(){this.$element.css({paddingLeft:"",paddingRight:""})},c.prototype.checkScrollbar=function(){var a=window.innerWidth;if(!a){var b=document.documentElement.getBoundingClientRect();a=b.right-Math.abs(b.left)}this.bodyIsOverflowing=document.body.clientWidth<a,this.scrollbarWidth=this.measureScrollbar()},c.prototype.setScrollbar=function(){var a=parseInt(this.$body.css("padding-right")||0,10);this.originalBodyPad=document.body.style.paddingRight||"",this.bodyIsOverflowing&&this.$body.css("padding-right",a+this.scrollbarWidth)},c.prototype.resetScrollbar=function(){this.$body.css("padding-right",this.originalBodyPad)},c.prototype.measureScrollbar=function(){var a=document.createElement("div");a.className="modal-scrollbar-measure",this.$body.append(a);var b=a.offsetWidth-a.clientWidth;return this.$body[0].removeChild(a),b};var d=a.fn.modal;a.fn.modal=b,a.fn.modal.Constructor=c,a.fn.modal.noConflict=function(){return a.fn.modal=d,this},a(document).on("click.bs.modal.data-api",'[data-toggle="modal"]',function(c){var d=a(this),e=d.attr("href"),f=a(d.attr("data-target")||e&&e.replace(/.*(?=#[^\s]+$)/,"")),g=f.data("bs.modal")?"toggle":a.extend({remote:!/#/.test(e)&&e},f.data(),d.data());d.is("a")&&c.preventDefault(),f.one("show.bs.modal",function(a){a.isDefaultPrevented()||f.one("hidden.bs.modal",function(){d.is(":visible")&&d.trigger("focus")})}),b.call(f,g,this)})}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.tooltip"),f="object"==typeof b&&b;(e||!/destroy|hide/.test(b))&&(e||d.data("bs.tooltip",e=new c(this,f)),"string"==typeof b&&e[b]())})}var c=function(a,b){this.type=null,this.options=null,this.enabled=null,this.timeout=null,this.hoverState=null,this.$element=null,this.inState=null,this.init("tooltip",a,b)};c.VERSION="3.3.6",c.TRANSITION_DURATION=150,c.DEFAULTS={animation:!0,placement:"top",selector:!1,template:'<div class="tooltip" role="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>',trigger:"hover focus",title:"",delay:0,html:!1,container:!1,viewport:{selector:"body",padding:0}},c.prototype.init=function(b,c,d){if(this.enabled=!0,this.type=b,this.$element=a(c),this.options=this.getOptions(d),this.$viewport=this.options.viewport&&a(a.isFunction(this.options.viewport)?this.options.viewport.call(this,this.$element):this.options.viewport.selector||this.options.viewport),this.inState={click:!1,hover:!1,focus:!1},this.$element[0]instanceof document.constructor&&!this.options.selector)throw new Error("`selector` option must be specified when initializing "+this.type+" on the window.document object!");for(var e=this.options.trigger.split(" "),f=e.length;f--;){var g=e[f];if("click"==g)this.$element.on("click."+this.type,this.options.selector,a.proxy(this.toggle,this));else if("manual"!=g){var h="hover"==g?"mouseenter":"focusin",i="hover"==g?"mouseleave":"focusout";this.$element.on(h+"."+this.type,this.options.selector,a.proxy(this.enter,this)),this.$element.on(i+"."+this.type,this.options.selector,a.proxy(this.leave,this))}}this.options.selector?this._options=a.extend({},this.options,{trigger:"manual",selector:""}):this.fixTitle()},c.prototype.getDefaults=function(){return c.DEFAULTS},c.prototype.getOptions=function(b){return b=a.extend({},this.getDefaults(),this.$element.data(),b),b.delay&&"number"==typeof b.delay&&(b.delay={show:b.delay,hide:b.delay}),b},c.prototype.getDelegateOptions=function(){var b={},c=this.getDefaults();return this._options&&a.each(this._options,function(a,d){c[a]!=d&&(b[a]=d)}),b},c.prototype.enter=function(b){var c=b instanceof this.constructor?b:a(b.currentTarget).data("bs."+this.type);return c||(c=new this.constructor(b.currentTarget,this.getDelegateOptions()),a(b.currentTarget).data("bs."+this.type,c)),b instanceof a.Event&&(c.inState["focusin"==b.type?"focus":"hover"]=!0),c.tip().hasClass("in")||"in"==c.hoverState?void(c.hoverState="in"):(clearTimeout(c.timeout),c.hoverState="in",c.options.delay&&c.options.delay.show?void(c.timeout=setTimeout(function(){"in"==c.hoverState&&c.show()},c.options.delay.show)):c.show())},c.prototype.isInStateTrue=function(){for(var a in this.inState)if(this.inState[a])return!0;return!1},c.prototype.leave=function(b){var c=b instanceof this.constructor?b:a(b.currentTarget).data("bs."+this.type);return c||(c=new this.constructor(b.currentTarget,this.getDelegateOptions()),a(b.currentTarget).data("bs."+this.type,c)),b instanceof a.Event&&(c.inState["focusout"==b.type?"focus":"hover"]=!1),c.isInStateTrue()?void 0:(clearTimeout(c.timeout),c.hoverState="out",c.options.delay&&c.options.delay.hide?void(c.timeout=setTimeout(function(){"out"==c.hoverState&&c.hide()},c.options.delay.hide)):c.hide())},c.prototype.show=function(){var b=a.Event("show.bs."+this.type);if(this.hasContent()&&this.enabled){this.$element.trigger(b);var d=a.contains(this.$element[0].ownerDocument.documentElement,this.$element[0]);if(b.isDefaultPrevented()||!d)return;var e=this,f=this.tip(),g=this.getUID(this.type);this.setContent(),f.attr("id",g),this.$element.attr("aria-describedby",g),this.options.animation&&f.addClass("fade");var h="function"==typeof this.options.placement?this.options.placement.call(this,f[0],this.$element[0]):this.options.placement,i=/\s?auto?\s?/i,j=i.test(h);j&&(h=h.replace(i,"")||"top"),f.detach().css({top:0,left:0,display:"block"}).addClass(h).data("bs."+this.type,this),this.options.container?f.appendTo(this.options.container):f.insertAfter(this.$element),this.$element.trigger("inserted.bs."+this.type);var k=this.getPosition(),l=f[0].offsetWidth,m=f[0].offsetHeight;if(j){var n=h,o=this.getPosition(this.$viewport);h="bottom"==h&&k.bottom+m>o.bottom?"top":"top"==h&&k.top-m<o.top?"bottom":"right"==h&&k.right+l>o.width?"left":"left"==h&&k.left-l<o.left?"right":h,f.removeClass(n).addClass(h)}var p=this.getCalculatedOffset(h,k,l,m);this.applyPlacement(p,h);var q=function(){var a=e.hoverState;e.$element.trigger("shown.bs."+e.type),e.hoverState=null,"out"==a&&e.leave(e)};a.support.transition&&this.$tip.hasClass("fade")?f.one("bsTransitionEnd",q).emulateTransitionEnd(c.TRANSITION_DURATION):q()}},c.prototype.applyPlacement=function(b,c){var d=this.tip(),e=d[0].offsetWidth,f=d[0].offsetHeight,g=parseInt(d.css("margin-top"),10),h=parseInt(d.css("margin-left"),10);isNaN(g)&&(g=0),isNaN(h)&&(h=0),b.top+=g,b.left+=h,a.offset.setOffset(d[0],a.extend({using:function(a){d.css({top:Math.round(a.top),left:Math.round(a.left)})}},b),0),d.addClass("in");var i=d[0].offsetWidth,j=d[0].offsetHeight;"top"==c&&j!=f&&(b.top=b.top+f-j);var k=this.getViewportAdjustedDelta(c,b,i,j);k.left?b.left+=k.left:b.top+=k.top;var l=/top|bottom/.test(c),m=l?2*k.left-e+i:2*k.top-f+j,n=l?"offsetWidth":"offsetHeight";d.offset(b),this.replaceArrow(m,d[0][n],l)},c.prototype.replaceArrow=function(a,b,c){this.arrow().css(c?"left":"top",50*(1-a/b)+"%").css(c?"top":"left","")},c.prototype.setContent=function(){var a=this.tip(),b=this.getTitle();a.find(".tooltip-inner")[this.options.html?"html":"text"](b),a.removeClass("fade in top bottom left right")},c.prototype.hide=function(b){function d(){"in"!=e.hoverState&&f.detach(),e.$element.removeAttr("aria-describedby").trigger("hidden.bs."+e.type),b&&b()}var e=this,f=a(this.$tip),g=a.Event("hide.bs."+this.type);return this.$element.trigger(g),g.isDefaultPrevented()?void 0:(f.removeClass("in"),a.support.transition&&f.hasClass("fade")?f.one("bsTransitionEnd",d).emulateTransitionEnd(c.TRANSITION_DURATION):d(),this.hoverState=null,this)},c.prototype.fixTitle=function(){var a=this.$element;(a.attr("title")||"string"!=typeof a.attr("data-original-title"))&&a.attr("data-original-title",a.attr("title")||"").attr("title","")},c.prototype.hasContent=function(){return this.getTitle()},c.prototype.getPosition=function(b){b=b||this.$element;var c=b[0],d="BODY"==c.tagName,e=c.getBoundingClientRect();null==e.width&&(e=a.extend({},e,{width:e.right-e.left,height:e.bottom-e.top}));var f=d?{top:0,left:0}:b.offset(),g={scroll:d?document.documentElement.scrollTop||document.body.scrollTop:b.scrollTop()},h=d?{width:a(window).width(),height:a(window).height()}:null;return a.extend({},e,g,h,f)},c.prototype.getCalculatedOffset=function(a,b,c,d){return"bottom"==a?{top:b.top+b.height,left:b.left+b.width/2-c/2}:"top"==a?{top:b.top-d,left:b.left+b.width/2-c/2}:"left"==a?{top:b.top+b.height/2-d/2,left:b.left-c}:{top:b.top+b.height/2-d/2,left:b.left+b.width}},c.prototype.getViewportAdjustedDelta=function(a,b,c,d){var e={top:0,left:0};if(!this.$viewport)return e;var f=this.options.viewport&&this.options.viewport.padding||0,g=this.getPosition(this.$viewport);if(/right|left/.test(a)){var h=b.top-f-g.scroll,i=b.top+f-g.scroll+d;h<g.top?e.top=g.top-h:i>g.top+g.height&&(e.top=g.top+g.height-i)}else{var j=b.left-f,k=b.left+f+c;j<g.left?e.left=g.left-j:k>g.right&&(e.left=g.left+g.width-k)}return e},c.prototype.getTitle=function(){var a,b=this.$element,c=this.options;return a=b.attr("data-original-title")||("function"==typeof c.title?c.title.call(b[0]):c.title)},c.prototype.getUID=function(a){do a+=~~(1e6*Math.random());while(document.getElementById(a));return a},c.prototype.tip=function(){if(!this.$tip&&(this.$tip=a(this.options.template),1!=this.$tip.length))throw new Error(this.type+" `template` option must consist of exactly 1 top-level element!");return this.$tip},c.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".tooltip-arrow")},c.prototype.enable=function(){this.enabled=!0},c.prototype.disable=function(){this.enabled=!1},c.prototype.toggleEnabled=function(){this.enabled=!this.enabled},c.prototype.toggle=function(b){var c=this;b&&(c=a(b.currentTarget).data("bs."+this.type),c||(c=new this.constructor(b.currentTarget,this.getDelegateOptions()),a(b.currentTarget).data("bs."+this.type,c))),b?(c.inState.click=!c.inState.click,c.isInStateTrue()?c.enter(c):c.leave(c)):c.tip().hasClass("in")?c.leave(c):c.enter(c)},c.prototype.destroy=function(){var a=this;clearTimeout(this.timeout),this.hide(function(){a.$element.off("."+a.type).removeData("bs."+a.type),a.$tip&&a.$tip.detach(),a.$tip=null,a.$arrow=null,a.$viewport=null})};var d=a.fn.tooltip;a.fn.tooltip=b,a.fn.tooltip.Constructor=c,a.fn.tooltip.noConflict=function(){return a.fn.tooltip=d,this}}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.popover"),f="object"==typeof b&&b;(e||!/destroy|hide/.test(b))&&(e||d.data("bs.popover",e=new c(this,f)),"string"==typeof b&&e[b]())})}var c=function(a,b){this.init("popover",a,b)};if(!a.fn.tooltip)throw new Error("Popover requires tooltip.js");c.VERSION="3.3.6",c.DEFAULTS=a.extend({},a.fn.tooltip.Constructor.DEFAULTS,{placement:"right",trigger:"click",content:"",template:'<div class="popover" role="tooltip"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>'}),c.prototype=a.extend({},a.fn.tooltip.Constructor.prototype),c.prototype.constructor=c,c.prototype.getDefaults=function(){return c.DEFAULTS},c.prototype.setContent=function(){var a=this.tip(),b=this.getTitle(),c=this.getContent();a.find(".popover-title")[this.options.html?"html":"text"](b),a.find(".popover-content").children().detach().end()[this.options.html?"string"==typeof c?"html":"append":"text"](c),a.removeClass("fade top bottom left right in"),a.find(".popover-title").html()||a.find(".popover-title").hide()},c.prototype.hasContent=function(){return this.getTitle()||this.getContent()},c.prototype.getContent=function(){var a=this.$element,b=this.options;return a.attr("data-content")||("function"==typeof b.content?b.content.call(a[0]):b.content)},c.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".arrow")};var d=a.fn.popover;a.fn.popover=b,a.fn.popover.Constructor=c,a.fn.popover.noConflict=function(){return a.fn.popover=d,this}}(jQuery),+function(a){"use strict";function b(c,d){this.$body=a(document.body),this.$scrollElement=a(a(c).is(document.body)?window:c),this.options=a.extend({},b.DEFAULTS,d),this.selector=(this.options.target||"")+" .nav li > a",this.offsets=[],this.targets=[],this.activeTarget=null,this.scrollHeight=0,this.$scrollElement.on("scroll.bs.scrollspy",a.proxy(this.process,this)),this.refresh(),this.process()}function c(c){return this.each(function(){var d=a(this),e=d.data("bs.scrollspy"),f="object"==typeof c&&c;e||d.data("bs.scrollspy",e=new b(this,f)),"string"==typeof c&&e[c]()})}b.VERSION="3.3.6",b.DEFAULTS={offset:10},b.prototype.getScrollHeight=function(){return this.$scrollElement[0].scrollHeight||Math.max(this.$body[0].scrollHeight,document.documentElement.scrollHeight)},b.prototype.refresh=function(){var b=this,c="offset",d=0;this.offsets=[],this.targets=[],this.scrollHeight=this.getScrollHeight(),a.isWindow(this.$scrollElement[0])||(c="position",d=this.$scrollElement.scrollTop()),this.$body.find(this.selector).map(function(){var b=a(this),e=b.data("target")||b.attr("href"),f=/^#./.test(e)&&a(e);return f&&f.length&&f.is(":visible")&&[[f[c]().top+d,e]]||null}).sort(function(a,b){return a[0]-b[0]}).each(function(){b.offsets.push(this[0]),b.targets.push(this[1])})},b.prototype.process=function(){var a,b=this.$scrollElement.scrollTop()+this.options.offset,c=this.getScrollHeight(),d=this.options.offset+c-this.$scrollElement.height(),e=this.offsets,f=this.targets,g=this.activeTarget;if(this.scrollHeight!=c&&this.refresh(),b>=d)return g!=(a=f[f.length-1])&&this.activate(a);if(g&&b<e[0])return this.activeTarget=null,this.clear();for(a=e.length;a--;)g!=f[a]&&b>=e[a]&&(void 0===e[a+1]||b<e[a+1])&&this.activate(f[a])},b.prototype.activate=function(b){this.activeTarget=b,this.clear();var c=this.selector+'[data-target="'+b+'"],'+this.selector+'[href="'+b+'"]',d=a(c).parents("li").addClass("active"); | ||
+ | d.parent(".dropdown-menu").length&&(d=d.closest("li.dropdown").addClass("active")),d.trigger("activate.bs.scrollspy")},b.prototype.clear=function(){a(this.selector).parentsUntil(this.options.target,".active").removeClass("active")};var d=a.fn.scrollspy;a.fn.scrollspy=c,a.fn.scrollspy.Constructor=b,a.fn.scrollspy.noConflict=function(){return a.fn.scrollspy=d,this},a(window).on("load.bs.scrollspy.data-api",function(){a('[data-spy="scroll"]').each(function(){var b=a(this);c.call(b,b.data())})})}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.tab");e||d.data("bs.tab",e=new c(this)),"string"==typeof b&&e[b]()})}var c=function(b){this.element=a(b)};c.VERSION="3.3.6",c.TRANSITION_DURATION=150,c.prototype.show=function(){var b=this.element,c=b.closest("ul:not(.dropdown-menu)"),d=b.data("target");if(d||(d=b.attr("href"),d=d&&d.replace(/.*(?=#[^\s]*$)/,"")),!b.parent("li").hasClass("active")){var e=c.find(".active:last a"),f=a.Event("hide.bs.tab",{relatedTarget:b[0]}),g=a.Event("show.bs.tab",{relatedTarget:e[0]});if(e.trigger(f),b.trigger(g),!g.isDefaultPrevented()&&!f.isDefaultPrevented()){var h=a(d);this.activate(b.closest("li"),c),this.activate(h,h.parent(),function(){e.trigger({type:"hidden.bs.tab",relatedTarget:b[0]}),b.trigger({type:"shown.bs.tab",relatedTarget:e[0]})})}}},c.prototype.activate=function(b,d,e){function f(){g.removeClass("active").find("> .dropdown-menu > .active").removeClass("active").end().find('[data-toggle="tab"]').attr("aria-expanded",!1),b.addClass("active").find('[data-toggle="tab"]').attr("aria-expanded",!0),h?(b[0].offsetWidth,b.addClass("in")):b.removeClass("fade"),b.parent(".dropdown-menu").length&&b.closest("li.dropdown").addClass("active").end().find('[data-toggle="tab"]').attr("aria-expanded",!0),e&&e()}var g=d.find("> .active"),h=e&&a.support.transition&&(g.length&&g.hasClass("fade")||!!d.find("> .fade").length);g.length&&h?g.one("bsTransitionEnd",f).emulateTransitionEnd(c.TRANSITION_DURATION):f(),g.removeClass("in")};var d=a.fn.tab;a.fn.tab=b,a.fn.tab.Constructor=c,a.fn.tab.noConflict=function(){return a.fn.tab=d,this};var e=function(c){c.preventDefault(),b.call(a(this),"show")};a(document).on("click.bs.tab.data-api",'[data-toggle="tab"]',e).on("click.bs.tab.data-api",'[data-toggle="pill"]',e)}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.affix"),f="object"==typeof b&&b;e||d.data("bs.affix",e=new c(this,f)),"string"==typeof b&&e[b]()})}var c=function(b,d){this.options=a.extend({},c.DEFAULTS,d),this.$target=a(this.options.target).on("scroll.bs.affix.data-api",a.proxy(this.checkPosition,this)).on("click.bs.affix.data-api",a.proxy(this.checkPositionWithEventLoop,this)),this.$element=a(b),this.affixed=null,this.unpin=null,this.pinnedOffset=null,this.checkPosition()};c.VERSION="3.3.6",c.RESET="affix affix-top affix-bottom",c.DEFAULTS={offset:0,target:window},c.prototype.getState=function(a,b,c,d){var e=this.$target.scrollTop(),f=this.$element.offset(),g=this.$target.height();if(null!=c&&"top"==this.affixed)return c>e?"top":!1;if("bottom"==this.affixed)return null!=c?e+this.unpin<=f.top?!1:"bottom":a-d>=e+g?!1:"bottom";var h=null==this.affixed,i=h?e:f.top,j=h?g:b;return null!=c&&c>=e?"top":null!=d&&i+j>=a-d?"bottom":!1},c.prototype.getPinnedOffset=function(){if(this.pinnedOffset)return this.pinnedOffset;this.$element.removeClass(c.RESET).addClass("affix");var a=this.$target.scrollTop(),b=this.$element.offset();return this.pinnedOffset=b.top-a},c.prototype.checkPositionWithEventLoop=function(){setTimeout(a.proxy(this.checkPosition,this),1)},c.prototype.checkPosition=function(){if(this.$element.is(":visible")){var b=this.$element.height(),d=this.options.offset,e=d.top,f=d.bottom,g=Math.max(a(document).height(),a(document.body).height());"object"!=typeof d&&(f=e=d),"function"==typeof e&&(e=d.top(this.$element)),"function"==typeof f&&(f=d.bottom(this.$element));var h=this.getState(g,b,e,f);if(this.affixed!=h){null!=this.unpin&&this.$element.css("top","");var i="affix"+(h?"-"+h:""),j=a.Event(i+".bs.affix");if(this.$element.trigger(j),j.isDefaultPrevented())return;this.affixed=h,this.unpin="bottom"==h?this.getPinnedOffset():null,this.$element.removeClass(c.RESET).addClass(i).trigger(i.replace("affix","affixed")+".bs.affix")}"bottom"==h&&this.$element.offset({top:g-b-f})}};var d=a.fn.affix;a.fn.affix=b,a.fn.affix.Constructor=c,a.fn.affix.noConflict=function(){return a.fn.affix=d,this},a(window).on("load",function(){a('[data-spy="affix"]').each(function(){var c=a(this),d=c.data();d.offset=d.offset||{},null!=d.offsetBottom&&(d.offset.bottom=d.offsetBottom),null!=d.offsetTop&&(d.offset.top=d.offsetTop),b.call(c,d)})})}(jQuery); | ||
+ | </script> | ||
+ | |||
+ | |||
+ | <script type="text/javascript"> | ||
+ | /* | ||
+ | * Copyright (C) 2009 Joel Sutherland | ||
+ | * Licenced under the MIT license | ||
+ | * http://www.newmediacampaigns.com/page/jquery-flickr-plugin | ||
+ | * | ||
+ | * Available tags for templates: | ||
+ | * title, link, date_taken, description, published, author, author_id, tags, image* | ||
+ | */ | ||
+ | (function($) { | ||
+ | $.fn.jflickrfeed = function(settings, callback) { | ||
+ | settings = $.extend(true, { | ||
+ | flickrbase: 'http://api.flickr.com/services/feeds/', | ||
+ | feedapi: 'photos_public.gne', | ||
+ | limit: 20, | ||
+ | qstrings: { | ||
+ | lang: 'en-us', | ||
+ | format: 'json', | ||
+ | jsoncallback: '?' | ||
+ | }, | ||
+ | cleanDescription: true, | ||
+ | useTemplate: true, | ||
+ | itemTemplate: '', | ||
+ | itemCallback: function(){} | ||
+ | }, settings); | ||
+ | |||
+ | var url = settings.flickrbase + settings.feedapi + '?'; | ||
+ | var first = true; | ||
+ | |||
+ | for(var key in settings.qstrings){ | ||
+ | if(!first) | ||
+ | url += '&'; | ||
+ | url += key + '=' + settings.qstrings[key]; | ||
+ | first = false; | ||
+ | } | ||
+ | |||
+ | return $(this).each(function(){ | ||
+ | var $container = $(this); | ||
+ | var container = this; | ||
+ | $.getJSON(url, function(data){ | ||
+ | $.each(data.items, function(i,item){ | ||
+ | if(i < settings.limit){ | ||
+ | |||
+ | // Clean out the Flickr Description | ||
+ | if(settings.cleanDescription){ | ||
+ | var regex = /<p>(.*?)<\/p>/g; | ||
+ | var input = item.description; | ||
+ | if(regex.test(input)) { | ||
+ | item.description = input.match(regex)[2] | ||
+ | if(item.description!=undefined) | ||
+ | item.description = item.description.replace('<p>','').replace('</p>',''); | ||
+ | } | ||
+ | } | ||
+ | |||
+ | // Add Image Sizes | ||
+ | // http://www.flickr.com/services/api/misc.urls.html | ||
+ | item['image_s'] = item.media.m.replace('_m', '_s'); | ||
+ | item['image_t'] = item.media.m.replace('_m', '_t'); | ||
+ | item['image_m'] = item.media.m.replace('_m', '_m'); | ||
+ | item['image'] = item.media.m.replace('_m', ''); | ||
+ | item['image_b'] = item.media.m.replace('_m', '_b'); | ||
+ | delete item.media; | ||
+ | |||
+ | // Use Template | ||
+ | if(settings.useTemplate){ | ||
+ | var template = settings.itemTemplate; | ||
+ | for(var key in item){ | ||
+ | var rgx = new RegExp('{{' + key + '}}', 'g'); | ||
+ | template = template.replace(rgx, item[key]); | ||
+ | } | ||
+ | $container.append(template) | ||
+ | } | ||
+ | |||
+ | //itemCallback | ||
+ | settings.itemCallback.call(container, item); | ||
+ | } | ||
+ | }); | ||
+ | if($.isFunction(callback)){ | ||
+ | callback.call(container, data); | ||
+ | } | ||
+ | }); | ||
+ | }); | ||
+ | } | ||
+ | })(jQuery); | ||
+ | </script> | ||
+ | |||
+ | |||
+ | <script type="text/javascript"> | ||
+ | /*! | ||
+ | * jQuery Cookie Plugin v1.4.0 | ||
+ | * https://github.com/carhartl/jquery-cookie | ||
+ | * | ||
+ | * Copyright 2013 Klaus Hartl | ||
+ | * Released under the MIT license | ||
+ | */ | ||
+ | (function (factory) { | ||
+ | if (typeof define === 'function' && define.amd) { | ||
+ | // AMD. Register as anonymous module. | ||
+ | define(['jquery'], factory); | ||
+ | } else { | ||
+ | // Browser globals. | ||
+ | factory(jQuery); | ||
+ | } | ||
+ | }(function ($) { | ||
+ | |||
+ | var pluses = /\+/g; | ||
+ | |||
+ | function encode(s) { | ||
+ | return config.raw ? s : encodeURIComponent(s); | ||
+ | } | ||
+ | |||
+ | function decode(s) { | ||
+ | return config.raw ? s : decodeURIComponent(s); | ||
+ | } | ||
+ | |||
+ | function stringifyCookieValue(value) { | ||
+ | return encode(config.json ? JSON.stringify(value) : String(value)); | ||
+ | } | ||
+ | |||
+ | function parseCookieValue(s) { | ||
+ | if (s.indexOf('"') === 0) { | ||
+ | // This is a quoted cookie as according to RFC2068, unescape... | ||
+ | s = s.slice(1, -1).replace(/\\"/g, '"').replace(/\\\\/g, '\\'); | ||
+ | } | ||
+ | |||
+ | try { | ||
+ | // Replace server-side written pluses with spaces. | ||
+ | // If we can't decode the cookie, ignore it, it's unusable. | ||
+ | s = decodeURIComponent(s.replace(pluses, ' ')); | ||
+ | } catch(e) { | ||
+ | return; | ||
+ | } | ||
+ | |||
+ | try { | ||
+ | // If we can't parse the cookie, ignore it, it's unusable. | ||
+ | return config.json ? JSON.parse(s) : s; | ||
+ | } catch(e) {} | ||
+ | } | ||
+ | |||
+ | function read(s, converter) { | ||
+ | var value = config.raw ? s : parseCookieValue(s); | ||
+ | return $.isFunction(converter) ? converter(value) : value; | ||
+ | } | ||
+ | |||
+ | var config = $.cookie = function (key, value, options) { | ||
+ | |||
+ | // Write | ||
+ | if (value !== undefined && !$.isFunction(value)) { | ||
+ | options = $.extend({}, config.defaults, options); | ||
+ | |||
+ | if (typeof options.expires === 'number') { | ||
+ | var days = options.expires, t = options.expires = new Date(); | ||
+ | t.setDate(t.getDate() + days); | ||
+ | } | ||
+ | |||
+ | return (document.cookie = [ | ||
+ | encode(key), '=', stringifyCookieValue(value), | ||
+ | options.expires ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE | ||
+ | options.path ? '; path=' + options.path : '', | ||
+ | options.domain ? '; domain=' + options.domain : '', | ||
+ | options.secure ? '; secure' : '' | ||
+ | ].join('')); | ||
+ | } | ||
+ | |||
+ | // Read | ||
+ | |||
+ | var result = key ? undefined : {}; | ||
+ | |||
+ | // To prevent the for loop in the first place assign an empty array | ||
+ | // in case there are no cookies at all. Also prevents odd result when | ||
+ | // calling $.cookie(). | ||
+ | var cookies = document.cookie ? document.cookie.split('; ') : []; | ||
+ | |||
+ | for (var i = 0, l = cookies.length; i < l; i++) { | ||
+ | var parts = cookies[i].split('='); | ||
+ | var name = decode(parts.shift()); | ||
+ | var cookie = parts.join('='); | ||
+ | |||
+ | if (key && key === name) { | ||
+ | // If second argument (value) is a function it's a converter... | ||
+ | result = read(cookie, value); | ||
+ | break; | ||
+ | } | ||
+ | |||
+ | // Prevent storing a cookie that we couldn't decode. | ||
+ | if (!key && (cookie = read(cookie)) !== undefined) { | ||
+ | result[name] = cookie; | ||
+ | } | ||
+ | } | ||
+ | |||
+ | return result; | ||
+ | }; | ||
+ | |||
+ | config.defaults = {}; | ||
+ | |||
+ | $.removeCookie = function (key, options) { | ||
+ | if ($.cookie(key) === undefined) { | ||
+ | return false; | ||
+ | } | ||
+ | |||
+ | // Must not alter options, thus extending a fresh object... | ||
+ | $.cookie(key, '', $.extend({}, options, { expires: -1 })); | ||
+ | return !$.cookie(key); | ||
+ | }; | ||
+ | |||
+ | })); | ||
+ | |||
+ | </script> | ||
+ | |||
+ | |||
+ | <script type="text/javascript"> | ||
+ | (function (factory) { | ||
+ | if (typeof define === 'function' && define.amd) { | ||
+ | // AMD | ||
+ | define(['jquery'], factory); | ||
+ | } else if (typeof exports === 'object') { | ||
+ | // CommonJS | ||
+ | factory(require('jquery')); | ||
+ | } else { | ||
+ | // Browser globals | ||
+ | factory(jQuery); | ||
+ | } | ||
+ | }(function ($) { | ||
+ | var CountTo = function (element, options) { | ||
+ | this.$element = $(element); | ||
+ | this.options = $.extend({}, CountTo.DEFAULTS, this.dataOptions(), options); | ||
+ | this.init(); | ||
+ | }; | ||
+ | |||
+ | CountTo.DEFAULTS = { | ||
+ | from: 0, // the number the element should start at | ||
+ | to: 0, // the number the element should end at | ||
+ | speed: 1000, // how long it should take to count between the target numbers | ||
+ | refreshInterval: 100, // how often the element should be updated | ||
+ | decimals: 0, // the number of decimal places to show | ||
+ | formatter: formatter, // handler for formatting the value before rendering | ||
+ | onUpdate: null, // callback method for every time the element is updated | ||
+ | onComplete: null // callback method for when the element finishes updating | ||
+ | }; | ||
+ | |||
+ | CountTo.prototype.init = function () { | ||
+ | this.value = this.options.from; | ||
+ | this.loops = Math.ceil(this.options.speed / this.options.refreshInterval); | ||
+ | this.loopCount = 0; | ||
+ | this.increment = (this.options.to - this.options.from) / this.loops; | ||
+ | }; | ||
+ | |||
+ | CountTo.prototype.dataOptions = function () { | ||
+ | var options = { | ||
+ | from: this.$element.data('from'), | ||
+ | to: this.$element.data('to'), | ||
+ | speed: this.$element.data('speed'), | ||
+ | refreshInterval: this.$element.data('refresh-interval'), | ||
+ | decimals: this.$element.data('decimals') | ||
+ | }; | ||
+ | |||
+ | var keys = Object.keys(options); | ||
+ | |||
+ | for (var i in keys) { | ||
+ | var key = keys[i]; | ||
+ | |||
+ | if (typeof(options[key]) === 'undefined') { | ||
+ | delete options[key]; | ||
+ | } | ||
+ | } | ||
+ | |||
+ | return options; | ||
+ | }; | ||
+ | |||
+ | CountTo.prototype.update = function () { | ||
+ | this.value += this.increment; | ||
+ | this.loopCount++; | ||
+ | |||
+ | this.render(); | ||
+ | |||
+ | if (typeof(this.options.onUpdate) == 'function') { | ||
+ | this.options.onUpdate.call(this.$element, this.value); | ||
+ | } | ||
+ | |||
+ | if (this.loopCount >= this.loops) { | ||
+ | clearInterval(this.interval); | ||
+ | this.value = this.options.to; | ||
+ | |||
+ | if (typeof(this.options.onComplete) == 'function') { | ||
+ | this.options.onComplete.call(this.$element, this.value); | ||
+ | } | ||
+ | } | ||
+ | }; | ||
+ | |||
+ | CountTo.prototype.render = function () { | ||
+ | var formattedValue = this.options.formatter.call(this.$element, this.value, this.options); | ||
+ | this.$element.text(formattedValue); | ||
+ | }; | ||
+ | |||
+ | CountTo.prototype.restart = function () { | ||
+ | this.stop(); | ||
+ | this.init(); | ||
+ | this.start(); | ||
+ | }; | ||
+ | |||
+ | CountTo.prototype.start = function () { | ||
+ | this.stop(); | ||
+ | this.render(); | ||
+ | this.interval = setInterval(this.update.bind(this), this.options.refreshInterval); | ||
+ | }; | ||
+ | |||
+ | CountTo.prototype.stop = function () { | ||
+ | if (this.interval) { | ||
+ | clearInterval(this.interval); | ||
+ | } | ||
+ | }; | ||
+ | |||
+ | CountTo.prototype.toggle = function () { | ||
+ | if (this.interval) { | ||
+ | this.stop(); | ||
+ | } else { | ||
+ | this.start(); | ||
+ | } | ||
+ | }; | ||
+ | |||
+ | function formatter(value, options) { | ||
+ | return value.toFixed(options.decimals); | ||
+ | } | ||
+ | |||
+ | $.fn.countTo = function (option) { | ||
+ | return this.each(function () { | ||
+ | var $this = $(this); | ||
+ | var data = $this.data('countTo'); | ||
+ | var init = !data || typeof(option) === 'object'; | ||
+ | var options = typeof(option) === 'object' ? option : {}; | ||
+ | var method = typeof(option) === 'string' ? option : 'start'; | ||
+ | |||
+ | if (init) { | ||
+ | if (data) data.stop(); | ||
+ | $this.data('countTo', data = new CountTo(this, options)); | ||
+ | } | ||
+ | |||
+ | data[method].call(data); | ||
+ | }); | ||
+ | }; | ||
+ | })); | ||
+ | |||
+ | </script> | ||
+ | |||
+ | |||
+ | <script type="text/javascript"> | ||
+ | /* | ||
+ | * jQuery Easing v1.3 - http://gsgd.co.uk/sandbox/jquery/easing/ | ||
+ | * | ||
+ | * Uses the built in easing capabilities added In jQuery 1.1 | ||
+ | * to offer multiple easing options | ||
+ | * | ||
+ | * TERMS OF USE - jQuery Easing | ||
+ | * | ||
+ | * Open source under the BSD License. | ||
+ | * | ||
+ | * Copyright © 2008 George McGinley Smith | ||
+ | * All rights reserved. | ||
+ | * | ||
+ | * Redistribution and use in source and binary forms, with or without modification, | ||
+ | * are permitted provided that the following conditions are met: | ||
+ | * | ||
+ | * Redistributions of source code must retain the above copyright notice, this list of | ||
+ | * conditions and the following disclaimer. | ||
+ | * Redistributions in binary form must reproduce the above copyright notice, this list | ||
+ | * of conditions and the following disclaimer in the documentation and/or other materials | ||
+ | * provided with the distribution. | ||
+ | * | ||
+ | * Neither the name of the author nor the names of contributors may be used to endorse | ||
+ | * or promote products derived from this software without specific prior written permission. | ||
+ | * | ||
+ | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY | ||
+ | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF | ||
+ | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE | ||
+ | * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | ||
+ | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE | ||
+ | * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED | ||
+ | * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | ||
+ | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | ||
+ | * OF THE POSSIBILITY OF SUCH DAMAGE. | ||
+ | * | ||
+ | */ | ||
+ | |||
+ | // t: current time, b: begInnIng value, c: change In value, d: duration | ||
+ | jQuery.easing['jswing'] = jQuery.easing['swing']; | ||
+ | |||
+ | jQuery.extend( jQuery.easing, | ||
+ | { | ||
+ | def: 'easeOutQuad', | ||
+ | swing: function (x, t, b, c, d) { | ||
+ | //alert(jQuery.easing.default); | ||
+ | return jQuery.easing[jQuery.easing.def](x, t, b, c, d); | ||
+ | }, | ||
+ | easeInQuad: function (x, t, b, c, d) { | ||
+ | return c*(t/=d)*t + b; | ||
+ | }, | ||
+ | easeOutQuad: function (x, t, b, c, d) { | ||
+ | return -c *(t/=d)*(t-2) + b; | ||
+ | }, | ||
+ | easeInOutQuad: function (x, t, b, c, d) { | ||
+ | if ((t/=d/2) < 1) return c/2*t*t + b; | ||
+ | return -c/2 * ((--t)*(t-2) - 1) + b; | ||
+ | }, | ||
+ | easeInCubic: function (x, t, b, c, d) { | ||
+ | return c*(t/=d)*t*t + b; | ||
+ | }, | ||
+ | easeOutCubic: function (x, t, b, c, d) { | ||
+ | return c*((t=t/d-1)*t*t + 1) + b; | ||
+ | }, | ||
+ | easeInOutCubic: function (x, t, b, c, d) { | ||
+ | if ((t/=d/2) < 1) return c/2*t*t*t + b; | ||
+ | return c/2*((t-=2)*t*t + 2) + b; | ||
+ | }, | ||
+ | easeInQuart: function (x, t, b, c, d) { | ||
+ | return c*(t/=d)*t*t*t + b; | ||
+ | }, | ||
+ | easeOutQuart: function (x, t, b, c, d) { | ||
+ | return -c * ((t=t/d-1)*t*t*t - 1) + b; | ||
+ | }, | ||
+ | easeInOutQuart: function (x, t, b, c, d) { | ||
+ | if ((t/=d/2) < 1) return c/2*t*t*t*t + b; | ||
+ | return -c/2 * ((t-=2)*t*t*t - 2) + b; | ||
+ | }, | ||
+ | easeInQuint: function (x, t, b, c, d) { | ||
+ | return c*(t/=d)*t*t*t*t + b; | ||
+ | }, | ||
+ | easeOutQuint: function (x, t, b, c, d) { | ||
+ | return c*((t=t/d-1)*t*t*t*t + 1) + b; | ||
+ | }, | ||
+ | easeInOutQuint: function (x, t, b, c, d) { | ||
+ | if ((t/=d/2) < 1) return c/2*t*t*t*t*t + b; | ||
+ | return c/2*((t-=2)*t*t*t*t + 2) + b; | ||
+ | }, | ||
+ | easeInSine: function (x, t, b, c, d) { | ||
+ | return -c * Math.cos(t/d * (Math.PI/2)) + c + b; | ||
+ | }, | ||
+ | easeOutSine: function (x, t, b, c, d) { | ||
+ | return c * Math.sin(t/d * (Math.PI/2)) + b; | ||
+ | }, | ||
+ | easeInOutSine: function (x, t, b, c, d) { | ||
+ | return -c/2 * (Math.cos(Math.PI*t/d) - 1) + b; | ||
+ | }, | ||
+ | easeInExpo: function (x, t, b, c, d) { | ||
+ | return (t==0) ? b : c * Math.pow(2, 10 * (t/d - 1)) + b; | ||
+ | }, | ||
+ | easeOutExpo: function (x, t, b, c, d) { | ||
+ | return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b; | ||
+ | }, | ||
+ | easeInOutExpo: function (x, t, b, c, d) { | ||
+ | if (t==0) return b; | ||
+ | if (t==d) return b+c; | ||
+ | if ((t/=d/2) < 1) return c/2 * Math.pow(2, 10 * (t - 1)) + b; | ||
+ | return c/2 * (-Math.pow(2, -10 * --t) + 2) + b; | ||
+ | }, | ||
+ | easeInCirc: function (x, t, b, c, d) { | ||
+ | return -c * (Math.sqrt(1 - (t/=d)*t) - 1) + b; | ||
+ | }, | ||
+ | easeOutCirc: function (x, t, b, c, d) { | ||
+ | return c * Math.sqrt(1 - (t=t/d-1)*t) + b; | ||
+ | }, | ||
+ | easeInOutCirc: function (x, t, b, c, d) { | ||
+ | if ((t/=d/2) < 1) return -c/2 * (Math.sqrt(1 - t*t) - 1) + b; | ||
+ | return c/2 * (Math.sqrt(1 - (t-=2)*t) + 1) + b; | ||
+ | }, | ||
+ | easeInElastic: function (x, t, b, c, d) { | ||
+ | var s=1.70158;var p=0;var a=c; | ||
+ | if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3; | ||
+ | if (a < Math.abs(c)) { a=c; var s=p/4; } | ||
+ | else var s = p/(2*Math.PI) * Math.asin (c/a); | ||
+ | return -(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b; | ||
+ | }, | ||
+ | easeOutElastic: function (x, t, b, c, d) { | ||
+ | var s=1.70158;var p=0;var a=c; | ||
+ | if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3; | ||
+ | if (a < Math.abs(c)) { a=c; var s=p/4; } | ||
+ | else var s = p/(2*Math.PI) * Math.asin (c/a); | ||
+ | return a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b; | ||
+ | }, | ||
+ | easeInOutElastic: function (x, t, b, c, d) { | ||
+ | var s=1.70158;var p=0;var a=c; | ||
+ | if (t==0) return b; if ((t/=d/2)==2) return b+c; if (!p) p=d*(.3*1.5); | ||
+ | if (a < Math.abs(c)) { a=c; var s=p/4; } | ||
+ | else var s = p/(2*Math.PI) * Math.asin (c/a); | ||
+ | if (t < 1) return -.5*(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b; | ||
+ | return a*Math.pow(2,-10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )*.5 + c + b; | ||
+ | }, | ||
+ | easeInBack: function (x, t, b, c, d, s) { | ||
+ | if (s == undefined) s = 1.70158; | ||
+ | return c*(t/=d)*t*((s+1)*t - s) + b; | ||
+ | }, | ||
+ | easeOutBack: function (x, t, b, c, d, s) { | ||
+ | if (s == undefined) s = 1.70158; | ||
+ | return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b; | ||
+ | }, | ||
+ | easeInOutBack: function (x, t, b, c, d, s) { | ||
+ | if (s == undefined) s = 1.70158; | ||
+ | if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b; | ||
+ | return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b; | ||
+ | }, | ||
+ | easeInBounce: function (x, t, b, c, d) { | ||
+ | return c - jQuery.easing.easeOutBounce (x, d-t, 0, c, d) + b; | ||
+ | }, | ||
+ | easeOutBounce: function (x, t, b, c, d) { | ||
+ | if ((t/=d) < (1/2.75)) { | ||
+ | return c*(7.5625*t*t) + b; | ||
+ | } else if (t < (2/2.75)) { | ||
+ | return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b; | ||
+ | } else if (t < (2.5/2.75)) { | ||
+ | return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b; | ||
+ | } else { | ||
+ | return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b; | ||
+ | } | ||
+ | }, | ||
+ | easeInOutBounce: function (x, t, b, c, d) { | ||
+ | if (t < d/2) return jQuery.easing.easeInBounce (x, t*2, 0, c, d) * .5 + b; | ||
+ | return jQuery.easing.easeOutBounce (x, t*2-d, 0, c, d) * .5 + c*.5 + b; | ||
+ | } | ||
+ | }); | ||
+ | |||
+ | /* | ||
+ | * | ||
+ | * TERMS OF USE - EASING EQUATIONS | ||
+ | * | ||
+ | * Open source under the BSD License. | ||
+ | * | ||
+ | * Copyright © 2001 Robert Penner | ||
+ | * All rights reserved. | ||
+ | * | ||
+ | * Redistribution and use in source and binary forms, with or without modification, | ||
+ | * are permitted provided that the following conditions are met: | ||
+ | * | ||
+ | * Redistributions of source code must retain the above copyright notice, this list of | ||
+ | * conditions and the following disclaimer. | ||
+ | * Redistributions in binary form must reproduce the above copyright notice, this list | ||
+ | * of conditions and the following disclaimer in the documentation and/or other materials | ||
+ | * provided with the distribution. | ||
+ | * | ||
+ | * Neither the name of the author nor the names of contributors may be used to endorse | ||
+ | * or promote products derived from this software without specific prior written permission. | ||
+ | * | ||
+ | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY | ||
+ | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF | ||
+ | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE | ||
+ | * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | ||
+ | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE | ||
+ | * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED | ||
+ | * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | ||
+ | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | ||
+ | * OF THE POSSIBILITY OF SUCH DAMAGE. | ||
+ | * | ||
+ | */ | ||
+ | </script> | ||
+ | |||
+ | |||
+ | <script type="text/javascript"> | ||
+ | /**! | ||
+ | * easy-pie-chart | ||
+ | * Lightweight plugin to render simple, animated and retina optimized pie charts | ||
+ | * | ||
+ | * @license | ||
+ | * @author Robert Fleischmann <rendro87@gmail.com> (http://robert-fleischmann.de) | ||
+ | * @version 2.1.7 | ||
+ | **/ | ||
+ | !function(a,b){"function"==typeof define&&define.amd?define(["jquery"],function(a){return b(a)}):"object"==typeof exports?module.exports=b(require("jquery")):b(jQuery)}(this,function(a){var b=function(a,b){var c,d=document.createElement("canvas");a.appendChild(d),"object"==typeof G_vmlCanvasManager&&G_vmlCanvasManager.initElement(d);var e=d.getContext("2d");d.width=d.height=b.size;var f=1;window.devicePixelRatio>1&&(f=window.devicePixelRatio,d.style.width=d.style.height=[b.size,"px"].join(""),d.width=d.height=b.size*f,e.scale(f,f)),e.translate(b.size/2,b.size/2),e.rotate((-0.5+b.rotate/180)*Math.PI);var g=(b.size-b.lineWidth)/2;b.scaleColor&&b.scaleLength&&(g-=b.scaleLength+2),Date.now=Date.now||function(){return+new Date};var h=function(a,b,c){c=Math.min(Math.max(-1,c||0),1);var d=0>=c?!0:!1;e.beginPath(),e.arc(0,0,g,0,2*Math.PI*c,d),e.strokeStyle=a,e.lineWidth=b,e.stroke()},i=function(){var a,c;e.lineWidth=1,e.fillStyle=b.scaleColor,e.save();for(var d=24;d>0;--d)d%6===0?(c=b.scaleLength,a=0):(c=.6*b.scaleLength,a=b.scaleLength-c),e.fillRect(-b.size/2+a,0,c,1),e.rotate(Math.PI/12);e.restore()},j=function(){return window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||function(a){window.setTimeout(a,1e3/60)}}(),k=function(){b.scaleColor&&i(),b.trackColor&&h(b.trackColor,b.trackWidth||b.lineWidth,1)};this.getCanvas=function(){return d},this.getCtx=function(){return e},this.clear=function(){e.clearRect(b.size/-2,b.size/-2,b.size,b.size)},this.draw=function(a){b.scaleColor||b.trackColor?e.getImageData&&e.putImageData?c?e.putImageData(c,0,0):(k(),c=e.getImageData(0,0,b.size*f,b.size*f)):(this.clear(),k()):this.clear(),e.lineCap=b.lineCap;var d;d="function"==typeof b.barColor?b.barColor(a):b.barColor,h(d,b.lineWidth,a/100)}.bind(this),this.animate=function(a,c){var d=Date.now();b.onStart(a,c);var e=function(){var f=Math.min(Date.now()-d,b.animate.duration),g=b.easing(this,f,a,c-a,b.animate.duration);this.draw(g),b.onStep(a,c,g),f>=b.animate.duration?b.onStop(a,c):j(e)}.bind(this);j(e)}.bind(this)},c=function(a,c){var d={barColor:"#ef1e25",trackColor:"#f9f9f9",scaleColor:"#dfe0e0",scaleLength:5,lineCap:"round",lineWidth:3,trackWidth:void 0,size:110,rotate:0,animate:{duration:1e3,enabled:!0},easing:function(a,b,c,d,e){return b/=e/2,1>b?d/2*b*b+c:-d/2*(--b*(b-2)-1)+c},onStart:function(a,b){},onStep:function(a,b,c){},onStop:function(a,b){}};if("undefined"!=typeof b)d.renderer=b;else{if("undefined"==typeof SVGRenderer)throw new Error("Please load either the SVG- or the CanvasRenderer");d.renderer=SVGRenderer}var e={},f=0,g=function(){this.el=a,this.options=e;for(var b in d)d.hasOwnProperty(b)&&(e[b]=c&&"undefined"!=typeof c[b]?c[b]:d[b],"function"==typeof e[b]&&(e[b]=e[b].bind(this)));"string"==typeof e.easing&&"undefined"!=typeof jQuery&&jQuery.isFunction(jQuery.easing[e.easing])?e.easing=jQuery.easing[e.easing]:e.easing=d.easing,"number"==typeof e.animate&&(e.animate={duration:e.animate,enabled:!0}),"boolean"!=typeof e.animate||e.animate||(e.animate={duration:1e3,enabled:e.animate}),this.renderer=new e.renderer(a,e),this.renderer.draw(f),a.dataset&&a.dataset.percent?this.update(parseFloat(a.dataset.percent)):a.getAttribute&&a.getAttribute("data-percent")&&this.update(parseFloat(a.getAttribute("data-percent")))}.bind(this);this.update=function(a){return a=parseFloat(a),e.animate.enabled?this.renderer.animate(f,a):this.renderer.draw(a),f=a,this}.bind(this),this.disableAnimation=function(){return e.animate.enabled=!1,this},this.enableAnimation=function(){return e.animate.enabled=!0,this},g()};a.fn.easyPieChart=function(b){return this.each(function(){var d;a.data(this,"easyPieChart")||(d=a.extend({},b,a(this).data()),a.data(this,"easyPieChart",new c(this,d)))})}}); | ||
+ | </script> | ||
+ | |||
+ | |||
+ | <script type="text/javascript"> | ||
+ | /* | ||
+ | * jQuery FlexSlider v2.2.0 | ||
+ | * Copyright 2012 WooThemes | ||
+ | * Contributing Author: Tyler Smith | ||
+ | */(function(e){e.flexslider=function(t,n){var r=e(t);r.vars=e.extend({},e.flexslider.defaults,n);var i=r.vars.namespace,s=window.navigator&&window.navigator.msPointerEnabled&&window.MSGesture,o=("ontouchstart"in window||s||window.DocumentTouch&&document instanceof DocumentTouch)&&r.vars.touch,u="click touchend MSPointerUp",a="",f,l=r.vars.direction==="vertical",c=r.vars.reverse,h=r.vars.itemWidth>0,p=r.vars.animation==="fade",d=r.vars.asNavFor!=="",v={},m=!0;e.data(t,"flexslider",r);v={init:function(){r.animating=!1;r.currentSlide=parseInt(r.vars.startAt?r.vars.startAt:0);isNaN(r.currentSlide)&&(r.currentSlide=0);r.animatingTo=r.currentSlide;r.atEnd=r.currentSlide===0||r.currentSlide===r.last;r.containerSelector=r.vars.selector.substr(0,r.vars.selector.search(" "));r.slides=e(r.vars.selector,r);r.container=e(r.containerSelector,r);r.count=r.slides.length;r.syncExists=e(r.vars.sync).length>0;r.vars.animation==="slide"&&(r.vars.animation="swing");r.prop=l?"top":"marginLeft";r.args={};r.manualPause=!1;r.stopped=!1;r.started=!1;r.startTimeout=null;r.transitions=!r.vars.video&&!p&&r.vars.useCSS&&function(){var e=document.createElement("div"),t=["perspectiveProperty","WebkitPerspective","MozPerspective","OPerspective","msPerspective"];for(var n in t)if(e.style[t[n]]!==undefined){r.pfx=t[n].replace("Perspective","").toLowerCase();r.prop="-"+r.pfx+"-transform";return!0}return!1}();r.vars.controlsContainer!==""&&(r.controlsContainer=e(r.vars.controlsContainer).length>0&&e(r.vars.controlsContainer));r.vars.manualControls!==""&&(r.manualControls=e(r.vars.manualControls).length>0&&e(r.vars.manualControls));if(r.vars.randomize){r.slides.sort(function(){return Math.round(Math.random())-.5});r.container.empty().append(r.slides)}r.doMath();r.setup("init");r.vars.controlNav&&v.controlNav.setup();r.vars.directionNav&&v.directionNav.setup();r.vars.keyboard&&(e(r.containerSelector).length===1||r.vars.multipleKeyboard)&&e(document).bind("keyup",function(e){var t=e.keyCode;if(!r.animating&&(t===39||t===37)){var n=t===39?r.getTarget("next"):t===37?r.getTarget("prev"):!1;r.flexAnimate(n,r.vars.pauseOnAction)}});r.vars.mousewheel&&r.bind("mousewheel",function(e,t,n,i){e.preventDefault();var s=t<0?r.getTarget("next"):r.getTarget("prev");r.flexAnimate(s,r.vars.pauseOnAction)});r.vars.pausePlay&&v.pausePlay.setup();r.vars.slideshow&&r.vars.pauseInvisible&&v.pauseInvisible.init();if(r.vars.slideshow){r.vars.pauseOnHover&&r.hover(function(){!r.manualPlay&&!r.manualPause&&r.pause()},function(){!r.manualPause&&!r.manualPlay&&!r.stopped&&r.play()});if(!r.vars.pauseInvisible||!v.pauseInvisible.isHidden())r.vars.initDelay>0?r.startTimeout=setTimeout(r.play,r.vars.initDelay):r.play()}d&&v.asNav.setup();o&&r.vars.touch&&v.touch();(!p||p&&r.vars.smoothHeight)&&e(window).bind("resize orientationchange focus",v.resize);r.find("img").attr("draggable","false");setTimeout(function(){r.vars.start(r)},200)},asNav:{setup:function(){r.asNav=!0;r.animatingTo=Math.floor(r.currentSlide/r.move);r.currentItem=r.currentSlide;r.slides.removeClass(i+"active-slide").eq(r.currentItem).addClass(i+"active-slide");if(!s)r.slides.click(function(t){t.preventDefault();var n=e(this),s=n.index(),o=n.offset().left-e(r).scrollLeft();if(o<=0&&n.hasClass(i+"active-slide"))r.flexAnimate(r.getTarget("prev"),!0);else if(!e(r.vars.asNavFor).data("flexslider").animating&&!n.hasClass(i+"active-slide")){r.direction=r.currentItem<s?"next":"prev";r.flexAnimate(s,r.vars.pauseOnAction,!1,!0,!0)}});else{t._slider=r;r.slides.each(function(){var t=this;t._gesture=new MSGesture;t._gesture.target=t;t.addEventListener("MSPointerDown",function(e){e.preventDefault();e.currentTarget._gesture&&e.currentTarget._gesture.addPointer(e.pointerId)},!1);t.addEventListener("MSGestureTap",function(t){t.preventDefault();var n=e(this),i=n.index();if(!e(r.vars.asNavFor).data("flexslider").animating&&!n.hasClass("active")){r.direction=r.currentItem<i?"next":"prev";r.flexAnimate(i,r.vars.pauseOnAction,!1,!0,!0)}})})}}},controlNav:{setup:function(){r.manualControls?v.controlNav.setupManual():v.controlNav.setupPaging()},setupPaging:function(){var t=r.vars.controlNav==="thumbnails"?"control-thumbs":"control-paging",n=1,s,o;r.controlNavScaffold=e('<ol class="'+i+"control-nav "+i+t+'"></ol>');if(r.pagingCount>1)for(var f=0;f<r.pagingCount;f++){o=r.slides.eq(f);s=r.vars.controlNav==="thumbnails"?'<img src="'+o.attr("data-thumb")+'"/>':"<a>"+n+"</a>";if("thumbnails"===r.vars.controlNav&&!0===r.vars.thumbCaptions){var l=o.attr("data-thumbcaption");""!=l&&undefined!=l&&(s+='<span class="'+i+'caption">'+l+"</span>")}r.controlNavScaffold.append("<li>"+s+"</li>");n++}r.controlsContainer?e(r.controlsContainer).append(r.controlNavScaffold):r.append(r.controlNavScaffold);v.controlNav.set();v.controlNav.active();r.controlNavScaffold.delegate("a, img",u,function(t){t.preventDefault();if(a===""||a===t.type){var n=e(this),s=r.controlNav.index(n);if(!n.hasClass(i+"active")){r.direction=s>r.currentSlide?"next":"prev";r.flexAnimate(s,r.vars.pauseOnAction)}}a===""&&(a=t.type);v.setToClearWatchedEvent()})},setupManual:function(){r.controlNav=r.manualControls;v.controlNav.active();r.controlNav.bind(u,function(t){t.preventDefault();if(a===""||a===t.type){var n=e(this),s=r.controlNav.index(n);if(!n.hasClass(i+"active")){s>r.currentSlide?r.direction="next":r.direction="prev";r.flexAnimate(s,r.vars.pauseOnAction)}}a===""&&(a=t.type);v.setToClearWatchedEvent()})},set:function(){var t=r.vars.controlNav==="thumbnails"?"img":"a";r.controlNav=e("."+i+"control-nav li "+t,r.controlsContainer?r.controlsContainer:r)},active:function(){r.controlNav.removeClass(i+"active").eq(r.animatingTo).addClass(i+"active")},update:function(t,n){r.pagingCount>1&&t==="add"?r.controlNavScaffold.append(e("<li><a>"+r.count+"</a></li>")):r.pagingCount===1?r.controlNavScaffold.find("li").remove():r.controlNav.eq(n).closest("li").remove();v.controlNav.set();r.pagingCount>1&&r.pagingCount!==r.controlNav.length?r.update(n,t):v.controlNav.active()}},directionNav:{setup:function(){var t=e('<ul class="'+i+'direction-nav"><li><a class="'+i+'prev" href="#">'+r.vars.prevText+'</a></li><li><a class="'+i+'next" href="#">'+r.vars.nextText+"</a></li></ul>");if(r.controlsContainer){e(r.controlsContainer).append(t);r.directionNav=e("."+i+"direction-nav li a",r.controlsContainer)}else{r.append(t);r.directionNav=e("."+i+"direction-nav li a",r)}v.directionNav.update();r.directionNav.bind(u,function(t){t.preventDefault();var n;if(a===""||a===t.type){n=e(this).hasClass(i+"next")?r.getTarget("next"):r.getTarget("prev");r.flexAnimate(n,r.vars.pauseOnAction)}a===""&&(a=t.type);v.setToClearWatchedEvent()})},update:function(){var e=i+"disabled";r.pagingCount===1?r.directionNav.addClass(e).attr("tabindex","-1"):r.vars.animationLoop?r.directionNav.removeClass(e).removeAttr("tabindex"):r.animatingTo===0?r.directionNav.removeClass(e).filter("."+i+"prev").addClass(e).attr("tabindex","-1"):r.animatingTo===r.last?r.directionNav.removeClass(e).filter("."+i+"next").addClass(e).attr("tabindex","-1"):r.directionNav.removeClass(e).removeAttr("tabindex")}},pausePlay:{setup:function(){var t=e('<div class="'+i+'pauseplay"><a></a></div>');if(r.controlsContainer){r.controlsContainer.append(t);r.pausePlay=e("."+i+"pauseplay a",r.controlsContainer)}else{r.append(t);r.pausePlay=e("."+i+"pauseplay a",r)}v.pausePlay.update(r.vars.slideshow?i+"pause":i+"play");r.pausePlay.bind(u,function(t){t.preventDefault();if(a===""||a===t.type)if(e(this).hasClass(i+"pause")){r.manualPause=!0;r.manualPlay=!1;r.pause()}else{r.manualPause=!1;r.manualPlay=!0;r.play()}a===""&&(a=t.type);v.setToClearWatchedEvent()})},update:function(e){e==="play"?r.pausePlay.removeClass(i+"pause").addClass(i+"play").html(r.vars.playText):r.pausePlay.removeClass(i+"play").addClass(i+"pause").html(r.vars.pauseText)}},touch:function(){var e,n,i,o,u,a,f=!1,d=0,v=0,m=0;if(!s){t.addEventListener("touchstart",g,!1);function g(s){if(r.animating)s.preventDefault();else if(window.navigator.msPointerEnabled||s.touches.length===1){r.pause();o=l?r.h:r.w;a=Number(new Date);d=s.touches[0].pageX;v=s.touches[0].pageY;i=h&&c&&r.animatingTo===r.last?0:h&&c?r.limit-(r.itemW+r.vars.itemMargin)*r.move*r.animatingTo:h&&r.currentSlide===r.last?r.limit:h?(r.itemW+r.vars.itemMargin)*r.move*r.currentSlide:c?(r.last-r.currentSlide+r.cloneOffset)*o:(r.currentSlide+r.cloneOffset)*o;e=l?v:d;n=l?d:v;t.addEventListener("touchmove",y,!1);t.addEventListener("touchend",b,!1)}}function y(t){d=t.touches[0].pageX;v=t.touches[0].pageY;u=l?e-v:e-d;f=l?Math.abs(u)<Math.abs(d-n):Math.abs(u)<Math.abs(v-n);var s=500;if(!f||Number(new Date)-a>s){t.preventDefault();if(!p&&r.transitions){r.vars.animationLoop||(u/=r.currentSlide===0&&u<0||r.currentSlide===r.last&&u>0?Math.abs(u)/o+2:1);r.setProps(i+u,"setTouch")}}}function b(s){t.removeEventListener("touchmove",y,!1);if(r.animatingTo===r.currentSlide&&!f&&u!==null){var l=c?-u:u,h=l>0?r.getTarget("next"):r.getTarget("prev");r.canAdvance(h)&&(Number(new Date)-a<550&&Math.abs(l)>50||Math.abs(l)>o/2)?r.flexAnimate(h,r.vars.pauseOnAction):p||r.flexAnimate(r.currentSlide,r.vars.pauseOnAction,!0)}t.removeEventListener("touchend",b,!1);e=null;n=null;u=null;i=null}}else{t.style.msTouchAction="none";t._gesture=new MSGesture;t._gesture.target=t;t.addEventListener("MSPointerDown",w,!1);t._slider=r;t.addEventListener("MSGestureChange",E,!1);t.addEventListener("MSGestureEnd",S,!1);function w(e){e.stopPropagation();if(r.animating)e.preventDefault();else{r.pause();t._gesture.addPointer(e.pointerId);m=0;o=l?r.h:r.w;a=Number(new Date);i=h&&c&&r.animatingTo===r.last?0:h&&c?r.limit-(r.itemW+r.vars.itemMargin)*r.move*r.animatingTo:h&&r.currentSlide===r.last?r.limit:h?(r.itemW+r.vars.itemMargin)*r.move*r.currentSlide:c?(r.last-r.currentSlide+r.cloneOffset)*o:(r.currentSlide+r.cloneOffset)*o}}function E(e){e.stopPropagation();var n=e.target._slider;if(!n)return;var r=-e.translationX,s=-e.translationY;m+=l?s:r;u=m;f=l?Math.abs(m)<Math.abs(-r):Math.abs(m)<Math.abs(-s);if(e.detail===e.MSGESTURE_FLAG_INERTIA){setImmediate(function(){t._gesture.stop()});return}if(!f||Number(new Date)-a>500){e.preventDefault();if(!p&&n.transitions){n.vars.animationLoop||(u=m/(n.currentSlide===0&&m<0||n.currentSlide===n.last&&m>0?Math.abs(m)/o+2:1));n.setProps(i+u,"setTouch")}}}function S(t){t.stopPropagation();var r=t.target._slider;if(!r)return;if(r.animatingTo===r.currentSlide&&!f&&u!==null){var s=c?-u:u,l=s>0?r.getTarget("next"):r.getTarget("prev");r.canAdvance(l)&&(Number(new Date)-a<550&&Math.abs(s)>50||Math.abs(s)>o/2)?r.flexAnimate(l,r.vars.pauseOnAction):p||r.flexAnimate(r.currentSlide,r.vars.pauseOnAction,!0)}e=null;n=null;u=null;i=null;m=0}}},resize:function(){if(!r.animating&&r.is(":visible")){h||r.doMath();if(p)v.smoothHeight();else if(h){r.slides.width(r.computedW);r.update(r.pagingCount);r.setProps()}else if(l){r.viewport.height(r.h);r.setProps(r.h,"setTotal")}else{r.vars.smoothHeight&&v.smoothHeight();r.newSlides.width(r.computedW);r.setProps(r.computedW,"setTotal")}}},smoothHeight:function(e){if(!l||p){var t=p?r:r.viewport;e?t.animate({height:r.slides.eq(r.animatingTo).height()},e):t.height(r.slides.eq(r.animatingTo).height())}},sync:function(t){var n=e(r.vars.sync).data("flexslider"),i=r.animatingTo;switch(t){case"animate":n.flexAnimate(i,r.vars.pauseOnAction,!1,!0);break;case"play":!n.playing&&!n.asNav&&n.play();break;case"pause":n.pause()}},pauseInvisible:{visProp:null,init:function(){var e=["webkit","moz","ms","o"];if("hidden"in document)return"hidden";for(var t=0;t<e.length;t++)e[t]+"Hidden"in document&&(v.pauseInvisible.visProp=e[t]+"Hidden");if(v.pauseInvisible.visProp){var n=v.pauseInvisible.visProp.replace(/[H|h]idden/,"")+"visibilitychange";document.addEventListener(n,function(){v.pauseInvisible.isHidden()?r.startTimeout?clearTimeout(r.startTimeout):r.pause():r.started?r.play():r.vars.initDelay>0?setTimeout(r.play,r.vars.initDelay):r.play()})}},isHidden:function(){return document[v.pauseInvisible.visProp]||!1}},setToClearWatchedEvent:function(){clearTimeout(f);f=setTimeout(function(){a=""},3e3)}};r.flexAnimate=function(t,n,s,u,a){!r.vars.animationLoop&&t!==r.currentSlide&&(r.direction=t>r.currentSlide?"next":"prev");d&&r.pagingCount===1&&(r.direction=r.currentItem<t?"next":"prev");if(!r.animating&&(r.canAdvance(t,a)||s)&&r.is(":visible")){if(d&&u){var f=e(r.vars.asNavFor).data("flexslider");r.atEnd=t===0||t===r.count-1;f.flexAnimate(t,!0,!1,!0,a);r.direction=r.currentItem<t?"next":"prev";f.direction=r.direction;if(Math.ceil((t+1)/r.visible)-1===r.currentSlide||t===0){r.currentItem=t;r.slides.removeClass(i+"active-slide").eq(t).addClass(i+"active-slide");return!1}r.currentItem=t;r.slides.removeClass(i+"active-slide").eq(t).addClass(i+"active-slide");t=Math.floor(t/r.visible)}r.animating=!0;r.animatingTo=t;n&&r.pause();r.vars.before(r);r.syncExists&&!a&&v.sync("animate");r.vars.controlNav&&v.controlNav.active();h||r.slides.removeClass(i+"active-slide").eq(t).addClass(i+"active-slide");r.atEnd=t===0||t===r.last;r.vars.directionNav&&v.directionNav.update();if(t===r.last){r.vars.end(r);r.vars.animationLoop||r.pause()}if(!p){var m=l?r.slides.filter(":first").height():r.computedW,g,y,b;if(h){g=r.vars.itemMargin;b=(r.itemW+g)*r.move*r.animatingTo;y=b>r.limit&&r.visible!==1?r.limit:b}else r.currentSlide===0&&t===r.count-1&&r.vars.animationLoop&&r.direction!=="next"?y=c?(r.count+r.cloneOffset)*m:0:r.currentSlide===r.last&&t===0&&r.vars.animationLoop&&r.direction!=="prev"?y=c?0:(r.count+1)*m:y=c?(r.count-1-t+r.cloneOffset)*m:(t+r.cloneOffset)*m;r.setProps(y,"",r.vars.animationSpeed);if(r.transitions){if(!r.vars.animationLoop||!r.atEnd){r.animating=!1;r.currentSlide=r.animatingTo}r.container.unbind("webkitTransitionEnd transitionend");r.container.bind("webkitTransitionEnd transitionend",function(){r.wrapup(m)})}else r.container.animate(r.args,r.vars.animationSpeed,r.vars.easing,function(){r.wrapup(m)})}else if(!o){r.slides.eq(r.currentSlide).css({zIndex:1}).animate({opacity:0},r.vars.animationSpeed,r.vars.easing);r.slides.eq(t).css({zIndex:2}).animate({opacity:1},r.vars.animationSpeed,r.vars.easing,r.wrapup)}else{r.slides.eq(r.currentSlide).css({opacity:0,zIndex:1});r.slides.eq(t).css({opacity:1,zIndex:2});r.wrapup(m)}r.vars.smoothHeight&&v.smoothHeight(r.vars.animationSpeed)}};r.wrapup=function(e){!p&&!h&&(r.currentSlide===0&&r.animatingTo===r.last&&r.vars.animationLoop?r.setProps(e,"jumpEnd"):r.currentSlide===r.last&&r.animatingTo===0&&r.vars.animationLoop&&r.setProps(e,"jumpStart"));r.animating=!1;r.currentSlide=r.animatingTo;r.vars.after(r)};r.animateSlides=function(){!r.animating&&m&&r.flexAnimate(r.getTarget("next"))};r.pause=function(){clearInterval(r.animatedSlides);r.animatedSlides=null;r.playing=!1;r.vars.pausePlay&&v.pausePlay.update("play");r.syncExists&&v.sync("pause")};r.play=function(){r.playing&&clearInterval(r.animatedSlides);r.animatedSlides=r.animatedSlides||setInterval(r.animateSlides,r.vars.slideshowSpeed);r.started=r.playing=!0;r.vars.pausePlay&&v.pausePlay.update("pause");r.syncExists&&v.sync("play")};r.stop=function(){r.pause();r.stopped=!0};r.canAdvance=function(e,t){var n=d?r.pagingCount-1:r.last;return t?!0:d&&r.currentItem===r.count-1&&e===0&&r.direction==="prev"?!0:d&&r.currentItem===0&&e===r.pagingCount-1&&r.direction!=="next"?!1:e===r.currentSlide&&!d?!1:r.vars.animationLoop?!0:r.atEnd&&r.currentSlide===0&&e===n&&r.direction!=="next"?!1:r.atEnd&&r.currentSlide===n&&e===0&&r.direction==="next"?!1:!0};r.getTarget=function(e){r.direction=e;return e==="next"?r.currentSlide===r.last?0:r.currentSlide+1:r.currentSlide===0?r.last:r.currentSlide-1};r.setProps=function(e,t,n){var i=function(){var n=e?e:(r.itemW+r.vars.itemMargin)*r.move*r.animatingTo,i=function(){if(h)return t==="setTouch"?e:c&&r.animatingTo===r.last?0:c?r.limit-(r.itemW+r.vars.itemMargin)*r.move*r.animatingTo:r.animatingTo===r.last?r.limit:n;switch(t){case"setTotal":return c?(r.count-1-r.currentSlide+r.cloneOffset)*e:(r.currentSlide+r.cloneOffset)*e;case"setTouch":return c?e:e;case"jumpEnd":return c?e:r.count*e;case"jumpStart":return c?r.count*e:e;default:return e}}();return i*-1+"px"}();if(r.transitions){i=l?"translate3d(0,"+i+",0)":"translate3d("+i+",0,0)";n=n!==undefined?n/1e3+"s":"0s";r.container.css("-"+r.pfx+"-transition-duration",n)}r.args[r.prop]=i;(r.transitions||n===undefined)&&r.container.css(r.args)};r.setup=function(t){if(!p){var n,s;if(t==="init"){r.viewport=e('<div class="'+i+'viewport"></div>').css({overflow:"hidden",position:"relative"}).appendTo(r).append(r.container);r.cloneCount=0;r.cloneOffset=0;if(c){s=e.makeArray(r.slides).reverse();r.slides=e(s);r.container.empty().append(r.slides)}}if(r.vars.animationLoop&&!h){r.cloneCount=2;r.cloneOffset=1;t!=="init"&&r.container.find(".clone").remove();r.container.append(r.slides.first().clone().addClass("clone").attr("aria-hidden","true")).prepend(r.slides.last().clone().addClass("clone").attr("aria-hidden","true"))}r.newSlides=e(r.vars.selector,r);n=c?r.count-1-r.currentSlide+r.cloneOffset:r.currentSlide+r.cloneOffset;if(l&&!h){r.container.height((r.count+r.cloneCount)*200+"%").css("position","absolute").width("100%");setTimeout(function(){r.newSlides.css({display:"block"});r.doMath();r.viewport.height(r.h);r.setProps(n*r.h,"init")},t==="init"?100:0)}else{r.container.width((r.count+r.cloneCount)*200+"%");r.setProps(n*r.computedW,"init");setTimeout(function(){r.doMath();r.newSlides.css({width:r.computedW,"float":"left",display:"block"});r.vars.smoothHeight&&v.smoothHeight()},t==="init"?100:0)}}else{r.slides.css({width:"100%","float":"left",marginRight:"-100%",position:"relative"});t==="init"&&(o?r.slides.css({opacity:0,display:"block",webkitTransition:"opacity "+r.vars.animationSpeed/1e3+"s ease",zIndex:1}).eq(r.currentSlide).css({opacity:1,zIndex:2}):r.slides.css({opacity:0,display:"block",zIndex:1}).eq(r.currentSlide).css({zIndex:2}).animate({opacity:1},r.vars.animationSpeed,r.vars.easing));r.vars.smoothHeight&&v.smoothHeight()}h||r.slides.removeClass(i+"active-slide").eq(r.currentSlide).addClass(i+"active-slide")};r.doMath=function(){var e=r.slides.first(),t=r.vars.itemMargin,n=r.vars.minItems,i=r.vars.maxItems;r.w=r.viewport===undefined?r.width():r.viewport.width();r.h=e.height();r.boxPadding=e.outerWidth()-e.width();if(h){r.itemT=r.vars.itemWidth+t;r.minW=n?n*r.itemT:r.w;r.maxW=i?i*r.itemT-t:r.w;r.itemW=r.minW>r.w?(r.w-t*(n-1))/n:r.maxW<r.w?(r.w-t*(i-1))/i:r.vars.itemWidth>r.w?r.w:r.vars.itemWidth;r.visible=Math.floor(r.w/r.itemW);r.move=r.vars.move>0&&r.vars.move<r.visible?r.vars.move:r.visible;r.pagingCount=Math.ceil((r.count-r.visible)/r.move+1);r.last=r.pagingCount-1;r.limit=r.pagingCount===1?0:r.vars.itemWidth>r.w?r.itemW*(r.count-1)+t*(r.count-1):(r.itemW+t)*r.count-r.w-t}else{r.itemW=r.w;r.pagingCount=r.count;r.last=r.count-1}r.computedW=r.itemW-r.boxPadding};r.update=function(e,t){r.doMath();if(!h){e<r.currentSlide?r.currentSlide+=1:e<=r.currentSlide&&e!==0&&(r.currentSlide-=1);r.animatingTo=r.currentSlide}if(r.vars.controlNav&&!r.manualControls)if(t==="add"&&!h||r.pagingCount>r.controlNav.length)v.controlNav.update("add");else if(t==="remove"&&!h||r.pagingCount<r.controlNav.length){if(h&&r.currentSlide>r.last){r.currentSlide-=1;r.animatingTo-=1}v.controlNav.update("remove",r.last)}r.vars.directionNav&&v.directionNav.update()};r.addSlide=function(t,n){var i=e(t);r.count+=1;r.last=r.count-1;l&&c?n!==undefined?r.slides.eq(r.count-n).after(i):r.container.prepend(i):n!==undefined?r.slides.eq(n).before(i):r.container.append(i);r.update(n,"add");r.slides=e(r.vars.selector+":not(.clone)",r);r.setup();r.vars.added(r)};r.removeSlide=function(t){var n=isNaN(t)?r.slides.index(e(t)):t;r.count-=1;r.last=r.count-1;isNaN(t)?e(t,r.slides).remove():l&&c?r.slides.eq(r.last).remove():r.slides.eq(t).remove();r.doMath();r.update(n,"remove");r.slides=e(r.vars.selector+":not(.clone)",r);r.setup();r.vars.removed(r)};v.init()};e(window).blur(function(e){focused=!1}).focus(function(e){focused=!0});e.flexslider.defaults={namespace:"flex-",selector:".slides > li",animation:"fade",easing:"swing",direction:"horizontal",reverse:!1,animationLoop:!0,smoothHeight:!1,startAt:0,slideshow:!0,slideshowSpeed:7e3,animationSpeed:600,initDelay:0,randomize:!1,thumbCaptions:!1,pauseOnAction:!0,pauseOnHover:!1,pauseInvisible:!0,useCSS:!0,touch:!0,video:!1,controlNav:!0,directionNav:!0,prevText:"",nextText:"",keyboard:!0,multipleKeyboard:!1,mousewheel:!1,pausePlay:!1,pauseText:"Pause",playText:"Play",controlsContainer:"",manualControls:"",sync:"",asNavFor:"",itemWidth:0,itemMargin:0,minItems:1,maxItems:0,move:0,allowOneSlide:!0,start:function(){},before:function(){},after:function(){},end:function(){},added:function(){},removed:function(){}};e.fn.flexslider=function(t){t===undefined&&(t={});if(typeof t=="object")return this.each(function(){var n=e(this),r=t.selector?t.selector:".slides > li",i=n.find(r);if(i.length===1&&t.allowOneSlide===!0||i.length===0){i.fadeIn(400);t.start&&t.start(n)}else n.data("flexslider")===undefined&&new e.flexslider(this,t)});var n=e(this).data("flexslider");switch(t){case"play":n.play();break;case"pause":n.pause();break;case"stop":n.stop();break;case"next":n.flexAnimate(n.getTarget("next"),!0);break;case"prev":case"previous":n.flexAnimate(n.getTarget("prev"),!0);break;default:typeof t=="number"&&n.flexAnimate(t,!0)}}})(jQuery); | ||
+ | </script> | ||
+ | |||
+ | |||
+ | <script type="text/javascript"> | ||
+ | /*! | ||
+ | * jQuery Fraction Slider v0.9.101 | ||
+ | * http://fractionslider.jacksbox.de | ||
+ | * | ||
+ | * Author: Mario Jäckle | ||
+ | * eMail: support@jacksbox.de | ||
+ | * | ||
+ | * Copyright 2014, jacksbox.design | ||
+ | * Free to use under the MIT license. | ||
+ | * http://www.opensource.org/licenses/mit-license.php | ||
+ | * | ||
+ | * Special thanks to: Lietzi (https://github.com/lietzi) for contributing | ||
+ | */ | ||
+ | ( function($) { | ||
+ | |||
+ | /** ************************* **/ | ||
+ | /** Methods **/ | ||
+ | /** ************************* **/ | ||
+ | var slider = null, methods = { | ||
+ | init : function(option) { | ||
+ | |||
+ | // defaults & options | ||
+ | var options = $.extend({ | ||
+ | 'slideTransition' : 'none', // default slide transition | ||
+ | 'slideTransitionSpeed' : 2000, // default slide transition | ||
+ | 'slideEndAnimation' : true, // if set true, objects will transition out at slide end (before the slideTransition is called) | ||
+ | 'position' : '0,0', // default position | should never be used | ||
+ | 'transitionIn' : 'left', // default in - transition | ||
+ | 'transitionOut' : 'left', // default out - transition | ||
+ | 'fullWidth' : false, // transition over the full width of the window | ||
+ | 'delay' : 0, // default delay for elements | ||
+ | 'timeout' : 2000, // default timeout before switching slides | ||
+ | 'speedIn' : 2500, // default in - transition speed | ||
+ | 'speedOut' : 1000, // default out - transition speed | ||
+ | 'easeIn' : 'easeOutExpo', // default easing in | ||
+ | 'easeOut' : 'easeOutCubic', // default easing out | ||
+ | |||
+ | 'controls' : false, // controls on/off | ||
+ | 'pager' : false, // controls on/off | ||
+ | 'autoChange' : true, // auto change slides | ||
+ | 'pauseOnHover' : false, // Pauses slider on hover (current step will still be completed) | ||
+ | |||
+ | 'backgroundAnimation' : false, // background animation | ||
+ | 'backgroundElement' : null, // element to animate | default fractionSlider element | ||
+ | 'backgroundX' : 500, // default x distance | ||
+ | 'backgroundY' : 500, // default y distance | ||
+ | 'backgroundSpeed' : 2500, // default background animation speed | ||
+ | 'backgroundEase' : 'easeOutCubic', // default background animation easing | ||
+ | |||
+ | 'responsive' : false, // activates the responsive slider | ||
+ | 'increase' : false, // if set, slider is allowed to get bigger than basic dimensions | ||
+ | 'dimensions' : '', // set basic dimension (width,height in px) for the responisve slider - the plugin with position elements with data-position relative to this dimensions (please see the documentation for more info), | ||
+ | |||
+ | 'startCallback' : null, | ||
+ | 'startNextSlideCallback' : null, | ||
+ | 'stopCallback' : null, | ||
+ | 'pauseCallback' : null, | ||
+ | 'resumeCallback' : null, | ||
+ | 'nextSlideCallback' : null, | ||
+ | 'prevSlideCallback' : null, | ||
+ | 'pagerCallback' : null | ||
+ | }, option); | ||
+ | |||
+ | return this.each(function() { | ||
+ | // ready for take-off | ||
+ | slider = new FractionSlider(this, options); | ||
+ | }); | ||
+ | }, | ||
+ | pause : function() { | ||
+ | slider.pause(true); | ||
+ | }, | ||
+ | resume : function() { | ||
+ | slider.resume(); | ||
+ | }, | ||
+ | stop : function() { | ||
+ | slider.stop(); | ||
+ | }, | ||
+ | start : function() { | ||
+ | slider.start(); | ||
+ | }, | ||
+ | startNextSlide : function() { | ||
+ | slider.startNextSlide(); | ||
+ | } | ||
+ | }; | ||
+ | |||
+ | /** ************************* **/ | ||
+ | /** SLDIER CLASS **/ | ||
+ | /** ************************* **/ | ||
+ | |||
+ | // here happens all the fun | ||
+ | var FractionSlider = function(element, options) { | ||
+ | |||
+ | var vars = { | ||
+ | init : true, // initialised the first time | ||
+ | running : false, // currently running | ||
+ | pause : false, | ||
+ | stop : false, | ||
+ | slideComplete : false, // current slide complete (needed for pause method) | ||
+ | stepComplete : false, | ||
+ | controlsActive : true, // controls pressed | ||
+ | currentSlide : 0, // current slide number | ||
+ | lastSlide : null, // last slide number (for anim out) | ||
+ | maxSlide : 0, // max slide number | ||
+ | currentStep : 0, // current step number | ||
+ | maxStep : 0, // max step number | ||
+ | currentObj : 0, // curent object number (in step) | ||
+ | maxObjs : 0, // max object number (in step) | ||
+ | finishedObjs : 0 // finsihed objects (in step) | ||
+ | }, | ||
+ | |||
+ | // Here are Slide elements temporarily stored | ||
+ | temp = { | ||
+ | currentSlide : null, // current Slide | ||
+ | lastSlide : null, // last Slide (for anim out) | ||
+ | animationkey : 'none' // animation for slidechange | ||
+ | }, timeouts = [], fractionObjs = null, | ||
+ | // objs for current step | ||
+ | dX = null, dY = null; | ||
+ | |||
+ | $(element).wrapInner('<div class="fraction-slider" />'); | ||
+ | |||
+ | var slider = $(element).find('.fraction-slider'), pager = null; | ||
+ | // the slider element | ||
+ | |||
+ | vars.maxSlide = slider.children('.slide').length - 1; | ||
+ | |||
+ | // some more needed vars | ||
+ | var sliderWidth = slider.width(), bodyWidth = $('body').width(), offsetX = 0; | ||
+ | |||
+ | if (options.fullWidth) { | ||
+ | offsetX = (bodyWidth - sliderWidth) / 2; | ||
+ | sliderWidth = bodyWidth; | ||
+ | } | ||
+ | |||
+ | var sliderHeight = slider.height(); | ||
+ | |||
+ | init(); | ||
+ | |||
+ | /** ************************* **/ | ||
+ | /** INITIALIZE **/ | ||
+ | /** ************************* **/ | ||
+ | |||
+ | function init() { | ||
+ | |||
+ | // controls | ||
+ | if (options.controls) { | ||
+ | slider.append('<a href="#" class="prev"></a><a href="#" class="next" ></a>'); | ||
+ | |||
+ | slider.find('.next').bind('click', function() { | ||
+ | return nextBtnPressed(); | ||
+ | }); | ||
+ | |||
+ | slider.find('.prev').bind('click', function() { | ||
+ | return prevBtnPressed(); | ||
+ | }); | ||
+ | } | ||
+ | |||
+ | if (options.pauseOnHover) { | ||
+ | slider.bind({ | ||
+ | mouseenter: function(){ pause(false); }, | ||
+ | mouseleave: function(){ resume(); } | ||
+ | }); | ||
+ | } | ||
+ | |||
+ | // fullwidth setup | ||
+ | if (options.fullWidth) { | ||
+ | slider.css({ | ||
+ | 'overflow' : 'visible' | ||
+ | }); | ||
+ | } else { | ||
+ | slider.css({ | ||
+ | 'overflow' : 'hidden' | ||
+ | }); | ||
+ | } | ||
+ | |||
+ | if (options.pager) { | ||
+ | var customPager = (typeof options.pager !== 'boolean'); | ||
+ | pager = (customPager) ? options.pager : $('<div class="fs-pager-wrapper"></div>'); | ||
+ | if (!customPager) { | ||
+ | slider.append(pager); | ||
+ | }else{ | ||
+ | pager.addClass('fs-custom-pager-wrapper'); | ||
+ | } | ||
+ | } | ||
+ | |||
+ | slider.children('.slide').each(function(index) { | ||
+ | var slide = $(this); | ||
+ | slide.children().attr('rel', index).addClass('fs_obj'); | ||
+ | slide.children('[data-fixed]').addClass('fs_fixed_obj'); | ||
+ | |||
+ | // pager again | ||
+ | if (options.pager || customPager) { | ||
+ | var tempObj = $('<a rel="' + index + '" href="#"></a>').bind('click', function() { | ||
+ | return pagerPressed(this); | ||
+ | }); | ||
+ | pager.append(tempObj); | ||
+ | } | ||
+ | }); | ||
+ | if (options.pager) { | ||
+ | pager = $(pager).children('a'); | ||
+ | } | ||
+ | |||
+ | // responisve | ||
+ | if (options.responsive) { | ||
+ | makeResponsive(); | ||
+ | } | ||
+ | |||
+ | // remove spinner | ||
+ | if (slider.find('.fs_loader').length > 0) { | ||
+ | slider.find('.fs_loader').remove(); | ||
+ | } | ||
+ | |||
+ | // all importent stuff is done, everybody has taken a shower, we can go | ||
+ | // starts the slider and the slide rotation | ||
+ | start(); | ||
+ | } | ||
+ | |||
+ | /** ************************* **/ | ||
+ | /** METHODES **/ | ||
+ | /** ************************* **/ | ||
+ | |||
+ | function start() { | ||
+ | vars.stop = false; | ||
+ | vars.pause = false; | ||
+ | vars.running = true; | ||
+ | |||
+ | cycle('slide'); | ||
+ | |||
+ | methodeCallback(options.startCallback); | ||
+ | } | ||
+ | |||
+ | |||
+ | this.start = function() {// for method calls | ||
+ | start(); | ||
+ | }; | ||
+ | |||
+ | function startNextSlide() { | ||
+ | vars.stop = false; | ||
+ | vars.pause = false; | ||
+ | vars.running = true; | ||
+ | |||
+ | nextSlide(); | ||
+ | |||
+ | methodeCallback(options.startNextSlideCallback); | ||
+ | } | ||
+ | |||
+ | |||
+ | this.startNextSlide = function() {// for method calls | ||
+ | startNextSlide(); | ||
+ | }; | ||
+ | |||
+ | // use with start or startNextSlide | ||
+ | function stop() { | ||
+ | vars.stop = true; | ||
+ | vars.running = false; | ||
+ | |||
+ | slider.find('.slide').stop(true, true); | ||
+ | slider.find('.fs_obj').stop(true, true).removeClass('fs-animation'); | ||
+ | stopTimeouts(timeouts); | ||
+ | |||
+ | methodeCallback(options.stopCallback); | ||
+ | } | ||
+ | |||
+ | |||
+ | this.stop = function() {// for method calls | ||
+ | stop(); | ||
+ | }; | ||
+ | |||
+ | // use with resume | ||
+ | function pause(finish) { | ||
+ | vars.pause = true; | ||
+ | vars.running = false; | ||
+ | |||
+ | if(finish) { | ||
+ | slider.find('.fs-animation').finish(); // finish the current step | ||
+ | } | ||
+ | |||
+ | methodeCallback(options.pauseCallback); | ||
+ | } | ||
+ | |||
+ | |||
+ | this.pause = function() {// for method calls | ||
+ | pause(false); | ||
+ | }; | ||
+ | |||
+ | // use with pause | ||
+ | function resume() { | ||
+ | vars.stop = false; | ||
+ | vars.pause = false; | ||
+ | vars.running = true; | ||
+ | |||
+ | if( vars.slideComplete ) { | ||
+ | cycle('slide'); | ||
+ | } else if( vars.stepComplete ) { | ||
+ | cycle('step'); | ||
+ | } else { | ||
+ | if (vars.finishedObjs < vars.maxObjs) { | ||
+ | // do nothing - elements are still animating | ||
+ | } else if (vars.currentStep < vars.maxStep) { // IS THIS STILL NEEDED? | ||
+ | cycle('step'); // IS THIS STILL NEEDED? | ||
+ | } else { | ||
+ | cycle('slide'); // IS THIS STILL NEEDED? | ||
+ | } | ||
+ | } | ||
+ | |||
+ | methodeCallback(options.resumeCallback ); | ||
+ | } | ||
+ | |||
+ | |||
+ | this.resume = function() {// for method calls | ||
+ | resume(); | ||
+ | }; | ||
+ | |||
+ | function nextSlide() { | ||
+ | vars.lastSlide = vars.currentSlide; | ||
+ | vars.currentSlide += 1; | ||
+ | |||
+ | vars.stop = false; | ||
+ | vars.pause = false; | ||
+ | vars.running = true; | ||
+ | |||
+ | slideChangeControler(); | ||
+ | |||
+ | methodeCallback(options.nextSlideCallback); | ||
+ | } | ||
+ | |||
+ | function prevSlide() { | ||
+ | vars.lastSlide = vars.currentSlide; | ||
+ | vars.currentSlide -= 1; | ||
+ | |||
+ | vars.stop = false; | ||
+ | vars.pause = false; | ||
+ | vars.running = true; | ||
+ | |||
+ | slideChangeControler(); | ||
+ | |||
+ | methodeCallback(options.prevSlideCallback); | ||
+ | } | ||
+ | |||
+ | function targetSlide(slide) { | ||
+ | vars.lastSlide = vars.currentSlide; | ||
+ | vars.currentSlide = slide; | ||
+ | |||
+ | vars.stop = false; | ||
+ | vars.pause = false; | ||
+ | vars.running = true; | ||
+ | |||
+ | slideChangeControler(); | ||
+ | |||
+ | methodeCallback(options.pagerCallback); | ||
+ | } | ||
+ | |||
+ | /** ************************* **/ | ||
+ | /** CALLBACKS **/ | ||
+ | /** ************************* **/ | ||
+ | |||
+ | function methodeCallback(callback) { | ||
+ | $.isFunction( callback ) && callback.call( this, slider, vars.currentSlide, vars.lastSlide, vars.currentStep ); | ||
+ | } | ||
+ | |||
+ | /** ************************* **/ | ||
+ | /** PAGER & CONTROLS **/ | ||
+ | /** ************************* **/ | ||
+ | |||
+ | function pagerPressed(el) { | ||
+ | var target = parseInt($(el).attr('rel')); | ||
+ | |||
+ | if (target != vars.currentSlide) { | ||
+ | stop(); | ||
+ | targetSlide(target); | ||
+ | } | ||
+ | return false; | ||
+ | } | ||
+ | |||
+ | function prevBtnPressed() { | ||
+ | stop(); | ||
+ | prevSlide(); | ||
+ | return false; | ||
+ | } | ||
+ | |||
+ | function nextBtnPressed() { | ||
+ | stop(); | ||
+ | nextSlide(); | ||
+ | return false; | ||
+ | } | ||
+ | |||
+ | /** ************************* **/ | ||
+ | /** CYCLE CONTROLLER **/ | ||
+ | /** ************************* **/ | ||
+ | |||
+ | function cycle(type) { | ||
+ | if (!vars.pause && !vars.stop && vars.running) { | ||
+ | switch(type) { | ||
+ | case "slide": | ||
+ | vars.slideComplete = false; | ||
+ | slideRotation(); | ||
+ | break; | ||
+ | case "step": | ||
+ | vars.stepComplete = false; | ||
+ | iterateSteps(); | ||
+ | break; | ||
+ | case "obj": | ||
+ | iterateObjs(); | ||
+ | break; | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | |||
+ | /** ************************* **/ | ||
+ | /** SLIDES **/ | ||
+ | /** ************************* **/ | ||
+ | |||
+ | function slideRotation() { | ||
+ | |||
+ | var timeout = options.timeout; | ||
+ | // set timeout | first slide instant start | ||
+ | if (vars.init) { | ||
+ | vars.init = false; | ||
+ | slideChangeControler(true); | ||
+ | } else { | ||
+ | // timeout after slide is complete | ||
+ | timeouts.push(setTimeout(function() { | ||
+ | // stops the slider after first slide (only when slide count = 1) | ||
+ | if (vars.maxSlide == 0 && vars.running == true) { | ||
+ | // TODO: better solution! | ||
+ | } else { | ||
+ | vars.lastSlide = vars.currentSlide; | ||
+ | vars.currentSlide += 1; | ||
+ | slideChangeControler(); | ||
+ | } | ||
+ | }, timeout)); | ||
+ | } | ||
+ | } | ||
+ | |||
+ | function slideChangeControler(init) { | ||
+ | slider.find('.active-slide').removeClass('active-slide'); | ||
+ | |||
+ | if (vars.currentSlide > vars.maxSlide) { | ||
+ | vars.currentSlide = 0; | ||
+ | } | ||
+ | if (vars.currentSlide < 0) { | ||
+ | vars.currentSlide = vars.maxSlide; | ||
+ | } | ||
+ | |||
+ | temp.currentSlide = slider.children('.slide:eq(' + vars.currentSlide + ')').addClass('active-slide'); | ||
+ | |||
+ | if (temp.currentSlide.length == 0) { | ||
+ | vars.currentSlide = 0; | ||
+ | temp.currentSlide = slider.children('.slide:eq(' + vars.currentSlide + ')'); | ||
+ | } | ||
+ | |||
+ | if (vars.lastSlide != null) { | ||
+ | if (vars.lastSlide < 0) { | ||
+ | vars.lastSlide = vars.maxSlide; | ||
+ | } | ||
+ | |||
+ | temp.lastSlide = slider.children('.slide:eq(' + vars.lastSlide + ')'); | ||
+ | } | ||
+ | |||
+ | if (init) { | ||
+ | temp.animation = 'none'; | ||
+ | } else { | ||
+ | temp.animation = temp.currentSlide.attr("data-in"); | ||
+ | |||
+ | if (temp.animation == null) { | ||
+ | temp.animation = options.slideTransition; | ||
+ | } | ||
+ | } | ||
+ | |||
+ | if (options.slideEndAnimation && vars.lastSlide != null) { | ||
+ | objOut(); | ||
+ | } else { | ||
+ | switch(temp.animation) { | ||
+ | case 'none': | ||
+ | startSlide(); | ||
+ | endSlide(); | ||
+ | break; | ||
+ | case 'scrollLeft': | ||
+ | startSlide(); | ||
+ | endSlide(); | ||
+ | break; | ||
+ | case 'scrollRight': | ||
+ | startSlide(); | ||
+ | endSlide(); | ||
+ | break; | ||
+ | case 'scrollTop': | ||
+ | startSlide(); | ||
+ | endSlide(); | ||
+ | break; | ||
+ | case 'scrollBottom': | ||
+ | startSlide(); | ||
+ | endSlide(); | ||
+ | break; | ||
+ | default: | ||
+ | startSlide(); | ||
+ | break; | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | |||
+ | // starts a slide | ||
+ | function startSlide() { | ||
+ | if (options.backgroundAnimation) { | ||
+ | backgroundAnimation(); | ||
+ | } | ||
+ | |||
+ | if (options.pager) { | ||
+ | pager.removeClass('active'); | ||
+ | pager.eq(vars.currentSlide).addClass('active'); | ||
+ | } | ||
+ | |||
+ | getStepsForSlide(); | ||
+ | |||
+ | temp.currentSlide.children().hide(); | ||
+ | |||
+ | vars.currentStep = 0; | ||
+ | vars.currentObj = 0; | ||
+ | vars.maxObjs = 0; | ||
+ | vars.finishedObjs = 0; | ||
+ | |||
+ | temp.currentSlide.children("[data-fixed]").show(); | ||
+ | |||
+ | slideAnimationIn(); | ||
+ | } | ||
+ | |||
+ | function startSlideComplete(slide) { | ||
+ | if (temp.lastSlide != null) { | ||
+ | temp.lastSlide.hide(); | ||
+ | } | ||
+ | if (slide.hasClass('active-slide')) { | ||
+ | // starts the cycle for the current slide | ||
+ | cycle('step'); | ||
+ | } | ||
+ | } | ||
+ | |||
+ | // ends a slide | ||
+ | function endSlide() { | ||
+ | if (temp.lastSlide == null) { | ||
+ | return; | ||
+ | } | ||
+ | if (temp.animation != 'none') { | ||
+ | slideAnimationOut(); | ||
+ | } | ||
+ | } | ||
+ | |||
+ | function endSlideComplete() { | ||
+ | } | ||
+ | |||
+ | /** ************************* **/ | ||
+ | /** STEPS **/ | ||
+ | /** ************************* **/ | ||
+ | |||
+ | // gets the maximum step for the current slide | ||
+ | function getStepsForSlide() { | ||
+ | var objs = temp.currentSlide.children(), maximum = 0; | ||
+ | |||
+ | objs.each(function() { | ||
+ | var value = parseFloat($(this).attr('data-step')); | ||
+ | maximum = (value > maximum) ? value : maximum; | ||
+ | }); | ||
+ | |||
+ | vars.maxStep = maximum; | ||
+ | } | ||
+ | |||
+ | function iterateSteps() { | ||
+ | var objs; | ||
+ | |||
+ | if (vars.currentStep == 0) { | ||
+ | objs = temp.currentSlide.children('*:not([data-step]):not([data-fixed]), *[data-step="' + vars.currentStep + '"]:not([data-fixed])'); | ||
+ | } else { | ||
+ | objs = temp.currentSlide.children('*[data-step="' + vars.currentStep + '"]:not([data-fixed])'); | ||
+ | } | ||
+ | |||
+ | vars.maxObjs = objs.length; | ||
+ | |||
+ | fractionObjs = objs; | ||
+ | |||
+ | if (vars.maxObjs > 0) { | ||
+ | |||
+ | vars.currentObj = 0; | ||
+ | vars.finishedObjs = 0; | ||
+ | |||
+ | cycle('obj'); | ||
+ | } else { | ||
+ | stepFinished(); | ||
+ | } | ||
+ | } | ||
+ | |||
+ | function stepFinished() { | ||
+ | vars.stepComplete = true; | ||
+ | vars.currentStep += 1; | ||
+ | |||
+ | if (vars.currentStep > vars.maxStep) { | ||
+ | if (options.autoChange) { | ||
+ | vars.currentStep = 0; | ||
+ | vars.slideComplete = true; | ||
+ | cycle('slide'); | ||
+ | } | ||
+ | |||
+ | return; | ||
+ | } | ||
+ | cycle('step'); | ||
+ | } | ||
+ | |||
+ | /** ************************* **/ | ||
+ | /** OBJECTS **/ | ||
+ | /** ************************* **/ | ||
+ | |||
+ | function iterateObjs() { | ||
+ | var obj = $(fractionObjs[vars.currentObj]); | ||
+ | |||
+ | obj.addClass('fs-animation'); | ||
+ | |||
+ | var position = obj.attr("data-position"), transition = obj.attr("data-in"), delay = obj.attr("data-delay"), time = obj.attr('data-time'), easing = obj.attr('data-ease-in'), | ||
+ | // check for special options | ||
+ | special = obj.attr("data-special"); | ||
+ | |||
+ | if (position == null) { | ||
+ | position = options.position.split(','); | ||
+ | } else { | ||
+ | position = position.split(','); | ||
+ | } | ||
+ | if (transition == null) { | ||
+ | transition = options.transitionIn; | ||
+ | } | ||
+ | if (delay == null) { | ||
+ | delay = options.delay; | ||
+ | } | ||
+ | if (easing == null) { | ||
+ | easing = options.easeIn; | ||
+ | } | ||
+ | objectAnimationIn(obj, position, transition, delay, time, easing, special); | ||
+ | |||
+ | vars.currentObj += 1; | ||
+ | |||
+ | if (vars.currentObj < vars.maxObjs) { | ||
+ | cycle('obj'); | ||
+ | } else { | ||
+ | vars.currentObj = 0; | ||
+ | } | ||
+ | } | ||
+ | |||
+ | function objFinished(obj) { | ||
+ | obj.removeClass('fs-animation'); | ||
+ | |||
+ | if (obj.attr('rel') == vars.currentSlide) { | ||
+ | vars.finishedObjs += 1; | ||
+ | if (vars.finishedObjs == vars.maxObjs) { | ||
+ | stepFinished(); | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | |||
+ | function objOut() { | ||
+ | var objs = temp.lastSlide.children(':not([data-fixed])'); | ||
+ | |||
+ | objs.each(function() { | ||
+ | var obj = $(this), position = obj.position(), transition = obj.attr("data-out"), easing = obj.attr("data-ease-out"); | ||
+ | |||
+ | if (transition == null) { | ||
+ | transition = options.transitionOut; | ||
+ | } | ||
+ | |||
+ | if (easing == null) { | ||
+ | easing = options.easeOut; | ||
+ | } | ||
+ | |||
+ | objectAnimationOut(obj, position, transition, null, easing); | ||
+ | }).promise().done(function() { | ||
+ | endSlide(); | ||
+ | startSlide(); | ||
+ | }); | ||
+ | } | ||
+ | |||
+ | /** ************************* **/ | ||
+ | /** TRANSITIONS **/ | ||
+ | /** ************************* **/ | ||
+ | |||
+ | /** TRANSITION SLIDES **/ | ||
+ | |||
+ | function slideAnimationIn() { | ||
+ | var slide = temp.currentSlide, cssStart = {}, cssEnd = {}, speed = options.slideTransitionSpeed, animation = temp.animation; | ||
+ | |||
+ | if (options.responsive) { | ||
+ | unit = '%'; | ||
+ | } else { | ||
+ | unit = 'px'; | ||
+ | } | ||
+ | |||
+ | switch(animation) { | ||
+ | case 'slideLeft': | ||
+ | cssStart.left = sliderWidth + unit; | ||
+ | cssStart.top = '0' + unit; | ||
+ | cssStart.display = 'block'; | ||
+ | cssEnd.left = '0' + unit; | ||
+ | cssEnd.top = '0' + unit; | ||
+ | break; | ||
+ | case 'slideTop': | ||
+ | cssStart.left = '0' + unit; | ||
+ | cssStart.top = -sliderHeight + unit; | ||
+ | cssStart.display = 'block'; | ||
+ | cssEnd.left = '0' + unit; | ||
+ | cssEnd.top = '0' + unit; | ||
+ | break; | ||
+ | case 'slideBottom': | ||
+ | cssStart.left = '0' + unit; | ||
+ | cssStart.top = sliderHeight + unit; | ||
+ | cssStart.display = 'block'; | ||
+ | cssEnd.left = '0' + unit; | ||
+ | cssEnd.top = '0' + unit; | ||
+ | break; | ||
+ | case 'slideRight': | ||
+ | cssStart.left = -sliderWidth + unit; | ||
+ | cssStart.top = '0' + unit; | ||
+ | cssStart.display = 'block'; | ||
+ | cssEnd.left = '0' + unit; | ||
+ | cssEnd.top = '0' + unit; | ||
+ | break; | ||
+ | case 'fade': | ||
+ | cssStart.left = '0' + unit; | ||
+ | cssStart.top = '0' + unit; | ||
+ | cssStart.display = 'block'; | ||
+ | cssStart.opacity = 0; | ||
+ | cssEnd.opacity = 1; | ||
+ | break; | ||
+ | case 'none': | ||
+ | cssStart.left = '0' + unit; | ||
+ | cssStart.top = '0' + unit; | ||
+ | cssStart.display = 'block'; | ||
+ | speed = 0; | ||
+ | break; | ||
+ | case 'scrollLeft': | ||
+ | cssStart.left = sliderWidth + unit; | ||
+ | cssStart.top = '0' + unit; | ||
+ | cssStart.display = 'block'; | ||
+ | cssEnd.left = '0' + unit; | ||
+ | cssEnd.top = '0' + unit; | ||
+ | break; | ||
+ | case 'scrollTop': | ||
+ | cssStart.left = '0' + unit; | ||
+ | cssStart.top = -sliderHeight + unit; | ||
+ | cssStart.display = 'block'; | ||
+ | cssEnd.left = '0' + unit; | ||
+ | cssEnd.top = '0' + unit; | ||
+ | break; | ||
+ | case 'scrollBottom': | ||
+ | cssStart.left = '0' + unit; | ||
+ | cssStart.top = sliderHeight + unit; | ||
+ | cssStart.display = 'block'; | ||
+ | cssEnd.left = '0' + unit; | ||
+ | cssEnd.top = '0' + unit; | ||
+ | break; | ||
+ | case 'scrollRight': | ||
+ | cssStart.left = -sliderWidth + unit; | ||
+ | cssStart.top = '0' + unit; | ||
+ | cssStart.display = 'block'; | ||
+ | cssEnd.left = '0' + unit; | ||
+ | cssEnd.top = '0' + unit; | ||
+ | break; | ||
+ | } | ||
+ | |||
+ | slide.css(cssStart).animate(cssEnd, speed, 'linear', function() { | ||
+ | startSlideComplete(slide); | ||
+ | }); | ||
+ | } | ||
+ | |||
+ | function slideAnimationOut() { | ||
+ | var cssStart = {}, cssEnd = {}, speed = options.slideTransitionSpeed, unit = null, animation = temp.animation; | ||
+ | |||
+ | if (options.responsive) { | ||
+ | unit = '%'; | ||
+ | } else { | ||
+ | unit = 'px'; | ||
+ | } | ||
+ | |||
+ | switch(animation) { | ||
+ | // case 'none': | ||
+ | // cssStart.display = 'none'; | ||
+ | // speed = 0 | ||
+ | // break; | ||
+ | case 'scrollLeft': | ||
+ | cssEnd.left = -sliderWidth + unit; | ||
+ | cssEnd.top = '0' + unit; | ||
+ | break; | ||
+ | case 'scrollTop': | ||
+ | cssEnd.left = '0' + unit; | ||
+ | cssEnd.top = sliderHeight + unit; | ||
+ | break; | ||
+ | case 'scrollBottom': | ||
+ | cssEnd.left = '0' + unit; | ||
+ | cssEnd.top = -sliderHeight + unit; | ||
+ | break; | ||
+ | case 'scrollRight': | ||
+ | cssEnd.left = sliderWidth + unit; | ||
+ | cssEnd.top = '0' + unit; | ||
+ | break; | ||
+ | default: | ||
+ | speed = 0; | ||
+ | break; | ||
+ | } | ||
+ | |||
+ | temp.lastSlide.animate(cssEnd, speed, 'linear', function() { | ||
+ | endSlideComplete(); | ||
+ | }); | ||
+ | } | ||
+ | |||
+ | /** IN TRANSITION OBJECTS **/ | ||
+ | function objectAnimationIn(obj, position, transition, delay, time, easing, special) { | ||
+ | var cssStart = {}, cssEnd = {}, speed = options.speedIn, unit = null; | ||
+ | |||
+ | if (options.responsive) { | ||
+ | unit = '%'; | ||
+ | } else { | ||
+ | unit = 'px'; | ||
+ | } | ||
+ | |||
+ | // #time | ||
+ | if (time != null && time != "") { | ||
+ | speed = time - delay; | ||
+ | } | ||
+ | |||
+ | cssStart.opacity = 1; | ||
+ | |||
+ | // set start position | ||
+ | switch(transition) { | ||
+ | case 'left': | ||
+ | cssStart.top = position[0]; | ||
+ | cssStart.left = sliderWidth; | ||
+ | break; | ||
+ | case 'bottomLeft': | ||
+ | cssStart.top = sliderHeight; | ||
+ | cssStart.left = sliderWidth; | ||
+ | break; | ||
+ | case 'topLeft': | ||
+ | cssStart.top = obj.outerHeight() * -1; | ||
+ | cssStart.left = sliderWidth; | ||
+ | break; | ||
+ | case 'top': | ||
+ | cssStart.top = obj.outerHeight() * -1; | ||
+ | cssStart.left = position[1]; | ||
+ | break; | ||
+ | case 'bottom': | ||
+ | cssStart.top = sliderHeight; | ||
+ | cssStart.left = position[1]; | ||
+ | break; | ||
+ | case 'right': | ||
+ | cssStart.top = position[0]; | ||
+ | cssStart.left = -offsetX - obj.outerWidth(); | ||
+ | break; | ||
+ | case 'bottomRight': | ||
+ | cssStart.top = sliderHeight; | ||
+ | cssStart.left = -offsetX - obj.outerWidth(); | ||
+ | break; | ||
+ | case 'topRight': | ||
+ | cssStart.top = obj.outerHeight() * -1; | ||
+ | cssStart.left = -offsetX - obj.outerWidth(); | ||
+ | break; | ||
+ | case 'fade': | ||
+ | cssStart.top = position[0]; | ||
+ | cssStart.left = position[1]; | ||
+ | cssStart.opacity = 0; | ||
+ | cssEnd.opacity = 1; | ||
+ | break; | ||
+ | case 'none': | ||
+ | cssStart.top = position[0]; | ||
+ | cssStart.left = position[1]; | ||
+ | cssStart.display = 'none'; | ||
+ | speed = 0; | ||
+ | break; | ||
+ | } | ||
+ | |||
+ | // set target position | ||
+ | cssEnd.top = position[0]; | ||
+ | cssEnd.left = position[1]; | ||
+ | |||
+ | // sets the right unit | ||
+ | cssEnd.left = cssEnd.left + unit; | ||
+ | cssEnd.top = cssEnd.top + unit; | ||
+ | cssStart.left = cssStart.left + unit; | ||
+ | cssStart.top = cssStart.top + unit; | ||
+ | |||
+ | // set the delay | ||
+ | timeouts.push(setTimeout(function() { | ||
+ | // for special=cylce | ||
+ | if (special == 'cycle' && obj.attr('rel') == vars.currentSlide) { | ||
+ | var tmp = obj.prev(); | ||
+ | if (tmp.length > 0) { | ||
+ | var tmpPosition = $(tmp).attr('data-position').split(','); | ||
+ | tmpPosition = { | ||
+ | 'top' : tmpPosition[0], | ||
+ | 'left' : tmpPosition[1] | ||
+ | }; | ||
+ | var tmpTransition = $(tmp).attr('data-out'); | ||
+ | if (tmpTransition == null) { | ||
+ | tmpTransition = options.transitionOut; | ||
+ | } | ||
+ | objectAnimationOut(tmp, tmpPosition, tmpTransition, speed); | ||
+ | } | ||
+ | } | ||
+ | |||
+ | // animate | ||
+ | obj.css(cssStart).show().animate(cssEnd, speed, easing, function() { | ||
+ | objFinished(obj); | ||
+ | }).addClass('fs_obj_active'); | ||
+ | }, delay)); | ||
+ | } | ||
+ | |||
+ | /** OUT TRANSITION OBJECTS **/ | ||
+ | function objectAnimationOut(obj, position, transition, speed, easing) { | ||
+ | var cssStart = {}, cssEnd = {}, unit = null; | ||
+ | |||
+ | speed = options.speedOut; | ||
+ | |||
+ | if (options.responsive) { | ||
+ | unit = '%'; | ||
+ | } else { | ||
+ | unit = 'px'; | ||
+ | } | ||
+ | |||
+ | var w = obj.outerWidth(), h = obj.outerHeight(); | ||
+ | |||
+ | if (options.responsive) { | ||
+ | w = pixelToPercent(w, dX); | ||
+ | h = pixelToPercent(h, dY); | ||
+ | } | ||
+ | |||
+ | // set target position | ||
+ | switch(transition) { | ||
+ | case 'left': | ||
+ | cssEnd.left = -offsetX - 100 - w; | ||
+ | break; | ||
+ | case 'bottomLeft': | ||
+ | cssEnd.top = sliderHeight; | ||
+ | cssEnd.left = -offsetX - 100 - w; | ||
+ | break; | ||
+ | case 'topLeft': | ||
+ | cssEnd.top = -h; | ||
+ | cssEnd.left = -offsetX - 100 - w; | ||
+ | break; | ||
+ | case 'top': | ||
+ | cssEnd.top = -h; | ||
+ | break; | ||
+ | case 'bottom': | ||
+ | cssEnd.top = sliderHeight; | ||
+ | break; | ||
+ | case 'right': | ||
+ | cssEnd.left = sliderWidth; | ||
+ | break; | ||
+ | case 'bottomRight': | ||
+ | cssEnd.top = sliderHeight; | ||
+ | cssEnd.left = sliderWidth; | ||
+ | break; | ||
+ | case 'topRight': | ||
+ | cssEnd.top = -h; | ||
+ | cssEnd.left = sliderWidth; | ||
+ | break; | ||
+ | case 'fade': | ||
+ | cssStart.opacity = 1; | ||
+ | cssEnd.opacity = 0; | ||
+ | break; | ||
+ | case 'hide': | ||
+ | cssEnd.display = 'none'; | ||
+ | speed = 0; | ||
+ | break; | ||
+ | default: | ||
+ | cssEnd.display = 'none'; | ||
+ | speed = 0; | ||
+ | break; | ||
+ | } | ||
+ | |||
+ | if ( typeof cssEnd.top != 'undefined') { | ||
+ | // substracts the px | ||
+ | if (cssEnd.top.toString().indexOf('px') > 0) { | ||
+ | cssEnd.top = cssEnd.top.substring(0, cssEnd.top.length - 2); | ||
+ | if (options.responsive) { | ||
+ | cssEnd.top = pixelToPercent(cssEnd.top, dY); | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | |||
+ | if ( typeof cssEnd.left != 'undefined') { | ||
+ | if (cssEnd.left.toString().indexOf('px') > 0) { | ||
+ | cssEnd.left = cssEnd.left.substring(0, cssEnd.left.length - 2); | ||
+ | if (options.responsive) { | ||
+ | cssEnd.left = pixelToPercent(cssEnd.left, dX); | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | |||
+ | // sets the right unit | ||
+ | cssEnd.left = cssEnd.left + unit; | ||
+ | cssEnd.top = cssEnd.top + unit; | ||
+ | |||
+ | // animation | ||
+ | obj.css(cssStart).animate(cssEnd, speed, easing, function() { | ||
+ | obj.hide(); | ||
+ | }).removeClass('fs_obj_active'); | ||
+ | } | ||
+ | |||
+ | function backgroundAnimation() { | ||
+ | var el; | ||
+ | if (options.backgroundElement == null || options.backgroundElement == "") { | ||
+ | el = slider.parent(); | ||
+ | } else { | ||
+ | el = $(options.backgroundElement); | ||
+ | } | ||
+ | |||
+ | var oldPos = el.css('background-position'); | ||
+ | oldPos = oldPos.split(' '); | ||
+ | var moveX = options.backgroundX, moveY = options.backgroundY, x = Number(oldPos[0].replace(/[px,%]/g, '')) + Number(moveX), y = Number(oldPos[1].replace(/[px,%]/g, '')) + Number(moveY); | ||
+ | |||
+ | el.animate({ | ||
+ | backgroundPositionX : x + 'px', | ||
+ | backgroundPositionY : y + 'px' | ||
+ | }, options.backgroundSpeed, options.backgroundEase); | ||
+ | } | ||
+ | |||
+ | /** ************************* **/ | ||
+ | /** RESPONSIVE **/ | ||
+ | /** ************************* **/ | ||
+ | |||
+ | function makeResponsive() { | ||
+ | var d = options.dimensions.split(','), | ||
+ | ie = msie(); | ||
+ | |||
+ | dX = d['0']; | ||
+ | dY = d['1']; | ||
+ | |||
+ | if (!options.increase) { | ||
+ | $(element).css({"maxWidth": dX+"px"}); | ||
+ | } | ||
+ | |||
+ | var objs = slider.children('.slide').find('*'); | ||
+ | |||
+ | objs.each(function() { | ||
+ | var obj = $(this), x = null, y = null, value = null; | ||
+ | |||
+ | // calculate % position | ||
+ | if (obj.attr("data-position") != null) { | ||
+ | var position = obj.attr("data-position").split(','); | ||
+ | |||
+ | x = pixelToPercent(position[1], dX); | ||
+ | y = pixelToPercent(position[0], dY); | ||
+ | obj.attr("data-position", y + ',' + x); | ||
+ | } | ||
+ | |||
+ | // calculate % width | ||
+ | if (obj.attr("width") != null && obj.attr("width") != "") { | ||
+ | value = obj.attr("width"); | ||
+ | |||
+ | x = pixelToPercent(value, dX); | ||
+ | obj.attr("width", x + "%"); | ||
+ | obj.css("width", x + "%"); | ||
+ | } else if (obj.css('width') != '0px') { | ||
+ | value = obj.css("width"); | ||
+ | if (value.indexOf('px') > 0) { | ||
+ | value = value.substring(0, value.length - 2); | ||
+ | x = pixelToPercent(value, dX); | ||
+ | obj.css("width", x + "%"); | ||
+ | } | ||
+ | } else if (obj.prop("tagName").toLowerCase() == 'img' && ie != -1) { | ||
+ | value = getWidth(obj); | ||
+ | x = pixelToPercent(value, dX); | ||
+ | obj.css("width", x + "%").attr('width', x+'%'); | ||
+ | } | ||
+ | else if (obj.prop("tagName").toLowerCase() == 'img') { | ||
+ | value = obj.get(0).width; | ||
+ | x = pixelToPercent(value, dX); | ||
+ | obj.css("width", x + "%"); | ||
+ | } | ||
+ | |||
+ | |||
+ | |||
+ | // calculate % height | ||
+ | if (obj.attr("height") != null && obj.attr("height") != "") { | ||
+ | value = obj.attr("height"); | ||
+ | |||
+ | y = pixelToPercent(value, dY); | ||
+ | obj.attr("height", y + "%"); | ||
+ | obj.css("height", y + "%"); | ||
+ | } else if (obj.css('height') != '0px') { | ||
+ | value = obj.css("height"); | ||
+ | if (value.indexOf('px') > 0) { | ||
+ | value = value.substring(0, value.length - 2); | ||
+ | y = pixelToPercent(value, dY); | ||
+ | obj.css("height", y + "%"); | ||
+ | } | ||
+ | }else if (obj.prop("tagName").toLowerCase() == 'img' && ie != -1) { | ||
+ | value = getHeight(obj); | ||
+ | y = pixelToPercent(value, dY); | ||
+ | obj.css("height", y + "%").attr('height', y+'%'); | ||
+ | } else if (obj.prop("tagName").toLowerCase() == 'img') { | ||
+ | value = obj.get(0).height; | ||
+ | y = pixelToPercent(value, dY); | ||
+ | obj.css("height", y + "%"); | ||
+ | } | ||
+ | |||
+ | obj.attr('data-fontsize', obj.css('font-size')); | ||
+ | |||
+ | }); | ||
+ | |||
+ | slider.css({ | ||
+ | 'width' : 'auto', | ||
+ | 'height' : 'auto' | ||
+ | }).append('<div class="fs-stretcher" style="width:' + dX + 'px; height:' + dY + 'px"></div>'); | ||
+ | |||
+ | resizeSlider(); | ||
+ | |||
+ | $(window).bind('resize', function() { | ||
+ | resizeSlider(); | ||
+ | }); | ||
+ | |||
+ | } | ||
+ | |||
+ | function getWidth (element) { | ||
+ | var img = new Image(); | ||
+ | img.src = element.attr('src'); | ||
+ | return img.width; | ||
+ | } | ||
+ | function getHeight (element) { | ||
+ | var img = new Image(); | ||
+ | img.src = element.attr('src'); | ||
+ | return img.height; | ||
+ | } | ||
+ | |||
+ | function resizeSlider() { | ||
+ | var w = slider.innerWidth(), h = slider.innerHeight(); | ||
+ | if (w <= dX || options.increase ) { | ||
+ | var xy = dX / dY, nH = w / xy; | ||
+ | slider.find('.fs-stretcher').css({ | ||
+ | 'width' : w + 'px', | ||
+ | 'height' : nH + "px" | ||
+ | }); | ||
+ | } | ||
+ | |||
+ | // Update bodyWidth | ||
+ | bodyWidth = $('body').width(); | ||
+ | |||
+ | // calculate the width/height/offsetX of the slider | ||
+ | var sW = slider.width(); | ||
+ | offsetX = pixelToPercent(((bodyWidth - sW) / 2), dX); | ||
+ | sliderWidth = 100; | ||
+ | if (options.fullWidth) { | ||
+ | sliderWidth = 100 + offsetX * 2; | ||
+ | } | ||
+ | sliderHeight = 100; | ||
+ | |||
+ | if (vars.init == false || w < dX) { | ||
+ | resizeFontSize(); | ||
+ | } | ||
+ | } | ||
+ | |||
+ | function resizeFontSize() { | ||
+ | var value = null, n = null, objs = slider.children('.slide').find('*'); | ||
+ | |||
+ | objs.each(function() { | ||
+ | obj = $(this); | ||
+ | |||
+ | var value = obj.attr('data-fontsize'); | ||
+ | |||
+ | if (value.indexOf('px') > 0) { | ||
+ | value = value.substring(0, value.length - 2); | ||
+ | n = pixelToPercent(value, dY) * (slider.find('.fs-stretcher').height() / 100); | ||
+ | obj.css("fontSize", n + "px"); | ||
+ | obj.css("lineHeight", '100%'); | ||
+ | } | ||
+ | |||
+ | }); | ||
+ | } | ||
+ | |||
+ | function pixelToPercent(value, d) { | ||
+ | return value / (d / 100); | ||
+ | } | ||
+ | |||
+ | /** ************************* **/ | ||
+ | /** HELPER **/ | ||
+ | /** ************************* **/ | ||
+ | |||
+ | function stopTimeout(timeout) { | ||
+ | clearTimeout(timeout); | ||
+ | } | ||
+ | |||
+ | function stopTimeouts(timeouts) { | ||
+ | var length = timeouts.length; | ||
+ | $.each(timeouts, function(index) { | ||
+ | clearTimeout(this); | ||
+ | if (index == length - 1) { | ||
+ | timeouts = []; | ||
+ | } | ||
+ | }); | ||
+ | } | ||
+ | |||
+ | function msie() | ||
+ | // Returns the version of Internet Explorer or a -1 | ||
+ | // (indicating the use of another browser). | ||
+ | { | ||
+ | var rv = -1; // Return value assumes failure. | ||
+ | if (navigator.appName == 'Microsoft Internet Explorer') | ||
+ | { | ||
+ | var ua = navigator.userAgent; | ||
+ | var re = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})"); | ||
+ | if (re.exec(ua) != null) | ||
+ | rv = parseFloat( RegExp.$1 ); | ||
+ | } | ||
+ | return rv; | ||
+ | } | ||
+ | |||
+ | }; | ||
+ | |||
+ | /** ************************* **/ | ||
+ | /** PLUGIN **/ | ||
+ | /** ************************* **/ | ||
+ | |||
+ | $.fn.fractionSlider = function(method) { | ||
+ | if (methods[method]) { | ||
+ | return methods[method].apply(this, Array.prototype.slice.call(arguments, 1)); | ||
+ | } else if ( typeof method == 'object' || !method) { | ||
+ | return methods.init.apply(this, arguments); | ||
+ | } else { | ||
+ | $.error('Method ' + method + ' does not exist on jQuery.tooltip'); | ||
+ | } | ||
+ | |||
+ | }; | ||
+ | |||
+ | /** ************************* **/ | ||
+ | /** EASING EXTEND **/ | ||
+ | /** ************************* **/ | ||
+ | |||
+ | // based on jqueryui (http://jqueryui.com/) | ||
+ | // based on easing equations from Robert Penner (http://www.robertpenner.com/easing) | ||
+ | |||
+ | var baseEasings = {}; | ||
+ | |||
+ | $.each(["Quad", "Cubic", "Quart", "Quint", "Expo"], function(i, name) { | ||
+ | baseEasings[name] = function(p) { | ||
+ | return Math.pow(p, i + 2); | ||
+ | }; | ||
+ | }); | ||
+ | |||
+ | $.extend(baseEasings, { | ||
+ | Sine : function(p) { | ||
+ | return 1 - Math.cos(p * Math.PI / 2); | ||
+ | }, | ||
+ | Circ : function(p) { | ||
+ | return 1 - Math.sqrt(1 - p * p); | ||
+ | }, | ||
+ | Elastic : function(p) { | ||
+ | return p == 0 || p == 1 ? p : -Math.pow(2, 8 * (p - 1)) * Math.sin(((p - 1) * 80 - 7.5 ) * Math.PI / 15); | ||
+ | }, | ||
+ | Back : function(p) { | ||
+ | return p * p * (3 * p - 2 ); | ||
+ | }, | ||
+ | Bounce : function(p) { | ||
+ | var pow2, bounce = 4; | ||
+ | |||
+ | while (p < (( pow2 = Math.pow(2, --bounce) ) - 1 ) / 11) { | ||
+ | } | ||
+ | return 1 / Math.pow(4, 3 - bounce) - 7.5625 * Math.pow((pow2 * 3 - 2 ) / 22 - p, 2); | ||
+ | } | ||
+ | }); | ||
+ | |||
+ | $.each(baseEasings, function(name, easeIn) { | ||
+ | $.easing["easeIn" + name] = easeIn; | ||
+ | $.easing["easeOut" + name] = function(p) { | ||
+ | return 1 - easeIn(1 - p); | ||
+ | }; | ||
+ | $.easing["easeInOut" + name] = function(p) { | ||
+ | return p < 0.5 ? easeIn(p * 2) / 2 : 1 - easeIn(p * -2 + 2) / 2; | ||
+ | }; | ||
+ | }); | ||
+ | // end easing | ||
+ | }(jQuery)); | ||
+ | |||
+ | </script> | ||
+ | |||
+ | |||
+ | <script type="text/javascript"> | ||
+ | |||
+ | /* ========================================================================== | ||
+ | Asynchronous Loading Google Maps | ||
+ | ============================================================================= */ | ||
+ | function loadScript() { | ||
+ | var script = document.createElement('script'); | ||
+ | script.type = 'text/javascript'; | ||
+ | script.src = 'https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false&' + 'callback=initialize'; | ||
+ | document.body.appendChild(script); | ||
+ | } | ||
+ | window.onload = loadScript; | ||
+ | |||
+ | /* ========================================================================== | ||
+ | Google Maps SETTING's | ||
+ | ============================================================================= */ | ||
+ | /* | ||
+ | * define the coordinates of your company | ||
+ | */ | ||
+ | |||
+ | lat = 28.65850; | ||
+ | lng = 77.20341; | ||
+ | |||
+ | var map; | ||
+ | var MY_MAPTYPE_ID = 'custom_style'; | ||
+ | |||
+ | function initialize() { | ||
+ | |||
+ | var featureOpts = [ | ||
+ | { | ||
+ | "featureType": "landscape", | ||
+ | "stylers": [ | ||
+ | { "weight": 0.1 }, | ||
+ | { "color": "grey" } | ||
+ | ] | ||
+ | },{ | ||
+ | "featureType": "road", | ||
+ | "elementType": "geometry", | ||
+ | "stylers": [ | ||
+ | { "visibility": "simplified" }, | ||
+ | { "color": "brown" } | ||
+ | ] | ||
+ | },{ | ||
+ | "featureType": "poi", | ||
+ | "elementType": "geometry", | ||
+ | "stylers": [ | ||
+ | { "color": "yellow" } | ||
+ | ] | ||
+ | },{ | ||
+ | "featureType": "road", | ||
+ | "elementType": "labels.text.fill", | ||
+ | "stylers": [ | ||
+ | { "color": "#2c3e50" } | ||
+ | ] | ||
+ | },{ | ||
+ | "featureType": "poi", | ||
+ | "elementType": "labels.text.fill", | ||
+ | "stylers": [ | ||
+ | { "color": "#e74c3c" } | ||
+ | ] | ||
+ | },{ | ||
+ | "featureType": "road", | ||
+ | "elementType": "labels.text.stroke", | ||
+ | "stylers": [ | ||
+ | { "color": "Yellow" } | ||
+ | ] | ||
+ | },{ | ||
+ | "featureType": "water", | ||
+ | "stylers": [ | ||
+ | { "color": "blue" } | ||
+ | ] | ||
+ | } | ||
+ | ]; | ||
+ | |||
+ | var myLatlng = new google.maps.LatLng(lat,lng); | ||
+ | var mapOptions = { | ||
+ | zoom: 11, | ||
+ | scrollwheel: false, | ||
+ | mapTypeControl:false, | ||
+ | streetViewControl:false, | ||
+ | center: myLatlng, | ||
+ | mapTypeControlOptions: { | ||
+ | mapTypeIds: [google.maps.MapTypeId.ROADMAP, MY_MAPTYPE_ID] | ||
+ | }, | ||
+ | mapTypeId: MY_MAPTYPE_ID | ||
+ | }; | ||
+ | |||
+ | var map = new google.maps.Map(document.getElementById('page_maps'), mapOptions); | ||
+ | |||
+ | var marker = new google.maps.Marker({ | ||
+ | position: myLatlng, | ||
+ | icon: "images/marker.png", | ||
+ | map: map | ||
+ | }); | ||
+ | |||
+ | var styledMapOptions = { | ||
+ | name: 'Custom Style' | ||
+ | }; | ||
+ | |||
+ | var customMapType = new google.maps.StyledMapType(featureOpts, styledMapOptions); | ||
+ | map.mapTypes.set(MY_MAPTYPE_ID, customMapType); | ||
+ | google.maps.event.addDomListener(window, 'load', initialize); | ||
+ | } | ||
+ | |||
+ | |||
+ | |||
+ | /*-----------------------------------------------------------------*/ | ||
+ | |||
+ | </script> | ||
+ | |||
+ | |||
+ | <script type="text/javascript"> | ||
+ | /** | ||
+ | * Isotope v1.5.25 | ||
+ | * An exquisite jQuery plugin for magical layouts | ||
+ | * http://isotope.metafizzy.co | ||
+ | * | ||
+ | * Commercial use requires one-time license fee | ||
+ | * http://metafizzy.co/#licenses | ||
+ | * | ||
+ | * Copyright 2012 David DeSandro / Metafizzy | ||
+ | */ | ||
+ | (function(a,b,c){"use strict";var d=a.document,e=a.Modernizr,f=function(a){return a.charAt(0).toUpperCase()+a.slice(1)},g="Moz Webkit O Ms".split(" "),h=function(a){var b=d.documentElement.style,c;if(typeof b[a]=="string")return a;a=f(a);for(var e=0,h=g.length;e<h;e++){c=g[e]+a;if(typeof b[c]=="string")return c}},i=h("transform"),j=h("transitionProperty"),k={csstransforms:function(){return!!i},csstransforms3d:function(){var a=!!h("perspective");if(a){var c=" -o- -moz- -ms- -webkit- -khtml- ".split(" "),d="@media ("+c.join("transform-3d),(")+"modernizr)",e=b("<style>"+d+"{#modernizr{height:3px}}"+"</style>").appendTo("head"),f=b('<div id="modernizr" />').appendTo("html");a=f.height()===3,f.remove(),e.remove()}return a},csstransitions:function(){return!!j}},l;if(e)for(l in k)e.hasOwnProperty(l)||e.addTest(l,k[l]);else{e=a.Modernizr={_version:"1.6ish: miniModernizr for Isotope"};var m=" ",n;for(l in k)n=k[l](),e[l]=n,m+=" "+(n?"":"no-")+l;b("html").addClass(m)}if(e.csstransforms){var o=e.csstransforms3d?{translate:function(a){return"translate3d("+a[0]+"px, "+a[1]+"px, 0) "},scale:function(a){return"scale3d("+a+", "+a+", 1) "}}:{translate:function(a){return"translate("+a[0]+"px, "+a[1]+"px) "},scale:function(a){return"scale("+a+") "}},p=function(a,c,d){var e=b.data(a,"isoTransform")||{},f={},g,h={},j;f[c]=d,b.extend(e,f);for(g in e)j=e[g],h[g]=o[g](j);var k=h.translate||"",l=h.scale||"",m=k+l;b.data(a,"isoTransform",e),a.style[i]=m};b.cssNumber.scale=!0,b.cssHooks.scale={set:function(a,b){p(a,"scale",b)},get:function(a,c){var d=b.data(a,"isoTransform");return d&&d.scale?d.scale:1}},b.fx.step.scale=function(a){b.cssHooks.scale.set(a.elem,a.now+a.unit)},b.cssNumber.translate=!0,b.cssHooks.translate={set:function(a,b){p(a,"translate",b)},get:function(a,c){var d=b.data(a,"isoTransform");return d&&d.translate?d.translate:[0,0]}}}var q,r;e.csstransitions&&(q={WebkitTransitionProperty:"webkitTransitionEnd",MozTransitionProperty:"transitionend",OTransitionProperty:"oTransitionEnd otransitionend",transitionProperty:"transitionend"}[j],r=h("transitionDuration"));var s=b.event,t=b.event.handle?"handle":"dispatch",u;s.special.smartresize={setup:function(){b(this).bind("resize",s.special.smartresize.handler)},teardown:function(){b(this).unbind("resize",s.special.smartresize.handler)},handler:function(a,b){var c=this,d=arguments;a.type="smartresize",u&&clearTimeout(u),u=setTimeout(function(){s[t].apply(c,d)},b==="execAsap"?0:100)}},b.fn.smartresize=function(a){return a?this.bind("smartresize",a):this.trigger("smartresize",["execAsap"])},b.Isotope=function(a,c,d){this.element=b(c),this._create(a),this._init(d)};var v=["width","height"],w=b(a);b.Isotope.settings={resizable:!0,layoutMode:"masonry",containerClass:"isotope",itemClass:"isotope-item",hiddenClass:"isotope-hidden",hiddenStyle:{opacity:0,scale:.001},visibleStyle:{opacity:1,scale:1},containerStyle:{position:"relative",overflow:"hidden"},animationEngine:"best-available",animationOptions:{queue:!1,duration:800},sortBy:"original-order",sortAscending:!0,resizesContainer:!0,transformsEnabled:!0,itemPositionDataEnabled:!1},b.Isotope.prototype={_create:function(a){this.options=b.extend({},b.Isotope.settings,a),this.styleQueue=[],this.elemCount=0;var c=this.element[0].style;this.originalStyle={};var d=v.slice(0);for(var e in this.options.containerStyle)d.push(e);for(var f=0,g=d.length;f<g;f++)e=d[f],this.originalStyle[e]=c[e]||"";this.element.css(this.options.containerStyle),this._updateAnimationEngine(),this._updateUsingTransforms();var h={"original-order":function(a,b){return b.elemCount++,b.elemCount},random:function(){return Math.random()}};this.options.getSortData=b.extend(this.options.getSortData,h),this.reloadItems(),this.offset={left:parseInt(this.element.css("padding-left")||0,10),top:parseInt(this.element.css("padding-top")||0,10)};var i=this;setTimeout(function(){i.element.addClass(i.options.containerClass)},0),this.options.resizable&&w.bind("smartresize.isotope",function(){i.resize()}),this.element.delegate("."+this.options.hiddenClass,"click",function(){return!1})},_getAtoms:function(a){var b=this.options.itemSelector,c=b?a.filter(b).add(a.find(b)):a,d={position:"absolute"};return c=c.filter(function(a,b){return b.nodeType===1}),this.usingTransforms&&(d.left=0,d.top=0),c.css(d).addClass(this.options.itemClass),this.updateSortData(c,!0),c},_init:function(a){this.$filteredAtoms=this._filter(this.$allAtoms),this._sort(),this.reLayout(a)},option:function(a){if(b.isPlainObject(a)){this.options=b.extend(!0,this.options,a);var c;for(var d in a)c="_update"+f(d),this[c]&&this[c]()}},_updateAnimationEngine:function(){var a=this.options.animationEngine.toLowerCase().replace(/[ _\-]/g,""),b;switch(a){case"css":case"none":b=!1;break;case"jquery":b=!0;break;default:b=!e.csstransitions}this.isUsingJQueryAnimation=b,this._updateUsingTransforms()},_updateTransformsEnabled:function(){this._updateUsingTransforms()},_updateUsingTransforms:function(){var a=this.usingTransforms=this.options.transformsEnabled&&e.csstransforms&&e.csstransitions&&!this.isUsingJQueryAnimation;a||(delete this.options.hiddenStyle.scale,delete this.options.visibleStyle.scale),this.getPositionStyles=a?this._translate:this._positionAbs},_filter:function(a){var b=this.options.filter===""?"*":this.options.filter;if(!b)return a;var c=this.options.hiddenClass,d="."+c,e=a.filter(d),f=e;if(b!=="*"){f=e.filter(b);var g=a.not(d).not(b).addClass(c);this.styleQueue.push({$el:g,style:this.options.hiddenStyle})}return this.styleQueue.push({$el:f,style:this.options.visibleStyle}),f.removeClass(c),a.filter(b)},updateSortData:function(a,c){var d=this,e=this.options.getSortData,f,g;a.each(function(){f=b(this),g={};for(var a in e)!c&&a==="original-order"?g[a]=b.data(this,"isotope-sort-data")[a]:g[a]=e[a](f,d);b.data(this,"isotope-sort-data",g)})},_sort:function(){var a=this.options.sortBy,b=this._getSorter,c=this.options.sortAscending?1:-1,d=function(d,e){var f=b(d,a),g=b(e,a);return f===g&&a!=="original-order"&&(f=b(d,"original-order"),g=b(e,"original-order")),(f>g?1:f<g?-1:0)*c};this.$filteredAtoms.sort(d)},_getSorter:function(a,c){return b.data(a,"isotope-sort-data")[c]},_translate:function(a,b){return{translate:[a,b]}},_positionAbs:function(a,b){return{left:a,top:b}},_pushPosition:function(a,b,c){b=Math.round(b+this.offset.left),c=Math.round(c+this.offset.top);var d=this.getPositionStyles(b,c);this.styleQueue.push({$el:a,style:d}),this.options.itemPositionDataEnabled&&a.data("isotope-item-position",{x:b,y:c})},layout:function(a,b){var c=this.options.layoutMode;this["_"+c+"Layout"](a);if(this.options.resizesContainer){var d=this["_"+c+"GetContainerSize"]();this.styleQueue.push({$el:this.element,style:d})}this._processStyleQueue(a,b),this.isLaidOut=!0},_processStyleQueue:function(a,c){var d=this.isLaidOut?this.isUsingJQueryAnimation?"animate":"css":"css",f=this.options.animationOptions,g=this.options.onLayout,h,i,j,k;i=function(a,b){b.$el[d](b.style,f)};if(this._isInserting&&this.isUsingJQueryAnimation)i=function(a,b){h=b.$el.hasClass("no-transition")?"css":d,b.$el[h](b.style,f)};else if(c||g||f.complete){var l=!1,m=[c,g,f.complete],n=this;j=!0,k=function(){if(l)return;var b;for(var c=0,d=m.length;c<d;c++)b=m[c],typeof b=="function"&&b.call(n.element,a,n);l=!0};if(this.isUsingJQueryAnimation&&d==="animate")f.complete=k,j=!1;else if(e.csstransitions){var o=0,p=this.styleQueue[0],s=p&&p.$el,t;while(!s||!s.length){t=this.styleQueue[o++];if(!t)return;s=t.$el}var u=parseFloat(getComputedStyle(s[0])[r]);u>0&&(i=function(a,b){b.$el[d](b.style,f).one(q,k)},j=!1)}}b.each(this.styleQueue,i),j&&k(),this.styleQueue=[]},resize:function(){this["_"+this.options.layoutMode+"ResizeChanged"]()&&this.reLayout()},reLayout:function(a){this["_"+this.options.layoutMode+"Reset"](),this.layout(this.$filteredAtoms,a)},addItems:function(a,b){var c=this._getAtoms(a);this.$allAtoms=this.$allAtoms.add(c),b&&b(c)},insert:function(a,b){this.element.append(a);var c=this;this.addItems(a,function(a){var d=c._filter(a);c._addHideAppended(d),c._sort(),c.reLayout(),c._revealAppended(d,b)})},appended:function(a,b){var c=this;this.addItems(a,function(a){c._addHideAppended(a),c.layout(a),c._revealAppended(a,b)})},_addHideAppended:function(a){this.$filteredAtoms=this.$filteredAtoms.add(a),a.addClass("no-transition"),this._isInserting=!0,this.styleQueue.push({$el:a,style:this.options.hiddenStyle})},_revealAppended:function(a,b){var c=this;setTimeout(function(){a.removeClass("no-transition"),c.styleQueue.push({$el:a,style:c.options.visibleStyle}),c._isInserting=!1,c._processStyleQueue(a,b)},10)},reloadItems:function(){this.$allAtoms=this._getAtoms(this.element.children())},remove:function(a,b){this.$allAtoms=this.$allAtoms.not(a),this.$filteredAtoms=this.$filteredAtoms.not(a);var c=this,d=function(){a.remove(),b&&b.call(c.element)};a.filter(":not(."+this.options.hiddenClass+")").length?(this.styleQueue.push({$el:a,style:this.options.hiddenStyle}),this._sort(),this.reLayout(d)):d()},shuffle:function(a){this.updateSortData(this.$allAtoms),this.options.sortBy="random",this._sort(),this.reLayout(a)},destroy:function(){var a=this.usingTransforms,b=this.options;this.$allAtoms.removeClass(b.hiddenClass+" "+b.itemClass).each(function(){var b=this.style;b.position="",b.top="",b.left="",b.opacity="",a&&(b[i]="")});var c=this.element[0].style;for(var d in this.originalStyle)c[d]=this.originalStyle[d];this.element.unbind(".isotope").undelegate("."+b.hiddenClass,"click").removeClass(b.containerClass).removeData("isotope"),w.unbind(".isotope")},_getSegments:function(a){var b=this.options.layoutMode,c=a?"rowHeight":"columnWidth",d=a?"height":"width",e=a?"rows":"cols",g=this.element[d](),h,i=this.options[b]&&this.options[b][c]||this.$filteredAtoms["outer"+f(d)](!0)||g;h=Math.floor(g/i),h=Math.max(h,1),this[b][e]=h,this[b][c]=i},_checkIfSegmentsChanged:function(a){var b=this.options.layoutMode,c=a?"rows":"cols",d=this[b][c];return this._getSegments(a),this[b][c]!==d},_masonryReset:function(){this.masonry={},this._getSegments();var a=this.masonry.cols;this.masonry.colYs=[];while(a--)this.masonry.colYs.push(0)},_masonryLayout:function(a){var c=this,d=c.masonry;a.each(function(){var a=b(this),e=Math.ceil(a.outerWidth(!0)/d.columnWidth);e=Math.min(e,d.cols);if(e===1)c._masonryPlaceBrick(a,d.colYs);else{var f=d.cols+1-e,g=[],h,i;for(i=0;i<f;i++)h=d.colYs.slice(i,i+e),g[i]=Math.max.apply(Math,h);c._masonryPlaceBrick(a,g)}})},_masonryPlaceBrick:function(a,b){var c=Math.min.apply(Math,b),d=0;for(var e=0,f=b.length;e<f;e++)if(b[e]===c){d=e;break}var g=this.masonry.columnWidth*d,h=c;this._pushPosition(a,g,h);var i=c+a.outerHeight(!0),j=this.masonry.cols+1-f;for(e=0;e<j;e++)this.masonry.colYs[d+e]=i},_masonryGetContainerSize:function(){var a=Math.max.apply(Math,this.masonry.colYs);return{height:a}},_masonryResizeChanged:function(){return this._checkIfSegmentsChanged()},_fitRowsReset:function(){this.fitRows={x:0,y:0,height:0}},_fitRowsLayout:function(a){var c=this,d=this.element.width(),e=this.fitRows;a.each(function(){var a=b(this),f=a.outerWidth(!0),g=a.outerHeight(!0);e.x!==0&&f+e.x>d&&(e.x=0,e.y=e.height),c._pushPosition(a,e.x,e.y),e.height=Math.max(e.y+g,e.height),e.x+=f})},_fitRowsGetContainerSize:function(){return{height:this.fitRows.height}},_fitRowsResizeChanged:function(){return!0},_cellsByRowReset:function(){this.cellsByRow={index:0},this._getSegments(),this._getSegments(!0)},_cellsByRowLayout:function(a){var c=this,d=this.cellsByRow;a.each(function(){var a=b(this),e=d.index%d.cols,f=Math.floor(d.index/d.cols),g=(e+.5)*d.columnWidth-a.outerWidth(!0)/2,h=(f+.5)*d.rowHeight-a.outerHeight(!0)/2;c._pushPosition(a,g,h),d.index++})},_cellsByRowGetContainerSize:function(){return{height:Math.ceil(this.$filteredAtoms.length/this.cellsByRow.cols)*this.cellsByRow.rowHeight+this.offset.top}},_cellsByRowResizeChanged:function(){return this._checkIfSegmentsChanged()},_straightDownReset:function(){this.straightDown={y:0}},_straightDownLayout:function(a){var c=this;a.each(function(a){var d=b(this);c._pushPosition(d,0,c.straightDown.y),c.straightDown.y+=d.outerHeight(!0)})},_straightDownGetContainerSize:function(){return{height:this.straightDown.y}},_straightDownResizeChanged:function(){return!0},_masonryHorizontalReset:function(){this.masonryHorizontal={},this._getSegments(!0);var a=this.masonryHorizontal.rows;this.masonryHorizontal.rowXs=[];while(a--)this.masonryHorizontal.rowXs.push(0)},_masonryHorizontalLayout:function(a){var c=this,d=c.masonryHorizontal;a.each(function(){var a=b(this),e=Math.ceil(a.outerHeight(!0)/d.rowHeight);e=Math.min(e,d.rows);if(e===1)c._masonryHorizontalPlaceBrick(a,d.rowXs);else{var f=d.rows+1-e,g=[],h,i;for(i=0;i<f;i++)h=d.rowXs.slice(i,i+e),g[i]=Math.max.apply(Math,h);c._masonryHorizontalPlaceBrick(a,g)}})},_masonryHorizontalPlaceBrick:function(a,b){var c=Math.min.apply(Math,b),d=0;for(var e=0,f=b.length;e<f;e++)if(b[e]===c){d=e;break}var g=c,h=this.masonryHorizontal.rowHeight*d;this._pushPosition(a,g,h);var i=c+a.outerWidth(!0),j=this.masonryHorizontal.rows+1-f;for(e=0;e<j;e++)this.masonryHorizontal.rowXs[d+e]=i},_masonryHorizontalGetContainerSize:function(){var a=Math.max.apply(Math,this.masonryHorizontal.rowXs);return{width:a}},_masonryHorizontalResizeChanged:function(){return this._checkIfSegmentsChanged(!0)},_fitColumnsReset:function(){this.fitColumns={x:0,y:0,width:0}},_fitColumnsLayout:function(a){var c=this,d=this.element.height(),e=this.fitColumns;a.each(function(){var a=b(this),f=a.outerWidth(!0),g=a.outerHeight(!0);e.y!==0&&g+e.y>d&&(e.x=e.width,e.y=0),c._pushPosition(a,e.x,e.y),e.width=Math.max(e.x+f,e.width),e.y+=g})},_fitColumnsGetContainerSize:function(){return{width:this.fitColumns.width}},_fitColumnsResizeChanged:function(){return!0},_cellsByColumnReset:function(){this.cellsByColumn={index:0},this._getSegments(),this._getSegments(!0)},_cellsByColumnLayout:function(a){var c=this,d=this.cellsByColumn;a.each(function(){var a=b(this),e=Math.floor(d.index/d.rows),f=d.index%d.rows,g=(e+.5)*d.columnWidth-a.outerWidth(!0)/2,h=(f+.5)*d.rowHeight-a.outerHeight(!0)/2;c._pushPosition(a,g,h),d.index++})},_cellsByColumnGetContainerSize:function(){return{width:Math.ceil(this.$filteredAtoms.length/this.cellsByColumn.rows)*this.cellsByColumn.columnWidth}},_cellsByColumnResizeChanged:function(){return this._checkIfSegmentsChanged(!0)},_straightAcrossReset:function(){this.straightAcross={x:0}},_straightAcrossLayout:function(a){var c=this;a.each(function(a){var d=b(this);c._pushPosition(d,c.straightAcross.x,0),c.straightAcross.x+=d.outerWidth(!0)})},_straightAcrossGetContainerSize:function(){return{width:this.straightAcross.x}},_straightAcrossResizeChanged:function(){return!0}},b.fn.imagesLoaded=function(a){function h(){a.call(c,d)}function i(a){var c=a.target;c.src!==f&&b.inArray(c,g)===-1&&(g.push(c),--e<=0&&(setTimeout(h),d.unbind(".imagesLoaded",i)))}var c=this,d=c.find("img").add(c.filter("img")),e=d.length,f="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw==",g=[];return e||h(),d.bind("load.imagesLoaded error.imagesLoaded",i).each(function(){var a=this.src;this.src=f,this.src=a}),c};var x=function(b){a.console&&a.console.error(b)};b.fn.isotope=function(a,c){if(typeof a=="string"){var d=Array.prototype.slice.call(arguments,1);this.each(function(){var c=b.data(this,"isotope");if(!c){x("cannot call methods on isotope prior to initialization; attempted to call method '"+a+"'");return}if(!b.isFunction(c[a])||a.charAt(0)==="_"){x("no such method '"+a+"' for isotope instance");return}c[a].apply(c,d)})}else this.each(function(){var d=b.data(this,"isotope");d?(d.option(a),d._init(c)):b.data(this,"isotope",new b.Isotope(a,this,c))});return this}})(window,jQuery); | ||
+ | </script> | ||
+ | |||
+ | |||
+ | <script type="text/javascript"> | ||
+ | // Magnific Popup v0.8.9 by Dmitry Semenov | ||
+ | // http://bit.ly/magnific-popup#build=inline+image+ajax+iframe+gallery | ||
+ | (function(a){var b="Close",c="AfterClose",d="BeforeAppend",e="MarkupParse",f="Open",g="Change",h="mfp",i="."+h,j="mfp-ready",k="mfp-removing",l="mfp-prevent-close",m,n=function(){},o=!!window.jQuery,p,q=a(window),r,s,t,u,v,w=function(a,b){m.ev.on(h+a+i,b)},x=function(b,c,d,e){var f=document.createElement("div");return f.className="mfp-"+b,d&&(f.innerHTML=d),e?c&&c.appendChild(f):(f=a(f),c&&f.appendTo(c)),f},y=function(b,c){m.ev.triggerHandler(h+b,c),m.st.callbacks&&(b=b.charAt(0).toLowerCase()+b.slice(1),m.st.callbacks[b]&&m.st.callbacks[b].apply(m,a.isArray(c)?c:[c]))},z=function(){(m.st.focus?m.content.find(m.st.focus).eq(0):m.wrap).focus()},A=function(b){if(b!==v||!m.currTemplate.closeBtn)m.currTemplate.closeBtn=a(m.st.closeMarkup.replace("%title%",m.st.tClose)),v=b;return m.currTemplate.closeBtn},B=function(){a.magnificPopup.instance||(m=new n,m.init(),a.magnificPopup.instance=m)},C=function(b){if(a(b).hasClass(l))return;var c=m.st.closeOnContentClick,d=m.st.closeOnBgClick;if(c&&d)return!0;if(!m.content||a(b).hasClass("mfp-close")||m.preloader&&b===m.preloader[0])return!0;if(b!==m.content[0]&&!a.contains(m.content[0],b)){if(d)return!0}else if(c)return!0;return!1};n.prototype={constructor:n,init:function(){var b=navigator.appVersion;m.isIE7=b.indexOf("MSIE 7.")!==-1,m.isIE8=b.indexOf("MSIE 8.")!==-1,m.isLowIE=m.isIE7||m.isIE8,m.isAndroid=/android/gi.test(b),m.isIOS=/iphone|ipad|ipod/gi.test(b),m.probablyMobile=m.isAndroid||m.isIOS||/(Opera Mini)|Kindle|webOS|BlackBerry|(Opera Mobi)|(Windows Phone)|IEMobile/i.test(navigator.userAgent),r=a(document.body),s=a(document),m.popupsCache={}},open:function(b){var c;if(b.isObj===!1){m.items=b.items.toArray(),m.index=0;var d=b.items,g;for(c=0;c<d.length;c++){g=d[c],g.parsed&&(g=g.el[0]);if(g===b.el[0]){m.index=c;break}}}else m.items=a.isArray(b.items)?b.items:[b.items],m.index=b.index||0;if(m.isOpen){m.updateItemHTML();return}m.types=[],u="",m.ev=b.mainEl||s,b.key?(m.popupsCache[b.key]||(m.popupsCache[b.key]={}),m.currTemplate=m.popupsCache[b.key]):m.currTemplate={},m.st=a.extend(!0,{},a.magnificPopup.defaults,b),m.fixedContentPos=m.st.fixedContentPos==="auto"?!m.probablyMobile:m.st.fixedContentPos,m.bgOverlay||(m.bgOverlay=x("bg").on("click"+i,function(){m.close()}),m.wrap=x("wrap").attr("tabindex",-1).on("click"+i,function(a){C(a.target)&&m.close()}),m.container=x("container",m.wrap)),m.contentContainer=x("content"),m.st.preloader&&(m.preloader=x("preloader",m.container,m.st.tLoading));var h=a.magnificPopup.modules;for(c=0;c<h.length;c++){var k=h[c];k=k.charAt(0).toUpperCase()+k.slice(1),m["init"+k].call(m)}y("BeforeOpen"),m.st.closeBtnInside?(w(e,function(a,b,c,d){c.close_replaceWith=A(d.type)}),u+=" mfp-close-btn-in"):m.wrap.append(A()),m.st.alignTop&&(u+=" mfp-align-top"),m.fixedContentPos?m.wrap.css({overflow:m.st.overflowY,overflowX:"hidden",overflowY:m.st.overflowY}):m.wrap.css({top:q.scrollTop(),position:"absolute"}),(m.st.fixedBgPos===!1||m.st.fixedBgPos==="auto"&&!m.fixedContentPos)&&m.bgOverlay.css({height:s.height(),position:"absolute"}),s.on("keyup"+i,function(a){a.keyCode===27&&m.close()}),q.on("resize"+i,function(){m.updateSize()}),m.st.closeOnContentClick||(u+=" mfp-auto-cursor"),u&&m.wrap.addClass(u);var l=m.wH=q.height(),n={};if(m.fixedContentPos&&m._hasScrollBar(l)){var o=m._getScrollbarSize();o&&(n.paddingRight=o)}m.fixedContentPos&&(m.isIE7?a("body, html").css("overflow","hidden"):n.overflow="hidden");var p=m.st.mainClass;m.isIE7&&(p+=" mfp-ie7"),p&&m._addClassToMFP(p),m.updateItemHTML(),y("BuildControls"),r.css(n),m.bgOverlay.add(m.wrap).prependTo(document.body),m._lastFocusedEl=document.activeElement,setTimeout(function(){m.content?(m._addClassToMFP(j),z()):m.bgOverlay.addClass(j),s.on("focusin"+i,function(b){if(b.target!==m.wrap[0]&&!a.contains(m.wrap[0],b.target))return z(),!1})},16),m.isOpen=!0,m.updateSize(l),y(f)},close:function(){if(!m.isOpen)return;m.isOpen=!1,m.st.removalDelay&&!m.isLowIE?(m._addClassToMFP(k),setTimeout(function(){m._close()},m.st.removalDelay)):m._close()},_close:function(){y(b);var d=k+" "+j+" ";m.bgOverlay.detach(),m.wrap.detach(),m.container.empty(),m.st.mainClass&&(d+=m.st.mainClass+" "),m._removeClassFromMFP(d);if(m.fixedContentPos){var e={paddingRight:""};m.isIE7?a("body, html").css("overflow",""):e.overflow="",r.css(e)}s.off("keyup"+i+" focusin"+i),m.ev.off(i),m.wrap.attr("class","mfp-wrap").removeAttr("style"),m.bgOverlay.attr("class","mfp-bg"),m.container.attr("class","mfp-container"),(!m.st.closeBtnInside||m.currTemplate[m.currItem.type]===!0)&&m.currTemplate.closeBtn&&m.currTemplate.closeBtn.detach(),m._lastFocusedEl&&a(m._lastFocusedEl).focus(),m.currItem=null,m.content=null,m.currTemplate=null,m.prevHeight=0,y(c)},updateSize:function(a){if(m.isIOS){var b=document.documentElement.clientWidth/window.innerWidth,c=window.innerHeight*b;m.wrap.css("height",c),m.wH=c}else m.wH=a||q.height();m.fixedContentPos||m.wrap.css("height",m.wH),y("Resize")},updateItemHTML:function(){var b=m.items[m.index];m.contentContainer.detach(),m.content&&m.content.detach(),b.parsed||(b=m.parseEl(m.index));var c=b.type;y("BeforeChange",[m.currItem?m.currItem.type:"",c]),m.currItem=b;if(!m.currTemplate[c]){var d=m.st[c]?m.st[c].markup:!1;y("FirstMarkupParse",d),d?m.currTemplate[c]=a(d):m.currTemplate[c]=!0}t&&t!==b.type&&m.container.removeClass("mfp-"+t+"-holder");var e=m["get"+c.charAt(0).toUpperCase()+c.slice(1)](b,m.currTemplate[c]);m.appendContent(e,c),b.preloaded=!0,y(g,b),t=b.type,m.container.prepend(m.contentContainer),y("AfterChange")},appendContent:function(a,b){m.content=a,a?m.st.closeBtnInside&&m.currTemplate[b]===!0?m.content.find(".mfp-close").length||m.content.append(A()):m.content=a:m.content="",y(d),m.container.addClass("mfp-"+b+"-holder"),m.contentContainer.append(m.content)},parseEl:function(b){var c=m.items[b],d=c.type;c.tagName?c={el:a(c)}:c={data:c,src:c.src};if(c.el){var e=m.types;for(var f=0;f<e.length;f++)if(c.el.hasClass("mfp-"+e[f])){d=e[f];break}c.src=c.el.attr("data-mfp-src"),c.src||(c.src=c.el.attr("href"))}return c.type=d||m.st.type||"inline",c.index=b,c.parsed=!0,m.items[b]=c,y("ElementParse",c),m.items[b]},addGroup:function(a,b){var c=function(c){c.mfpEl=this,m._openClick(c,a,b)};b||(b={});var d="click.magnificPopup";b.mainEl=a,b.items?(b.isObj=!0,a.off(d).on(d,c)):(b.isObj=!1,b.delegate?a.off(d).on(d,b.delegate,c):(b.items=a,a.off(d).on(d,c)))},_openClick:function(b,c,d){var e=d.midClick!==undefined?d.midClick:a.magnificPopup.defaults.midClick;if(e||b.which!==2){var f=d.disableOn!==undefined?d.disableOn:a.magnificPopup.defaults.disableOn;if(f)if(a.isFunction(f)){if(!f.call(m))return!0}else if(q.width()<f)return!0;b.type&&(b.preventDefault(),m.isOpen&&b.stopPropagation()),d.el=a(b.mfpEl),d.delegate&&(d.items=c.find(d.delegate)),m.open(d)}},updateStatus:function(a,b){if(m.preloader){p!==a&&m.container.removeClass("mfp-s-"+p),!b&&a==="loading"&&(b=m.st.tLoading);var c={status:a,text:b};y("UpdateStatus",c),a=c.status,b=c.text,m.preloader.html(b),m.preloader.find("a").click(function(a){a.stopImmediatePropagation()}),m.container.addClass("mfp-s-"+a),p=a}},_addClassToMFP:function(a){m.bgOverlay.addClass(a),m.wrap.addClass(a)},_removeClassFromMFP:function(a){this.bgOverlay.removeClass(a),m.wrap.removeClass(a)},_hasScrollBar:function(a){return(m.isIE7?s.height():document.body.scrollHeight)>(a||q.height())},_parseMarkup:function(b,c,d){var f;d.data&&(c=a.extend(d.data,c)),y(e,[b,c,d]),a.each(c,function(a,c){if(c===undefined||c===!1)return!0;f=a.split("_");if(f.length>1){var d=b.find(i+"-"+f[0]);if(d.length>0){var e=f[1];e==="replaceWith"?d[0]!==c[0]&&d.replaceWith(c):e==="img"?d.is("img")?d.attr("src",c):d.replaceWith('<img src="'+c+'" class="'+d.attr("class")+'" />'):d.attr(f[1],c)}}else b.find(i+"-"+a).html(c)})},_getScrollbarSize:function(){if(m.scrollbarSize===undefined){var a=document.createElement("div");a.id="mfp-sbm",a.style.cssText="width: 99px; height: 99px; overflow: scroll; position: absolute; top: -9999px;",document.body.appendChild(a),m.scrollbarSize=a.offsetWidth-a.clientWidth,document.body.removeChild(a)}return m.scrollbarSize}},a.magnificPopup={instance:null,proto:n.prototype,modules:[],open:function(a,b){return B(),a||(a={}),a.isObj=!0,a.index=b||0,this.instance.open(a)},close:function(){return a.magnificPopup.instance.close()},registerModule:function(b,c){c.options&&(a.magnificPopup.defaults[b]=c.options),a.extend(this.proto,c.proto),this.modules.push(b)},defaults:{disableOn:0,key:null,midClick:!1,mainClass:"",preloader:!0,focus:"",closeOnContentClick:!1,closeOnBgClick:!0,closeBtnInside:!0,alignTop:!1,removalDelay:0,fixedContentPos:"auto",fixedBgPos:"auto",overflowY:"auto",closeMarkup:'<button title="%title%" type="button" class="mfp-close"></button>',tClose:"Close (Esc)",tLoading:"Loading..."}},a.fn.magnificPopup=function(b){B();var c=a(this);if(typeof b=="string")if(b==="open"){var d,e=o?c.data("magnificPopup"):c[0].magnificPopup,f=parseInt(arguments[1],10)||0;e.items?d=e.items[f]:(d=c,e.delegate&&(d=d.find(e.delegate)),d=d.eq(f)),m._openClick({mfpEl:d},c,e)}else m.isOpen&&m[b].apply(m,Array.prototype.slice.call(arguments,1));else o?c.data("magnificPopup",b):c[0].magnificPopup=b,m.addGroup(c,b);return c};var D="inline",E,F,G,H=function(){G&&(F.after(G.addClass(E)).detach(),G=null)};a.magnificPopup.registerModule(D,{options:{hiddenClass:"hide",markup:"",tNotFound:"Content not found"},proto:{initInline:function(){m.types.push(D),w(b+"."+D,function(){H()})},getInline:function(b,c){H();if(b.src){var d=m.st.inline,e=a(b.src);if(e.length){var f=e[0].parentNode;f&&f.tagName&&(F||(E=d.hiddenClass,F=x(E),E="mfp-"+E),G=e.after(F).detach().removeClass(E)),m.updateStatus("ready")}else m.updateStatus("error",d.tNotFound),e=a("<div>");return b.inlineElement=e,e}return m.updateStatus("ready"),m._parseMarkup(c,{},b),c}}});var I="ajax",J,K=function(){J&&r.removeClass(J)};a.magnificPopup.registerModule(I,{options:{settings:null,cursor:"mfp-ajax-cur",tError:'<a href="%url%">The content</a> could not be loaded.'},proto:{initAjax:function(){m.types.push(I),J=m.st.ajax.cursor,w(b+"."+I,function(){K(),m.req&&m.req.abort()})},getAjax:function(b){J&&r.addClass(J),m.updateStatus("loading");var c=a.extend({url:b.src,success:function(c,d,e){var f={data:c,xhr:e};y("ParseAjax",f),m.appendContent(a(f.data),I),b.finished=!0,K(),z(),setTimeout(function(){m.wrap.addClass(j)},16),m.updateStatus("ready"),y("AjaxContentAdded")},error:function(){K(),b.finished=b.loadError=!0,m.updateStatus("error",m.st.ajax.tError.replace("%url%",b.src))}},m.st.ajax.settings);return m.req=a.ajax(c),""}}});var L,M=function(b){if(b.data&&b.data.title!==undefined)return b.data.title;var c=m.st.image.titleSrc;if(c){if(a.isFunction(c))return c.call(m,b);if(b.el)return b.el.attr(c)||""}return""};a.magnificPopup.registerModule("image",{options:{markup:'<div class="mfp-figure"><div class="mfp-close"></div><div class="mfp-img"></div><div class="mfp-bottom-bar"><div class="mfp-title"></div><div class="mfp-counter"></div></div></div>',cursor:"mfp-zoom-out-cur",titleSrc:"title",verticalFit:!0,tError:'<a href="%url%">The image</a> could not be loaded.'},proto:{initImage:function(){var a=m.st.image,c=".image";m.types.push("image"),w(f+c,function(){m.currItem.type==="image"&&a.cursor&&r.addClass(a.cursor)}),w(b+c,function(){a.cursor&&r.removeClass(a.cursor),q.off("resize"+i)}),w("Resize"+c,m.resizeImage),m.isLowIE&&w("AfterChange",m.resizeImage)},resizeImage:function(){var a=m.currItem;if(!a.img)return;if(m.st.image.verticalFit){var b=0;m.isLowIE&&(b=parseInt(a.img.css("padding-top"),10)+parseInt(a.img.css("padding-bottom"),10)),a.img.css("max-height",m.wH-b)}},_onImageHasSize:function(a){a.img&&(a.hasSize=!0,L&&clearInterval(L),a.isCheckingImgSize=!1,y("ImageHasSize",a),a.imgHidden&&(m.content&&m.content.removeClass("mfp-loading"),a.imgHidden=!1))},findImageSize:function(a){var b=0,c=a.img[0],d=function(e){L&&clearInterval(L),L=setInterval(function(){if(c.naturalWidth>0){m._onImageHasSize(a);return}b>200&&clearInterval(L),b++,b===3?d(10):b===40?d(50):b===100&&d(500)},e)};d(1)},getImage:function(b,c){var d=0,e=function(){b&&(b.img[0].complete?(b.img.off(".mfploader"),b===m.currItem&&(m._onImageHasSize(b),m.updateStatus("ready")),b.hasSize=!0,b.loaded=!0):(d++,d<200?setTimeout(e,100):f()))},f=function(){b&&(b.img.off(".mfploader"),b===m.currItem&&(m._onImageHasSize(b),m.updateStatus("error",g.tError.replace("%url%",b.src))),b.hasSize=!0,b.loaded=!0,b.loadError=!0)},g=m.st.image,h=c.find(".mfp-img");if(h.length){var i=new Image;i.className="mfp-img",b.img=a(i).on("load.mfploader",e).on("error.mfploader",f),i.src=b.src,h.is("img")&&(b.img=b.img.clone())}return m._parseMarkup(c,{title:M(b),img_replaceWith:b.img},b),m.resizeImage(),b.hasSize?(L&&clearInterval(L),b.loadError?(c.addClass("mfp-loading"),m.updateStatus("error",g.tError.replace("%url%",b.src))):(c.removeClass("mfp-loading"),m.updateStatus("ready")),c):(m.updateStatus("loading"),b.loading=!0,b.hasSize||(b.imgHidden=!0,c.addClass("mfp-loading"),m.findImageSize(b)),c)}}});var N="iframe",O="//about:blank",P=function(a){if(m.currTemplate[N]){var b=m.currTemplate[N].find("iframe");b.length&&(a||(b[0].src=O),m.isIE8&&b.css("display",a?"block":"none"))}};a.magnificPopup.registerModule(N,{options:{markup:'<div class="mfp-iframe-scaler"><div class="mfp-close"></div><iframe class="mfp-iframe" src="//about:blank" frameborder="0" allowfullscreen></iframe></div>',srcAction:"iframe_src",patterns:{youtube:{index:"youtube.com",id:"v=",src:"//www.youtube.com/embed/%id%?autoplay=1"},vimeo:{index:"vimeo.com/",id:"/",src:"//player.vimeo.com/video/%id%?autoplay=1"},gmaps:{index:"//maps.google.",src:"%id%&output=embed"}}},proto:{initIframe:function(){m.types.push(N),w("BeforeChange",function(a,b,c){b!==c&&(b===N?P():c===N&&P(!0))}),w(b+"."+N,function(){P()})},getIframe:function(b,c){var d=b.src,e=m.st.iframe;a.each(e.patterns,function(){if(d.indexOf(this.index)>-1)return this.id&&(typeof this.id=="string"?d=d.substr(d.lastIndexOf(this.id)+this.id.length,d.length):d=this.id.call(this,d)),d=this.src.replace("%id%",d),!1});var f={};return e.srcAction&&(f[e.srcAction]=d),m._parseMarkup(c,f,b),m.updateStatus("ready"),c}}});var Q=function(a){var b=m.items.length;return a>b-1?a-b:a<0?b+a:a},R=function(a,b,c){return a.replace("%curr%",b+1).replace("%total%",c)};a.magnificPopup.registerModule("gallery",{options:{enabled:!1,arrowMarkup:'<button title="%title%" type="button" class="mfp-arrow mfp-arrow-%dir%"></button>',preload:[0,2],navigateByImgClick:!0,arrows:!0,tPrev:"Previous (Left arrow key)",tNext:"Next (Right arrow key)",tCounter:"%curr% of %total%"},proto:{initGallery:function(){var c=m.st.gallery,d=".mfp-gallery",h=Boolean(a.fn.mfpFastClick);m.direction=!0;if(!c||!c.enabled)return!1;u+=" mfp-gallery",w(f+d,function(){c.navigateByImgClick&&m.wrap.on("click"+d,".mfp-img",function(){if(m.items.length>1)return m.next(),!1}),s.on("keydown"+d,function(a){a.keyCode===37?m.prev():a.keyCode===39&&m.next()})}),w("UpdateStatus"+d,function(a,b){b.text&&(b.text=R(b.text,m.currItem.index,m.items.length))}),w(e+d,function(a,b,d,e){var f=m.items.length;d.counter=f>1?R(c.tCounter,e.index,f):""}),w("BuildControls"+d,function(){if(m.items.length>1&&c.arrows&&!m.arrowLeft){var b=c.arrowMarkup,d=m.arrowLeft=a(b.replace("%title%",c.tPrev).replace("%dir%","left")).addClass(l),e=m.arrowRight=a(b.replace("%title%",c.tNext).replace("%dir%","right")).addClass(l),f=h?"mfpFastClick":"click";d[f](function(){m.prev()}),e[f](function(){m.next()}),m.isIE7&&(x("b",d[0],!1,!0),x("a",d[0],!1,!0),x("b",e[0],!1,!0),x("a",e[0],!1,!0)),m.container.append(d.add(e))}}),w(g+d,function(){m._preloadTimeout&&clearTimeout(m._preloadTimeout),m._preloadTimeout=setTimeout(function(){m.preloadNearbyImages(),m._preloadTimeout=null},16)}),w(b+d,function(){s.off(d),m.wrap.off("click"+d),m.arrowLeft&&h&&m.arrowLeft.add(m.arrowRight).destroyMfpFastClick(),m.arrowRight=m.arrowLeft=null})},next:function(){m.direction=!0,m.index=Q(m.index+1),m.updateItemHTML()},prev:function(){m.direction=!1,m.index=Q(m.index-1),m.updateItemHTML()},goTo:function(a){m.direction=a>=m.index,m.index=a,m.updateItemHTML()},preloadNearbyImages:function(){var a=m.st.gallery.preload,b=Math.min(a[0],m.items.length),c=Math.min(a[1],m.items.length),d;for(d=1;d<=(m.direction?c:b);d++)m._preloadItem(m.index+d);for(d=1;d<=(m.direction?b:c);d++)m._preloadItem(m.index-d)},_preloadItem:function(b){b=Q(b);if(m.items[b].preloaded)return;var c=m.items[b];c.parsed||(c=m.parseEl(b)),y("LazyLoad",c),c.type==="image"&&(c.img=a('<img class="mfp-img" />').on("load.mfploader",function(){c.hasSize=!0}).on("error.mfploader",function(){c.hasSize=!0,c.loadError=!0}).attr("src",c.src)),c.preloaded=!0}}})})(window.jQuery||window.Zepto) | ||
+ | |||
+ | </script> | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | <script type="text/javascript"> | ||
+ | /** | ||
+ | * jquery.matchHeight-min.js master | ||
+ | * http://brm.io/jquery-match-height/ | ||
+ | * License: MIT | ||
+ | */ | ||
+ | (function(c){var n=-1,f=-1,g=function(a){return parseFloat(a)||0},r=function(a){var b=null,d=[];c(a).each(function(){var a=c(this),k=a.offset().top-g(a.css("margin-top")),l=0<d.length?d[d.length-1]:null;null===l?d.push(a):1>=Math.floor(Math.abs(b-k))?d[d.length-1]=l.add(a):d.push(a);b=k});return d},p=function(a){var b={byRow:!0,property:"height",target:null,remove:!1};if("object"===typeof a)return c.extend(b,a);"boolean"===typeof a?b.byRow=a:"remove"===a&&(b.remove=!0);return b},b=c.fn.matchHeight= | ||
+ | function(a){a=p(a);if(a.remove){var e=this;this.css(a.property,"");c.each(b._groups,function(a,b){b.elements=b.elements.not(e)});return this}if(1>=this.length&&!a.target)return this;b._groups.push({elements:this,options:a});b._apply(this,a);return this};b._groups=[];b._throttle=80;b._maintainScroll=!1;b._beforeUpdate=null;b._afterUpdate=null;b._apply=function(a,e){var d=p(e),h=c(a),k=[h],l=c(window).scrollTop(),f=c("html").outerHeight(!0),m=h.parents().filter(":hidden");m.each(function(){var a=c(this); | ||
+ | a.data("style-cache",a.attr("style"))});m.css("display","block");d.byRow&&!d.target&&(h.each(function(){var a=c(this),b=a.css("display");"inline-block"!==b&&"inline-flex"!==b&&(b="block");a.data("style-cache",a.attr("style"));a.css({display:b,"padding-top":"0","padding-bottom":"0","margin-top":"0","margin-bottom":"0","border-top-width":"0","border-bottom-width":"0",height:"100px"})}),k=r(h),h.each(function(){var a=c(this);a.attr("style",a.data("style-cache")||"")}));c.each(k,function(a,b){var e=c(b), | ||
+ | f=0;if(d.target)f=d.target.outerHeight(!1);else{if(d.byRow&&1>=e.length){e.css(d.property,"");return}e.each(function(){var a=c(this),b=a.css("display");"inline-block"!==b&&"inline-flex"!==b&&(b="block");b={display:b};b[d.property]="";a.css(b);a.outerHeight(!1)>f&&(f=a.outerHeight(!1));a.css("display","")})}e.each(function(){var a=c(this),b=0;d.target&&a.is(d.target)||("border-box"!==a.css("box-sizing")&&(b+=g(a.css("border-top-width"))+g(a.css("border-bottom-width")),b+=g(a.css("padding-top"))+g(a.css("padding-bottom"))), | ||
+ | a.css(d.property,f-b+"px"))})});m.each(function(){var a=c(this);a.attr("style",a.data("style-cache")||null)});b._maintainScroll&&c(window).scrollTop(l/f*c("html").outerHeight(!0));return this};b._applyDataApi=function(){var a={};c("[data-match-height], [data-mh]").each(function(){var b=c(this),d=b.attr("data-mh")||b.attr("data-match-height");a[d]=d in a?a[d].add(b):b});c.each(a,function(){this.matchHeight(!0)})};var q=function(a){b._beforeUpdate&&b._beforeUpdate(a,b._groups);c.each(b._groups,function(){b._apply(this.elements, | ||
+ | this.options)});b._afterUpdate&&b._afterUpdate(a,b._groups)};b._update=function(a,e){if(e&&"resize"===e.type){var d=c(window).width();if(d===n)return;n=d}a?-1===f&&(f=setTimeout(function(){q(e);f=-1},b._throttle)):q(e)};c(b._applyDataApi);c(window).bind("load",function(a){b._update(!1,a)});c(window).bind("resize orientationchange",function(a){b._update(!0,a)})})(jQuery); | ||
+ | </script> | ||
+ | |||
+ | |||
+ | <script type="text/javascript"> | ||
+ | /*! SmartMenus jQuery Plugin Bootstrap Addon - v0.1.0 - March 27, 2014 | ||
+ | * http://www.smartmenus.org/ | ||
+ | * Copyright 2014 Vasil Dinkov, Vadikom Web Ltd. http://vadikom.com; Licensed MIT */(function(t){t(function(){t("ul.navbar-nav").each(function(){var s=t(this);s.addClass("sm").smartmenus({subMenusSubOffsetX:2,subMenusSubOffsetY:-6,subIndicatorsPos:"append",subIndicatorsText:"...",collapsibleShowFunction:null,collapsibleHideFunction:null,rightToLeftSubMenus:s.hasClass("navbar-right"),bottomToTopSubMenus:s.closest(".navbar").hasClass("navbar-fixed-bottom")}).find("a.current").parent().addClass("active")}).bind({"show.smapi":function(s,e){var i=t(e),o=i.dataSM("scroll-arrows"),a=t(this).data("smartmenus");o&&o.css("background-color",t(document.body).css("background-color")),i.parent().addClass("open"+(a.isCollapsible()?" collapsible":""))},"hide.smapi":function(s,e){t(e).parent().removeClass("open collapsible")},"click.smapi":function(s,e){var i=t(this).data("smartmenus");if(i.isCollapsible()){var o=t(e),a=o.parent().dataSM("sub");if(a&&a.dataSM("shown-before")&&a.is(":visible"))return i.itemActivate(o),i.menuHide(a),!1}}})}),t.SmartMenus.prototype.isCollapsible=function(){return"left"!=this.$firstLink.parent().css("float")}})(jQuery); | ||
+ | </script> | ||
+ | |||
+ | <script type="text/javascript"> | ||
+ | /*! SmartMenus jQuery Plugin - v0.9.6 - March 27, 2014 | ||
+ | * http://www.smartmenus.org/ | ||
+ | * Copyright 2014 Vasil Dinkov, Vadikom Web Ltd. http://vadikom.com; Licensed MIT */(function(t){function s(s){if(h||s)h&&s&&(t(document).unbind(".smartmenus_mouse"),h=!1);else{var e=!0,o=null;t(document).bind({"mousemove.smartmenus_mouse":function(s){var a={x:s.pageX,y:s.pageY,timeStamp:(new Date).getTime()};if(o){var r=Math.abs(o.x-a.x),h=Math.abs(o.y-a.y);if((r>0||h>0)&&2>=r&&2>=h&&300>=a.timeStamp-o.timeStamp&&(n=!0,e)){var u=t(s.target).closest("a");u.is("a")&&t.each(i,function(){return t.contains(this.$root[0],u[0])?(this.itemEnter({currentTarget:u[0]}),!1):void 0}),e=!1}}o=a},"touchstart.smartmenus_mouse pointerover.smartmenus_mouse MSPointerOver.smartmenus_mouse":function(t){/^(4|mouse)$/.test(t.originalEvent.pointerType)||(n=!1)}}),h=!0}}var i=[],e=!!window.createPopup,o=e&&!document.defaultView,a=e&&!document.querySelector,r=e&&document.documentElement.currentStyle.minWidth===void 0,n=!1,h=!1;t.SmartMenus=function(s,i){this.$root=t(s),this.opts=i,this.rootId="",this.$subArrow=null,this.subMenus=[],this.activatedItems=[],this.visibleSubMenus=[],this.showTimeout=0,this.hideTimeout=0,this.scrollTimeout=0,this.clickActivated=!1,this.zIndexInc=0,this.$firstLink=null,this.$firstSub=null,this.disabled=!1,this.$disableOverlay=null,this.init()},t.extend(t.SmartMenus,{hideAll:function(){t.each(i,function(){this.menuHideAll()})},destroy:function(){for(;i.length;)i[0].destroy();s(!0)},prototype:{init:function(e){var o=this;if(!e){i.push(this),this.rootId=((new Date).getTime()+Math.random()+"").replace(/\D/g,""),this.$root.hasClass("sm-rtl")&&(this.opts.rightToLeftSubMenus=!0),this.$root.data("smartmenus",this).attr("data-smartmenus-id",this.rootId).dataSM("level",1).bind({"mouseover.smartmenus focusin.smartmenus":t.proxy(this.rootOver,this),"mouseout.smartmenus focusout.smartmenus":t.proxy(this.rootOut,this)}).delegate("a",{"mouseenter.smartmenus":t.proxy(this.itemEnter,this),"mouseleave.smartmenus":t.proxy(this.itemLeave,this),"mousedown.smartmenus":t.proxy(this.itemDown,this),"focus.smartmenus":t.proxy(this.itemFocus,this),"blur.smartmenus":t.proxy(this.itemBlur,this),"click.smartmenus":t.proxy(this.itemClick,this),"touchend.smartmenus":t.proxy(this.itemTouchEnd,this)});var a=".smartmenus"+this.rootId;this.opts.hideOnClick&&t(document).bind("touchstart"+a,t.proxy(this.docTouchStart,this)).bind("touchmove"+a,t.proxy(this.docTouchMove,this)).bind("touchend"+a,t.proxy(this.docTouchEnd,this)).bind("click"+a,t.proxy(this.docClick,this)),t(window).bind("resize"+a+" orientationchange"+a,t.proxy(this.winResize,this)),this.opts.subIndicators&&(this.$subArrow=t("<span/>").addClass("sub-arrow"),this.opts.subIndicatorsText&&this.$subArrow.html(this.opts.subIndicatorsText)),s()}if(this.$firstSub=this.$root.find("ul").each(function(){o.menuInit(t(this))}).eq(0),this.$firstLink=this.$root.find("a").eq(0),this.opts.markCurrentItem){var r=/(index|default)\.[^#\?\/]*/i,n=/#.*/,h=window.location.href.replace(r,""),u=h.replace(n,"");this.$root.find("a").each(function(){var s=this.href.replace(r,""),i=t(this);(s==h||s==u)&&(i.addClass("current"),o.opts.markCurrentTree&&i.parents("li").each(function(){var s=t(this);s.dataSM("sub")&&s.children("a").addClass("current")}))})}},destroy:function(){this.menuHideAll(),this.$root.removeData("smartmenus").removeAttr("data-smartmenus-id").removeDataSM("level").unbind(".smartmenus").undelegate(".smartmenus");var s=".smartmenus"+this.rootId;t(document).unbind(s),t(window).unbind(s),this.opts.subIndicators&&(this.$subArrow=null);var e=this;t.each(this.subMenus,function(){this.hasClass("mega-menu")&&this.find("ul").removeDataSM("in-mega"),this.dataSM("shown-before")&&(a&&this.children().css({styleFloat:"",width:""}),(e.opts.subMenusMinWidth||e.opts.subMenusMaxWidth)&&(r?this.css({width:"",overflowX:"",overflowY:""}).children().children("a").css("white-space",""):this.css({width:"",minWidth:"",maxWidth:""}).removeClass("sm-nowrap")),this.dataSM("scroll-arrows")&&this.dataSM("scroll-arrows").remove(),this.css({zIndex:"",top:"",left:"",marginLeft:"",marginTop:"",display:""})),e.opts.subIndicators&&this.dataSM("parent-a").removeClass("has-submenu").children("span.sub-arrow").remove(),this.removeDataSM("shown-before").removeDataSM("ie-shim").removeDataSM("scroll-arrows").removeDataSM("parent-a").removeDataSM("level").removeDataSM("beforefirstshowfired").parent().removeDataSM("sub")}),this.opts.markCurrentItem&&this.$root.find("a.current").removeClass("current"),this.$root=null,this.$firstLink=null,this.$firstSub=null,this.$disableOverlay&&(this.$disableOverlay.remove(),this.$disableOverlay=null),i.splice(t.inArray(this,i),1)},disable:function(s){if(!this.disabled){if(this.menuHideAll(),!s&&!this.opts.isPopup&&this.$root.is(":visible")){var i=this.$root.offset();this.$disableOverlay=t('<div class="sm-jquery-disable-overlay"/>').css({position:"absolute",top:i.top,left:i.left,width:this.$root.outerWidth(),height:this.$root.outerHeight(),zIndex:this.getStartZIndex()+1,opacity:0}).appendTo(document.body)}this.disabled=!0}},docClick:function(s){(this.visibleSubMenus.length&&!t.contains(this.$root[0],s.target)||t(s.target).is("a"))&&this.menuHideAll()},docTouchEnd:function(){if(this.lastTouch){if(!(!this.visibleSubMenus.length||void 0!==this.lastTouch.x2&&this.lastTouch.x1!=this.lastTouch.x2||void 0!==this.lastTouch.y2&&this.lastTouch.y1!=this.lastTouch.y2||this.lastTouch.target&&t.contains(this.$root[0],this.lastTouch.target))){this.hideTimeout&&(clearTimeout(this.hideTimeout),this.hideTimeout=0);var s=this;this.hideTimeout=setTimeout(function(){s.menuHideAll()},350)}this.lastTouch=null}},docTouchMove:function(t){if(this.lastTouch){var s=t.originalEvent.touches[0];this.lastTouch.x2=s.pageX,this.lastTouch.y2=s.pageY}},docTouchStart:function(t){var s=t.originalEvent.touches[0];this.lastTouch={x1:s.pageX,y1:s.pageY,target:s.target}},enable:function(){this.disabled&&(this.$disableOverlay&&(this.$disableOverlay.remove(),this.$disableOverlay=null),this.disabled=!1)},getHeight:function(t){return this.getOffset(t,!0)},getOffset:function(t,s){var i;"none"==t.css("display")&&(i={position:t[0].style.position,visibility:t[0].style.visibility},t.css({position:"absolute",visibility:"hidden"}).show());var e=t[0].ownerDocument.defaultView,o=e&&e.getComputedStyle&&e.getComputedStyle(t[0],null),a=o&&parseFloat(o[s?"height":"width"]);return a?a+=parseFloat(o[s?"paddingTop":"paddingLeft"])+parseFloat(o[s?"paddingBottom":"paddingRight"])+parseInt(o[s?"borderTopWidth":"borderLeftWidth"])+parseInt(o[s?"borderBottomWidth":"borderRightWidth"]):a=s?t[0].offsetHeight:t[0].offsetWidth,i&&t.hide().css(i),a},getWidth:function(t){return this.getOffset(t)},getStartZIndex:function(){var t=parseInt(this.$root.css("z-index"));return isNaN(t)?1:t},handleEvents:function(){return!this.disabled&&this.isCSSOn()},handleItemEvents:function(t){return this.handleEvents()&&!this.isLinkInMegaMenu(t)},isCollapsible:function(){return"static"==this.$firstSub.css("position")},isCSSOn:function(){return"block"==this.$firstLink.css("display")},isFixed:function(){return"fixed"==this.$root.css("position")},isLinkInMegaMenu:function(t){return!t.parent().parent().dataSM("level")},isTouchMode:function(){return!n||this.isCollapsible()},itemActivate:function(s){var i=s.parent(),e=i.parent(),o=e.dataSM("level");if(o>1&&(!this.activatedItems[o-2]||this.activatedItems[o-2][0]!=e.dataSM("parent-a")[0])){var a=this;t(e.parentsUntil("[data-smartmenus-id]","ul").get().reverse()).add(e).each(function(){a.itemActivate(t(this).dataSM("parent-a"))})}if(this.visibleSubMenus.length>o)for(var r=this.visibleSubMenus.length-1,n=this.activatedItems[o-1]&&this.activatedItems[o-1][0]==s[0]?o:o-1;r>n;r--)this.menuHide(this.visibleSubMenus[r]);if(this.activatedItems[o-1]=s,this.visibleSubMenus[o-1]=e,this.$root.triggerHandler("activate.smapi",s[0])!==!1){var h=i.dataSM("sub");h&&(this.isTouchMode()||!this.opts.showOnClick||this.clickActivated)&&this.menuShow(h)}},itemBlur:function(s){var i=t(s.currentTarget);this.handleItemEvents(i)&&this.$root.triggerHandler("blur.smapi",i[0])},itemClick:function(s){var i=t(s.currentTarget);if(this.handleItemEvents(i)){if(i.removeDataSM("mousedown"),this.$root.triggerHandler("click.smapi",i[0])===!1)return!1;var e=i.parent().dataSM("sub");if(this.isTouchMode()){if(i.dataSM("href")&&i.attr("href",i.dataSM("href")).removeDataSM("href"),e&&(!e.dataSM("shown-before")||!e.is(":visible"))&&(this.itemActivate(i),e.is(":visible")))return!1}else if(this.opts.showOnClick&&1==i.parent().parent().dataSM("level")&&e)return this.clickActivated=!0,this.menuShow(e),!1;return i.hasClass("disabled")?!1:this.$root.triggerHandler("select.smapi",i[0])===!1?!1:void 0}},itemDown:function(s){var i=t(s.currentTarget);this.handleItemEvents(i)&&i.dataSM("mousedown",!0)},itemEnter:function(s){var i=t(s.currentTarget);if(this.handleItemEvents(i)){if(!this.isTouchMode()){this.showTimeout&&(clearTimeout(this.showTimeout),this.showTimeout=0);var e=this;this.showTimeout=setTimeout(function(){e.itemActivate(i)},this.opts.showOnClick&&1==i.parent().parent().dataSM("level")?1:this.opts.showTimeout)}this.$root.triggerHandler("mouseenter.smapi",i[0])}},itemFocus:function(s){var i=t(s.currentTarget);this.handleItemEvents(i)&&(this.isTouchMode()&&i.dataSM("mousedown")||this.activatedItems.length&&this.activatedItems[this.activatedItems.length-1][0]==i[0]||this.itemActivate(i),this.$root.triggerHandler("focus.smapi",i[0]))},itemLeave:function(s){var i=t(s.currentTarget);this.handleItemEvents(i)&&(this.isTouchMode()||(i[0].blur&&i[0].blur(),this.showTimeout&&(clearTimeout(this.showTimeout),this.showTimeout=0)),i.removeDataSM("mousedown"),this.$root.triggerHandler("mouseleave.smapi",i[0]))},itemTouchEnd:function(s){var i=t(s.currentTarget);if(this.handleItemEvents(i)){var e=i.parent().dataSM("sub");"#"===i.attr("href").charAt(0)||!e||e.dataSM("shown-before")&&e.is(":visible")||(i.dataSM("href",i.attr("href")),i.attr("href","#"))}},menuFixLayout:function(t){t.dataSM("shown-before")||(t.hide().dataSM("shown-before",!0),a&&t.children().css({styleFloat:"left",width:"100%"}))},menuHide:function(t){if(this.$root.triggerHandler("beforehide.smapi",t[0])!==!1&&(t.stop(!0,!0),t.is(":visible"))){var s=function(){o?t.parent().css("z-index",""):t.css("z-index","")};this.isCollapsible()?this.opts.collapsibleHideFunction?this.opts.collapsibleHideFunction.call(this,t,s):t.hide(this.opts.collapsibleHideDuration,s):this.opts.hideFunction?this.opts.hideFunction.call(this,t,s):t.hide(this.opts.hideDuration,s),t.dataSM("ie-shim")&&t.dataSM("ie-shim").remove(),t.dataSM("scroll")&&t.unbind(".smartmenus_scroll").removeDataSM("scroll").dataSM("scroll-arrows").hide(),t.dataSM("parent-a").removeClass("highlighted");var i=t.dataSM("level");this.activatedItems.splice(i-1,1),this.visibleSubMenus.splice(i-1,1),this.$root.triggerHandler("hide.smapi",t[0])}},menuHideAll:function(){this.showTimeout&&(clearTimeout(this.showTimeout),this.showTimeout=0);for(var t=this.visibleSubMenus.length-1;t>0;t--)this.menuHide(this.visibleSubMenus[t]);this.opts.isPopup&&(this.$root.stop(!0,!0),this.$root.is(":visible")&&(this.opts.hideFunction?this.opts.hideFunction.call(this,this.$root):this.$root.hide(this.opts.hideDuration),this.$root.dataSM("ie-shim")&&this.$root.dataSM("ie-shim").remove())),this.activatedItems=[],this.visibleSubMenus=[],this.clickActivated=!1,this.zIndexInc=0},menuIframeShim:function(s){e&&this.opts.overlapControlsInIE&&!s.dataSM("ie-shim")&&s.dataSM("ie-shim",t("<iframe/>").attr({src:"javascript:0",tabindex:-9}).css({position:"absolute",top:"auto",left:"0",opacity:0,border:"0"}))},menuInit:function(t){if(!t.dataSM("in-mega")){this.subMenus.push(t),t.hasClass("mega-menu")&&t.find("ul").dataSM("in-mega",!0);for(var s=2,i=t[0];(i=i.parentNode.parentNode)!=this.$root[0];)s++;t.dataSM("parent-a",t.prevAll("a").eq(-1)).dataSM("level",s).parent().dataSM("sub",t),this.opts.subIndicators&&t.dataSM("parent-a").addClass("has-submenu")[this.opts.subIndicatorsPos](this.$subArrow.clone())}},menuPosition:function(s){var i,e,o=s.dataSM("parent-a"),a=s.parent().parent(),r=s.dataSM("level"),h=this.getWidth(s),u=this.getHeight(s),l=o.offset(),d=l.left,c=l.top,m=this.getWidth(o),p=this.getHeight(o),f=t(window),v=f.scrollLeft(),b=f.scrollTop(),M=f.width(),S=f.height(),w=a.hasClass("sm")&&!a.hasClass("sm-vertical"),g=2==r?this.opts.mainMenuSubOffsetX:this.opts.subMenusSubOffsetX,T=2==r?this.opts.mainMenuSubOffsetY:this.opts.subMenusSubOffsetY;if(w?(i=this.opts.rightToLeftSubMenus?m-h-g:g,e=this.opts.bottomToTopSubMenus?-u-T:p+T):(i=this.opts.rightToLeftSubMenus?g-h:m-g,e=this.opts.bottomToTopSubMenus?p-T-u:T),this.opts.keepInViewport&&!this.isCollapsible()){this.isFixed()&&(d-=v,c-=b,v=b=0);var $=d+i,I=c+e;if(this.opts.rightToLeftSubMenus&&v>$?i=w?v-$+i:m-g:!this.opts.rightToLeftSubMenus&&$+h>v+M&&(i=w?v+M-h-$+i:g-h),w||(S>u&&I+u>b+S?e+=b+S-u-I:(u>=S||b>I)&&(e+=b-I)),n&&(w&&(I+u>b+S+.49||b>I)||!w&&u>S+.49)){var y=this;s.dataSM("scroll-arrows")||s.dataSM("scroll-arrows",t([t('<span class="scroll-up"><span class="scroll-up-arrow"></span></span>')[0],t('<span class="scroll-down"><span class="scroll-down-arrow"></span></span>')[0]]).bind({mouseenter:function(){y.menuScroll(s,t(this).hasClass("scroll-up"))},mouseleave:function(t){y.menuScrollStop(s),y.menuScrollOut(s,t)},"mousewheel DOMMouseScroll":function(t){t.preventDefault()}}).insertAfter(s));var x=b-(c+p);s.dataSM("scroll",{vportY:x,subH:u,winH:S,step:1}).bind({"mouseover.smartmenus_scroll":function(t){y.menuScrollOver(s,t)},"mouseout.smartmenus_scroll":function(t){y.menuScrollOut(s,t)},"mousewheel.smartmenus_scroll DOMMouseScroll.smartmenus_scroll":function(t){y.menuScrollMousewheel(s,t)}}).dataSM("scroll-arrows").css({top:"auto",left:"0",marginLeft:i+(parseInt(s.css("border-left-width"))||0),width:this.getWidth(s)-(parseInt(s.css("border-left-width"))||0)-(parseInt(s.css("border-right-width"))||0),zIndex:this.getStartZIndex()+this.zIndexInc}).eq(0).css("margin-top",x).end().eq(1).css("margin-top",x+S-this.getHeight(s.dataSM("scroll-arrows").eq(1))).end().eq(w&&this.opts.bottomToTopSubMenus?0:1).show()}}s.css({top:"auto",left:"0",marginLeft:i,marginTop:e-p}),this.menuIframeShim(s),s.dataSM("ie-shim")&&s.dataSM("ie-shim").css({zIndex:s.css("z-index"),width:h,height:u,marginLeft:i,marginTop:e-p})},menuScroll:function(t,s,i){var e=parseFloat(t.css("margin-top")),o=t.dataSM("scroll"),a=o.vportY+(s?0:o.winH-o.subH),r=i||!this.opts.scrollAccelerate?this.opts.scrollStep:Math.floor(t.dataSM("scroll").step);if(t.add(t.dataSM("ie-shim")).css("margin-top",Math.abs(a-e)>r?e+(s?r:-r):a),e=parseFloat(t.css("margin-top")),(s&&e+o.subH>o.vportY+o.winH||!s&&o.vportY>e)&&t.dataSM("scroll-arrows").eq(s?1:0).show(),!i&&this.opts.scrollAccelerate&&t.dataSM("scroll").step<this.opts.scrollStep&&(t.dataSM("scroll").step+=.5),1>Math.abs(e-a))t.dataSM("scroll-arrows").eq(s?0:1).hide(),t.dataSM("scroll").step=1;else if(!i){var n=this;this.scrollTimeout=setTimeout(function(){n.menuScroll(t,s)},this.opts.scrollInterval)}},menuScrollMousewheel:function(s,i){for(var e=t(i.target).closest("ul");e.dataSM("in-mega");)e=e.parent().closest("ul");if(e[0]==s[0]){var o=(i.originalEvent.wheelDelta||-i.originalEvent.detail)>0;s.dataSM("scroll-arrows").eq(o?0:1).is(":visible")&&this.menuScroll(s,o,!0)}i.preventDefault()},menuScrollOut:function(s,i){for(var e=/^scroll-(up|down)/,o=t(i.relatedTarget).closest("ul");o.dataSM("in-mega");)o=o.parent().closest("ul");e.test((i.relatedTarget||"").className)||(s[0]==i.relatedTarget||t.contains(s[0],i.relatedTarget))&&o[0]==s[0]||s.dataSM("scroll-arrows").css("visibility","hidden")},menuScrollOver:function(s,i){for(var e=/^scroll-(up|down)/,o=t(i.target).closest("ul");o.dataSM("in-mega");)o=o.parent().closest("ul");e.test(i.target.className)||o[0]!=s[0]||s.dataSM("scroll-arrows").css("visibility","visible")},menuScrollStop:function(t){this.scrollTimeout&&(clearTimeout(this.scrollTimeout),this.scrollTimeout=0,t.dataSM("scroll").step=1)},menuShow:function(t){if((t.dataSM("beforefirstshowfired")||(t.dataSM("beforefirstshowfired",!0),this.$root.triggerHandler("beforefirstshow.smapi",t[0])!==!1))&&this.$root.triggerHandler("beforeshow.smapi",t[0])!==!1&&(this.menuFixLayout(t),t.stop(!0,!0),!t.is(":visible"))){var s=this.getStartZIndex()+ ++this.zIndexInc;if(o?t.parent().css("z-index",s):t.css("z-index",s),(this.opts.keepHighlighted||this.isCollapsible())&&t.dataSM("parent-a").addClass("highlighted"),this.opts.subMenusMinWidth||this.opts.subMenusMaxWidth)if(a){if(t.children().css("styleFloat","none"),r?t.width(this.opts.subMenusMinWidth?this.opts.subMenusMinWidth:1).children().children("a").css("white-space","nowrap"):(t.css({width:"auto",minWidth:"",maxWidth:""}).addClass("sm-nowrap"),this.opts.subMenusMinWidth&&t.css("min-width",this.opts.subMenusMinWidth)),this.opts.subMenusMaxWidth){var i=t.width();if(r){var e=t.css({width:this.opts.subMenusMaxWidth,overflowX:"hidden",overflowY:"hidden"}).width();i>e?t.css({width:e,overflowX:"visible",overflowY:"visible"}).children().children("a").css("white-space",""):t.css({width:i,overflowX:"visible",overflowY:"visible"})}else t.css("max-width",this.opts.subMenusMaxWidth),i>t.width()?t.removeClass("sm-nowrap").css("width",this.opts.subMenusMaxWidth):t.width(i)}else t.width(t.width());t.children().css("styleFloat","left")}else if(t.css({width:"auto",minWidth:"",maxWidth:""}).addClass("sm-nowrap"),this.opts.subMenusMinWidth&&t.css("min-width",this.opts.subMenusMinWidth),this.opts.subMenusMaxWidth){var i=this.getWidth(t);t.css("max-width",this.opts.subMenusMaxWidth),i>this.getWidth(t)&&t.removeClass("sm-nowrap").css("width",this.opts.subMenusMaxWidth)}this.menuPosition(t),t.dataSM("ie-shim")&&t.dataSM("ie-shim").insertBefore(t);var n=function(){t.css("overflow","")};this.isCollapsible()?this.opts.collapsibleShowFunction?this.opts.collapsibleShowFunction.call(this,t,n):t.show(this.opts.collapsibleShowDuration,n):this.opts.showFunction?this.opts.showFunction.call(this,t,n):t.show(this.opts.showDuration,n),this.visibleSubMenus[t.dataSM("level")-1]=t,this.$root.triggerHandler("show.smapi",t[0])}},popupHide:function(t){this.hideTimeout&&(clearTimeout(this.hideTimeout),this.hideTimeout=0);var s=this;this.hideTimeout=setTimeout(function(){s.menuHideAll()},t?1:this.opts.hideTimeout)},popupShow:function(t,s){return this.opts.isPopup?(this.hideTimeout&&(clearTimeout(this.hideTimeout),this.hideTimeout=0),this.menuFixLayout(this.$root),this.$root.stop(!0,!0),this.$root.is(":visible")||(this.$root.css({left:t,top:s}),this.menuIframeShim(this.$root),this.$root.dataSM("ie-shim")&&this.$root.dataSM("ie-shim").css({zIndex:this.$root.css("z-index"),width:this.getWidth(this.$root),height:this.getHeight(this.$root),left:t,top:s}).insertBefore(this.$root),this.opts.showFunction?this.opts.showFunction.call(this,this.$root):this.$root.show(this.opts.showDuration),this.visibleSubMenus[0]=this.$root),void 0):(alert('SmartMenus jQuery Error:\n\nIf you want to show this menu via the "popupShow" method, set the isPopup:true option.'),void 0)},refresh:function(){this.menuHideAll(),this.$root.find("ul").each(function(){var s=t(this);s.dataSM("scroll-arrows")&&s.dataSM("scroll-arrows").remove()}).removeDataSM("in-mega").removeDataSM("shown-before").removeDataSM("ie-shim").removeDataSM("scroll-arrows").removeDataSM("parent-a").removeDataSM("level").removeDataSM("beforefirstshowfired"),this.$root.find("a.has-submenu").removeClass("has-submenu").parent().removeDataSM("sub"),this.opts.subIndicators&&this.$root.find("span.sub-arrow").remove(),this.opts.markCurrentItem&&this.$root.find("a.current").removeClass("current"),this.subMenus=[],this.init(!0)},rootOut:function(t){if(this.handleEvents()&&!this.isTouchMode()&&t.target!=this.$root[0]&&(this.hideTimeout&&(clearTimeout(this.hideTimeout),this.hideTimeout=0),!this.opts.showOnClick||!this.opts.hideOnClick)){var s=this;this.hideTimeout=setTimeout(function(){s.menuHideAll()},this.opts.hideTimeout)}},rootOver:function(t){this.handleEvents()&&!this.isTouchMode()&&t.target!=this.$root[0]&&this.hideTimeout&&(clearTimeout(this.hideTimeout),this.hideTimeout=0)},winResize:function(t){if(this.handleEvents())this.isCollapsible()||"onorientationchange"in window&&"orientationchange"!=t.type||(this.activatedItems.length&&this.activatedItems[this.activatedItems.length-1][0].blur(),this.menuHideAll());else if(this.$disableOverlay){var s=this.$root.offset();this.$disableOverlay.css({top:s.top,left:s.left,width:this.$root.outerWidth(),height:this.$root.outerHeight()})}}}}),t.fn.dataSM=function(t,s){return s?this.data(t+"_smartmenus",s):this.data(t+"_smartmenus")},t.fn.removeDataSM=function(t){return this.removeData(t+"_smartmenus")},t.fn.smartmenus=function(s){if("string"==typeof s){var i=arguments,e=s;return Array.prototype.shift.call(i),this.each(function(){var s=t(this).data("smartmenus");s&&s[e]&&s[e].apply(s,i)})}var o=t.extend({},t.fn.smartmenus.defaults,s);return this.each(function(){new t.SmartMenus(this,o)})},t.fn.smartmenus.defaults={isPopup:!1,mainMenuSubOffsetX:0,mainMenuSubOffsetY:0,subMenusSubOffsetX:0,subMenusSubOffsetY:0,subMenusMinWidth:"10em",subMenusMaxWidth:"20em",subIndicators:!0,subIndicatorsPos:"prepend",subIndicatorsText:"+",scrollStep:30,scrollInterval:30,scrollAccelerate:!0,showTimeout:250,hideTimeout:500,showDuration:0,showFunction:null,hideDuration:0,hideFunction:function(t,s){t.fadeOut(200,s)},collapsibleShowDuration:0,collapsibleShowFunction:function(t,s){t.slideDown(200,s)},collapsibleHideDuration:0,collapsibleHideFunction:function(t,s){t.slideUp(200,s)},showOnClick:!1,hideOnClick:!0,keepInViewport:!0,keepHighlighted:!0,markCurrentItem:!1,markCurrentTree:!0,rightToLeftSubMenus:!1,bottomToTopSubMenus:!1,overlapControlsInIE:!0}})(jQuery); | ||
+ | </script> | ||
+ | |||
+ | <script type="text/javascript"> | ||
+ | // Sticky Plugin v1.0.3 for jQuery | ||
+ | // ============= | ||
+ | // Author: Anthony Garand | ||
+ | // Improvements by German M. Bravo (Kronuz) and Ruud Kamphuis (ruudk) | ||
+ | // Improvements by Leonardo C. Daronco (daronco) | ||
+ | // Created: 02/14/2011 | ||
+ | // Date: 07/20/2015 | ||
+ | // Website: http://stickyjs.com/ | ||
+ | // Description: Makes an element on the page stick on the screen as you scroll | ||
+ | // It will only set the 'top' and 'position' of your element, you | ||
+ | // might need to adjust the width in some cases. | ||
+ | |||
+ | (function (factory) { | ||
+ | if (typeof define === 'function' && define.amd) { | ||
+ | // AMD. Register as an anonymous module. | ||
+ | define(['jquery'], factory); | ||
+ | } else if (typeof module === 'object' && module.exports) { | ||
+ | // Node/CommonJS | ||
+ | module.exports = factory(require('jquery')); | ||
+ | } else { | ||
+ | // Browser globals | ||
+ | factory(jQuery); | ||
+ | } | ||
+ | }(function ($) { | ||
+ | var slice = Array.prototype.slice; // save ref to original slice() | ||
+ | var splice = Array.prototype.splice; // save ref to original slice() | ||
+ | |||
+ | var defaults = { | ||
+ | topSpacing: 0, | ||
+ | bottomSpacing: 0, | ||
+ | className: 'is-sticky', | ||
+ | wrapperClassName: 'sticky-wrapper', | ||
+ | center: false, | ||
+ | getWidthFrom: '', | ||
+ | widthFromWrapper: true, // works only when .getWidthFrom is empty | ||
+ | responsiveWidth: false | ||
+ | }, | ||
+ | $window = $(window), | ||
+ | $document = $(document), | ||
+ | sticked = [], | ||
+ | windowHeight = $window.height(), | ||
+ | scroller = function() { | ||
+ | var scrollTop = $window.scrollTop(), | ||
+ | documentHeight = $document.height(), | ||
+ | dwh = documentHeight - windowHeight, | ||
+ | extra = (scrollTop > dwh) ? dwh - scrollTop : 0; | ||
+ | |||
+ | for (var i = 0, l = sticked.length; i < l; i++) { | ||
+ | var s = sticked[i], | ||
+ | elementTop = s.stickyWrapper.offset().top, | ||
+ | etse = elementTop - s.topSpacing - extra; | ||
+ | |||
+ | //update height in case of dynamic content | ||
+ | s.stickyWrapper.css('height', s.stickyElement.outerHeight()); | ||
+ | |||
+ | if (scrollTop <= etse) { | ||
+ | if (s.currentTop !== null) { | ||
+ | s.stickyElement | ||
+ | .css({ | ||
+ | 'width': '', | ||
+ | 'position': '', | ||
+ | 'top': '' | ||
+ | }); | ||
+ | s.stickyElement.parent().removeClass(s.className); | ||
+ | s.stickyElement.trigger('sticky-end', [s]); | ||
+ | s.currentTop = null; | ||
+ | } | ||
+ | } | ||
+ | else { | ||
+ | var newTop = documentHeight - s.stickyElement.outerHeight() | ||
+ | - s.topSpacing - s.bottomSpacing - scrollTop - extra; | ||
+ | if (newTop < 0) { | ||
+ | newTop = newTop + s.topSpacing; | ||
+ | } else { | ||
+ | newTop = s.topSpacing; | ||
+ | } | ||
+ | if (s.currentTop !== newTop) { | ||
+ | var newWidth; | ||
+ | if (s.getWidthFrom) { | ||
+ | newWidth = $(s.getWidthFrom).width() || null; | ||
+ | } else if (s.widthFromWrapper) { | ||
+ | newWidth = s.stickyWrapper.width(); | ||
+ | } | ||
+ | if (newWidth == null) { | ||
+ | newWidth = s.stickyElement.width(); | ||
+ | } | ||
+ | s.stickyElement | ||
+ | .css('width', newWidth) | ||
+ | .css('position', 'fixed') | ||
+ | .css('top', newTop); | ||
+ | |||
+ | s.stickyElement.parent().addClass(s.className); | ||
+ | |||
+ | if (s.currentTop === null) { | ||
+ | s.stickyElement.trigger('sticky-start', [s]); | ||
+ | } else { | ||
+ | // sticky is started but it have to be repositioned | ||
+ | s.stickyElement.trigger('sticky-update', [s]); | ||
+ | } | ||
+ | |||
+ | if (s.currentTop === s.topSpacing && s.currentTop > newTop || s.currentTop === null && newTop < s.topSpacing) { | ||
+ | // just reached bottom || just started to stick but bottom is already reached | ||
+ | s.stickyElement.trigger('sticky-bottom-reached', [s]); | ||
+ | } else if(s.currentTop !== null && newTop === s.topSpacing && s.currentTop < newTop) { | ||
+ | // sticky is started && sticked at topSpacing && overflowing from top just finished | ||
+ | s.stickyElement.trigger('sticky-bottom-unreached', [s]); | ||
+ | } | ||
+ | |||
+ | s.currentTop = newTop; | ||
+ | } | ||
+ | |||
+ | // Check if sticky has reached end of container and stop sticking | ||
+ | var stickyWrapperContainer = s.stickyWrapper.parent(); | ||
+ | var unstick = (s.stickyElement.offset().top + s.stickyElement.outerHeight() >= stickyWrapperContainer.offset().top + stickyWrapperContainer.outerHeight()) && (s.stickyElement.offset().top <= s.topSpacing); | ||
+ | |||
+ | if( unstick ) { | ||
+ | s.stickyElement | ||
+ | .css('position', 'absolute') | ||
+ | .css('top', '') | ||
+ | .css('bottom', 0); | ||
+ | } else { | ||
+ | s.stickyElement | ||
+ | .css('position', 'fixed') | ||
+ | .css('top', newTop) | ||
+ | .css('bottom', ''); | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | }, | ||
+ | resizer = function() { | ||
+ | windowHeight = $window.height(); | ||
+ | |||
+ | for (var i = 0, l = sticked.length; i < l; i++) { | ||
+ | var s = sticked[i]; | ||
+ | var newWidth = null; | ||
+ | if (s.getWidthFrom) { | ||
+ | if (s.responsiveWidth) { | ||
+ | newWidth = $(s.getWidthFrom).width(); | ||
+ | } | ||
+ | } else if(s.widthFromWrapper) { | ||
+ | newWidth = s.stickyWrapper.width(); | ||
+ | } | ||
+ | if (newWidth != null) { | ||
+ | s.stickyElement.css('width', newWidth); | ||
+ | } | ||
+ | } | ||
+ | }, | ||
+ | methods = { | ||
+ | init: function(options) { | ||
+ | var o = $.extend({}, defaults, options); | ||
+ | return this.each(function() { | ||
+ | var stickyElement = $(this); | ||
+ | |||
+ | var stickyId = stickyElement.attr('id'); | ||
+ | var stickyHeight = stickyElement.outerHeight(); | ||
+ | var wrapperId = stickyId ? stickyId + '-' + defaults.wrapperClassName : defaults.wrapperClassName; | ||
+ | var wrapper = $('<div></div>') | ||
+ | .attr('id', wrapperId) | ||
+ | .addClass(o.wrapperClassName); | ||
+ | |||
+ | stickyElement.wrapAll(wrapper); | ||
+ | |||
+ | var stickyWrapper = stickyElement.parent(); | ||
+ | |||
+ | if (o.center) { | ||
+ | stickyWrapper.css({width:stickyElement.outerWidth(),marginLeft:"auto",marginRight:"auto"}); | ||
+ | } | ||
+ | |||
+ | if (stickyElement.css("float") === "right") { | ||
+ | stickyElement.css({"float":"none"}).parent().css({"float":"right"}); | ||
+ | } | ||
+ | |||
+ | stickyWrapper.css('height', stickyHeight); | ||
+ | |||
+ | o.stickyElement = stickyElement; | ||
+ | o.stickyWrapper = stickyWrapper; | ||
+ | o.currentTop = null; | ||
+ | |||
+ | sticked.push(o); | ||
+ | }); | ||
+ | }, | ||
+ | update: scroller, | ||
+ | unstick: function(options) { | ||
+ | return this.each(function() { | ||
+ | var that = this; | ||
+ | var unstickyElement = $(that); | ||
+ | |||
+ | var removeIdx = -1; | ||
+ | var i = sticked.length; | ||
+ | while (i-- > 0) { | ||
+ | if (sticked[i].stickyElement.get(0) === that) { | ||
+ | splice.call(sticked,i,1); | ||
+ | removeIdx = i; | ||
+ | } | ||
+ | } | ||
+ | if(removeIdx !== -1) { | ||
+ | unstickyElement.unwrap(); | ||
+ | unstickyElement | ||
+ | .css({ | ||
+ | 'width': '', | ||
+ | 'position': '', | ||
+ | 'top': '', | ||
+ | 'float': '' | ||
+ | }) | ||
+ | ; | ||
+ | } | ||
+ | }); | ||
+ | } | ||
+ | }; | ||
+ | |||
+ | // should be more efficient than using $window.scroll(scroller) and $window.resize(resizer): | ||
+ | if (window.addEventListener) { | ||
+ | window.addEventListener('scroll', scroller, false); | ||
+ | window.addEventListener('resize', resizer, false); | ||
+ | } else if (window.attachEvent) { | ||
+ | window.attachEvent('onscroll', scroller); | ||
+ | window.attachEvent('onresize', resizer); | ||
+ | } | ||
+ | |||
+ | $.fn.sticky = function(method) { | ||
+ | if (methods[method]) { | ||
+ | return methods[method].apply(this, slice.call(arguments, 1)); | ||
+ | } else if (typeof method === 'object' || !method ) { | ||
+ | return methods.init.apply( this, arguments ); | ||
+ | } else { | ||
+ | $.error('Method ' + method + ' does not exist on jQuery.sticky'); | ||
+ | } | ||
+ | }; | ||
+ | |||
+ | $.fn.unstick = function(method) { | ||
+ | if (methods[method]) { | ||
+ | return methods[method].apply(this, slice.call(arguments, 1)); | ||
+ | } else if (typeof method === 'object' || !method ) { | ||
+ | return methods.unstick.apply( this, arguments ); | ||
+ | } else { | ||
+ | $.error('Method ' + method + ' does not exist on jQuery.sticky'); | ||
+ | } | ||
+ | }; | ||
+ | $(function() { | ||
+ | setTimeout(scroller, 0); | ||
+ | }); | ||
+ | })); | ||
+ | |||
+ | </script> | ||
+ | |||
+ | <script type="text/javascript"> | ||
+ | /*! jQuery Validation Plugin - v1.11.0 - 2/4/2013 | ||
+ | * https://github.com/jzaefferer/jquery-validation | ||
+ | * Copyright (c) 2013 Jörn Zaefferer; Licensed MIT */ | ||
+ | (function(e){e.extend(e.fn,{validate:function(t){if(!this.length){t&&t.debug&&window.console&&console.warn("Nothing selected, can't validate, returning nothing.");return}var n=e.data(this[0],"validator");return n?n:(this.attr("novalidate","novalidate"),n=new e.validator(t,this[0]),e.data(this[0],"validator",n),n.settings.onsubmit&&(this.validateDelegate(":submit","click",function(t){n.settings.submitHandler&&(n.submitButton=t.target),e(t.target).hasClass("cancel")&&(n.cancelSubmit=!0)}),this.submit(function(t){function r(){var r;return n.settings.submitHandler?(n.submitButton&&(r=e("<input type='hidden'/>").attr("name",n.submitButton.name).val(n.submitButton.value).appendTo(n.currentForm)),n.settings.submitHandler.call(n,n.currentForm,t),n.submitButton&&r.remove(),!1):!0}return n.settings.debug&&t.preventDefault(),n.cancelSubmit?(n.cancelSubmit=!1,r()):n.form()?n.pendingRequest?(n.formSubmitted=!0,!1):r():(n.focusInvalid(),!1)})),n)},valid:function(){if(e(this[0]).is("form"))return this.validate().form();var t=!0,n=e(this[0].form).validate();return this.each(function(){t&=n.element(this)}),t},removeAttrs:function(t){var n={},r=this;return e.each(t.split(/\s/),function(e,t){n[t]=r.attr(t),r.removeAttr(t)}),n},rules:function(t,n){var r=this[0];if(t){var i=e.data(r.form,"validator").settings,s=i.rules,o=e.validator.staticRules(r);switch(t){case"add":e.extend(o,e.validator.normalizeRule(n)),s[r.name]=o,n.messages&&(i.messages[r.name]=e.extend(i.messages[r.name],n.messages));break;case"remove":if(!n)return delete s[r.name],o;var u={};return e.each(n.split(/\s/),function(e,t){u[t]=o[t],delete o[t]}),u}}var a=e.validator.normalizeRules(e.extend({},e.validator.classRules(r),e.validator.attributeRules(r),e.validator.dataRules(r),e.validator.staticRules(r)),r);if(a.required){var f=a.required;delete a.required,a=e.extend({required:f},a)}return a}}),e.extend(e.expr[":"],{blank:function(t){return!e.trim(""+t.value)},filled:function(t){return!!e.trim(""+t.value)},unchecked:function(e){return!e.checked}}),e.validator=function(t,n){this.settings=e.extend(!0,{},e.validator.defaults,t),this.currentForm=n,this.init()},e.validator.format=function(t,n){return arguments.length===1?function(){var n=e.makeArray(arguments);return n.unshift(t),e.validator.format.apply(this,n)}:(arguments.length>2&&n.constructor!==Array&&(n=e.makeArray(arguments).slice(1)),n.constructor!==Array&&(n=[n]),e.each(n,function(e,n){t=t.replace(new RegExp("\\{"+e+"\\}","g"),function(){return n})}),t)},e.extend(e.validator,{defaults:{messages:{},groups:{},rules:{},errorClass:"error",validClass:"valid",errorElement:"label",focusInvalid:!0,errorContainer:e([]),errorLabelContainer:e([]),onsubmit:!0,ignore:":hidden",ignoreTitle:!1,onfocusin:function(e,t){this.lastActive=e,this.settings.focusCleanup&&!this.blockFocusCleanup&&(this.settings.unhighlight&&this.settings.unhighlight.call(this,e,this.settings.errorClass,this.settings.validClass),this.addWrapper(this.errorsFor(e)).hide())},onfocusout:function(e,t){!this.checkable(e)&&(e.name in this.submitted||!this.optional(e))&&this.element(e)},onkeyup:function(e,t){if(t.which===9&&this.elementValue(e)==="")return;(e.name in this.submitted||e===this.lastElement)&&this.element(e)},onclick:function(e,t){e.name in this.submitted?this.element(e):e.parentNode.name in this.submitted&&this.element(e.parentNode)},highlight:function(t,n,r){t.type==="radio"?this.findByName(t.name).addClass(n).removeClass(r):e(t).addClass(n).removeClass(r)},unhighlight:function(t,n,r){t.type==="radio"?this.findByName(t.name).removeClass(n).addClass(r):e(t).removeClass(n).addClass(r)}},setDefaults:function(t){e.extend(e.validator.defaults,t)},messages:{required:"This field is required.",remote:"Please fix this field.",email:"Please enter a valid email address.",url:"Please enter a valid URL.",date:"Please enter a valid date.",dateISO:"Please enter a valid date (ISO).",number:"Please enter a valid number.",digits:"Please enter only digits.",creditcard:"Please enter a valid credit card number.",equalTo:"Please enter the same value again.",maxlength:e.validator.format("Please enter no more than {0} characters."),minlength:e.validator.format("Please enter at least {0} characters."),rangelength:e.validator.format("Please enter a value between {0} and {1} characters long."),range:e.validator.format("Please enter a value between {0} and {1}."),max:e.validator.format("Please enter a value less than or equal to {0}."),min:e.validator.format("Please enter a value greater than or equal to {0}.")},autoCreateRanges:!1,prototype:{init:function(){function r(t){var n=e.data(this[0].form,"validator"),r="on"+t.type.replace(/^validate/,"");n.settings[r]&&n.settings[r].call(n,this[0],t)}this.labelContainer=e(this.settings.errorLabelContainer),this.errorContext=this.labelContainer.length&&this.labelContainer||e(this.currentForm),this.containers=e(this.settings.errorContainer).add(this.settings.errorLabelContainer),this.submitted={},this.valueCache={},this.pendingRequest=0,this.pending={},this.invalid={},this.reset();var t=this.groups={};e.each(this.settings.groups,function(n,r){typeof r=="string"&&(r=r.split(/\s/)),e.each(r,function(e,r){t[r]=n})});var n=this.settings.rules;e.each(n,function(t,r){n[t]=e.validator.normalizeRule(r)}),e(this.currentForm).validateDelegate(":text, [type='password'], [type='file'], select, textarea, [type='number'], [type='search'] ,[type='tel'], [type='url'], [type='email'], [type='datetime'], [type='date'], [type='month'], [type='week'], [type='time'], [type='datetime-local'], [type='range'], [type='color'] ","focusin focusout keyup",r).validateDelegate("[type='radio'], [type='checkbox'], select, option","click",r),this.settings.invalidHandler&&e(this.currentForm).bind("invalid-form.validate",this.settings.invalidHandler)},form:function(){return this.checkForm(),e.extend(this.submitted,this.errorMap),this.invalid=e.extend({},this.errorMap),this.valid()||e(this.currentForm).triggerHandler("invalid-form",[this]),this.showErrors(),this.valid()},checkForm:function(){this.prepareForm();for(var e=0,t=this.currentElements=this.elements();t[e];e++)this.check(t[e]);return this.valid()},element:function(t){t=this.validationTargetFor(this.clean(t)),this.lastElement=t,this.prepareElement(t),this.currentElements=e(t);var n=this.check(t)!==!1;return n?delete this.invalid[t.name]:this.invalid[t.name]=!0,this.numberOfInvalids()||(this.toHide=this.toHide.add(this.containers)),this.showErrors(),n},showErrors:function(t){if(t){e.extend(this.errorMap,t),this.errorList=[];for(var n in t)this.errorList.push({message:t[n],element:this.findByName(n)[0]});this.successList=e.grep(this.successList,function(e){return!(e.name in t)})}this.settings.showErrors?this.settings.showErrors.call(this,this.errorMap,this.errorList):this.defaultShowErrors()},resetForm:function(){e.fn.resetForm&&e(this.currentForm).resetForm(),this.submitted={},this.lastElement=null,this.prepareForm(),this.hideErrors(),this.elements().removeClass(this.settings.errorClass).removeData("previousValue")},numberOfInvalids:function(){return this.objectLength(this.invalid)},objectLength:function(e){var t=0;for(var n in e)t++;return t},hideErrors:function(){this.addWrapper(this.toHide).hide()},valid:function(){return this.size()===0},size:function(){return this.errorList.length},focusInvalid:function(){if(this.settings.focusInvalid)try{e(this.findLastActive()||this.errorList.length&&this.errorList[0].element||[]).filter(":visible").focus().trigger("focusin")}catch(t){}},findLastActive:function(){var t=this.lastActive;return t&&e.grep(this.errorList,function(e){return e.element.name===t.name}).length===1&&t},elements:function(){var t=this,n={};return e(this.currentForm).find("input, select, textarea").not(":submit, :reset, :image, [disabled]").not(this.settings.ignore).filter(function(){return!this.name&&t.settings.debug&&window.console&&console.error("%o has no name assigned",this),this.name in n||!t.objectLength(e(this).rules())?!1:(n[this.name]=!0,!0)})},clean:function(t){return e(t)[0]},errors:function(){var t=this.settings.errorClass.replace(" ",".");return e(this.settings.errorElement+"."+t,this.errorContext)},reset:function(){this.successList=[],this.errorList=[],this.errorMap={},this.toShow=e([]),this.toHide=e([]),this.currentElements=e([])},prepareForm:function(){this.reset(),this.toHide=this.errors().add(this.containers)},prepareElement:function(e){this.reset(),this.toHide=this.errorsFor(e)},elementValue:function(t){var n=e(t).attr("type"),r=e(t).val();return n==="radio"||n==="checkbox"?e("input[name='"+e(t).attr("name")+"']:checked").val():typeof r=="string"?r.replace(/\r/g,""):r},check:function(t){t=this.validationTargetFor(this.clean(t));var n=e(t).rules(),r=!1,i=this.elementValue(t),s;for(var o in n){var u={method:o,parameters:n[o]};try{s=e.validator.methods[o].call(this,i,t,u.parameters);if(s==="dependency-mismatch"){r=!0;continue}r=!1;if(s==="pending"){this.toHide=this.toHide.not(this.errorsFor(t));return}if(!s)return this.formatAndAdd(t,u),!1}catch(a){throw this.settings.debug&&window.console&&console.log("Exception occured when checking element "+t.id+", check the '"+u.method+"' method.",a),a}}if(r)return;return this.objectLength(n)&&this.successList.push(t),!0},customDataMessage:function(t,n){return e(t).data("msg-"+n.toLowerCase())||t.attributes&&e(t).attr("data-msg-"+n.toLowerCase())},customMessage:function(e,t){var n=this.settings.messages[e];return n&&(n.constructor===String?n:n[t])},findDefined:function(){for(var e=0;e<arguments.length;e++)if(arguments[e]!==undefined)return arguments[e];return undefined},defaultMessage:function(t,n){return this.findDefined(this.customMessage(t.name,n),this.customDataMessage(t,n),!this.settings.ignoreTitle&&t.title||undefined,e.validator.messages[n],"<strong>Warning: No message defined for "+t.name+"</strong>")},formatAndAdd:function(t,n){var r=this.defaultMessage(t,n.method),i=/\$?\{(\d+)\}/g;typeof r=="function"?r=r.call(this,n.parameters,t):i.test(r)&&(r=e.validator.format(r.replace(i,"{$1}"),n.parameters)),this.errorList.push({message:r,element:t}),this.errorMap[t.name]=r,this.submitted[t.name]=r},addWrapper:function(e){return this.settings.wrapper&&(e=e.add(e.parent(this.settings.wrapper))),e},defaultShowErrors:function(){var e,t;for(e=0;this.errorList[e];e++){var n=this.errorList[e];this.settings.highlight&&this.settings.highlight.call(this,n.element,this.settings.errorClass,this.settings.validClass),this.showLabel(n.element,n.message)}this.errorList.length&&(this.toShow=this.toShow.add(this.containers));if(this.settings.success)for(e=0;this.successList[e];e++)this.showLabel(this.successList[e]);if(this.settings.unhighlight)for(e=0,t=this.validElements();t[e];e++)this.settings.unhighlight.call(this,t[e],this.settings.errorClass,this.settings.validClass);this.toHide=this.toHide.not(this.toShow),this.hideErrors(),this.addWrapper(this.toShow).show()},validElements:function(){return this.currentElements.not(this.invalidElements())},invalidElements:function(){return e(this.errorList).map(function(){return this.element})},showLabel:function(t,n){var r=this.errorsFor(t);r.length?(r.removeClass(this.settings.validClass).addClass(this.settings.errorClass),r.html(n)):(r=e("<"+this.settings.errorElement+">").attr("for",this.idOrName(t)).addClass(this.settings.errorClass).html(n||""),this.settings.wrapper&&(r=r.hide().show().wrap("<"+this.settings.wrapper+"/>").parent()),this.labelContainer.append(r).length||(this.settings.errorPlacement?this.settings.errorPlacement(r,e(t)):r.insertAfter(t))),!n&&this.settings.success&&(r.text(""),typeof this.settings.success=="string"?r.addClass(this.settings.success):this.settings.success(r,t)),this.toShow=this.toShow.add(r)},errorsFor:function(t){var n=this.idOrName(t);return this.errors().filter(function(){return e(this).attr("for")===n})},idOrName:function(e){return this.groups[e.name]||(this.checkable(e)?e.name:e.id||e.name)},validationTargetFor:function(e){return this.checkable(e)&&(e=this.findByName(e.name).not(this.settings.ignore)[0]),e},checkable:function(e){return/radio|checkbox/i.test(e.type)},findByName:function(t){return e(this.currentForm).find("[name='"+t+"']")},getLength:function(t,n){switch(n.nodeName.toLowerCase()){case"select":return e("option:selected",n).length;case"input":if(this.checkable(n))return this.findByName(n.name).filter(":checked").length}return t.length},depend:function(e,t){return this.dependTypes[typeof e]?this.dependTypes[typeof e](e,t):!0},dependTypes:{"boolean":function(e,t){return e},string:function(t,n){return!!e(t,n.form).length},"function":function(e,t){return e(t)}},optional:function(t){var n=this.elementValue(t);return!e.validator.methods.required.call(this,n,t)&&"dependency-mismatch"},startRequest:function(e){this.pending[e.name]||(this.pendingRequest++,this.pending[e.name]=!0)},stopRequest:function(t,n){this.pendingRequest--,this.pendingRequest<0&&(this.pendingRequest=0),delete this.pending[t.name],n&&this.pendingRequest===0&&this.formSubmitted&&this.form()?(e(this.currentForm).submit(),this.formSubmitted=!1):!n&&this.pendingRequest===0&&this.formSubmitted&&(e(this.currentForm).triggerHandler("invalid-form",[this]),this.formSubmitted=!1)},previousValue:function(t){return e.data(t,"previousValue")||e.data(t,"previousValue",{old:null,valid:!0,message:this.defaultMessage(t,"remote")})}},classRuleSettings:{required:{required:!0},email:{email:!0},url:{url:!0},date:{date:!0},dateISO:{dateISO:!0},number:{number:!0},digits:{digits:!0},creditcard:{creditcard:!0}},addClassRules:function(t,n){t.constructor===String?this.classRuleSettings[t]=n:e.extend(this.classRuleSettings,t)},classRules:function(t){var n={},r=e(t).attr("class");return r&&e.each(r.split(" "),function(){this in e.validator.classRuleSettings&&e.extend(n,e.validator.classRuleSettings[this])}),n},attributeRules:function(t){var n={},r=e(t);for(var i in e.validator.methods){var s;i==="required"?(s=r.get(0).getAttribute(i),s===""&&(s=!0),s=!!s):s=r.attr(i),s?n[i]=s:r[0].getAttribute("type")===i&&(n[i]=!0)}return n.maxlength&&/-1|2147483647|524288/.test(n.maxlength)&&delete n.maxlength,n},dataRules:function(t){var n,r,i={},s=e(t);for(n in e.validator.methods)r=s.data("rule-"+n.toLowerCase()),r!==undefined&&(i[n]=r);return i},staticRules:function(t){var n={},r=e.data(t.form,"validator");return r.settings.rules&&(n=e.validator.normalizeRule(r.settings.rules[t.name])||{}),n},normalizeRules:function(t,n){return e.each(t,function(r,i){if(i===!1){delete t[r];return}if(i.param||i.depends){var s=!0;switch(typeof i.depends){case"string":s=!!e(i.depends,n.form).length;break;case"function":s=i.depends.call(n,n)}s?t[r]=i.param!==undefined?i.param:!0:delete t[r]}}),e.each(t,function(r,i){t[r]=e.isFunction(i)?i(n):i}),e.each(["minlength","maxlength"],function(){t[this]&&(t[this]=Number(t[this]))}),e.each(["rangelength"],function(){var n;t[this]&&(e.isArray(t[this])?t[this]=[Number(t[this][0]),Number(t[this][1])]:typeof t[this]=="string"&&(n=t[this].split(/[\s,]+/),t[this]=[Number(n[0]),Number(n[1])]))}),e.validator.autoCreateRanges&&(t.min&&t.max&&(t.range=[t.min,t.max],delete t.min,delete t.max),t.minlength&&t.maxlength&&(t.rangelength=[t.minlength,t.maxlength],delete t.minlength,delete t.maxlength)),t},normalizeRule:function(t){if(typeof t=="string"){var n={};e.each(t.split(/\s/),function(){n[this]=!0}),t=n}return t},addMethod:function(t,n,r){e.validator.methods[t]=n,e.validator.messages[t]=r!==undefined?r:e.validator.messages[t],n.length<3&&e.validator.addClassRules(t,e.validator.normalizeRule(t))},methods:{required:function(t,n,r){if(!this.depend(r,n))return"dependency-mismatch";if(n.nodeName.toLowerCase()==="select"){var i=e(n).val();return i&&i.length>0}return this.checkable(n)?this.getLength(t,n)>0:e.trim(t).length>0},remote:function(t,n,r){if(this.optional(n))return"dependency-mismatch";var i=this.previousValue(n);this.settings.messages[n.name]||(this.settings.messages[n.name]={}),i.originalMessage=this.settings.messages[n.name].remote,this.settings.messages[n.name].remote=i.message,r=typeof r=="string"&&{url:r}||r;if(i.old===t)return i.valid;i.old=t;var s=this;this.startRequest(n);var o={};return o[n.name]=t,e.ajax(e.extend(!0,{url:r,mode:"abort",port:"validate"+n.name,dataType:"json",data:o,success:function(r){s.settings.messages[n.name].remote=i.originalMessage;var o=r===!0||r==="true";if(o){var u=s.formSubmitted;s.prepareElement(n),s.formSubmitted=u,s.successList.push(n),delete s.invalid[n.name],s.showErrors()}else{var a={},f=r||s.defaultMessage(n,"remote");a[n.name]=i.message=e.isFunction(f)?f(t):f,s.invalid[n.name]=!0,s.showErrors(a)}i.valid=o,s.stopRequest(n,o)}},r)),"pending"},minlength:function(t,n,r){var i=e.isArray(t)?t.length:this.getLength(e.trim(t),n);return this.optional(n)||i>=r},maxlength:function(t,n,r){var i=e.isArray(t)?t.length:this.getLength(e.trim(t),n);return this.optional(n)||i<=r},rangelength:function(t,n,r){var i=e.isArray(t)?t.length:this.getLength(e.trim(t),n);return this.optional(n)||i>=r[0]&&i<=r[1]},min:function(e,t,n){return this.optional(t)||e>=n},max:function(e,t,n){return this.optional(t)||e<=n},range:function(e,t,n){return this.optional(t)||e>=n[0]&&e<=n[1]},email:function(e,t){return this.optional(t)||/^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))$/i.test(e)},url:function(e,t){return this.optional(t)||/^(https?|s?ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i.test(e)},date:function(e,t){return this.optional(t)||!/Invalid|NaN/.test((new Date(e)).toString())},dateISO:function(e,t){return this.optional(t)||/^\d{4}[\/\-]\d{1,2}[\/\-]\d{1,2}$/.test(e)},number:function(e,t){return this.optional(t)||/^-?(?:\d+|\d{1,3}(?:,\d{3})+)?(?:\.\d+)?$/.test(e)},digits:function(e,t){return this.optional(t)||/^\d+$/.test(e)},creditcard:function(e,t){if(this.optional(t))return"dependency-mismatch";if(/[^0-9 \-]+/.test(e))return!1;var n=0,r=0,i=!1;e=e.replace(/\D/g,"");for(var s=e.length-1;s>=0;s--){var o=e.charAt(s);r=parseInt(o,10),i&&(r*=2)>9&&(r-=9),n+=r,i=!i}return n%10===0},equalTo:function(t,n,r){var i=e(r);return this.settings.onfocusout&&i.unbind(".validate-equalTo").bind("blur.validate-equalTo",function(){e(n).valid()}),t===i.val()}}}),e.format=e.validator.format})(jQuery),function(e){var t={};if(e.ajaxPrefilter)e.ajaxPrefilter(function(e,n,r){var i=e.port;e.mode==="abort"&&(t[i]&&t[i].abort(),t[i]=r)});else{var n=e.ajax;e.ajax=function(r){var i=("mode"in r?r:e.ajaxSettings).mode,s=("port"in r?r:e.ajaxSettings).port;return i==="abort"?(t[s]&&t[s].abort(),t[s]=n.apply(this,arguments)):n.apply(this,arguments)}}}(jQuery),function(e){e.extend(e.fn,{validateDelegate:function(t,n,r){return this.bind(n,function(n){var i=e(n.target);if(i.is(t))return r.apply(i,arguments)})}})}(jQuery); | ||
+ | </script> | ||
+ | |||
+ | |||
+ | <script type="text/javascript"> | ||
+ | /*! | ||
+ | * jQuery JavaScript Library v1.10.2 | ||
+ | * http://jquery.com/ | ||
+ | * | ||
+ | * Includes Sizzle.js | ||
+ | * http://sizzlejs.com/ | ||
+ | * | ||
+ | * Copyright 2005, 2013 jQuery Foundation, Inc. and other contributors | ||
+ | * Released under the MIT license | ||
+ | * http://jquery.org/license | ||
+ | * | ||
+ | * Date: 2013-07-03T13:48Z | ||
+ | */ | ||
+ | (function( window, undefined ) { | ||
+ | |||
+ | // Can't do this because several apps including ASP.NET trace | ||
+ | // the stack via arguments.caller.callee and Firefox dies if | ||
+ | // you try to trace through "use strict" call chains. (#13335) | ||
+ | // Support: Firefox 18+ | ||
+ | //"use strict"; | ||
+ | var | ||
+ | // The deferred used on DOM ready | ||
+ | readyList, | ||
+ | |||
+ | // A central reference to the root jQuery(document) | ||
+ | rootjQuery, | ||
+ | |||
+ | // Support: IE<10 | ||
+ | // For `typeof xmlNode.method` instead of `xmlNode.method !== undefined` | ||
+ | core_strundefined = typeof undefined, | ||
+ | |||
+ | // Use the correct document accordingly with window argument (sandbox) | ||
+ | location = window.location, | ||
+ | document = window.document, | ||
+ | docElem = document.documentElement, | ||
+ | |||
+ | // Map over jQuery in case of overwrite | ||
+ | _jQuery = window.jQuery, | ||
+ | |||
+ | // Map over the $ in case of overwrite | ||
+ | _$ = window.$, | ||
+ | |||
+ | // [[Class]] -> type pairs | ||
+ | class2type = {}, | ||
+ | |||
+ | // List of deleted data cache ids, so we can reuse them | ||
+ | core_deletedIds = [], | ||
+ | |||
+ | core_version = "1.10.2", | ||
+ | |||
+ | // Save a reference to some core methods | ||
+ | core_concat = core_deletedIds.concat, | ||
+ | core_push = core_deletedIds.push, | ||
+ | core_slice = core_deletedIds.slice, | ||
+ | core_indexOf = core_deletedIds.indexOf, | ||
+ | core_toString = class2type.toString, | ||
+ | core_hasOwn = class2type.hasOwnProperty, | ||
+ | core_trim = core_version.trim, | ||
+ | |||
+ | // Define a local copy of jQuery | ||
+ | jQuery = function( selector, context ) { | ||
+ | // The jQuery object is actually just the init constructor 'enhanced' | ||
+ | return new jQuery.fn.init( selector, context, rootjQuery ); | ||
+ | }, | ||
+ | |||
+ | // Used for matching numbers | ||
+ | core_pnum = /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source, | ||
+ | |||
+ | // Used for splitting on whitespace | ||
+ | core_rnotwhite = /\S+/g, | ||
+ | |||
+ | // Make sure we trim BOM and NBSP (here's looking at you, Safari 5.0 and IE) | ||
+ | rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, | ||
+ | |||
+ | // A simple way to check for HTML strings | ||
+ | // Prioritize #id over <tag> to avoid XSS via location.hash (#9521) | ||
+ | // Strict HTML recognition (#11290: must start with <) | ||
+ | rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/, | ||
+ | |||
+ | // Match a standalone tag | ||
+ | rsingleTag = /^<(\w+)\s*\/?>(?:<\/\1>|)$/, | ||
+ | |||
+ | // JSON RegExp | ||
+ | rvalidchars = /^[\],:{}\s]*$/, | ||
+ | rvalidbraces = /(?:^|:|,)(?:\s*\[)+/g, | ||
+ | rvalidescape = /\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g, | ||
+ | rvalidtokens = /"[^"\\\r\n]*"|true|false|null|-?(?:\d+\.|)\d+(?:[eE][+-]?\d+|)/g, | ||
+ | |||
+ | // Matches dashed string for camelizing | ||
+ | rmsPrefix = /^-ms-/, | ||
+ | rdashAlpha = /-([\da-z])/gi, | ||
+ | |||
+ | // Used by jQuery.camelCase as callback to replace() | ||
+ | fcamelCase = function( all, letter ) { | ||
+ | return letter.toUpperCase(); | ||
+ | }, | ||
+ | |||
+ | // The ready event handler | ||
+ | completed = function( event ) { | ||
+ | |||
+ | // readyState === "complete" is good enough for us to call the dom ready in oldIE | ||
+ | if ( document.addEventListener || event.type === "load" || document.readyState === "complete" ) { | ||
+ | detach(); | ||
+ | jQuery.ready(); | ||
+ | } | ||
+ | }, | ||
+ | // Clean-up method for dom ready events | ||
+ | detach = function() { | ||
+ | if ( document.addEventListener ) { | ||
+ | document.removeEventListener( "DOMContentLoaded", completed, false ); | ||
+ | window.removeEventListener( "load", completed, false ); | ||
+ | |||
+ | } else { | ||
+ | document.detachEvent( "onreadystatechange", completed ); | ||
+ | window.detachEvent( "onload", completed ); | ||
+ | } | ||
+ | }; | ||
+ | |||
+ | jQuery.fn = jQuery.prototype = { | ||
+ | // The current version of jQuery being used | ||
+ | jquery: core_version, | ||
+ | |||
+ | constructor: jQuery, | ||
+ | init: function( selector, context, rootjQuery ) { | ||
+ | var match, elem; | ||
+ | |||
+ | // HANDLE: $(""), $(null), $(undefined), $(false) | ||
+ | if ( !selector ) { | ||
+ | return this; | ||
+ | } | ||
+ | |||
+ | // Handle HTML strings | ||
+ | if ( typeof selector === "string" ) { | ||
+ | if ( selector.charAt(0) === "<" && selector.charAt( selector.length - 1 ) === ">" && selector.length >= 3 ) { | ||
+ | // Assume that strings that start and end with <> are HTML and skip the regex check | ||
+ | match = [ null, selector, null ]; | ||
+ | |||
+ | } else { | ||
+ | match = rquickExpr.exec( selector ); | ||
+ | } | ||
+ | |||
+ | // Match html or make sure no context is specified for #id | ||
+ | if ( match && (match[1] || !context) ) { | ||
+ | |||
+ | // HANDLE: $(html) -> $(array) | ||
+ | if ( match[1] ) { | ||
+ | context = context instanceof jQuery ? context[0] : context; | ||
+ | |||
+ | // scripts is true for back-compat | ||
+ | jQuery.merge( this, jQuery.parseHTML( | ||
+ | match[1], | ||
+ | context && context.nodeType ? context.ownerDocument || context : document, | ||
+ | true | ||
+ | ) ); | ||
+ | |||
+ | // HANDLE: $(html, props) | ||
+ | if ( rsingleTag.test( match[1] ) && jQuery.isPlainObject( context ) ) { | ||
+ | for ( match in context ) { | ||
+ | // Properties of context are called as methods if possible | ||
+ | if ( jQuery.isFunction( this[ match ] ) ) { | ||
+ | this[ match ]( context[ match ] ); | ||
+ | |||
+ | // ...and otherwise set as attributes | ||
+ | } else { | ||
+ | this.attr( match, context[ match ] ); | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | |||
+ | return this; | ||
+ | |||
+ | // HANDLE: $(#id) | ||
+ | } else { | ||
+ | elem = document.getElementById( match[2] ); | ||
+ | |||
+ | // Check parentNode to catch when Blackberry 4.6 returns | ||
+ | // nodes that are no longer in the document #6963 | ||
+ | if ( elem && elem.parentNode ) { | ||
+ | // Handle the case where IE and Opera return items | ||
+ | // by name instead of ID | ||
+ | if ( elem.id !== match[2] ) { | ||
+ | return rootjQuery.find( selector ); | ||
+ | } | ||
+ | |||
+ | // Otherwise, we inject the element directly into the jQuery object | ||
+ | this.length = 1; | ||
+ | this[0] = elem; | ||
+ | } | ||
+ | |||
+ | this.context = document; | ||
+ | this.selector = selector; | ||
+ | return this; | ||
+ | } | ||
+ | |||
+ | // HANDLE: $(expr, $(...)) | ||
+ | } else if ( !context || context.jquery ) { | ||
+ | return ( context || rootjQuery ).find( selector ); | ||
+ | |||
+ | // HANDLE: $(expr, context) | ||
+ | // (which is just equivalent to: $(context).find(expr) | ||
+ | } else { | ||
+ | return this.constructor( context ).find( selector ); | ||
+ | } | ||
+ | |||
+ | // HANDLE: $(DOMElement) | ||
+ | } else if ( selector.nodeType ) { | ||
+ | this.context = this[0] = selector; | ||
+ | this.length = 1; | ||
+ | return this; | ||
+ | |||
+ | // HANDLE: $(function) | ||
+ | // Shortcut for document ready | ||
+ | } else if ( jQuery.isFunction( selector ) ) { | ||
+ | return rootjQuery.ready( selector ); | ||
+ | } | ||
+ | |||
+ | if ( selector.selector !== undefined ) { | ||
+ | this.selector = selector.selector; | ||
+ | this.context = selector.context; | ||
+ | } | ||
+ | |||
+ | return jQuery.makeArray( selector, this ); | ||
+ | }, | ||
+ | |||
+ | // Start with an empty selector | ||
+ | selector: "", | ||
+ | |||
+ | // The default length of a jQuery object is 0 | ||
+ | length: 0, | ||
+ | |||
+ | toArray: function() { | ||
+ | return core_slice.call( this ); | ||
+ | }, | ||
+ | |||
+ | // Get the Nth element in the matched element set OR | ||
+ | // Get the whole matched element set as a clean array | ||
+ | get: function( num ) { | ||
+ | return num == null ? | ||
+ | |||
+ | // Return a 'clean' array | ||
+ | this.toArray() : | ||
+ | |||
+ | // Return just the object | ||
+ | ( num < 0 ? this[ this.length + num ] : this[ num ] ); | ||
+ | }, | ||
+ | |||
+ | // Take an array of elements and push it onto the stack | ||
+ | // (returning the new matched element set) | ||
+ | pushStack: function( elems ) { | ||
+ | |||
+ | // Build a new jQuery matched element set | ||
+ | var ret = jQuery.merge( this.constructor(), elems ); | ||
+ | |||
+ | // Add the old object onto the stack (as a reference) | ||
+ | ret.prevObject = this; | ||
+ | ret.context = this.context; | ||
+ | |||
+ | // Return the newly-formed element set | ||
+ | return ret; | ||
+ | }, | ||
+ | |||
+ | // Execute a callback for every element in the matched set. | ||
+ | // (You can seed the arguments with an array of args, but this is | ||
+ | // only used internally.) | ||
+ | each: function( callback, args ) { | ||
+ | return jQuery.each( this, callback, args ); | ||
+ | }, | ||
+ | |||
+ | ready: function( fn ) { | ||
+ | // Add the callback | ||
+ | jQuery.ready.promise().done( fn ); | ||
+ | |||
+ | return this; | ||
+ | }, | ||
+ | |||
+ | slice: function() { | ||
+ | return this.pushStack( core_slice.apply( this, arguments ) ); | ||
+ | }, | ||
+ | |||
+ | first: function() { | ||
+ | return this.eq( 0 ); | ||
+ | }, | ||
+ | |||
+ | last: function() { | ||
+ | return this.eq( -1 ); | ||
+ | }, | ||
+ | |||
+ | eq: function( i ) { | ||
+ | var len = this.length, | ||
+ | j = +i + ( i < 0 ? len : 0 ); | ||
+ | return this.pushStack( j >= 0 && j < len ? [ this[j] ] : [] ); | ||
+ | }, | ||
+ | |||
+ | map: function( callback ) { | ||
+ | return this.pushStack( jQuery.map(this, function( elem, i ) { | ||
+ | return callback.call( elem, i, elem ); | ||
+ | })); | ||
+ | }, | ||
+ | |||
+ | end: function() { | ||
+ | return this.prevObject || this.constructor(null); | ||
+ | }, | ||
+ | |||
+ | // For internal use only. | ||
+ | // Behaves like an Array's method, not like a jQuery method. | ||
+ | push: core_push, | ||
+ | sort: [].sort, | ||
+ | splice: [].splice | ||
+ | }; | ||
+ | |||
+ | // Give the init function the jQuery prototype for later instantiation | ||
+ | jQuery.fn.init.prototype = jQuery.fn; | ||
+ | |||
+ | jQuery.extend = jQuery.fn.extend = function() { | ||
+ | var src, copyIsArray, copy, name, options, clone, | ||
+ | target = arguments[0] || {}, | ||
+ | i = 1, | ||
+ | length = arguments.length, | ||
+ | deep = false; | ||
+ | |||
+ | // Handle a deep copy situation | ||
+ | if ( typeof target === "boolean" ) { | ||
+ | deep = target; | ||
+ | target = arguments[1] || {}; | ||
+ | // skip the boolean and the target | ||
+ | i = 2; | ||
+ | } | ||
+ | |||
+ | // Handle case when target is a string or something (possible in deep copy) | ||
+ | if ( typeof target !== "object" && !jQuery.isFunction(target) ) { | ||
+ | target = {}; | ||
+ | } | ||
+ | |||
+ | // extend jQuery itself if only one argument is passed | ||
+ | if ( length === i ) { | ||
+ | target = this; | ||
+ | --i; | ||
+ | } | ||
+ | |||
+ | for ( ; i < length; i++ ) { | ||
+ | // Only deal with non-null/undefined values | ||
+ | if ( (options = arguments[ i ]) != null ) { | ||
+ | // Extend the base object | ||
+ | for ( name in options ) { | ||
+ | src = target[ name ]; | ||
+ | copy = options[ name ]; | ||
+ | |||
+ | // Prevent never-ending loop | ||
+ | if ( target === copy ) { | ||
+ | continue; | ||
+ | } | ||
+ | |||
+ | // Recurse if we're merging plain objects or arrays | ||
+ | if ( deep && copy && ( jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)) ) ) { | ||
+ | if ( copyIsArray ) { | ||
+ | copyIsArray = false; | ||
+ | clone = src && jQuery.isArray(src) ? src : []; | ||
+ | |||
+ | } else { | ||
+ | clone = src && jQuery.isPlainObject(src) ? src : {}; | ||
+ | } | ||
+ | |||
+ | // Never move original objects, clone them | ||
+ | target[ name ] = jQuery.extend( deep, clone, copy ); | ||
+ | |||
+ | // Don't bring in undefined values | ||
+ | } else if ( copy !== undefined ) { | ||
+ | target[ name ] = copy; | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | |||
+ | // Return the modified object | ||
+ | return target; | ||
+ | }; | ||
+ | |||
+ | jQuery.extend({ | ||
+ | // Unique for each copy of jQuery on the page | ||
+ | // Non-digits removed to match rinlinejQuery | ||
+ | expando: "jQuery" + ( core_version + Math.random() ).replace( /\D/g, "" ), | ||
+ | |||
+ | noConflict: function( deep ) { | ||
+ | if ( window.$ === jQuery ) { | ||
+ | window.$ = _$; | ||
+ | } | ||
+ | |||
+ | if ( deep && window.jQuery === jQuery ) { | ||
+ | window.jQuery = _jQuery; | ||
+ | } | ||
+ | |||
+ | return jQuery; | ||
+ | }, | ||
+ | |||
+ | // Is the DOM ready to be used? Set to true once it occurs. | ||
+ | isReady: false, | ||
+ | |||
+ | // A counter to track how many items to wait for before | ||
+ | // the ready event fires. See #6781 | ||
+ | readyWait: 1, | ||
+ | |||
+ | // Hold (or release) the ready event | ||
+ | holdReady: function( hold ) { | ||
+ | if ( hold ) { | ||
+ | jQuery.readyWait++; | ||
+ | } else { | ||
+ | jQuery.ready( true ); | ||
+ | } | ||
+ | }, | ||
+ | |||
+ | // Handle when the DOM is ready | ||
+ | ready: function( wait ) { | ||
+ | |||
+ | // Abort if there are pending holds or we're already ready | ||
+ | if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) { | ||
+ | return; | ||
+ | } | ||
+ | |||
+ | // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443). | ||
+ | if ( !document.body ) { | ||
+ | return setTimeout( jQuery.ready ); | ||
+ | } | ||
+ | |||
+ | // Remember that the DOM is ready | ||
+ | jQuery.isReady = true; | ||
+ | |||
+ | // If a normal DOM Ready event fired, decrement, and wait if need be | ||
+ | if ( wait !== true && --jQuery.readyWait > 0 ) { | ||
+ | return; | ||
+ | } | ||
+ | |||
+ | // If there are functions bound, to execute | ||
+ | readyList.resolveWith( document, [ jQuery ] ); | ||
+ | |||
+ | // Trigger any bound ready events | ||
+ | if ( jQuery.fn.trigger ) { | ||
+ | jQuery( document ).trigger("ready").off("ready"); | ||
+ | } | ||
+ | }, | ||
+ | |||
+ | // See test/unit/core.js for details concerning isFunction. | ||
+ | // Since version 1.3, DOM methods and functions like alert | ||
+ | // aren't supported. They return false on IE (#2968). | ||
+ | isFunction: function( obj ) { | ||
+ | return jQuery.type(obj) === "function"; | ||
+ | }, | ||
+ | |||
+ | isArray: Array.isArray || function( obj ) { | ||
+ | return jQuery.type(obj) === "array"; | ||
+ | }, | ||
+ | |||
+ | isWindow: function( obj ) { | ||
+ | /* jshint eqeqeq: false */ | ||
+ | return obj != null && obj == obj.window; | ||
+ | }, | ||
+ | |||
+ | isNumeric: function( obj ) { | ||
+ | return !isNaN( parseFloat(obj) ) && isFinite( obj ); | ||
+ | }, | ||
+ | |||
+ | type: function( obj ) { | ||
+ | if ( obj == null ) { | ||
+ | return String( obj ); | ||
+ | } | ||
+ | return typeof obj === "object" || typeof obj === "function" ? | ||
+ | class2type[ core_toString.call(obj) ] || "object" : | ||
+ | typeof obj; | ||
+ | }, | ||
+ | |||
+ | isPlainObject: function( obj ) { | ||
+ | var key; | ||
+ | |||
+ | // Must be an Object. | ||
+ | // Because of IE, we also have to check the presence of the constructor property. | ||
+ | // Make sure that DOM nodes and window objects don't pass through, as well | ||
+ | if ( !obj || jQuery.type(obj) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) { | ||
+ | return false; | ||
+ | } | ||
+ | |||
+ | try { | ||
+ | // Not own constructor property must be Object | ||
+ | if ( obj.constructor && | ||
+ | !core_hasOwn.call(obj, "constructor") && | ||
+ | !core_hasOwn.call(obj.constructor.prototype, "isPrototypeOf") ) { | ||
+ | return false; | ||
+ | } | ||
+ | } catch ( e ) { | ||
+ | // IE8,9 Will throw exceptions on certain host objects #9897 | ||
+ | return false; | ||
+ | } | ||
+ | |||
+ | // Support: IE<9 | ||
+ | // Handle iteration over inherited properties before own properties. | ||
+ | if ( jQuery.support.ownLast ) { | ||
+ | for ( key in obj ) { | ||
+ | return core_hasOwn.call( obj, key ); | ||
+ | } | ||
+ | } | ||
+ | |||
+ | // Own properties are enumerated firstly, so to speed up, | ||
+ | // if last one is own, then all properties are own. | ||
+ | for ( key in obj ) {} | ||
+ | |||
+ | return key === undefined || core_hasOwn.call( obj, key ); | ||
+ | }, | ||
+ | |||
+ | isEmptyObject: function( obj ) { | ||
+ | var name; | ||
+ | for ( name in obj ) { | ||
+ | return false; | ||
+ | } | ||
+ | return true; | ||
+ | }, | ||
+ | |||
+ | error: function( msg ) { | ||
+ | throw new Error( msg ); | ||
+ | }, | ||
+ | |||
+ | // data: string of html | ||
+ | // context (optional): If specified, the fragment will be created in this context, defaults to document | ||
+ | // keepScripts (optional): If true, will include scripts passed in the html string | ||
+ | parseHTML: function( data, context, keepScripts ) { | ||
+ | if ( !data || typeof data !== "string" ) { | ||
+ | return null; | ||
+ | } | ||
+ | if ( typeof context === "boolean" ) { | ||
+ | keepScripts = context; | ||
+ | context = false; | ||
+ | } | ||
+ | context = context || document; | ||
+ | |||
+ | var parsed = rsingleTag.exec( data ), | ||
+ | scripts = !keepScripts && []; | ||
+ | |||
+ | // Single tag | ||
+ | if ( parsed ) { | ||
+ | return [ context.createElement( parsed[1] ) ]; | ||
+ | } | ||
+ | |||
+ | parsed = jQuery.buildFragment( [ data ], context, scripts ); | ||
+ | if ( scripts ) { | ||
+ | jQuery( scripts ).remove(); | ||
+ | } | ||
+ | return jQuery.merge( [], parsed.childNodes ); | ||
+ | }, | ||
+ | |||
+ | parseJSON: function( data ) { | ||
+ | // Attempt to parse using the native JSON parser first | ||
+ | if ( window.JSON && window.JSON.parse ) { | ||
+ | return window.JSON.parse( data ); | ||
+ | } | ||
+ | |||
+ | if ( data === null ) { | ||
+ | return data; | ||
+ | } | ||
+ | |||
+ | if ( typeof data === "string" ) { | ||
+ | |||
+ | // Make sure leading/trailing whitespace is removed (IE can't handle it) | ||
+ | data = jQuery.trim( data ); | ||
+ | |||
+ | if ( data ) { | ||
+ | // Make sure the incoming data is actual JSON | ||
+ | // Logic borrowed from http://json.org/json2.js | ||
+ | if ( rvalidchars.test( data.replace( rvalidescape, "@" ) | ||
+ | .replace( rvalidtokens, "]" ) | ||
+ | .replace( rvalidbraces, "")) ) { | ||
+ | |||
+ | return ( new Function( "return " + data ) )(); | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | |||
+ | jQuery.error( "Invalid JSON: " + data ); | ||
+ | }, | ||
+ | |||
+ | // Cross-browser xml parsing | ||
+ | parseXML: function( data ) { | ||
+ | var xml, tmp; | ||
+ | if ( !data || typeof data !== "string" ) { | ||
+ | return null; | ||
+ | } | ||
+ | try { | ||
+ | if ( window.DOMParser ) { // Standard | ||
+ | tmp = new DOMParser(); | ||
+ | xml = tmp.parseFromString( data , "text/xml" ); | ||
+ | } else { // IE | ||
+ | xml = new ActiveXObject( "Microsoft.XMLDOM" ); | ||
+ | xml.async = "false"; | ||
+ | xml.loadXML( data ); | ||
+ | } | ||
+ | } catch( e ) { | ||
+ | xml = undefined; | ||
+ | } | ||
+ | if ( !xml || !xml.documentElement || xml.getElementsByTagName( "parsererror" ).length ) { | ||
+ | jQuery.error( "Invalid XML: " + data ); | ||
+ | } | ||
+ | return xml; | ||
+ | }, | ||
+ | |||
+ | noop: function() {}, | ||
+ | |||
+ | // Evaluates a script in a global context | ||
+ | // Workarounds based on findings by Jim Driscoll | ||
+ | // http://weblogs.java.net/blog/driscoll/archive/2009/09/08/eval-javascript-global-context | ||
+ | globalEval: function( data ) { | ||
+ | if ( data && jQuery.trim( data ) ) { | ||
+ | // We use execScript on Internet Explorer | ||
+ | // We use an anonymous function so that context is window | ||
+ | // rather than jQuery in Firefox | ||
+ | ( window.execScript || function( data ) { | ||
+ | window[ "eval" ].call( window, data ); | ||
+ | } )( data ); | ||
+ | } | ||
+ | }, | ||
+ | |||
+ | // Convert dashed to camelCase; used by the css and data modules | ||
+ | // Microsoft forgot to hump their vendor prefix (#9572) | ||
+ | camelCase: function( string ) { | ||
+ | return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase ); | ||
+ | }, | ||
+ | |||
+ | nodeName: function( elem, name ) { | ||
+ | return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase(); | ||
+ | }, | ||
+ | |||
+ | // args is for internal usage only | ||
+ | each: function( obj, callback, args ) { | ||
+ | var value, | ||
+ | i = 0, | ||
+ | length = obj.length, | ||
+ | isArray = isArraylike( obj ); | ||
+ | |||
+ | if ( args ) { | ||
+ | if ( isArray ) { | ||
+ | for ( ; i < length; i++ ) { | ||
+ | value = callback.apply( obj[ i ], args ); | ||
+ | |||
+ | if ( value === false ) { | ||
+ | break; | ||
+ | } | ||
+ | } | ||
+ | } else { | ||
+ | for ( i in obj ) { | ||
+ | value = callback.apply( obj[ i ], args ); | ||
+ | |||
+ | if ( value === false ) { | ||
+ | break; | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | |||
+ | // A special, fast, case for the most common use of each | ||
+ | } else { | ||
+ | if ( isArray ) { | ||
+ | for ( ; i < length; i++ ) { | ||
+ | value = callback.call( obj[ i ], i, obj[ i ] ); | ||
+ | |||
+ | if ( value === false ) { | ||
+ | break; | ||
+ | } | ||
+ | } | ||
+ | } else { | ||
+ | for ( i in obj ) { | ||
+ | value = callback.call( obj[ i ], i, obj[ i ] ); | ||
+ | |||
+ | if ( value === false ) { | ||
+ | break; | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | |||
+ | return obj; | ||
+ | }, | ||
+ | |||
+ | // Use native String.trim function wherever possible | ||
+ | trim: core_trim && !core_trim.call("\uFEFF\xA0") ? | ||
+ | function( text ) { | ||
+ | return text == null ? | ||
+ | "" : | ||
+ | core_trim.call( text ); | ||
+ | } : | ||
+ | |||
+ | // Otherwise use our own trimming functionality | ||
+ | function( text ) { | ||
+ | return text == null ? | ||
+ | "" : | ||
+ | ( text + "" ).replace( rtrim, "" ); | ||
+ | }, | ||
+ | |||
+ | // results is for internal usage only | ||
+ | makeArray: function( arr, results ) { | ||
+ | var ret = results || []; | ||
+ | |||
+ | if ( arr != null ) { | ||
+ | if ( isArraylike( Object(arr) ) ) { | ||
+ | jQuery.merge( ret, | ||
+ | typeof arr === "string" ? | ||
+ | [ arr ] : arr | ||
+ | ); | ||
+ | } else { | ||
+ | core_push.call( ret, arr ); | ||
+ | } | ||
+ | } | ||
+ | |||
+ | return ret; | ||
+ | }, | ||
+ | |||
+ | inArray: function( elem, arr, i ) { | ||
+ | var len; | ||
+ | |||
+ | if ( arr ) { | ||
+ | if ( core_indexOf ) { | ||
+ | return core_indexOf.call( arr, elem, i ); | ||
+ | } | ||
+ | |||
+ | len = arr.length; | ||
+ | i = i ? i < 0 ? Math.max( 0, len + i ) : i : 0; | ||
+ | |||
+ | for ( ; i < len; i++ ) { | ||
+ | // Skip accessing in sparse arrays | ||
+ | if ( i in arr && arr[ i ] === elem ) { | ||
+ | return i; | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | |||
+ | return -1; | ||
+ | }, | ||
+ | |||
+ | merge: function( first, second ) { | ||
+ | var l = second.length, | ||
+ | i = first.length, | ||
+ | j = 0; | ||
+ | |||
+ | if ( typeof l === "number" ) { | ||
+ | for ( ; j < l; j++ ) { | ||
+ | first[ i++ ] = second[ j ]; | ||
+ | } | ||
+ | } else { | ||
+ | while ( second[j] !== undefined ) { | ||
+ | first[ i++ ] = second[ j++ ]; | ||
+ | } | ||
+ | } | ||
+ | |||
+ | first.length = i; | ||
+ | |||
+ | return first; | ||
+ | }, | ||
+ | |||
+ | grep: function( elems, callback, inv ) { | ||
+ | var retVal, | ||
+ | ret = [], | ||
+ | i = 0, | ||
+ | length = elems.length; | ||
+ | inv = !!inv; | ||
+ | |||
+ | // Go through the array, only saving the items | ||
+ | // that pass the validator function | ||
+ | for ( ; i < length; i++ ) { | ||
+ | retVal = !!callback( elems[ i ], i ); | ||
+ | if ( inv !== retVal ) { | ||
+ | ret.push( elems[ i ] ); | ||
+ | } | ||
+ | } | ||
+ | |||
+ | return ret; | ||
+ | }, | ||
+ | |||
+ | // arg is for internal usage only | ||
+ | map: function( elems, callback, arg ) { | ||
+ | var value, | ||
+ | i = 0, | ||
+ | length = elems.length, | ||
+ | isArray = isArraylike( elems ), | ||
+ | ret = []; | ||
+ | |||
+ | // Go through the array, translating each of the items to their | ||
+ | if ( isArray ) { | ||
+ | for ( ; i < length; i++ ) { | ||
+ | value = callback( elems[ i ], i, arg ); | ||
+ | |||
+ | if ( value != null ) { | ||
+ | ret[ ret.length ] = value; | ||
+ | } | ||
+ | } | ||
+ | |||
+ | // Go through every key on the object, | ||
+ | } else { | ||
+ | for ( i in elems ) { | ||
+ | value = callback( elems[ i ], i, arg ); | ||
+ | |||
+ | if ( value != null ) { | ||
+ | ret[ ret.length ] = value; | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | |||
+ | // Flatten any nested arrays | ||
+ | return core_concat.apply( [], ret ); | ||
+ | }, | ||
+ | |||
+ | // A global GUID counter for objects | ||
+ | guid: 1, | ||
+ | |||
+ | // Bind a function to a context, optionally partially applying any | ||
+ | // arguments. | ||
+ | proxy: function( fn, context ) { | ||
+ | var args, proxy, tmp; | ||
+ | |||
+ | if ( typeof context === "string" ) { | ||
+ | tmp = fn[ context ]; | ||
+ | context = fn; | ||
+ | fn = tmp; | ||
+ | } | ||
+ | |||
+ | // Quick check to determine if target is callable, in the spec | ||
+ | // this throws a TypeError, but we will just return undefined. | ||
+ | if ( !jQuery.isFunction( fn ) ) { | ||
+ | return undefined; | ||
+ | } | ||
+ | |||
+ | // Simulated bind | ||
+ | args = core_slice.call( arguments, 2 ); | ||
+ | proxy = function() { | ||
+ | return fn.apply( context || this, args.concat( core_slice.call( arguments ) ) ); | ||
+ | }; | ||
+ | |||
+ | // Set the guid of unique handler to the same of original handler, so it can be removed | ||
+ | proxy.guid = fn.guid = fn.guid || jQuery.guid++; | ||
+ | |||
+ | return proxy; | ||
+ | }, | ||
+ | |||
+ | // Multifunctional method to get and set values of a collection | ||
+ | // The value/s can optionally be executed if it's a function | ||
+ | access: function( elems, fn, key, value, chainable, emptyGet, raw ) { | ||
+ | var i = 0, | ||
+ | length = elems.length, | ||
+ | bulk = key == null; | ||
+ | |||
+ | // Sets many values | ||
+ | if ( jQuery.type( key ) === "object" ) { | ||
+ | chainable = true; | ||
+ | for ( i in key ) { | ||
+ | jQuery.access( elems, fn, i, key[i], true, emptyGet, raw ); | ||
+ | } | ||
+ | |||
+ | // Sets one value | ||
+ | } else if ( value !== undefined ) { | ||
+ | chainable = true; | ||
+ | |||
+ | if ( !jQuery.isFunction( value ) ) { | ||
+ | raw = true; | ||
+ | } | ||
+ | |||
+ | if ( bulk ) { | ||
+ | // Bulk operations run against the entire set | ||
+ | if ( raw ) { | ||
+ | fn.call( elems, value ); | ||
+ | fn = null; | ||
+ | |||
+ | // ...except when executing function values | ||
+ | } else { | ||
+ | bulk = fn; | ||
+ | fn = function( elem, key, value ) { | ||
+ | return bulk.call( jQuery( elem ), value ); | ||
+ | }; | ||
+ | } | ||
+ | } | ||
+ | |||
+ | if ( fn ) { | ||
+ | for ( ; i < length; i++ ) { | ||
+ | fn( elems[i], key, raw ? value : value.call( elems[i], i, fn( elems[i], key ) ) ); | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | |||
+ | return chainable ? | ||
+ | elems : | ||
+ | |||
+ | // Gets | ||
+ | bulk ? | ||
+ | fn.call( elems ) : | ||
+ | length ? fn( elems[0], key ) : emptyGet; | ||
+ | }, | ||
+ | |||
+ | now: function() { | ||
+ | return ( new Date() ).getTime(); | ||
+ | }, | ||
+ | |||
+ | // A method for quickly swapping in/out CSS properties to get correct calculations. | ||
+ | // Note: this method belongs to the css module but it's needed here for the support module. | ||
+ | // If support gets modularized, this method should be moved back to the css module. | ||
+ | swap: function( elem, options, callback, args ) { | ||
+ | var ret, name, | ||
+ | old = {}; | ||
+ | |||
+ | // Remember the old values, and insert the new ones | ||
+ | for ( name in options ) { | ||
+ | old[ name ] = elem.style[ name ]; | ||
+ | elem.style[ name ] = options[ name ]; | ||
+ | } | ||
+ | |||
+ | ret = callback.apply( elem, args || [] ); | ||
+ | |||
+ | // Revert the old values | ||
+ | for ( name in options ) { | ||
+ | elem.style[ name ] = old[ name ]; | ||
+ | } | ||
+ | |||
+ | return ret; | ||
+ | } | ||
+ | }); | ||
+ | |||
+ | jQuery.ready.promise = function( obj ) { | ||
+ | if ( !readyList ) { | ||
+ | |||
+ | readyList = jQuery.Deferred(); | ||
+ | |||
+ | // Catch cases where $(document).ready() is called after the browser event has already occurred. | ||
+ | // we once tried to use readyState "interactive" here, but it caused issues like the one | ||
+ | // discovered by ChrisS here: http://bugs.jquery.com/ticket/12282#comment:15 | ||
+ | if ( document.readyState === "complete" ) { | ||
+ | // Handle it asynchronously to allow scripts the opportunity to delay ready | ||
+ | setTimeout( jQuery.ready ); | ||
+ | |||
+ | // Standards-based browsers support DOMContentLoaded | ||
+ | } else if ( document.addEventListener ) { | ||
+ | // Use the handy event callback | ||
+ | document.addEventListener( "DOMContentLoaded", completed, false ); | ||
+ | |||
+ | // A fallback to window.onload, that will always work | ||
+ | window.addEventListener( "load", completed, false ); | ||
+ | |||
+ | // If IE event model is used | ||
+ | } else { | ||
+ | // Ensure firing before onload, maybe late but safe also for iframes | ||
+ | document.attachEvent( "onreadystatechange", completed ); | ||
+ | |||
+ | // A fallback to window.onload, that will always work | ||
+ | window.attachEvent( "onload", completed ); | ||
+ | |||
+ | // If IE and not a frame | ||
+ | // continually check to see if the document is ready | ||
+ | var top = false; | ||
+ | |||
+ | try { | ||
+ | top = window.frameElement == null && document.documentElement; | ||
+ | } catch(e) {} | ||
+ | |||
+ | if ( top && top.doScroll ) { | ||
+ | (function doScrollCheck() { | ||
+ | if ( !jQuery.isReady ) { | ||
+ | |||
+ | try { | ||
+ | // Use the trick by Diego Perini | ||
+ | // http://javascript.nwbox.com/IEContentLoaded/ | ||
+ | top.doScroll("left"); | ||
+ | } catch(e) { | ||
+ | return setTimeout( doScrollCheck, 50 ); | ||
+ | } | ||
+ | |||
+ | // detach all dom ready events | ||
+ | detach(); | ||
+ | |||
+ | // and execute any waiting functions | ||
+ | jQuery.ready(); | ||
+ | } | ||
+ | })(); | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | return readyList.promise( obj ); | ||
+ | }; | ||
+ | |||
+ | // Populate the class2type map | ||
+ | jQuery.each("Boolean Number String Function Array Date RegExp Object Error".split(" "), function(i, name) { | ||
+ | class2type[ "[object " + name + "]" ] = name.toLowerCase(); | ||
+ | }); | ||
+ | |||
+ | function isArraylike( obj ) { | ||
+ | var length = obj.length, | ||
+ | type = jQuery.type( obj ); | ||
+ | |||
+ | if ( jQuery.isWindow( obj ) ) { | ||
+ | return false; | ||
+ | } | ||
+ | |||
+ | if ( obj.nodeType === 1 && length ) { | ||
+ | return true; | ||
+ | } | ||
+ | |||
+ | return type === "array" || type !== "function" && | ||
+ | ( length === 0 || | ||
+ | typeof length === "number" && length > 0 && ( length - 1 ) in obj ); | ||
+ | } | ||
+ | |||
+ | // All jQuery objects should point back to these | ||
+ | rootjQuery = jQuery(document); | ||
+ | /*! | ||
+ | * Sizzle CSS Selector Engine v1.10.2 | ||
+ | * http://sizzlejs.com/ | ||
+ | * | ||
+ | * Copyright 2013 jQuery Foundation, Inc. and other contributors | ||
+ | * Released under the MIT license | ||
+ | * http://jquery.org/license | ||
+ | * | ||
+ | * Date: 2013-07-03 | ||
+ | */ | ||
+ | (function( window, undefined ) { | ||
+ | |||
+ | var i, | ||
+ | support, | ||
+ | cachedruns, | ||
+ | Expr, | ||
+ | getText, | ||
+ | isXML, | ||
+ | compile, | ||
+ | outermostContext, | ||
+ | sortInput, | ||
+ | |||
+ | // Local document vars | ||
+ | setDocument, | ||
+ | document, | ||
+ | docElem, | ||
+ | documentIsHTML, | ||
+ | rbuggyQSA, | ||
+ | rbuggyMatches, | ||
+ | matches, | ||
+ | contains, | ||
+ | |||
+ | // Instance-specific data | ||
+ | expando = "sizzle" + -(new Date()), | ||
+ | preferredDoc = window.document, | ||
+ | dirruns = 0, | ||
+ | done = 0, | ||
+ | classCache = createCache(), | ||
+ | tokenCache = createCache(), | ||
+ | compilerCache = createCache(), | ||
+ | hasDuplicate = false, | ||
+ | sortOrder = function( a, b ) { | ||
+ | if ( a === b ) { | ||
+ | hasDuplicate = true; | ||
+ | return 0; | ||
+ | } | ||
+ | return 0; | ||
+ | }, | ||
+ | |||
+ | // General-purpose constants | ||
+ | strundefined = typeof undefined, | ||
+ | MAX_NEGATIVE = 1 << 31, | ||
+ | |||
+ | // Instance methods | ||
+ | hasOwn = ({}).hasOwnProperty, | ||
+ | arr = [], | ||
+ | pop = arr.pop, | ||
+ | push_native = arr.push, | ||
+ | push = arr.push, | ||
+ | slice = arr.slice, | ||
+ | // Use a stripped-down indexOf if we can't use a native one | ||
+ | indexOf = arr.indexOf || function( elem ) { | ||
+ | var i = 0, | ||
+ | len = this.length; | ||
+ | for ( ; i < len; i++ ) { | ||
+ | if ( this[i] === elem ) { | ||
+ | return i; | ||
+ | } | ||
+ | } | ||
+ | return -1; | ||
+ | }, | ||
+ | |||
+ | booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped", | ||
+ | |||
+ | // Regular expressions | ||
+ | |||
+ | // Whitespace characters http://www.w3.org/TR/css3-selectors/#whitespace | ||
+ | whitespace = "[\\x20\\t\\r\\n\\f]", | ||
+ | // http://www.w3.org/TR/css3-syntax/#characters | ||
+ | characterEncoding = "(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+", | ||
+ | |||
+ | // Loosely modeled on CSS identifier characters | ||
+ | // An unquoted value should be a CSS identifier http://www.w3.org/TR/css3-selectors/#attribute-selectors | ||
+ | // Proper syntax: http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier | ||
+ | identifier = characterEncoding.replace( "w", "w#" ), | ||
+ | |||
+ | // Acceptable operators http://www.w3.org/TR/selectors/#attribute-selectors | ||
+ | attributes = "\\[" + whitespace + "*(" + characterEncoding + ")" + whitespace + | ||
+ | "*(?:([*^$|!~]?=)" + whitespace + "*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|(" + identifier + ")|)|)" + whitespace + "*\\]", | ||
+ | |||
+ | // Prefer arguments quoted, | ||
+ | // then not containing pseudos/brackets, | ||
+ | // then attribute selectors/non-parenthetical expressions, | ||
+ | // then anything else | ||
+ | // These preferences are here to reduce the number of selectors | ||
+ | // needing tokenize in the PSEUDO preFilter | ||
+ | pseudos = ":(" + characterEncoding + ")(?:\\(((['\"])((?:\\\\.|[^\\\\])*?)\\3|((?:\\\\.|[^\\\\()[\\]]|" + attributes.replace( 3, 8 ) + ")*)|.*)\\)|)", | ||
+ | |||
+ | // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter | ||
+ | rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ), | ||
+ | |||
+ | rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ), | ||
+ | rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" ), | ||
+ | |||
+ | rsibling = new RegExp( whitespace + "*[+~]" ), | ||
+ | rattributeQuotes = new RegExp( "=" + whitespace + "*([^\\]'\"]*)" + whitespace + "*\\]", "g" ), | ||
+ | |||
+ | rpseudo = new RegExp( pseudos ), | ||
+ | ridentifier = new RegExp( "^" + identifier + "$" ), | ||
+ | |||
+ | matchExpr = { | ||
+ | "ID": new RegExp( "^#(" + characterEncoding + ")" ), | ||
+ | "CLASS": new RegExp( "^\\.(" + characterEncoding + ")" ), | ||
+ | "TAG": new RegExp( "^(" + characterEncoding.replace( "w", "w*" ) + ")" ), | ||
+ | "ATTR": new RegExp( "^" + attributes ), | ||
+ | "PSEUDO": new RegExp( "^" + pseudos ), | ||
+ | "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace + | ||
+ | "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace + | ||
+ | "*(\\d+)|))" + whitespace + "*\\)|)", "i" ), | ||
+ | "bool": new RegExp( "^(?:" + booleans + ")$", "i" ), | ||
+ | // For use in libraries implementing .is() | ||
+ | // We use this for POS matching in `select` | ||
+ | "needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + | ||
+ | whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" ) | ||
+ | }, | ||
+ | |||
+ | rnative = /^[^{]+\{\s*\[native \w/, | ||
+ | |||
+ | // Easily-parseable/retrievable ID or TAG or CLASS selectors | ||
+ | rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/, | ||
+ | |||
+ | rinputs = /^(?:input|select|textarea|button)$/i, | ||
+ | rheader = /^h\d$/i, | ||
+ | |||
+ | rescape = /'|\\/g, | ||
+ | |||
+ | // CSS escapes http://www.w3.org/TR/CSS21/syndata.html#escaped-characters | ||
+ | runescape = new RegExp( "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig" ), | ||
+ | funescape = function( _, escaped, escapedWhitespace ) { | ||
+ | var high = "0x" + escaped - 0x10000; | ||
+ | // NaN means non-codepoint | ||
+ | // Support: Firefox | ||
+ | // Workaround erroneous numeric interpretation of +"0x" | ||
+ | return high !== high || escapedWhitespace ? | ||
+ | escaped : | ||
+ | // BMP codepoint | ||
+ | high < 0 ? | ||
+ | String.fromCharCode( high + 0x10000 ) : | ||
+ | // Supplemental Plane codepoint (surrogate pair) | ||
+ | String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 ); | ||
+ | }; | ||
+ | |||
+ | // Optimize for push.apply( _, NodeList ) | ||
+ | try { | ||
+ | push.apply( | ||
+ | (arr = slice.call( preferredDoc.childNodes )), | ||
+ | preferredDoc.childNodes | ||
+ | ); | ||
+ | // Support: Android<4.0 | ||
+ | // Detect silently failing push.apply | ||
+ | arr[ preferredDoc.childNodes.length ].nodeType; | ||
+ | } catch ( e ) { | ||
+ | push = { apply: arr.length ? | ||
+ | |||
+ | // Leverage slice if possible | ||
+ | function( target, els ) { | ||
+ | push_native.apply( target, slice.call(els) ); | ||
+ | } : | ||
+ | |||
+ | // Support: IE<9 | ||
+ | // Otherwise append directly | ||
+ | function( target, els ) { | ||
+ | var j = target.length, | ||
+ | i = 0; | ||
+ | // Can't trust NodeList.length | ||
+ | while ( (target[j++] = els[i++]) ) {} | ||
+ | target.length = j - 1; | ||
+ | } | ||
+ | }; | ||
+ | } | ||
+ | |||
+ | function Sizzle( selector, context, results, seed ) { | ||
+ | var match, elem, m, nodeType, | ||
+ | // QSA vars | ||
+ | i, groups, old, nid, newContext, newSelector; | ||
+ | |||
+ | if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) { | ||
+ | setDocument( context ); | ||
+ | } | ||
+ | |||
+ | context = context || document; | ||
+ | results = results || []; | ||
+ | |||
+ | if ( !selector || typeof selector !== "string" ) { | ||
+ | return results; | ||
+ | } | ||
+ | |||
+ | if ( (nodeType = context.nodeType) !== 1 && nodeType !== 9 ) { | ||
+ | return []; | ||
+ | } | ||
+ | |||
+ | if ( documentIsHTML && !seed ) { | ||
+ | |||
+ | // Shortcuts | ||
+ | if ( (match = rquickExpr.exec( selector )) ) { | ||
+ | // Speed-up: Sizzle("#ID") | ||
+ | if ( (m = match[1]) ) { | ||
+ | if ( nodeType === 9 ) { | ||
+ | elem = context.getElementById( m ); | ||
+ | // Check parentNode to catch when Blackberry 4.6 returns | ||
+ | // nodes that are no longer in the document #6963 | ||
+ | if ( elem && elem.parentNode ) { | ||
+ | // Handle the case where IE, Opera, and Webkit return items | ||
+ | // by name instead of ID | ||
+ | if ( elem.id === m ) { | ||
+ | results.push( elem ); | ||
+ | return results; | ||
+ | } | ||
+ | } else { | ||
+ | return results; | ||
+ | } | ||
+ | } else { | ||
+ | // Context is not a document | ||
+ | if ( context.ownerDocument && (elem = context.ownerDocument.getElementById( m )) && | ||
+ | contains( context, elem ) && elem.id === m ) { | ||
+ | results.push( elem ); | ||
+ | return results; | ||
+ | } | ||
+ | } | ||
+ | |||
+ | // Speed-up: Sizzle("TAG") | ||
+ | } else if ( match[2] ) { | ||
+ | push.apply( results, context.getElementsByTagName( selector ) ); | ||
+ | return results; | ||
+ | |||
+ | // Speed-up: Sizzle(".CLASS") | ||
+ | } else if ( (m = match[3]) && support.getElementsByClassName && context.getElementsByClassName ) { | ||
+ | push.apply( results, context.getElementsByClassName( m ) ); | ||
+ | return results; | ||
+ | } | ||
+ | } | ||
+ | |||
+ | // QSA path | ||
+ | if ( support.qsa && (!rbuggyQSA || !rbuggyQSA.test( selector )) ) { | ||
+ | nid = old = expando; | ||
+ | newContext = context; | ||
+ | newSelector = nodeType === 9 && selector; | ||
+ | |||
+ | // qSA works strangely on Element-rooted queries | ||
+ | // We can work around this by specifying an extra ID on the root | ||
+ | // and working up from there (Thanks to Andrew Dupont for the technique) | ||
+ | // IE 8 doesn't work on object elements | ||
+ | if ( nodeType === 1 && context.nodeName.toLowerCase() !== "object" ) { | ||
+ | groups = tokenize( selector ); | ||
+ | |||
+ | if ( (old = context.getAttribute("id")) ) { | ||
+ | nid = old.replace( rescape, "\\$&" ); | ||
+ | } else { | ||
+ | context.setAttribute( "id", nid ); | ||
+ | } | ||
+ | nid = "[id='" + nid + "'] "; | ||
+ | |||
+ | i = groups.length; | ||
+ | while ( i-- ) { | ||
+ | groups[i] = nid + toSelector( groups[i] ); | ||
+ | } | ||
+ | newContext = rsibling.test( selector ) && context.parentNode || context; | ||
+ | newSelector = groups.join(","); | ||
+ | } | ||
+ | |||
+ | if ( newSelector ) { | ||
+ | try { | ||
+ | push.apply( results, | ||
+ | newContext.querySelectorAll( newSelector ) | ||
+ | ); | ||
+ | return results; | ||
+ | } catch(qsaError) { | ||
+ | } finally { | ||
+ | if ( !old ) { | ||
+ | context.removeAttribute("id"); | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | |||
+ | // All others | ||
+ | return select( selector.replace( rtrim, "$1" ), context, results, seed ); | ||
+ | } | ||
+ | |||
+ | /** | ||
+ | * Create key-value caches of limited size | ||
+ | * @returns {Function(string, Object)} Returns the Object data after storing it on itself with | ||
+ | * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength) | ||
+ | * deleting the oldest entry | ||
+ | */ | ||
+ | function createCache() { | ||
+ | var keys = []; | ||
+ | |||
+ | function cache( key, value ) { | ||
+ | // Use (key + " ") to avoid collision with native prototype properties (see Issue #157) | ||
+ | if ( keys.push( key += " " ) > Expr.cacheLength ) { | ||
+ | // Only keep the most recent entries | ||
+ | delete cache[ keys.shift() ]; | ||
+ | } | ||
+ | return (cache[ key ] = value); | ||
+ | } | ||
+ | return cache; | ||
+ | } | ||
+ | |||
+ | /** | ||
+ | * Mark a function for special use by Sizzle | ||
+ | * @param {Function} fn The function to mark | ||
+ | */ | ||
+ | function markFunction( fn ) { | ||
+ | fn[ expando ] = true; | ||
+ | return fn; | ||
+ | } | ||
+ | |||
+ | /** | ||
+ | * Support testing using an element | ||
+ | * @param {Function} fn Passed the created div and expects a boolean result | ||
+ | */ | ||
+ | function assert( fn ) { | ||
+ | var div = document.createElement("div"); | ||
+ | |||
+ | try { | ||
+ | return !!fn( div ); | ||
+ | } catch (e) { | ||
+ | return false; | ||
+ | } finally { | ||
+ | // Remove from its parent by default | ||
+ | if ( div.parentNode ) { | ||
+ | div.parentNode.removeChild( div ); | ||
+ | } | ||
+ | // release memory in IE | ||
+ | div = null; | ||
+ | } | ||
+ | } | ||
+ | |||
+ | /** | ||
+ | * Adds the same handler for all of the specified attrs | ||
+ | * @param {String} attrs Pipe-separated list of attributes | ||
+ | * @param {Function} handler The method that will be applied | ||
+ | */ | ||
+ | function addHandle( attrs, handler ) { | ||
+ | var arr = attrs.split("|"), | ||
+ | i = attrs.length; | ||
+ | |||
+ | while ( i-- ) { | ||
+ | Expr.attrHandle[ arr[i] ] = handler; | ||
+ | } | ||
+ | } | ||
+ | |||
+ | /** | ||
+ | * Checks document order of two siblings | ||
+ | * @param {Element} a | ||
+ | * @param {Element} b | ||
+ | * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b | ||
+ | */ | ||
+ | function siblingCheck( a, b ) { | ||
+ | var cur = b && a, | ||
+ | diff = cur && a.nodeType === 1 && b.nodeType === 1 && | ||
+ | ( ~b.sourceIndex || MAX_NEGATIVE ) - | ||
+ | ( ~a.sourceIndex || MAX_NEGATIVE ); | ||
+ | |||
+ | // Use IE sourceIndex if available on both nodes | ||
+ | if ( diff ) { | ||
+ | return diff; | ||
+ | } | ||
+ | |||
+ | // Check if b follows a | ||
+ | if ( cur ) { | ||
+ | while ( (cur = cur.nextSibling) ) { | ||
+ | if ( cur === b ) { | ||
+ | return -1; | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | |||
+ | return a ? 1 : -1; | ||
+ | } | ||
+ | |||
+ | /** | ||
+ | * Returns a function to use in pseudos for input types | ||
+ | * @param {String} type | ||
+ | */ | ||
+ | function createInputPseudo( type ) { | ||
+ | return function( elem ) { | ||
+ | var name = elem.nodeName.toLowerCase(); | ||
+ | return name === "input" && elem.type === type; | ||
+ | }; | ||
+ | } | ||
+ | |||
+ | /** | ||
+ | * Returns a function to use in pseudos for buttons | ||
+ | * @param {String} type | ||
+ | */ | ||
+ | function createButtonPseudo( type ) { | ||
+ | return function( elem ) { | ||
+ | var name = elem.nodeName.toLowerCase(); | ||
+ | return (name === "input" || name === "button") && elem.type === type; | ||
+ | }; | ||
+ | } | ||
+ | |||
+ | /** | ||
+ | * Returns a function to use in pseudos for positionals | ||
+ | * @param {Function} fn | ||
+ | */ | ||
+ | function createPositionalPseudo( fn ) { | ||
+ | return markFunction(function( argument ) { | ||
+ | argument = +argument; | ||
+ | return markFunction(function( seed, matches ) { | ||
+ | var j, | ||
+ | matchIndexes = fn( [], seed.length, argument ), | ||
+ | i = matchIndexes.length; | ||
+ | |||
+ | // Match elements found at the specified indexes | ||
+ | while ( i-- ) { | ||
+ | if ( seed[ (j = matchIndexes[i]) ] ) { | ||
+ | seed[j] = !(matches[j] = seed[j]); | ||
+ | } | ||
+ | } | ||
+ | }); | ||
+ | }); | ||
+ | } | ||
+ | |||
+ | /** | ||
+ | * Detect xml | ||
+ | * @param {Element|Object} elem An element or a document | ||
+ | */ | ||
+ | isXML = Sizzle.isXML = function( elem ) { | ||
+ | // documentElement is verified for cases where it doesn't yet exist | ||
+ | // (such as loading iframes in IE - #4833) | ||
+ | var documentElement = elem && (elem.ownerDocument || elem).documentElement; | ||
+ | return documentElement ? documentElement.nodeName !== "HTML" : false; | ||
+ | }; | ||
+ | |||
+ | // Expose support vars for convenience | ||
+ | support = Sizzle.support = {}; | ||
+ | |||
+ | /** | ||
+ | * Sets document-related variables once based on the current document | ||
+ | * @param {Element|Object} [doc] An element or document object to use to set the document | ||
+ | * @returns {Object} Returns the current document | ||
+ | */ | ||
+ | setDocument = Sizzle.setDocument = function( node ) { | ||
+ | var doc = node ? node.ownerDocument || node : preferredDoc, | ||
+ | parent = doc.defaultView; | ||
+ | |||
+ | // If no document and documentElement is available, return | ||
+ | if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) { | ||
+ | return document; | ||
+ | } | ||
+ | |||
+ | // Set our document | ||
+ | document = doc; | ||
+ | docElem = doc.documentElement; | ||
+ | |||
+ | // Support tests | ||
+ | documentIsHTML = !isXML( doc ); | ||
+ | |||
+ | // Support: IE>8 | ||
+ | // If iframe document is assigned to "document" variable and if iframe has been reloaded, | ||
+ | // IE will throw "permission denied" error when accessing "document" variable, see jQuery #13936 | ||
+ | // IE6-8 do not support the defaultView property so parent will be undefined | ||
+ | if ( parent && parent.attachEvent && parent !== parent.top ) { | ||
+ | parent.attachEvent( "onbeforeunload", function() { | ||
+ | setDocument(); | ||
+ | }); | ||
+ | } | ||
+ | |||
+ | /* Attributes | ||
+ | ---------------------------------------------------------------------- */ | ||
+ | |||
+ | // Support: IE<8 | ||
+ | // Verify that getAttribute really returns attributes and not properties (excepting IE8 booleans) | ||
+ | support.attributes = assert(function( div ) { | ||
+ | div.className = "i"; | ||
+ | return !div.getAttribute("className"); | ||
+ | }); | ||
+ | |||
+ | /* getElement(s)By* | ||
+ | ---------------------------------------------------------------------- */ | ||
+ | |||
+ | // Check if getElementsByTagName("*") returns only elements | ||
+ | support.getElementsByTagName = assert(function( div ) { | ||
+ | div.appendChild( doc.createComment("") ); | ||
+ | return !div.getElementsByTagName("*").length; | ||
+ | }); | ||
+ | |||
+ | // Check if getElementsByClassName can be trusted | ||
+ | support.getElementsByClassName = assert(function( div ) { | ||
+ | div.innerHTML = "<div class='a'></div><div class='a i'></div>"; | ||
+ | |||
+ | // Support: Safari<4 | ||
+ | // Catch class over-caching | ||
+ | div.firstChild.className = "i"; | ||
+ | // Support: Opera<10 | ||
+ | // Catch gEBCN failure to find non-leading classes | ||
+ | return div.getElementsByClassName("i").length === 2; | ||
+ | }); | ||
+ | |||
+ | // Support: IE<10 | ||
+ | // Check if getElementById returns elements by name | ||
+ | // The broken getElementById methods don't pick up programatically-set names, | ||
+ | // so use a roundabout getElementsByName test | ||
+ | support.getById = assert(function( div ) { | ||
+ | docElem.appendChild( div ).id = expando; | ||
+ | return !doc.getElementsByName || !doc.getElementsByName( expando ).length; | ||
+ | }); | ||
+ | |||
+ | // ID find and filter | ||
+ | if ( support.getById ) { | ||
+ | Expr.find["ID"] = function( id, context ) { | ||
+ | if ( typeof context.getElementById !== strundefined && documentIsHTML ) { | ||
+ | var m = context.getElementById( id ); | ||
+ | // Check parentNode to catch when Blackberry 4.6 returns | ||
+ | // nodes that are no longer in the document #6963 | ||
+ | return m && m.parentNode ? [m] : []; | ||
+ | } | ||
+ | }; | ||
+ | Expr.filter["ID"] = function( id ) { | ||
+ | var attrId = id.replace( runescape, funescape ); | ||
+ | return function( elem ) { | ||
+ | return elem.getAttribute("id") === attrId; | ||
+ | }; | ||
+ | }; | ||
+ | } else { | ||
+ | // Support: IE6/7 | ||
+ | // getElementById is not reliable as a find shortcut | ||
+ | delete Expr.find["ID"]; | ||
+ | |||
+ | Expr.filter["ID"] = function( id ) { | ||
+ | var attrId = id.replace( runescape, funescape ); | ||
+ | return function( elem ) { | ||
+ | var node = typeof elem.getAttributeNode !== strundefined && elem.getAttributeNode("id"); | ||
+ | return node && node.value === attrId; | ||
+ | }; | ||
+ | }; | ||
+ | } | ||
+ | |||
+ | // Tag | ||
+ | Expr.find["TAG"] = support.getElementsByTagName ? | ||
+ | function( tag, context ) { | ||
+ | if ( typeof context.getElementsByTagName !== strundefined ) { | ||
+ | return context.getElementsByTagName( tag ); | ||
+ | } | ||
+ | } : | ||
+ | function( tag, context ) { | ||
+ | var elem, | ||
+ | tmp = [], | ||
+ | i = 0, | ||
+ | results = context.getElementsByTagName( tag ); | ||
+ | |||
+ | // Filter out possible comments | ||
+ | if ( tag === "*" ) { | ||
+ | while ( (elem = results[i++]) ) { | ||
+ | if ( elem.nodeType === 1 ) { | ||
+ | tmp.push( elem ); | ||
+ | } | ||
+ | } | ||
+ | |||
+ | return tmp; | ||
+ | } | ||
+ | return results; | ||
+ | }; | ||
+ | |||
+ | // Class | ||
+ | Expr.find["CLASS"] = support.getElementsByClassName && function( className, context ) { | ||
+ | if ( typeof context.getElementsByClassName !== strundefined && documentIsHTML ) { | ||
+ | return context.getElementsByClassName( className ); | ||
+ | } | ||
+ | }; | ||
+ | |||
+ | /* QSA/matchesSelector | ||
+ | ---------------------------------------------------------------------- */ | ||
+ | |||
+ | // QSA and matchesSelector support | ||
+ | |||
+ | // matchesSelector(:active) reports false when true (IE9/Opera 11.5) | ||
+ | rbuggyMatches = []; | ||
+ | |||
+ | // qSa(:focus) reports false when true (Chrome 21) | ||
+ | // We allow this because of a bug in IE8/9 that throws an error | ||
+ | // whenever `document.activeElement` is accessed on an iframe | ||
+ | // So, we allow :focus to pass through QSA all the time to avoid the IE error | ||
+ | // See http://bugs.jquery.com/ticket/13378 | ||
+ | rbuggyQSA = []; | ||
+ | |||
+ | if ( (support.qsa = rnative.test( doc.querySelectorAll )) ) { | ||
+ | // Build QSA regex | ||
+ | // Regex strategy adopted from Diego Perini | ||
+ | assert(function( div ) { | ||
+ | // Select is set to empty string on purpose | ||
+ | // This is to test IE's treatment of not explicitly | ||
+ | // setting a boolean content attribute, | ||
+ | // since its presence should be enough | ||
+ | // http://bugs.jquery.com/ticket/12359 | ||
+ | div.innerHTML = "<select><option selected=''></option></select>"; | ||
+ | |||
+ | // Support: IE8 | ||
+ | // Boolean attributes and "value" are not treated correctly | ||
+ | if ( !div.querySelectorAll("[selected]").length ) { | ||
+ | rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" ); | ||
+ | } | ||
+ | |||
+ | // Webkit/Opera - :checked should return selected option elements | ||
+ | // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked | ||
+ | // IE8 throws error here and will not see later tests | ||
+ | if ( !div.querySelectorAll(":checked").length ) { | ||
+ | rbuggyQSA.push(":checked"); | ||
+ | } | ||
+ | }); | ||
+ | |||
+ | assert(function( div ) { | ||
+ | |||
+ | // Support: Opera 10-12/IE8 | ||
+ | // ^= $= *= and empty values | ||
+ | // Should not select anything | ||
+ | // Support: Windows 8 Native Apps | ||
+ | // The type attribute is restricted during .innerHTML assignment | ||
+ | var input = doc.createElement("input"); | ||
+ | input.setAttribute( "type", "hidden" ); | ||
+ | div.appendChild( input ).setAttribute( "t", "" ); | ||
+ | |||
+ | if ( div.querySelectorAll("[t^='']").length ) { | ||
+ | rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" ); | ||
+ | } | ||
+ | |||
+ | // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled) | ||
+ | // IE8 throws error here and will not see later tests | ||
+ | if ( !div.querySelectorAll(":enabled").length ) { | ||
+ | rbuggyQSA.push( ":enabled", ":disabled" ); | ||
+ | } | ||
+ | |||
+ | // Opera 10-11 does not throw on post-comma invalid pseudos | ||
+ | div.querySelectorAll("*,:x"); | ||
+ | rbuggyQSA.push(",.*:"); | ||
+ | }); | ||
+ | } | ||
+ | |||
+ | if ( (support.matchesSelector = rnative.test( (matches = docElem.webkitMatchesSelector || | ||
+ | docElem.mozMatchesSelector || | ||
+ | docElem.oMatchesSelector || | ||
+ | docElem.msMatchesSelector) )) ) { | ||
+ | |||
+ | assert(function( div ) { | ||
+ | // Check to see if it's possible to do matchesSelector | ||
+ | // on a disconnected node (IE 9) | ||
+ | support.disconnectedMatch = matches.call( div, "div" ); | ||
+ | |||
+ | // This should fail with an exception | ||
+ | // Gecko does not error, returns false instead | ||
+ | matches.call( div, "[s!='']:x" ); | ||
+ | rbuggyMatches.push( "!=", pseudos ); | ||
+ | }); | ||
+ | } | ||
+ | |||
+ | rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join("|") ); | ||
+ | rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join("|") ); | ||
+ | |||
+ | /* Contains | ||
+ | ---------------------------------------------------------------------- */ | ||
+ | |||
+ | // Element contains another | ||
+ | // Purposefully does not implement inclusive descendent | ||
+ | // As in, an element does not contain itself | ||
+ | contains = rnative.test( docElem.contains ) || docElem.compareDocumentPosition ? | ||
+ | function( a, b ) { | ||
+ | var adown = a.nodeType === 9 ? a.documentElement : a, | ||
+ | bup = b && b.parentNode; | ||
+ | return a === bup || !!( bup && bup.nodeType === 1 && ( | ||
+ | adown.contains ? | ||
+ | adown.contains( bup ) : | ||
+ | a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16 | ||
+ | )); | ||
+ | } : | ||
+ | function( a, b ) { | ||
+ | if ( b ) { | ||
+ | while ( (b = b.parentNode) ) { | ||
+ | if ( b === a ) { | ||
+ | return true; | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | return false; | ||
+ | }; | ||
+ | |||
+ | /* Sorting | ||
+ | ---------------------------------------------------------------------- */ | ||
+ | |||
+ | // Document order sorting | ||
+ | sortOrder = docElem.compareDocumentPosition ? | ||
+ | function( a, b ) { | ||
+ | |||
+ | // Flag for duplicate removal | ||
+ | if ( a === b ) { | ||
+ | hasDuplicate = true; | ||
+ | return 0; | ||
+ | } | ||
+ | |||
+ | var compare = b.compareDocumentPosition && a.compareDocumentPosition && a.compareDocumentPosition( b ); | ||
+ | |||
+ | if ( compare ) { | ||
+ | // Disconnected nodes | ||
+ | if ( compare & 1 || | ||
+ | (!support.sortDetached && b.compareDocumentPosition( a ) === compare) ) { | ||
+ | |||
+ | // Choose the first element that is related to our preferred document | ||
+ | if ( a === doc || contains(preferredDoc, a) ) { | ||
+ | return -1; | ||
+ | } | ||
+ | if ( b === doc || contains(preferredDoc, b) ) { | ||
+ | return 1; | ||
+ | } | ||
+ | |||
+ | // Maintain original order | ||
+ | return sortInput ? | ||
+ | ( indexOf.call( sortInput, a ) - indexOf.call( sortInput, b ) ) : | ||
+ | 0; | ||
+ | } | ||
+ | |||
+ | return compare & 4 ? -1 : 1; | ||
+ | } | ||
+ | |||
+ | // Not directly comparable, sort on existence of method | ||
+ | return a.compareDocumentPosition ? -1 : 1; | ||
+ | } : | ||
+ | function( a, b ) { | ||
+ | var cur, | ||
+ | i = 0, | ||
+ | aup = a.parentNode, | ||
+ | bup = b.parentNode, | ||
+ | ap = [ a ], | ||
+ | bp = [ b ]; | ||
+ | |||
+ | // Exit early if the nodes are identical | ||
+ | if ( a === b ) { | ||
+ | hasDuplicate = true; | ||
+ | return 0; | ||
+ | |||
+ | // Parentless nodes are either documents or disconnected | ||
+ | } else if ( !aup || !bup ) { | ||
+ | return a === doc ? -1 : | ||
+ | b === doc ? 1 : | ||
+ | aup ? -1 : | ||
+ | bup ? 1 : | ||
+ | sortInput ? | ||
+ | ( indexOf.call( sortInput, a ) - indexOf.call( sortInput, b ) ) : | ||
+ | 0; | ||
+ | |||
+ | // If the nodes are siblings, we can do a quick check | ||
+ | } else if ( aup === bup ) { | ||
+ | return siblingCheck( a, b ); | ||
+ | } | ||
+ | |||
+ | // Otherwise we need full lists of their ancestors for comparison | ||
+ | cur = a; | ||
+ | while ( (cur = cur.parentNode) ) { | ||
+ | ap.unshift( cur ); | ||
+ | } | ||
+ | cur = b; | ||
+ | while ( (cur = cur.parentNode) ) { | ||
+ | bp.unshift( cur ); | ||
+ | } | ||
+ | |||
+ | // Walk down the tree looking for a discrepancy | ||
+ | while ( ap[i] === bp[i] ) { | ||
+ | i++; | ||
+ | } | ||
+ | |||
+ | return i ? | ||
+ | // Do a sibling check if the nodes have a common ancestor | ||
+ | siblingCheck( ap[i], bp[i] ) : | ||
+ | |||
+ | // Otherwise nodes in our document sort first | ||
+ | ap[i] === preferredDoc ? -1 : | ||
+ | bp[i] === preferredDoc ? 1 : | ||
+ | 0; | ||
+ | }; | ||
+ | |||
+ | return doc; | ||
+ | }; | ||
+ | |||
+ | Sizzle.matches = function( expr, elements ) { | ||
+ | return Sizzle( expr, null, null, elements ); | ||
+ | }; | ||
+ | |||
+ | Sizzle.matchesSelector = function( elem, expr ) { | ||
+ | // Set document vars if needed | ||
+ | if ( ( elem.ownerDocument || elem ) !== document ) { | ||
+ | setDocument( elem ); | ||
+ | } | ||
+ | |||
+ | // Make sure that attribute selectors are quoted | ||
+ | expr = expr.replace( rattributeQuotes, "='$1']" ); | ||
+ | |||
+ | if ( support.matchesSelector && documentIsHTML && | ||
+ | ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) && | ||
+ | ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) { | ||
+ | |||
+ | try { | ||
+ | var ret = matches.call( elem, expr ); | ||
+ | |||
+ | // IE 9's matchesSelector returns false on disconnected nodes | ||
+ | if ( ret || support.disconnectedMatch || | ||
+ | // As well, disconnected nodes are said to be in a document | ||
+ | // fragment in IE 9 | ||
+ | elem.document && elem.document.nodeType !== 11 ) { | ||
+ | return ret; | ||
+ | } | ||
+ | } catch(e) {} | ||
+ | } | ||
+ | |||
+ | return Sizzle( expr, document, null, [elem] ).length > 0; | ||
+ | }; | ||
+ | |||
+ | Sizzle.contains = function( context, elem ) { | ||
+ | // Set document vars if needed | ||
+ | if ( ( context.ownerDocument || context ) !== document ) { | ||
+ | setDocument( context ); | ||
+ | } | ||
+ | return contains( context, elem ); | ||
+ | }; | ||
+ | |||
+ | Sizzle.attr = function( elem, name ) { | ||
+ | // Set document vars if needed | ||
+ | if ( ( elem.ownerDocument || elem ) !== document ) { | ||
+ | setDocument( elem ); | ||
+ | } | ||
+ | |||
+ | var fn = Expr.attrHandle[ name.toLowerCase() ], | ||
+ | // Don't get fooled by Object.prototype properties (jQuery #13807) | ||
+ | val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ? | ||
+ | fn( elem, name, !documentIsHTML ) : | ||
+ | undefined; | ||
+ | |||
+ | return val === undefined ? | ||
+ | support.attributes || !documentIsHTML ? | ||
+ | elem.getAttribute( name ) : | ||
+ | (val = elem.getAttributeNode(name)) && val.specified ? | ||
+ | val.value : | ||
+ | null : | ||
+ | val; | ||
+ | }; | ||
+ | |||
+ | Sizzle.error = function( msg ) { | ||
+ | throw new Error( "Syntax error, unrecognized expression: " + msg ); | ||
+ | }; | ||
+ | |||
+ | /** | ||
+ | * Document sorting and removing duplicates | ||
+ | * @param {ArrayLike} results | ||
+ | */ | ||
+ | Sizzle.uniqueSort = function( results ) { | ||
+ | var elem, | ||
+ | duplicates = [], | ||
+ | j = 0, | ||
+ | i = 0; | ||
+ | |||
+ | // Unless we *know* we can detect duplicates, assume their presence | ||
+ | hasDuplicate = !support.detectDuplicates; | ||
+ | sortInput = !support.sortStable && results.slice( 0 ); | ||
+ | results.sort( sortOrder ); | ||
+ | |||
+ | if ( hasDuplicate ) { | ||
+ | while ( (elem = results[i++]) ) { | ||
+ | if ( elem === results[ i ] ) { | ||
+ | j = duplicates.push( i ); | ||
+ | } | ||
+ | } | ||
+ | while ( j-- ) { | ||
+ | results.splice( duplicates[ j ], 1 ); | ||
+ | } | ||
+ | } | ||
+ | |||
+ | return results; | ||
+ | }; | ||
+ | |||
+ | /** | ||
+ | * Utility function for retrieving the text value of an array of DOM nodes | ||
+ | * @param {Array|Element} elem | ||
+ | */ | ||
+ | getText = Sizzle.getText = function( elem ) { | ||
+ | var node, | ||
+ | ret = "", | ||
+ | i = 0, | ||
+ | nodeType = elem.nodeType; | ||
+ | |||
+ | if ( !nodeType ) { | ||
+ | // If no nodeType, this is expected to be an array | ||
+ | for ( ; (node = elem[i]); i++ ) { | ||
+ | // Do not traverse comment nodes | ||
+ | ret += getText( node ); | ||
+ | } | ||
+ | } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) { | ||
+ | // Use textContent for elements | ||
+ | // innerText usage removed for consistency of new lines (see #11153) | ||
+ | if ( typeof elem.textContent === "string" ) { | ||
+ | return elem.textContent; | ||
+ | } else { | ||
+ | // Traverse its children | ||
+ | for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { | ||
+ | ret += getText( elem ); | ||
+ | } | ||
+ | } | ||
+ | } else if ( nodeType === 3 || nodeType === 4 ) { | ||
+ | return elem.nodeValue; | ||
+ | } | ||
+ | // Do not include comment or processing instruction nodes | ||
+ | |||
+ | return ret; | ||
+ | }; | ||
+ | |||
+ | Expr = Sizzle.selectors = { | ||
+ | |||
+ | // Can be adjusted by the user | ||
+ | cacheLength: 50, | ||
+ | |||
+ | createPseudo: markFunction, | ||
+ | |||
+ | match: matchExpr, | ||
+ | |||
+ | attrHandle: {}, | ||
+ | |||
+ | find: {}, | ||
+ | |||
+ | relative: { | ||
+ | ">": { dir: "parentNode", first: true }, | ||
+ | " ": { dir: "parentNode" }, | ||
+ | "+": { dir: "previousSibling", first: true }, | ||
+ | "~": { dir: "previousSibling" } | ||
+ | }, | ||
+ | |||
+ | preFilter: { | ||
+ | "ATTR": function( match ) { | ||
+ | match[1] = match[1].replace( runescape, funescape ); | ||
+ | |||
+ | // Move the given value to match[3] whether quoted or unquoted | ||
+ | match[3] = ( match[4] || match[5] || "" ).replace( runescape, funescape ); | ||
+ | |||
+ | if ( match[2] === "~=" ) { | ||
+ | match[3] = " " + match[3] + " "; | ||
+ | } | ||
+ | |||
+ | return match.slice( 0, 4 ); | ||
+ | }, | ||
+ | |||
+ | "CHILD": function( match ) { | ||
+ | /* matches from matchExpr["CHILD"] | ||
+ | 1 type (only|nth|...) | ||
+ | 2 what (child|of-type) | ||
+ | 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...) | ||
+ | 4 xn-component of xn+y argument ([+-]?\d*n|) | ||
+ | 5 sign of xn-component | ||
+ | 6 x of xn-component | ||
+ | 7 sign of y-component | ||
+ | 8 y of y-component | ||
+ | */ | ||
+ | match[1] = match[1].toLowerCase(); | ||
+ | |||
+ | if ( match[1].slice( 0, 3 ) === "nth" ) { | ||
+ | // nth-* requires argument | ||
+ | if ( !match[3] ) { | ||
+ | Sizzle.error( match[0] ); | ||
+ | } | ||
+ | |||
+ | // numeric x and y parameters for Expr.filter.CHILD | ||
+ | // remember that false/true cast respectively to 0/1 | ||
+ | match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) ); | ||
+ | match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" ); | ||
+ | |||
+ | // other types prohibit arguments | ||
+ | } else if ( match[3] ) { | ||
+ | Sizzle.error( match[0] ); | ||
+ | } | ||
+ | |||
+ | return match; | ||
+ | }, | ||
+ | |||
+ | "PSEUDO": function( match ) { | ||
+ | var excess, | ||
+ | unquoted = !match[5] && match[2]; | ||
+ | |||
+ | if ( matchExpr["CHILD"].test( match[0] ) ) { | ||
+ | return null; | ||
+ | } | ||
+ | |||
+ | // Accept quoted arguments as-is | ||
+ | if ( match[3] && match[4] !== undefined ) { | ||
+ | match[2] = match[4]; | ||
+ | |||
+ | // Strip excess characters from unquoted arguments | ||
+ | } else if ( unquoted && rpseudo.test( unquoted ) && | ||
+ | // Get excess from tokenize (recursively) | ||
+ | (excess = tokenize( unquoted, true )) && | ||
+ | // advance to the next closing parenthesis | ||
+ | (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) { | ||
+ | |||
+ | // excess is a negative index | ||
+ | match[0] = match[0].slice( 0, excess ); | ||
+ | match[2] = unquoted.slice( 0, excess ); | ||
+ | } | ||
+ | |||
+ | // Return only captures needed by the pseudo filter method (type and argument) | ||
+ | return match.slice( 0, 3 ); | ||
+ | } | ||
+ | }, | ||
+ | |||
+ | filter: { | ||
+ | |||
+ | "TAG": function( nodeNameSelector ) { | ||
+ | var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase(); | ||
+ | return nodeNameSelector === "*" ? | ||
+ | function() { return true; } : | ||
+ | function( elem ) { | ||
+ | return elem.nodeName && elem.nodeName.toLowerCase() === nodeName; | ||
+ | }; | ||
+ | }, | ||
+ | |||
+ | "CLASS": function( className ) { | ||
+ | var pattern = classCache[ className + " " ]; | ||
+ | |||
+ | return pattern || | ||
+ | (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) && | ||
+ | classCache( className, function( elem ) { | ||
+ | return pattern.test( typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== strundefined && elem.getAttribute("class") || "" ); | ||
+ | }); | ||
+ | }, | ||
+ | |||
+ | "ATTR": function( name, operator, check ) { | ||
+ | return function( elem ) { | ||
+ | var result = Sizzle.attr( elem, name ); | ||
+ | |||
+ | if ( result == null ) { | ||
+ | return operator === "!="; | ||
+ | } | ||
+ | if ( !operator ) { | ||
+ | return true; | ||
+ | } | ||
+ | |||
+ | result += ""; | ||
+ | |||
+ | return operator === "=" ? result === check : | ||
+ | operator === "!=" ? result !== check : | ||
+ | operator === "^=" ? check && result.indexOf( check ) === 0 : | ||
+ | operator === "*=" ? check && result.indexOf( check ) > -1 : | ||
+ | operator === "$=" ? check && result.slice( -check.length ) === check : | ||
+ | operator === "~=" ? ( " " + result + " " ).indexOf( check ) > -1 : | ||
+ | operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" : | ||
+ | false; | ||
+ | }; | ||
+ | }, | ||
+ | |||
+ | "CHILD": function( type, what, argument, first, last ) { | ||
+ | var simple = type.slice( 0, 3 ) !== "nth", | ||
+ | forward = type.slice( -4 ) !== "last", | ||
+ | ofType = what === "of-type"; | ||
+ | |||
+ | return first === 1 && last === 0 ? | ||
+ | |||
+ | // Shortcut for :nth-*(n) | ||
+ | function( elem ) { | ||
+ | return !!elem.parentNode; | ||
+ | } : | ||
+ | |||
+ | function( elem, context, xml ) { | ||
+ | var cache, outerCache, node, diff, nodeIndex, start, | ||
+ | dir = simple !== forward ? "nextSibling" : "previousSibling", | ||
+ | parent = elem.parentNode, | ||
+ | name = ofType && elem.nodeName.toLowerCase(), | ||
+ | useCache = !xml && !ofType; | ||
+ | |||
+ | if ( parent ) { | ||
+ | |||
+ | // :(first|last|only)-(child|of-type) | ||
+ | if ( simple ) { | ||
+ | while ( dir ) { | ||
+ | node = elem; | ||
+ | while ( (node = node[ dir ]) ) { | ||
+ | if ( ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1 ) { | ||
+ | return false; | ||
+ | } | ||
+ | } | ||
+ | // Reverse direction for :only-* (if we haven't yet done so) | ||
+ | start = dir = type === "only" && !start && "nextSibling"; | ||
+ | } | ||
+ | return true; | ||
+ | } | ||
+ | |||
+ | start = [ forward ? parent.firstChild : parent.lastChild ]; | ||
+ | |||
+ | // non-xml :nth-child(...) stores cache data on `parent` | ||
+ | if ( forward && useCache ) { | ||
+ | // Seek `elem` from a previously-cached index | ||
+ | outerCache = parent[ expando ] || (parent[ expando ] = {}); | ||
+ | cache = outerCache[ type ] || []; | ||
+ | nodeIndex = cache[0] === dirruns && cache[1]; | ||
+ | diff = cache[0] === dirruns && cache[2]; | ||
+ | node = nodeIndex && parent.childNodes[ nodeIndex ]; | ||
+ | |||
+ | while ( (node = ++nodeIndex && node && node[ dir ] || | ||
+ | |||
+ | // Fallback to seeking `elem` from the start | ||
+ | (diff = nodeIndex = 0) || start.pop()) ) { | ||
+ | |||
+ | // When found, cache indexes on `parent` and break | ||
+ | if ( node.nodeType === 1 && ++diff && node === elem ) { | ||
+ | outerCache[ type ] = [ dirruns, nodeIndex, diff ]; | ||
+ | break; | ||
+ | } | ||
+ | } | ||
+ | |||
+ | // Use previously-cached element index if available | ||
+ | } else if ( useCache && (cache = (elem[ expando ] || (elem[ expando ] = {}))[ type ]) && cache[0] === dirruns ) { | ||
+ | diff = cache[1]; | ||
+ | |||
+ | // xml :nth-child(...) or :nth-last-child(...) or :nth(-last)?-of-type(...) | ||
+ | } else { | ||
+ | // Use the same loop as above to seek `elem` from the start | ||
+ | while ( (node = ++nodeIndex && node && node[ dir ] || | ||
+ | (diff = nodeIndex = 0) || start.pop()) ) { | ||
+ | |||
+ | if ( ( ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1 ) && ++diff ) { | ||
+ | // Cache the index of each encountered element | ||
+ | if ( useCache ) { | ||
+ | (node[ expando ] || (node[ expando ] = {}))[ type ] = [ dirruns, diff ]; | ||
+ | } | ||
+ | |||
+ | if ( node === elem ) { | ||
+ | break; | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | |||
+ | // Incorporate the offset, then check against cycle size | ||
+ | diff -= last; | ||
+ | return diff === first || ( diff % first === 0 && diff / first >= 0 ); | ||
+ | } | ||
+ | }; | ||
+ | }, | ||
+ | |||
+ | "PSEUDO": function( pseudo, argument ) { | ||
+ | // pseudo-class names are case-insensitive | ||
+ | // http://www.w3.org/TR/selectors/#pseudo-classes | ||
+ | // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters | ||
+ | // Remember that setFilters inherits from pseudos | ||
+ | var args, | ||
+ | fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] || | ||
+ | Sizzle.error( "unsupported pseudo: " + pseudo ); | ||
+ | |||
+ | // The user may use createPseudo to indicate that | ||
+ | // arguments are needed to create the filter function | ||
+ | // just as Sizzle does | ||
+ | if ( fn[ expando ] ) { | ||
+ | return fn( argument ); | ||
+ | } | ||
+ | |||
+ | // But maintain support for old signatures | ||
+ | if ( fn.length > 1 ) { | ||
+ | args = [ pseudo, pseudo, "", argument ]; | ||
+ | return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ? | ||
+ | markFunction(function( seed, matches ) { | ||
+ | var idx, | ||
+ | matched = fn( seed, argument ), | ||
+ | i = matched.length; | ||
+ | while ( i-- ) { | ||
+ | idx = indexOf.call( seed, matched[i] ); | ||
+ | seed[ idx ] = !( matches[ idx ] = matched[i] ); | ||
+ | } | ||
+ | }) : | ||
+ | function( elem ) { | ||
+ | return fn( elem, 0, args ); | ||
+ | }; | ||
+ | } | ||
+ | |||
+ | return fn; | ||
+ | } | ||
+ | }, | ||
+ | |||
+ | pseudos: { | ||
+ | // Potentially complex pseudos | ||
+ | "not": markFunction(function( selector ) { | ||
+ | // Trim the selector passed to compile | ||
+ | // to avoid treating leading and trailing | ||
+ | // spaces as combinators | ||
+ | var input = [], | ||
+ | results = [], | ||
+ | matcher = compile( selector.replace( rtrim, "$1" ) ); | ||
+ | |||
+ | return matcher[ expando ] ? | ||
+ | markFunction(function( seed, matches, context, xml ) { | ||
+ | var elem, | ||
+ | unmatched = matcher( seed, null, xml, [] ), | ||
+ | i = seed.length; | ||
+ | |||
+ | // Match elements unmatched by `matcher` | ||
+ | while ( i-- ) { | ||
+ | if ( (elem = unmatched[i]) ) { | ||
+ | seed[i] = !(matches[i] = elem); | ||
+ | } | ||
+ | } | ||
+ | }) : | ||
+ | function( elem, context, xml ) { | ||
+ | input[0] = elem; | ||
+ | matcher( input, null, xml, results ); | ||
+ | return !results.pop(); | ||
+ | }; | ||
+ | }), | ||
+ | |||
+ | "has": markFunction(function( selector ) { | ||
+ | return function( elem ) { | ||
+ | return Sizzle( selector, elem ).length > 0; | ||
+ | }; | ||
+ | }), | ||
+ | |||
+ | "contains": markFunction(function( text ) { | ||
+ | return function( elem ) { | ||
+ | return ( elem.textContent || elem.innerText || getText( elem ) ).indexOf( text ) > -1; | ||
+ | }; | ||
+ | }), | ||
+ | |||
+ | // "Whether an element is represented by a :lang() selector | ||
+ | // is based solely on the element's language value | ||
+ | // being equal to the identifier C, | ||
+ | // or beginning with the identifier C immediately followed by "-". | ||
+ | // The matching of C against the element's language value is performed case-insensitively. | ||
+ | // The identifier C does not have to be a valid language name." | ||
+ | // http://www.w3.org/TR/selectors/#lang-pseudo | ||
+ | "lang": markFunction( function( lang ) { | ||
+ | // lang value must be a valid identifier | ||
+ | if ( !ridentifier.test(lang || "") ) { | ||
+ | Sizzle.error( "unsupported lang: " + lang ); | ||
+ | } | ||
+ | lang = lang.replace( runescape, funescape ).toLowerCase(); | ||
+ | return function( elem ) { | ||
+ | var elemLang; | ||
+ | do { | ||
+ | if ( (elemLang = documentIsHTML ? | ||
+ | elem.lang : | ||
+ | elem.getAttribute("xml:lang") || elem.getAttribute("lang")) ) { | ||
+ | |||
+ | elemLang = elemLang.toLowerCase(); | ||
+ | return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0; | ||
+ | } | ||
+ | } while ( (elem = elem.parentNode) && elem.nodeType === 1 ); | ||
+ | return false; | ||
+ | }; | ||
+ | }), | ||
+ | |||
+ | // Miscellaneous | ||
+ | "target": function( elem ) { | ||
+ | var hash = window.location && window.location.hash; | ||
+ | return hash && hash.slice( 1 ) === elem.id; | ||
+ | }, | ||
+ | |||
+ | "root": function( elem ) { | ||
+ | return elem === docElem; | ||
+ | }, | ||
+ | |||
+ | "focus": function( elem ) { | ||
+ | return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex); | ||
+ | }, | ||
+ | |||
+ | // Boolean properties | ||
+ | "enabled": function( elem ) { | ||
+ | return elem.disabled === false; | ||
+ | }, | ||
+ | |||
+ | "disabled": function( elem ) { | ||
+ | return elem.disabled === true; | ||
+ | }, | ||
+ | |||
+ | "checked": function( elem ) { | ||
+ | // In CSS3, :checked should return both checked and selected elements | ||
+ | // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked | ||
+ | var nodeName = elem.nodeName.toLowerCase(); | ||
+ | return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected); | ||
+ | }, | ||
+ | |||
+ | "selected": function( elem ) { | ||
+ | // Accessing this property makes selected-by-default | ||
+ | // options in Safari work properly | ||
+ | if ( elem.parentNode ) { | ||
+ | elem.parentNode.selectedIndex; | ||
+ | } | ||
+ | |||
+ | return elem.selected === true; | ||
+ | }, | ||
+ | |||
+ | // Contents | ||
+ | "empty": function( elem ) { | ||
+ | // http://www.w3.org/TR/selectors/#empty-pseudo | ||
+ | // :empty is only affected by element nodes and content nodes(including text(3), cdata(4)), | ||
+ | // not comment, processing instructions, or others | ||
+ | // Thanks to Diego Perini for the nodeName shortcut | ||
+ | // Greater than "@" means alpha characters (specifically not starting with "#" or "?") | ||
+ | for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { | ||
+ | if ( elem.nodeName > "@" || elem.nodeType === 3 || elem.nodeType === 4 ) { | ||
+ | return false; | ||
+ | } | ||
+ | } | ||
+ | return true; | ||
+ | }, | ||
+ | |||
+ | "parent": function( elem ) { | ||
+ | return !Expr.pseudos["empty"]( elem ); | ||
+ | }, | ||
+ | |||
+ | // Element/input types | ||
+ | "header": function( elem ) { | ||
+ | return rheader.test( elem.nodeName ); | ||
+ | }, | ||
+ | |||
+ | "input": function( elem ) { | ||
+ | return rinputs.test( elem.nodeName ); | ||
+ | }, | ||
+ | |||
+ | "button": function( elem ) { | ||
+ | var name = elem.nodeName.toLowerCase(); | ||
+ | return name === "input" && elem.type === "button" || name === "button"; | ||
+ | }, | ||
+ | |||
+ | "text": function( elem ) { | ||
+ | var attr; | ||
+ | // IE6 and 7 will map elem.type to 'text' for new HTML5 types (search, etc) | ||
+ | // use getAttribute instead to test this case | ||
+ | return elem.nodeName.toLowerCase() === "input" && | ||
+ | elem.type === "text" && | ||
+ | ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === elem.type ); | ||
+ | }, | ||
+ | |||
+ | // Position-in-collection | ||
+ | "first": createPositionalPseudo(function() { | ||
+ | return [ 0 ]; | ||
+ | }), | ||
+ | |||
+ | "last": createPositionalPseudo(function( matchIndexes, length ) { | ||
+ | return [ length - 1 ]; | ||
+ | }), | ||
+ | |||
+ | "eq": createPositionalPseudo(function( matchIndexes, length, argument ) { | ||
+ | return [ argument < 0 ? argument + length : argument ]; | ||
+ | }), | ||
+ | |||
+ | "even": createPositionalPseudo(function( matchIndexes, length ) { | ||
+ | var i = 0; | ||
+ | for ( ; i < length; i += 2 ) { | ||
+ | matchIndexes.push( i ); | ||
+ | } | ||
+ | return matchIndexes; | ||
+ | }), | ||
+ | |||
+ | "odd": createPositionalPseudo(function( matchIndexes, length ) { | ||
+ | var i = 1; | ||
+ | for ( ; i < length; i += 2 ) { | ||
+ | matchIndexes.push( i ); | ||
+ | } | ||
+ | return matchIndexes; | ||
+ | }), | ||
+ | |||
+ | "lt": createPositionalPseudo(function( matchIndexes, length, argument ) { | ||
+ | var i = argument < 0 ? argument + length : argument; | ||
+ | for ( ; --i >= 0; ) { | ||
+ | matchIndexes.push( i ); | ||
+ | } | ||
+ | return matchIndexes; | ||
+ | }), | ||
+ | |||
+ | "gt": createPositionalPseudo(function( matchIndexes, length, argument ) { | ||
+ | var i = argument < 0 ? argument + length : argument; | ||
+ | for ( ; ++i < length; ) { | ||
+ | matchIndexes.push( i ); | ||
+ | } | ||
+ | return matchIndexes; | ||
+ | }) | ||
+ | } | ||
+ | }; | ||
+ | |||
+ | Expr.pseudos["nth"] = Expr.pseudos["eq"]; | ||
+ | |||
+ | // Add button/input type pseudos | ||
+ | for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) { | ||
+ | Expr.pseudos[ i ] = createInputPseudo( i ); | ||
+ | } | ||
+ | for ( i in { submit: true, reset: true } ) { | ||
+ | Expr.pseudos[ i ] = createButtonPseudo( i ); | ||
+ | } | ||
+ | |||
+ | // Easy API for creating new setFilters | ||
+ | function setFilters() {} | ||
+ | setFilters.prototype = Expr.filters = Expr.pseudos; | ||
+ | Expr.setFilters = new setFilters(); | ||
+ | |||
+ | function tokenize( selector, parseOnly ) { | ||
+ | var matched, match, tokens, type, | ||
+ | soFar, groups, preFilters, | ||
+ | cached = tokenCache[ selector + " " ]; | ||
+ | |||
+ | if ( cached ) { | ||
+ | return parseOnly ? 0 : cached.slice( 0 ); | ||
+ | } | ||
+ | |||
+ | soFar = selector; | ||
+ | groups = []; | ||
+ | preFilters = Expr.preFilter; | ||
+ | |||
+ | while ( soFar ) { | ||
+ | |||
+ | // Comma and first run | ||
+ | if ( !matched || (match = rcomma.exec( soFar )) ) { | ||
+ | if ( match ) { | ||
+ | // Don't consume trailing commas as valid | ||
+ | soFar = soFar.slice( match[0].length ) || soFar; | ||
+ | } | ||
+ | groups.push( tokens = [] ); | ||
+ | } | ||
+ | |||
+ | matched = false; | ||
+ | |||
+ | // Combinators | ||
+ | if ( (match = rcombinators.exec( soFar )) ) { | ||
+ | matched = match.shift(); | ||
+ | tokens.push({ | ||
+ | value: matched, | ||
+ | // Cast descendant combinators to space | ||
+ | type: match[0].replace( rtrim, " " ) | ||
+ | }); | ||
+ | soFar = soFar.slice( matched.length ); | ||
+ | } | ||
+ | |||
+ | // Filters | ||
+ | for ( type in Expr.filter ) { | ||
+ | if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] || | ||
+ | (match = preFilters[ type ]( match ))) ) { | ||
+ | matched = match.shift(); | ||
+ | tokens.push({ | ||
+ | value: matched, | ||
+ | type: type, | ||
+ | matches: match | ||
+ | }); | ||
+ | soFar = soFar.slice( matched.length ); | ||
+ | } | ||
+ | } | ||
+ | |||
+ | if ( !matched ) { | ||
+ | break; | ||
+ | } | ||
+ | } | ||
+ | |||
+ | // Return the length of the invalid excess | ||
+ | // if we're just parsing | ||
+ | // Otherwise, throw an error or return tokens | ||
+ | return parseOnly ? | ||
+ | soFar.length : | ||
+ | soFar ? | ||
+ | Sizzle.error( selector ) : | ||
+ | // Cache the tokens | ||
+ | tokenCache( selector, groups ).slice( 0 ); | ||
+ | } | ||
+ | |||
+ | function toSelector( tokens ) { | ||
+ | var i = 0, | ||
+ | len = tokens.length, | ||
+ | selector = ""; | ||
+ | for ( ; i < len; i++ ) { | ||
+ | selector += tokens[i].value; | ||
+ | } | ||
+ | return selector; | ||
+ | } | ||
+ | |||
+ | function addCombinator( matcher, combinator, base ) { | ||
+ | var dir = combinator.dir, | ||
+ | checkNonElements = base && dir === "parentNode", | ||
+ | doneName = done++; | ||
+ | |||
+ | return combinator.first ? | ||
+ | // Check against closest ancestor/preceding element | ||
+ | function( elem, context, xml ) { | ||
+ | while ( (elem = elem[ dir ]) ) { | ||
+ | if ( elem.nodeType === 1 || checkNonElements ) { | ||
+ | return matcher( elem, context, xml ); | ||
+ | } | ||
+ | } | ||
+ | } : | ||
+ | |||
+ | // Check against all ancestor/preceding elements | ||
+ | function( elem, context, xml ) { | ||
+ | var data, cache, outerCache, | ||
+ | dirkey = dirruns + " " + doneName; | ||
+ | |||
+ | // We can't set arbitrary data on XML nodes, so they don't benefit from dir caching | ||
+ | if ( xml ) { | ||
+ | while ( (elem = elem[ dir ]) ) { | ||
+ | if ( elem.nodeType === 1 || checkNonElements ) { | ||
+ | if ( matcher( elem, context, xml ) ) { | ||
+ | return true; | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | } else { | ||
+ | while ( (elem = elem[ dir ]) ) { | ||
+ | if ( elem.nodeType === 1 || checkNonElements ) { | ||
+ | outerCache = elem[ expando ] || (elem[ expando ] = {}); | ||
+ | if ( (cache = outerCache[ dir ]) && cache[0] === dirkey ) { | ||
+ | if ( (data = cache[1]) === true || data === cachedruns ) { | ||
+ | return data === true; | ||
+ | } | ||
+ | } else { | ||
+ | cache = outerCache[ dir ] = [ dirkey ]; | ||
+ | cache[1] = matcher( elem, context, xml ) || cachedruns; | ||
+ | if ( cache[1] === true ) { | ||
+ | return true; | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | }; | ||
+ | } | ||
+ | |||
+ | function elementMatcher( matchers ) { | ||
+ | return matchers.length > 1 ? | ||
+ | function( elem, context, xml ) { | ||
+ | var i = matchers.length; | ||
+ | while ( i-- ) { | ||
+ | if ( !matchers[i]( elem, context, xml ) ) { | ||
+ | return false; | ||
+ | } | ||
+ | } | ||
+ | return true; | ||
+ | } : | ||
+ | matchers[0]; | ||
+ | } | ||
+ | |||
+ | function condense( unmatched, map, filter, context, xml ) { | ||
+ | var elem, | ||
+ | newUnmatched = [], | ||
+ | i = 0, | ||
+ | len = unmatched.length, | ||
+ | mapped = map != null; | ||
+ | |||
+ | for ( ; i < len; i++ ) { | ||
+ | if ( (elem = unmatched[i]) ) { | ||
+ | if ( !filter || filter( elem, context, xml ) ) { | ||
+ | newUnmatched.push( elem ); | ||
+ | if ( mapped ) { | ||
+ | map.push( i ); | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | |||
+ | return newUnmatched; | ||
+ | } | ||
+ | |||
+ | function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) { | ||
+ | if ( postFilter && !postFilter[ expando ] ) { | ||
+ | postFilter = setMatcher( postFilter ); | ||
+ | } | ||
+ | if ( postFinder && !postFinder[ expando ] ) { | ||
+ | postFinder = setMatcher( postFinder, postSelector ); | ||
+ | } | ||
+ | return markFunction(function( seed, results, context, xml ) { | ||
+ | var temp, i, elem, | ||
+ | preMap = [], | ||
+ | postMap = [], | ||
+ | preexisting = results.length, | ||
+ | |||
+ | // Get initial elements from seed or context | ||
+ | elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ), | ||
+ | |||
+ | // Prefilter to get matcher input, preserving a map for seed-results synchronization | ||
+ | matcherIn = preFilter && ( seed || !selector ) ? | ||
+ | condense( elems, preMap, preFilter, context, xml ) : | ||
+ | elems, | ||
+ | |||
+ | matcherOut = matcher ? | ||
+ | // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results, | ||
+ | postFinder || ( seed ? preFilter : preexisting || postFilter ) ? | ||
+ | |||
+ | // ...intermediate processing is necessary | ||
+ | [] : | ||
+ | |||
+ | // ...otherwise use results directly | ||
+ | results : | ||
+ | matcherIn; | ||
+ | |||
+ | // Find primary matches | ||
+ | if ( matcher ) { | ||
+ | matcher( matcherIn, matcherOut, context, xml ); | ||
+ | } | ||
+ | |||
+ | // Apply postFilter | ||
+ | if ( postFilter ) { | ||
+ | temp = condense( matcherOut, postMap ); | ||
+ | postFilter( temp, [], context, xml ); | ||
+ | |||
+ | // Un-match failing elements by moving them back to matcherIn | ||
+ | i = temp.length; | ||
+ | while ( i-- ) { | ||
+ | if ( (elem = temp[i]) ) { | ||
+ | matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem); | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | |||
+ | if ( seed ) { | ||
+ | if ( postFinder || preFilter ) { | ||
+ | if ( postFinder ) { | ||
+ | // Get the final matcherOut by condensing this intermediate into postFinder contexts | ||
+ | temp = []; | ||
+ | i = matcherOut.length; | ||
+ | while ( i-- ) { | ||
+ | if ( (elem = matcherOut[i]) ) { | ||
+ | // Restore matcherIn since elem is not yet a final match | ||
+ | temp.push( (matcherIn[i] = elem) ); | ||
+ | } | ||
+ | } | ||
+ | postFinder( null, (matcherOut = []), temp, xml ); | ||
+ | } | ||
+ | |||
+ | // Move matched elements from seed to results to keep them synchronized | ||
+ | i = matcherOut.length; | ||
+ | while ( i-- ) { | ||
+ | if ( (elem = matcherOut[i]) && | ||
+ | (temp = postFinder ? indexOf.call( seed, elem ) : preMap[i]) > -1 ) { | ||
+ | |||
+ | seed[temp] = !(results[temp] = elem); | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | |||
+ | // Add elements to results, through postFinder if defined | ||
+ | } else { | ||
+ | matcherOut = condense( | ||
+ | matcherOut === results ? | ||
+ | matcherOut.splice( preexisting, matcherOut.length ) : | ||
+ | matcherOut | ||
+ | ); | ||
+ | if ( postFinder ) { | ||
+ | postFinder( null, results, matcherOut, xml ); | ||
+ | } else { | ||
+ | push.apply( results, matcherOut ); | ||
+ | } | ||
+ | } | ||
+ | }); | ||
+ | } | ||
+ | |||
+ | function matcherFromTokens( tokens ) { | ||
+ | var checkContext, matcher, j, | ||
+ | len = tokens.length, | ||
+ | leadingRelative = Expr.relative[ tokens[0].type ], | ||
+ | implicitRelative = leadingRelative || Expr.relative[" "], | ||
+ | i = leadingRelative ? 1 : 0, | ||
+ | |||
+ | // The foundational matcher ensures that elements are reachable from top-level context(s) | ||
+ | matchContext = addCombinator( function( elem ) { | ||
+ | return elem === checkContext; | ||
+ | }, implicitRelative, true ), | ||
+ | matchAnyContext = addCombinator( function( elem ) { | ||
+ | return indexOf.call( checkContext, elem ) > -1; | ||
+ | }, implicitRelative, true ), | ||
+ | matchers = [ function( elem, context, xml ) { | ||
+ | return ( !leadingRelative && ( xml || context !== outermostContext ) ) || ( | ||
+ | (checkContext = context).nodeType ? | ||
+ | matchContext( elem, context, xml ) : | ||
+ | matchAnyContext( elem, context, xml ) ); | ||
+ | } ]; | ||
+ | |||
+ | for ( ; i < len; i++ ) { | ||
+ | if ( (matcher = Expr.relative[ tokens[i].type ]) ) { | ||
+ | matchers = [ addCombinator(elementMatcher( matchers ), matcher) ]; | ||
+ | } else { | ||
+ | matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches ); | ||
+ | |||
+ | // Return special upon seeing a positional matcher | ||
+ | if ( matcher[ expando ] ) { | ||
+ | // Find the next relative operator (if any) for proper handling | ||
+ | j = ++i; | ||
+ | for ( ; j < len; j++ ) { | ||
+ | if ( Expr.relative[ tokens[j].type ] ) { | ||
+ | break; | ||
+ | } | ||
+ | } | ||
+ | return setMatcher( | ||
+ | i > 1 && elementMatcher( matchers ), | ||
+ | i > 1 && toSelector( | ||
+ | // If the preceding token was a descendant combinator, insert an implicit any-element `*` | ||
+ | tokens.slice( 0, i - 1 ).concat({ value: tokens[ i - 2 ].type === " " ? "*" : "" }) | ||
+ | ).replace( rtrim, "$1" ), | ||
+ | matcher, | ||
+ | i < j && matcherFromTokens( tokens.slice( i, j ) ), | ||
+ | j < len && matcherFromTokens( (tokens = tokens.slice( j )) ), | ||
+ | j < len && toSelector( tokens ) | ||
+ | ); | ||
+ | } | ||
+ | matchers.push( matcher ); | ||
+ | } | ||
+ | } | ||
+ | |||
+ | return elementMatcher( matchers ); | ||
+ | } | ||
+ | |||
+ | function matcherFromGroupMatchers( elementMatchers, setMatchers ) { | ||
+ | // A counter to specify which element is currently being matched | ||
+ | var matcherCachedRuns = 0, | ||
+ | bySet = setMatchers.length > 0, | ||
+ | byElement = elementMatchers.length > 0, | ||
+ | superMatcher = function( seed, context, xml, results, expandContext ) { | ||
+ | var elem, j, matcher, | ||
+ | setMatched = [], | ||
+ | matchedCount = 0, | ||
+ | i = "0", | ||
+ | unmatched = seed && [], | ||
+ | outermost = expandContext != null, | ||
+ | contextBackup = outermostContext, | ||
+ | // We must always have either seed elements or context | ||
+ | elems = seed || byElement && Expr.find["TAG"]( "*", expandContext && context.parentNode || context ), | ||
+ | // Use integer dirruns iff this is the outermost matcher | ||
+ | dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1); | ||
+ | |||
+ | if ( outermost ) { | ||
+ | outermostContext = context !== document && context; | ||
+ | cachedruns = matcherCachedRuns; | ||
+ | } | ||
+ | |||
+ | // Add elements passing elementMatchers directly to results | ||
+ | // Keep `i` a string if there are no elements so `matchedCount` will be "00" below | ||
+ | for ( ; (elem = elems[i]) != null; i++ ) { | ||
+ | if ( byElement && elem ) { | ||
+ | j = 0; | ||
+ | while ( (matcher = elementMatchers[j++]) ) { | ||
+ | if ( matcher( elem, context, xml ) ) { | ||
+ | results.push( elem ); | ||
+ | break; | ||
+ | } | ||
+ | } | ||
+ | if ( outermost ) { | ||
+ | dirruns = dirrunsUnique; | ||
+ | cachedruns = ++matcherCachedRuns; | ||
+ | } | ||
+ | } | ||
+ | |||
+ | // Track unmatched elements for set filters | ||
+ | if ( bySet ) { | ||
+ | // They will have gone through all possible matchers | ||
+ | if ( (elem = !matcher && elem) ) { | ||
+ | matchedCount--; | ||
+ | } | ||
+ | |||
+ | // Lengthen the array for every element, matched or not | ||
+ | if ( seed ) { | ||
+ | unmatched.push( elem ); | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | |||
+ | // Apply set filters to unmatched elements | ||
+ | matchedCount += i; | ||
+ | if ( bySet && i !== matchedCount ) { | ||
+ | j = 0; | ||
+ | while ( (matcher = setMatchers[j++]) ) { | ||
+ | matcher( unmatched, setMatched, context, xml ); | ||
+ | } | ||
+ | |||
+ | if ( seed ) { | ||
+ | // Reintegrate element matches to eliminate the need for sorting | ||
+ | if ( matchedCount > 0 ) { | ||
+ | while ( i-- ) { | ||
+ | if ( !(unmatched[i] || setMatched[i]) ) { | ||
+ | setMatched[i] = pop.call( results ); | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | |||
+ | // Discard index placeholder values to get only actual matches | ||
+ | setMatched = condense( setMatched ); | ||
+ | } | ||
+ | |||
+ | // Add matches to results | ||
+ | push.apply( results, setMatched ); | ||
+ | |||
+ | // Seedless set matches succeeding multiple successful matchers stipulate sorting | ||
+ | if ( outermost && !seed && setMatched.length > 0 && | ||
+ | ( matchedCount + setMatchers.length ) > 1 ) { | ||
+ | |||
+ | Sizzle.uniqueSort( results ); | ||
+ | } | ||
+ | } | ||
+ | |||
+ | // Override manipulation of globals by nested matchers | ||
+ | if ( outermost ) { | ||
+ | dirruns = dirrunsUnique; | ||
+ | outermostContext = contextBackup; | ||
+ | } | ||
+ | |||
+ | return unmatched; | ||
+ | }; | ||
+ | |||
+ | return bySet ? | ||
+ | markFunction( superMatcher ) : | ||
+ | superMatcher; | ||
+ | } | ||
+ | |||
+ | compile = Sizzle.compile = function( selector, group /* Internal Use Only */ ) { | ||
+ | var i, | ||
+ | setMatchers = [], | ||
+ | elementMatchers = [], | ||
+ | cached = compilerCache[ selector + " " ]; | ||
+ | |||
+ | if ( !cached ) { | ||
+ | // Generate a function of recursive functions that can be used to check each element | ||
+ | if ( !group ) { | ||
+ | group = tokenize( selector ); | ||
+ | } | ||
+ | i = group.length; | ||
+ | while ( i-- ) { | ||
+ | cached = matcherFromTokens( group[i] ); | ||
+ | if ( cached[ expando ] ) { | ||
+ | setMatchers.push( cached ); | ||
+ | } else { | ||
+ | elementMatchers.push( cached ); | ||
+ | } | ||
+ | } | ||
+ | |||
+ | // Cache the compiled function | ||
+ | cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) ); | ||
+ | } | ||
+ | return cached; | ||
+ | }; | ||
+ | |||
+ | function multipleContexts( selector, contexts, results ) { | ||
+ | var i = 0, | ||
+ | len = contexts.length; | ||
+ | for ( ; i < len; i++ ) { | ||
+ | Sizzle( selector, contexts[i], results ); | ||
+ | } | ||
+ | return results; | ||
+ | } | ||
+ | |||
+ | function select( selector, context, results, seed ) { | ||
+ | var i, tokens, token, type, find, | ||
+ | match = tokenize( selector ); | ||
+ | |||
+ | if ( !seed ) { | ||
+ | // Try to minimize operations if there is only one group | ||
+ | if ( match.length === 1 ) { | ||
+ | |||
+ | // Take a shortcut and set the context if the root selector is an ID | ||
+ | tokens = match[0] = match[0].slice( 0 ); | ||
+ | if ( tokens.length > 2 && (token = tokens[0]).type === "ID" && | ||
+ | support.getById && context.nodeType === 9 && documentIsHTML && | ||
+ | Expr.relative[ tokens[1].type ] ) { | ||
+ | |||
+ | context = ( Expr.find["ID"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0]; | ||
+ | if ( !context ) { | ||
+ | return results; | ||
+ | } | ||
+ | selector = selector.slice( tokens.shift().value.length ); | ||
+ | } | ||
+ | |||
+ | // Fetch a seed set for right-to-left matching | ||
+ | i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length; | ||
+ | while ( i-- ) { | ||
+ | token = tokens[i]; | ||
+ | |||
+ | // Abort if we hit a combinator | ||
+ | if ( Expr.relative[ (type = token.type) ] ) { | ||
+ | break; | ||
+ | } | ||
+ | if ( (find = Expr.find[ type ]) ) { | ||
+ | // Search, expanding context for leading sibling combinators | ||
+ | if ( (seed = find( | ||
+ | token.matches[0].replace( runescape, funescape ), | ||
+ | rsibling.test( tokens[0].type ) && context.parentNode || context | ||
+ | )) ) { | ||
+ | |||
+ | // If seed is empty or no tokens remain, we can return early | ||
+ | tokens.splice( i, 1 ); | ||
+ | selector = seed.length && toSelector( tokens ); | ||
+ | if ( !selector ) { | ||
+ | push.apply( results, seed ); | ||
+ | return results; | ||
+ | } | ||
+ | |||
+ | break; | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | |||
+ | // Compile and execute a filtering function | ||
+ | // Provide `match` to avoid retokenization if we modified the selector above | ||
+ | compile( selector, match )( | ||
+ | seed, | ||
+ | context, | ||
+ | !documentIsHTML, | ||
+ | results, | ||
+ | rsibling.test( selector ) | ||
+ | ); | ||
+ | return results; | ||
+ | } | ||
+ | |||
+ | // One-time assignments | ||
+ | |||
+ | // Sort stability | ||
+ | support.sortStable = expando.split("").sort( sortOrder ).join("") === expando; | ||
+ | |||
+ | // Support: Chrome<14 | ||
+ | // Always assume duplicates if they aren't passed to the comparison function | ||
+ | support.detectDuplicates = hasDuplicate; | ||
+ | |||
+ | // Initialize against the default document | ||
+ | setDocument(); | ||
+ | |||
+ | // Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27) | ||
+ | // Detached nodes confoundingly follow *each other* | ||
+ | support.sortDetached = assert(function( div1 ) { | ||
+ | // Should return 1, but returns 4 (following) | ||
+ | return div1.compareDocumentPosition( document.createElement("div") ) & 1; | ||
+ | }); | ||
+ | |||
+ | // Support: IE<8 | ||
+ | // Prevent attribute/property "interpolation" | ||
+ | // http://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx | ||
+ | if ( !assert(function( div ) { | ||
+ | div.innerHTML = "<a href='#'></a>"; | ||
+ | return div.firstChild.getAttribute("href") === "#" ; | ||
+ | }) ) { | ||
+ | addHandle( "type|href|height|width", function( elem, name, isXML ) { | ||
+ | if ( !isXML ) { | ||
+ | return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 ); | ||
+ | } | ||
+ | }); | ||
+ | } | ||
+ | |||
+ | // Support: IE<9 | ||
+ | // Use defaultValue in place of getAttribute("value") | ||
+ | if ( !support.attributes || !assert(function( div ) { | ||
+ | div.innerHTML = "<input/>"; | ||
+ | div.firstChild.setAttribute( "value", "" ); | ||
+ | return div.firstChild.getAttribute( "value" ) === ""; | ||
+ | }) ) { | ||
+ | addHandle( "value", function( elem, name, isXML ) { | ||
+ | if ( !isXML && elem.nodeName.toLowerCase() === "input" ) { | ||
+ | return elem.defaultValue; | ||
+ | } | ||
+ | }); | ||
+ | } | ||
+ | |||
+ | // Support: IE<9 | ||
+ | // Use getAttributeNode to fetch booleans when getAttribute lies | ||
+ | if ( !assert(function( div ) { | ||
+ | return div.getAttribute("disabled") == null; | ||
+ | }) ) { | ||
+ | addHandle( booleans, function( elem, name, isXML ) { | ||
+ | var val; | ||
+ | if ( !isXML ) { | ||
+ | return (val = elem.getAttributeNode( name )) && val.specified ? | ||
+ | val.value : | ||
+ | elem[ name ] === true ? name.toLowerCase() : null; | ||
+ | } | ||
+ | }); | ||
+ | } | ||
+ | |||
+ | jQuery.find = Sizzle; | ||
+ | jQuery.expr = Sizzle.selectors; | ||
+ | jQuery.expr[":"] = jQuery.expr.pseudos; | ||
+ | jQuery.unique = Sizzle.uniqueSort; | ||
+ | jQuery.text = Sizzle.getText; | ||
+ | jQuery.isXMLDoc = Sizzle.isXML; | ||
+ | jQuery.contains = Sizzle.contains; | ||
+ | |||
+ | |||
+ | })( window ); | ||
+ | // String to Object options format cache | ||
+ | var optionsCache = {}; | ||
+ | |||
+ | // Convert String-formatted options into Object-formatted ones and store in cache | ||
+ | function createOptions( options ) { | ||
+ | var object = optionsCache[ options ] = {}; | ||
+ | jQuery.each( options.match( core_rnotwhite ) || [], function( _, flag ) { | ||
+ | object[ flag ] = true; | ||
+ | }); | ||
+ | return object; | ||
+ | } | ||
+ | |||
+ | /* | ||
+ | * Create a callback list using the following parameters: | ||
+ | * | ||
+ | * options: an optional list of space-separated options that will change how | ||
+ | * the callback list behaves or a more traditional option object | ||
+ | * | ||
+ | * By default a callback list will act like an event callback list and can be | ||
+ | * "fired" multiple times. | ||
+ | * | ||
+ | * Possible options: | ||
+ | * | ||
+ | * once: will ensure the callback list can only be fired once (like a Deferred) | ||
+ | * | ||
+ | * memory: will keep track of previous values and will call any callback added | ||
+ | * after the list has been fired right away with the latest "memorized" | ||
+ | * values (like a Deferred) | ||
+ | * | ||
+ | * unique: will ensure a callback can only be added once (no duplicate in the list) | ||
+ | * | ||
+ | * stopOnFalse: interrupt callings when a callback returns false | ||
+ | * | ||
+ | */ | ||
+ | jQuery.Callbacks = function( options ) { | ||
+ | |||
+ | // Convert options from String-formatted to Object-formatted if needed | ||
+ | // (we check in cache first) | ||
+ | options = typeof options === "string" ? | ||
+ | ( optionsCache[ options ] || createOptions( options ) ) : | ||
+ | jQuery.extend( {}, options ); | ||
+ | |||
+ | var // Flag to know if list is currently firing | ||
+ | firing, | ||
+ | // Last fire value (for non-forgettable lists) | ||
+ | memory, | ||
+ | // Flag to know if list was already fired | ||
+ | fired, | ||
+ | // End of the loop when firing | ||
+ | firingLength, | ||
+ | // Index of currently firing callback (modified by remove if needed) | ||
+ | firingIndex, | ||
+ | // First callback to fire (used internally by add and fireWith) | ||
+ | firingStart, | ||
+ | // Actual callback list | ||
+ | list = [], | ||
+ | // Stack of fire calls for repeatable lists | ||
+ | stack = !options.once && [], | ||
+ | // Fire callbacks | ||
+ | fire = function( data ) { | ||
+ | memory = options.memory && data; | ||
+ | fired = true; | ||
+ | firingIndex = firingStart || 0; | ||
+ | firingStart = 0; | ||
+ | firingLength = list.length; | ||
+ | firing = true; | ||
+ | for ( ; list && firingIndex < firingLength; firingIndex++ ) { | ||
+ | if ( list[ firingIndex ].apply( data[ 0 ], data[ 1 ] ) === false && options.stopOnFalse ) { | ||
+ | memory = false; // To prevent further calls using add | ||
+ | break; | ||
+ | } | ||
+ | } | ||
+ | firing = false; | ||
+ | if ( list ) { | ||
+ | if ( stack ) { | ||
+ | if ( stack.length ) { | ||
+ | fire( stack.shift() ); | ||
+ | } | ||
+ | } else if ( memory ) { | ||
+ | list = []; | ||
+ | } else { | ||
+ | self.disable(); | ||
+ | } | ||
+ | } | ||
+ | }, | ||
+ | // Actual Callbacks object | ||
+ | self = { | ||
+ | // Add a callback or a collection of callbacks to the list | ||
+ | add: function() { | ||
+ | if ( list ) { | ||
+ | // First, we save the current length | ||
+ | var start = list.length; | ||
+ | (function add( args ) { | ||
+ | jQuery.each( args, function( _, arg ) { | ||
+ | var type = jQuery.type( arg ); | ||
+ | if ( type === "function" ) { | ||
+ | if ( !options.unique || !self.has( arg ) ) { | ||
+ | list.push( arg ); | ||
+ | } | ||
+ | } else if ( arg && arg.length && type !== "string" ) { | ||
+ | // Inspect recursively | ||
+ | add( arg ); | ||
+ | } | ||
+ | }); | ||
+ | })( arguments ); | ||
+ | // Do we need to add the callbacks to the | ||
+ | // current firing batch? | ||
+ | if ( firing ) { | ||
+ | firingLength = list.length; | ||
+ | // With memory, if we're not firing then | ||
+ | // we should call right away | ||
+ | } else if ( memory ) { | ||
+ | firingStart = start; | ||
+ | fire( memory ); | ||
+ | } | ||
+ | } | ||
+ | return this; | ||
+ | }, | ||
+ | // Remove a callback from the list | ||
+ | remove: function() { | ||
+ | if ( list ) { | ||
+ | jQuery.each( arguments, function( _, arg ) { | ||
+ | var index; | ||
+ | while( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) { | ||
+ | list.splice( index, 1 ); | ||
+ | // Handle firing indexes | ||
+ | if ( firing ) { | ||
+ | if ( index <= firingLength ) { | ||
+ | firingLength--; | ||
+ | } | ||
+ | if ( index <= firingIndex ) { | ||
+ | firingIndex--; | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | }); | ||
+ | } | ||
+ | return this; | ||
+ | }, | ||
+ | // Check if a given callback is in the list. | ||
+ | // If no argument is given, return whether or not list has callbacks attached. | ||
+ | has: function( fn ) { | ||
+ | return fn ? jQuery.inArray( fn, list ) > -1 : !!( list && list.length ); | ||
+ | }, | ||
+ | // Remove all callbacks from the list | ||
+ | empty: function() { | ||
+ | list = []; | ||
+ | firingLength = 0; | ||
+ | return this; | ||
+ | }, | ||
+ | // Have the list do nothing anymore | ||
+ | disable: function() { | ||
+ | list = stack = memory = undefined; | ||
+ | return this; | ||
+ | }, | ||
+ | // Is it disabled? | ||
+ | disabled: function() { | ||
+ | return !list; | ||
+ | }, | ||
+ | // Lock the list in its current state | ||
+ | lock: function() { | ||
+ | stack = undefined; | ||
+ | if ( !memory ) { | ||
+ | self.disable(); | ||
+ | } | ||
+ | return this; | ||
+ | }, | ||
+ | // Is it locked? | ||
+ | locked: function() { | ||
+ | return !stack; | ||
+ | }, | ||
+ | // Call all callbacks with the given context and arguments | ||
+ | fireWith: function( context, args ) { | ||
+ | if ( list && ( !fired || stack ) ) { | ||
+ | args = args || []; | ||
+ | args = [ context, args.slice ? args.slice() : args ]; | ||
+ | if ( firing ) { | ||
+ | stack.push( args ); | ||
+ | } else { | ||
+ | fire( args ); | ||
+ | } | ||
+ | } | ||
+ | return this; | ||
+ | }, | ||
+ | // Call all the callbacks with the given arguments | ||
+ | fire: function() { | ||
+ | self.fireWith( this, arguments ); | ||
+ | return this; | ||
+ | }, | ||
+ | // To know if the callbacks have already been called at least once | ||
+ | fired: function() { | ||
+ | return !!fired; | ||
+ | } | ||
+ | }; | ||
+ | |||
+ | return self; | ||
+ | }; | ||
+ | jQuery.extend({ | ||
+ | |||
+ | Deferred: function( func ) { | ||
+ | var tuples = [ | ||
+ | // action, add listener, listener list, final state | ||
+ | [ "resolve", "done", jQuery.Callbacks("once memory"), "resolved" ], | ||
+ | [ "reject", "fail", jQuery.Callbacks("once memory"), "rejected" ], | ||
+ | [ "notify", "progress", jQuery.Callbacks("memory") ] | ||
+ | ], | ||
+ | state = "pending", | ||
+ | promise = { | ||
+ | state: function() { | ||
+ | return state; | ||
+ | }, | ||
+ | always: function() { | ||
+ | deferred.done( arguments ).fail( arguments ); | ||
+ | return this; | ||
+ | }, | ||
+ | then: function( /* fnDone, fnFail, fnProgress */ ) { | ||
+ | var fns = arguments; | ||
+ | return jQuery.Deferred(function( newDefer ) { | ||
+ | jQuery.each( tuples, function( i, tuple ) { | ||
+ | var action = tuple[ 0 ], | ||
+ | fn = jQuery.isFunction( fns[ i ] ) && fns[ i ]; | ||
+ | // deferred[ done | fail | progress ] for forwarding actions to newDefer | ||
+ | deferred[ tuple[1] ](function() { | ||
+ | var returned = fn && fn.apply( this, arguments ); | ||
+ | if ( returned && jQuery.isFunction( returned.promise ) ) { | ||
+ | returned.promise() | ||
+ | .done( newDefer.resolve ) | ||
+ | .fail( newDefer.reject ) | ||
+ | .progress( newDefer.notify ); | ||
+ | } else { | ||
+ | newDefer[ action + "With" ]( this === promise ? newDefer.promise() : this, fn ? [ returned ] : arguments ); | ||
+ | } | ||
+ | }); | ||
+ | }); | ||
+ | fns = null; | ||
+ | }).promise(); | ||
+ | }, | ||
+ | // Get a promise for this deferred | ||
+ | // If obj is provided, the promise aspect is added to the object | ||
+ | promise: function( obj ) { | ||
+ | return obj != null ? jQuery.extend( obj, promise ) : promise; | ||
+ | } | ||
+ | }, | ||
+ | deferred = {}; | ||
+ | |||
+ | // Keep pipe for back-compat | ||
+ | promise.pipe = promise.then; | ||
+ | |||
+ | // Add list-specific methods | ||
+ | jQuery.each( tuples, function( i, tuple ) { | ||
+ | var list = tuple[ 2 ], | ||
+ | stateString = tuple[ 3 ]; | ||
+ | |||
+ | // promise[ done | fail | progress ] = list.add | ||
+ | promise[ tuple[1] ] = list.add; | ||
+ | |||
+ | // Handle state | ||
+ | if ( stateString ) { | ||
+ | list.add(function() { | ||
+ | // state = [ resolved | rejected ] | ||
+ | state = stateString; | ||
+ | |||
+ | // [ reject_list | resolve_list ].disable; progress_list.lock | ||
+ | }, tuples[ i ^ 1 ][ 2 ].disable, tuples[ 2 ][ 2 ].lock ); | ||
+ | } | ||
+ | |||
+ | // deferred[ resolve | reject | notify ] | ||
+ | deferred[ tuple[0] ] = function() { | ||
+ | deferred[ tuple[0] + "With" ]( this === deferred ? promise : this, arguments ); | ||
+ | return this; | ||
+ | }; | ||
+ | deferred[ tuple[0] + "With" ] = list.fireWith; | ||
+ | }); | ||
+ | |||
+ | // Make the deferred a promise | ||
+ | promise.promise( deferred ); | ||
+ | |||
+ | // Call given func if any | ||
+ | if ( func ) { | ||
+ | func.call( deferred, deferred ); | ||
+ | } | ||
+ | |||
+ | // All done! | ||
+ | return deferred; | ||
+ | }, | ||
+ | |||
+ | // Deferred helper | ||
+ | when: function( subordinate /* , ..., subordinateN */ ) { | ||
+ | var i = 0, | ||
+ | resolveValues = core_slice.call( arguments ), | ||
+ | length = resolveValues.length, | ||
+ | |||
+ | // the count of uncompleted subordinates | ||
+ | remaining = length !== 1 || ( subordinate && jQuery.isFunction( subordinate.promise ) ) ? length : 0, | ||
+ | |||
+ | // the master Deferred. If resolveValues consist of only a single Deferred, just use that. | ||
+ | deferred = remaining === 1 ? subordinate : jQuery.Deferred(), | ||
+ | |||
+ | // Update function for both resolve and progress values | ||
+ | updateFunc = function( i, contexts, values ) { | ||
+ | return function( value ) { | ||
+ | contexts[ i ] = this; | ||
+ | values[ i ] = arguments.length > 1 ? core_slice.call( arguments ) : value; | ||
+ | if( values === progressValues ) { | ||
+ | deferred.notifyWith( contexts, values ); | ||
+ | } else if ( !( --remaining ) ) { | ||
+ | deferred.resolveWith( contexts, values ); | ||
+ | } | ||
+ | }; | ||
+ | }, | ||
+ | |||
+ | progressValues, progressContexts, resolveContexts; | ||
+ | |||
+ | // add listeners to Deferred subordinates; treat others as resolved | ||
+ | if ( length > 1 ) { | ||
+ | progressValues = new Array( length ); | ||
+ | progressContexts = new Array( length ); | ||
+ | resolveContexts = new Array( length ); | ||
+ | for ( ; i < length; i++ ) { | ||
+ | if ( resolveValues[ i ] && jQuery.isFunction( resolveValues[ i ].promise ) ) { | ||
+ | resolveValues[ i ].promise() | ||
+ | .done( updateFunc( i, resolveContexts, resolveValues ) ) | ||
+ | .fail( deferred.reject ) | ||
+ | .progress( updateFunc( i, progressContexts, progressValues ) ); | ||
+ | } else { | ||
+ | --remaining; | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | |||
+ | // if we're not waiting on anything, resolve the master | ||
+ | if ( !remaining ) { | ||
+ | deferred.resolveWith( resolveContexts, resolveValues ); | ||
+ | } | ||
+ | |||
+ | return deferred.promise(); | ||
+ | } | ||
+ | }); | ||
+ | jQuery.support = (function( support ) { | ||
+ | |||
+ | var all, a, input, select, fragment, opt, eventName, isSupported, i, | ||
+ | div = document.createElement("div"); | ||
+ | |||
+ | // Setup | ||
+ | div.setAttribute( "className", "t" ); | ||
+ | div.innerHTML = " <link/><table></table><a href='/a'>a</a><input type='checkbox'/>"; | ||
+ | |||
+ | // Finish early in limited (non-browser) environments | ||
+ | all = div.getElementsByTagName("*") || []; | ||
+ | a = div.getElementsByTagName("a")[ 0 ]; | ||
+ | if ( !a || !a.style || !all.length ) { | ||
+ | return support; | ||
+ | } | ||
+ | |||
+ | // First batch of tests | ||
+ | select = document.createElement("select"); | ||
+ | opt = select.appendChild( document.createElement("option") ); | ||
+ | input = div.getElementsByTagName("input")[ 0 ]; | ||
+ | |||
+ | a.style.cssText = "top:1px;float:left;opacity:.5"; | ||
+ | |||
+ | // Test setAttribute on camelCase class. If it works, we need attrFixes when doing get/setAttribute (ie6/7) | ||
+ | support.getSetAttribute = div.className !== "t"; | ||
+ | |||
+ | // IE strips leading whitespace when .innerHTML is used | ||
+ | support.leadingWhitespace = div.firstChild.nodeType === 3; | ||
+ | |||
+ | // Make sure that tbody elements aren't automatically inserted | ||
+ | // IE will insert them into empty tables | ||
+ | support.tbody = !div.getElementsByTagName("tbody").length; | ||
+ | |||
+ | // Make sure that link elements get serialized correctly by innerHTML | ||
+ | // This requires a wrapper element in IE | ||
+ | support.htmlSerialize = !!div.getElementsByTagName("link").length; | ||
+ | |||
+ | // Get the style information from getAttribute | ||
+ | // (IE uses .cssText instead) | ||
+ | support.style = /top/.test( a.getAttribute("style") ); | ||
+ | |||
+ | // Make sure that URLs aren't manipulated | ||
+ | // (IE normalizes it by default) | ||
+ | support.hrefNormalized = a.getAttribute("href") === "/a"; | ||
+ | |||
+ | // Make sure that element opacity exists | ||
+ | // (IE uses filter instead) | ||
+ | // Use a regex to work around a WebKit issue. See #5145 | ||
+ | support.opacity = /^0.5/.test( a.style.opacity ); | ||
+ | |||
+ | // Verify style float existence | ||
+ | // (IE uses styleFloat instead of cssFloat) | ||
+ | support.cssFloat = !!a.style.cssFloat; | ||
+ | |||
+ | // Check the default checkbox/radio value ("" on WebKit; "on" elsewhere) | ||
+ | support.checkOn = !!input.value; | ||
+ | |||
+ | // Make sure that a selected-by-default option has a working selected property. | ||
+ | // (WebKit defaults to false instead of true, IE too, if it's in an optgroup) | ||
+ | support.optSelected = opt.selected; | ||
+ | |||
+ | // Tests for enctype support on a form (#6743) | ||
+ | support.enctype = !!document.createElement("form").enctype; | ||
+ | |||
+ | // Makes sure cloning an html5 element does not cause problems | ||
+ | // Where outerHTML is undefined, this still works | ||
+ | support.html5Clone = document.createElement("nav").cloneNode( true ).outerHTML !== "<:nav></:nav>"; | ||
+ | |||
+ | // Will be defined later | ||
+ | support.inlineBlockNeedsLayout = false; | ||
+ | support.shrinkWrapBlocks = false; | ||
+ | support.pixelPosition = false; | ||
+ | support.deleteExpando = true; | ||
+ | support.noCloneEvent = true; | ||
+ | support.reliableMarginRight = true; | ||
+ | support.boxSizingReliable = true; | ||
+ | |||
+ | // Make sure checked status is properly cloned | ||
+ | input.checked = true; | ||
+ | support.noCloneChecked = input.cloneNode( true ).checked; | ||
+ | |||
+ | // Make sure that the options inside disabled selects aren't marked as disabled | ||
+ | // (WebKit marks them as disabled) | ||
+ | select.disabled = true; | ||
+ | support.optDisabled = !opt.disabled; | ||
+ | |||
+ | // Support: IE<9 | ||
+ | try { | ||
+ | delete div.test; | ||
+ | } catch( e ) { | ||
+ | support.deleteExpando = false; | ||
+ | } | ||
+ | |||
+ | // Check if we can trust getAttribute("value") | ||
+ | input = document.createElement("input"); | ||
+ | input.setAttribute( "value", "" ); | ||
+ | support.input = input.getAttribute( "value" ) === ""; | ||
+ | |||
+ | // Check if an input maintains its value after becoming a radio | ||
+ | input.value = "t"; | ||
+ | input.setAttribute( "type", "radio" ); | ||
+ | support.radioValue = input.value === "t"; | ||
+ | |||
+ | // #11217 - WebKit loses check when the name is after the checked attribute | ||
+ | input.setAttribute( "checked", "t" ); | ||
+ | input.setAttribute( "name", "t" ); | ||
+ | |||
+ | fragment = document.createDocumentFragment(); | ||
+ | fragment.appendChild( input ); | ||
+ | |||
+ | // Check if a disconnected checkbox will retain its checked | ||
+ | // value of true after appended to the DOM (IE6/7) | ||
+ | support.appendChecked = input.checked; | ||
+ | |||
+ | // WebKit doesn't clone checked state correctly in fragments | ||
+ | support.checkClone = fragment.cloneNode( true ).cloneNode( true ).lastChild.checked; | ||
+ | |||
+ | // Support: IE<9 | ||
+ | // Opera does not clone events (and typeof div.attachEvent === undefined). | ||
+ | // IE9-10 clones events bound via attachEvent, but they don't trigger with .click() | ||
+ | if ( div.attachEvent ) { | ||
+ | div.attachEvent( "onclick", function() { | ||
+ | support.noCloneEvent = false; | ||
+ | }); | ||
+ | |||
+ | div.cloneNode( true ).click(); | ||
+ | } | ||
+ | |||
+ | // Support: IE<9 (lack submit/change bubble), Firefox 17+ (lack focusin event) | ||
+ | // Beware of CSP restrictions (https://developer.mozilla.org/en/Security/CSP) | ||
+ | for ( i in { submit: true, change: true, focusin: true }) { | ||
+ | div.setAttribute( eventName = "on" + i, "t" ); | ||
+ | |||
+ | support[ i + "Bubbles" ] = eventName in window || div.attributes[ eventName ].expando === false; | ||
+ | } | ||
+ | |||
+ | div.style.backgroundClip = "content-box"; | ||
+ | div.cloneNode( true ).style.backgroundClip = ""; | ||
+ | support.clearCloneStyle = div.style.backgroundClip === "content-box"; | ||
+ | |||
+ | // Support: IE<9 | ||
+ | // Iteration over object's inherited properties before its own. | ||
+ | for ( i in jQuery( support ) ) { | ||
+ | break; | ||
+ | } | ||
+ | support.ownLast = i !== "0"; | ||
+ | |||
+ | // Run tests that need a body at doc ready | ||
+ | jQuery(function() { | ||
+ | var container, marginDiv, tds, | ||
+ | divReset = "padding:0;margin:0;border:0;display:block;box-sizing:content-box;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;", | ||
+ | body = document.getElementsByTagName("body")[0]; | ||
+ | |||
+ | if ( !body ) { | ||
+ | // Return for frameset docs that don't have a body | ||
+ | return; | ||
+ | } | ||
+ | |||
+ | container = document.createElement("div"); | ||
+ | container.style.cssText = "border:0;width:0;height:0;position:absolute;top:0;left:-9999px;margin-top:1px"; | ||
+ | |||
+ | body.appendChild( container ).appendChild( div ); | ||
+ | |||
+ | // Support: IE8 | ||
+ | // Check if table cells still have offsetWidth/Height when they are set | ||
+ | // to display:none and there are still other visible table cells in a | ||
+ | // table row; if so, offsetWidth/Height are not reliable for use when | ||
+ | // determining if an element has been hidden directly using | ||
+ | // display:none (it is still safe to use offsets if a parent element is | ||
+ | // hidden; don safety goggles and see bug #4512 for more information). | ||
+ | div.innerHTML = "<table><tr><td></td><td>t</td></tr></table>"; | ||
+ | tds = div.getElementsByTagName("td"); | ||
+ | tds[ 0 ].style.cssText = "padding:0;margin:0;border:0;display:none"; | ||
+ | isSupported = ( tds[ 0 ].offsetHeight === 0 ); | ||
+ | |||
+ | tds[ 0 ].style.display = ""; | ||
+ | tds[ 1 ].style.display = "none"; | ||
+ | |||
+ | // Support: IE8 | ||
+ | // Check if empty table cells still have offsetWidth/Height | ||
+ | support.reliableHiddenOffsets = isSupported && ( tds[ 0 ].offsetHeight === 0 ); | ||
+ | |||
+ | // Check box-sizing and margin behavior. | ||
+ | div.innerHTML = ""; | ||
+ | div.style.cssText = "box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%;"; | ||
+ | |||
+ | // Workaround failing boxSizing test due to offsetWidth returning wrong value | ||
+ | // with some non-1 values of body zoom, ticket #13543 | ||
+ | jQuery.swap( body, body.style.zoom != null ? { zoom: 1 } : {}, function() { | ||
+ | support.boxSizing = div.offsetWidth === 4; | ||
+ | }); | ||
+ | |||
+ | // Use window.getComputedStyle because jsdom on node.js will break without it. | ||
+ | if ( window.getComputedStyle ) { | ||
+ | support.pixelPosition = ( window.getComputedStyle( div, null ) || {} ).top !== "1%"; | ||
+ | support.boxSizingReliable = ( window.getComputedStyle( div, null ) || { width: "4px" } ).width === "4px"; | ||
+ | |||
+ | // Check if div with explicit width and no margin-right incorrectly | ||
+ | // gets computed margin-right based on width of container. (#3333) | ||
+ | // Fails in WebKit before Feb 2011 nightlies | ||
+ | // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right | ||
+ | marginDiv = div.appendChild( document.createElement("div") ); | ||
+ | marginDiv.style.cssText = div.style.cssText = divReset; | ||
+ | marginDiv.style.marginRight = marginDiv.style.width = "0"; | ||
+ | div.style.width = "1px"; | ||
+ | |||
+ | support.reliableMarginRight = | ||
+ | !parseFloat( ( window.getComputedStyle( marginDiv, null ) || {} ).marginRight ); | ||
+ | } | ||
+ | |||
+ | if ( typeof div.style.zoom !== core_strundefined ) { | ||
+ | // Support: IE<8 | ||
+ | // Check if natively block-level elements act like inline-block | ||
+ | // elements when setting their display to 'inline' and giving | ||
+ | // them layout | ||
+ | div.innerHTML = ""; | ||
+ | div.style.cssText = divReset + "width:1px;padding:1px;display:inline;zoom:1"; | ||
+ | support.inlineBlockNeedsLayout = ( div.offsetWidth === 3 ); | ||
+ | |||
+ | // Support: IE6 | ||
+ | // Check if elements with layout shrink-wrap their children | ||
+ | div.style.display = "block"; | ||
+ | div.innerHTML = "<div></div>"; | ||
+ | div.firstChild.style.width = "5px"; | ||
+ | support.shrinkWrapBlocks = ( div.offsetWidth !== 3 ); | ||
+ | |||
+ | if ( support.inlineBlockNeedsLayout ) { | ||
+ | // Prevent IE 6 from affecting layout for positioned elements #11048 | ||
+ | // Prevent IE from shrinking the body in IE 7 mode #12869 | ||
+ | // Support: IE<8 | ||
+ | body.style.zoom = 1; | ||
+ | } | ||
+ | } | ||
+ | |||
+ | body.removeChild( container ); | ||
+ | |||
+ | // Null elements to avoid leaks in IE | ||
+ | container = div = tds = marginDiv = null; | ||
+ | }); | ||
+ | |||
+ | // Null elements to avoid leaks in IE | ||
+ | all = select = fragment = opt = a = input = null; | ||
+ | |||
+ | return support; | ||
+ | })({}); | ||
+ | |||
+ | var rbrace = /(?:\{[\s\S]*\}|\[[\s\S]*\])$/, | ||
+ | rmultiDash = /([A-Z])/g; | ||
+ | |||
+ | function internalData( elem, name, data, pvt /* Internal Use Only */ ){ | ||
+ | if ( !jQuery.acceptData( elem ) ) { | ||
+ | return; | ||
+ | } | ||
+ | |||
+ | var ret, thisCache, | ||
+ | internalKey = jQuery.expando, | ||
+ | |||
+ | // We have to handle DOM nodes and JS objects differently because IE6-7 | ||
+ | // can't GC object references properly across the DOM-JS boundary | ||
+ | isNode = elem.nodeType, | ||
+ | |||
+ | // Only DOM nodes need the global jQuery cache; JS object data is | ||
+ | // attached directly to the object so GC can occur automatically | ||
+ | cache = isNode ? jQuery.cache : elem, | ||
+ | |||
+ | // Only defining an ID for JS objects if its cache already exists allows | ||
+ | // the code to shortcut on the same path as a DOM node with no cache | ||
+ | id = isNode ? elem[ internalKey ] : elem[ internalKey ] && internalKey; | ||
+ | |||
+ | // Avoid doing any more work than we need to when trying to get data on an | ||
+ | // object that has no data at all | ||
+ | if ( (!id || !cache[id] || (!pvt && !cache[id].data)) && data === undefined && typeof name === "string" ) { | ||
+ | return; | ||
+ | } | ||
+ | |||
+ | if ( !id ) { | ||
+ | // Only DOM nodes need a new unique ID for each element since their data | ||
+ | // ends up in the global cache | ||
+ | if ( isNode ) { | ||
+ | id = elem[ internalKey ] = core_deletedIds.pop() || jQuery.guid++; | ||
+ | } else { | ||
+ | id = internalKey; | ||
+ | } | ||
+ | } | ||
+ | |||
+ | if ( !cache[ id ] ) { | ||
+ | // Avoid exposing jQuery metadata on plain JS objects when the object | ||
+ | // is serialized using JSON.stringify | ||
+ | cache[ id ] = isNode ? {} : { toJSON: jQuery.noop }; | ||
+ | } | ||
+ | |||
+ | // An object can be passed to jQuery.data instead of a key/value pair; this gets | ||
+ | // shallow copied over onto the existing cache | ||
+ | if ( typeof name === "object" || typeof name === "function" ) { | ||
+ | if ( pvt ) { | ||
+ | cache[ id ] = jQuery.extend( cache[ id ], name ); | ||
+ | } else { | ||
+ | cache[ id ].data = jQuery.extend( cache[ id ].data, name ); | ||
+ | } | ||
+ | } | ||
+ | |||
+ | thisCache = cache[ id ]; | ||
+ | |||
+ | // jQuery data() is stored in a separate object inside the object's internal data | ||
+ | // cache in order to avoid key collisions between internal data and user-defined | ||
+ | // data. | ||
+ | if ( !pvt ) { | ||
+ | if ( !thisCache.data ) { | ||
+ | thisCache.data = {}; | ||
+ | } | ||
+ | |||
+ | thisCache = thisCache.data; | ||
+ | } | ||
+ | |||
+ | if ( data !== undefined ) { | ||
+ | thisCache[ jQuery.camelCase( name ) ] = data; | ||
+ | } | ||
+ | |||
+ | // Check for both converted-to-camel and non-converted data property names | ||
+ | // If a data property was specified | ||
+ | if ( typeof name === "string" ) { | ||
+ | |||
+ | // First Try to find as-is property data | ||
+ | ret = thisCache[ name ]; | ||
+ | |||
+ | // Test for null|undefined property data | ||
+ | if ( ret == null ) { | ||
+ | |||
+ | // Try to find the camelCased property | ||
+ | ret = thisCache[ jQuery.camelCase( name ) ]; | ||
+ | } | ||
+ | } else { | ||
+ | ret = thisCache; | ||
+ | } | ||
+ | |||
+ | return ret; | ||
+ | } | ||
+ | |||
+ | function internalRemoveData( elem, name, pvt ) { | ||
+ | if ( !jQuery.acceptData( elem ) ) { | ||
+ | return; | ||
+ | } | ||
+ | |||
+ | var thisCache, i, | ||
+ | isNode = elem.nodeType, | ||
+ | |||
+ | // See jQuery.data for more information | ||
+ | cache = isNode ? jQuery.cache : elem, | ||
+ | id = isNode ? elem[ jQuery.expando ] : jQuery.expando; | ||
+ | |||
+ | // If there is already no cache entry for this object, there is no | ||
+ | // purpose in continuing | ||
+ | if ( !cache[ id ] ) { | ||
+ | return; | ||
+ | } | ||
+ | |||
+ | if ( name ) { | ||
+ | |||
+ | thisCache = pvt ? cache[ id ] : cache[ id ].data; | ||
+ | |||
+ | if ( thisCache ) { | ||
+ | |||
+ | // Support array or space separated string names for data keys | ||
+ | if ( !jQuery.isArray( name ) ) { | ||
+ | |||
+ | // try the string as a key before any manipulation | ||
+ | if ( name in thisCache ) { | ||
+ | name = [ name ]; | ||
+ | } else { | ||
+ | |||
+ | // split the camel cased version by spaces unless a key with the spaces exists | ||
+ | name = jQuery.camelCase( name ); | ||
+ | if ( name in thisCache ) { | ||
+ | name = [ name ]; | ||
+ | } else { | ||
+ | name = name.split(" "); | ||
+ | } | ||
+ | } | ||
+ | } else { | ||
+ | // If "name" is an array of keys... | ||
+ | // When data is initially created, via ("key", "val") signature, | ||
+ | // keys will be converted to camelCase. | ||
+ | // Since there is no way to tell _how_ a key was added, remove | ||
+ | // both plain key and camelCase key. #12786 | ||
+ | // This will only penalize the array argument path. | ||
+ | name = name.concat( jQuery.map( name, jQuery.camelCase ) ); | ||
+ | } | ||
+ | |||
+ | i = name.length; | ||
+ | while ( i-- ) { | ||
+ | delete thisCache[ name[i] ]; | ||
+ | } | ||
+ | |||
+ | // If there is no data left in the cache, we want to continue | ||
+ | // and let the cache object itself get destroyed | ||
+ | if ( pvt ? !isEmptyDataObject(thisCache) : !jQuery.isEmptyObject(thisCache) ) { | ||
+ | return; | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | |||
+ | // See jQuery.data for more information | ||
+ | if ( !pvt ) { | ||
+ | delete cache[ id ].data; | ||
+ | |||
+ | // Don't destroy the parent cache unless the internal data object | ||
+ | // had been the only thing left in it | ||
+ | if ( !isEmptyDataObject( cache[ id ] ) ) { | ||
+ | return; | ||
+ | } | ||
+ | } | ||
+ | |||
+ | // Destroy the cache | ||
+ | if ( isNode ) { | ||
+ | jQuery.cleanData( [ elem ], true ); | ||
+ | |||
+ | // Use delete when supported for expandos or `cache` is not a window per isWindow (#10080) | ||
+ | /* jshint eqeqeq: false */ | ||
+ | } else if ( jQuery.support.deleteExpando || cache != cache.window ) { | ||
+ | /* jshint eqeqeq: true */ | ||
+ | delete cache[ id ]; | ||
+ | |||
+ | // When all else fails, null | ||
+ | } else { | ||
+ | cache[ id ] = null; | ||
+ | } | ||
+ | } | ||
+ | |||
+ | jQuery.extend({ | ||
+ | cache: {}, | ||
+ | |||
+ | // The following elements throw uncatchable exceptions if you | ||
+ | // attempt to add expando properties to them. | ||
+ | noData: { | ||
+ | "applet": true, | ||
+ | "embed": true, | ||
+ | // Ban all objects except for Flash (which handle expandos) | ||
+ | "object": "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" | ||
+ | }, | ||
+ | |||
+ | hasData: function( elem ) { | ||
+ | elem = elem.nodeType ? jQuery.cache[ elem[jQuery.expando] ] : elem[ jQuery.expando ]; | ||
+ | return !!elem && !isEmptyDataObject( elem ); | ||
+ | }, | ||
+ | |||
+ | data: function( elem, name, data ) { | ||
+ | return internalData( elem, name, data ); | ||
+ | }, | ||
+ | |||
+ | removeData: function( elem, name ) { | ||
+ | return internalRemoveData( elem, name ); | ||
+ | }, | ||
+ | |||
+ | // For internal use only. | ||
+ | _data: function( elem, name, data ) { | ||
+ | return internalData( elem, name, data, true ); | ||
+ | }, | ||
+ | |||
+ | _removeData: function( elem, name ) { | ||
+ | return internalRemoveData( elem, name, true ); | ||
+ | }, | ||
+ | |||
+ | // A method for determining if a DOM node can handle the data expando | ||
+ | acceptData: function( elem ) { | ||
+ | // Do not set data on non-element because it will not be cleared (#8335). | ||
+ | if ( elem.nodeType && elem.nodeType !== 1 && elem.nodeType !== 9 ) { | ||
+ | return false; | ||
+ | } | ||
+ | |||
+ | var noData = elem.nodeName && jQuery.noData[ elem.nodeName.toLowerCase() ]; | ||
+ | |||
+ | // nodes accept data unless otherwise specified; rejection can be conditional | ||
+ | return !noData || noData !== true && elem.getAttribute("classid") === noData; | ||
+ | } | ||
+ | }); | ||
+ | |||
+ | jQuery.fn.extend({ | ||
+ | data: function( key, value ) { | ||
+ | var attrs, name, | ||
+ | data = null, | ||
+ | i = 0, | ||
+ | elem = this[0]; | ||
+ | |||
+ | // Special expections of .data basically thwart jQuery.access, | ||
+ | // so implement the relevant behavior ourselves | ||
+ | |||
+ | // Gets all values | ||
+ | if ( key === undefined ) { | ||
+ | if ( this.length ) { | ||
+ | data = jQuery.data( elem ); | ||
+ | |||
+ | if ( elem.nodeType === 1 && !jQuery._data( elem, "parsedAttrs" ) ) { | ||
+ | attrs = elem.attributes; | ||
+ | for ( ; i < attrs.length; i++ ) { | ||
+ | name = attrs[i].name; | ||
+ | |||
+ | if ( name.indexOf("data-") === 0 ) { | ||
+ | name = jQuery.camelCase( name.slice(5) ); | ||
+ | |||
+ | dataAttr( elem, name, data[ name ] ); | ||
+ | } | ||
+ | } | ||
+ | jQuery._data( elem, "parsedAttrs", true ); | ||
+ | } | ||
+ | } | ||
+ | |||
+ | return data; | ||
+ | } | ||
+ | |||
+ | // Sets multiple values | ||
+ | if ( typeof key === "object" ) { | ||
+ | return this.each(function() { | ||
+ | jQuery.data( this, key ); | ||
+ | }); | ||
+ | } | ||
+ | |||
+ | return arguments.length > 1 ? | ||
+ | |||
+ | // Sets one value | ||
+ | this.each(function() { | ||
+ | jQuery.data( this, key, value ); | ||
+ | }) : | ||
+ | |||
+ | // Gets one value | ||
+ | // Try to fetch any internally stored data first | ||
+ | elem ? dataAttr( elem, key, jQuery.data( elem, key ) ) : null; | ||
+ | }, | ||
+ | |||
+ | removeData: function( key ) { | ||
+ | return this.each(function() { | ||
+ | jQuery.removeData( this, key ); | ||
+ | }); | ||
+ | } | ||
+ | }); | ||
+ | |||
+ | function dataAttr( elem, key, data ) { | ||
+ | // If nothing was found internally, try to fetch any | ||
+ | // data from the HTML5 data-* attribute | ||
+ | if ( data === undefined && elem.nodeType === 1 ) { | ||
+ | |||
+ | var name = "data-" + key.replace( rmultiDash, "-$1" ).toLowerCase(); | ||
+ | |||
+ | data = elem.getAttribute( name ); | ||
+ | |||
+ | if ( typeof data === "string" ) { | ||
+ | try { | ||
+ | data = data === "true" ? true : | ||
+ | data === "false" ? false : | ||
+ | data === "null" ? null : | ||
+ | // Only convert to a number if it doesn't change the string | ||
+ | +data + "" === data ? +data : | ||
+ | rbrace.test( data ) ? jQuery.parseJSON( data ) : | ||
+ | data; | ||
+ | } catch( e ) {} | ||
+ | |||
+ | // Make sure we set the data so it isn't changed later | ||
+ | jQuery.data( elem, key, data ); | ||
+ | |||
+ | } else { | ||
+ | data = undefined; | ||
+ | } | ||
+ | } | ||
+ | |||
+ | return data; | ||
+ | } | ||
+ | |||
+ | // checks a cache object for emptiness | ||
+ | function isEmptyDataObject( obj ) { | ||
+ | var name; | ||
+ | for ( name in obj ) { | ||
+ | |||
+ | // if the public data object is empty, the private is still empty | ||
+ | if ( name === "data" && jQuery.isEmptyObject( obj[name] ) ) { | ||
+ | continue; | ||
+ | } | ||
+ | if ( name !== "toJSON" ) { | ||
+ | return false; | ||
+ | } | ||
+ | } | ||
+ | |||
+ | return true; | ||
+ | } | ||
+ | jQuery.extend({ | ||
+ | queue: function( elem, type, data ) { | ||
+ | var queue; | ||
+ | |||
+ | if ( elem ) { | ||
+ | type = ( type || "fx" ) + "queue"; | ||
+ | queue = jQuery._data( elem, type ); | ||
+ | |||
+ | // Speed up dequeue by getting out quickly if this is just a lookup | ||
+ | if ( data ) { | ||
+ | if ( !queue || jQuery.isArray(data) ) { | ||
+ | queue = jQuery._data( elem, type, jQuery.makeArray(data) ); | ||
+ | } else { | ||
+ | queue.push( data ); | ||
+ | } | ||
+ | } | ||
+ | return queue || []; | ||
+ | } | ||
+ | }, | ||
+ | |||
+ | dequeue: function( elem, type ) { | ||
+ | type = type || "fx"; | ||
+ | |||
+ | var queue = jQuery.queue( elem, type ), | ||
+ | startLength = queue.length, | ||
+ | fn = queue.shift(), | ||
+ | hooks = jQuery._queueHooks( elem, type ), | ||
+ | next = function() { | ||
+ | jQuery.dequeue( elem, type ); | ||
+ | }; | ||
+ | |||
+ | // If the fx queue is dequeued, always remove the progress sentinel | ||
+ | if ( fn === "inprogress" ) { | ||
+ | fn = queue.shift(); | ||
+ | startLength--; | ||
+ | } | ||
+ | |||
+ | if ( fn ) { | ||
+ | |||
+ | // Add a progress sentinel to prevent the fx queue from being | ||
+ | // automatically dequeued | ||
+ | if ( type === "fx" ) { | ||
+ | queue.unshift( "inprogress" ); | ||
+ | } | ||
+ | |||
+ | // clear up the last queue stop function | ||
+ | delete hooks.stop; | ||
+ | fn.call( elem, next, hooks ); | ||
+ | } | ||
+ | |||
+ | if ( !startLength && hooks ) { | ||
+ | hooks.empty.fire(); | ||
+ | } | ||
+ | }, | ||
+ | |||
+ | // not intended for public consumption - generates a queueHooks object, or returns the current one | ||
+ | _queueHooks: function( elem, type ) { | ||
+ | var key = type + "queueHooks"; | ||
+ | return jQuery._data( elem, key ) || jQuery._data( elem, key, { | ||
+ | empty: jQuery.Callbacks("once memory").add(function() { | ||
+ | jQuery._removeData( elem, type + "queue" ); | ||
+ | jQuery._removeData( elem, key ); | ||
+ | }) | ||
+ | }); | ||
+ | } | ||
+ | }); | ||
+ | |||
+ | jQuery.fn.extend({ | ||
+ | queue: function( type, data ) { | ||
+ | var setter = 2; | ||
+ | |||
+ | if ( typeof type !== "string" ) { | ||
+ | data = type; | ||
+ | type = "fx"; | ||
+ | setter--; | ||
+ | } | ||
+ | |||
+ | if ( arguments.length < setter ) { | ||
+ | return jQuery.queue( this[0], type ); | ||
+ | } | ||
+ | |||
+ | return data === undefined ? | ||
+ | this : | ||
+ | this.each(function() { | ||
+ | var queue = jQuery.queue( this, type, data ); | ||
+ | |||
+ | // ensure a hooks for this queue | ||
+ | jQuery._queueHooks( this, type ); | ||
+ | |||
+ | if ( type === "fx" && queue[0] !== "inprogress" ) { | ||
+ | jQuery.dequeue( this, type ); | ||
+ | } | ||
+ | }); | ||
+ | }, | ||
+ | dequeue: function( type ) { | ||
+ | return this.each(function() { | ||
+ | jQuery.dequeue( this, type ); | ||
+ | }); | ||
+ | }, | ||
+ | // Based off of the plugin by Clint Helfers, with permission. | ||
+ | // http://blindsignals.com/index.php/2009/07/jquery-delay/ | ||
+ | delay: function( time, type ) { | ||
+ | time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time; | ||
+ | type = type || "fx"; | ||
+ | |||
+ | return this.queue( type, function( next, hooks ) { | ||
+ | var timeout = setTimeout( next, time ); | ||
+ | hooks.stop = function() { | ||
+ | clearTimeout( timeout ); | ||
+ | }; | ||
+ | }); | ||
+ | }, | ||
+ | clearQueue: function( type ) { | ||
+ | return this.queue( type || "fx", [] ); | ||
+ | }, | ||
+ | // Get a promise resolved when queues of a certain type | ||
+ | // are emptied (fx is the type by default) | ||
+ | promise: function( type, obj ) { | ||
+ | var tmp, | ||
+ | count = 1, | ||
+ | defer = jQuery.Deferred(), | ||
+ | elements = this, | ||
+ | i = this.length, | ||
+ | resolve = function() { | ||
+ | if ( !( --count ) ) { | ||
+ | defer.resolveWith( elements, [ elements ] ); | ||
+ | } | ||
+ | }; | ||
+ | |||
+ | if ( typeof type !== "string" ) { | ||
+ | obj = type; | ||
+ | type = undefined; | ||
+ | } | ||
+ | type = type || "fx"; | ||
+ | |||
+ | while( i-- ) { | ||
+ | tmp = jQuery._data( elements[ i ], type + "queueHooks" ); | ||
+ | if ( tmp && tmp.empty ) { | ||
+ | count++; | ||
+ | tmp.empty.add( resolve ); | ||
+ | } | ||
+ | } | ||
+ | resolve(); | ||
+ | return defer.promise( obj ); | ||
+ | } | ||
+ | }); | ||
+ | var nodeHook, boolHook, | ||
+ | rclass = /[\t\r\n\f]/g, | ||
+ | rreturn = /\r/g, | ||
+ | rfocusable = /^(?:input|select|textarea|button|object)$/i, | ||
+ | rclickable = /^(?:a|area)$/i, | ||
+ | ruseDefault = /^(?:checked|selected)$/i, | ||
+ | getSetAttribute = jQuery.support.getSetAttribute, | ||
+ | getSetInput = jQuery.support.input; | ||
+ | |||
+ | jQuery.fn.extend({ | ||
+ | attr: function( name, value ) { | ||
+ | return jQuery.access( this, jQuery.attr, name, value, arguments.length > 1 ); | ||
+ | }, | ||
+ | |||
+ | removeAttr: function( name ) { | ||
+ | return this.each(function() { | ||
+ | jQuery.removeAttr( this, name ); | ||
+ | }); | ||
+ | }, | ||
+ | |||
+ | prop: function( name, value ) { | ||
+ | return jQuery.access( this, jQuery.prop, name, value, arguments.length > 1 ); | ||
+ | }, | ||
+ | |||
+ | removeProp: function( name ) { | ||
+ | name = jQuery.propFix[ name ] || name; | ||
+ | return this.each(function() { | ||
+ | // try/catch handles cases where IE balks (such as removing a property on window) | ||
+ | try { | ||
+ | this[ name ] = undefined; | ||
+ | delete this[ name ]; | ||
+ | } catch( e ) {} | ||
+ | }); | ||
+ | }, | ||
+ | |||
+ | addClass: function( value ) { | ||
+ | var classes, elem, cur, clazz, j, | ||
+ | i = 0, | ||
+ | len = this.length, | ||
+ | proceed = typeof value === "string" && value; | ||
+ | |||
+ | if ( jQuery.isFunction( value ) ) { | ||
+ | return this.each(function( j ) { | ||
+ | jQuery( this ).addClass( value.call( this, j, this.className ) ); | ||
+ | }); | ||
+ | } | ||
+ | |||
+ | if ( proceed ) { | ||
+ | // The disjunction here is for better compressibility (see removeClass) | ||
+ | classes = ( value || "" ).match( core_rnotwhite ) || []; | ||
+ | |||
+ | for ( ; i < len; i++ ) { | ||
+ | elem = this[ i ]; | ||
+ | cur = elem.nodeType === 1 && ( elem.className ? | ||
+ | ( " " + elem.className + " " ).replace( rclass, " " ) : | ||
+ | " " | ||
+ | ); | ||
+ | |||
+ | if ( cur ) { | ||
+ | j = 0; | ||
+ | while ( (clazz = classes[j++]) ) { | ||
+ | if ( cur.indexOf( " " + clazz + " " ) < 0 ) { | ||
+ | cur += clazz + " "; | ||
+ | } | ||
+ | } | ||
+ | elem.className = jQuery.trim( cur ); | ||
+ | |||
+ | } | ||
+ | } | ||
+ | } | ||
+ | |||
+ | return this; | ||
+ | }, | ||
+ | |||
+ | removeClass: function( value ) { | ||
+ | var classes, elem, cur, clazz, j, | ||
+ | i = 0, | ||
+ | len = this.length, | ||
+ | proceed = arguments.length === 0 || typeof value === "string" && value; | ||
+ | |||
+ | if ( jQuery.isFunction( value ) ) { | ||
+ | return this.each(function( j ) { | ||
+ | jQuery( this ).removeClass( value.call( this, j, this.className ) ); | ||
+ | }); | ||
+ | } | ||
+ | if ( proceed ) { | ||
+ | classes = ( value || "" ).match( core_rnotwhite ) || []; | ||
+ | |||
+ | for ( ; i < len; i++ ) { | ||
+ | elem = this[ i ]; | ||
+ | // This expression is here for better compressibility (see addClass) | ||
+ | cur = elem.nodeType === 1 && ( elem.className ? | ||
+ | ( " " + elem.className + " " ).replace( rclass, " " ) : | ||
+ | "" | ||
+ | ); | ||
+ | |||
+ | if ( cur ) { | ||
+ | j = 0; | ||
+ | while ( (clazz = classes[j++]) ) { | ||
+ | // Remove *all* instances | ||
+ | while ( cur.indexOf( " " + clazz + " " ) >= 0 ) { | ||
+ | cur = cur.replace( " " + clazz + " ", " " ); | ||
+ | } | ||
+ | } | ||
+ | elem.className = value ? jQuery.trim( cur ) : ""; | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | |||
+ | return this; | ||
+ | }, | ||
+ | |||
+ | toggleClass: function( value, stateVal ) { | ||
+ | var type = typeof value; | ||
+ | |||
+ | if ( typeof stateVal === "boolean" && type === "string" ) { | ||
+ | return stateVal ? this.addClass( value ) : this.removeClass( value ); | ||
+ | } | ||
+ | |||
+ | if ( jQuery.isFunction( value ) ) { | ||
+ | return this.each(function( i ) { | ||
+ | jQuery( this ).toggleClass( value.call(this, i, this.className, stateVal), stateVal ); | ||
+ | }); | ||
+ | } | ||
+ | |||
+ | return this.each(function() { | ||
+ | if ( type === "string" ) { | ||
+ | // toggle individual class names | ||
+ | var className, | ||
+ | i = 0, | ||
+ | self = jQuery( this ), | ||
+ | classNames = value.match( core_rnotwhite ) || []; | ||
+ | |||
+ | while ( (className = classNames[ i++ ]) ) { | ||
+ | // check each className given, space separated list | ||
+ | if ( self.hasClass( className ) ) { | ||
+ | self.removeClass( className ); | ||
+ | } else { | ||
+ | self.addClass( className ); | ||
+ | } | ||
+ | } | ||
+ | |||
+ | // Toggle whole class name | ||
+ | } else if ( type === core_strundefined || type === "boolean" ) { | ||
+ | if ( this.className ) { | ||
+ | // store className if set | ||
+ | jQuery._data( this, "__className__", this.className ); | ||
+ | } | ||
+ | |||
+ | // If the element has a class name or if we're passed "false", | ||
+ | // then remove the whole classname (if there was one, the above saved it). | ||
+ | // Otherwise bring back whatever was previously saved (if anything), | ||
+ | // falling back to the empty string if nothing was stored. | ||
+ | this.className = this.className || value === false ? "" : jQuery._data( this, "__className__" ) || ""; | ||
+ | } | ||
+ | }); | ||
+ | }, | ||
+ | |||
+ | hasClass: function( selector ) { | ||
+ | var className = " " + selector + " ", | ||
+ | i = 0, | ||
+ | l = this.length; | ||
+ | for ( ; i < l; i++ ) { | ||
+ | if ( this[i].nodeType === 1 && (" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) >= 0 ) { | ||
+ | return true; | ||
+ | } | ||
+ | } | ||
+ | |||
+ | return false; | ||
+ | }, | ||
+ | |||
+ | val: function( value ) { | ||
+ | var ret, hooks, isFunction, | ||
+ | elem = this[0]; | ||
+ | |||
+ | if ( !arguments.length ) { | ||
+ | if ( elem ) { | ||
+ | hooks = jQuery.valHooks[ elem.type ] || jQuery.valHooks[ elem.nodeName.toLowerCase() ]; | ||
+ | |||
+ | if ( hooks && "get" in hooks && (ret = hooks.get( elem, "value" )) !== undefined ) { | ||
+ | return ret; | ||
+ | } | ||
+ | |||
+ | ret = elem.value; | ||
+ | |||
+ | return typeof ret === "string" ? | ||
+ | // handle most common string cases | ||
+ | ret.replace(rreturn, "") : | ||
+ | // handle cases where value is null/undef or number | ||
+ | ret == null ? "" : ret; | ||
+ | } | ||
+ | |||
+ | return; | ||
+ | } | ||
+ | |||
+ | isFunction = jQuery.isFunction( value ); | ||
+ | |||
+ | return this.each(function( i ) { | ||
+ | var val; | ||
+ | |||
+ | if ( this.nodeType !== 1 ) { | ||
+ | return; | ||
+ | } | ||
+ | |||
+ | if ( isFunction ) { | ||
+ | val = value.call( this, i, jQuery( this ).val() ); | ||
+ | } else { | ||
+ | val = value; | ||
+ | } | ||
+ | |||
+ | // Treat null/undefined as ""; convert numbers to string | ||
+ | if ( val == null ) { | ||
+ | val = ""; | ||
+ | } else if ( typeof val === "number" ) { | ||
+ | val += ""; | ||
+ | } else if ( jQuery.isArray( val ) ) { | ||
+ | val = jQuery.map(val, function ( value ) { | ||
+ | return value == null ? "" : value + ""; | ||
+ | }); | ||
+ | } | ||
+ | |||
+ | hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ]; | ||
+ | |||
+ | // If set returns undefined, fall back to normal setting | ||
+ | if ( !hooks || !("set" in hooks) || hooks.set( this, val, "value" ) === undefined ) { | ||
+ | this.value = val; | ||
+ | } | ||
+ | }); | ||
+ | } | ||
+ | }); | ||
+ | |||
+ | jQuery.extend({ | ||
+ | valHooks: { | ||
+ | option: { | ||
+ | get: function( elem ) { | ||
+ | // Use proper attribute retrieval(#6932, #12072) | ||
+ | var val = jQuery.find.attr( elem, "value" ); | ||
+ | return val != null ? | ||
+ | val : | ||
+ | elem.text; | ||
+ | } | ||
+ | }, | ||
+ | select: { | ||
+ | get: function( elem ) { | ||
+ | var value, option, | ||
+ | options = elem.options, | ||
+ | index = elem.selectedIndex, | ||
+ | one = elem.type === "select-one" || index < 0, | ||
+ | values = one ? null : [], | ||
+ | max = one ? index + 1 : options.length, | ||
+ | i = index < 0 ? | ||
+ | max : | ||
+ | one ? index : 0; | ||
+ | |||
+ | // Loop through all the selected options | ||
+ | for ( ; i < max; i++ ) { | ||
+ | option = options[ i ]; | ||
+ | |||
+ | // oldIE doesn't update selected after form reset (#2551) | ||
+ | if ( ( option.selected || i === index ) && | ||
+ | // Don't return options that are disabled or in a disabled optgroup | ||
+ | ( jQuery.support.optDisabled ? !option.disabled : option.getAttribute("disabled") === null ) && | ||
+ | ( !option.parentNode.disabled || !jQuery.nodeName( option.parentNode, "optgroup" ) ) ) { | ||
+ | |||
+ | // Get the specific value for the option | ||
+ | value = jQuery( option ).val(); | ||
+ | |||
+ | // We don't need an array for one selects | ||
+ | if ( one ) { | ||
+ | return value; | ||
+ | } | ||
+ | |||
+ | // Multi-Selects return an array | ||
+ | values.push( value ); | ||
+ | } | ||
+ | } | ||
+ | |||
+ | return values; | ||
+ | }, | ||
+ | |||
+ | set: function( elem, value ) { | ||
+ | var optionSet, option, | ||
+ | options = elem.options, | ||
+ | values = jQuery.makeArray( value ), | ||
+ | i = options.length; | ||
+ | |||
+ | while ( i-- ) { | ||
+ | option = options[ i ]; | ||
+ | if ( (option.selected = jQuery.inArray( jQuery(option).val(), values ) >= 0) ) { | ||
+ | optionSet = true; | ||
+ | } | ||
+ | } | ||
+ | |||
+ | // force browsers to behave consistently when non-matching value is set | ||
+ | if ( !optionSet ) { | ||
+ | elem.selectedIndex = -1; | ||
+ | } | ||
+ | return values; | ||
+ | } | ||
+ | } | ||
+ | }, | ||
+ | |||
+ | attr: function( elem, name, value ) { | ||
+ | var hooks, ret, | ||
+ | nType = elem.nodeType; | ||
+ | |||
+ | // don't get/set attributes on text, comment and attribute nodes | ||
+ | if ( !elem || nType === 3 || nType === 8 || nType === 2 ) { | ||
+ | return; | ||
+ | } | ||
+ | |||
+ | // Fallback to prop when attributes are not supported | ||
+ | if ( typeof elem.getAttribute === core_strundefined ) { | ||
+ | return jQuery.prop( elem, name, value ); | ||
+ | } | ||
+ | |||
+ | // All attributes are lowercase | ||
+ | // Grab necessary hook if one is defined | ||
+ | if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) { | ||
+ | name = name.toLowerCase(); | ||
+ | hooks = jQuery.attrHooks[ name ] || | ||
+ | ( jQuery.expr.match.bool.test( name ) ? boolHook : nodeHook ); | ||
+ | } | ||
+ | |||
+ | if ( value !== undefined ) { | ||
+ | |||
+ | if ( value === null ) { | ||
+ | jQuery.removeAttr( elem, name ); | ||
+ | |||
+ | } else if ( hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) { | ||
+ | return ret; | ||
+ | |||
+ | } else { | ||
+ | elem.setAttribute( name, value + "" ); | ||
+ | return value; | ||
+ | } | ||
+ | |||
+ | } else if ( hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ) { | ||
+ | return ret; | ||
+ | |||
+ | } else { | ||
+ | ret = jQuery.find.attr( elem, name ); | ||
+ | |||
+ | // Non-existent attributes return null, we normalize to undefined | ||
+ | return ret == null ? | ||
+ | undefined : | ||
+ | ret; | ||
+ | } | ||
+ | }, | ||
+ | |||
+ | removeAttr: function( elem, value ) { | ||
+ | var name, propName, | ||
+ | i = 0, | ||
+ | attrNames = value && value.match( core_rnotwhite ); | ||
+ | |||
+ | if ( attrNames && elem.nodeType === 1 ) { | ||
+ | while ( (name = attrNames[i++]) ) { | ||
+ | propName = jQuery.propFix[ name ] || name; | ||
+ | |||
+ | // Boolean attributes get special treatment (#10870) | ||
+ | if ( jQuery.expr.match.bool.test( name ) ) { | ||
+ | // Set corresponding property to false | ||
+ | if ( getSetInput && getSetAttribute || !ruseDefault.test( name ) ) { | ||
+ | elem[ propName ] = false; | ||
+ | // Support: IE<9 | ||
+ | // Also clear defaultChecked/defaultSelected (if appropriate) | ||
+ | } else { | ||
+ | elem[ jQuery.camelCase( "default-" + name ) ] = | ||
+ | elem[ propName ] = false; | ||
+ | } | ||
+ | |||
+ | // See #9699 for explanation of this approach (setting first, then removal) | ||
+ | } else { | ||
+ | jQuery.attr( elem, name, "" ); | ||
+ | } | ||
+ | |||
+ | elem.removeAttribute( getSetAttribute ? name : propName ); | ||
+ | } | ||
+ | } | ||
+ | }, | ||
+ | |||
+ | attrHooks: { | ||
+ | type: { | ||
+ | set: function( elem, value ) { | ||
+ | if ( !jQuery.support.radioValue && value === "radio" && jQuery.nodeName(elem, "input") ) { | ||
+ | // Setting the type on a radio button after the value resets the value in IE6-9 | ||
+ | // Reset value to default in case type is set after value during creation | ||
+ | var val = elem.value; | ||
+ | elem.setAttribute( "type", value ); | ||
+ | if ( val ) { | ||
+ | elem.value = val; | ||
+ | } | ||
+ | return value; | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | }, | ||
+ | |||
+ | propFix: { | ||
+ | "for": "htmlFor", | ||
+ | "class": "className" | ||
+ | }, | ||
+ | |||
+ | prop: function( elem, name, value ) { | ||
+ | var ret, hooks, notxml, | ||
+ | nType = elem.nodeType; | ||
+ | |||
+ | // don't get/set properties on text, comment and attribute nodes | ||
+ | if ( !elem || nType === 3 || nType === 8 || nType === 2 ) { | ||
+ | return; | ||
+ | } | ||
+ | |||
+ | notxml = nType !== 1 || !jQuery.isXMLDoc( elem ); | ||
+ | |||
+ | if ( notxml ) { | ||
+ | // Fix name and attach hooks | ||
+ | name = jQuery.propFix[ name ] || name; | ||
+ | hooks = jQuery.propHooks[ name ]; | ||
+ | } | ||
+ | |||
+ | if ( value !== undefined ) { | ||
+ | return hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ? | ||
+ | ret : | ||
+ | ( elem[ name ] = value ); | ||
+ | |||
+ | } else { | ||
+ | return hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ? | ||
+ | ret : | ||
+ | elem[ name ]; | ||
+ | } | ||
+ | }, | ||
+ | |||
+ | propHooks: { | ||
+ | tabIndex: { | ||
+ | get: function( elem ) { | ||
+ | // elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set | ||
+ | // http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/ | ||
+ | // Use proper attribute retrieval(#12072) | ||
+ | var tabindex = jQuery.find.attr( elem, "tabindex" ); | ||
+ | |||
+ | return tabindex ? | ||
+ | parseInt( tabindex, 10 ) : | ||
+ | rfocusable.test( elem.nodeName ) || rclickable.test( elem.nodeName ) && elem.href ? | ||
+ | 0 : | ||
+ | -1; | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | }); | ||
+ | |||
+ | // Hooks for boolean attributes | ||
+ | boolHook = { | ||
+ | set: function( elem, value, name ) { | ||
+ | if ( value === false ) { | ||
+ | // Remove boolean attributes when set to false | ||
+ | jQuery.removeAttr( elem, name ); | ||
+ | } else if ( getSetInput && getSetAttribute || !ruseDefault.test( name ) ) { | ||
+ | // IE<8 needs the *property* name | ||
+ | elem.setAttribute( !getSetAttribute && jQuery.propFix[ name ] || name, name ); | ||
+ | |||
+ | // Use defaultChecked and defaultSelected for oldIE | ||
+ | } else { | ||
+ | elem[ jQuery.camelCase( "default-" + name ) ] = elem[ name ] = true; | ||
+ | } | ||
+ | |||
+ | return name; | ||
+ | } | ||
+ | }; | ||
+ | jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( i, name ) { | ||
+ | var getter = jQuery.expr.attrHandle[ name ] || jQuery.find.attr; | ||
+ | |||
+ | jQuery.expr.attrHandle[ name ] = getSetInput && getSetAttribute || !ruseDefault.test( name ) ? | ||
+ | function( elem, name, isXML ) { | ||
+ | var fn = jQuery.expr.attrHandle[ name ], | ||
+ | ret = isXML ? | ||
+ | undefined : | ||
+ | /* jshint eqeqeq: false */ | ||
+ | (jQuery.expr.attrHandle[ name ] = undefined) != | ||
+ | getter( elem, name, isXML ) ? | ||
+ | |||
+ | name.toLowerCase() : | ||
+ | null; | ||
+ | jQuery.expr.attrHandle[ name ] = fn; | ||
+ | return ret; | ||
+ | } : | ||
+ | function( elem, name, isXML ) { | ||
+ | return isXML ? | ||
+ | undefined : | ||
+ | elem[ jQuery.camelCase( "default-" + name ) ] ? | ||
+ | name.toLowerCase() : | ||
+ | null; | ||
+ | }; | ||
+ | }); | ||
+ | |||
+ | // fix oldIE attroperties | ||
+ | if ( !getSetInput || !getSetAttribute ) { | ||
+ | jQuery.attrHooks.value = { | ||
+ | set: function( elem, value, name ) { | ||
+ | if ( jQuery.nodeName( elem, "input" ) ) { | ||
+ | // Does not return so that setAttribute is also used | ||
+ | elem.defaultValue = value; | ||
+ | } else { | ||
+ | // Use nodeHook if defined (#1954); otherwise setAttribute is fine | ||
+ | return nodeHook && nodeHook.set( elem, value, name ); | ||
+ | } | ||
+ | } | ||
+ | }; | ||
+ | } | ||
+ | |||
+ | // IE6/7 do not support getting/setting some attributes with get/setAttribute | ||
+ | if ( !getSetAttribute ) { | ||
+ | |||
+ | // Use this for any attribute in IE6/7 | ||
+ | // This fixes almost every IE6/7 issue | ||
+ | nodeHook = { | ||
+ | set: function( elem, value, name ) { | ||
+ | // Set the existing or create a new attribute node | ||
+ | var ret = elem.getAttributeNode( name ); | ||
+ | if ( !ret ) { | ||
+ | elem.setAttributeNode( | ||
+ | (ret = elem.ownerDocument.createAttribute( name )) | ||
+ | ); | ||
+ | } | ||
+ | |||
+ | ret.value = value += ""; | ||
+ | |||
+ | // Break association with cloned elements by also using setAttribute (#9646) | ||
+ | return name === "value" || value === elem.getAttribute( name ) ? | ||
+ | value : | ||
+ | undefined; | ||
+ | } | ||
+ | }; | ||
+ | jQuery.expr.attrHandle.id = jQuery.expr.attrHandle.name = jQuery.expr.attrHandle.coords = | ||
+ | // Some attributes are constructed with empty-string values when not defined | ||
+ | function( elem, name, isXML ) { | ||
+ | var ret; | ||
+ | return isXML ? | ||
+ | undefined : | ||
+ | (ret = elem.getAttributeNode( name )) && ret.value !== "" ? | ||
+ | ret.value : | ||
+ | null; | ||
+ | }; | ||
+ | jQuery.valHooks.button = { | ||
+ | get: function( elem, name ) { | ||
+ | var ret = elem.getAttributeNode( name ); | ||
+ | return ret && ret.specified ? | ||
+ | ret.value : | ||
+ | undefined; | ||
+ | }, | ||
+ | set: nodeHook.set | ||
+ | }; | ||
+ | |||
+ | // Set contenteditable to false on removals(#10429) | ||
+ | // Setting to empty string throws an error as an invalid value | ||
+ | jQuery.attrHooks.contenteditable = { | ||
+ | set: function( elem, value, name ) { | ||
+ | nodeHook.set( elem, value === "" ? false : value, name ); | ||
+ | } | ||
+ | }; | ||
+ | |||
+ | // Set width and height to auto instead of 0 on empty string( Bug #8150 ) | ||
+ | // This is for removals | ||
+ | jQuery.each([ "width", "height" ], function( i, name ) { | ||
+ | jQuery.attrHooks[ name ] = { | ||
+ | set: function( elem, value ) { | ||
+ | if ( value === "" ) { | ||
+ | elem.setAttribute( name, "auto" ); | ||
+ | return value; | ||
+ | } | ||
+ | } | ||
+ | }; | ||
+ | }); | ||
+ | } | ||
+ | |||
+ | |||
+ | // Some attributes require a special call on IE | ||
+ | // http://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx | ||
+ | if ( !jQuery.support.hrefNormalized ) { | ||
+ | // href/src property should get the full normalized URL (#10299/#12915) | ||
+ | jQuery.each([ "href", "src" ], function( i, name ) { | ||
+ | jQuery.propHooks[ name ] = { | ||
+ | get: function( elem ) { | ||
+ | return elem.getAttribute( name, 4 ); | ||
+ | } | ||
+ | }; | ||
+ | }); | ||
+ | } | ||
+ | |||
+ | if ( !jQuery.support.style ) { | ||
+ | jQuery.attrHooks.style = { | ||
+ | get: function( elem ) { | ||
+ | // Return undefined in the case of empty string | ||
+ | // Note: IE uppercases css property names, but if we were to .toLowerCase() | ||
+ | // .cssText, that would destroy case senstitivity in URL's, like in "background" | ||
+ | return elem.style.cssText || undefined; | ||
+ | }, | ||
+ | set: function( elem, value ) { | ||
+ | return ( elem.style.cssText = value + "" ); | ||
+ | } | ||
+ | }; | ||
+ | } | ||
+ | |||
+ | // Safari mis-reports the default selected property of an option | ||
+ | // Accessing the parent's selectedIndex property fixes it | ||
+ | if ( !jQuery.support.optSelected ) { | ||
+ | jQuery.propHooks.selected = { | ||
+ | get: function( elem ) { | ||
+ | var parent = elem.parentNode; | ||
+ | |||
+ | if ( parent ) { | ||
+ | parent.selectedIndex; | ||
+ | |||
+ | // Make sure that it also works with optgroups, see #5701 | ||
+ | if ( parent.parentNode ) { | ||
+ | parent.parentNode.selectedIndex; | ||
+ | } | ||
+ | } | ||
+ | return null; | ||
+ | } | ||
+ | }; | ||
+ | } | ||
+ | |||
+ | jQuery.each([ | ||
+ | "tabIndex", | ||
+ | "readOnly", | ||
+ | "maxLength", | ||
+ | "cellSpacing", | ||
+ | "cellPadding", | ||
+ | "rowSpan", | ||
+ | "colSpan", | ||
+ | "useMap", | ||
+ | "frameBorder", | ||
+ | "contentEditable" | ||
+ | ], function() { | ||
+ | jQuery.propFix[ this.toLowerCase() ] = this; | ||
+ | }); | ||
+ | |||
+ | // IE6/7 call enctype encoding | ||
+ | if ( !jQuery.support.enctype ) { | ||
+ | jQuery.propFix.enctype = "encoding"; | ||
+ | } | ||
+ | |||
+ | // Radios and checkboxes getter/setter | ||
+ | jQuery.each([ "radio", "checkbox" ], function() { | ||
+ | jQuery.valHooks[ this ] = { | ||
+ | set: function( elem, value ) { | ||
+ | if ( jQuery.isArray( value ) ) { | ||
+ | return ( elem.checked = jQuery.inArray( jQuery(elem).val(), value ) >= 0 ); | ||
+ | } | ||
+ | } | ||
+ | }; | ||
+ | if ( !jQuery.support.checkOn ) { | ||
+ | jQuery.valHooks[ this ].get = function( elem ) { | ||
+ | // Support: Webkit | ||
+ | // "" is returned instead of "on" if a value isn't specified | ||
+ | return elem.getAttribute("value") === null ? "on" : elem.value; | ||
+ | }; | ||
+ | } | ||
+ | }); | ||
+ | var rformElems = /^(?:input|select|textarea)$/i, | ||
+ | rkeyEvent = /^key/, | ||
+ | rmouseEvent = /^(?:mouse|contextmenu)|click/, | ||
+ | rfocusMorph = /^(?:focusinfocus|focusoutblur)$/, | ||
+ | rtypenamespace = /^([^.]*)(?:\.(.+)|)$/; | ||
+ | |||
+ | function returnTrue() { | ||
+ | return true; | ||
+ | } | ||
+ | |||
+ | function returnFalse() { | ||
+ | return false; | ||
+ | } | ||
+ | |||
+ | function safeActiveElement() { | ||
+ | try { | ||
+ | return document.activeElement; | ||
+ | } catch ( err ) { } | ||
+ | } | ||
+ | |||
+ | /* | ||
+ | * Helper functions for managing events -- not part of the public interface. | ||
+ | * Props to Dean Edwards' addEvent library for many of the ideas. | ||
+ | */ | ||
+ | jQuery.event = { | ||
+ | |||
+ | global: {}, | ||
+ | |||
+ | add: function( elem, types, handler, data, selector ) { | ||
+ | var tmp, events, t, handleObjIn, | ||
+ | special, eventHandle, handleObj, | ||
+ | handlers, type, namespaces, origType, | ||
+ | elemData = jQuery._data( elem ); | ||
+ | |||
+ | // Don't attach events to noData or text/comment nodes (but allow plain objects) | ||
+ | if ( !elemData ) { | ||
+ | return; | ||
+ | } | ||
+ | |||
+ | // Caller can pass in an object of custom data in lieu of the handler | ||
+ | if ( handler.handler ) { | ||
+ | handleObjIn = handler; | ||
+ | handler = handleObjIn.handler; | ||
+ | selector = handleObjIn.selector; | ||
+ | } | ||
+ | |||
+ | // Make sure that the handler has a unique ID, used to find/remove it later | ||
+ | if ( !handler.guid ) { | ||
+ | handler.guid = jQuery.guid++; | ||
+ | } | ||
+ | |||
+ | // Init the element's event structure and main handler, if this is the first | ||
+ | if ( !(events = elemData.events) ) { | ||
+ | events = elemData.events = {}; | ||
+ | } | ||
+ | if ( !(eventHandle = elemData.handle) ) { | ||
+ | eventHandle = elemData.handle = function( e ) { | ||
+ | // Discard the second event of a jQuery.event.trigger() and | ||
+ | // when an event is called after a page has unloaded | ||
+ | return typeof jQuery !== core_strundefined && (!e || jQuery.event.triggered !== e.type) ? | ||
+ | jQuery.event.dispatch.apply( eventHandle.elem, arguments ) : | ||
+ | undefined; | ||
+ | }; | ||
+ | // Add elem as a property of the handle fn to prevent a memory leak with IE non-native events | ||
+ | eventHandle.elem = elem; | ||
+ | } | ||
+ | |||
+ | // Handle multiple events separated by a space | ||
+ | types = ( types || "" ).match( core_rnotwhite ) || [""]; | ||
+ | t = types.length; | ||
+ | while ( t-- ) { | ||
+ | tmp = rtypenamespace.exec( types[t] ) || []; | ||
+ | type = origType = tmp[1]; | ||
+ | namespaces = ( tmp[2] || "" ).split( "." ).sort(); | ||
+ | |||
+ | // There *must* be a type, no attaching namespace-only handlers | ||
+ | if ( !type ) { | ||
+ | continue; | ||
+ | } | ||
+ | |||
+ | // If event changes its type, use the special event handlers for the changed type | ||
+ | special = jQuery.event.special[ type ] || {}; | ||
+ | |||
+ | // If selector defined, determine special event api type, otherwise given type | ||
+ | type = ( selector ? special.delegateType : special.bindType ) || type; | ||
+ | |||
+ | // Update special based on newly reset type | ||
+ | special = jQuery.event.special[ type ] || {}; | ||
+ | |||
+ | // handleObj is passed to all event handlers | ||
+ | handleObj = jQuery.extend({ | ||
+ | type: type, | ||
+ | origType: origType, | ||
+ | data: data, | ||
+ | handler: handler, | ||
+ | guid: handler.guid, | ||
+ | selector: selector, | ||
+ | needsContext: selector && jQuery.expr.match.needsContext.test( selector ), | ||
+ | namespace: namespaces.join(".") | ||
+ | }, handleObjIn ); | ||
+ | |||
+ | // Init the event handler queue if we're the first | ||
+ | if ( !(handlers = events[ type ]) ) { | ||
+ | handlers = events[ type ] = []; | ||
+ | handlers.delegateCount = 0; | ||
+ | |||
+ | // Only use addEventListener/attachEvent if the special events handler returns false | ||
+ | if ( !special.setup || special.setup.call( elem, data, namespaces, eventHandle ) === false ) { | ||
+ | // Bind the global event handler to the element | ||
+ | if ( elem.addEventListener ) { | ||
+ | elem.addEventListener( type, eventHandle, false ); | ||
+ | |||
+ | } else if ( elem.attachEvent ) { | ||
+ | elem.attachEvent( "on" + type, eventHandle ); | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | |||
+ | if ( special.add ) { | ||
+ | special.add.call( elem, handleObj ); | ||
+ | |||
+ | if ( !handleObj.handler.guid ) { | ||
+ | handleObj.handler.guid = handler.guid; | ||
+ | } | ||
+ | } | ||
+ | |||
+ | // Add to the element's handler list, delegates in front | ||
+ | if ( selector ) { | ||
+ | handlers.splice( handlers.delegateCount++, 0, handleObj ); | ||
+ | } else { | ||
+ | handlers.push( handleObj ); | ||
+ | } | ||
+ | |||
+ | // Keep track of which events have ever been used, for event optimization | ||
+ | jQuery.event.global[ type ] = true; | ||
+ | } | ||
+ | |||
+ | // Nullify elem to prevent memory leaks in IE | ||
+ | elem = null; | ||
+ | }, | ||
+ | |||
+ | // Detach an event or set of events from an element | ||
+ | remove: function( elem, types, handler, selector, mappedTypes ) { | ||
+ | var j, handleObj, tmp, | ||
+ | origCount, t, events, | ||
+ | special, handlers, type, | ||
+ | namespaces, origType, | ||
+ | elemData = jQuery.hasData( elem ) && jQuery._data( elem ); | ||
+ | |||
+ | if ( !elemData || !(events = elemData.events) ) { | ||
+ | return; | ||
+ | } | ||
+ | |||
+ | // Once for each type.namespace in types; type may be omitted | ||
+ | types = ( types || "" ).match( core_rnotwhite ) || [""]; | ||
+ | t = types.length; | ||
+ | while ( t-- ) { | ||
+ | tmp = rtypenamespace.exec( types[t] ) || []; | ||
+ | type = origType = tmp[1]; | ||
+ | namespaces = ( tmp[2] || "" ).split( "." ).sort(); | ||
+ | |||
+ | // Unbind all events (on this namespace, if provided) for the element | ||
+ | if ( !type ) { | ||
+ | for ( type in events ) { | ||
+ | jQuery.event.remove( elem, type + types[ t ], handler, selector, true ); | ||
+ | } | ||
+ | continue; | ||
+ | } | ||
+ | |||
+ | special = jQuery.event.special[ type ] || {}; | ||
+ | type = ( selector ? special.delegateType : special.bindType ) || type; | ||
+ | handlers = events[ type ] || []; | ||
+ | tmp = tmp[2] && new RegExp( "(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)" ); | ||
+ | |||
+ | // Remove matching events | ||
+ | origCount = j = handlers.length; | ||
+ | while ( j-- ) { | ||
+ | handleObj = handlers[ j ]; | ||
+ | |||
+ | if ( ( mappedTypes || origType === handleObj.origType ) && | ||
+ | ( !handler || handler.guid === handleObj.guid ) && | ||
+ | ( !tmp || tmp.test( handleObj.namespace ) ) && | ||
+ | ( !selector || selector === handleObj.selector || selector === "**" && handleObj.selector ) ) { | ||
+ | handlers.splice( j, 1 ); | ||
+ | |||
+ | if ( handleObj.selector ) { | ||
+ | handlers.delegateCount--; | ||
+ | } | ||
+ | if ( special.remove ) { | ||
+ | special.remove.call( elem, handleObj ); | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | |||
+ | // Remove generic event handler if we removed something and no more handlers exist | ||
+ | // (avoids potential for endless recursion during removal of special event handlers) | ||
+ | if ( origCount && !handlers.length ) { | ||
+ | if ( !special.teardown || special.teardown.call( elem, namespaces, elemData.handle ) === false ) { | ||
+ | jQuery.removeEvent( elem, type, elemData.handle ); | ||
+ | } | ||
+ | |||
+ | delete events[ type ]; | ||
+ | } | ||
+ | } | ||
+ | |||
+ | // Remove the expando if it's no longer used | ||
+ | if ( jQuery.isEmptyObject( events ) ) { | ||
+ | delete elemData.handle; | ||
+ | |||
+ | // removeData also checks for emptiness and clears the expando if empty | ||
+ | // so use it instead of delete | ||
+ | jQuery._removeData( elem, "events" ); | ||
+ | } | ||
+ | }, | ||
+ | |||
+ | trigger: function( event, data, elem, onlyHandlers ) { | ||
+ | var handle, ontype, cur, | ||
+ | bubbleType, special, tmp, i, | ||
+ | eventPath = [ elem || document ], | ||
+ | type = core_hasOwn.call( event, "type" ) ? event.type : event, | ||
+ | namespaces = core_hasOwn.call( event, "namespace" ) ? event.namespace.split(".") : []; | ||
+ | |||
+ | cur = tmp = elem = elem || document; | ||
+ | |||
+ | // Don't do events on text and comment nodes | ||
+ | if ( elem.nodeType === 3 || elem.nodeType === 8 ) { | ||
+ | return; | ||
+ | } | ||
+ | |||
+ | // focus/blur morphs to focusin/out; ensure we're not firing them right now | ||
+ | if ( rfocusMorph.test( type + jQuery.event.triggered ) ) { | ||
+ | return; | ||
+ | } | ||
+ | |||
+ | if ( type.indexOf(".") >= 0 ) { | ||
+ | // Namespaced trigger; create a regexp to match event type in handle() | ||
+ | namespaces = type.split("."); | ||
+ | type = namespaces.shift(); | ||
+ | namespaces.sort(); | ||
+ | } | ||
+ | ontype = type.indexOf(":") < 0 && "on" + type; | ||
+ | |||
+ | // Caller can pass in a jQuery.Event object, Object, or just an event type string | ||
+ | event = event[ jQuery.expando ] ? | ||
+ | event : | ||
+ | new jQuery.Event( type, typeof event === "object" && event ); | ||
+ | |||
+ | // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true) | ||
+ | event.isTrigger = onlyHandlers ? 2 : 3; | ||
+ | event.namespace = namespaces.join("."); | ||
+ | event.namespace_re = event.namespace ? | ||
+ | new RegExp( "(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)" ) : | ||
+ | null; | ||
+ | |||
+ | // Clean up the event in case it is being reused | ||
+ | event.result = undefined; | ||
+ | if ( !event.target ) { | ||
+ | event.target = elem; | ||
+ | } | ||
+ | |||
+ | // Clone any incoming data and prepend the event, creating the handler arg list | ||
+ | data = data == null ? | ||
+ | [ event ] : | ||
+ | jQuery.makeArray( data, [ event ] ); | ||
+ | |||
+ | // Allow special events to draw outside the lines | ||
+ | special = jQuery.event.special[ type ] || {}; | ||
+ | if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) { | ||
+ | return; | ||
+ | } | ||
+ | |||
+ | // Determine event propagation path in advance, per W3C events spec (#9951) | ||
+ | // Bubble up to document, then to window; watch for a global ownerDocument var (#9724) | ||
+ | if ( !onlyHandlers && !special.noBubble && !jQuery.isWindow( elem ) ) { | ||
+ | |||
+ | bubbleType = special.delegateType || type; | ||
+ | if ( !rfocusMorph.test( bubbleType + type ) ) { | ||
+ | cur = cur.parentNode; | ||
+ | } | ||
+ | for ( ; cur; cur = cur.parentNode ) { | ||
+ | eventPath.push( cur ); | ||
+ | tmp = cur; | ||
+ | } | ||
+ | |||
+ | // Only add window if we got to document (e.g., not plain obj or detached DOM) | ||
+ | if ( tmp === (elem.ownerDocument || document) ) { | ||
+ | eventPath.push( tmp.defaultView || tmp.parentWindow || window ); | ||
+ | } | ||
+ | } | ||
+ | |||
+ | // Fire handlers on the event path | ||
+ | i = 0; | ||
+ | while ( (cur = eventPath[i++]) && !event.isPropagationStopped() ) { | ||
+ | |||
+ | event.type = i > 1 ? | ||
+ | bubbleType : | ||
+ | special.bindType || type; | ||
+ | |||
+ | // jQuery handler | ||
+ | handle = ( jQuery._data( cur, "events" ) || {} )[ event.type ] && jQuery._data( cur, "handle" ); | ||
+ | if ( handle ) { | ||
+ | handle.apply( cur, data ); | ||
+ | } | ||
+ | |||
+ | // Native handler | ||
+ | handle = ontype && cur[ ontype ]; | ||
+ | if ( handle && jQuery.acceptData( cur ) && handle.apply && handle.apply( cur, data ) === false ) { | ||
+ | event.preventDefault(); | ||
+ | } | ||
+ | } | ||
+ | event.type = type; | ||
+ | |||
+ | // If nobody prevented the default action, do it now | ||
+ | if ( !onlyHandlers && !event.isDefaultPrevented() ) { | ||
+ | |||
+ | if ( (!special._default || special._default.apply( eventPath.pop(), data ) === false) && | ||
+ | jQuery.acceptData( elem ) ) { | ||
+ | |||
+ | // Call a native DOM method on the target with the same name name as the event. | ||
+ | // Can't use an .isFunction() check here because IE6/7 fails that test. | ||
+ | // Don't do default actions on window, that's where global variables be (#6170) | ||
+ | if ( ontype && elem[ type ] && !jQuery.isWindow( elem ) ) { | ||
+ | |||
+ | // Don't re-trigger an onFOO event when we call its FOO() method | ||
+ | tmp = elem[ ontype ]; | ||
+ | |||
+ | if ( tmp ) { | ||
+ | elem[ ontype ] = null; | ||
+ | } | ||
+ | |||
+ | // Prevent re-triggering of the same event, since we already bubbled it above | ||
+ | jQuery.event.triggered = type; | ||
+ | try { | ||
+ | elem[ type ](); | ||
+ | } catch ( e ) { | ||
+ | // IE<9 dies on focus/blur to hidden element (#1486,#12518) | ||
+ | // only reproducible on winXP IE8 native, not IE9 in IE8 mode | ||
+ | } | ||
+ | jQuery.event.triggered = undefined; | ||
+ | |||
+ | if ( tmp ) { | ||
+ | elem[ ontype ] = tmp; | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | |||
+ | return event.result; | ||
+ | }, | ||
+ | |||
+ | dispatch: function( event ) { | ||
+ | |||
+ | // Make a writable jQuery.Event from the native event object | ||
+ | event = jQuery.event.fix( event ); | ||
+ | |||
+ | var i, ret, handleObj, matched, j, | ||
+ | handlerQueue = [], | ||
+ | args = core_slice.call( arguments ), | ||
+ | handlers = ( jQuery._data( this, "events" ) || {} )[ event.type ] || [], | ||
+ | special = jQuery.event.special[ event.type ] || {}; | ||
+ | |||
+ | // Use the fix-ed jQuery.Event rather than the (read-only) native event | ||
+ | args[0] = event; | ||
+ | event.delegateTarget = this; | ||
+ | |||
+ | // Call the preDispatch hook for the mapped type, and let it bail if desired | ||
+ | if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) { | ||
+ | return; | ||
+ | } | ||
+ | |||
+ | // Determine handlers | ||
+ | handlerQueue = jQuery.event.handlers.call( this, event, handlers ); | ||
+ | |||
+ | // Run delegates first; they may want to stop propagation beneath us | ||
+ | i = 0; | ||
+ | while ( (matched = handlerQueue[ i++ ]) && !event.isPropagationStopped() ) { | ||
+ | event.currentTarget = matched.elem; | ||
+ | |||
+ | j = 0; | ||
+ | while ( (handleObj = matched.handlers[ j++ ]) && !event.isImmediatePropagationStopped() ) { | ||
+ | |||
+ | // Triggered event must either 1) have no namespace, or | ||
+ | // 2) have namespace(s) a subset or equal to those in the bound event (both can have no namespace). | ||
+ | if ( !event.namespace_re || event.namespace_re.test( handleObj.namespace ) ) { | ||
+ | |||
+ | event.handleObj = handleObj; | ||
+ | event.data = handleObj.data; | ||
+ | |||
+ | ret = ( (jQuery.event.special[ handleObj.origType ] || {}).handle || handleObj.handler ) | ||
+ | .apply( matched.elem, args ); | ||
+ | |||
+ | if ( ret !== undefined ) { | ||
+ | if ( (event.result = ret) === false ) { | ||
+ | event.preventDefault(); | ||
+ | event.stopPropagation(); | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | |||
+ | // Call the postDispatch hook for the mapped type | ||
+ | if ( special.postDispatch ) { | ||
+ | special.postDispatch.call( this, event ); | ||
+ | } | ||
+ | |||
+ | return event.result; | ||
+ | }, | ||
+ | |||
+ | handlers: function( event, handlers ) { | ||
+ | var sel, handleObj, matches, i, | ||
+ | handlerQueue = [], | ||
+ | delegateCount = handlers.delegateCount, | ||
+ | cur = event.target; | ||
+ | |||
+ | // Find delegate handlers | ||
+ | // Black-hole SVG <use> instance trees (#13180) | ||
+ | // Avoid non-left-click bubbling in Firefox (#3861) | ||
+ | if ( delegateCount && cur.nodeType && (!event.button || event.type !== "click") ) { | ||
+ | |||
+ | /* jshint eqeqeq: false */ | ||
+ | for ( ; cur != this; cur = cur.parentNode || this ) { | ||
+ | /* jshint eqeqeq: true */ | ||
+ | |||
+ | // Don't check non-elements (#13208) | ||
+ | // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764) | ||
+ | if ( cur.nodeType === 1 && (cur.disabled !== true || event.type !== "click") ) { | ||
+ | matches = []; | ||
+ | for ( i = 0; i < delegateCount; i++ ) { | ||
+ | handleObj = handlers[ i ]; | ||
+ | |||
+ | // Don't conflict with Object.prototype properties (#13203) | ||
+ | sel = handleObj.selector + " "; | ||
+ | |||
+ | if ( matches[ sel ] === undefined ) { | ||
+ | matches[ sel ] = handleObj.needsContext ? | ||
+ | jQuery( sel, this ).index( cur ) >= 0 : | ||
+ | jQuery.find( sel, this, null, [ cur ] ).length; | ||
+ | } | ||
+ | if ( matches[ sel ] ) { | ||
+ | matches.push( handleObj ); | ||
+ | } | ||
+ | } | ||
+ | if ( matches.length ) { | ||
+ | handlerQueue.push({ elem: cur, handlers: matches }); | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | |||
+ | // Add the remaining (directly-bound) handlers | ||
+ | if ( delegateCount < handlers.length ) { | ||
+ | handlerQueue.push({ elem: this, handlers: handlers.slice( delegateCount ) }); | ||
+ | } | ||
+ | |||
+ | return handlerQueue; | ||
+ | }, | ||
+ | |||
+ | fix: function( event ) { | ||
+ | if ( event[ jQuery.expando ] ) { | ||
+ | return event; | ||
+ | } | ||
+ | |||
+ | // Create a writable copy of the event object and normalize some properties | ||
+ | var i, prop, copy, | ||
+ | type = event.type, | ||
+ | originalEvent = event, | ||
+ | fixHook = this.fixHooks[ type ]; | ||
+ | |||
+ | if ( !fixHook ) { | ||
+ | this.fixHooks[ type ] = fixHook = | ||
+ | rmouseEvent.test( type ) ? this.mouseHooks : | ||
+ | rkeyEvent.test( type ) ? this.keyHooks : | ||
+ | {}; | ||
+ | } | ||
+ | copy = fixHook.props ? this.props.concat( fixHook.props ) : this.props; | ||
+ | |||
+ | event = new jQuery.Event( originalEvent ); | ||
+ | |||
+ | i = copy.length; | ||
+ | while ( i-- ) { | ||
+ | prop = copy[ i ]; | ||
+ | event[ prop ] = originalEvent[ prop ]; | ||
+ | } | ||
+ | |||
+ | // Support: IE<9 | ||
+ | // Fix target property (#1925) | ||
+ | if ( !event.target ) { | ||
+ | event.target = originalEvent.srcElement || document; | ||
+ | } | ||
+ | |||
+ | // Support: Chrome 23+, Safari? | ||
+ | // Target should not be a text node (#504, #13143) | ||
+ | if ( event.target.nodeType === 3 ) { | ||
+ | event.target = event.target.parentNode; | ||
+ | } | ||
+ | |||
+ | // Support: IE<9 | ||
+ | // For mouse/key events, metaKey==false if it's undefined (#3368, #11328) | ||
+ | event.metaKey = !!event.metaKey; | ||
+ | |||
+ | return fixHook.filter ? fixHook.filter( event, originalEvent ) : event; | ||
+ | }, | ||
+ | |||
+ | // Includes some event props shared by KeyEvent and MouseEvent | ||
+ | props: "altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "), | ||
+ | |||
+ | fixHooks: {}, | ||
+ | |||
+ | keyHooks: { | ||
+ | props: "char charCode key keyCode".split(" "), | ||
+ | filter: function( event, original ) { | ||
+ | |||
+ | // Add which for key events | ||
+ | if ( event.which == null ) { | ||
+ | event.which = original.charCode != null ? original.charCode : original.keyCode; | ||
+ | } | ||
+ | |||
+ | return event; | ||
+ | } | ||
+ | }, | ||
+ | |||
+ | mouseHooks: { | ||
+ | props: "button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "), | ||
+ | filter: function( event, original ) { | ||
+ | var body, eventDoc, doc, | ||
+ | button = original.button, | ||
+ | fromElement = original.fromElement; | ||
+ | |||
+ | // Calculate pageX/Y if missing and clientX/Y available | ||
+ | if ( event.pageX == null && original.clientX != null ) { | ||
+ | eventDoc = event.target.ownerDocument || document; | ||
+ | doc = eventDoc.documentElement; | ||
+ | body = eventDoc.body; | ||
+ | |||
+ | event.pageX = original.clientX + ( doc && doc.scrollLeft || body && body.scrollLeft || 0 ) - ( doc && doc.clientLeft || body && body.clientLeft || 0 ); | ||
+ | event.pageY = original.clientY + ( doc && doc.scrollTop || body && body.scrollTop || 0 ) - ( doc && doc.clientTop || body && body.clientTop || 0 ); | ||
+ | } | ||
+ | |||
+ | // Add relatedTarget, if necessary | ||
+ | if ( !event.relatedTarget && fromElement ) { | ||
+ | event.relatedTarget = fromElement === event.target ? original.toElement : fromElement; | ||
+ | } | ||
+ | |||
+ | // Add which for click: 1 === left; 2 === middle; 3 === right | ||
+ | // Note: button is not normalized, so don't use it | ||
+ | if ( !event.which && button !== undefined ) { | ||
+ | event.which = ( button & 1 ? 1 : ( button & 2 ? 3 : ( button & 4 ? 2 : 0 ) ) ); | ||
+ | } | ||
+ | |||
+ | return event; | ||
+ | } | ||
+ | }, | ||
+ | |||
+ | special: { | ||
+ | load: { | ||
+ | // Prevent triggered image.load events from bubbling to window.load | ||
+ | noBubble: true | ||
+ | }, | ||
+ | focus: { | ||
+ | // Fire native event if possible so blur/focus sequence is correct | ||
+ | trigger: function() { | ||
+ | if ( this !== safeActiveElement() && this.focus ) { | ||
+ | try { | ||
+ | this.focus(); | ||
+ | return false; | ||
+ | } catch ( e ) { | ||
+ | // Support: IE<9 | ||
+ | // If we error on focus to hidden element (#1486, #12518), | ||
+ | // let .trigger() run the handlers | ||
+ | } | ||
+ | } | ||
+ | }, | ||
+ | delegateType: "focusin" | ||
+ | }, | ||
+ | blur: { | ||
+ | trigger: function() { | ||
+ | if ( this === safeActiveElement() && this.blur ) { | ||
+ | this.blur(); | ||
+ | return false; | ||
+ | } | ||
+ | }, | ||
+ | delegateType: "focusout" | ||
+ | }, | ||
+ | click: { | ||
+ | // For checkbox, fire native event so checked state will be right | ||
+ | trigger: function() { | ||
+ | if ( jQuery.nodeName( this, "input" ) && this.type === "checkbox" && this.click ) { | ||
+ | this.click(); | ||
+ | return false; | ||
+ | } | ||
+ | }, | ||
+ | |||
+ | // For cross-browser consistency, don't fire native .click() on links | ||
+ | _default: function( event ) { | ||
+ | return jQuery.nodeName( event.target, "a" ); | ||
+ | } | ||
+ | }, | ||
+ | |||
+ | beforeunload: { | ||
+ | postDispatch: function( event ) { | ||
+ | |||
+ | // Even when returnValue equals to undefined Firefox will still show alert | ||
+ | if ( event.result !== undefined ) { | ||
+ | event.originalEvent.returnValue = event.result; | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | }, | ||
+ | |||
+ | simulate: function( type, elem, event, bubble ) { | ||
+ | // Piggyback on a donor event to simulate a different one. | ||
+ | // Fake originalEvent to avoid donor's stopPropagation, but if the | ||
+ | // simulated event prevents default then we do the same on the donor. | ||
+ | var e = jQuery.extend( | ||
+ | new jQuery.Event(), | ||
+ | event, | ||
+ | { | ||
+ | type: type, | ||
+ | isSimulated: true, | ||
+ | originalEvent: {} | ||
+ | } | ||
+ | ); | ||
+ | if ( bubble ) { | ||
+ | jQuery.event.trigger( e, null, elem ); | ||
+ | } else { | ||
+ | jQuery.event.dispatch.call( elem, e ); | ||
+ | } | ||
+ | if ( e.isDefaultPrevented() ) { | ||
+ | event.preventDefault(); | ||
+ | } | ||
+ | } | ||
+ | }; | ||
+ | |||
+ | jQuery.removeEvent = document.removeEventListener ? | ||
+ | function( elem, type, handle ) { | ||
+ | if ( elem.removeEventListener ) { | ||
+ | elem.removeEventListener( type, handle, false ); | ||
+ | } | ||
+ | } : | ||
+ | function( elem, type, handle ) { | ||
+ | var name = "on" + type; | ||
+ | |||
+ | if ( elem.detachEvent ) { | ||
+ | |||
+ | // #8545, #7054, preventing memory leaks for custom events in IE6-8 | ||
+ | // detachEvent needed property on element, by name of that event, to properly expose it to GC | ||
+ | if ( typeof elem[ name ] === core_strundefined ) { | ||
+ | elem[ name ] = null; | ||
+ | } | ||
+ | |||
+ | elem.detachEvent( name, handle ); | ||
+ | } | ||
+ | }; | ||
+ | |||
+ | jQuery.Event = function( src, props ) { | ||
+ | // Allow instantiation without the 'new' keyword | ||
+ | if ( !(this instanceof jQuery.Event) ) { | ||
+ | return new jQuery.Event( src, props ); | ||
+ | } | ||
+ | |||
+ | // Event object | ||
+ | if ( src && src.type ) { | ||
+ | this.originalEvent = src; | ||
+ | this.type = src.type; | ||
+ | |||
+ | // Events bubbling up the document may have been marked as prevented | ||
+ | // by a handler lower down the tree; reflect the correct value. | ||
+ | this.isDefaultPrevented = ( src.defaultPrevented || src.returnValue === false || | ||
+ | src.getPreventDefault && src.getPreventDefault() ) ? returnTrue : returnFalse; | ||
+ | |||
+ | // Event type | ||
+ | } else { | ||
+ | this.type = src; | ||
+ | } | ||
+ | |||
+ | // Put explicitly provided properties onto the event object | ||
+ | if ( props ) { | ||
+ | jQuery.extend( this, props ); | ||
+ | } | ||
+ | |||
+ | // Create a timestamp if incoming event doesn't have one | ||
+ | this.timeStamp = src && src.timeStamp || jQuery.now(); | ||
+ | |||
+ | // Mark it as fixed | ||
+ | this[ jQuery.expando ] = true; | ||
+ | }; | ||
+ | |||
+ | // jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding | ||
+ | // http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html | ||
+ | jQuery.Event.prototype = { | ||
+ | isDefaultPrevented: returnFalse, | ||
+ | isPropagationStopped: returnFalse, | ||
+ | isImmediatePropagationStopped: returnFalse, | ||
+ | |||
+ | preventDefault: function() { | ||
+ | var e = this.originalEvent; | ||
+ | |||
+ | this.isDefaultPrevented = returnTrue; | ||
+ | if ( !e ) { | ||
+ | return; | ||
+ | } | ||
+ | |||
+ | // If preventDefault exists, run it on the original event | ||
+ | if ( e.preventDefault ) { | ||
+ | e.preventDefault(); | ||
+ | |||
+ | // Support: IE | ||
+ | // Otherwise set the returnValue property of the original event to false | ||
+ | } else { | ||
+ | e.returnValue = false; | ||
+ | } | ||
+ | }, | ||
+ | stopPropagation: function() { | ||
+ | var e = this.originalEvent; | ||
+ | |||
+ | this.isPropagationStopped = returnTrue; | ||
+ | if ( !e ) { | ||
+ | return; | ||
+ | } | ||
+ | // If stopPropagation exists, run it on the original event | ||
+ | if ( e.stopPropagation ) { | ||
+ | e.stopPropagation(); | ||
+ | } | ||
+ | |||
+ | // Support: IE | ||
+ | // Set the cancelBubble property of the original event to true | ||
+ | e.cancelBubble = true; | ||
+ | }, | ||
+ | stopImmediatePropagation: function() { | ||
+ | this.isImmediatePropagationStopped = returnTrue; | ||
+ | this.stopPropagation(); | ||
+ | } | ||
+ | }; | ||
+ | |||
+ | // Create mouseenter/leave events using mouseover/out and event-time checks | ||
+ | jQuery.each({ | ||
+ | mouseenter: "mouseover", | ||
+ | mouseleave: "mouseout" | ||
+ | }, function( orig, fix ) { | ||
+ | jQuery.event.special[ orig ] = { | ||
+ | delegateType: fix, | ||
+ | bindType: fix, | ||
+ | |||
+ | handle: function( event ) { | ||
+ | var ret, | ||
+ | target = this, | ||
+ | related = event.relatedTarget, | ||
+ | handleObj = event.handleObj; | ||
+ | |||
+ | // For mousenter/leave call the handler if related is outside the target. | ||
+ | // NB: No relatedTarget if the mouse left/entered the browser window | ||
+ | if ( !related || (related !== target && !jQuery.contains( target, related )) ) { | ||
+ | event.type = handleObj.origType; | ||
+ | ret = handleObj.handler.apply( this, arguments ); | ||
+ | event.type = fix; | ||
+ | } | ||
+ | return ret; | ||
+ | } | ||
+ | }; | ||
+ | }); | ||
+ | |||
+ | // IE submit delegation | ||
+ | if ( !jQuery.support.submitBubbles ) { | ||
+ | |||
+ | jQuery.event.special.submit = { | ||
+ | setup: function() { | ||
+ | // Only need this for delegated form submit events | ||
+ | if ( jQuery.nodeName( this, "form" ) ) { | ||
+ | return false; | ||
+ | } | ||
+ | |||
+ | // Lazy-add a submit handler when a descendant form may potentially be submitted | ||
+ | jQuery.event.add( this, "click._submit keypress._submit", function( e ) { | ||
+ | // Node name check avoids a VML-related crash in IE (#9807) | ||
+ | var elem = e.target, | ||
+ | form = jQuery.nodeName( elem, "input" ) || jQuery.nodeName( elem, "button" ) ? elem.form : undefined; | ||
+ | if ( form && !jQuery._data( form, "submitBubbles" ) ) { | ||
+ | jQuery.event.add( form, "submit._submit", function( event ) { | ||
+ | event._submit_bubble = true; | ||
+ | }); | ||
+ | jQuery._data( form, "submitBubbles", true ); | ||
+ | } | ||
+ | }); | ||
+ | // return undefined since we don't need an event listener | ||
+ | }, | ||
+ | |||
+ | postDispatch: function( event ) { | ||
+ | // If form was submitted by the user, bubble the event up the tree | ||
+ | if ( event._submit_bubble ) { | ||
+ | delete event._submit_bubble; | ||
+ | if ( this.parentNode && !event.isTrigger ) { | ||
+ | jQuery.event.simulate( "submit", this.parentNode, event, true ); | ||
+ | } | ||
+ | } | ||
+ | }, | ||
+ | |||
+ | teardown: function() { | ||
+ | // Only need this for delegated form submit events | ||
+ | if ( jQuery.nodeName( this, "form" ) ) { | ||
+ | return false; | ||
+ | } | ||
+ | |||
+ | // Remove delegated handlers; cleanData eventually reaps submit handlers attached above | ||
+ | jQuery.event.remove( this, "._submit" ); | ||
+ | } | ||
+ | }; | ||
+ | } | ||
+ | |||
+ | // IE change delegation and checkbox/radio fix | ||
+ | if ( !jQuery.support.changeBubbles ) { | ||
+ | |||
+ | jQuery.event.special.change = { | ||
+ | |||
+ | setup: function() { | ||
+ | |||
+ | if ( rformElems.test( this.nodeName ) ) { | ||
+ | // IE doesn't fire change on a check/radio until blur; trigger it on click | ||
+ | // after a propertychange. Eat the blur-change in special.change.handle. | ||
+ | // This still fires onchange a second time for check/radio after blur. | ||
+ | if ( this.type === "checkbox" || this.type === "radio" ) { | ||
+ | jQuery.event.add( this, "propertychange._change", function( event ) { | ||
+ | if ( event.originalEvent.propertyName === "checked" ) { | ||
+ | this._just_changed = true; | ||
+ | } | ||
+ | }); | ||
+ | jQuery.event.add( this, "click._change", function( event ) { | ||
+ | if ( this._just_changed && !event.isTrigger ) { | ||
+ | this._just_changed = false; | ||
+ | } | ||
+ | // Allow triggered, simulated change events (#11500) | ||
+ | jQuery.event.simulate( "change", this, event, true ); | ||
+ | }); | ||
+ | } | ||
+ | return false; | ||
+ | } | ||
+ | // Delegated event; lazy-add a change handler on descendant inputs | ||
+ | jQuery.event.add( this, "beforeactivate._change", function( e ) { | ||
+ | var elem = e.target; | ||
+ | |||
+ | if ( rformElems.test( elem.nodeName ) && !jQuery._data( elem, "changeBubbles" ) ) { | ||
+ | jQuery.event.add( elem, "change._change", function( event ) { | ||
+ | if ( this.parentNode && !event.isSimulated && !event.isTrigger ) { | ||
+ | jQuery.event.simulate( "change", this.parentNode, event, true ); | ||
+ | } | ||
+ | }); | ||
+ | jQuery._data( elem, "changeBubbles", true ); | ||
+ | } | ||
+ | }); | ||
+ | }, | ||
+ | |||
+ | handle: function( event ) { | ||
+ | var elem = event.target; | ||
+ | |||
+ | // Swallow native change events from checkbox/radio, we already triggered them above | ||
+ | if ( this !== elem || event.isSimulated || event.isTrigger || (elem.type !== "radio" && elem.type !== "checkbox") ) { | ||
+ | return event.handleObj.handler.apply( this, arguments ); | ||
+ | } | ||
+ | }, | ||
+ | |||
+ | teardown: function() { | ||
+ | jQuery.event.remove( this, "._change" ); | ||
+ | |||
+ | return !rformElems.test( this.nodeName ); | ||
+ | } | ||
+ | }; | ||
+ | } | ||
+ | |||
+ | // Create "bubbling" focus and blur events | ||
+ | if ( !jQuery.support.focusinBubbles ) { | ||
+ | jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) { | ||
+ | |||
+ | // Attach a single capturing handler while someone wants focusin/focusout | ||
+ | var attaches = 0, | ||
+ | handler = function( event ) { | ||
+ | jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ), true ); | ||
+ | }; | ||
+ | |||
+ | jQuery.event.special[ fix ] = { | ||
+ | setup: function() { | ||
+ | if ( attaches++ === 0 ) { | ||
+ | document.addEventListener( orig, handler, true ); | ||
+ | } | ||
+ | }, | ||
+ | teardown: function() { | ||
+ | if ( --attaches === 0 ) { | ||
+ | document.removeEventListener( orig, handler, true ); | ||
+ | } | ||
+ | } | ||
+ | }; | ||
+ | }); | ||
+ | } | ||
+ | |||
+ | jQuery.fn.extend({ | ||
+ | |||
+ | on: function( types, selector, data, fn, /*INTERNAL*/ one ) { | ||
+ | var type, origFn; | ||
+ | |||
+ | // Types can be a map of types/handlers | ||
+ | if ( typeof types === "object" ) { | ||
+ | // ( types-Object, selector, data ) | ||
+ | if ( typeof selector !== "string" ) { | ||
+ | // ( types-Object, data ) | ||
+ | data = data || selector; | ||
+ | selector = undefined; | ||
+ | } | ||
+ | for ( type in types ) { | ||
+ | this.on( type, selector, data, types[ type ], one ); | ||
+ | } | ||
+ | return this; | ||
+ | } | ||
+ | |||
+ | if ( data == null && fn == null ) { | ||
+ | // ( types, fn ) | ||
+ | fn = selector; | ||
+ | data = selector = undefined; | ||
+ | } else if ( fn == null ) { | ||
+ | if ( typeof selector === "string" ) { | ||
+ | // ( types, selector, fn ) | ||
+ | fn = data; | ||
+ | data = undefined; | ||
+ | } else { | ||
+ | // ( types, data, fn ) | ||
+ | fn = data; | ||
+ | data = selector; | ||
+ | selector = undefined; | ||
+ | } | ||
+ | } | ||
+ | if ( fn === false ) { | ||
+ | fn = returnFalse; | ||
+ | } else if ( !fn ) { | ||
+ | return this; | ||
+ | } | ||
+ | |||
+ | if ( one === 1 ) { | ||
+ | origFn = fn; | ||
+ | fn = function( event ) { | ||
+ | // Can use an empty set, since event contains the info | ||
+ | jQuery().off( event ); | ||
+ | return origFn.apply( this, arguments ); | ||
+ | }; | ||
+ | // Use same guid so caller can remove using origFn | ||
+ | fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ ); | ||
+ | } | ||
+ | return this.each( function() { | ||
+ | jQuery.event.add( this, types, fn, data, selector ); | ||
+ | }); | ||
+ | }, | ||
+ | one: function( types, selector, data, fn ) { | ||
+ | return this.on( types, selector, data, fn, 1 ); | ||
+ | }, | ||
+ | off: function( types, selector, fn ) { | ||
+ | var handleObj, type; | ||
+ | if ( types && types.preventDefault && types.handleObj ) { | ||
+ | // ( event ) dispatched jQuery.Event | ||
+ | handleObj = types.handleObj; | ||
+ | jQuery( types.delegateTarget ).off( | ||
+ | handleObj.namespace ? handleObj.origType + "." + handleObj.namespace : handleObj.origType, | ||
+ | handleObj.selector, | ||
+ | handleObj.handler | ||
+ | ); | ||
+ | return this; | ||
+ | } | ||
+ | if ( typeof types === "object" ) { | ||
+ | // ( types-object [, selector] ) | ||
+ | for ( type in types ) { | ||
+ | this.off( type, selector, types[ type ] ); | ||
+ | } | ||
+ | return this; | ||
+ | } | ||
+ | if ( selector === false || typeof selector === "function" ) { | ||
+ | // ( types [, fn] ) | ||
+ | fn = selector; | ||
+ | selector = undefined; | ||
+ | } | ||
+ | if ( fn === false ) { | ||
+ | fn = returnFalse; | ||
+ | } | ||
+ | return this.each(function() { | ||
+ | jQuery.event.remove( this, types, fn, selector ); | ||
+ | }); | ||
+ | }, | ||
+ | |||
+ | trigger: function( type, data ) { | ||
+ | return this.each(function() { | ||
+ | jQuery.event.trigger( type, data, this ); | ||
+ | }); | ||
+ | }, | ||
+ | triggerHandler: function( type, data ) { | ||
+ | var elem = this[0]; | ||
+ | if ( elem ) { | ||
+ | return jQuery.event.trigger( type, data, elem, true ); | ||
+ | } | ||
+ | } | ||
+ | }); | ||
+ | var isSimple = /^.[^:#\[\.,]*$/, | ||
+ | rparentsprev = /^(?:parents|prev(?:Until|All))/, | ||
+ | rneedsContext = jQuery.expr.match.needsContext, | ||
+ | // methods guaranteed to produce a unique set when starting from a unique set | ||
+ | guaranteedUnique = { | ||
+ | children: true, | ||
+ | contents: true, | ||
+ | next: true, | ||
+ | prev: true | ||
+ | }; | ||
+ | |||
+ | jQuery.fn.extend({ | ||
+ | find: function( selector ) { | ||
+ | var i, | ||
+ | ret = [], | ||
+ | self = this, | ||
+ | len = self.length; | ||
+ | |||
+ | if ( typeof selector !== "string" ) { | ||
+ | return this.pushStack( jQuery( selector ).filter(function() { | ||
+ | for ( i = 0; i < len; i++ ) { | ||
+ | if ( jQuery.contains( self[ i ], this ) ) { | ||
+ | return true; | ||
+ | } | ||
+ | } | ||
+ | }) ); | ||
+ | } | ||
+ | |||
+ | for ( i = 0; i < len; i++ ) { | ||
+ | jQuery.find( selector, self[ i ], ret ); | ||
+ | } | ||
+ | |||
+ | // Needed because $( selector, context ) becomes $( context ).find( selector ) | ||
+ | ret = this.pushStack( len > 1 ? jQuery.unique( ret ) : ret ); | ||
+ | ret.selector = this.selector ? this.selector + " " + selector : selector; | ||
+ | return ret; | ||
+ | }, | ||
+ | |||
+ | has: function( target ) { | ||
+ | var i, | ||
+ | targets = jQuery( target, this ), | ||
+ | len = targets.length; | ||
+ | |||
+ | return this.filter(function() { | ||
+ | for ( i = 0; i < len; i++ ) { | ||
+ | if ( jQuery.contains( this, targets[i] ) ) { | ||
+ | return true; | ||
+ | } | ||
+ | } | ||
+ | }); | ||
+ | }, | ||
+ | |||
+ | not: function( selector ) { | ||
+ | return this.pushStack( winnow(this, selector || [], true) ); | ||
+ | }, | ||
+ | |||
+ | filter: function( selector ) { | ||
+ | return this.pushStack( winnow(this, selector || [], false) ); | ||
+ | }, | ||
+ | |||
+ | is: function( selector ) { | ||
+ | return !!winnow( | ||
+ | this, | ||
+ | |||
+ | // If this is a positional/relative selector, check membership in the returned set | ||
+ | // so $("p:first").is("p:last") won't return true for a doc with two "p". | ||
+ | typeof selector === "string" && rneedsContext.test( selector ) ? | ||
+ | jQuery( selector ) : | ||
+ | selector || [], | ||
+ | false | ||
+ | ).length; | ||
+ | }, | ||
+ | |||
+ | closest: function( selectors, context ) { | ||
+ | var cur, | ||
+ | i = 0, | ||
+ | l = this.length, | ||
+ | ret = [], | ||
+ | pos = rneedsContext.test( selectors ) || typeof selectors !== "string" ? | ||
+ | jQuery( selectors, context || this.context ) : | ||
+ | 0; | ||
+ | |||
+ | for ( ; i < l; i++ ) { | ||
+ | for ( cur = this[i]; cur && cur !== context; cur = cur.parentNode ) { | ||
+ | // Always skip document fragments | ||
+ | if ( cur.nodeType < 11 && (pos ? | ||
+ | pos.index(cur) > -1 : | ||
+ | |||
+ | // Don't pass non-elements to Sizzle | ||
+ | cur.nodeType === 1 && | ||
+ | jQuery.find.matchesSelector(cur, selectors)) ) { | ||
+ | |||
+ | cur = ret.push( cur ); | ||
+ | break; | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | |||
+ | return this.pushStack( ret.length > 1 ? jQuery.unique( ret ) : ret ); | ||
+ | }, | ||
+ | |||
+ | // Determine the position of an element within | ||
+ | // the matched set of elements | ||
+ | index: function( elem ) { | ||
+ | |||
+ | // No argument, return index in parent | ||
+ | if ( !elem ) { | ||
+ | return ( this[0] && this[0].parentNode ) ? this.first().prevAll().length : -1; | ||
+ | } | ||
+ | |||
+ | // index in selector | ||
+ | if ( typeof elem === "string" ) { | ||
+ | return jQuery.inArray( this[0], jQuery( elem ) ); | ||
+ | } | ||
+ | |||
+ | // Locate the position of the desired element | ||
+ | return jQuery.inArray( | ||
+ | // If it receives a jQuery object, the first element is used | ||
+ | elem.jquery ? elem[0] : elem, this ); | ||
+ | }, | ||
+ | |||
+ | add: function( selector, context ) { | ||
+ | var set = typeof selector === "string" ? | ||
+ | jQuery( selector, context ) : | ||
+ | jQuery.makeArray( selector && selector.nodeType ? [ selector ] : selector ), | ||
+ | all = jQuery.merge( this.get(), set ); | ||
+ | |||
+ | return this.pushStack( jQuery.unique(all) ); | ||
+ | }, | ||
+ | |||
+ | addBack: function( selector ) { | ||
+ | return this.add( selector == null ? | ||
+ | this.prevObject : this.prevObject.filter(selector) | ||
+ | ); | ||
+ | } | ||
+ | }); | ||
+ | |||
+ | function sibling( cur, dir ) { | ||
+ | do { | ||
+ | cur = cur[ dir ]; | ||
+ | } while ( cur && cur.nodeType !== 1 ); | ||
+ | |||
+ | return cur; | ||
+ | } | ||
+ | |||
+ | jQuery.each({ | ||
+ | parent: function( elem ) { | ||
+ | var parent = elem.parentNode; | ||
+ | return parent && parent.nodeType !== 11 ? parent : null; | ||
+ | }, | ||
+ | parents: function( elem ) { | ||
+ | return jQuery.dir( elem, "parentNode" ); | ||
+ | }, | ||
+ | parentsUntil: function( elem, i, until ) { | ||
+ | return jQuery.dir( elem, "parentNode", until ); | ||
+ | }, | ||
+ | next: function( elem ) { | ||
+ | return sibling( elem, "nextSibling" ); | ||
+ | }, | ||
+ | prev: function( elem ) { | ||
+ | return sibling( elem, "previousSibling" ); | ||
+ | }, | ||
+ | nextAll: function( elem ) { | ||
+ | return jQuery.dir( elem, "nextSibling" ); | ||
+ | }, | ||
+ | prevAll: function( elem ) { | ||
+ | return jQuery.dir( elem, "previousSibling" ); | ||
+ | }, | ||
+ | nextUntil: function( elem, i, until ) { | ||
+ | return jQuery.dir( elem, "nextSibling", until ); | ||
+ | }, | ||
+ | prevUntil: function( elem, i, until ) { | ||
+ | return jQuery.dir( elem, "previousSibling", until ); | ||
+ | }, | ||
+ | siblings: function( elem ) { | ||
+ | return jQuery.sibling( ( elem.parentNode || {} ).firstChild, elem ); | ||
+ | }, | ||
+ | children: function( elem ) { | ||
+ | return jQuery.sibling( elem.firstChild ); | ||
+ | }, | ||
+ | contents: function( elem ) { | ||
+ | return jQuery.nodeName( elem, "iframe" ) ? | ||
+ | elem.contentDocument || elem.contentWindow.document : | ||
+ | jQuery.merge( [], elem.childNodes ); | ||
+ | } | ||
+ | }, function( name, fn ) { | ||
+ | jQuery.fn[ name ] = function( until, selector ) { | ||
+ | var ret = jQuery.map( this, fn, until ); | ||
+ | |||
+ | if ( name.slice( -5 ) !== "Until" ) { | ||
+ | selector = until; | ||
+ | } | ||
+ | |||
+ | if ( selector && typeof selector === "string" ) { | ||
+ | ret = jQuery.filter( selector, ret ); | ||
+ | } | ||
+ | |||
+ | if ( this.length > 1 ) { | ||
+ | // Remove duplicates | ||
+ | if ( !guaranteedUnique[ name ] ) { | ||
+ | ret = jQuery.unique( ret ); | ||
+ | } | ||
+ | |||
+ | // Reverse order for parents* and prev-derivatives | ||
+ | if ( rparentsprev.test( name ) ) { | ||
+ | ret = ret.reverse(); | ||
+ | } | ||
+ | } | ||
+ | |||
+ | return this.pushStack( ret ); | ||
+ | }; | ||
+ | }); | ||
+ | |||
+ | jQuery.extend({ | ||
+ | filter: function( expr, elems, not ) { | ||
+ | var elem = elems[ 0 ]; | ||
+ | |||
+ | if ( not ) { | ||
+ | expr = ":not(" + expr + ")"; | ||
+ | } | ||
+ | |||
+ | return elems.length === 1 && elem.nodeType === 1 ? | ||
+ | jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : [] : | ||
+ | jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) { | ||
+ | return elem.nodeType === 1; | ||
+ | })); | ||
+ | }, | ||
+ | |||
+ | dir: function( elem, dir, until ) { | ||
+ | var matched = [], | ||
+ | cur = elem[ dir ]; | ||
+ | |||
+ | while ( cur && cur.nodeType !== 9 && (until === undefined || cur.nodeType !== 1 || !jQuery( cur ).is( until )) ) { | ||
+ | if ( cur.nodeType === 1 ) { | ||
+ | matched.push( cur ); | ||
+ | } | ||
+ | cur = cur[dir]; | ||
+ | } | ||
+ | return matched; | ||
+ | }, | ||
+ | |||
+ | sibling: function( n, elem ) { | ||
+ | var r = []; | ||
+ | |||
+ | for ( ; n; n = n.nextSibling ) { | ||
+ | if ( n.nodeType === 1 && n !== elem ) { | ||
+ | r.push( n ); | ||
+ | } | ||
+ | } | ||
+ | |||
+ | return r; | ||
+ | } | ||
+ | }); | ||
+ | |||
+ | // Implement the identical functionality for filter and not | ||
+ | function winnow( elements, qualifier, not ) { | ||
+ | if ( jQuery.isFunction( qualifier ) ) { | ||
+ | return jQuery.grep( elements, function( elem, i ) { | ||
+ | /* jshint -W018 */ | ||
+ | return !!qualifier.call( elem, i, elem ) !== not; | ||
+ | }); | ||
+ | |||
+ | } | ||
+ | |||
+ | if ( qualifier.nodeType ) { | ||
+ | return jQuery.grep( elements, function( elem ) { | ||
+ | return ( elem === qualifier ) !== not; | ||
+ | }); | ||
+ | |||
+ | } | ||
+ | |||
+ | if ( typeof qualifier === "string" ) { | ||
+ | if ( isSimple.test( qualifier ) ) { | ||
+ | return jQuery.filter( qualifier, elements, not ); | ||
+ | } | ||
+ | |||
+ | qualifier = jQuery.filter( qualifier, elements ); | ||
+ | } | ||
+ | |||
+ | return jQuery.grep( elements, function( elem ) { | ||
+ | return ( jQuery.inArray( elem, qualifier ) >= 0 ) !== not; | ||
+ | }); | ||
+ | } | ||
+ | function createSafeFragment( document ) { | ||
+ | var list = nodeNames.split( "|" ), | ||
+ | safeFrag = document.createDocumentFragment(); | ||
+ | |||
+ | if ( safeFrag.createElement ) { | ||
+ | while ( list.length ) { | ||
+ | safeFrag.createElement( | ||
+ | list.pop() | ||
+ | ); | ||
+ | } | ||
+ | } | ||
+ | return safeFrag; | ||
+ | } | ||
+ | |||
+ | var nodeNames = "abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|" + | ||
+ | "header|hgroup|mark|meter|nav|output|progress|section|summary|time|video", | ||
+ | rinlinejQuery = / jQuery\d+="(?:null|\d+)"/g, | ||
+ | rnoshimcache = new RegExp("<(?:" + nodeNames + ")[\\s/>]", "i"), | ||
+ | rleadingWhitespace = /^\s+/, | ||
+ | rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi, | ||
+ | rtagName = /<([\w:]+)/, | ||
+ | rtbody = /<tbody/i, | ||
+ | rhtml = /<|&#?\w+;/, | ||
+ | rnoInnerhtml = /<(?:script|style|link)/i, | ||
+ | manipulation_rcheckableType = /^(?:checkbox|radio)$/i, | ||
+ | // checked="checked" or checked | ||
+ | rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i, | ||
+ | rscriptType = /^$|\/(?:java|ecma)script/i, | ||
+ | rscriptTypeMasked = /^true\/(.*)/, | ||
+ | rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g, | ||
+ | |||
+ | // We have to close these tags to support XHTML (#13200) | ||
+ | wrapMap = { | ||
+ | option: [ 1, "<select multiple='multiple'>", "</select>" ], | ||
+ | legend: [ 1, "<fieldset>", "</fieldset>" ], | ||
+ | area: [ 1, "<map>", "</map>" ], | ||
+ | param: [ 1, "<object>", "</object>" ], | ||
+ | thead: [ 1, "<table>", "</table>" ], | ||
+ | tr: [ 2, "<table><tbody>", "</tbody></table>" ], | ||
+ | col: [ 2, "<table><tbody></tbody><colgroup>", "</colgroup></table>" ], | ||
+ | td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ], | ||
+ | |||
+ | // IE6-8 can't serialize link, script, style, or any html5 (NoScope) tags, | ||
+ | // unless wrapped in a div with non-breaking characters in front of it. | ||
+ | _default: jQuery.support.htmlSerialize ? [ 0, "", "" ] : [ 1, "X<div>", "</div>" ] | ||
+ | }, | ||
+ | safeFragment = createSafeFragment( document ), | ||
+ | fragmentDiv = safeFragment.appendChild( document.createElement("div") ); | ||
+ | |||
+ | wrapMap.optgroup = wrapMap.option; | ||
+ | wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead; | ||
+ | wrapMap.th = wrapMap.td; | ||
+ | |||
+ | jQuery.fn.extend({ | ||
+ | text: function( value ) { | ||
+ | return jQuery.access( this, function( value ) { | ||
+ | return value === undefined ? | ||
+ | jQuery.text( this ) : | ||
+ | this.empty().append( ( this[0] && this[0].ownerDocument || document ).createTextNode( value ) ); | ||
+ | }, null, value, arguments.length ); | ||
+ | }, | ||
+ | |||
+ | append: function() { | ||
+ | return this.domManip( arguments, function( elem ) { | ||
+ | if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { | ||
+ | var target = manipulationTarget( this, elem ); | ||
+ | target.appendChild( elem ); | ||
+ | } | ||
+ | }); | ||
+ | }, | ||
+ | |||
+ | prepend: function() { | ||
+ | return this.domManip( arguments, function( elem ) { | ||
+ | if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { | ||
+ | var target = manipulationTarget( this, elem ); | ||
+ | target.insertBefore( elem, target.firstChild ); | ||
+ | } | ||
+ | }); | ||
+ | }, | ||
+ | |||
+ | before: function() { | ||
+ | return this.domManip( arguments, function( elem ) { | ||
+ | if ( this.parentNode ) { | ||
+ | this.parentNode.insertBefore( elem, this ); | ||
+ | } | ||
+ | }); | ||
+ | }, | ||
+ | |||
+ | after: function() { | ||
+ | return this.domManip( arguments, function( elem ) { | ||
+ | if ( this.parentNode ) { | ||
+ | this.parentNode.insertBefore( elem, this.nextSibling ); | ||
+ | } | ||
+ | }); | ||
+ | }, | ||
+ | |||
+ | // keepData is for internal use only--do not document | ||
+ | remove: function( selector, keepData ) { | ||
+ | var elem, | ||
+ | elems = selector ? jQuery.filter( selector, this ) : this, | ||
+ | i = 0; | ||
+ | |||
+ | for ( ; (elem = elems[i]) != null; i++ ) { | ||
+ | |||
+ | if ( !keepData && elem.nodeType === 1 ) { | ||
+ | jQuery.cleanData( getAll( elem ) ); | ||
+ | } | ||
+ | |||
+ | if ( elem.parentNode ) { | ||
+ | if ( keepData && jQuery.contains( elem.ownerDocument, elem ) ) { | ||
+ | setGlobalEval( getAll( elem, "script" ) ); | ||
+ | } | ||
+ | elem.parentNode.removeChild( elem ); | ||
+ | } | ||
+ | } | ||
+ | |||
+ | return this; | ||
+ | }, | ||
+ | |||
+ | empty: function() { | ||
+ | var elem, | ||
+ | i = 0; | ||
+ | |||
+ | for ( ; (elem = this[i]) != null; i++ ) { | ||
+ | // Remove element nodes and prevent memory leaks | ||
+ | if ( elem.nodeType === 1 ) { | ||
+ | jQuery.cleanData( getAll( elem, false ) ); | ||
+ | } | ||
+ | |||
+ | // Remove any remaining nodes | ||
+ | while ( elem.firstChild ) { | ||
+ | elem.removeChild( elem.firstChild ); | ||
+ | } | ||
+ | |||
+ | // If this is a select, ensure that it displays empty (#12336) | ||
+ | // Support: IE<9 | ||
+ | if ( elem.options && jQuery.nodeName( elem, "select" ) ) { | ||
+ | elem.options.length = 0; | ||
+ | } | ||
+ | } | ||
+ | |||
+ | return this; | ||
+ | }, | ||
+ | |||
+ | clone: function( dataAndEvents, deepDataAndEvents ) { | ||
+ | dataAndEvents = dataAndEvents == null ? false : dataAndEvents; | ||
+ | deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents; | ||
+ | |||
+ | return this.map( function () { | ||
+ | return jQuery.clone( this, dataAndEvents, deepDataAndEvents ); | ||
+ | }); | ||
+ | }, | ||
+ | |||
+ | html: function( value ) { | ||
+ | return jQuery.access( this, function( value ) { | ||
+ | var elem = this[0] || {}, | ||
+ | i = 0, | ||
+ | l = this.length; | ||
+ | |||
+ | if ( value === undefined ) { | ||
+ | return elem.nodeType === 1 ? | ||
+ | elem.innerHTML.replace( rinlinejQuery, "" ) : | ||
+ | undefined; | ||
+ | } | ||
+ | |||
+ | // See if we can take a shortcut and just use innerHTML | ||
+ | if ( typeof value === "string" && !rnoInnerhtml.test( value ) && | ||
+ | ( jQuery.support.htmlSerialize || !rnoshimcache.test( value ) ) && | ||
+ | ( jQuery.support.leadingWhitespace || !rleadingWhitespace.test( value ) ) && | ||
+ | !wrapMap[ ( rtagName.exec( value ) || ["", ""] )[1].toLowerCase() ] ) { | ||
+ | |||
+ | value = value.replace( rxhtmlTag, "<$1></$2>" ); | ||
+ | |||
+ | try { | ||
+ | for (; i < l; i++ ) { | ||
+ | // Remove element nodes and prevent memory leaks | ||
+ | elem = this[i] || {}; | ||
+ | if ( elem.nodeType === 1 ) { | ||
+ | jQuery.cleanData( getAll( elem, false ) ); | ||
+ | elem.innerHTML = value; | ||
+ | } | ||
+ | } | ||
+ | |||
+ | elem = 0; | ||
+ | |||
+ | // If using innerHTML throws an exception, use the fallback method | ||
+ | } catch(e) {} | ||
+ | } | ||
+ | |||
+ | if ( elem ) { | ||
+ | this.empty().append( value ); | ||
+ | } | ||
+ | }, null, value, arguments.length ); | ||
+ | }, | ||
+ | |||
+ | replaceWith: function() { | ||
+ | var | ||
+ | // Snapshot the DOM in case .domManip sweeps something relevant into its fragment | ||
+ | args = jQuery.map( this, function( elem ) { | ||
+ | return [ elem.nextSibling, elem.parentNode ]; | ||
+ | }), | ||
+ | i = 0; | ||
+ | |||
+ | // Make the changes, replacing each context element with the new content | ||
+ | this.domManip( arguments, function( elem ) { | ||
+ | var next = args[ i++ ], | ||
+ | parent = args[ i++ ]; | ||
+ | |||
+ | if ( parent ) { | ||
+ | // Don't use the snapshot next if it has moved (#13810) | ||
+ | if ( next && next.parentNode !== parent ) { | ||
+ | next = this.nextSibling; | ||
+ | } | ||
+ | jQuery( this ).remove(); | ||
+ | parent.insertBefore( elem, next ); | ||
+ | } | ||
+ | // Allow new content to include elements from the context set | ||
+ | }, true ); | ||
+ | |||
+ | // Force removal if there was no new content (e.g., from empty arguments) | ||
+ | return i ? this : this.remove(); | ||
+ | }, | ||
+ | |||
+ | detach: function( selector ) { | ||
+ | return this.remove( selector, true ); | ||
+ | }, | ||
+ | |||
+ | domManip: function( args, callback, allowIntersection ) { | ||
+ | |||
+ | // Flatten any nested arrays | ||
+ | args = core_concat.apply( [], args ); | ||
+ | |||
+ | var first, node, hasScripts, | ||
+ | scripts, doc, fragment, | ||
+ | i = 0, | ||
+ | l = this.length, | ||
+ | set = this, | ||
+ | iNoClone = l - 1, | ||
+ | value = args[0], | ||
+ | isFunction = jQuery.isFunction( value ); | ||
+ | |||
+ | // We can't cloneNode fragments that contain checked, in WebKit | ||
+ | if ( isFunction || !( l <= 1 || typeof value !== "string" || jQuery.support.checkClone || !rchecked.test( value ) ) ) { | ||
+ | return this.each(function( index ) { | ||
+ | var self = set.eq( index ); | ||
+ | if ( isFunction ) { | ||
+ | args[0] = value.call( this, index, self.html() ); | ||
+ | } | ||
+ | self.domManip( args, callback, allowIntersection ); | ||
+ | }); | ||
+ | } | ||
+ | |||
+ | if ( l ) { | ||
+ | fragment = jQuery.buildFragment( args, this[ 0 ].ownerDocument, false, !allowIntersection && this ); | ||
+ | first = fragment.firstChild; | ||
+ | |||
+ | if ( fragment.childNodes.length === 1 ) { | ||
+ | fragment = first; | ||
+ | } | ||
+ | |||
+ | if ( first ) { | ||
+ | scripts = jQuery.map( getAll( fragment, "script" ), disableScript ); | ||
+ | hasScripts = scripts.length; | ||
+ | |||
+ | // Use the original fragment for the last item instead of the first because it can end up | ||
+ | // being emptied incorrectly in certain situations (#8070). | ||
+ | for ( ; i < l; i++ ) { | ||
+ | node = fragment; | ||
+ | |||
+ | if ( i !== iNoClone ) { | ||
+ | node = jQuery.clone( node, true, true ); | ||
+ | |||
+ | // Keep references to cloned scripts for later restoration | ||
+ | if ( hasScripts ) { | ||
+ | jQuery.merge( scripts, getAll( node, "script" ) ); | ||
+ | } | ||
+ | } | ||
+ | |||
+ | callback.call( this[i], node, i ); | ||
+ | } | ||
+ | |||
+ | if ( hasScripts ) { | ||
+ | doc = scripts[ scripts.length - 1 ].ownerDocument; | ||
+ | |||
+ | // Reenable scripts | ||
+ | jQuery.map( scripts, restoreScript ); | ||
+ | |||
+ | // Evaluate executable scripts on first document insertion | ||
+ | for ( i = 0; i < hasScripts; i++ ) { | ||
+ | node = scripts[ i ]; | ||
+ | if ( rscriptType.test( node.type || "" ) && | ||
+ | !jQuery._data( node, "globalEval" ) && jQuery.contains( doc, node ) ) { | ||
+ | |||
+ | if ( node.src ) { | ||
+ | // Hope ajax is available... | ||
+ | jQuery._evalUrl( node.src ); | ||
+ | } else { | ||
+ | jQuery.globalEval( ( node.text || node.textContent || node.innerHTML || "" ).replace( rcleanScript, "" ) ); | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | |||
+ | // Fix #11809: Avoid leaking memory | ||
+ | fragment = first = null; | ||
+ | } | ||
+ | } | ||
+ | |||
+ | return this; | ||
+ | } | ||
+ | }); | ||
+ | |||
+ | // Support: IE<8 | ||
+ | // Manipulating tables requires a tbody | ||
+ | function manipulationTarget( elem, content ) { | ||
+ | return jQuery.nodeName( elem, "table" ) && | ||
+ | jQuery.nodeName( content.nodeType === 1 ? content : content.firstChild, "tr" ) ? | ||
+ | |||
+ | elem.getElementsByTagName("tbody")[0] || | ||
+ | elem.appendChild( elem.ownerDocument.createElement("tbody") ) : | ||
+ | elem; | ||
+ | } | ||
+ | |||
+ | // Replace/restore the type attribute of script elements for safe DOM manipulation | ||
+ | function disableScript( elem ) { | ||
+ | elem.type = (jQuery.find.attr( elem, "type" ) !== null) + "/" + elem.type; | ||
+ | return elem; | ||
+ | } | ||
+ | function restoreScript( elem ) { | ||
+ | var match = rscriptTypeMasked.exec( elem.type ); | ||
+ | if ( match ) { | ||
+ | elem.type = match[1]; | ||
+ | } else { | ||
+ | elem.removeAttribute("type"); | ||
+ | } | ||
+ | return elem; | ||
+ | } | ||
+ | |||
+ | // Mark scripts as having already been evaluated | ||
+ | function setGlobalEval( elems, refElements ) { | ||
+ | var elem, | ||
+ | i = 0; | ||
+ | for ( ; (elem = elems[i]) != null; i++ ) { | ||
+ | jQuery._data( elem, "globalEval", !refElements || jQuery._data( refElements[i], "globalEval" ) ); | ||
+ | } | ||
+ | } | ||
+ | |||
+ | function cloneCopyEvent( src, dest ) { | ||
+ | |||
+ | if ( dest.nodeType !== 1 || !jQuery.hasData( src ) ) { | ||
+ | return; | ||
+ | } | ||
+ | |||
+ | var type, i, l, | ||
+ | oldData = jQuery._data( src ), | ||
+ | curData = jQuery._data( dest, oldData ), | ||
+ | events = oldData.events; | ||
+ | |||
+ | if ( events ) { | ||
+ | delete curData.handle; | ||
+ | curData.events = {}; | ||
+ | |||
+ | for ( type in events ) { | ||
+ | for ( i = 0, l = events[ type ].length; i < l; i++ ) { | ||
+ | jQuery.event.add( dest, type, events[ type ][ i ] ); | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | |||
+ | // make the cloned public data object a copy from the original | ||
+ | if ( curData.data ) { | ||
+ | curData.data = jQuery.extend( {}, curData.data ); | ||
+ | } | ||
+ | } | ||
+ | |||
+ | function fixCloneNodeIssues( src, dest ) { | ||
+ | var nodeName, e, data; | ||
+ | |||
+ | // We do not need to do anything for non-Elements | ||
+ | if ( dest.nodeType !== 1 ) { | ||
+ | return; | ||
+ | } | ||
+ | |||
+ | nodeName = dest.nodeName.toLowerCase(); | ||
+ | |||
+ | // IE6-8 copies events bound via attachEvent when using cloneNode. | ||
+ | if ( !jQuery.support.noCloneEvent && dest[ jQuery.expando ] ) { | ||
+ | data = jQuery._data( dest ); | ||
+ | |||
+ | for ( e in data.events ) { | ||
+ | jQuery.removeEvent( dest, e, data.handle ); | ||
+ | } | ||
+ | |||
+ | // Event data gets referenced instead of copied if the expando gets copied too | ||
+ | dest.removeAttribute( jQuery.expando ); | ||
+ | } | ||
+ | |||
+ | // IE blanks contents when cloning scripts, and tries to evaluate newly-set text | ||
+ | if ( nodeName === "script" && dest.text !== src.text ) { | ||
+ | disableScript( dest ).text = src.text; | ||
+ | restoreScript( dest ); | ||
+ | |||
+ | // IE6-10 improperly clones children of object elements using classid. | ||
+ | // IE10 throws NoModificationAllowedError if parent is null, #12132. | ||
+ | } else if ( nodeName === "object" ) { | ||
+ | if ( dest.parentNode ) { | ||
+ | dest.outerHTML = src.outerHTML; | ||
+ | } | ||
+ | |||
+ | // This path appears unavoidable for IE9. When cloning an object | ||
+ | // element in IE9, the outerHTML strategy above is not sufficient. | ||
+ | // If the src has innerHTML and the destination does not, | ||
+ | // copy the src.innerHTML into the dest.innerHTML. #10324 | ||
+ | if ( jQuery.support.html5Clone && ( src.innerHTML && !jQuery.trim(dest.innerHTML) ) ) { | ||
+ | dest.innerHTML = src.innerHTML; | ||
+ | } | ||
+ | |||
+ | } else if ( nodeName === "input" && manipulation_rcheckableType.test( src.type ) ) { | ||
+ | // IE6-8 fails to persist the checked state of a cloned checkbox | ||
+ | // or radio button. Worse, IE6-7 fail to give the cloned element | ||
+ | // a checked appearance if the defaultChecked value isn't also set | ||
+ | |||
+ | dest.defaultChecked = dest.checked = src.checked; | ||
+ | |||
+ | // IE6-7 get confused and end up setting the value of a cloned | ||
+ | // checkbox/radio button to an empty string instead of "on" | ||
+ | if ( dest.value !== src.value ) { | ||
+ | dest.value = src.value; | ||
+ | } | ||
+ | |||
+ | // IE6-8 fails to return the selected option to the default selected | ||
+ | // state when cloning options | ||
+ | } else if ( nodeName === "option" ) { | ||
+ | dest.defaultSelected = dest.selected = src.defaultSelected; | ||
+ | |||
+ | // IE6-8 fails to set the defaultValue to the correct value when | ||
+ | // cloning other types of input fields | ||
+ | } else if ( nodeName === "input" || nodeName === "textarea" ) { | ||
+ | dest.defaultValue = src.defaultValue; | ||
+ | } | ||
+ | } | ||
+ | |||
+ | jQuery.each({ | ||
+ | appendTo: "append", | ||
+ | prependTo: "prepend", | ||
+ | insertBefore: "before", | ||
+ | insertAfter: "after", | ||
+ | replaceAll: "replaceWith" | ||
+ | }, function( name, original ) { | ||
+ | jQuery.fn[ name ] = function( selector ) { | ||
+ | var elems, | ||
+ | i = 0, | ||
+ | ret = [], | ||
+ | insert = jQuery( selector ), | ||
+ | last = insert.length - 1; | ||
+ | |||
+ | for ( ; i <= last; i++ ) { | ||
+ | elems = i === last ? this : this.clone(true); | ||
+ | jQuery( insert[i] )[ original ]( elems ); | ||
+ | |||
+ | // Modern browsers can apply jQuery collections as arrays, but oldIE needs a .get() | ||
+ | core_push.apply( ret, elems.get() ); | ||
+ | } | ||
+ | |||
+ | return this.pushStack( ret ); | ||
+ | }; | ||
+ | }); | ||
+ | |||
+ | function getAll( context, tag ) { | ||
+ | var elems, elem, | ||
+ | i = 0, | ||
+ | found = typeof context.getElementsByTagName !== core_strundefined ? context.getElementsByTagName( tag || "*" ) : | ||
+ | typeof context.querySelectorAll !== core_strundefined ? context.querySelectorAll( tag || "*" ) : | ||
+ | undefined; | ||
+ | |||
+ | if ( !found ) { | ||
+ | for ( found = [], elems = context.childNodes || context; (elem = elems[i]) != null; i++ ) { | ||
+ | if ( !tag || jQuery.nodeName( elem, tag ) ) { | ||
+ | found.push( elem ); | ||
+ | } else { | ||
+ | jQuery.merge( found, getAll( elem, tag ) ); | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | |||
+ | return tag === undefined || tag && jQuery.nodeName( context, tag ) ? | ||
+ | jQuery.merge( [ context ], found ) : | ||
+ | found; | ||
+ | } | ||
+ | |||
+ | // Used in buildFragment, fixes the defaultChecked property | ||
+ | function fixDefaultChecked( elem ) { | ||
+ | if ( manipulation_rcheckableType.test( elem.type ) ) { | ||
+ | elem.defaultChecked = elem.checked; | ||
+ | } | ||
+ | } | ||
+ | |||
+ | jQuery.extend({ | ||
+ | clone: function( elem, dataAndEvents, deepDataAndEvents ) { | ||
+ | var destElements, node, clone, i, srcElements, | ||
+ | inPage = jQuery.contains( elem.ownerDocument, elem ); | ||
+ | |||
+ | if ( jQuery.support.html5Clone || jQuery.isXMLDoc(elem) || !rnoshimcache.test( "<" + elem.nodeName + ">" ) ) { | ||
+ | clone = elem.cloneNode( true ); | ||
+ | |||
+ | // IE<=8 does not properly clone detached, unknown element nodes | ||
+ | } else { | ||
+ | fragmentDiv.innerHTML = elem.outerHTML; | ||
+ | fragmentDiv.removeChild( clone = fragmentDiv.firstChild ); | ||
+ | } | ||
+ | |||
+ | if ( (!jQuery.support.noCloneEvent || !jQuery.support.noCloneChecked) && | ||
+ | (elem.nodeType === 1 || elem.nodeType === 11) && !jQuery.isXMLDoc(elem) ) { | ||
+ | |||
+ | // We eschew Sizzle here for performance reasons: http://jsperf.com/getall-vs-sizzle/2 | ||
+ | destElements = getAll( clone ); | ||
+ | srcElements = getAll( elem ); | ||
+ | |||
+ | // Fix all IE cloning issues | ||
+ | for ( i = 0; (node = srcElements[i]) != null; ++i ) { | ||
+ | // Ensure that the destination node is not null; Fixes #9587 | ||
+ | if ( destElements[i] ) { | ||
+ | fixCloneNodeIssues( node, destElements[i] ); | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | |||
+ | // Copy the events from the original to the clone | ||
+ | if ( dataAndEvents ) { | ||
+ | if ( deepDataAndEvents ) { | ||
+ | srcElements = srcElements || getAll( elem ); | ||
+ | destElements = destElements || getAll( clone ); | ||
+ | |||
+ | for ( i = 0; (node = srcElements[i]) != null; i++ ) { | ||
+ | cloneCopyEvent( node, destElements[i] ); | ||
+ | } | ||
+ | } else { | ||
+ | cloneCopyEvent( elem, clone ); | ||
+ | } | ||
+ | } | ||
+ | |||
+ | // Preserve script evaluation history | ||
+ | destElements = getAll( clone, "script" ); | ||
+ | if ( destElements.length > 0 ) { | ||
+ | setGlobalEval( destElements, !inPage && getAll( elem, "script" ) ); | ||
+ | } | ||
+ | |||
+ | destElements = srcElements = node = null; | ||
+ | |||
+ | // Return the cloned set | ||
+ | return clone; | ||
+ | }, | ||
+ | |||
+ | buildFragment: function( elems, context, scripts, selection ) { | ||
+ | var j, elem, contains, | ||
+ | tmp, tag, tbody, wrap, | ||
+ | l = elems.length, | ||
+ | |||
+ | // Ensure a safe fragment | ||
+ | safe = createSafeFragment( context ), | ||
+ | |||
+ | nodes = [], | ||
+ | i = 0; | ||
+ | |||
+ | for ( ; i < l; i++ ) { | ||
+ | elem = elems[ i ]; | ||
+ | |||
+ | if ( elem || elem === 0 ) { | ||
+ | |||
+ | // Add nodes directly | ||
+ | if ( jQuery.type( elem ) === "object" ) { | ||
+ | jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem ); | ||
+ | |||
+ | // Convert non-html into a text node | ||
+ | } else if ( !rhtml.test( elem ) ) { | ||
+ | nodes.push( context.createTextNode( elem ) ); | ||
+ | |||
+ | // Convert html into DOM nodes | ||
+ | } else { | ||
+ | tmp = tmp || safe.appendChild( context.createElement("div") ); | ||
+ | |||
+ | // Deserialize a standard representation | ||
+ | tag = ( rtagName.exec( elem ) || ["", ""] )[1].toLowerCase(); | ||
+ | wrap = wrapMap[ tag ] || wrapMap._default; | ||
+ | |||
+ | tmp.innerHTML = wrap[1] + elem.replace( rxhtmlTag, "<$1></$2>" ) + wrap[2]; | ||
+ | |||
+ | // Descend through wrappers to the right content | ||
+ | j = wrap[0]; | ||
+ | while ( j-- ) { | ||
+ | tmp = tmp.lastChild; | ||
+ | } | ||
+ | |||
+ | // Manually add leading whitespace removed by IE | ||
+ | if ( !jQuery.support.leadingWhitespace && rleadingWhitespace.test( elem ) ) { | ||
+ | nodes.push( context.createTextNode( rleadingWhitespace.exec( elem )[0] ) ); | ||
+ | } | ||
+ | |||
+ | // Remove IE's autoinserted <tbody> from table fragments | ||
+ | if ( !jQuery.support.tbody ) { | ||
+ | |||
+ | // String was a <table>, *may* have spurious <tbody> | ||
+ | elem = tag === "table" && !rtbody.test( elem ) ? | ||
+ | tmp.firstChild : | ||
+ | |||
+ | // String was a bare <thead> or <tfoot> | ||
+ | wrap[1] === "<table>" && !rtbody.test( elem ) ? | ||
+ | tmp : | ||
+ | 0; | ||
+ | |||
+ | j = elem && elem.childNodes.length; | ||
+ | while ( j-- ) { | ||
+ | if ( jQuery.nodeName( (tbody = elem.childNodes[j]), "tbody" ) && !tbody.childNodes.length ) { | ||
+ | elem.removeChild( tbody ); | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | |||
+ | jQuery.merge( nodes, tmp.childNodes ); | ||
+ | |||
+ | // Fix #12392 for WebKit and IE > 9 | ||
+ | tmp.textContent = ""; | ||
+ | |||
+ | // Fix #12392 for oldIE | ||
+ | while ( tmp.firstChild ) { | ||
+ | tmp.removeChild( tmp.firstChild ); | ||
+ | } | ||
+ | |||
+ | // Remember the top-level container for proper cleanup | ||
+ | tmp = safe.lastChild; | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | |||
+ | // Fix #11356: Clear elements from fragment | ||
+ | if ( tmp ) { | ||
+ | safe.removeChild( tmp ); | ||
+ | } | ||
+ | |||
+ | // Reset defaultChecked for any radios and checkboxes | ||
+ | // about to be appended to the DOM in IE 6/7 (#8060) | ||
+ | if ( !jQuery.support.appendChecked ) { | ||
+ | jQuery.grep( getAll( nodes, "input" ), fixDefaultChecked ); | ||
+ | } | ||
+ | |||
+ | i = 0; | ||
+ | while ( (elem = nodes[ i++ ]) ) { | ||
+ | |||
+ | // #4087 - If origin and destination elements are the same, and this is | ||
+ | // that element, do not do anything | ||
+ | if ( selection && jQuery.inArray( elem, selection ) !== -1 ) { | ||
+ | continue; | ||
+ | } | ||
+ | |||
+ | contains = jQuery.contains( elem.ownerDocument, elem ); | ||
+ | |||
+ | // Append to fragment | ||
+ | tmp = getAll( safe.appendChild( elem ), "script" ); | ||
+ | |||
+ | // Preserve script evaluation history | ||
+ | if ( contains ) { | ||
+ | setGlobalEval( tmp ); | ||
+ | } | ||
+ | |||
+ | // Capture executables | ||
+ | if ( scripts ) { | ||
+ | j = 0; | ||
+ | while ( (elem = tmp[ j++ ]) ) { | ||
+ | if ( rscriptType.test( elem.type || "" ) ) { | ||
+ | scripts.push( elem ); | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | |||
+ | tmp = null; | ||
+ | |||
+ | return safe; | ||
+ | }, | ||
+ | |||
+ | cleanData: function( elems, /* internal */ acceptData ) { | ||
+ | var elem, type, id, data, | ||
+ | i = 0, | ||
+ | internalKey = jQuery.expando, | ||
+ | cache = jQuery.cache, | ||
+ | deleteExpando = jQuery.support.deleteExpando, | ||
+ | special = jQuery.event.special; | ||
+ | |||
+ | for ( ; (elem = elems[i]) != null; i++ ) { | ||
+ | |||
+ | if ( acceptData || jQuery.acceptData( elem ) ) { | ||
+ | |||
+ | id = elem[ internalKey ]; | ||
+ | data = id && cache[ id ]; | ||
+ | |||
+ | if ( data ) { | ||
+ | if ( data.events ) { | ||
+ | for ( type in data.events ) { | ||
+ | if ( special[ type ] ) { | ||
+ | jQuery.event.remove( elem, type ); | ||
+ | |||
+ | // This is a shortcut to avoid jQuery.event.remove's overhead | ||
+ | } else { | ||
+ | jQuery.removeEvent( elem, type, data.handle ); | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | |||
+ | // Remove cache only if it was not already removed by jQuery.event.remove | ||
+ | if ( cache[ id ] ) { | ||
+ | |||
+ | delete cache[ id ]; | ||
+ | |||
+ | // IE does not allow us to delete expando properties from nodes, | ||
+ | // nor does it have a removeAttribute function on Document nodes; | ||
+ | // we must handle all of these cases | ||
+ | if ( deleteExpando ) { | ||
+ | delete elem[ internalKey ]; | ||
+ | |||
+ | } else if ( typeof elem.removeAttribute !== core_strundefined ) { | ||
+ | elem.removeAttribute( internalKey ); | ||
+ | |||
+ | } else { | ||
+ | elem[ internalKey ] = null; | ||
+ | } | ||
+ | |||
+ | core_deletedIds.push( id ); | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | }, | ||
+ | |||
+ | _evalUrl: function( url ) { | ||
+ | return jQuery.ajax({ | ||
+ | url: url, | ||
+ | type: "GET", | ||
+ | dataType: "script", | ||
+ | async: false, | ||
+ | global: false, | ||
+ | "throws": true | ||
+ | }); | ||
+ | } | ||
+ | }); | ||
+ | jQuery.fn.extend({ | ||
+ | wrapAll: function( html ) { | ||
+ | if ( jQuery.isFunction( html ) ) { | ||
+ | return this.each(function(i) { | ||
+ | jQuery(this).wrapAll( html.call(this, i) ); | ||
+ | }); | ||
+ | } | ||
+ | |||
+ | if ( this[0] ) { | ||
+ | // The elements to wrap the target around | ||
+ | var wrap = jQuery( html, this[0].ownerDocument ).eq(0).clone(true); | ||
+ | |||
+ | if ( this[0].parentNode ) { | ||
+ | wrap.insertBefore( this[0] ); | ||
+ | } | ||
+ | |||
+ | wrap.map(function() { | ||
+ | var elem = this; | ||
+ | |||
+ | while ( elem.firstChild && elem.firstChild.nodeType === 1 ) { | ||
+ | elem = elem.firstChild; | ||
+ | } | ||
+ | |||
+ | return elem; | ||
+ | }).append( this ); | ||
+ | } | ||
+ | |||
+ | return this; | ||
+ | }, | ||
+ | |||
+ | wrapInner: function( html ) { | ||
+ | if ( jQuery.isFunction( html ) ) { | ||
+ | return this.each(function(i) { | ||
+ | jQuery(this).wrapInner( html.call(this, i) ); | ||
+ | }); | ||
+ | } | ||
+ | |||
+ | return this.each(function() { | ||
+ | var self = jQuery( this ), | ||
+ | contents = self.contents(); | ||
+ | |||
+ | if ( contents.length ) { | ||
+ | contents.wrapAll( html ); | ||
+ | |||
+ | } else { | ||
+ | self.append( html ); | ||
+ | } | ||
+ | }); | ||
+ | }, | ||
+ | |||
+ | wrap: function( html ) { | ||
+ | var isFunction = jQuery.isFunction( html ); | ||
+ | |||
+ | return this.each(function(i) { | ||
+ | jQuery( this ).wrapAll( isFunction ? html.call(this, i) : html ); | ||
+ | }); | ||
+ | }, | ||
+ | |||
+ | unwrap: function() { | ||
+ | return this.parent().each(function() { | ||
+ | if ( !jQuery.nodeName( this, "body" ) ) { | ||
+ | jQuery( this ).replaceWith( this.childNodes ); | ||
+ | } | ||
+ | }).end(); | ||
+ | } | ||
+ | }); | ||
+ | var iframe, getStyles, curCSS, | ||
+ | ralpha = /alpha\([^)]*\)/i, | ||
+ | ropacity = /opacity\s*=\s*([^)]*)/, | ||
+ | rposition = /^(top|right|bottom|left)$/, | ||
+ | // swappable if display is none or starts with table except "table", "table-cell", or "table-caption" | ||
+ | // see here for display values: https://developer.mozilla.org/en-US/docs/CSS/display | ||
+ | rdisplayswap = /^(none|table(?!-c[ea]).+)/, | ||
+ | rmargin = /^margin/, | ||
+ | rnumsplit = new RegExp( "^(" + core_pnum + ")(.*)$", "i" ), | ||
+ | rnumnonpx = new RegExp( "^(" + core_pnum + ")(?!px)[a-z%]+$", "i" ), | ||
+ | rrelNum = new RegExp( "^([+-])=(" + core_pnum + ")", "i" ), | ||
+ | elemdisplay = { BODY: "block" }, | ||
+ | |||
+ | cssShow = { position: "absolute", visibility: "hidden", display: "block" }, | ||
+ | cssNormalTransform = { | ||
+ | letterSpacing: 0, | ||
+ | fontWeight: 400 | ||
+ | }, | ||
+ | |||
+ | cssExpand = [ "Top", "Right", "Bottom", "Left" ], | ||
+ | cssPrefixes = [ "Webkit", "O", "Moz", "ms" ]; | ||
+ | |||
+ | // return a css property mapped to a potentially vendor prefixed property | ||
+ | function vendorPropName( style, name ) { | ||
+ | |||
+ | // shortcut for names that are not vendor prefixed | ||
+ | if ( name in style ) { | ||
+ | return name; | ||
+ | } | ||
+ | |||
+ | // check for vendor prefixed names | ||
+ | var capName = name.charAt(0).toUpperCase() + name.slice(1), | ||
+ | origName = name, | ||
+ | i = cssPrefixes.length; | ||
+ | |||
+ | while ( i-- ) { | ||
+ | name = cssPrefixes[ i ] + capName; | ||
+ | if ( name in style ) { | ||
+ | return name; | ||
+ | } | ||
+ | } | ||
+ | |||
+ | return origName; | ||
+ | } | ||
+ | |||
+ | function isHidden( elem, el ) { | ||
+ | // isHidden might be called from jQuery#filter function; | ||
+ | // in that case, element will be second argument | ||
+ | elem = el || elem; | ||
+ | return jQuery.css( elem, "display" ) === "none" || !jQuery.contains( elem.ownerDocument, elem ); | ||
+ | } | ||
+ | |||
+ | function showHide( elements, show ) { | ||
+ | var display, elem, hidden, | ||
+ | values = [], | ||
+ | index = 0, | ||
+ | length = elements.length; | ||
+ | |||
+ | for ( ; index < length; index++ ) { | ||
+ | elem = elements[ index ]; | ||
+ | if ( !elem.style ) { | ||
+ | continue; | ||
+ | } | ||
+ | |||
+ | values[ index ] = jQuery._data( elem, "olddisplay" ); | ||
+ | display = elem.style.display; | ||
+ | if ( show ) { | ||
+ | // Reset the inline display of this element to learn if it is | ||
+ | // being hidden by cascaded rules or not | ||
+ | if ( !values[ index ] && display === "none" ) { | ||
+ | elem.style.display = ""; | ||
+ | } | ||
+ | |||
+ | // Set elements which have been overridden with display: none | ||
+ | // in a stylesheet to whatever the default browser style is | ||
+ | // for such an element | ||
+ | if ( elem.style.display === "" && isHidden( elem ) ) { | ||
+ | values[ index ] = jQuery._data( elem, "olddisplay", css_defaultDisplay(elem.nodeName) ); | ||
+ | } | ||
+ | } else { | ||
+ | |||
+ | if ( !values[ index ] ) { | ||
+ | hidden = isHidden( elem ); | ||
+ | |||
+ | if ( display && display !== "none" || !hidden ) { | ||
+ | jQuery._data( elem, "olddisplay", hidden ? display : jQuery.css( elem, "display" ) ); | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | |||
+ | // Set the display of most of the elements in a second loop | ||
+ | // to avoid the constant reflow | ||
+ | for ( index = 0; index < length; index++ ) { | ||
+ | elem = elements[ index ]; | ||
+ | if ( !elem.style ) { | ||
+ | continue; | ||
+ | } | ||
+ | if ( !show || elem.style.display === "none" || elem.style.display === "" ) { | ||
+ | elem.style.display = show ? values[ index ] || "" : "none"; | ||
+ | } | ||
+ | } | ||
+ | |||
+ | return elements; | ||
+ | } | ||
+ | |||
+ | jQuery.fn.extend({ | ||
+ | css: function( name, value ) { | ||
+ | return jQuery.access( this, function( elem, name, value ) { | ||
+ | var len, styles, | ||
+ | map = {}, | ||
+ | i = 0; | ||
+ | |||
+ | if ( jQuery.isArray( name ) ) { | ||
+ | styles = getStyles( elem ); | ||
+ | len = name.length; | ||
+ | |||
+ | for ( ; i < len; i++ ) { | ||
+ | map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles ); | ||
+ | } | ||
+ | |||
+ | return map; | ||
+ | } | ||
+ | |||
+ | return value !== undefined ? | ||
+ | jQuery.style( elem, name, value ) : | ||
+ | jQuery.css( elem, name ); | ||
+ | }, name, value, arguments.length > 1 ); | ||
+ | }, | ||
+ | show: function() { | ||
+ | return showHide( this, true ); | ||
+ | }, | ||
+ | hide: function() { | ||
+ | return showHide( this ); | ||
+ | }, | ||
+ | toggle: function( state ) { | ||
+ | if ( typeof state === "boolean" ) { | ||
+ | return state ? this.show() : this.hide(); | ||
+ | } | ||
+ | |||
+ | return this.each(function() { | ||
+ | if ( isHidden( this ) ) { | ||
+ | jQuery( this ).show(); | ||
+ | } else { | ||
+ | jQuery( this ).hide(); | ||
+ | } | ||
+ | }); | ||
+ | } | ||
+ | }); | ||
+ | |||
+ | jQuery.extend({ | ||
+ | // Add in style property hooks for overriding the default | ||
+ | // behavior of getting and setting a style property | ||
+ | cssHooks: { | ||
+ | opacity: { | ||
+ | get: function( elem, computed ) { | ||
+ | if ( computed ) { | ||
+ | // We should always get a number back from opacity | ||
+ | var ret = curCSS( elem, "opacity" ); | ||
+ | return ret === "" ? "1" : ret; | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | }, | ||
+ | |||
+ | // Don't automatically add "px" to these possibly-unitless properties | ||
+ | cssNumber: { | ||
+ | "columnCount": true, | ||
+ | "fillOpacity": true, | ||
+ | "fontWeight": true, | ||
+ | "lineHeight": true, | ||
+ | "opacity": true, | ||
+ | "order": true, | ||
+ | "orphans": true, | ||
+ | "widows": true, | ||
+ | "zIndex": true, | ||
+ | "zoom": true | ||
+ | }, | ||
+ | |||
+ | // Add in properties whose names you wish to fix before | ||
+ | // setting or getting the value | ||
+ | cssProps: { | ||
+ | // normalize float css property | ||
+ | "float": jQuery.support.cssFloat ? "cssFloat" : "styleFloat" | ||
+ | }, | ||
+ | |||
+ | // Get and set the style property on a DOM Node | ||
+ | style: function( elem, name, value, extra ) { | ||
+ | // Don't set styles on text and comment nodes | ||
+ | if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) { | ||
+ | return; | ||
+ | } | ||
+ | |||
+ | // Make sure that we're working with the right name | ||
+ | var ret, type, hooks, | ||
+ | origName = jQuery.camelCase( name ), | ||
+ | style = elem.style; | ||
+ | |||
+ | name = jQuery.cssProps[ origName ] || ( jQuery.cssProps[ origName ] = vendorPropName( style, origName ) ); | ||
+ | |||
+ | // gets hook for the prefixed version | ||
+ | // followed by the unprefixed version | ||
+ | hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ]; | ||
+ | |||
+ | // Check if we're setting a value | ||
+ | if ( value !== undefined ) { | ||
+ | type = typeof value; | ||
+ | |||
+ | // convert relative number strings (+= or -=) to relative numbers. #7345 | ||
+ | if ( type === "string" && (ret = rrelNum.exec( value )) ) { | ||
+ | value = ( ret[1] + 1 ) * ret[2] + parseFloat( jQuery.css( elem, name ) ); | ||
+ | // Fixes bug #9237 | ||
+ | type = "number"; | ||
+ | } | ||
+ | |||
+ | // Make sure that NaN and null values aren't set. See: #7116 | ||
+ | if ( value == null || type === "number" && isNaN( value ) ) { | ||
+ | return; | ||
+ | } | ||
+ | |||
+ | // If a number was passed in, add 'px' to the (except for certain CSS properties) | ||
+ | if ( type === "number" && !jQuery.cssNumber[ origName ] ) { | ||
+ | value += "px"; | ||
+ | } | ||
+ | |||
+ | // Fixes #8908, it can be done more correctly by specifing setters in cssHooks, | ||
+ | // but it would mean to define eight (for every problematic property) identical functions | ||
+ | if ( !jQuery.support.clearCloneStyle && value === "" && name.indexOf("background") === 0 ) { | ||
+ | style[ name ] = "inherit"; | ||
+ | } | ||
+ | |||
+ | // If a hook was provided, use that value, otherwise just set the specified value | ||
+ | if ( !hooks || !("set" in hooks) || (value = hooks.set( elem, value, extra )) !== undefined ) { | ||
+ | |||
+ | // Wrapped to prevent IE from throwing errors when 'invalid' values are provided | ||
+ | // Fixes bug #5509 | ||
+ | try { | ||
+ | style[ name ] = value; | ||
+ | } catch(e) {} | ||
+ | } | ||
+ | |||
+ | } else { | ||
+ | // If a hook was provided get the non-computed value from there | ||
+ | if ( hooks && "get" in hooks && (ret = hooks.get( elem, false, extra )) !== undefined ) { | ||
+ | return ret; | ||
+ | } | ||
+ | |||
+ | // Otherwise just get the value from the style object | ||
+ | return style[ name ]; | ||
+ | } | ||
+ | }, | ||
+ | |||
+ | css: function( elem, name, extra, styles ) { | ||
+ | var num, val, hooks, | ||
+ | origName = jQuery.camelCase( name ); | ||
+ | |||
+ | // Make sure that we're working with the right name | ||
+ | name = jQuery.cssProps[ origName ] || ( jQuery.cssProps[ origName ] = vendorPropName( elem.style, origName ) ); | ||
+ | |||
+ | // gets hook for the prefixed version | ||
+ | // followed by the unprefixed version | ||
+ | hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ]; | ||
+ | |||
+ | // If a hook was provided get the computed value from there | ||
+ | if ( hooks && "get" in hooks ) { | ||
+ | val = hooks.get( elem, true, extra ); | ||
+ | } | ||
+ | |||
+ | // Otherwise, if a way to get the computed value exists, use that | ||
+ | if ( val === undefined ) { | ||
+ | val = curCSS( elem, name, styles ); | ||
+ | } | ||
+ | |||
+ | //convert "normal" to computed value | ||
+ | if ( val === "normal" && name in cssNormalTransform ) { | ||
+ | val = cssNormalTransform[ name ]; | ||
+ | } | ||
+ | |||
+ | // Return, converting to number if forced or a qualifier was provided and val looks numeric | ||
+ | if ( extra === "" || extra ) { | ||
+ | num = parseFloat( val ); | ||
+ | return extra === true || jQuery.isNumeric( num ) ? num || 0 : val; | ||
+ | } | ||
+ | return val; | ||
+ | } | ||
+ | }); | ||
+ | |||
+ | // NOTE: we've included the "window" in window.getComputedStyle | ||
+ | // because jsdom on node.js will break without it. | ||
+ | if ( window.getComputedStyle ) { | ||
+ | getStyles = function( elem ) { | ||
+ | return window.getComputedStyle( elem, null ); | ||
+ | }; | ||
+ | |||
+ | curCSS = function( elem, name, _computed ) { | ||
+ | var width, minWidth, maxWidth, | ||
+ | computed = _computed || getStyles( elem ), | ||
+ | |||
+ | // getPropertyValue is only needed for .css('filter') in IE9, see #12537 | ||
+ | ret = computed ? computed.getPropertyValue( name ) || computed[ name ] : undefined, | ||
+ | style = elem.style; | ||
+ | |||
+ | if ( computed ) { | ||
+ | |||
+ | if ( ret === "" && !jQuery.contains( elem.ownerDocument, elem ) ) { | ||
+ | ret = jQuery.style( elem, name ); | ||
+ | } | ||
+ | |||
+ | // A tribute to the "awesome hack by Dean Edwards" | ||
+ | // Chrome < 17 and Safari 5.0 uses "computed value" instead of "used value" for margin-right | ||
+ | // Safari 5.1.7 (at least) returns percentage for a larger set of values, but width seems to be reliably pixels | ||
+ | // this is against the CSSOM draft spec: http://dev.w3.org/csswg/cssom/#resolved-values | ||
+ | if ( rnumnonpx.test( ret ) && rmargin.test( name ) ) { | ||
+ | |||
+ | // Remember the original values | ||
+ | width = style.width; | ||
+ | minWidth = style.minWidth; | ||
+ | maxWidth = style.maxWidth; | ||
+ | |||
+ | // Put in the new values to get a computed value out | ||
+ | style.minWidth = style.maxWidth = style.width = ret; | ||
+ | ret = computed.width; | ||
+ | |||
+ | // Revert the changed values | ||
+ | style.width = width; | ||
+ | style.minWidth = minWidth; | ||
+ | style.maxWidth = maxWidth; | ||
+ | } | ||
+ | } | ||
+ | |||
+ | return ret; | ||
+ | }; | ||
+ | } else if ( document.documentElement.currentStyle ) { | ||
+ | getStyles = function( elem ) { | ||
+ | return elem.currentStyle; | ||
+ | }; | ||
+ | |||
+ | curCSS = function( elem, name, _computed ) { | ||
+ | var left, rs, rsLeft, | ||
+ | computed = _computed || getStyles( elem ), | ||
+ | ret = computed ? computed[ name ] : undefined, | ||
+ | style = elem.style; | ||
+ | |||
+ | // Avoid setting ret to empty string here | ||
+ | // so we don't default to auto | ||
+ | if ( ret == null && style && style[ name ] ) { | ||
+ | ret = style[ name ]; | ||
+ | } | ||
+ | |||
+ | // From the awesome hack by Dean Edwards | ||
+ | // http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291 | ||
+ | |||
+ | // If we're not dealing with a regular pixel number | ||
+ | // but a number that has a weird ending, we need to convert it to pixels | ||
+ | // but not position css attributes, as those are proportional to the parent element instead | ||
+ | // and we can't measure the parent instead because it might trigger a "stacking dolls" problem | ||
+ | if ( rnumnonpx.test( ret ) && !rposition.test( name ) ) { | ||
+ | |||
+ | // Remember the original values | ||
+ | left = style.left; | ||
+ | rs = elem.runtimeStyle; | ||
+ | rsLeft = rs && rs.left; | ||
+ | |||
+ | // Put in the new values to get a computed value out | ||
+ | if ( rsLeft ) { | ||
+ | rs.left = elem.currentStyle.left; | ||
+ | } | ||
+ | style.left = name === "fontSize" ? "1em" : ret; | ||
+ | ret = style.pixelLeft + "px"; | ||
+ | |||
+ | // Revert the changed values | ||
+ | style.left = left; | ||
+ | if ( rsLeft ) { | ||
+ | rs.left = rsLeft; | ||
+ | } | ||
+ | } | ||
+ | |||
+ | return ret === "" ? "auto" : ret; | ||
+ | }; | ||
+ | } | ||
+ | |||
+ | function setPositiveNumber( elem, value, subtract ) { | ||
+ | var matches = rnumsplit.exec( value ); | ||
+ | return matches ? | ||
+ | // Guard against undefined "subtract", e.g., when used as in cssHooks | ||
+ | Math.max( 0, matches[ 1 ] - ( subtract || 0 ) ) + ( matches[ 2 ] || "px" ) : | ||
+ | value; | ||
+ | } | ||
+ | |||
+ | function augmentWidthOrHeight( elem, name, extra, isBorderBox, styles ) { | ||
+ | var i = extra === ( isBorderBox ? "border" : "content" ) ? | ||
+ | // If we already have the right measurement, avoid augmentation | ||
+ | 4 : | ||
+ | // Otherwise initialize for horizontal or vertical properties | ||
+ | name === "width" ? 1 : 0, | ||
+ | |||
+ | val = 0; | ||
+ | |||
+ | for ( ; i < 4; i += 2 ) { | ||
+ | // both box models exclude margin, so add it if we want it | ||
+ | if ( extra === "margin" ) { | ||
+ | val += jQuery.css( elem, extra + cssExpand[ i ], true, styles ); | ||
+ | } | ||
+ | |||
+ | if ( isBorderBox ) { | ||
+ | // border-box includes padding, so remove it if we want content | ||
+ | if ( extra === "content" ) { | ||
+ | val -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles ); | ||
+ | } | ||
+ | |||
+ | // at this point, extra isn't border nor margin, so remove border | ||
+ | if ( extra !== "margin" ) { | ||
+ | val -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); | ||
+ | } | ||
+ | } else { | ||
+ | // at this point, extra isn't content, so add padding | ||
+ | val += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles ); | ||
+ | |||
+ | // at this point, extra isn't content nor padding, so add border | ||
+ | if ( extra !== "padding" ) { | ||
+ | val += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | |||
+ | return val; | ||
+ | } | ||
+ | |||
+ | function getWidthOrHeight( elem, name, extra ) { | ||
+ | |||
+ | // Start with offset property, which is equivalent to the border-box value | ||
+ | var valueIsBorderBox = true, | ||
+ | val = name === "width" ? elem.offsetWidth : elem.offsetHeight, | ||
+ | styles = getStyles( elem ), | ||
+ | isBorderBox = jQuery.support.boxSizing && jQuery.css( elem, "boxSizing", false, styles ) === "border-box"; | ||
+ | |||
+ | // some non-html elements return undefined for offsetWidth, so check for null/undefined | ||
+ | // svg - https://bugzilla.mozilla.org/show_bug.cgi?id=649285 | ||
+ | // MathML - https://bugzilla.mozilla.org/show_bug.cgi?id=491668 | ||
+ | if ( val <= 0 || val == null ) { | ||
+ | // Fall back to computed then uncomputed css if necessary | ||
+ | val = curCSS( elem, name, styles ); | ||
+ | if ( val < 0 || val == null ) { | ||
+ | val = elem.style[ name ]; | ||
+ | } | ||
+ | |||
+ | // Computed unit is not pixels. Stop here and return. | ||
+ | if ( rnumnonpx.test(val) ) { | ||
+ | return val; | ||
+ | } | ||
+ | |||
+ | // we need the check for style in case a browser which returns unreliable values | ||
+ | // for getComputedStyle silently falls back to the reliable elem.style | ||
+ | valueIsBorderBox = isBorderBox && ( jQuery.support.boxSizingReliable || val === elem.style[ name ] ); | ||
+ | |||
+ | // Normalize "", auto, and prepare for extra | ||
+ | val = parseFloat( val ) || 0; | ||
+ | } | ||
+ | |||
+ | // use the active box-sizing model to add/subtract irrelevant styles | ||
+ | return ( val + | ||
+ | augmentWidthOrHeight( | ||
+ | elem, | ||
+ | name, | ||
+ | extra || ( isBorderBox ? "border" : "content" ), | ||
+ | valueIsBorderBox, | ||
+ | styles | ||
+ | ) | ||
+ | ) + "px"; | ||
+ | } | ||
+ | |||
+ | // Try to determine the default display value of an element | ||
+ | function css_defaultDisplay( nodeName ) { | ||
+ | var doc = document, | ||
+ | display = elemdisplay[ nodeName ]; | ||
+ | |||
+ | if ( !display ) { | ||
+ | display = actualDisplay( nodeName, doc ); | ||
+ | |||
+ | // If the simple way fails, read from inside an iframe | ||
+ | if ( display === "none" || !display ) { | ||
+ | // Use the already-created iframe if possible | ||
+ | iframe = ( iframe || | ||
+ | jQuery("<iframe frameborder='0' width='0' height='0'/>") | ||
+ | .css( "cssText", "display:block !important" ) | ||
+ | ).appendTo( doc.documentElement ); | ||
+ | |||
+ | // Always write a new HTML skeleton so Webkit and Firefox don't choke on reuse | ||
+ | doc = ( iframe[0].contentWindow || iframe[0].contentDocument ).document; | ||
+ | doc.write("<!doctype html><html><body>"); | ||
+ | doc.close(); | ||
+ | |||
+ | display = actualDisplay( nodeName, doc ); | ||
+ | iframe.detach(); | ||
+ | } | ||
+ | |||
+ | // Store the correct default display | ||
+ | elemdisplay[ nodeName ] = display; | ||
+ | } | ||
+ | |||
+ | return display; | ||
+ | } | ||
+ | |||
+ | // Called ONLY from within css_defaultDisplay | ||
+ | function actualDisplay( name, doc ) { | ||
+ | var elem = jQuery( doc.createElement( name ) ).appendTo( doc.body ), | ||
+ | display = jQuery.css( elem[0], "display" ); | ||
+ | elem.remove(); | ||
+ | return display; | ||
+ | } | ||
+ | |||
+ | jQuery.each([ "height", "width" ], function( i, name ) { | ||
+ | jQuery.cssHooks[ name ] = { | ||
+ | get: function( elem, computed, extra ) { | ||
+ | if ( computed ) { | ||
+ | // certain elements can have dimension info if we invisibly show them | ||
+ | // however, it must have a current display style that would benefit from this | ||
+ | return elem.offsetWidth === 0 && rdisplayswap.test( jQuery.css( elem, "display" ) ) ? | ||
+ | jQuery.swap( elem, cssShow, function() { | ||
+ | return getWidthOrHeight( elem, name, extra ); | ||
+ | }) : | ||
+ | getWidthOrHeight( elem, name, extra ); | ||
+ | } | ||
+ | }, | ||
+ | |||
+ | set: function( elem, value, extra ) { | ||
+ | var styles = extra && getStyles( elem ); | ||
+ | return setPositiveNumber( elem, value, extra ? | ||
+ | augmentWidthOrHeight( | ||
+ | elem, | ||
+ | name, | ||
+ | extra, | ||
+ | jQuery.support.boxSizing && jQuery.css( elem, "boxSizing", false, styles ) === "border-box", | ||
+ | styles | ||
+ | ) : 0 | ||
+ | ); | ||
+ | } | ||
+ | }; | ||
+ | }); | ||
+ | |||
+ | if ( !jQuery.support.opacity ) { | ||
+ | jQuery.cssHooks.opacity = { | ||
+ | get: function( elem, computed ) { | ||
+ | // IE uses filters for opacity | ||
+ | return ropacity.test( (computed && elem.currentStyle ? elem.currentStyle.filter : elem.style.filter) || "" ) ? | ||
+ | ( 0.01 * parseFloat( RegExp.$1 ) ) + "" : | ||
+ | computed ? "1" : ""; | ||
+ | }, | ||
+ | |||
+ | set: function( elem, value ) { | ||
+ | var style = elem.style, | ||
+ | currentStyle = elem.currentStyle, | ||
+ | opacity = jQuery.isNumeric( value ) ? "alpha(opacity=" + value * 100 + ")" : "", | ||
+ | filter = currentStyle && currentStyle.filter || style.filter || ""; | ||
+ | |||
+ | // IE has trouble with opacity if it does not have layout | ||
+ | // Force it by setting the zoom level | ||
+ | style.zoom = 1; | ||
+ | |||
+ | // if setting opacity to 1, and no other filters exist - attempt to remove filter attribute #6652 | ||
+ | // if value === "", then remove inline opacity #12685 | ||
+ | if ( ( value >= 1 || value === "" ) && | ||
+ | jQuery.trim( filter.replace( ralpha, "" ) ) === "" && | ||
+ | style.removeAttribute ) { | ||
+ | |||
+ | // Setting style.filter to null, "" & " " still leave "filter:" in the cssText | ||
+ | // if "filter:" is present at all, clearType is disabled, we want to avoid this | ||
+ | // style.removeAttribute is IE Only, but so apparently is this code path... | ||
+ | style.removeAttribute( "filter" ); | ||
+ | |||
+ | // if there is no filter style applied in a css rule or unset inline opacity, we are done | ||
+ | if ( value === "" || currentStyle && !currentStyle.filter ) { | ||
+ | return; | ||
+ | } | ||
+ | } | ||
+ | |||
+ | // otherwise, set new filter values | ||
+ | style.filter = ralpha.test( filter ) ? | ||
+ | filter.replace( ralpha, opacity ) : | ||
+ | filter + " " + opacity; | ||
+ | } | ||
+ | }; | ||
+ | } | ||
+ | |||
+ | // These hooks cannot be added until DOM ready because the support test | ||
+ | // for it is not run until after DOM ready | ||
+ | jQuery(function() { | ||
+ | if ( !jQuery.support.reliableMarginRight ) { | ||
+ | jQuery.cssHooks.marginRight = { | ||
+ | get: function( elem, computed ) { | ||
+ | if ( computed ) { | ||
+ | // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right | ||
+ | // Work around by temporarily setting element display to inline-block | ||
+ | return jQuery.swap( elem, { "display": "inline-block" }, | ||
+ | curCSS, [ elem, "marginRight" ] ); | ||
+ | } | ||
+ | } | ||
+ | }; | ||
+ | } | ||
+ | |||
+ | // Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084 | ||
+ | // getComputedStyle returns percent when specified for top/left/bottom/right | ||
+ | // rather than make the css module depend on the offset module, we just check for it here | ||
+ | if ( !jQuery.support.pixelPosition && jQuery.fn.position ) { | ||
+ | jQuery.each( [ "top", "left" ], function( i, prop ) { | ||
+ | jQuery.cssHooks[ prop ] = { | ||
+ | get: function( elem, computed ) { | ||
+ | if ( computed ) { | ||
+ | computed = curCSS( elem, prop ); | ||
+ | // if curCSS returns percentage, fallback to offset | ||
+ | return rnumnonpx.test( computed ) ? | ||
+ | jQuery( elem ).position()[ prop ] + "px" : | ||
+ | computed; | ||
+ | } | ||
+ | } | ||
+ | }; | ||
+ | }); | ||
+ | } | ||
+ | |||
+ | }); | ||
+ | |||
+ | if ( jQuery.expr && jQuery.expr.filters ) { | ||
+ | jQuery.expr.filters.hidden = function( elem ) { | ||
+ | // Support: Opera <= 12.12 | ||
+ | // Opera reports offsetWidths and offsetHeights less than zero on some elements | ||
+ | return elem.offsetWidth <= 0 && elem.offsetHeight <= 0 || | ||
+ | (!jQuery.support.reliableHiddenOffsets && ((elem.style && elem.style.display) || jQuery.css( elem, "display" )) === "none"); | ||
+ | }; | ||
+ | |||
+ | jQuery.expr.filters.visible = function( elem ) { | ||
+ | return !jQuery.expr.filters.hidden( elem ); | ||
+ | }; | ||
+ | } | ||
+ | |||
+ | // These hooks are used by animate to expand properties | ||
+ | jQuery.each({ | ||
+ | margin: "", | ||
+ | padding: "", | ||
+ | border: "Width" | ||
+ | }, function( prefix, suffix ) { | ||
+ | jQuery.cssHooks[ prefix + suffix ] = { | ||
+ | expand: function( value ) { | ||
+ | var i = 0, | ||
+ | expanded = {}, | ||
+ | |||
+ | // assumes a single number if not a string | ||
+ | parts = typeof value === "string" ? value.split(" ") : [ value ]; | ||
+ | |||
+ | for ( ; i < 4; i++ ) { | ||
+ | expanded[ prefix + cssExpand[ i ] + suffix ] = | ||
+ | parts[ i ] || parts[ i - 2 ] || parts[ 0 ]; | ||
+ | } | ||
+ | |||
+ | return expanded; | ||
+ | } | ||
+ | }; | ||
+ | |||
+ | if ( !rmargin.test( prefix ) ) { | ||
+ | jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber; | ||
+ | } | ||
+ | }); | ||
+ | var r20 = /%20/g, | ||
+ | rbracket = /\[\]$/, | ||
+ | rCRLF = /\r?\n/g, | ||
+ | rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i, | ||
+ | rsubmittable = /^(?:input|select|textarea|keygen)/i; | ||
+ | |||
+ | jQuery.fn.extend({ | ||
+ | serialize: function() { | ||
+ | return jQuery.param( this.serializeArray() ); | ||
+ | }, | ||
+ | serializeArray: function() { | ||
+ | return this.map(function(){ | ||
+ | // Can add propHook for "elements" to filter or add form elements | ||
+ | var elements = jQuery.prop( this, "elements" ); | ||
+ | return elements ? jQuery.makeArray( elements ) : this; | ||
+ | }) | ||
+ | .filter(function(){ | ||
+ | var type = this.type; | ||
+ | // Use .is(":disabled") so that fieldset[disabled] works | ||
+ | return this.name && !jQuery( this ).is( ":disabled" ) && | ||
+ | rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) && | ||
+ | ( this.checked || !manipulation_rcheckableType.test( type ) ); | ||
+ | }) | ||
+ | .map(function( i, elem ){ | ||
+ | var val = jQuery( this ).val(); | ||
+ | |||
+ | return val == null ? | ||
+ | null : | ||
+ | jQuery.isArray( val ) ? | ||
+ | jQuery.map( val, function( val ){ | ||
+ | return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) }; | ||
+ | }) : | ||
+ | { name: elem.name, value: val.replace( rCRLF, "\r\n" ) }; | ||
+ | }).get(); | ||
+ | } | ||
+ | }); | ||
+ | |||
+ | //Serialize an array of form elements or a set of | ||
+ | //key/values into a query string | ||
+ | jQuery.param = function( a, traditional ) { | ||
+ | var prefix, | ||
+ | s = [], | ||
+ | add = function( key, value ) { | ||
+ | // If value is a function, invoke it and return its value | ||
+ | value = jQuery.isFunction( value ) ? value() : ( value == null ? "" : value ); | ||
+ | s[ s.length ] = encodeURIComponent( key ) + "=" + encodeURIComponent( value ); | ||
+ | }; | ||
+ | |||
+ | // Set traditional to true for jQuery <= 1.3.2 behavior. | ||
+ | if ( traditional === undefined ) { | ||
+ | traditional = jQuery.ajaxSettings && jQuery.ajaxSettings.traditional; | ||
+ | } | ||
+ | |||
+ | // If an array was passed in, assume that it is an array of form elements. | ||
+ | if ( jQuery.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) { | ||
+ | // Serialize the form elements | ||
+ | jQuery.each( a, function() { | ||
+ | add( this.name, this.value ); | ||
+ | }); | ||
+ | |||
+ | } else { | ||
+ | // If traditional, encode the "old" way (the way 1.3.2 or older | ||
+ | // did it), otherwise encode params recursively. | ||
+ | for ( prefix in a ) { | ||
+ | buildParams( prefix, a[ prefix ], traditional, add ); | ||
+ | } | ||
+ | } | ||
+ | |||
+ | // Return the resulting serialization | ||
+ | return s.join( "&" ).replace( r20, "+" ); | ||
+ | }; | ||
+ | |||
+ | function buildParams( prefix, obj, traditional, add ) { | ||
+ | var name; | ||
+ | |||
+ | if ( jQuery.isArray( obj ) ) { | ||
+ | // Serialize array item. | ||
+ | jQuery.each( obj, function( i, v ) { | ||
+ | if ( traditional || rbracket.test( prefix ) ) { | ||
+ | // Treat each array item as a scalar. | ||
+ | add( prefix, v ); | ||
+ | |||
+ | } else { | ||
+ | // Item is non-scalar (array or object), encode its numeric index. | ||
+ | buildParams( prefix + "[" + ( typeof v === "object" ? i : "" ) + "]", v, traditional, add ); | ||
+ | } | ||
+ | }); | ||
+ | |||
+ | } else if ( !traditional && jQuery.type( obj ) === "object" ) { | ||
+ | // Serialize object item. | ||
+ | for ( name in obj ) { | ||
+ | buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add ); | ||
+ | } | ||
+ | |||
+ | } else { | ||
+ | // Serialize scalar item. | ||
+ | add( prefix, obj ); | ||
+ | } | ||
+ | } | ||
+ | jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblclick " + | ||
+ | "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " + | ||
+ | "change select submit keydown keypress keyup error contextmenu").split(" "), function( i, name ) { | ||
+ | |||
+ | // Handle event binding | ||
+ | jQuery.fn[ name ] = function( data, fn ) { | ||
+ | return arguments.length > 0 ? | ||
+ | this.on( name, null, data, fn ) : | ||
+ | this.trigger( name ); | ||
+ | }; | ||
+ | }); | ||
+ | |||
+ | jQuery.fn.extend({ | ||
+ | hover: function( fnOver, fnOut ) { | ||
+ | return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver ); | ||
+ | }, | ||
+ | |||
+ | bind: function( types, data, fn ) { | ||
+ | return this.on( types, null, data, fn ); | ||
+ | }, | ||
+ | unbind: function( types, fn ) { | ||
+ | return this.off( types, null, fn ); | ||
+ | }, | ||
+ | |||
+ | delegate: function( selector, types, data, fn ) { | ||
+ | return this.on( types, selector, data, fn ); | ||
+ | }, | ||
+ | undelegate: function( selector, types, fn ) { | ||
+ | // ( namespace ) or ( selector, types [, fn] ) | ||
+ | return arguments.length === 1 ? this.off( selector, "**" ) : this.off( types, selector || "**", fn ); | ||
+ | } | ||
+ | }); | ||
+ | var | ||
+ | // Document location | ||
+ | ajaxLocParts, | ||
+ | ajaxLocation, | ||
+ | ajax_nonce = jQuery.now(), | ||
+ | |||
+ | ajax_rquery = /\?/, | ||
+ | rhash = /#.*$/, | ||
+ | rts = /([?&])_=[^&]*/, | ||
+ | rheaders = /^(.*?):[ \t]*([^\r\n]*)\r?$/mg, // IE leaves an \r character at EOL | ||
+ | // #7653, #8125, #8152: local protocol detection | ||
+ | rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/, | ||
+ | rnoContent = /^(?:GET|HEAD)$/, | ||
+ | rprotocol = /^\/\//, | ||
+ | rurl = /^([\w.+-]+:)(?:\/\/([^\/?#:]*)(?::(\d+)|)|)/, | ||
+ | |||
+ | // Keep a copy of the old load method | ||
+ | _load = jQuery.fn.load, | ||
+ | |||
+ | /* Prefilters | ||
+ | * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example) | ||
+ | * 2) These are called: | ||
+ | * - BEFORE asking for a transport | ||
+ | * - AFTER param serialization (s.data is a string if s.processData is true) | ||
+ | * 3) key is the dataType | ||
+ | * 4) the catchall symbol "*" can be used | ||
+ | * 5) execution will start with transport dataType and THEN continue down to "*" if needed | ||
+ | */ | ||
+ | prefilters = {}, | ||
+ | |||
+ | /* Transports bindings | ||
+ | * 1) key is the dataType | ||
+ | * 2) the catchall symbol "*" can be used | ||
+ | * 3) selection will start with transport dataType and THEN go to "*" if needed | ||
+ | */ | ||
+ | transports = {}, | ||
+ | |||
+ | // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression | ||
+ | allTypes = "*/".concat("*"); | ||
+ | |||
+ | // #8138, IE may throw an exception when accessing | ||
+ | // a field from window.location if document.domain has been set | ||
+ | try { | ||
+ | ajaxLocation = location.href; | ||
+ | } catch( e ) { | ||
+ | // Use the href attribute of an A element | ||
+ | // since IE will modify it given document.location | ||
+ | ajaxLocation = document.createElement( "a" ); | ||
+ | ajaxLocation.href = ""; | ||
+ | ajaxLocation = ajaxLocation.href; | ||
+ | } | ||
+ | |||
+ | // Segment location into parts | ||
+ | ajaxLocParts = rurl.exec( ajaxLocation.toLowerCase() ) || []; | ||
+ | |||
+ | // Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport | ||
+ | function addToPrefiltersOrTransports( structure ) { | ||
+ | |||
+ | // dataTypeExpression is optional and defaults to "*" | ||
+ | return function( dataTypeExpression, func ) { | ||
+ | |||
+ | if ( typeof dataTypeExpression !== "string" ) { | ||
+ | func = dataTypeExpression; | ||
+ | dataTypeExpression = "*"; | ||
+ | } | ||
+ | |||
+ | var dataType, | ||
+ | i = 0, | ||
+ | dataTypes = dataTypeExpression.toLowerCase().match( core_rnotwhite ) || []; | ||
+ | |||
+ | if ( jQuery.isFunction( func ) ) { | ||
+ | // For each dataType in the dataTypeExpression | ||
+ | while ( (dataType = dataTypes[i++]) ) { | ||
+ | // Prepend if requested | ||
+ | if ( dataType[0] === "+" ) { | ||
+ | dataType = dataType.slice( 1 ) || "*"; | ||
+ | (structure[ dataType ] = structure[ dataType ] || []).unshift( func ); | ||
+ | |||
+ | // Otherwise append | ||
+ | } else { | ||
+ | (structure[ dataType ] = structure[ dataType ] || []).push( func ); | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | }; | ||
+ | } | ||
+ | |||
+ | // Base inspection function for prefilters and transports | ||
+ | function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) { | ||
+ | |||
+ | var inspected = {}, | ||
+ | seekingTransport = ( structure === transports ); | ||
+ | |||
+ | function inspect( dataType ) { | ||
+ | var selected; | ||
+ | inspected[ dataType ] = true; | ||
+ | jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) { | ||
+ | var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR ); | ||
+ | if( typeof dataTypeOrTransport === "string" && !seekingTransport && !inspected[ dataTypeOrTransport ] ) { | ||
+ | options.dataTypes.unshift( dataTypeOrTransport ); | ||
+ | inspect( dataTypeOrTransport ); | ||
+ | return false; | ||
+ | } else if ( seekingTransport ) { | ||
+ | return !( selected = dataTypeOrTransport ); | ||
+ | } | ||
+ | }); | ||
+ | return selected; | ||
+ | } | ||
+ | |||
+ | return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" ); | ||
+ | } | ||
+ | |||
+ | // A special extend for ajax options | ||
+ | // that takes "flat" options (not to be deep extended) | ||
+ | // Fixes #9887 | ||
+ | function ajaxExtend( target, src ) { | ||
+ | var deep, key, | ||
+ | flatOptions = jQuery.ajaxSettings.flatOptions || {}; | ||
+ | |||
+ | for ( key in src ) { | ||
+ | if ( src[ key ] !== undefined ) { | ||
+ | ( flatOptions[ key ] ? target : ( deep || (deep = {}) ) )[ key ] = src[ key ]; | ||
+ | } | ||
+ | } | ||
+ | if ( deep ) { | ||
+ | jQuery.extend( true, target, deep ); | ||
+ | } | ||
+ | |||
+ | return target; | ||
+ | } | ||
+ | |||
+ | jQuery.fn.load = function( url, params, callback ) { | ||
+ | if ( typeof url !== "string" && _load ) { | ||
+ | return _load.apply( this, arguments ); | ||
+ | } | ||
+ | |||
+ | var selector, response, type, | ||
+ | self = this, | ||
+ | off = url.indexOf(" "); | ||
+ | |||
+ | if ( off >= 0 ) { | ||
+ | selector = url.slice( off, url.length ); | ||
+ | url = url.slice( 0, off ); | ||
+ | } | ||
+ | |||
+ | // If it's a function | ||
+ | if ( jQuery.isFunction( params ) ) { | ||
+ | |||
+ | // We assume that it's the callback | ||
+ | callback = params; | ||
+ | params = undefined; | ||
+ | |||
+ | // Otherwise, build a param string | ||
+ | } else if ( params && typeof params === "object" ) { | ||
+ | type = "POST"; | ||
+ | } | ||
+ | |||
+ | // If we have elements to modify, make the request | ||
+ | if ( self.length > 0 ) { | ||
+ | jQuery.ajax({ | ||
+ | url: url, | ||
+ | |||
+ | // if "type" variable is undefined, then "GET" method will be used | ||
+ | type: type, | ||
+ | dataType: "html", | ||
+ | data: params | ||
+ | }).done(function( responseText ) { | ||
+ | |||
+ | // Save response for use in complete callback | ||
+ | response = arguments; | ||
+ | |||
+ | self.html( selector ? | ||
+ | |||
+ | // If a selector was specified, locate the right elements in a dummy div | ||
+ | // Exclude scripts to avoid IE 'Permission Denied' errors | ||
+ | jQuery("<div>").append( jQuery.parseHTML( responseText ) ).find( selector ) : | ||
+ | |||
+ | // Otherwise use the full result | ||
+ | responseText ); | ||
+ | |||
+ | }).complete( callback && function( jqXHR, status ) { | ||
+ | self.each( callback, response || [ jqXHR.responseText, status, jqXHR ] ); | ||
+ | }); | ||
+ | } | ||
+ | |||
+ | return this; | ||
+ | }; | ||
+ | |||
+ | // Attach a bunch of functions for handling common AJAX events | ||
+ | jQuery.each( [ "ajaxStart", "ajaxStop", "ajaxComplete", "ajaxError", "ajaxSuccess", "ajaxSend" ], function( i, type ){ | ||
+ | jQuery.fn[ type ] = function( fn ){ | ||
+ | return this.on( type, fn ); | ||
+ | }; | ||
+ | }); | ||
+ | |||
+ | jQuery.extend({ | ||
+ | |||
+ | // Counter for holding the number of active queries | ||
+ | active: 0, | ||
+ | |||
+ | // Last-Modified header cache for next request | ||
+ | lastModified: {}, | ||
+ | etag: {}, | ||
+ | |||
+ | ajaxSettings: { | ||
+ | url: ajaxLocation, | ||
+ | type: "GET", | ||
+ | isLocal: rlocalProtocol.test( ajaxLocParts[ 1 ] ), | ||
+ | global: true, | ||
+ | processData: true, | ||
+ | async: true, | ||
+ | contentType: "application/x-www-form-urlencoded; charset=UTF-8", | ||
+ | /* | ||
+ | timeout: 0, | ||
+ | data: null, | ||
+ | dataType: null, | ||
+ | username: null, | ||
+ | password: null, | ||
+ | cache: null, | ||
+ | throws: false, | ||
+ | traditional: false, | ||
+ | headers: {}, | ||
+ | */ | ||
+ | |||
+ | accepts: { | ||
+ | "*": allTypes, | ||
+ | text: "text/plain", | ||
+ | html: "text/html", | ||
+ | xml: "application/xml, text/xml", | ||
+ | json: "application/json, text/javascript" | ||
+ | }, | ||
+ | |||
+ | contents: { | ||
+ | xml: /xml/, | ||
+ | html: /html/, | ||
+ | json: /json/ | ||
+ | }, | ||
+ | |||
+ | responseFields: { | ||
+ | xml: "responseXML", | ||
+ | text: "responseText", | ||
+ | json: "responseJSON" | ||
+ | }, | ||
+ | |||
+ | // Data converters | ||
+ | // Keys separate source (or catchall "*") and destination types with a single space | ||
+ | converters: { | ||
+ | |||
+ | // Convert anything to text | ||
+ | "* text": String, | ||
+ | |||
+ | // Text to html (true = no transformation) | ||
+ | "text html": true, | ||
+ | |||
+ | // Evaluate text as a json expression | ||
+ | "text json": jQuery.parseJSON, | ||
+ | |||
+ | // Parse text as xml | ||
+ | "text xml": jQuery.parseXML | ||
+ | }, | ||
+ | |||
+ | // For options that shouldn't be deep extended: | ||
+ | // you can add your own custom options here if | ||
+ | // and when you create one that shouldn't be | ||
+ | // deep extended (see ajaxExtend) | ||
+ | flatOptions: { | ||
+ | url: true, | ||
+ | context: true | ||
+ | } | ||
+ | }, | ||
+ | |||
+ | // Creates a full fledged settings object into target | ||
+ | // with both ajaxSettings and settings fields. | ||
+ | // If target is omitted, writes into ajaxSettings. | ||
+ | ajaxSetup: function( target, settings ) { | ||
+ | return settings ? | ||
+ | |||
+ | // Building a settings object | ||
+ | ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) : | ||
+ | |||
+ | // Extending ajaxSettings | ||
+ | ajaxExtend( jQuery.ajaxSettings, target ); | ||
+ | }, | ||
+ | |||
+ | ajaxPrefilter: addToPrefiltersOrTransports( prefilters ), | ||
+ | ajaxTransport: addToPrefiltersOrTransports( transports ), | ||
+ | |||
+ | // Main method | ||
+ | ajax: function( url, options ) { | ||
+ | |||
+ | // If url is an object, simulate pre-1.5 signature | ||
+ | if ( typeof url === "object" ) { | ||
+ | options = url; | ||
+ | url = undefined; | ||
+ | } | ||
+ | |||
+ | // Force options to be an object | ||
+ | options = options || {}; | ||
+ | |||
+ | var // Cross-domain detection vars | ||
+ | parts, | ||
+ | // Loop variable | ||
+ | i, | ||
+ | // URL without anti-cache param | ||
+ | cacheURL, | ||
+ | // Response headers as string | ||
+ | responseHeadersString, | ||
+ | // timeout handle | ||
+ | timeoutTimer, | ||
+ | |||
+ | // To know if global events are to be dispatched | ||
+ | fireGlobals, | ||
+ | |||
+ | transport, | ||
+ | // Response headers | ||
+ | responseHeaders, | ||
+ | // Create the final options object | ||
+ | s = jQuery.ajaxSetup( {}, options ), | ||
+ | // Callbacks context | ||
+ | callbackContext = s.context || s, | ||
+ | // Context for global events is callbackContext if it is a DOM node or jQuery collection | ||
+ | globalEventContext = s.context && ( callbackContext.nodeType || callbackContext.jquery ) ? | ||
+ | jQuery( callbackContext ) : | ||
+ | jQuery.event, | ||
+ | // Deferreds | ||
+ | deferred = jQuery.Deferred(), | ||
+ | completeDeferred = jQuery.Callbacks("once memory"), | ||
+ | // Status-dependent callbacks | ||
+ | statusCode = s.statusCode || {}, | ||
+ | // Headers (they are sent all at once) | ||
+ | requestHeaders = {}, | ||
+ | requestHeadersNames = {}, | ||
+ | // The jqXHR state | ||
+ | state = 0, | ||
+ | // Default abort message | ||
+ | strAbort = "canceled", | ||
+ | // Fake xhr | ||
+ | jqXHR = { | ||
+ | readyState: 0, | ||
+ | |||
+ | // Builds headers hashtable if needed | ||
+ | getResponseHeader: function( key ) { | ||
+ | var match; | ||
+ | if ( state === 2 ) { | ||
+ | if ( !responseHeaders ) { | ||
+ | responseHeaders = {}; | ||
+ | while ( (match = rheaders.exec( responseHeadersString )) ) { | ||
+ | responseHeaders[ match[1].toLowerCase() ] = match[ 2 ]; | ||
+ | } | ||
+ | } | ||
+ | match = responseHeaders[ key.toLowerCase() ]; | ||
+ | } | ||
+ | return match == null ? null : match; | ||
+ | }, | ||
+ | |||
+ | // Raw string | ||
+ | getAllResponseHeaders: function() { | ||
+ | return state === 2 ? responseHeadersString : null; | ||
+ | }, | ||
+ | |||
+ | // Caches the header | ||
+ | setRequestHeader: function( name, value ) { | ||
+ | var lname = name.toLowerCase(); | ||
+ | if ( !state ) { | ||
+ | name = requestHeadersNames[ lname ] = requestHeadersNames[ lname ] || name; | ||
+ | requestHeaders[ name ] = value; | ||
+ | } | ||
+ | return this; | ||
+ | }, | ||
+ | |||
+ | // Overrides response content-type header | ||
+ | overrideMimeType: function( type ) { | ||
+ | if ( !state ) { | ||
+ | s.mimeType = type; | ||
+ | } | ||
+ | return this; | ||
+ | }, | ||
+ | |||
+ | // Status-dependent callbacks | ||
+ | statusCode: function( map ) { | ||
+ | var code; | ||
+ | if ( map ) { | ||
+ | if ( state < 2 ) { | ||
+ | for ( code in map ) { | ||
+ | // Lazy-add the new callback in a way that preserves old ones | ||
+ | statusCode[ code ] = [ statusCode[ code ], map[ code ] ]; | ||
+ | } | ||
+ | } else { | ||
+ | // Execute the appropriate callbacks | ||
+ | jqXHR.always( map[ jqXHR.status ] ); | ||
+ | } | ||
+ | } | ||
+ | return this; | ||
+ | }, | ||
+ | |||
+ | // Cancel the request | ||
+ | abort: function( statusText ) { | ||
+ | var finalText = statusText || strAbort; | ||
+ | if ( transport ) { | ||
+ | transport.abort( finalText ); | ||
+ | } | ||
+ | done( 0, finalText ); | ||
+ | return this; | ||
+ | } | ||
+ | }; | ||
+ | |||
+ | // Attach deferreds | ||
+ | deferred.promise( jqXHR ).complete = completeDeferred.add; | ||
+ | jqXHR.success = jqXHR.done; | ||
+ | jqXHR.error = jqXHR.fail; | ||
+ | |||
+ | // Remove hash character (#7531: and string promotion) | ||
+ | // Add protocol if not provided (#5866: IE7 issue with protocol-less urls) | ||
+ | // Handle falsy url in the settings object (#10093: consistency with old signature) | ||
+ | // We also use the url parameter if available | ||
+ | s.url = ( ( url || s.url || ajaxLocation ) + "" ).replace( rhash, "" ).replace( rprotocol, ajaxLocParts[ 1 ] + "//" ); | ||
+ | |||
+ | // Alias method option to type as per ticket #12004 | ||
+ | s.type = options.method || options.type || s.method || s.type; | ||
+ | |||
+ | // Extract dataTypes list | ||
+ | s.dataTypes = jQuery.trim( s.dataType || "*" ).toLowerCase().match( core_rnotwhite ) || [""]; | ||
+ | |||
+ | // A cross-domain request is in order when we have a protocol:host:port mismatch | ||
+ | if ( s.crossDomain == null ) { | ||
+ | parts = rurl.exec( s.url.toLowerCase() ); | ||
+ | s.crossDomain = !!( parts && | ||
+ | ( parts[ 1 ] !== ajaxLocParts[ 1 ] || parts[ 2 ] !== ajaxLocParts[ 2 ] || | ||
+ | ( parts[ 3 ] || ( parts[ 1 ] === "http:" ? "80" : "443" ) ) !== | ||
+ | ( ajaxLocParts[ 3 ] || ( ajaxLocParts[ 1 ] === "http:" ? "80" : "443" ) ) ) | ||
+ | ); | ||
+ | } | ||
+ | |||
+ | // Convert data if not already a string | ||
+ | if ( s.data && s.processData && typeof s.data !== "string" ) { | ||
+ | s.data = jQuery.param( s.data, s.traditional ); | ||
+ | } | ||
+ | |||
+ | // Apply prefilters | ||
+ | inspectPrefiltersOrTransports( prefilters, s, options, jqXHR ); | ||
+ | |||
+ | // If request was aborted inside a prefilter, stop there | ||
+ | if ( state === 2 ) { | ||
+ | return jqXHR; | ||
+ | } | ||
+ | |||
+ | // We can fire global events as of now if asked to | ||
+ | fireGlobals = s.global; | ||
+ | |||
+ | // Watch for a new set of requests | ||
+ | if ( fireGlobals && jQuery.active++ === 0 ) { | ||
+ | jQuery.event.trigger("ajaxStart"); | ||
+ | } | ||
+ | |||
+ | // Uppercase the type | ||
+ | s.type = s.type.toUpperCase(); | ||
+ | |||
+ | // Determine if request has content | ||
+ | s.hasContent = !rnoContent.test( s.type ); | ||
+ | |||
+ | // Save the URL in case we're toying with the If-Modified-Since | ||
+ | // and/or If-None-Match header later on | ||
+ | cacheURL = s.url; | ||
+ | |||
+ | // More options handling for requests with no content | ||
+ | if ( !s.hasContent ) { | ||
+ | |||
+ | // If data is available, append data to url | ||
+ | if ( s.data ) { | ||
+ | cacheURL = ( s.url += ( ajax_rquery.test( cacheURL ) ? "&" : "?" ) + s.data ); | ||
+ | // #9682: remove data so that it's not used in an eventual retry | ||
+ | delete s.data; | ||
+ | } | ||
+ | |||
+ | // Add anti-cache in url if needed | ||
+ | if ( s.cache === false ) { | ||
+ | s.url = rts.test( cacheURL ) ? | ||
+ | |||
+ | // If there is already a '_' parameter, set its value | ||
+ | cacheURL.replace( rts, "$1_=" + ajax_nonce++ ) : | ||
+ | |||
+ | // Otherwise add one to the end | ||
+ | cacheURL + ( ajax_rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + ajax_nonce++; | ||
+ | } | ||
+ | } | ||
+ | |||
+ | // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. | ||
+ | if ( s.ifModified ) { | ||
+ | if ( jQuery.lastModified[ cacheURL ] ) { | ||
+ | jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] ); | ||
+ | } | ||
+ | if ( jQuery.etag[ cacheURL ] ) { | ||
+ | jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] ); | ||
+ | } | ||
+ | } | ||
+ | |||
+ | // Set the correct header, if data is being sent | ||
+ | if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) { | ||
+ | jqXHR.setRequestHeader( "Content-Type", s.contentType ); | ||
+ | } | ||
+ | |||
+ | // Set the Accepts header for the server, depending on the dataType | ||
+ | jqXHR.setRequestHeader( | ||
+ | "Accept", | ||
+ | s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[0] ] ? | ||
+ | s.accepts[ s.dataTypes[0] ] + ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) : | ||
+ | s.accepts[ "*" ] | ||
+ | ); | ||
+ | |||
+ | // Check for headers option | ||
+ | for ( i in s.headers ) { | ||
+ | jqXHR.setRequestHeader( i, s.headers[ i ] ); | ||
+ | } | ||
+ | |||
+ | // Allow custom headers/mimetypes and early abort | ||
+ | if ( s.beforeSend && ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || state === 2 ) ) { | ||
+ | // Abort if not done already and return | ||
+ | return jqXHR.abort(); | ||
+ | } | ||
+ | |||
+ | // aborting is no longer a cancellation | ||
+ | strAbort = "abort"; | ||
+ | |||
+ | // Install callbacks on deferreds | ||
+ | for ( i in { success: 1, error: 1, complete: 1 } ) { | ||
+ | jqXHR[ i ]( s[ i ] ); | ||
+ | } | ||
+ | |||
+ | // Get transport | ||
+ | transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR ); | ||
+ | |||
+ | // If no transport, we auto-abort | ||
+ | if ( !transport ) { | ||
+ | done( -1, "No Transport" ); | ||
+ | } else { | ||
+ | jqXHR.readyState = 1; | ||
+ | |||
+ | // Send global event | ||
+ | if ( fireGlobals ) { | ||
+ | globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] ); | ||
+ | } | ||
+ | // Timeout | ||
+ | if ( s.async && s.timeout > 0 ) { | ||
+ | timeoutTimer = setTimeout(function() { | ||
+ | jqXHR.abort("timeout"); | ||
+ | }, s.timeout ); | ||
+ | } | ||
+ | |||
+ | try { | ||
+ | state = 1; | ||
+ | transport.send( requestHeaders, done ); | ||
+ | } catch ( e ) { | ||
+ | // Propagate exception as error if not done | ||
+ | if ( state < 2 ) { | ||
+ | done( -1, e ); | ||
+ | // Simply rethrow otherwise | ||
+ | } else { | ||
+ | throw e; | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | |||
+ | // Callback for when everything is done | ||
+ | function done( status, nativeStatusText, responses, headers ) { | ||
+ | var isSuccess, success, error, response, modified, | ||
+ | statusText = nativeStatusText; | ||
+ | |||
+ | // Called once | ||
+ | if ( state === 2 ) { | ||
+ | return; | ||
+ | } | ||
+ | |||
+ | // State is "done" now | ||
+ | state = 2; | ||
+ | |||
+ | // Clear timeout if it exists | ||
+ | if ( timeoutTimer ) { | ||
+ | clearTimeout( timeoutTimer ); | ||
+ | } | ||
+ | |||
+ | // Dereference transport for early garbage collection | ||
+ | // (no matter how long the jqXHR object will be used) | ||
+ | transport = undefined; | ||
+ | |||
+ | // Cache response headers | ||
+ | responseHeadersString = headers || ""; | ||
+ | |||
+ | // Set readyState | ||
+ | jqXHR.readyState = status > 0 ? 4 : 0; | ||
+ | |||
+ | // Determine if successful | ||
+ | isSuccess = status >= 200 && status < 300 || status === 304; | ||
+ | |||
+ | // Get response data | ||
+ | if ( responses ) { | ||
+ | response = ajaxHandleResponses( s, jqXHR, responses ); | ||
+ | } | ||
+ | |||
+ | // Convert no matter what (that way responseXXX fields are always set) | ||
+ | response = ajaxConvert( s, response, jqXHR, isSuccess ); | ||
+ | |||
+ | // If successful, handle type chaining | ||
+ | if ( isSuccess ) { | ||
+ | |||
+ | // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. | ||
+ | if ( s.ifModified ) { | ||
+ | modified = jqXHR.getResponseHeader("Last-Modified"); | ||
+ | if ( modified ) { | ||
+ | jQuery.lastModified[ cacheURL ] = modified; | ||
+ | } | ||
+ | modified = jqXHR.getResponseHeader("etag"); | ||
+ | if ( modified ) { | ||
+ | jQuery.etag[ cacheURL ] = modified; | ||
+ | } | ||
+ | } | ||
+ | |||
+ | // if no content | ||
+ | if ( status === 204 || s.type === "HEAD" ) { | ||
+ | statusText = "nocontent"; | ||
+ | |||
+ | // if not modified | ||
+ | } else if ( status === 304 ) { | ||
+ | statusText = "notmodified"; | ||
+ | |||
+ | // If we have data, let's convert it | ||
+ | } else { | ||
+ | statusText = response.state; | ||
+ | success = response.data; | ||
+ | error = response.error; | ||
+ | isSuccess = !error; | ||
+ | } | ||
+ | } else { | ||
+ | // We extract error from statusText | ||
+ | // then normalize statusText and status for non-aborts | ||
+ | error = statusText; | ||
+ | if ( status || !statusText ) { | ||
+ | statusText = "error"; | ||
+ | if ( status < 0 ) { | ||
+ | status = 0; | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | |||
+ | // Set data for the fake xhr object | ||
+ | jqXHR.status = status; | ||
+ | jqXHR.statusText = ( nativeStatusText || statusText ) + ""; | ||
+ | |||
+ | // Success/Error | ||
+ | if ( isSuccess ) { | ||
+ | deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] ); | ||
+ | } else { | ||
+ | deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] ); | ||
+ | } | ||
+ | |||
+ | // Status-dependent callbacks | ||
+ | jqXHR.statusCode( statusCode ); | ||
+ | statusCode = undefined; | ||
+ | |||
+ | if ( fireGlobals ) { | ||
+ | globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError", | ||
+ | [ jqXHR, s, isSuccess ? success : error ] ); | ||
+ | } | ||
+ | |||
+ | // Complete | ||
+ | completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] ); | ||
+ | |||
+ | if ( fireGlobals ) { | ||
+ | globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] ); | ||
+ | // Handle the global AJAX counter | ||
+ | if ( !( --jQuery.active ) ) { | ||
+ | jQuery.event.trigger("ajaxStop"); | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | |||
+ | return jqXHR; | ||
+ | }, | ||
+ | |||
+ | getJSON: function( url, data, callback ) { | ||
+ | return jQuery.get( url, data, callback, "json" ); | ||
+ | }, | ||
+ | |||
+ | getScript: function( url, callback ) { | ||
+ | return jQuery.get( url, undefined, callback, "script" ); | ||
+ | } | ||
+ | }); | ||
+ | |||
+ | jQuery.each( [ "get", "post" ], function( i, method ) { | ||
+ | jQuery[ method ] = function( url, data, callback, type ) { | ||
+ | // shift arguments if data argument was omitted | ||
+ | if ( jQuery.isFunction( data ) ) { | ||
+ | type = type || callback; | ||
+ | callback = data; | ||
+ | data = undefined; | ||
+ | } | ||
+ | |||
+ | return jQuery.ajax({ | ||
+ | url: url, | ||
+ | type: method, | ||
+ | dataType: type, | ||
+ | data: data, | ||
+ | success: callback | ||
+ | }); | ||
+ | }; | ||
+ | }); | ||
+ | |||
+ | /* Handles responses to an ajax request: | ||
+ | * - finds the right dataType (mediates between content-type and expected dataType) | ||
+ | * - returns the corresponding response | ||
+ | */ | ||
+ | function ajaxHandleResponses( s, jqXHR, responses ) { | ||
+ | var firstDataType, ct, finalDataType, type, | ||
+ | contents = s.contents, | ||
+ | dataTypes = s.dataTypes; | ||
+ | |||
+ | // Remove auto dataType and get content-type in the process | ||
+ | while( dataTypes[ 0 ] === "*" ) { | ||
+ | dataTypes.shift(); | ||
+ | if ( ct === undefined ) { | ||
+ | ct = s.mimeType || jqXHR.getResponseHeader("Content-Type"); | ||
+ | } | ||
+ | } | ||
+ | |||
+ | // Check if we're dealing with a known content-type | ||
+ | if ( ct ) { | ||
+ | for ( type in contents ) { | ||
+ | if ( contents[ type ] && contents[ type ].test( ct ) ) { | ||
+ | dataTypes.unshift( type ); | ||
+ | break; | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | |||
+ | // Check to see if we have a response for the expected dataType | ||
+ | if ( dataTypes[ 0 ] in responses ) { | ||
+ | finalDataType = dataTypes[ 0 ]; | ||
+ | } else { | ||
+ | // Try convertible dataTypes | ||
+ | for ( type in responses ) { | ||
+ | if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[0] ] ) { | ||
+ | finalDataType = type; | ||
+ | break; | ||
+ | } | ||
+ | if ( !firstDataType ) { | ||
+ | firstDataType = type; | ||
+ | } | ||
+ | } | ||
+ | // Or just use first one | ||
+ | finalDataType = finalDataType || firstDataType; | ||
+ | } | ||
+ | |||
+ | // If we found a dataType | ||
+ | // We add the dataType to the list if needed | ||
+ | // and return the corresponding response | ||
+ | if ( finalDataType ) { | ||
+ | if ( finalDataType !== dataTypes[ 0 ] ) { | ||
+ | dataTypes.unshift( finalDataType ); | ||
+ | } | ||
+ | return responses[ finalDataType ]; | ||
+ | } | ||
+ | } | ||
+ | |||
+ | /* Chain conversions given the request and the original response | ||
+ | * Also sets the responseXXX fields on the jqXHR instance | ||
+ | */ | ||
+ | function ajaxConvert( s, response, jqXHR, isSuccess ) { | ||
+ | var conv2, current, conv, tmp, prev, | ||
+ | converters = {}, | ||
+ | // Work with a copy of dataTypes in case we need to modify it for conversion | ||
+ | dataTypes = s.dataTypes.slice(); | ||
+ | |||
+ | // Create converters map with lowercased keys | ||
+ | if ( dataTypes[ 1 ] ) { | ||
+ | for ( conv in s.converters ) { | ||
+ | converters[ conv.toLowerCase() ] = s.converters[ conv ]; | ||
+ | } | ||
+ | } | ||
+ | |||
+ | current = dataTypes.shift(); | ||
+ | |||
+ | // Convert to each sequential dataType | ||
+ | while ( current ) { | ||
+ | |||
+ | if ( s.responseFields[ current ] ) { | ||
+ | jqXHR[ s.responseFields[ current ] ] = response; | ||
+ | } | ||
+ | |||
+ | // Apply the dataFilter if provided | ||
+ | if ( !prev && isSuccess && s.dataFilter ) { | ||
+ | response = s.dataFilter( response, s.dataType ); | ||
+ | } | ||
+ | |||
+ | prev = current; | ||
+ | current = dataTypes.shift(); | ||
+ | |||
+ | if ( current ) { | ||
+ | |||
+ | // There's only work to do if current dataType is non-auto | ||
+ | if ( current === "*" ) { | ||
+ | |||
+ | current = prev; | ||
+ | |||
+ | // Convert response if prev dataType is non-auto and differs from current | ||
+ | } else if ( prev !== "*" && prev !== current ) { | ||
+ | |||
+ | // Seek a direct converter | ||
+ | conv = converters[ prev + " " + current ] || converters[ "* " + current ]; | ||
+ | |||
+ | // If none found, seek a pair | ||
+ | if ( !conv ) { | ||
+ | for ( conv2 in converters ) { | ||
+ | |||
+ | // If conv2 outputs current | ||
+ | tmp = conv2.split( " " ); | ||
+ | if ( tmp[ 1 ] === current ) { | ||
+ | |||
+ | // If prev can be converted to accepted input | ||
+ | conv = converters[ prev + " " + tmp[ 0 ] ] || | ||
+ | converters[ "* " + tmp[ 0 ] ]; | ||
+ | if ( conv ) { | ||
+ | // Condense equivalence converters | ||
+ | if ( conv === true ) { | ||
+ | conv = converters[ conv2 ]; | ||
+ | |||
+ | // Otherwise, insert the intermediate dataType | ||
+ | } else if ( converters[ conv2 ] !== true ) { | ||
+ | current = tmp[ 0 ]; | ||
+ | dataTypes.unshift( tmp[ 1 ] ); | ||
+ | } | ||
+ | break; | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | |||
+ | // Apply converter (if not an equivalence) | ||
+ | if ( conv !== true ) { | ||
+ | |||
+ | // Unless errors are allowed to bubble, catch and return them | ||
+ | if ( conv && s[ "throws" ] ) { | ||
+ | response = conv( response ); | ||
+ | } else { | ||
+ | try { | ||
+ | response = conv( response ); | ||
+ | } catch ( e ) { | ||
+ | return { state: "parsererror", error: conv ? e : "No conversion from " + prev + " to " + current }; | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | |||
+ | return { state: "success", data: response }; | ||
+ | } | ||
+ | // Install script dataType | ||
+ | jQuery.ajaxSetup({ | ||
+ | accepts: { | ||
+ | script: "text/javascript, application/javascript, application/ecmascript, application/x-ecmascript" | ||
+ | }, | ||
+ | contents: { | ||
+ | script: /(?:java|ecma)script/ | ||
+ | }, | ||
+ | converters: { | ||
+ | "text script": function( text ) { | ||
+ | jQuery.globalEval( text ); | ||
+ | return text; | ||
+ | } | ||
+ | } | ||
+ | }); | ||
+ | |||
+ | // Handle cache's special case and global | ||
+ | jQuery.ajaxPrefilter( "script", function( s ) { | ||
+ | if ( s.cache === undefined ) { | ||
+ | s.cache = false; | ||
+ | } | ||
+ | if ( s.crossDomain ) { | ||
+ | s.type = "GET"; | ||
+ | s.global = false; | ||
+ | } | ||
+ | }); | ||
+ | |||
+ | // Bind script tag hack transport | ||
+ | jQuery.ajaxTransport( "script", function(s) { | ||
+ | |||
+ | // This transport only deals with cross domain requests | ||
+ | if ( s.crossDomain ) { | ||
+ | |||
+ | var script, | ||
+ | head = document.head || jQuery("head")[0] || document.documentElement; | ||
+ | |||
+ | return { | ||
+ | |||
+ | send: function( _, callback ) { | ||
+ | |||
+ | script = document.createElement("script"); | ||
+ | |||
+ | script.async = true; | ||
+ | |||
+ | if ( s.scriptCharset ) { | ||
+ | script.charset = s.scriptCharset; | ||
+ | } | ||
+ | |||
+ | script.src = s.url; | ||
+ | |||
+ | // Attach handlers for all browsers | ||
+ | script.onload = script.onreadystatechange = function( _, isAbort ) { | ||
+ | |||
+ | if ( isAbort || !script.readyState || /loaded|complete/.test( script.readyState ) ) { | ||
+ | |||
+ | // Handle memory leak in IE | ||
+ | script.onload = script.onreadystatechange = null; | ||
+ | |||
+ | // Remove the script | ||
+ | if ( script.parentNode ) { | ||
+ | script.parentNode.removeChild( script ); | ||
+ | } | ||
+ | |||
+ | // Dereference the script | ||
+ | script = null; | ||
+ | |||
+ | // Callback if not abort | ||
+ | if ( !isAbort ) { | ||
+ | callback( 200, "success" ); | ||
+ | } | ||
+ | } | ||
+ | }; | ||
+ | |||
+ | // Circumvent IE6 bugs with base elements (#2709 and #4378) by prepending | ||
+ | // Use native DOM manipulation to avoid our domManip AJAX trickery | ||
+ | head.insertBefore( script, head.firstChild ); | ||
+ | }, | ||
+ | |||
+ | abort: function() { | ||
+ | if ( script ) { | ||
+ | script.onload( undefined, true ); | ||
+ | } | ||
+ | } | ||
+ | }; | ||
+ | } | ||
+ | }); | ||
+ | var oldCallbacks = [], | ||
+ | rjsonp = /(=)\?(?=&|$)|\?\?/; | ||
+ | |||
+ | // Default jsonp settings | ||
+ | jQuery.ajaxSetup({ | ||
+ | jsonp: "callback", | ||
+ | jsonpCallback: function() { | ||
+ | var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( ajax_nonce++ ) ); | ||
+ | this[ callback ] = true; | ||
+ | return callback; | ||
+ | } | ||
+ | }); | ||
+ | |||
+ | // Detect, normalize options and install callbacks for jsonp requests | ||
+ | jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) { | ||
+ | |||
+ | var callbackName, overwritten, responseContainer, | ||
+ | jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ? | ||
+ | "url" : | ||
+ | typeof s.data === "string" && !( s.contentType || "" ).indexOf("application/x-www-form-urlencoded") && rjsonp.test( s.data ) && "data" | ||
+ | ); | ||
+ | |||
+ | // Handle iff the expected data type is "jsonp" or we have a parameter to set | ||
+ | if ( jsonProp || s.dataTypes[ 0 ] === "jsonp" ) { | ||
+ | |||
+ | // Get callback name, remembering preexisting value associated with it | ||
+ | callbackName = s.jsonpCallback = jQuery.isFunction( s.jsonpCallback ) ? | ||
+ | s.jsonpCallback() : | ||
+ | s.jsonpCallback; | ||
+ | |||
+ | // Insert callback into url or form data | ||
+ | if ( jsonProp ) { | ||
+ | s[ jsonProp ] = s[ jsonProp ].replace( rjsonp, "$1" + callbackName ); | ||
+ | } else if ( s.jsonp !== false ) { | ||
+ | s.url += ( ajax_rquery.test( s.url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName; | ||
+ | } | ||
+ | |||
+ | // Use data converter to retrieve json after script execution | ||
+ | s.converters["script json"] = function() { | ||
+ | if ( !responseContainer ) { | ||
+ | jQuery.error( callbackName + " was not called" ); | ||
+ | } | ||
+ | return responseContainer[ 0 ]; | ||
+ | }; | ||
+ | |||
+ | // force json dataType | ||
+ | s.dataTypes[ 0 ] = "json"; | ||
+ | |||
+ | // Install callback | ||
+ | overwritten = window[ callbackName ]; | ||
+ | window[ callbackName ] = function() { | ||
+ | responseContainer = arguments; | ||
+ | }; | ||
+ | |||
+ | // Clean-up function (fires after converters) | ||
+ | jqXHR.always(function() { | ||
+ | // Restore preexisting value | ||
+ | window[ callbackName ] = overwritten; | ||
+ | |||
+ | // Save back as free | ||
+ | if ( s[ callbackName ] ) { | ||
+ | // make sure that re-using the options doesn't screw things around | ||
+ | s.jsonpCallback = originalSettings.jsonpCallback; | ||
+ | |||
+ | // save the callback name for future use | ||
+ | oldCallbacks.push( callbackName ); | ||
+ | } | ||
+ | |||
+ | // Call if it was a function and we have a response | ||
+ | if ( responseContainer && jQuery.isFunction( overwritten ) ) { | ||
+ | overwritten( responseContainer[ 0 ] ); | ||
+ | } | ||
+ | |||
+ | responseContainer = overwritten = undefined; | ||
+ | }); | ||
+ | |||
+ | // Delegate to script | ||
+ | return "script"; | ||
+ | } | ||
+ | }); | ||
+ | var xhrCallbacks, xhrSupported, | ||
+ | xhrId = 0, | ||
+ | // #5280: Internet Explorer will keep connections alive if we don't abort on unload | ||
+ | xhrOnUnloadAbort = window.ActiveXObject && function() { | ||
+ | // Abort all pending requests | ||
+ | var key; | ||
+ | for ( key in xhrCallbacks ) { | ||
+ | xhrCallbacks[ key ]( undefined, true ); | ||
+ | } | ||
+ | }; | ||
+ | |||
+ | // Functions to create xhrs | ||
+ | function createStandardXHR() { | ||
+ | try { | ||
+ | return new window.XMLHttpRequest(); | ||
+ | } catch( e ) {} | ||
+ | } | ||
+ | |||
+ | function createActiveXHR() { | ||
+ | try { | ||
+ | return new window.ActiveXObject("Microsoft.XMLHTTP"); | ||
+ | } catch( e ) {} | ||
+ | } | ||
+ | |||
+ | // Create the request object | ||
+ | // (This is still attached to ajaxSettings for backward compatibility) | ||
+ | jQuery.ajaxSettings.xhr = window.ActiveXObject ? | ||
+ | /* Microsoft failed to properly | ||
+ | * implement the XMLHttpRequest in IE7 (can't request local files), | ||
+ | * so we use the ActiveXObject when it is available | ||
+ | * Additionally XMLHttpRequest can be disabled in IE7/IE8 so | ||
+ | * we need a fallback. | ||
+ | */ | ||
+ | function() { | ||
+ | return !this.isLocal && createStandardXHR() || createActiveXHR(); | ||
+ | } : | ||
+ | // For all other browsers, use the standard XMLHttpRequest object | ||
+ | createStandardXHR; | ||
+ | |||
+ | // Determine support properties | ||
+ | xhrSupported = jQuery.ajaxSettings.xhr(); | ||
+ | jQuery.support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported ); | ||
+ | xhrSupported = jQuery.support.ajax = !!xhrSupported; | ||
+ | |||
+ | // Create transport if the browser can provide an xhr | ||
+ | if ( xhrSupported ) { | ||
+ | |||
+ | jQuery.ajaxTransport(function( s ) { | ||
+ | // Cross domain only allowed if supported through XMLHttpRequest | ||
+ | if ( !s.crossDomain || jQuery.support.cors ) { | ||
+ | |||
+ | var callback; | ||
+ | |||
+ | return { | ||
+ | send: function( headers, complete ) { | ||
+ | |||
+ | // Get a new xhr | ||
+ | var handle, i, | ||
+ | xhr = s.xhr(); | ||
+ | |||
+ | // Open the socket | ||
+ | // Passing null username, generates a login popup on Opera (#2865) | ||
+ | if ( s.username ) { | ||
+ | xhr.open( s.type, s.url, s.async, s.username, s.password ); | ||
+ | } else { | ||
+ | xhr.open( s.type, s.url, s.async ); | ||
+ | } | ||
+ | |||
+ | // Apply custom fields if provided | ||
+ | if ( s.xhrFields ) { | ||
+ | for ( i in s.xhrFields ) { | ||
+ | xhr[ i ] = s.xhrFields[ i ]; | ||
+ | } | ||
+ | } | ||
+ | |||
+ | // Override mime type if needed | ||
+ | if ( s.mimeType && xhr.overrideMimeType ) { | ||
+ | xhr.overrideMimeType( s.mimeType ); | ||
+ | } | ||
+ | |||
+ | // X-Requested-With header | ||
+ | // For cross-domain requests, seeing as conditions for a preflight are | ||
+ | // akin to a jigsaw puzzle, we simply never set it to be sure. | ||
+ | // (it can always be set on a per-request basis or even using ajaxSetup) | ||
+ | // For same-domain requests, won't change header if already provided. | ||
+ | if ( !s.crossDomain && !headers["X-Requested-With"] ) { | ||
+ | headers["X-Requested-With"] = "XMLHttpRequest"; | ||
+ | } | ||
+ | |||
+ | // Need an extra try/catch for cross domain requests in Firefox 3 | ||
+ | try { | ||
+ | for ( i in headers ) { | ||
+ | xhr.setRequestHeader( i, headers[ i ] ); | ||
+ | } | ||
+ | } catch( err ) {} | ||
+ | |||
+ | // Do send the request | ||
+ | // This may raise an exception which is actually | ||
+ | // handled in jQuery.ajax (so no try/catch here) | ||
+ | xhr.send( ( s.hasContent && s.data ) || null ); | ||
+ | |||
+ | // Listener | ||
+ | callback = function( _, isAbort ) { | ||
+ | var status, responseHeaders, statusText, responses; | ||
+ | |||
+ | // Firefox throws exceptions when accessing properties | ||
+ | // of an xhr when a network error occurred | ||
+ | // http://helpful.knobs-dials.com/index.php/Component_returned_failure_code:_0x80040111_(NS_ERROR_NOT_AVAILABLE) | ||
+ | try { | ||
+ | |||
+ | // Was never called and is aborted or complete | ||
+ | if ( callback && ( isAbort || xhr.readyState === 4 ) ) { | ||
+ | |||
+ | // Only called once | ||
+ | callback = undefined; | ||
+ | |||
+ | // Do not keep as active anymore | ||
+ | if ( handle ) { | ||
+ | xhr.onreadystatechange = jQuery.noop; | ||
+ | if ( xhrOnUnloadAbort ) { | ||
+ | delete xhrCallbacks[ handle ]; | ||
+ | } | ||
+ | } | ||
+ | |||
+ | // If it's an abort | ||
+ | if ( isAbort ) { | ||
+ | // Abort it manually if needed | ||
+ | if ( xhr.readyState !== 4 ) { | ||
+ | xhr.abort(); | ||
+ | } | ||
+ | } else { | ||
+ | responses = {}; | ||
+ | status = xhr.status; | ||
+ | responseHeaders = xhr.getAllResponseHeaders(); | ||
+ | |||
+ | // When requesting binary data, IE6-9 will throw an exception | ||
+ | // on any attempt to access responseText (#11426) | ||
+ | if ( typeof xhr.responseText === "string" ) { | ||
+ | responses.text = xhr.responseText; | ||
+ | } | ||
+ | |||
+ | // Firefox throws an exception when accessing | ||
+ | // statusText for faulty cross-domain requests | ||
+ | try { | ||
+ | statusText = xhr.statusText; | ||
+ | } catch( e ) { | ||
+ | // We normalize with Webkit giving an empty statusText | ||
+ | statusText = ""; | ||
+ | } | ||
+ | |||
+ | // Filter status for non standard behaviors | ||
+ | |||
+ | // If the request is local and we have data: assume a success | ||
+ | // (success with no data won't get notified, that's the best we | ||
+ | // can do given current implementations) | ||
+ | if ( !status && s.isLocal && !s.crossDomain ) { | ||
+ | status = responses.text ? 200 : 404; | ||
+ | // IE - #1450: sometimes returns 1223 when it should be 204 | ||
+ | } else if ( status === 1223 ) { | ||
+ | status = 204; | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | } catch( firefoxAccessException ) { | ||
+ | if ( !isAbort ) { | ||
+ | complete( -1, firefoxAccessException ); | ||
+ | } | ||
+ | } | ||
+ | |||
+ | // Call complete if needed | ||
+ | if ( responses ) { | ||
+ | complete( status, statusText, responses, responseHeaders ); | ||
+ | } | ||
+ | }; | ||
+ | |||
+ | if ( !s.async ) { | ||
+ | // if we're in sync mode we fire the callback | ||
+ | callback(); | ||
+ | } else if ( xhr.readyState === 4 ) { | ||
+ | // (IE6 & IE7) if it's in cache and has been | ||
+ | // retrieved directly we need to fire the callback | ||
+ | setTimeout( callback ); | ||
+ | } else { | ||
+ | handle = ++xhrId; | ||
+ | if ( xhrOnUnloadAbort ) { | ||
+ | // Create the active xhrs callbacks list if needed | ||
+ | // and attach the unload handler | ||
+ | if ( !xhrCallbacks ) { | ||
+ | xhrCallbacks = {}; | ||
+ | jQuery( window ).unload( xhrOnUnloadAbort ); | ||
+ | } | ||
+ | // Add to list of active xhrs callbacks | ||
+ | xhrCallbacks[ handle ] = callback; | ||
+ | } | ||
+ | xhr.onreadystatechange = callback; | ||
+ | } | ||
+ | }, | ||
+ | |||
+ | abort: function() { | ||
+ | if ( callback ) { | ||
+ | callback( undefined, true ); | ||
+ | } | ||
+ | } | ||
+ | }; | ||
+ | } | ||
+ | }); | ||
+ | } | ||
+ | var fxNow, timerId, | ||
+ | rfxtypes = /^(?:toggle|show|hide)$/, | ||
+ | rfxnum = new RegExp( "^(?:([+-])=|)(" + core_pnum + ")([a-z%]*)$", "i" ), | ||
+ | rrun = /queueHooks$/, | ||
+ | animationPrefilters = [ defaultPrefilter ], | ||
+ | tweeners = { | ||
+ | "*": [function( prop, value ) { | ||
+ | var tween = this.createTween( prop, value ), | ||
+ | target = tween.cur(), | ||
+ | parts = rfxnum.exec( value ), | ||
+ | unit = parts && parts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ), | ||
+ | |||
+ | // Starting value computation is required for potential unit mismatches | ||
+ | start = ( jQuery.cssNumber[ prop ] || unit !== "px" && +target ) && | ||
+ | rfxnum.exec( jQuery.css( tween.elem, prop ) ), | ||
+ | scale = 1, | ||
+ | maxIterations = 20; | ||
+ | |||
+ | if ( start && start[ 3 ] !== unit ) { | ||
+ | // Trust units reported by jQuery.css | ||
+ | unit = unit || start[ 3 ]; | ||
+ | |||
+ | // Make sure we update the tween properties later on | ||
+ | parts = parts || []; | ||
+ | |||
+ | // Iteratively approximate from a nonzero starting point | ||
+ | start = +target || 1; | ||
+ | |||
+ | do { | ||
+ | // If previous iteration zeroed out, double until we get *something* | ||
+ | // Use a string for doubling factor so we don't accidentally see scale as unchanged below | ||
+ | scale = scale || ".5"; | ||
+ | |||
+ | // Adjust and apply | ||
+ | start = start / scale; | ||
+ | jQuery.style( tween.elem, prop, start + unit ); | ||
+ | |||
+ | // Update scale, tolerating zero or NaN from tween.cur() | ||
+ | // And breaking the loop if scale is unchanged or perfect, or if we've just had enough | ||
+ | } while ( scale !== (scale = tween.cur() / target) && scale !== 1 && --maxIterations ); | ||
+ | } | ||
+ | |||
+ | // Update tween properties | ||
+ | if ( parts ) { | ||
+ | start = tween.start = +start || +target || 0; | ||
+ | tween.unit = unit; | ||
+ | // If a +=/-= token was provided, we're doing a relative animation | ||
+ | tween.end = parts[ 1 ] ? | ||
+ | start + ( parts[ 1 ] + 1 ) * parts[ 2 ] : | ||
+ | +parts[ 2 ]; | ||
+ | } | ||
+ | |||
+ | return tween; | ||
+ | }] | ||
+ | }; | ||
+ | |||
+ | // Animations created synchronously will run synchronously | ||
+ | function createFxNow() { | ||
+ | setTimeout(function() { | ||
+ | fxNow = undefined; | ||
+ | }); | ||
+ | return ( fxNow = jQuery.now() ); | ||
+ | } | ||
+ | |||
+ | function createTween( value, prop, animation ) { | ||
+ | var tween, | ||
+ | collection = ( tweeners[ prop ] || [] ).concat( tweeners[ "*" ] ), | ||
+ | index = 0, | ||
+ | length = collection.length; | ||
+ | for ( ; index < length; index++ ) { | ||
+ | if ( (tween = collection[ index ].call( animation, prop, value )) ) { | ||
+ | |||
+ | // we're done with this property | ||
+ | return tween; | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | |||
+ | function Animation( elem, properties, options ) { | ||
+ | var result, | ||
+ | stopped, | ||
+ | index = 0, | ||
+ | length = animationPrefilters.length, | ||
+ | deferred = jQuery.Deferred().always( function() { | ||
+ | // don't match elem in the :animated selector | ||
+ | delete tick.elem; | ||
+ | }), | ||
+ | tick = function() { | ||
+ | if ( stopped ) { | ||
+ | return false; | ||
+ | } | ||
+ | var currentTime = fxNow || createFxNow(), | ||
+ | remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ), | ||
+ | // archaic crash bug won't allow us to use 1 - ( 0.5 || 0 ) (#12497) | ||
+ | temp = remaining / animation.duration || 0, | ||
+ | percent = 1 - temp, | ||
+ | index = 0, | ||
+ | length = animation.tweens.length; | ||
+ | |||
+ | for ( ; index < length ; index++ ) { | ||
+ | animation.tweens[ index ].run( percent ); | ||
+ | } | ||
+ | |||
+ | deferred.notifyWith( elem, [ animation, percent, remaining ]); | ||
+ | |||
+ | if ( percent < 1 && length ) { | ||
+ | return remaining; | ||
+ | } else { | ||
+ | deferred.resolveWith( elem, [ animation ] ); | ||
+ | return false; | ||
+ | } | ||
+ | }, | ||
+ | animation = deferred.promise({ | ||
+ | elem: elem, | ||
+ | props: jQuery.extend( {}, properties ), | ||
+ | opts: jQuery.extend( true, { specialEasing: {} }, options ), | ||
+ | originalProperties: properties, | ||
+ | originalOptions: options, | ||
+ | startTime: fxNow || createFxNow(), | ||
+ | duration: options.duration, | ||
+ | tweens: [], | ||
+ | createTween: function( prop, end ) { | ||
+ | var tween = jQuery.Tween( elem, animation.opts, prop, end, | ||
+ | animation.opts.specialEasing[ prop ] || animation.opts.easing ); | ||
+ | animation.tweens.push( tween ); | ||
+ | return tween; | ||
+ | }, | ||
+ | stop: function( gotoEnd ) { | ||
+ | var index = 0, | ||
+ | // if we are going to the end, we want to run all the tweens | ||
+ | // otherwise we skip this part | ||
+ | length = gotoEnd ? animation.tweens.length : 0; | ||
+ | if ( stopped ) { | ||
+ | return this; | ||
+ | } | ||
+ | stopped = true; | ||
+ | for ( ; index < length ; index++ ) { | ||
+ | animation.tweens[ index ].run( 1 ); | ||
+ | } | ||
+ | |||
+ | // resolve when we played the last frame | ||
+ | // otherwise, reject | ||
+ | if ( gotoEnd ) { | ||
+ | deferred.resolveWith( elem, [ animation, gotoEnd ] ); | ||
+ | } else { | ||
+ | deferred.rejectWith( elem, [ animation, gotoEnd ] ); | ||
+ | } | ||
+ | return this; | ||
+ | } | ||
+ | }), | ||
+ | props = animation.props; | ||
+ | |||
+ | propFilter( props, animation.opts.specialEasing ); | ||
+ | |||
+ | for ( ; index < length ; index++ ) { | ||
+ | result = animationPrefilters[ index ].call( animation, elem, props, animation.opts ); | ||
+ | if ( result ) { | ||
+ | return result; | ||
+ | } | ||
+ | } | ||
+ | |||
+ | jQuery.map( props, createTween, animation ); | ||
+ | |||
+ | if ( jQuery.isFunction( animation.opts.start ) ) { | ||
+ | animation.opts.start.call( elem, animation ); | ||
+ | } | ||
+ | |||
+ | jQuery.fx.timer( | ||
+ | jQuery.extend( tick, { | ||
+ | elem: elem, | ||
+ | anim: animation, | ||
+ | queue: animation.opts.queue | ||
+ | }) | ||
+ | ); | ||
+ | |||
+ | // attach callbacks from options | ||
+ | return animation.progress( animation.opts.progress ) | ||
+ | .done( animation.opts.done, animation.opts.complete ) | ||
+ | .fail( animation.opts.fail ) | ||
+ | .always( animation.opts.always ); | ||
+ | } | ||
+ | |||
+ | function propFilter( props, specialEasing ) { | ||
+ | var index, name, easing, value, hooks; | ||
+ | |||
+ | // camelCase, specialEasing and expand cssHook pass | ||
+ | for ( index in props ) { | ||
+ | name = jQuery.camelCase( index ); | ||
+ | easing = specialEasing[ name ]; | ||
+ | value = props[ index ]; | ||
+ | if ( jQuery.isArray( value ) ) { | ||
+ | easing = value[ 1 ]; | ||
+ | value = props[ index ] = value[ 0 ]; | ||
+ | } | ||
+ | |||
+ | if ( index !== name ) { | ||
+ | props[ name ] = value; | ||
+ | delete props[ index ]; | ||
+ | } | ||
+ | |||
+ | hooks = jQuery.cssHooks[ name ]; | ||
+ | if ( hooks && "expand" in hooks ) { | ||
+ | value = hooks.expand( value ); | ||
+ | delete props[ name ]; | ||
+ | |||
+ | // not quite $.extend, this wont overwrite keys already present. | ||
+ | // also - reusing 'index' from above because we have the correct "name" | ||
+ | for ( index in value ) { | ||
+ | if ( !( index in props ) ) { | ||
+ | props[ index ] = value[ index ]; | ||
+ | specialEasing[ index ] = easing; | ||
+ | } | ||
+ | } | ||
+ | } else { | ||
+ | specialEasing[ name ] = easing; | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | |||
+ | jQuery.Animation = jQuery.extend( Animation, { | ||
+ | |||
+ | tweener: function( props, callback ) { | ||
+ | if ( jQuery.isFunction( props ) ) { | ||
+ | callback = props; | ||
+ | props = [ "*" ]; | ||
+ | } else { | ||
+ | props = props.split(" "); | ||
+ | } | ||
+ | |||
+ | var prop, | ||
+ | index = 0, | ||
+ | length = props.length; | ||
+ | |||
+ | for ( ; index < length ; index++ ) { | ||
+ | prop = props[ index ]; | ||
+ | tweeners[ prop ] = tweeners[ prop ] || []; | ||
+ | tweeners[ prop ].unshift( callback ); | ||
+ | } | ||
+ | }, | ||
+ | |||
+ | prefilter: function( callback, prepend ) { | ||
+ | if ( prepend ) { | ||
+ | animationPrefilters.unshift( callback ); | ||
+ | } else { | ||
+ | animationPrefilters.push( callback ); | ||
+ | } | ||
+ | } | ||
+ | }); | ||
+ | |||
+ | function defaultPrefilter( elem, props, opts ) { | ||
+ | /* jshint validthis: true */ | ||
+ | var prop, value, toggle, tween, hooks, oldfire, | ||
+ | anim = this, | ||
+ | orig = {}, | ||
+ | style = elem.style, | ||
+ | hidden = elem.nodeType && isHidden( elem ), | ||
+ | dataShow = jQuery._data( elem, "fxshow" ); | ||
+ | |||
+ | // handle queue: false promises | ||
+ | if ( !opts.queue ) { | ||
+ | hooks = jQuery._queueHooks( elem, "fx" ); | ||
+ | if ( hooks.unqueued == null ) { | ||
+ | hooks.unqueued = 0; | ||
+ | oldfire = hooks.empty.fire; | ||
+ | hooks.empty.fire = function() { | ||
+ | if ( !hooks.unqueued ) { | ||
+ | oldfire(); | ||
+ | } | ||
+ | }; | ||
+ | } | ||
+ | hooks.unqueued++; | ||
+ | |||
+ | anim.always(function() { | ||
+ | // doing this makes sure that the complete handler will be called | ||
+ | // before this completes | ||
+ | anim.always(function() { | ||
+ | hooks.unqueued--; | ||
+ | if ( !jQuery.queue( elem, "fx" ).length ) { | ||
+ | hooks.empty.fire(); | ||
+ | } | ||
+ | }); | ||
+ | }); | ||
+ | } | ||
+ | |||
+ | // height/width overflow pass | ||
+ | if ( elem.nodeType === 1 && ( "height" in props || "width" in props ) ) { | ||
+ | // Make sure that nothing sneaks out | ||
+ | // Record all 3 overflow attributes because IE does not | ||
+ | // change the overflow attribute when overflowX and | ||
+ | // overflowY are set to the same value | ||
+ | opts.overflow = [ style.overflow, style.overflowX, style.overflowY ]; | ||
+ | |||
+ | // Set display property to inline-block for height/width | ||
+ | // animations on inline elements that are having width/height animated | ||
+ | if ( jQuery.css( elem, "display" ) === "inline" && | ||
+ | jQuery.css( elem, "float" ) === "none" ) { | ||
+ | |||
+ | // inline-level elements accept inline-block; | ||
+ | // block-level elements need to be inline with layout | ||
+ | if ( !jQuery.support.inlineBlockNeedsLayout || css_defaultDisplay( elem.nodeName ) === "inline" ) { | ||
+ | style.display = "inline-block"; | ||
+ | |||
+ | } else { | ||
+ | style.zoom = 1; | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | |||
+ | if ( opts.overflow ) { | ||
+ | style.overflow = "hidden"; | ||
+ | if ( !jQuery.support.shrinkWrapBlocks ) { | ||
+ | anim.always(function() { | ||
+ | style.overflow = opts.overflow[ 0 ]; | ||
+ | style.overflowX = opts.overflow[ 1 ]; | ||
+ | style.overflowY = opts.overflow[ 2 ]; | ||
+ | }); | ||
+ | } | ||
+ | } | ||
+ | |||
+ | |||
+ | // show/hide pass | ||
+ | for ( prop in props ) { | ||
+ | value = props[ prop ]; | ||
+ | if ( rfxtypes.exec( value ) ) { | ||
+ | delete props[ prop ]; | ||
+ | toggle = toggle || value === "toggle"; | ||
+ | if ( value === ( hidden ? "hide" : "show" ) ) { | ||
+ | continue; | ||
+ | } | ||
+ | orig[ prop ] = dataShow && dataShow[ prop ] || jQuery.style( elem, prop ); | ||
+ | } | ||
+ | } | ||
+ | |||
+ | if ( !jQuery.isEmptyObject( orig ) ) { | ||
+ | if ( dataShow ) { | ||
+ | if ( "hidden" in dataShow ) { | ||
+ | hidden = dataShow.hidden; | ||
+ | } | ||
+ | } else { | ||
+ | dataShow = jQuery._data( elem, "fxshow", {} ); | ||
+ | } | ||
+ | |||
+ | // store state if its toggle - enables .stop().toggle() to "reverse" | ||
+ | if ( toggle ) { | ||
+ | dataShow.hidden = !hidden; | ||
+ | } | ||
+ | if ( hidden ) { | ||
+ | jQuery( elem ).show(); | ||
+ | } else { | ||
+ | anim.done(function() { | ||
+ | jQuery( elem ).hide(); | ||
+ | }); | ||
+ | } | ||
+ | anim.done(function() { | ||
+ | var prop; | ||
+ | jQuery._removeData( elem, "fxshow" ); | ||
+ | for ( prop in orig ) { | ||
+ | jQuery.style( elem, prop, orig[ prop ] ); | ||
+ | } | ||
+ | }); | ||
+ | for ( prop in orig ) { | ||
+ | tween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim ); | ||
+ | |||
+ | if ( !( prop in dataShow ) ) { | ||
+ | dataShow[ prop ] = tween.start; | ||
+ | if ( hidden ) { | ||
+ | tween.end = tween.start; | ||
+ | tween.start = prop === "width" || prop === "height" ? 1 : 0; | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | |||
+ | function Tween( elem, options, prop, end, easing ) { | ||
+ | return new Tween.prototype.init( elem, options, prop, end, easing ); | ||
+ | } | ||
+ | jQuery.Tween = Tween; | ||
+ | |||
+ | Tween.prototype = { | ||
+ | constructor: Tween, | ||
+ | init: function( elem, options, prop, end, easing, unit ) { | ||
+ | this.elem = elem; | ||
+ | this.prop = prop; | ||
+ | this.easing = easing || "swing"; | ||
+ | this.options = options; | ||
+ | this.start = this.now = this.cur(); | ||
+ | this.end = end; | ||
+ | this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" ); | ||
+ | }, | ||
+ | cur: function() { | ||
+ | var hooks = Tween.propHooks[ this.prop ]; | ||
+ | |||
+ | return hooks && hooks.get ? | ||
+ | hooks.get( this ) : | ||
+ | Tween.propHooks._default.get( this ); | ||
+ | }, | ||
+ | run: function( percent ) { | ||
+ | var eased, | ||
+ | hooks = Tween.propHooks[ this.prop ]; | ||
+ | |||
+ | if ( this.options.duration ) { | ||
+ | this.pos = eased = jQuery.easing[ this.easing ]( | ||
+ | percent, this.options.duration * percent, 0, 1, this.options.duration | ||
+ | ); | ||
+ | } else { | ||
+ | this.pos = eased = percent; | ||
+ | } | ||
+ | this.now = ( this.end - this.start ) * eased + this.start; | ||
+ | |||
+ | if ( this.options.step ) { | ||
+ | this.options.step.call( this.elem, this.now, this ); | ||
+ | } | ||
+ | |||
+ | if ( hooks && hooks.set ) { | ||
+ | hooks.set( this ); | ||
+ | } else { | ||
+ | Tween.propHooks._default.set( this ); | ||
+ | } | ||
+ | return this; | ||
+ | } | ||
+ | }; | ||
+ | |||
+ | Tween.prototype.init.prototype = Tween.prototype; | ||
+ | |||
+ | Tween.propHooks = { | ||
+ | _default: { | ||
+ | get: function( tween ) { | ||
+ | var result; | ||
+ | |||
+ | if ( tween.elem[ tween.prop ] != null && | ||
+ | (!tween.elem.style || tween.elem.style[ tween.prop ] == null) ) { | ||
+ | return tween.elem[ tween.prop ]; | ||
+ | } | ||
+ | |||
+ | // passing an empty string as a 3rd parameter to .css will automatically | ||
+ | // attempt a parseFloat and fallback to a string if the parse fails | ||
+ | // so, simple values such as "10px" are parsed to Float. | ||
+ | // complex values such as "rotate(1rad)" are returned as is. | ||
+ | result = jQuery.css( tween.elem, tween.prop, "" ); | ||
+ | // Empty strings, null, undefined and "auto" are converted to 0. | ||
+ | return !result || result === "auto" ? 0 : result; | ||
+ | }, | ||
+ | set: function( tween ) { | ||
+ | // use step hook for back compat - use cssHook if its there - use .style if its | ||
+ | // available and use plain properties where available | ||
+ | if ( jQuery.fx.step[ tween.prop ] ) { | ||
+ | jQuery.fx.step[ tween.prop ]( tween ); | ||
+ | } else if ( tween.elem.style && ( tween.elem.style[ jQuery.cssProps[ tween.prop ] ] != null || jQuery.cssHooks[ tween.prop ] ) ) { | ||
+ | jQuery.style( tween.elem, tween.prop, tween.now + tween.unit ); | ||
+ | } else { | ||
+ | tween.elem[ tween.prop ] = tween.now; | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | }; | ||
+ | |||
+ | // Support: IE <=9 | ||
+ | // Panic based approach to setting things on disconnected nodes | ||
+ | |||
+ | Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = { | ||
+ | set: function( tween ) { | ||
+ | if ( tween.elem.nodeType && tween.elem.parentNode ) { | ||
+ | tween.elem[ tween.prop ] = tween.now; | ||
+ | } | ||
+ | } | ||
+ | }; | ||
+ | |||
+ | jQuery.each([ "toggle", "show", "hide" ], function( i, name ) { | ||
+ | var cssFn = jQuery.fn[ name ]; | ||
+ | jQuery.fn[ name ] = function( speed, easing, callback ) { | ||
+ | return speed == null || typeof speed === "boolean" ? | ||
+ | cssFn.apply( this, arguments ) : | ||
+ | this.animate( genFx( name, true ), speed, easing, callback ); | ||
+ | }; | ||
+ | }); | ||
+ | |||
+ | jQuery.fn.extend({ | ||
+ | fadeTo: function( speed, to, easing, callback ) { | ||
+ | |||
+ | // show any hidden elements after setting opacity to 0 | ||
+ | return this.filter( isHidden ).css( "opacity", 0 ).show() | ||
+ | |||
+ | // animate to the value specified | ||
+ | .end().animate({ opacity: to }, speed, easing, callback ); | ||
+ | }, | ||
+ | animate: function( prop, speed, easing, callback ) { | ||
+ | var empty = jQuery.isEmptyObject( prop ), | ||
+ | optall = jQuery.speed( speed, easing, callback ), | ||
+ | doAnimation = function() { | ||
+ | // Operate on a copy of prop so per-property easing won't be lost | ||
+ | var anim = Animation( this, jQuery.extend( {}, prop ), optall ); | ||
+ | |||
+ | // Empty animations, or finishing resolves immediately | ||
+ | if ( empty || jQuery._data( this, "finish" ) ) { | ||
+ | anim.stop( true ); | ||
+ | } | ||
+ | }; | ||
+ | doAnimation.finish = doAnimation; | ||
+ | |||
+ | return empty || optall.queue === false ? | ||
+ | this.each( doAnimation ) : | ||
+ | this.queue( optall.queue, doAnimation ); | ||
+ | }, | ||
+ | stop: function( type, clearQueue, gotoEnd ) { | ||
+ | var stopQueue = function( hooks ) { | ||
+ | var stop = hooks.stop; | ||
+ | delete hooks.stop; | ||
+ | stop( gotoEnd ); | ||
+ | }; | ||
+ | |||
+ | if ( typeof type !== "string" ) { | ||
+ | gotoEnd = clearQueue; | ||
+ | clearQueue = type; | ||
+ | type = undefined; | ||
+ | } | ||
+ | if ( clearQueue && type !== false ) { | ||
+ | this.queue( type || "fx", [] ); | ||
+ | } | ||
+ | |||
+ | return this.each(function() { | ||
+ | var dequeue = true, | ||
+ | index = type != null && type + "queueHooks", | ||
+ | timers = jQuery.timers, | ||
+ | data = jQuery._data( this ); | ||
+ | |||
+ | if ( index ) { | ||
+ | if ( data[ index ] && data[ index ].stop ) { | ||
+ | stopQueue( data[ index ] ); | ||
+ | } | ||
+ | } else { | ||
+ | for ( index in data ) { | ||
+ | if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) { | ||
+ | stopQueue( data[ index ] ); | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | |||
+ | for ( index = timers.length; index--; ) { | ||
+ | if ( timers[ index ].elem === this && (type == null || timers[ index ].queue === type) ) { | ||
+ | timers[ index ].anim.stop( gotoEnd ); | ||
+ | dequeue = false; | ||
+ | timers.splice( index, 1 ); | ||
+ | } | ||
+ | } | ||
+ | |||
+ | // start the next in the queue if the last step wasn't forced | ||
+ | // timers currently will call their complete callbacks, which will dequeue | ||
+ | // but only if they were gotoEnd | ||
+ | if ( dequeue || !gotoEnd ) { | ||
+ | jQuery.dequeue( this, type ); | ||
+ | } | ||
+ | }); | ||
+ | }, | ||
+ | finish: function( type ) { | ||
+ | if ( type !== false ) { | ||
+ | type = type || "fx"; | ||
+ | } | ||
+ | return this.each(function() { | ||
+ | var index, | ||
+ | data = jQuery._data( this ), | ||
+ | queue = data[ type + "queue" ], | ||
+ | hooks = data[ type + "queueHooks" ], | ||
+ | timers = jQuery.timers, | ||
+ | length = queue ? queue.length : 0; | ||
+ | |||
+ | // enable finishing flag on private data | ||
+ | data.finish = true; | ||
+ | |||
+ | // empty the queue first | ||
+ | jQuery.queue( this, type, [] ); | ||
+ | |||
+ | if ( hooks && hooks.stop ) { | ||
+ | hooks.stop.call( this, true ); | ||
+ | } | ||
+ | |||
+ | // look for any active animations, and finish them | ||
+ | for ( index = timers.length; index--; ) { | ||
+ | if ( timers[ index ].elem === this && timers[ index ].queue === type ) { | ||
+ | timers[ index ].anim.stop( true ); | ||
+ | timers.splice( index, 1 ); | ||
+ | } | ||
+ | } | ||
+ | |||
+ | // look for any animations in the old queue and finish them | ||
+ | for ( index = 0; index < length; index++ ) { | ||
+ | if ( queue[ index ] && queue[ index ].finish ) { | ||
+ | queue[ index ].finish.call( this ); | ||
+ | } | ||
+ | } | ||
+ | |||
+ | // turn off finishing flag | ||
+ | delete data.finish; | ||
+ | }); | ||
+ | } | ||
+ | }); | ||
+ | |||
+ | // Generate parameters to create a standard animation | ||
+ | function genFx( type, includeWidth ) { | ||
+ | var which, | ||
+ | attrs = { height: type }, | ||
+ | i = 0; | ||
+ | |||
+ | // if we include width, step value is 1 to do all cssExpand values, | ||
+ | // if we don't include width, step value is 2 to skip over Left and Right | ||
+ | includeWidth = includeWidth? 1 : 0; | ||
+ | for( ; i < 4 ; i += 2 - includeWidth ) { | ||
+ | which = cssExpand[ i ]; | ||
+ | attrs[ "margin" + which ] = attrs[ "padding" + which ] = type; | ||
+ | } | ||
+ | |||
+ | if ( includeWidth ) { | ||
+ | attrs.opacity = attrs.width = type; | ||
+ | } | ||
+ | |||
+ | return attrs; | ||
+ | } | ||
+ | |||
+ | // Generate shortcuts for custom animations | ||
+ | jQuery.each({ | ||
+ | slideDown: genFx("show"), | ||
+ | slideUp: genFx("hide"), | ||
+ | slideToggle: genFx("toggle"), | ||
+ | fadeIn: { opacity: "show" }, | ||
+ | fadeOut: { opacity: "hide" }, | ||
+ | fadeToggle: { opacity: "toggle" } | ||
+ | }, function( name, props ) { | ||
+ | jQuery.fn[ name ] = function( speed, easing, callback ) { | ||
+ | return this.animate( props, speed, easing, callback ); | ||
+ | }; | ||
+ | }); | ||
+ | |||
+ | jQuery.speed = function( speed, easing, fn ) { | ||
+ | var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : { | ||
+ | complete: fn || !fn && easing || | ||
+ | jQuery.isFunction( speed ) && speed, | ||
+ | duration: speed, | ||
+ | easing: fn && easing || easing && !jQuery.isFunction( easing ) && easing | ||
+ | }; | ||
+ | |||
+ | opt.duration = jQuery.fx.off ? 0 : typeof opt.duration === "number" ? opt.duration : | ||
+ | opt.duration in jQuery.fx.speeds ? jQuery.fx.speeds[ opt.duration ] : jQuery.fx.speeds._default; | ||
+ | |||
+ | // normalize opt.queue - true/undefined/null -> "fx" | ||
+ | if ( opt.queue == null || opt.queue === true ) { | ||
+ | opt.queue = "fx"; | ||
+ | } | ||
+ | |||
+ | // Queueing | ||
+ | opt.old = opt.complete; | ||
+ | |||
+ | opt.complete = function() { | ||
+ | if ( jQuery.isFunction( opt.old ) ) { | ||
+ | opt.old.call( this ); | ||
+ | } | ||
+ | |||
+ | if ( opt.queue ) { | ||
+ | jQuery.dequeue( this, opt.queue ); | ||
+ | } | ||
+ | }; | ||
+ | |||
+ | return opt; | ||
+ | }; | ||
+ | |||
+ | jQuery.easing = { | ||
+ | linear: function( p ) { | ||
+ | return p; | ||
+ | }, | ||
+ | swing: function( p ) { | ||
+ | return 0.5 - Math.cos( p*Math.PI ) / 2; | ||
+ | } | ||
+ | }; | ||
+ | |||
+ | jQuery.timers = []; | ||
+ | jQuery.fx = Tween.prototype.init; | ||
+ | jQuery.fx.tick = function() { | ||
+ | var timer, | ||
+ | timers = jQuery.timers, | ||
+ | i = 0; | ||
+ | |||
+ | fxNow = jQuery.now(); | ||
+ | |||
+ | for ( ; i < timers.length; i++ ) { | ||
+ | timer = timers[ i ]; | ||
+ | // Checks the timer has not already been removed | ||
+ | if ( !timer() && timers[ i ] === timer ) { | ||
+ | timers.splice( i--, 1 ); | ||
+ | } | ||
+ | } | ||
+ | |||
+ | if ( !timers.length ) { | ||
+ | jQuery.fx.stop(); | ||
+ | } | ||
+ | fxNow = undefined; | ||
+ | }; | ||
+ | |||
+ | jQuery.fx.timer = function( timer ) { | ||
+ | if ( timer() && jQuery.timers.push( timer ) ) { | ||
+ | jQuery.fx.start(); | ||
+ | } | ||
+ | }; | ||
+ | |||
+ | jQuery.fx.interval = 13; | ||
+ | |||
+ | jQuery.fx.start = function() { | ||
+ | if ( !timerId ) { | ||
+ | timerId = setInterval( jQuery.fx.tick, jQuery.fx.interval ); | ||
+ | } | ||
+ | }; | ||
+ | |||
+ | jQuery.fx.stop = function() { | ||
+ | clearInterval( timerId ); | ||
+ | timerId = null; | ||
+ | }; | ||
+ | |||
+ | jQuery.fx.speeds = { | ||
+ | slow: 600, | ||
+ | fast: 200, | ||
+ | // Default speed | ||
+ | _default: 400 | ||
+ | }; | ||
+ | |||
+ | // Back Compat <1.8 extension point | ||
+ | jQuery.fx.step = {}; | ||
+ | |||
+ | if ( jQuery.expr && jQuery.expr.filters ) { | ||
+ | jQuery.expr.filters.animated = function( elem ) { | ||
+ | return jQuery.grep(jQuery.timers, function( fn ) { | ||
+ | return elem === fn.elem; | ||
+ | }).length; | ||
+ | }; | ||
+ | } | ||
+ | jQuery.fn.offset = function( options ) { | ||
+ | if ( arguments.length ) { | ||
+ | return options === undefined ? | ||
+ | this : | ||
+ | this.each(function( i ) { | ||
+ | jQuery.offset.setOffset( this, options, i ); | ||
+ | }); | ||
+ | } | ||
+ | |||
+ | var docElem, win, | ||
+ | box = { top: 0, left: 0 }, | ||
+ | elem = this[ 0 ], | ||
+ | doc = elem && elem.ownerDocument; | ||
+ | |||
+ | if ( !doc ) { | ||
+ | return; | ||
+ | } | ||
+ | |||
+ | docElem = doc.documentElement; | ||
+ | |||
+ | // Make sure it's not a disconnected DOM node | ||
+ | if ( !jQuery.contains( docElem, elem ) ) { | ||
+ | return box; | ||
+ | } | ||
+ | |||
+ | // If we don't have gBCR, just use 0,0 rather than error | ||
+ | // BlackBerry 5, iOS 3 (original iPhone) | ||
+ | if ( typeof elem.getBoundingClientRect !== core_strundefined ) { | ||
+ | box = elem.getBoundingClientRect(); | ||
+ | } | ||
+ | win = getWindow( doc ); | ||
+ | return { | ||
+ | top: box.top + ( win.pageYOffset || docElem.scrollTop ) - ( docElem.clientTop || 0 ), | ||
+ | left: box.left + ( win.pageXOffset || docElem.scrollLeft ) - ( docElem.clientLeft || 0 ) | ||
+ | }; | ||
+ | }; | ||
+ | |||
+ | jQuery.offset = { | ||
+ | |||
+ | setOffset: function( elem, options, i ) { | ||
+ | var position = jQuery.css( elem, "position" ); | ||
+ | |||
+ | // set position first, in-case top/left are set even on static elem | ||
+ | if ( position === "static" ) { | ||
+ | elem.style.position = "relative"; | ||
+ | } | ||
+ | |||
+ | var curElem = jQuery( elem ), | ||
+ | curOffset = curElem.offset(), | ||
+ | curCSSTop = jQuery.css( elem, "top" ), | ||
+ | curCSSLeft = jQuery.css( elem, "left" ), | ||
+ | calculatePosition = ( position === "absolute" || position === "fixed" ) && jQuery.inArray("auto", [curCSSTop, curCSSLeft]) > -1, | ||
+ | props = {}, curPosition = {}, curTop, curLeft; | ||
+ | |||
+ | // need to be able to calculate position if either top or left is auto and position is either absolute or fixed | ||
+ | if ( calculatePosition ) { | ||
+ | curPosition = curElem.position(); | ||
+ | curTop = curPosition.top; | ||
+ | curLeft = curPosition.left; | ||
+ | } else { | ||
+ | curTop = parseFloat( curCSSTop ) || 0; | ||
+ | curLeft = parseFloat( curCSSLeft ) || 0; | ||
+ | } | ||
+ | |||
+ | if ( jQuery.isFunction( options ) ) { | ||
+ | options = options.call( elem, i, curOffset ); | ||
+ | } | ||
+ | |||
+ | if ( options.top != null ) { | ||
+ | props.top = ( options.top - curOffset.top ) + curTop; | ||
+ | } | ||
+ | if ( options.left != null ) { | ||
+ | props.left = ( options.left - curOffset.left ) + curLeft; | ||
+ | } | ||
+ | |||
+ | if ( "using" in options ) { | ||
+ | options.using.call( elem, props ); | ||
+ | } else { | ||
+ | curElem.css( props ); | ||
+ | } | ||
+ | } | ||
+ | }; | ||
+ | |||
+ | |||
+ | jQuery.fn.extend({ | ||
+ | |||
+ | position: function() { | ||
+ | if ( !this[ 0 ] ) { | ||
+ | return; | ||
+ | } | ||
+ | |||
+ | var offsetParent, offset, | ||
+ | parentOffset = { top: 0, left: 0 }, | ||
+ | elem = this[ 0 ]; | ||
+ | |||
+ | // fixed elements are offset from window (parentOffset = {top:0, left: 0}, because it is it's only offset parent | ||
+ | if ( jQuery.css( elem, "position" ) === "fixed" ) { | ||
+ | // we assume that getBoundingClientRect is available when computed position is fixed | ||
+ | offset = elem.getBoundingClientRect(); | ||
+ | } else { | ||
+ | // Get *real* offsetParent | ||
+ | offsetParent = this.offsetParent(); | ||
+ | |||
+ | // Get correct offsets | ||
+ | offset = this.offset(); | ||
+ | if ( !jQuery.nodeName( offsetParent[ 0 ], "html" ) ) { | ||
+ | parentOffset = offsetParent.offset(); | ||
+ | } | ||
+ | |||
+ | // Add offsetParent borders | ||
+ | parentOffset.top += jQuery.css( offsetParent[ 0 ], "borderTopWidth", true ); | ||
+ | parentOffset.left += jQuery.css( offsetParent[ 0 ], "borderLeftWidth", true ); | ||
+ | } | ||
+ | |||
+ | // Subtract parent offsets and element margins | ||
+ | // note: when an element has margin: auto the offsetLeft and marginLeft | ||
+ | // are the same in Safari causing offset.left to incorrectly be 0 | ||
+ | return { | ||
+ | top: offset.top - parentOffset.top - jQuery.css( elem, "marginTop", true ), | ||
+ | left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true) | ||
+ | }; | ||
+ | }, | ||
+ | |||
+ | offsetParent: function() { | ||
+ | return this.map(function() { | ||
+ | var offsetParent = this.offsetParent || docElem; | ||
+ | while ( offsetParent && ( !jQuery.nodeName( offsetParent, "html" ) && jQuery.css( offsetParent, "position") === "static" ) ) { | ||
+ | offsetParent = offsetParent.offsetParent; | ||
+ | } | ||
+ | return offsetParent || docElem; | ||
+ | }); | ||
+ | } | ||
+ | }); | ||
+ | |||
+ | |||
+ | // Create scrollLeft and scrollTop methods | ||
+ | jQuery.each( {scrollLeft: "pageXOffset", scrollTop: "pageYOffset"}, function( method, prop ) { | ||
+ | var top = /Y/.test( prop ); | ||
+ | |||
+ | jQuery.fn[ method ] = function( val ) { | ||
+ | return jQuery.access( this, function( elem, method, val ) { | ||
+ | var win = getWindow( elem ); | ||
+ | |||
+ | if ( val === undefined ) { | ||
+ | return win ? (prop in win) ? win[ prop ] : | ||
+ | win.document.documentElement[ method ] : | ||
+ | elem[ method ]; | ||
+ | } | ||
+ | |||
+ | if ( win ) { | ||
+ | win.scrollTo( | ||
+ | !top ? val : jQuery( win ).scrollLeft(), | ||
+ | top ? val : jQuery( win ).scrollTop() | ||
+ | ); | ||
+ | |||
+ | } else { | ||
+ | elem[ method ] = val; | ||
+ | } | ||
+ | }, method, val, arguments.length, null ); | ||
+ | }; | ||
+ | }); | ||
+ | |||
+ | function getWindow( elem ) { | ||
+ | return jQuery.isWindow( elem ) ? | ||
+ | elem : | ||
+ | elem.nodeType === 9 ? | ||
+ | elem.defaultView || elem.parentWindow : | ||
+ | false; | ||
+ | } | ||
+ | // Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods | ||
+ | jQuery.each( { Height: "height", Width: "width" }, function( name, type ) { | ||
+ | jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name }, function( defaultExtra, funcName ) { | ||
+ | // margin is only for outerHeight, outerWidth | ||
+ | jQuery.fn[ funcName ] = function( margin, value ) { | ||
+ | var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ), | ||
+ | extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" ); | ||
+ | |||
+ | return jQuery.access( this, function( elem, type, value ) { | ||
+ | var doc; | ||
+ | |||
+ | if ( jQuery.isWindow( elem ) ) { | ||
+ | // As of 5/8/2012 this will yield incorrect results for Mobile Safari, but there | ||
+ | // isn't a whole lot we can do. See pull request at this URL for discussion: | ||
+ | // https://github.com/jquery/jquery/pull/764 | ||
+ | return elem.document.documentElement[ "client" + name ]; | ||
+ | } | ||
+ | |||
+ | // Get document width or height | ||
+ | if ( elem.nodeType === 9 ) { | ||
+ | doc = elem.documentElement; | ||
+ | |||
+ | // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height], whichever is greatest | ||
+ | // unfortunately, this causes bug #3838 in IE6/8 only, but there is currently no good, small way to fix it. | ||
+ | return Math.max( | ||
+ | elem.body[ "scroll" + name ], doc[ "scroll" + name ], | ||
+ | elem.body[ "offset" + name ], doc[ "offset" + name ], | ||
+ | doc[ "client" + name ] | ||
+ | ); | ||
+ | } | ||
+ | |||
+ | return value === undefined ? | ||
+ | // Get width or height on the element, requesting but not forcing parseFloat | ||
+ | jQuery.css( elem, type, extra ) : | ||
+ | |||
+ | // Set width or height on the element | ||
+ | jQuery.style( elem, type, value, extra ); | ||
+ | }, type, chainable ? margin : undefined, chainable, null ); | ||
+ | }; | ||
+ | }); | ||
+ | }); | ||
+ | // Limit scope pollution from any deprecated API | ||
+ | // (function() { | ||
+ | |||
+ | // The number of elements contained in the matched element set | ||
+ | jQuery.fn.size = function() { | ||
+ | return this.length; | ||
+ | }; | ||
+ | |||
+ | jQuery.fn.andSelf = jQuery.fn.addBack; | ||
+ | |||
+ | // })(); | ||
+ | if ( typeof module === "object" && module && typeof module.exports === "object" ) { | ||
+ | // Expose jQuery as module.exports in loaders that implement the Node | ||
+ | // module pattern (including browserify). Do not create the global, since | ||
+ | // the user will be storing it themselves locally, and globals are frowned | ||
+ | // upon in the Node module world. | ||
+ | module.exports = jQuery; | ||
+ | } else { | ||
+ | // Otherwise expose jQuery to the global object as usual | ||
+ | window.jQuery = window.$ = jQuery; | ||
+ | |||
+ | // Register as a named AMD module, since jQuery can be concatenated with other | ||
+ | // files that may use define, but not via a proper concatenation script that | ||
+ | // understands anonymous AMD modules. A named AMD is safest and most robust | ||
+ | // way to register. Lowercase jquery is used because AMD module names are | ||
+ | // derived from file names, and jQuery is normally delivered in a lowercase | ||
+ | // file name. Do this after creating the global so that if an AMD module wants | ||
+ | // to call noConflict to hide this version of jQuery, it will work. | ||
+ | if ( typeof define === "function" && define.amd ) { | ||
+ | define( "jquery", [], function () { return jQuery; } ); | ||
+ | } | ||
+ | } | ||
+ | |||
+ | })( window ); | ||
+ | |||
+ | </script> | ||
+ | |||
+ | |||
+ | <script type="text/javascript"> | ||
+ | (function($){ | ||
+ | $(document).ready(function(){ | ||
+ | |||
+ | |||
+ | (function() { | ||
+ | // Fixed Navigation Bar | ||
+ | // $('#menu-bar').scrollToFixed(); | ||
+ | |||
+ | // Moving Logo from Logo-Bar to Navbar-header on Tab size of 768px or Minimum | ||
+ | $(window).on("load resize orientationchange",function(e){ | ||
+ | if($(window).width() < 768){ | ||
+ | $("#logo").detach().appendTo($(".navbar-static-top")); | ||
+ | } | ||
+ | else{ | ||
+ | $("#logo").detach().appendTo('#menu-bar .container .col-sm-3') | ||
+ | } | ||
+ | |||
+ | // Dynamic Header Height Set in Home Page | ||
+ | $(".home #header").height($("#header-top").height() + $(".slider_block").height()); | ||
+ | |||
+ | }); | ||
+ | |||
+ | |||
+ | |||
+ | })(); | ||
+ | |||
+ | var abc = $('.vertical-tab .nav-tabs').width(); | ||
+ | $('.vertical-tab .tab-content').css("margin-left", abc-1); | ||
+ | |||
+ | /*----------------------------------------------------*/ | ||
+ | /* Sticky Header | ||
+ | /*----------------------------------------------------*/ | ||
+ | if(jQuery.isFunction(jQuery.fn.sticky)){ | ||
+ | $(window).load(function(){ | ||
+ | $("#menu-bar").sticky({ topSpacing: 0 }); | ||
+ | }); | ||
+ | } | ||
+ | /*----------------------------------------------------*/ | ||
+ | /* Same Height Div's | ||
+ | /*----------------------------------------------------*/ | ||
+ | if(jQuery.isFunction(jQuery.fn.matchHeight)){ | ||
+ | $('.same-height').matchHeight(); | ||
+ | } | ||
+ | |||
+ | /*-------------------------------------------------- | ||
+ | Search-Icon | ||
+ | * ----------------------------------------------------*/ | ||
+ | $(function(){ | ||
+ | $(".search-label .search-button").on("click", function(e){ | ||
+ | e.preventDefault(); | ||
+ | $("html").addClass("search-exp"); | ||
+ | $(".search-input").focus(); | ||
+ | }); | ||
+ | $(".search-input").blur(function(){ | ||
+ | // Do not hide input if contains text | ||
+ | if($(".search-input").val() === ""){ | ||
+ | $("html").removeClass("search-exp"); | ||
+ | } | ||
+ | }); | ||
+ | }); | ||
+ | |||
+ | /*----------------------------------------------------*/ | ||
+ | /* FlexSlider | ||
+ | /*----------------------------------------------------*/ | ||
+ | if(jQuery.isFunction(jQuery.fn.fractionSlider)){ | ||
+ | $('.flexslider.top_slider').flexslider({ | ||
+ | animation: "fade", | ||
+ | controlNav: false, | ||
+ | directionNav: true, | ||
+ | prevText: "←", | ||
+ | nextText: "→" | ||
+ | }); | ||
+ | } | ||
+ | |||
+ | /*----------------------------------------------------*/ | ||
+ | /* EasyPie Chart Effects | ||
+ | /*----------------------------------------------------*/ | ||
+ | if(jQuery.isFunction(jQuery.fn.easyPieChart)){ | ||
+ | |||
+ | // Big EasyPie Chart Effects; | ||
+ | $('.circular-chart-big').easyPieChart({ | ||
+ | animate : 2000, | ||
+ | barColor: "#727CB6", | ||
+ | trackColor : '#f9f9f9', | ||
+ | scaleColor: false, | ||
+ | lineWidth: 11, | ||
+ | size: 180, | ||
+ | onStep: function(from, to, percent) { | ||
+ | $(this.el).find('.percent').text(Math.round(percent)+'%'); | ||
+ | } | ||
+ | }); | ||
+ | |||
+ | // Small EasyPie Chart Effects; | ||
+ | $('.circular-chart-small').easyPieChart({ | ||
+ | size : 120, | ||
+ | animate : 2000, | ||
+ | lineWidth : 7, | ||
+ | lineCap : 'square', | ||
+ | barColor : '#727CB6', | ||
+ | trackColor : '#f9f9f9', | ||
+ | scaleColor : false, | ||
+ | onStep: function(from, to, percent) { | ||
+ | $(this.el).find('.percent').text(Math.round(percent)+'%'); | ||
+ | } | ||
+ | }); | ||
+ | } | ||
+ | |||
+ | /*----------------------------------------------------*/ | ||
+ | /* CountTo | ||
+ | /*----------------------------------------------------*/ | ||
+ | if(jQuery.isFunction(jQuery.fn.countTo)){ | ||
+ | $('.timer').countTo(); | ||
+ | } | ||
+ | |||
+ | /*----------------------------------------------------*/ | ||
+ | /* Owl Carousel | ||
+ | /*----------------------------------------------------*/ | ||
+ | if(jQuery.isFunction(jQuery.fn.owlCarousel)){ | ||
+ | |||
+ | // Recent Work Slider | ||
+ | $("#recent-work-slider").owlCarousel({ | ||
+ | navigation : true, | ||
+ | pagination : false, | ||
+ | items : 4, | ||
+ | itemsDesktop:[1199,4], | ||
+ | itemsTablet : [768, 3], | ||
+ | itemsDesktopSmall : [992, 3], | ||
+ | itemsMobile : [480,1], | ||
+ | navigationText : ["",""] | ||
+ | }); | ||
+ | |||
+ | // Post News Slider | ||
+ | $("#post-slider").owlCarousel({ | ||
+ | navigation : true, | ||
+ | pagination : false, | ||
+ | items : 4, | ||
+ | itemsDesktop:[1199,3], | ||
+ | itemsDesktopSmall:[980,2], | ||
+ | itemsMobile : [479,1], | ||
+ | navigationText : ["",""] | ||
+ | }); | ||
+ | } | ||
+ | |||
+ | $("body").tooltip({ | ||
+ | selector: '[data-toggle="tooltip"]' | ||
+ | }); | ||
+ | |||
+ | |||
+ | // ============================ | ||
+ | // = Scroll event function = | ||
+ | // =========================== | ||
+ | var goScrolling = function(elem) { | ||
+ | var docViewTop = $(window).scrollTop(); | ||
+ | var docViewBottom = docViewTop + $(window).height(); | ||
+ | var elemTop = elem.offset().top; | ||
+ | var elemBottom = elemTop + elem.height(); | ||
+ | return ((elemBottom <= docViewBottom) && (elemTop >= docViewTop)); | ||
+ | }; | ||
+ | |||
+ | |||
+ | // ======================= | ||
+ | // = Progress bars = | ||
+ | // ======================= | ||
+ | $('.progress_skill .bar').data('width', $(this).width()).css({ | ||
+ | width : 0, | ||
+ | height:0 | ||
+ | }); | ||
+ | $(window).scroll(function() { | ||
+ | $('.progress_skill .bar').each(function() { | ||
+ | if (goScrolling($(this))) { | ||
+ | $(this).css({ | ||
+ | width : $(this).attr('data-value') + '%', | ||
+ | height : $(this).attr('data-height') + '%' | ||
+ | }); | ||
+ | } | ||
+ | }); | ||
+ | }); | ||
+ | |||
+ | |||
+ | // =================== | ||
+ | // = Flickr Gallery = | ||
+ | // =================== | ||
+ | $('#flickrFeed').jflickrfeed({ | ||
+ | limit: 9, | ||
+ | qstrings: { | ||
+ | //id: '124787947@N07' our id // | ||
+ | id: '124787947@N07' | ||
+ | }, | ||
+ | itemTemplate: '<li><a class="mfp-gallery" title="{{title}}" href="{{image_b}}"><i class="fa fa-search"></i><div class="hover"></div></a><img src="{{image_s}}" alt="{{title}}" /></li>' | ||
+ | }); | ||
+ | |||
+ | /*===========================================================*/ | ||
+ | /* Isotope Posrtfolio | ||
+ | /*===========================================================*/ | ||
+ | if(jQuery.isFunction(jQuery.fn.isotope)){ | ||
+ | jQuery('.portfolio_list').isotope({ | ||
+ | itemSelector : '.list_item', | ||
+ | layoutMode : 'fitRows', | ||
+ | animationEngine : 'jquery' | ||
+ | }); | ||
+ | |||
+ | /* ---- Filtering ----- */ | ||
+ | jQuery('#filter li').click(function(){ | ||
+ | var $this = jQuery(this); | ||
+ | if ( $this.hasClass('selected') ) { | ||
+ | return false; | ||
+ | } else { | ||
+ | jQuery('#filter .selected').removeClass('selected'); | ||
+ | var selector = $this.attr('data-filter'); | ||
+ | $this.parent().next().isotope({ filter: selector }); | ||
+ | $this.addClass('selected'); | ||
+ | return false; | ||
+ | } | ||
+ | }); | ||
+ | } | ||
+ | |||
+ | |||
+ | /*----------------------------------------------------*/ | ||
+ | /* Magnific Popup | ||
+ | /*----------------------------------------------------*/ | ||
+ | $('body').magnificPopup({ | ||
+ | type: 'image', | ||
+ | delegate: 'a.mfp-gallery', | ||
+ | fixedContentPos: true, | ||
+ | fixedBgPos: true, | ||
+ | overflowY: 'auto', | ||
+ | closeBtnInside: true, | ||
+ | preloader: true, | ||
+ | removalDelay: 0, | ||
+ | mainClass: 'mfp-fade', | ||
+ | gallery:{enabled:true}, | ||
+ | callbacks: { | ||
+ | buildControls: function() { | ||
+ | console.log('inside'); this.contentContainer.append(this.arrowLeft.add(this.arrowRight)); | ||
+ | } | ||
+ | } | ||
+ | }); | ||
+ | |||
+ | $('.mfp-image').magnificPopup({ | ||
+ | type: 'image', | ||
+ | closeOnContentClick: true, | ||
+ | mainClass: 'mfp-fade', | ||
+ | image: { | ||
+ | verticalFit: true | ||
+ | } | ||
+ | }); | ||
+ | |||
+ | $('.mfp-youtube, .mfp-vimeo, .mfp-gmaps').magnificPopup({ | ||
+ | disableOn: 700, | ||
+ | type: 'iframe', | ||
+ | mainClass: 'mfp-fade', | ||
+ | removalDelay: 0, | ||
+ | preloader: false, | ||
+ | fixedContentPos: false | ||
+ | }); | ||
+ | |||
+ | /*----------------------------------------------------*/ | ||
+ | /* Swipe Slider | ||
+ | /*----------------------------------------------------*/ | ||
+ | window.mySwipe = new Swipe(document.getElementById('slider'), { | ||
+ | startSlide: 2, | ||
+ | speed: 400, | ||
+ | auto: 3000, | ||
+ | continuous: true, | ||
+ | disableScroll: false, | ||
+ | stopPropagation: false, | ||
+ | callback: function(index, elem) {}, | ||
+ | transitionEnd: function(index, elem) {} | ||
+ | }); | ||
+ | |||
+ | /*----------------------------------------------------*/ | ||
+ | /* Accordians | ||
+ | /*----------------------------------------------------*/ | ||
+ | $('.accordion').on('shown.bs.collapse', function (e) { | ||
+ | $(e.target).parent().addClass('active_acc'); | ||
+ | $(e.target).prev().find('.switch').removeClass('fa-plus'); | ||
+ | $(e.target).prev().find('.switch').addClass('fa-minus'); | ||
+ | }); | ||
+ | $('.accordion').on('hidden.bs.collapse', function (e) { | ||
+ | $(e.target).parent().removeClass('active_acc'); | ||
+ | $(e.target).prev().find('.switch').addClass('fa-plus'); | ||
+ | $(e.target).prev().find('.switch').removeClass('fa-minus'); | ||
+ | }); | ||
+ | |||
+ | |||
+ | /*----------------------------------------------------*/ | ||
+ | /* Toggles | ||
+ | /*----------------------------------------------------*/ | ||
+ | $('.toggle').on('shown.bs.collapse', function (e) { | ||
+ | $(e.target).parent().addClass('active_acc'); | ||
+ | $(e.target).prev().find('.switch').removeClass('fa-plus'); | ||
+ | $(e.target).prev().find('.switch').addClass('fa-minus'); | ||
+ | }); | ||
+ | $('.toggle').on('hidden.bs.collapse', function (e) { | ||
+ | $(e.target).parent().removeClass('active_acc'); | ||
+ | $(e.target).prev().find('.switch').addClass('fa-plus'); | ||
+ | $(e.target).prev().find('.switch').removeClass('fa-minus'); | ||
+ | }); | ||
+ | |||
+ | /* ------------------ End Document ------------------ */ | ||
+ | }); | ||
+ | })(this.jQuery); | ||
+ | |||
+ | $(document).ready(function() { | ||
+ | |||
+ | /*================= | ||
+ | * Contact Form | ||
+ | * #contact | ||
+ | ===================*/ | ||
+ | |||
+ | try{ | ||
+ | jQuery('#contact').validate({ | ||
+ | submitHandler: function(form) { | ||
+ | jQuery('#contact .message').hide(); | ||
+ | var ajaxurl = 'contact.php'; | ||
+ | var data = { | ||
+ | action: 'contact_us', | ||
+ | datas: jQuery(form).serialize() | ||
+ | }; | ||
+ | |||
+ | jQuery.ajax({ | ||
+ | type: 'POST', | ||
+ | url: ajaxurl, | ||
+ | data: data, | ||
+ | success: function(response){ | ||
+ | jQuery('#contact .message').text(response.error).css({'display' : 'inline-block'}); | ||
+ | }, | ||
+ | dataType: 'json' | ||
+ | }); | ||
+ | return false; | ||
+ | }, | ||
+ | rules: { | ||
+ | c_name: { | ||
+ | required: true, | ||
+ | minlength: 3 | ||
+ | }, | ||
+ | c_mail: { | ||
+ | required: true, | ||
+ | email: true | ||
+ | }, | ||
+ | c_subject: { | ||
+ | required: true, | ||
+ | minlength: 6 | ||
+ | }, | ||
+ | c_message:{ | ||
+ | required: true, | ||
+ | minlength: 20 | ||
+ | } | ||
+ | } | ||
+ | }); | ||
+ | }catch(e){ | ||
+ | |||
+ | } | ||
+ | |||
+ | |||
+ | /*============ | ||
+ | BUTTON UP | ||
+ | * ===========*/ | ||
+ | var btnUp = $('<div/>', {'class':'btntoTop'}); | ||
+ | btnUp.appendTo('body'); | ||
+ | $(document) | ||
+ | .on('click', '.btntoTop', function() { | ||
+ | $('html, body').animate({ | ||
+ | scrollTop: 0 | ||
+ | }, 700); | ||
+ | }); | ||
+ | |||
+ | $(window) | ||
+ | .on('scroll', function() { | ||
+ | if ($(this).scrollTop() > 200) | ||
+ | $('.btntoTop').addClass('active'); | ||
+ | else | ||
+ | $('.btntoTop').removeClass('active'); | ||
+ | }); | ||
+ | }); | ||
+ | |||
+ | |||
+ | /** | ||
+ | * jQuery Plugin to obtain touch gestures from iPhone, iPod Touch, iPad, and Android mobile phones | ||
+ | * Common usage: wipe images (left and right to show the previous or next image) | ||
+ | * | ||
+ | * @author Andreas Waltl, netCU Internetagentur (http://www.netcu.de) | ||
+ | */ | ||
+ | (function($){$.fn.touchwipe=function(settings){var config={min_move_x:20,min_move_y:20,wipeLeft:function(){},wipeRight:function(){},wipeUp:function(){},wipeDown:function(){},preventDefaultEvents:true};if(settings)$.extend(config,settings);this.each(function(){var startX;var startY;var isMoving=false;function cancelTouch(){this.removeEventListener('touchmove',onTouchMove);startX=null;isMoving=false}function onTouchMove(e){if(config.preventDefaultEvents){e.preventDefault()}if(isMoving){var x=e.touches[0].pageX;var y=e.touches[0].pageY;var dx=startX-x;var dy=startY-y;if(Math.abs(dx)>=config.min_move_x){cancelTouch();if(dx>0){config.wipeLeft()}else{config.wipeRight()}}else if(Math.abs(dy)>=config.min_move_y){cancelTouch();if(dy>0){config.wipeDown()}else{config.wipeUp()}}}}function onTouchStart(e){if(e.touches.length==1){startX=e.touches[0].pageX;startY=e.touches[0].pageY;isMoving=true;this.addEventListener('touchmove',onTouchMove,false)}}if('ontouchstart'in document.documentElement){this.addEventListener('touchstart',onTouchStart,false)}});return this}})(jQuery); | ||
+ | </script> | ||
+ | |||
+ | |||
+ | <script type="text/javascript"> | ||
+ | "function"!==typeof Object.create&&(Object.create=function(f){function g(){}g.prototype=f;return new g}); | ||
+ | (function(f,g,k){var l={init:function(a,b){this.$elem=f(b);this.options=f.extend({},f.fn.owlCarousel.options,this.$elem.data(),a);this.userOptions=a;this.loadContent()},loadContent:function(){function a(a){var d,e="";if("function"===typeof b.options.jsonSuccess)b.options.jsonSuccess.apply(this,[a]);else{for(d in a.owl)a.owl.hasOwnProperty(d)&&(e+=a.owl[d].item);b.$elem.html(e)}b.logIn()}var b=this,e;"function"===typeof b.options.beforeInit&&b.options.beforeInit.apply(this,[b.$elem]);"string"===typeof b.options.jsonPath? | ||
+ | (e=b.options.jsonPath,f.getJSON(e,a)):b.logIn()},logIn:function(){this.$elem.data("owl-originalStyles",this.$elem.attr("style"));this.$elem.data("owl-originalClasses",this.$elem.attr("class"));this.$elem.css({opacity:0});this.orignalItems=this.options.items;this.checkBrowser();this.wrapperWidth=0;this.checkVisible=null;this.setVars()},setVars:function(){if(0===this.$elem.children().length)return!1;this.baseClass();this.eventTypes();this.$userItems=this.$elem.children();this.itemsAmount=this.$userItems.length; | ||
+ | this.wrapItems();this.$owlItems=this.$elem.find(".owl-item");this.$owlWrapper=this.$elem.find(".owl-wrapper");this.playDirection="next";this.prevItem=0;this.prevArr=[0];this.currentItem=0;this.customEvents();this.onStartup()},onStartup:function(){this.updateItems();this.calculateAll();this.buildControls();this.updateControls();this.response();this.moveEvents();this.stopOnHover();this.owlStatus();!1!==this.options.transitionStyle&&this.transitionTypes(this.options.transitionStyle);!0===this.options.autoPlay&& | ||
+ | (this.options.autoPlay=5E3);this.play();this.$elem.find(".owl-wrapper").css("display","block");this.$elem.is(":visible")?this.$elem.css("opacity",1):this.watchVisibility();this.onstartup=!1;this.eachMoveUpdate();"function"===typeof this.options.afterInit&&this.options.afterInit.apply(this,[this.$elem])},eachMoveUpdate:function(){!0===this.options.lazyLoad&&this.lazyLoad();!0===this.options.autoHeight&&this.autoHeight();this.onVisibleItems();"function"===typeof this.options.afterAction&&this.options.afterAction.apply(this, | ||
+ | [this.$elem])},updateVars:function(){"function"===typeof this.options.beforeUpdate&&this.options.beforeUpdate.apply(this,[this.$elem]);this.watchVisibility();this.updateItems();this.calculateAll();this.updatePosition();this.updateControls();this.eachMoveUpdate();"function"===typeof this.options.afterUpdate&&this.options.afterUpdate.apply(this,[this.$elem])},reload:function(){var a=this;g.setTimeout(function(){a.updateVars()},0)},watchVisibility:function(){var a=this;if(!1===a.$elem.is(":visible"))a.$elem.css({opacity:0}), | ||
+ | g.clearInterval(a.autoPlayInterval),g.clearInterval(a.checkVisible);else return!1;a.checkVisible=g.setInterval(function(){a.$elem.is(":visible")&&(a.reload(),a.$elem.animate({opacity:1},200),g.clearInterval(a.checkVisible))},500)},wrapItems:function(){this.$userItems.wrapAll('<div class="owl-wrapper">').wrap('<div class="owl-item"></div>');this.$elem.find(".owl-wrapper").wrap('<div class="owl-wrapper-outer">');this.wrapperOuter=this.$elem.find(".owl-wrapper-outer");this.$elem.css("display","block")}, | ||
+ | baseClass:function(){var a=this.$elem.hasClass(this.options.baseClass),b=this.$elem.hasClass(this.options.theme);a||this.$elem.addClass(this.options.baseClass);b||this.$elem.addClass(this.options.theme)},updateItems:function(){var a,b;if(!1===this.options.responsive)return!1;if(!0===this.options.singleItem)return this.options.items=this.orignalItems=1,this.options.itemsCustom=!1,this.options.itemsDesktop=!1,this.options.itemsDesktopSmall=!1,this.options.itemsTablet=!1,this.options.itemsTabletSmall= | ||
+ | !1,this.options.itemsMobile=!1;a=f(this.options.responsiveBaseWidth).width();a>(this.options.itemsDesktop[0]||this.orignalItems)&&(this.options.items=this.orignalItems);if(!1!==this.options.itemsCustom)for(this.options.itemsCustom.sort(function(a,b){return a[0]-b[0]}),b=0;b<this.options.itemsCustom.length;b+=1)this.options.itemsCustom[b][0]<=a&&(this.options.items=this.options.itemsCustom[b][1]);else a<=this.options.itemsDesktop[0]&&!1!==this.options.itemsDesktop&&(this.options.items=this.options.itemsDesktop[1]), | ||
+ | a<=this.options.itemsDesktopSmall[0]&&!1!==this.options.itemsDesktopSmall&&(this.options.items=this.options.itemsDesktopSmall[1]),a<=this.options.itemsTablet[0]&&!1!==this.options.itemsTablet&&(this.options.items=this.options.itemsTablet[1]),a<=this.options.itemsTabletSmall[0]&&!1!==this.options.itemsTabletSmall&&(this.options.items=this.options.itemsTabletSmall[1]),a<=this.options.itemsMobile[0]&&!1!==this.options.itemsMobile&&(this.options.items=this.options.itemsMobile[1]);this.options.items>this.itemsAmount&& | ||
+ | !0===this.options.itemsScaleUp&&(this.options.items=this.itemsAmount)},response:function(){var a=this,b,e;if(!0!==a.options.responsive)return!1;e=f(g).width();a.resizer=function(){f(g).width()!==e&&(!1!==a.options.autoPlay&&g.clearInterval(a.autoPlayInterval),g.clearTimeout(b),b=g.setTimeout(function(){e=f(g).width();a.updateVars()},a.options.responsiveRefreshRate))};f(g).resize(a.resizer)},updatePosition:function(){this.jumpTo(this.currentItem);!1!==this.options.autoPlay&&this.checkAp()},appendItemsSizes:function(){var a= | ||
+ | this,b=0,e=a.itemsAmount-a.options.items;a.$owlItems.each(function(c){var d=f(this);d.css({width:a.itemWidth}).data("owl-item",Number(c));if(0===c%a.options.items||c===e)c>e||(b+=1);d.data("owl-roundPages",b)})},appendWrapperSizes:function(){this.$owlWrapper.css({width:this.$owlItems.length*this.itemWidth*2,left:0});this.appendItemsSizes()},calculateAll:function(){this.calculateWidth();this.appendWrapperSizes();this.loops();this.max()},calculateWidth:function(){this.itemWidth=Math.round(this.$elem.width()/ | ||
+ | this.options.items)},max:function(){var a=-1*(this.itemsAmount*this.itemWidth-this.options.items*this.itemWidth);this.options.items>this.itemsAmount?this.maximumPixels=a=this.maximumItem=0:(this.maximumItem=this.itemsAmount-this.options.items,this.maximumPixels=a);return a},min:function(){return 0},loops:function(){var a=0,b=0,e,c;this.positionsInArray=[0];this.pagesInArray=[];for(e=0;e<this.itemsAmount;e+=1)b+=this.itemWidth,this.positionsInArray.push(-b),!0===this.options.scrollPerPage&&(c=f(this.$owlItems[e]), | ||
+ | c=c.data("owl-roundPages"),c!==a&&(this.pagesInArray[a]=this.positionsInArray[e],a=c))},buildControls:function(){if(!0===this.options.navigation||!0===this.options.pagination)this.owlControls=f('<div class="owl-controls"/>').toggleClass("clickable",!this.browser.isTouch).appendTo(this.$elem);!0===this.options.pagination&&this.buildPagination();!0===this.options.navigation&&this.buildButtons()},buildButtons:function(){var a=this,b=f('<div class="owl-buttons"/>');a.owlControls.append(b);a.buttonPrev= | ||
+ | f("<div/>",{"class":"owl-prev",html:a.options.navigationText[0]||""});a.buttonNext=f("<div/>",{"class":"owl-next",html:a.options.navigationText[1]||""});b.append(a.buttonPrev).append(a.buttonNext);b.on("touchstart.owlControls mousedown.owlControls",'div[class^="owl"]',function(a){a.preventDefault()});b.on("touchend.owlControls mouseup.owlControls",'div[class^="owl"]',function(b){b.preventDefault();f(this).hasClass("owl-next")?a.next():a.prev()})},buildPagination:function(){var a=this;a.paginationWrapper= | ||
+ | f('<div class="owl-pagination"/>');a.owlControls.append(a.paginationWrapper);a.paginationWrapper.on("touchend.owlControls mouseup.owlControls",".owl-page",function(b){b.preventDefault();Number(f(this).data("owl-page"))!==a.currentItem&&a.goTo(Number(f(this).data("owl-page")),!0)})},updatePagination:function(){var a,b,e,c,d,g;if(!1===this.options.pagination)return!1;this.paginationWrapper.html("");a=0;b=this.itemsAmount-this.itemsAmount%this.options.items;for(c=0;c<this.itemsAmount;c+=1)0===c%this.options.items&& | ||
+ | (a+=1,b===c&&(e=this.itemsAmount-this.options.items),d=f("<div/>",{"class":"owl-page"}),g=f("<span></span>",{text:!0===this.options.paginationNumbers?a:"","class":!0===this.options.paginationNumbers?"owl-numbers":""}),d.append(g),d.data("owl-page",b===c?e:c),d.data("owl-roundPages",a),this.paginationWrapper.append(d));this.checkPagination()},checkPagination:function(){var a=this;if(!1===a.options.pagination)return!1;a.paginationWrapper.find(".owl-page").each(function(){f(this).data("owl-roundPages")=== | ||
+ | f(a.$owlItems[a.currentItem]).data("owl-roundPages")&&(a.paginationWrapper.find(".owl-page").removeClass("active"),f(this).addClass("active"))})},checkNavigation:function(){if(!1===this.options.navigation)return!1;!1===this.options.rewindNav&&(0===this.currentItem&&0===this.maximumItem?(this.buttonPrev.addClass("disabled"),this.buttonNext.addClass("disabled")):0===this.currentItem&&0!==this.maximumItem?(this.buttonPrev.addClass("disabled"),this.buttonNext.removeClass("disabled")):this.currentItem=== | ||
+ | this.maximumItem?(this.buttonPrev.removeClass("disabled"),this.buttonNext.addClass("disabled")):0!==this.currentItem&&this.currentItem!==this.maximumItem&&(this.buttonPrev.removeClass("disabled"),this.buttonNext.removeClass("disabled")))},updateControls:function(){this.updatePagination();this.checkNavigation();this.owlControls&&(this.options.items>=this.itemsAmount?this.owlControls.hide():this.owlControls.show())},destroyControls:function(){this.owlControls&&this.owlControls.remove()},next:function(a){if(this.isTransition)return!1; | ||
+ | this.currentItem+=!0===this.options.scrollPerPage?this.options.items:1;if(this.currentItem>this.maximumItem+(!0===this.options.scrollPerPage?this.options.items-1:0))if(!0===this.options.rewindNav)this.currentItem=0,a="rewind";else return this.currentItem=this.maximumItem,!1;this.goTo(this.currentItem,a)},prev:function(a){if(this.isTransition)return!1;this.currentItem=!0===this.options.scrollPerPage&&0<this.currentItem&&this.currentItem<this.options.items?0:this.currentItem-(!0===this.options.scrollPerPage? | ||
+ | this.options.items:1);if(0>this.currentItem)if(!0===this.options.rewindNav)this.currentItem=this.maximumItem,a="rewind";else return this.currentItem=0,!1;this.goTo(this.currentItem,a)},goTo:function(a,b,e){var c=this;if(c.isTransition)return!1;"function"===typeof c.options.beforeMove&&c.options.beforeMove.apply(this,[c.$elem]);a>=c.maximumItem?a=c.maximumItem:0>=a&&(a=0);c.currentItem=c.owl.currentItem=a;if(!1!==c.options.transitionStyle&&"drag"!==e&&1===c.options.items&&!0===c.browser.support3d)return c.swapSpeed(0), | ||
+ | !0===c.browser.support3d?c.transition3d(c.positionsInArray[a]):c.css2slide(c.positionsInArray[a],1),c.afterGo(),c.singleItemTransition(),!1;a=c.positionsInArray[a];!0===c.browser.support3d?(c.isCss3Finish=!1,!0===b?(c.swapSpeed("paginationSpeed"),g.setTimeout(function(){c.isCss3Finish=!0},c.options.paginationSpeed)):"rewind"===b?(c.swapSpeed(c.options.rewindSpeed),g.setTimeout(function(){c.isCss3Finish=!0},c.options.rewindSpeed)):(c.swapSpeed("slideSpeed"),g.setTimeout(function(){c.isCss3Finish=!0}, | ||
+ | c.options.slideSpeed)),c.transition3d(a)):!0===b?c.css2slide(a,c.options.paginationSpeed):"rewind"===b?c.css2slide(a,c.options.rewindSpeed):c.css2slide(a,c.options.slideSpeed);c.afterGo()},jumpTo:function(a){"function"===typeof this.options.beforeMove&&this.options.beforeMove.apply(this,[this.$elem]);a>=this.maximumItem||-1===a?a=this.maximumItem:0>=a&&(a=0);this.swapSpeed(0);!0===this.browser.support3d?this.transition3d(this.positionsInArray[a]):this.css2slide(this.positionsInArray[a],1);this.currentItem= | ||
+ | this.owl.currentItem=a;this.afterGo()},afterGo:function(){this.prevArr.push(this.currentItem);this.prevItem=this.owl.prevItem=this.prevArr[this.prevArr.length-2];this.prevArr.shift(0);this.prevItem!==this.currentItem&&(this.checkPagination(),this.checkNavigation(),this.eachMoveUpdate(),!1!==this.options.autoPlay&&this.checkAp());"function"===typeof this.options.afterMove&&this.prevItem!==this.currentItem&&this.options.afterMove.apply(this,[this.$elem])},stop:function(){this.apStatus="stop";g.clearInterval(this.autoPlayInterval)}, | ||
+ | checkAp:function(){"stop"!==this.apStatus&&this.play()},play:function(){var a=this;a.apStatus="play";if(!1===a.options.autoPlay)return!1;g.clearInterval(a.autoPlayInterval);a.autoPlayInterval=g.setInterval(function(){a.next(!0)},a.options.autoPlay)},swapSpeed:function(a){"slideSpeed"===a?this.$owlWrapper.css(this.addCssSpeed(this.options.slideSpeed)):"paginationSpeed"===a?this.$owlWrapper.css(this.addCssSpeed(this.options.paginationSpeed)):"string"!==typeof a&&this.$owlWrapper.css(this.addCssSpeed(a))}, | ||
+ | addCssSpeed:function(a){return{"-webkit-transition":"all "+a+"ms ease","-moz-transition":"all "+a+"ms ease","-o-transition":"all "+a+"ms ease",transition:"all "+a+"ms ease"}},removeTransition:function(){return{"-webkit-transition":"","-moz-transition":"","-o-transition":"",transition:""}},doTranslate:function(a){return{"-webkit-transform":"translate3d("+a+"px, 0px, 0px)","-moz-transform":"translate3d("+a+"px, 0px, 0px)","-o-transform":"translate3d("+a+"px, 0px, 0px)","-ms-transform":"translate3d("+ | ||
+ | a+"px, 0px, 0px)",transform:"translate3d("+a+"px, 0px,0px)"}},transition3d:function(a){this.$owlWrapper.css(this.doTranslate(a))},css2move:function(a){this.$owlWrapper.css({left:a})},css2slide:function(a,b){var e=this;e.isCssFinish=!1;e.$owlWrapper.stop(!0,!0).animate({left:a},{duration:b||e.options.slideSpeed,complete:function(){e.isCssFinish=!0}})},checkBrowser:function(){var a=k.createElement("div");a.style.cssText=" -moz-transform:translate3d(0px, 0px, 0px); -ms-transform:translate3d(0px, 0px, 0px); -o-transform:translate3d(0px, 0px, 0px); -webkit-transform:translate3d(0px, 0px, 0px); transform:translate3d(0px, 0px, 0px)"; | ||
+ | a=a.style.cssText.match(/translate3d\(0px, 0px, 0px\)/g);this.browser={support3d:null!==a&&1===a.length,isTouch:"ontouchstart"in g||g.navigator.msMaxTouchPoints}},moveEvents:function(){if(!1!==this.options.mouseDrag||!1!==this.options.touchDrag)this.gestures(),this.disabledEvents()},eventTypes:function(){var a=["s","e","x"];this.ev_types={};!0===this.options.mouseDrag&&!0===this.options.touchDrag?a=["touchstart.owl mousedown.owl","touchmove.owl mousemove.owl","touchend.owl touchcancel.owl mouseup.owl"]: | ||
+ | !1===this.options.mouseDrag&&!0===this.options.touchDrag?a=["touchstart.owl","touchmove.owl","touchend.owl touchcancel.owl"]:!0===this.options.mouseDrag&&!1===this.options.touchDrag&&(a=["mousedown.owl","mousemove.owl","mouseup.owl"]);this.ev_types.start=a[0];this.ev_types.move=a[1];this.ev_types.end=a[2]},disabledEvents:function(){this.$elem.on("dragstart.owl",function(a){a.preventDefault()});this.$elem.on("mousedown.disableTextSelect",function(a){return f(a.target).is("input, textarea, select, option")})}, | ||
+ | gestures:function(){function a(a){if(void 0!==a.touches)return{x:a.touches[0].pageX,y:a.touches[0].pageY};if(void 0===a.touches){if(void 0!==a.pageX)return{x:a.pageX,y:a.pageY};if(void 0===a.pageX)return{x:a.clientX,y:a.clientY}}}function b(a){"on"===a?(f(k).on(d.ev_types.move,e),f(k).on(d.ev_types.end,c)):"off"===a&&(f(k).off(d.ev_types.move),f(k).off(d.ev_types.end))}function e(b){b=b.originalEvent||b||g.event;d.newPosX=a(b).x-h.offsetX;d.newPosY=a(b).y-h.offsetY;d.newRelativeX=d.newPosX-h.relativePos; | ||
+ | "function"===typeof d.options.startDragging&&!0!==h.dragging&&0!==d.newRelativeX&&(h.dragging=!0,d.options.startDragging.apply(d,[d.$elem]));(8<d.newRelativeX||-8>d.newRelativeX)&&!0===d.browser.isTouch&&(void 0!==b.preventDefault?b.preventDefault():b.returnValue=!1,h.sliding=!0);(10<d.newPosY||-10>d.newPosY)&&!1===h.sliding&&f(k).off("touchmove.owl");d.newPosX=Math.max(Math.min(d.newPosX,d.newRelativeX/5),d.maximumPixels+d.newRelativeX/5);!0===d.browser.support3d?d.transition3d(d.newPosX):d.css2move(d.newPosX)} | ||
+ | function c(a){a=a.originalEvent||a||g.event;var c;a.target=a.target||a.srcElement;h.dragging=!1;!0!==d.browser.isTouch&&d.$owlWrapper.removeClass("grabbing");d.dragDirection=0>d.newRelativeX?d.owl.dragDirection="left":d.owl.dragDirection="right";0!==d.newRelativeX&&(c=d.getNewPosition(),d.goTo(c,!1,"drag"),h.targetElement===a.target&&!0!==d.browser.isTouch&&(f(a.target).on("click.disable",function(a){a.stopImmediatePropagation();a.stopPropagation();a.preventDefault();f(a.target).off("click.disable")}), | ||
+ | a=f._data(a.target,"events").click,c=a.pop(),a.splice(0,0,c)));b("off")}var d=this,h={offsetX:0,offsetY:0,baseElWidth:0,relativePos:0,position:null,minSwipe:null,maxSwipe:null,sliding:null,dargging:null,targetElement:null};d.isCssFinish=!0;d.$elem.on(d.ev_types.start,".owl-wrapper",function(c){c=c.originalEvent||c||g.event;var e;if(3===c.which)return!1;if(!(d.itemsAmount<=d.options.items)){if(!1===d.isCssFinish&&!d.options.dragBeforeAnimFinish||!1===d.isCss3Finish&&!d.options.dragBeforeAnimFinish)return!1; | ||
+ | !1!==d.options.autoPlay&&g.clearInterval(d.autoPlayInterval);!0===d.browser.isTouch||d.$owlWrapper.hasClass("grabbing")||d.$owlWrapper.addClass("grabbing");d.newPosX=0;d.newRelativeX=0;f(this).css(d.removeTransition());e=f(this).position();h.relativePos=e.left;h.offsetX=a(c).x-e.left;h.offsetY=a(c).y-e.top;b("on");h.sliding=!1;h.targetElement=c.target||c.srcElement}})},getNewPosition:function(){var a=this.closestItem();a>this.maximumItem?a=this.currentItem=this.maximumItem:0<=this.newPosX&&(this.currentItem= | ||
+ | a=0);return a},closestItem:function(){var a=this,b=!0===a.options.scrollPerPage?a.pagesInArray:a.positionsInArray,e=a.newPosX,c=null;f.each(b,function(d,g){e-a.itemWidth/20>b[d+1]&&e-a.itemWidth/20<g&&"left"===a.moveDirection()?(c=g,a.currentItem=!0===a.options.scrollPerPage?f.inArray(c,a.positionsInArray):d):e+a.itemWidth/20<g&&e+a.itemWidth/20>(b[d+1]||b[d]-a.itemWidth)&&"right"===a.moveDirection()&&(!0===a.options.scrollPerPage?(c=b[d+1]||b[b.length-1],a.currentItem=f.inArray(c,a.positionsInArray)): | ||
+ | (c=b[d+1],a.currentItem=d+1))});return a.currentItem},moveDirection:function(){var a;0>this.newRelativeX?(a="right",this.playDirection="next"):(a="left",this.playDirection="prev");return a},customEvents:function(){var a=this;a.$elem.on("owl.next",function(){a.next()});a.$elem.on("owl.prev",function(){a.prev()});a.$elem.on("owl.play",function(b,e){a.options.autoPlay=e;a.play();a.hoverStatus="play"});a.$elem.on("owl.stop",function(){a.stop();a.hoverStatus="stop"});a.$elem.on("owl.goTo",function(b,e){a.goTo(e)}); | ||
+ | a.$elem.on("owl.jumpTo",function(b,e){a.jumpTo(e)})},stopOnHover:function(){var a=this;!0===a.options.stopOnHover&&!0!==a.browser.isTouch&&!1!==a.options.autoPlay&&(a.$elem.on("mouseover",function(){a.stop()}),a.$elem.on("mouseout",function(){"stop"!==a.hoverStatus&&a.play()}))},lazyLoad:function(){var a,b,e,c,d;if(!1===this.options.lazyLoad)return!1;for(a=0;a<this.itemsAmount;a+=1)b=f(this.$owlItems[a]),"loaded"!==b.data("owl-loaded")&&(e=b.data("owl-item"),c=b.find(".lazyOwl"),"string"!==typeof c.data("src")? | ||
+ | b.data("owl-loaded","loaded"):(void 0===b.data("owl-loaded")&&(c.hide(),b.addClass("loading").data("owl-loaded","checked")),(d=!0===this.options.lazyFollow?e>=this.currentItem:!0)&&e<this.currentItem+this.options.items&&c.length&&this.lazyPreload(b,c)))},lazyPreload:function(a,b){function e(){a.data("owl-loaded","loaded").removeClass("loading");b.removeAttr("data-src");"fade"===d.options.lazyEffect?b.fadeIn(400):b.show();"function"===typeof d.options.afterLazyLoad&&d.options.afterLazyLoad.apply(this, | ||
+ | [d.$elem])}function c(){f+=1;d.completeImg(b.get(0))||!0===k?e():100>=f?g.setTimeout(c,100):e()}var d=this,f=0,k;"DIV"===b.prop("tagName")?(b.css("background-image","url("+b.data("src")+")"),k=!0):b[0].src=b.data("src");c()},autoHeight:function(){function a(){var a=f(e.$owlItems[e.currentItem]).height();e.wrapperOuter.css("height",a+"px");e.wrapperOuter.hasClass("autoHeight")||g.setTimeout(function(){e.wrapperOuter.addClass("autoHeight")},0)}function b(){d+=1;e.completeImg(c.get(0))?a():100>=d?g.setTimeout(b, | ||
+ | 100):e.wrapperOuter.css("height","")}var e=this,c=f(e.$owlItems[e.currentItem]).find("img"),d;void 0!==c.get(0)?(d=0,b()):a()},completeImg:function(a){return!a.complete||"undefined"!==typeof a.naturalWidth&&0===a.naturalWidth?!1:!0},onVisibleItems:function(){var a;!0===this.options.addClassActive&&this.$owlItems.removeClass("active");this.visibleItems=[];for(a=this.currentItem;a<this.currentItem+this.options.items;a+=1)this.visibleItems.push(a),!0===this.options.addClassActive&&f(this.$owlItems[a]).addClass("active"); | ||
+ | this.owl.visibleItems=this.visibleItems},transitionTypes:function(a){this.outClass="owl-"+a+"-out";this.inClass="owl-"+a+"-in"},singleItemTransition:function(){var a=this,b=a.outClass,e=a.inClass,c=a.$owlItems.eq(a.currentItem),d=a.$owlItems.eq(a.prevItem),f=Math.abs(a.positionsInArray[a.currentItem])+a.positionsInArray[a.prevItem],g=Math.abs(a.positionsInArray[a.currentItem])+a.itemWidth/2;a.isTransition=!0;a.$owlWrapper.addClass("owl-origin").css({"-webkit-transform-origin":g+"px","-moz-perspective-origin":g+ | ||
+ | "px","perspective-origin":g+"px"});d.css({position:"relative",left:f+"px"}).addClass(b).on("webkitAnimationEnd oAnimationEnd MSAnimationEnd animationend",function(){a.endPrev=!0;d.off("webkitAnimationEnd oAnimationEnd MSAnimationEnd animationend");a.clearTransStyle(d,b)});c.addClass(e).on("webkitAnimationEnd oAnimationEnd MSAnimationEnd animationend",function(){a.endCurrent=!0;c.off("webkitAnimationEnd oAnimationEnd MSAnimationEnd animationend");a.clearTransStyle(c,e)})},clearTransStyle:function(a, | ||
+ | b){a.css({position:"",left:""}).removeClass(b);this.endPrev&&this.endCurrent&&(this.$owlWrapper.removeClass("owl-origin"),this.isTransition=this.endCurrent=this.endPrev=!1)},owlStatus:function(){this.owl={userOptions:this.userOptions,baseElement:this.$elem,userItems:this.$userItems,owlItems:this.$owlItems,currentItem:this.currentItem,prevItem:this.prevItem,visibleItems:this.visibleItems,isTouch:this.browser.isTouch,browser:this.browser,dragDirection:this.dragDirection}},clearEvents:function(){this.$elem.off(".owl owl mousedown.disableTextSelect"); | ||
+ | f(k).off(".owl owl");f(g).off("resize",this.resizer)},unWrap:function(){0!==this.$elem.children().length&&(this.$owlWrapper.unwrap(),this.$userItems.unwrap().unwrap(),this.owlControls&&this.owlControls.remove());this.clearEvents();this.$elem.attr("style",this.$elem.data("owl-originalStyles")||"").attr("class",this.$elem.data("owl-originalClasses"))},destroy:function(){this.stop();g.clearInterval(this.checkVisible);this.unWrap();this.$elem.removeData()},reinit:function(a){a=f.extend({},this.userOptions, | ||
+ | a);this.unWrap();this.init(a,this.$elem)},addItem:function(a,b){var e;if(!a)return!1;if(0===this.$elem.children().length)return this.$elem.append(a),this.setVars(),!1;this.unWrap();e=void 0===b||-1===b?-1:b;e>=this.$userItems.length||-1===e?this.$userItems.eq(-1).after(a):this.$userItems.eq(e).before(a);this.setVars()},removeItem:function(a){if(0===this.$elem.children().length)return!1;a=void 0===a||-1===a?-1:a;this.unWrap();this.$userItems.eq(a).remove();this.setVars()}};f.fn.owlCarousel=function(a){return this.each(function(){if(!0=== | ||
+ | f(this).data("owl-init"))return!1;f(this).data("owl-init",!0);var b=Object.create(l);b.init(a,this);f.data(this,"owlCarousel",b)})};f.fn.owlCarousel.options={items:5,itemsCustom:!1,itemsDesktop:[1199,4],itemsDesktopSmall:[979,3],itemsTablet:[768,2],itemsTabletSmall:!1,itemsMobile:[479,1],singleItem:!1,itemsScaleUp:!1,slideSpeed:200,paginationSpeed:800,rewindSpeed:1E3,autoPlay:!1,stopOnHover:!1,navigation:!1,navigationText:["prev","next"],rewindNav:!0,scrollPerPage:!1,pagination:!0,paginationNumbers:!1, | ||
+ | responsive:!0,responsiveRefreshRate:200,responsiveBaseWidth:g,baseClass:"owl-carousel",theme:"owl-theme",lazyLoad:!1,lazyFollow:!0,lazyEffect:"fade",autoHeight:!1,jsonPath:!1,jsonSuccess:!1,dragBeforeAnimFinish:!0,mouseDrag:!0,touchDrag:!0,addClassActive:!1,transitionStyle:!1,beforeUpdate:!1,afterUpdate:!1,beforeInit:!1,afterInit:!1,beforeMove:!1,afterMove:!1,afterAction:!1,startDragging:!1,afterLazyLoad:!1}})(jQuery,window,document); | ||
+ | </script> | ||
+ | |||
+ | <script type="text/javascript"> | ||
+ | /*! | ||
+ | * Retina.js v1.1.0 | ||
+ | * | ||
+ | * Copyright 2013 Imulus, LLC | ||
+ | * Released under the MIT license | ||
+ | * | ||
+ | * Retina.js is an open source script that makes it easy to serve | ||
+ | * high-resolution images to devices with retina displays. | ||
+ | */ | ||
+ | (function(){var root=typeof exports=="undefined"?window:exports;var config={check_mime_type:true};root.Retina=Retina;function Retina(){}Retina.configure=function(options){if(options==null)options={};for(var prop in options)config[prop]=options[prop]};Retina.init=function(context){if(context==null)context=root;var existing_onload=context.onload||new Function;context.onload=function(){var images=document.getElementsByTagName("img"),retinaImages=[],i,image;for(i=0;i<images.length;i++){image=images[i];retinaImages.push(new RetinaImage(image))}existing_onload()}};Retina.isRetina=function(){var mediaQuery="(-webkit-min-device-pixel-ratio: 1.5), (min--moz-device-pixel-ratio: 1.5), (-o-min-device-pixel-ratio: 3/2), (min-resolution: 1.5dppx)";if(root.devicePixelRatio>1)return true;if(root.matchMedia&&root.matchMedia(mediaQuery).matches)return true;return false};root.RetinaImagePath=RetinaImagePath;function RetinaImagePath(path,at_2x_path){this.path=path;if(typeof at_2x_path!=="undefined"&&at_2x_path!==null){this.at_2x_path=at_2x_path;this.perform_check=false}else{this.at_2x_path=path.replace(/\.\w+$/,function(match){return"@2x"+match});this.perform_check=true}}RetinaImagePath.confirmed_paths=[];RetinaImagePath.prototype.is_external=function(){return!!(this.path.match(/^https?\:/i)&&!this.path.match("//"+document.domain))};RetinaImagePath.prototype.check_2x_variant=function(callback){var http,that=this;if(this.is_external()){return callback(false)}else if(!this.perform_check&&typeof this.at_2x_path!=="undefined"&&this.at_2x_path!==null){return callback(true)}else if(this.at_2x_path in RetinaImagePath.confirmed_paths){return callback(true)}else{http=new XMLHttpRequest;http.open("HEAD",this.at_2x_path);http.onreadystatechange=function(){if(http.readyState!=4){return callback(false)}if(http.status>=200&&http.status<=399){if(config.check_mime_type){var type=http.getResponseHeader("Content-Type");if(type==null||!type.match(/^image/i)){return callback(false)}}RetinaImagePath.confirmed_paths.push(that.at_2x_path);return callback(true)}else{return callback(false)}};http.send()}};function RetinaImage(el){this.el=el;this.path=new RetinaImagePath(this.el.getAttribute("src"),this.el.getAttribute("data-at2x"));var that=this;this.path.check_2x_variant(function(hasVariant){if(hasVariant)that.swap()})}root.RetinaImage=RetinaImage;RetinaImage.prototype.swap=function(path){if(typeof path=="undefined")path=this.path.at_2x_path;var that=this;function load(){if(!that.el.complete){setTimeout(load,5)}else{that.el.setAttribute("width",that.el.offsetWidth);that.el.setAttribute("height",that.el.offsetHeight);that.el.setAttribute("src",path)}}load()};if(Retina.isRetina()){Retina.init(root)}})(); | ||
+ | </script> | ||
+ | |||
+ | <script type="text/javascript"> | ||
+ | /* Style Switcher */ | ||
+ | |||
+ | window.console = window.console || (function($){ | ||
+ | var c = {}; c.log = c.warn = c.debug = c.info = c.error = c.time = c.dir = c.profile = c.clear = c.exception = c.trace = c.assert = function(){}; | ||
+ | return c; | ||
+ | })(); | ||
+ | |||
+ | $(document).ready(function($){ | ||
+ | |||
+ | var styleswitcherstr = ' \ | ||
+ | <h2>Style Switcher <a href="#"></a></h2> \ | ||
+ | <div class="content"> \ | ||
+ | <h3>Layout Style</h3> \ | ||
+ | <div class="layout-switcher"> \ | ||
+ | <a id="wide" class="layout">Wide</a> \ | ||
+ | <a id="boxed" class="layout">boxed</a> \ | ||
+ | </div> \ | ||
+ | \ | ||
+ | <div class="clear"></div> \ | ||
+ | <div class="switcher-box"> \ | ||
+ | <h3>Change Color</h3> \ | ||
+ | <a id="default" class="styleswitch color"></a> \ | ||
+ | <a id="Strongcyan" class="styleswitch color"></a> \ | ||
+ | <a id="DarkCyan" class="styleswitch color"></a> \ | ||
+ | <a id="blue" class="styleswitch color"></a> \ | ||
+ | <a id="orange" class="styleswitch color"></a> \ | ||
+ | <a id="green" class="styleswitch color"></a> \ | ||
+ | <a id="Softred" class="styleswitch color"></a> \ | ||
+ | </div><!-- End switcher-box --> \ | ||
+ | <div class="bg hidden"> \ | ||
+ | <h3>BG Pattern</h3> \ | ||
+ | <a id="wood" class="pattern"></a> \ | ||
+ | <a id="crossed" class="pattern"></a> \ | ||
+ | <a id="fabric" class="pattern"></a> \ | ||
+ | <a id="linen" class="pattern"></a> \ | ||
+ | <a id="diagmonds" class="pattern"></a> \ | ||
+ | <a id="triangles" class="pattern"></a> \ | ||
+ | <a id="black_thread" class="pattern"></a> \ | ||
+ | <a id="checkered_pattern" class="pattern"></a> \ | ||
+ | <a id="black_mamba" class="pattern"></a> \ | ||
+ | <a id="back_pattern" class="pattern"></a> \ | ||
+ | <a id="vichy" class="pattern"></a> \ | ||
+ | <a id="diamond_upholstery" class="pattern"></a> \ | ||
+ | <a id="lyonnette" class="pattern"></a> \ | ||
+ | <a id="graphy" class="pattern"></a> \ | ||
+ | <a id="subtlenet2" class="pattern"></a> \ | ||
+ | </div> \ | ||
+ | \ | ||
+ | <div class="clear"></div> \ | ||
+ | </div><!-- End content --> \ | ||
+ | '; | ||
+ | |||
+ | $(".switcher").prepend( styleswitcherstr ); | ||
+ | |||
+ | }); | ||
+ | |||
+ | /* boxed & wide syle */ | ||
+ | $(document).ready(function(){ | ||
+ | |||
+ | var cookieName = 'wide'; | ||
+ | |||
+ | function changeLayout(layout) { | ||
+ | $.cookie(cookieName, layout); | ||
+ | $('head link[data-name=layout]').attr('href', 'css/layout/' + layout + '.css'); | ||
+ | } | ||
+ | |||
+ | if( $.cookie(cookieName)) { | ||
+ | changeLayout($.cookie(cookieName)); | ||
+ | } | ||
+ | |||
+ | $("#wide").click( function(){ $ | ||
+ | changeLayout('wide'); | ||
+ | location.reload(); | ||
+ | }); | ||
+ | |||
+ | $("#boxed").click( function(){ $ | ||
+ | changeLayout('boxed'); | ||
+ | location.reload(); | ||
+ | }); | ||
+ | |||
+ | }); | ||
+ | |||
+ | |||
+ | /* background images */ | ||
+ | $(document).ready(function(){ | ||
+ | |||
+ | var startClass = $.cookie('mycookie'); | ||
+ | $("body").addClass("wood"); | ||
+ | |||
+ | /* crossed */ | ||
+ | $("#crossed").click( function(){ | ||
+ | $("body").removeClass('wood'); | ||
+ | $("body").removeClass('fabric'); | ||
+ | $("body").removeClass('linen'); | ||
+ | $("body").removeClass('diagmonds'); | ||
+ | $("body").removeClass('triangles'); | ||
+ | $("body").removeClass('black_mamba'); | ||
+ | $("body").removeClass('vichy'); | ||
+ | $("body").removeClass('back_pattern'); | ||
+ | $("body").removeClass('checkered_pattern'); | ||
+ | $("body").removeClass('diamond_upholstery'); | ||
+ | $("body").removeClass('lyonnette'); | ||
+ | $("body").removeClass('graphy'); | ||
+ | $("body").removeClass('black_thread'); | ||
+ | $("body").removeClass('subtlenet2'); | ||
+ | $("body").addClass('crossed'); | ||
+ | $.cookie('mycookie','crossed'); | ||
+ | }); | ||
+ | |||
+ | /* fabric */ | ||
+ | $("#fabric").click( function(){ | ||
+ | $("body").removeClass('crossed'); | ||
+ | $("body").removeClass('linen'); | ||
+ | $("body").removeClass('wood'); | ||
+ | $("body").removeClass('diagmonds'); | ||
+ | $("body").removeClass('triangles'); | ||
+ | $("body").removeClass('black_mamba'); | ||
+ | $("body").removeClass('vichy'); | ||
+ | $("body").removeClass('back_pattern'); | ||
+ | $("body").removeClass('checkered_pattern'); | ||
+ | $("body").removeClass('diamond_upholstery'); | ||
+ | $("body").removeClass('lyonnette'); | ||
+ | $("body").removeClass('graphy'); | ||
+ | $("body").removeClass('black_thread'); | ||
+ | $("body").removeClass('subtlenet2'); | ||
+ | $("body").addClass('fabric'); | ||
+ | $.cookie('mycookie','fabric'); | ||
+ | }); | ||
+ | |||
+ | /* linen */ | ||
+ | $("#linen").click( function(){ | ||
+ | $("body").removeClass('crossed'); | ||
+ | $("body").removeClass('fabric'); | ||
+ | $("body").removeClass('wood'); | ||
+ | $("body").removeClass('diagmonds'); | ||
+ | $("body").removeClass('triangles'); | ||
+ | $("body").removeClass('black_mamba'); | ||
+ | $("body").removeClass('vichy'); | ||
+ | $("body").removeClass('back_pattern'); | ||
+ | $("body").removeClass('checkered_pattern'); | ||
+ | $("body").removeClass('diamond_upholstery'); | ||
+ | $("body").removeClass('lyonnette'); | ||
+ | $("body").removeClass('graphy'); | ||
+ | $("body").removeClass('black_thread'); | ||
+ | $("body").removeClass('subtlenet2'); | ||
+ | $("body").addClass('linen'); | ||
+ | $.cookie('mycookie','linen'); | ||
+ | }); | ||
+ | |||
+ | /* wood */ | ||
+ | $("#wood").click( function(){ | ||
+ | $("body").removeClass('crossed'); | ||
+ | $("body").removeClass('fabric'); | ||
+ | $("body").removeClass('linen'); | ||
+ | $("body").removeClass('diagmonds'); | ||
+ | $("body").removeClass('triangles'); | ||
+ | $("body").removeClass('black_mamba'); | ||
+ | $("body").removeClass('vichy'); | ||
+ | $("body").removeClass('back_pattern'); | ||
+ | $("body").removeClass('checkered_pattern'); | ||
+ | $("body").removeClass('diamond_upholstery'); | ||
+ | $("body").removeClass('lyonnette'); | ||
+ | $("body").removeClass('graphy'); | ||
+ | $("body").removeClass('black_thread'); | ||
+ | $("body").removeClass('subtlenet2'); | ||
+ | $("body").addClass('wood'); | ||
+ | $.cookie('mycookie','wood'); | ||
+ | }); | ||
+ | |||
+ | /* diagmonds */ | ||
+ | $("#diagmonds").click( function(){ | ||
+ | $("body").removeClass('crossed'); | ||
+ | $("body").removeClass('fabric'); | ||
+ | $("body").removeClass('linen'); | ||
+ | $("body").removeClass('wood'); | ||
+ | $("body").removeClass('triangles'); | ||
+ | $("body").removeClass('black_mamba'); | ||
+ | $("body").removeClass('vichy'); | ||
+ | $("body").removeClass('back_pattern'); | ||
+ | $("body").removeClass('checkered_pattern'); | ||
+ | $("body").removeClass('diamond_upholstery'); | ||
+ | $("body").removeClass('lyonnette'); | ||
+ | $("body").removeClass('graphy'); | ||
+ | $("body").removeClass('black_thread'); | ||
+ | $("body").removeClass('subtlenet2'); | ||
+ | $("body").addClass('diagmonds'); | ||
+ | $.cookie('mycookie','diagmonds'); | ||
+ | }); | ||
+ | |||
+ | /* triangles */ | ||
+ | $("#triangles").click( function(){ | ||
+ | $("body").removeClass('crossed'); | ||
+ | $("body").removeClass('fabric'); | ||
+ | $("body").removeClass('linen'); | ||
+ | $("body").removeClass('wood'); | ||
+ | $("body").removeClass('diagmonds'); | ||
+ | $("body").removeClass('black_mamba'); | ||
+ | $("body").removeClass('vichy'); | ||
+ | $("body").removeClass('back_pattern'); | ||
+ | $("body").removeClass('checkered_pattern'); | ||
+ | $("body").removeClass('diamond_upholstery'); | ||
+ | $("body").removeClass('lyonnette'); | ||
+ | $("body").removeClass('graphy'); | ||
+ | $("body").removeClass('black_thread'); | ||
+ | $("body").removeClass('subtlenet2'); | ||
+ | $("body").addClass('triangles'); | ||
+ | $.cookie('mycookie','triangles'); | ||
+ | }); | ||
+ | |||
+ | /* triangles */ | ||
+ | $("#black_mamba").click( function(){ | ||
+ | $("body").removeClass('crossed'); | ||
+ | $("body").removeClass('fabric'); | ||
+ | $("body").removeClass('linen'); | ||
+ | $("body").removeClass('wood'); | ||
+ | $("body").removeClass('diagmonds'); | ||
+ | $("body").removeClass('triangles'); | ||
+ | $("body").removeClass('vichy'); | ||
+ | $("body").removeClass('back_pattern'); | ||
+ | $("body").removeClass('checkered_pattern'); | ||
+ | $("body").removeClass('diamond_upholstery'); | ||
+ | $("body").removeClass('lyonnette'); | ||
+ | $("body").removeClass('graphy'); | ||
+ | $("body").removeClass('black_thread'); | ||
+ | $("body").removeClass('subtlenet2'); | ||
+ | $("body").addClass('black_mamba'); | ||
+ | $.cookie('mycookie','black_mamba'); | ||
+ | }); | ||
+ | |||
+ | /* vichy */ | ||
+ | $("#vichy").click( function(){ | ||
+ | $("body").removeClass('crossed'); | ||
+ | $("body").removeClass('fabric'); | ||
+ | $("body").removeClass('linen'); | ||
+ | $("body").removeClass('wood'); | ||
+ | $("body").removeClass('diagmonds'); | ||
+ | $("body").removeClass('triangles'); | ||
+ | $("body").removeClass('black_mamba'); | ||
+ | $("body").removeClass('back_pattern'); | ||
+ | $("body").removeClass('checkered_pattern'); | ||
+ | $("body").removeClass('diamond_upholstery'); | ||
+ | $("body").removeClass('lyonnette'); | ||
+ | $("body").removeClass('graphy'); | ||
+ | $("body").removeClass('black_thread'); | ||
+ | $("body").removeClass('subtlenet2'); | ||
+ | $("body").addClass('vichy'); | ||
+ | $.cookie('mycookie','vichy'); | ||
+ | }); | ||
+ | |||
+ | /* back_pattern */ | ||
+ | $("#back_pattern").click( function(){ | ||
+ | $("body").removeClass('crossed'); | ||
+ | $("body").removeClass('fabric'); | ||
+ | $("body").removeClass('linen'); | ||
+ | $("body").removeClass('wood'); | ||
+ | $("body").removeClass('diagmonds'); | ||
+ | $("body").removeClass('triangles'); | ||
+ | $("body").removeClass('black_mamba'); | ||
+ | $("body").removeClass('vichy'); | ||
+ | $("body").removeClass('checkered_pattern'); | ||
+ | $("body").removeClass('diamond_upholstery'); | ||
+ | $("body").removeClass('lyonnette'); | ||
+ | $("body").removeClass('graphy'); | ||
+ | $("body").removeClass('black_thread'); | ||
+ | $("body").removeClass('subtlenet2'); | ||
+ | $("body").addClass('back_pattern'); | ||
+ | $.cookie('mycookie','back_pattern'); | ||
+ | }); | ||
+ | |||
+ | /* checkered_pattern */ | ||
+ | $("#checkered_pattern").click( function(){ | ||
+ | $("body").removeClass('crossed'); | ||
+ | $("body").removeClass('fabric'); | ||
+ | $("body").removeClass('linen'); | ||
+ | $("body").removeClass('wood'); | ||
+ | $("body").removeClass('diagmonds'); | ||
+ | $("body").removeClass('triangles'); | ||
+ | $("body").removeClass('black_mamba'); | ||
+ | $("body").removeClass('vichy'); | ||
+ | $("body").removeClass('back_pattern'); | ||
+ | $("body").removeClass('diamond_upholstery'); | ||
+ | $("body").removeClass('lyonnette'); | ||
+ | $("body").removeClass('graphy'); | ||
+ | $("body").removeClass('black_thread'); | ||
+ | $("body").removeClass('subtlenet2'); | ||
+ | $("body").addClass('checkered_pattern'); | ||
+ | $.cookie('mycookie','checkered_pattern'); | ||
+ | }); | ||
+ | |||
+ | /* diamond_upholstery */ | ||
+ | $("#diamond_upholstery").click( function(){ | ||
+ | $("body").removeClass('crossed'); | ||
+ | $("body").removeClass('fabric'); | ||
+ | $("body").removeClass('linen'); | ||
+ | $("body").removeClass('wood'); | ||
+ | $("body").removeClass('diagmonds'); | ||
+ | $("body").removeClass('triangles'); | ||
+ | $("body").removeClass('black_mamba'); | ||
+ | $("body").removeClass('vichy'); | ||
+ | $("body").removeClass('back_pattern'); | ||
+ | $("body").removeClass('checkered_pattern'); | ||
+ | $("body").removeClass('lyonnette'); | ||
+ | $("body").removeClass('graphy'); | ||
+ | $("body").removeClass('black_thread'); | ||
+ | $("body").removeClass('subtlenet2'); | ||
+ | $("body").addClass('diamond_upholstery'); | ||
+ | $.cookie('mycookie','diamond_upholstery'); | ||
+ | }); | ||
+ | |||
+ | /* lyonnette */ | ||
+ | $("#lyonnette").click( function(){ | ||
+ | $("body").removeClass('crossed'); | ||
+ | $("body").removeClass('fabric'); | ||
+ | $("body").removeClass('linen'); | ||
+ | $("body").removeClass('wood'); | ||
+ | $("body").removeClass('diagmonds'); | ||
+ | $("body").removeClass('triangles'); | ||
+ | $("body").removeClass('black_mamba'); | ||
+ | $("body").removeClass('vichy'); | ||
+ | $("body").removeClass('back_pattern'); | ||
+ | $("body").removeClass('checkered_pattern'); | ||
+ | $("body").removeClass('diamond_upholstery'); | ||
+ | $("body").removeClass('graphy'); | ||
+ | $("body").removeClass('black_thread'); | ||
+ | $("body").removeClass('subtlenet2'); | ||
+ | $("body").addClass('lyonnette'); | ||
+ | $.cookie('mycookie','lyonnette'); | ||
+ | }); | ||
+ | |||
+ | /* graphy */ | ||
+ | $("#graphy").click( function(){ | ||
+ | $("body").removeClass('crossed'); | ||
+ | $("body").removeClass('fabric'); | ||
+ | $("body").removeClass('linen'); | ||
+ | $("body").removeClass('wood'); | ||
+ | $("body").removeClass('diagmonds'); | ||
+ | $("body").removeClass('triangles'); | ||
+ | $("body").removeClass('black_mamba'); | ||
+ | $("body").removeClass('vichy'); | ||
+ | $("body").removeClass('back_pattern'); | ||
+ | $("body").removeClass('checkered_pattern'); | ||
+ | $("body").removeClass('diamond_upholstery'); | ||
+ | $("body").removeClass('lyonnette'); | ||
+ | $("body").removeClass('black_thread'); | ||
+ | $("body").removeClass('subtlenet2'); | ||
+ | $("body").addClass('graphy'); | ||
+ | $.cookie('mycookie','graphy'); | ||
+ | }); | ||
+ | |||
+ | /* black_thread */ | ||
+ | $("#black_thread").click( function(){ | ||
+ | $("body").removeClass('crossed'); | ||
+ | $("body").removeClass('fabric'); | ||
+ | $("body").removeClass('linen'); | ||
+ | $("body").removeClass('wood'); | ||
+ | $("body").removeClass('diagmonds'); | ||
+ | $("body").removeClass('triangles'); | ||
+ | $("body").removeClass('black_mamba'); | ||
+ | $("body").removeClass('vichy'); | ||
+ | $("body").removeClass('back_pattern'); | ||
+ | $("body").removeClass('checkered_pattern'); | ||
+ | $("body").removeClass('diamond_upholstery'); | ||
+ | $("body").removeClass('lyonnette'); | ||
+ | $("body").removeClass('graphy'); | ||
+ | $("body").removeClass('subtlenet2'); | ||
+ | $("body").addClass('black_thread'); | ||
+ | $.cookie('mycookie','black_thread'); | ||
+ | }); | ||
+ | |||
+ | /* subtlenet2 */ | ||
+ | $("#subtlenet2").click( function(){ | ||
+ | $("body").removeClass('crossed'); | ||
+ | $("body").removeClass('fabric'); | ||
+ | $("body").removeClass('linen'); | ||
+ | $("body").removeClass('wood'); | ||
+ | $("body").removeClass('diagmonds'); | ||
+ | $("body").removeClass('triangles'); | ||
+ | $("body").removeClass('black_mamba'); | ||
+ | $("body").removeClass('vichy'); | ||
+ | $("body").removeClass('back_pattern'); | ||
+ | $("body").removeClass('checkered_pattern'); | ||
+ | $("body").removeClass('diamond_upholstery'); | ||
+ | $("body").removeClass('lyonnette'); | ||
+ | $("body").removeClass('graphy'); | ||
+ | $("body").removeClass('black_thread'); | ||
+ | $("body").addClass('subtlenet2'); | ||
+ | $.cookie('mycookie','subtlenet2'); | ||
+ | }); | ||
+ | |||
+ | |||
+ | |||
+ | if ($.cookie('mycookie')) { | ||
+ | $('body').addClass($.cookie('mycookie')); | ||
+ | } | ||
+ | |||
+ | }); | ||
+ | |||
+ | /* Skins Style */ | ||
+ | $(document).ready(function($){ | ||
+ | |||
+ | var cookieName = 'default'; | ||
+ | |||
+ | function changeLayout(layout) { | ||
+ | $.cookie(cookieName, layout); | ||
+ | $('head link[data-name=skins]').attr('href', 'css/skins/' + layout + '.css'); | ||
+ | } | ||
+ | |||
+ | if( $.cookie(cookieName)) { | ||
+ | changeLayout($.cookie(cookieName)); | ||
+ | } | ||
+ | |||
+ | $("#default").click( function(){ $ | ||
+ | changeLayout('default'); | ||
+ | }); | ||
+ | |||
+ | $("#Strongcyan").click( function(){ $ | ||
+ | changeLayout('Strongcyan'); | ||
+ | }); | ||
+ | $("#DarkCyan").click( function(){ $ | ||
+ | changeLayout('DarkCyan'); | ||
+ | }); | ||
+ | $("#asphalt").click( function(){ $ | ||
+ | changeLayout('asphalt'); | ||
+ | }); | ||
+ | $("#blue").click( function(){ $ | ||
+ | changeLayout('blue'); | ||
+ | }); | ||
+ | $("#orange").click( function(){ $ | ||
+ | changeLayout('orange'); | ||
+ | }); | ||
+ | $("#clouds").click( function(){ $ | ||
+ | changeLayout('clouds'); | ||
+ | }); | ||
+ | $("#Softred").click( function(){ $ | ||
+ | changeLayout('Softred'); | ||
+ | }); | ||
+ | $("#green").click( function(){ $ | ||
+ | changeLayout('green'); | ||
+ | }); | ||
+ | $("#orange").click( function(){ $ | ||
+ | changeLayout('orange'); | ||
+ | }); | ||
+ | |||
+ | }); | ||
+ | |||
+ | |||
+ | /* Reset Switcher */ | ||
+ | $(document).ready(function(){ | ||
+ | |||
+ | // Style Switcher | ||
+ | $('.switcher').animate({ | ||
+ | left: '-255px' | ||
+ | }); | ||
+ | |||
+ | $('.switcher h2 a').click(function(e){ | ||
+ | e.preventDefault(); | ||
+ | var div = $('.switcher'); | ||
+ | console.log(div.css('left')); | ||
+ | if (div.css('left') === '-255px') { | ||
+ | $('.switcher').animate({ | ||
+ | left: '0px' | ||
+ | }); | ||
+ | } else { | ||
+ | $('.switcher').animate({ | ||
+ | left: '-255px' | ||
+ | }); | ||
+ | } | ||
+ | }) | ||
+ | }); | ||
+ | |||
+ | |||
+ | </script> | ||
+ | |||
+ | <script type="text/javascript"> | ||
+ | /* | ||
+ | * Swipe 2.0 | ||
+ | * | ||
+ | * Brad Birdsall | ||
+ | * Copyright 2013, MIT License | ||
+ | * | ||
+ | */ | ||
+ | |||
+ | function Swipe(container, options) { | ||
+ | |||
+ | "use strict"; | ||
+ | |||
+ | // utilities | ||
+ | var noop = function() {}; // simple no operation function | ||
+ | var offloadFn = function(fn) { setTimeout(fn || noop, 0) }; // offload a functions execution | ||
+ | |||
+ | // check browser capabilities | ||
+ | var browser = { | ||
+ | addEventListener: !!window.addEventListener, | ||
+ | touch: ('ontouchstart' in window) || window.DocumentTouch && document instanceof DocumentTouch, | ||
+ | transitions: (function(temp) { | ||
+ | var props = ['transitionProperty', 'WebkitTransition', 'MozTransition', 'OTransition', 'msTransition']; | ||
+ | for ( var i in props ) if (temp.style[ props[i] ] !== undefined) return true; | ||
+ | return false; | ||
+ | })(document.createElement('swipe')) | ||
+ | }; | ||
+ | |||
+ | // quit if no root element | ||
+ | if (!container) return; | ||
+ | var element = container.children[0]; | ||
+ | var slides, slidePos, width, length; | ||
+ | options = options || {}; | ||
+ | var index = parseInt(options.startSlide, 10) || 0; | ||
+ | var speed = options.speed || 300; | ||
+ | options.continuous = options.continuous !== undefined ? options.continuous : true; | ||
+ | |||
+ | function setup() { | ||
+ | |||
+ | // cache slides | ||
+ | slides = element.children; | ||
+ | length = slides.length; | ||
+ | |||
+ | // set continuous to false if only one slide | ||
+ | if (slides.length < 2) options.continuous = false; | ||
+ | |||
+ | //special case if two slides | ||
+ | if (browser.transitions && options.continuous && slides.length < 3) { | ||
+ | element.appendChild(slides[0].cloneNode(true)); | ||
+ | element.appendChild(element.children[1].cloneNode(true)); | ||
+ | slides = element.children; | ||
+ | } | ||
+ | |||
+ | // create an array to store current positions of each slide | ||
+ | slidePos = new Array(slides.length); | ||
+ | |||
+ | // determine width of each slide | ||
+ | width = container.getBoundingClientRect().width || container.offsetWidth; | ||
+ | |||
+ | element.style.width = (slides.length * width) + 'px'; | ||
+ | |||
+ | // stack elements | ||
+ | var pos = slides.length; | ||
+ | while(pos--) { | ||
+ | |||
+ | var slide = slides[pos]; | ||
+ | |||
+ | slide.style.width = width + 'px'; | ||
+ | slide.setAttribute('data-index', pos); | ||
+ | |||
+ | if (browser.transitions) { | ||
+ | slide.style.left = (pos * -width) + 'px'; | ||
+ | move(pos, index > pos ? -width : (index < pos ? width : 0), 0); | ||
+ | } | ||
+ | |||
+ | } | ||
+ | |||
+ | // reposition elements before and after index | ||
+ | if (options.continuous && browser.transitions) { | ||
+ | move(circle(index-1), -width, 0); | ||
+ | move(circle(index+1), width, 0); | ||
+ | } | ||
+ | |||
+ | if (!browser.transitions) element.style.left = (index * -width) + 'px'; | ||
+ | |||
+ | container.style.visibility = 'visible'; | ||
+ | |||
+ | } | ||
+ | |||
+ | function prev() { | ||
+ | |||
+ | if (options.continuous) slide(index-1); | ||
+ | else if (index) slide(index-1); | ||
+ | |||
+ | } | ||
+ | |||
+ | function next() { | ||
+ | |||
+ | if (options.continuous) slide(index+1); | ||
+ | else if (index < slides.length - 1) slide(index+1); | ||
+ | |||
+ | } | ||
+ | |||
+ | function circle(index) { | ||
+ | |||
+ | // a simple positive modulo using slides.length | ||
+ | return (slides.length + (index % slides.length)) % slides.length; | ||
+ | |||
+ | } | ||
+ | |||
+ | function slide(to, slideSpeed) { | ||
+ | |||
+ | // do nothing if already on requested slide | ||
+ | if (index == to) return; | ||
+ | |||
+ | if (browser.transitions) { | ||
+ | |||
+ | var direction = Math.abs(index-to) / (index-to); // 1: backward, -1: forward | ||
+ | |||
+ | // get the actual position of the slide | ||
+ | if (options.continuous) { | ||
+ | var natural_direction = direction; | ||
+ | direction = -slidePos[circle(to)] / width; | ||
+ | |||
+ | // if going forward but to < index, use to = slides.length + to | ||
+ | // if going backward but to > index, use to = -slides.length + to | ||
+ | if (direction !== natural_direction) to = -direction * slides.length + to; | ||
+ | |||
+ | } | ||
+ | |||
+ | var diff = Math.abs(index-to) - 1; | ||
+ | |||
+ | // move all the slides between index and to in the right direction | ||
+ | while (diff--) move( circle((to > index ? to : index) - diff - 1), width * direction, 0); | ||
+ | |||
+ | to = circle(to); | ||
+ | |||
+ | move(index, width * direction, slideSpeed || speed); | ||
+ | move(to, 0, slideSpeed || speed); | ||
+ | |||
+ | if (options.continuous) move(circle(to - direction), -(width * direction), 0); // we need to get the next in place | ||
+ | |||
+ | } else { | ||
+ | |||
+ | to = circle(to); | ||
+ | animate(index * -width, to * -width, slideSpeed || speed); | ||
+ | //no fallback for a circular continuous if the browser does not accept transitions | ||
+ | } | ||
+ | |||
+ | index = to; | ||
+ | offloadFn(options.callback && options.callback(index, slides[index])); | ||
+ | } | ||
+ | |||
+ | function move(index, dist, speed) { | ||
+ | |||
+ | translate(index, dist, speed); | ||
+ | slidePos[index] = dist; | ||
+ | |||
+ | } | ||
+ | |||
+ | function translate(index, dist, speed) { | ||
+ | |||
+ | var slide = slides[index]; | ||
+ | var style = slide && slide.style; | ||
+ | |||
+ | if (!style) return; | ||
+ | |||
+ | style.webkitTransitionDuration = | ||
+ | style.MozTransitionDuration = | ||
+ | style.msTransitionDuration = | ||
+ | style.OTransitionDuration = | ||
+ | style.transitionDuration = speed + 'ms'; | ||
+ | |||
+ | style.webkitTransform = 'translate(' + dist + 'px,0)' + 'translateZ(0)'; | ||
+ | style.msTransform = | ||
+ | style.MozTransform = | ||
+ | style.OTransform = 'translateX(' + dist + 'px)'; | ||
+ | |||
+ | } | ||
+ | |||
+ | function animate(from, to, speed) { | ||
+ | |||
+ | // if not an animation, just reposition | ||
+ | if (!speed) { | ||
+ | |||
+ | element.style.left = to + 'px'; | ||
+ | return; | ||
+ | |||
+ | } | ||
+ | |||
+ | var start = +new Date; | ||
+ | |||
+ | var timer = setInterval(function() { | ||
+ | |||
+ | var timeElap = +new Date - start; | ||
+ | |||
+ | if (timeElap > speed) { | ||
+ | |||
+ | element.style.left = to + 'px'; | ||
+ | |||
+ | if (delay) begin(); | ||
+ | |||
+ | options.transitionEnd && options.transitionEnd.call(event, index, slides[index]); | ||
+ | |||
+ | clearInterval(timer); | ||
+ | return; | ||
+ | |||
+ | } | ||
+ | |||
+ | element.style.left = (( (to - from) * (Math.floor((timeElap / speed) * 100) / 100) ) + from) + 'px'; | ||
+ | |||
+ | }, 4); | ||
+ | |||
+ | } | ||
+ | |||
+ | // setup auto slideshow | ||
+ | var delay = options.auto || 0; | ||
+ | var interval; | ||
+ | |||
+ | function begin() { | ||
+ | |||
+ | interval = setTimeout(next, delay); | ||
+ | |||
+ | } | ||
+ | |||
+ | function stop() { | ||
+ | |||
+ | delay = 0; | ||
+ | clearTimeout(interval); | ||
+ | |||
+ | } | ||
+ | |||
+ | |||
+ | // setup initial vars | ||
+ | var start = {}; | ||
+ | var delta = {}; | ||
+ | var isScrolling; | ||
+ | |||
+ | // setup event capturing | ||
+ | var events = { | ||
+ | |||
+ | handleEvent: function(event) { | ||
+ | |||
+ | switch (event.type) { | ||
+ | case 'touchstart': this.start(event); break; | ||
+ | case 'touchmove': this.move(event); break; | ||
+ | case 'touchend': offloadFn(this.end(event)); break; | ||
+ | case 'webkitTransitionEnd': | ||
+ | case 'msTransitionEnd': | ||
+ | case 'oTransitionEnd': | ||
+ | case 'otransitionend': | ||
+ | case 'transitionend': offloadFn(this.transitionEnd(event)); break; | ||
+ | case 'resize': offloadFn(setup.call()); break; | ||
+ | } | ||
+ | |||
+ | if (options.stopPropagation) event.stopPropagation(); | ||
+ | |||
+ | }, | ||
+ | start: function(event) { | ||
+ | |||
+ | var touches = event.touches[0]; | ||
+ | |||
+ | // measure start values | ||
+ | start = { | ||
+ | |||
+ | // get initial touch coords | ||
+ | x: touches.pageX, | ||
+ | y: touches.pageY, | ||
+ | |||
+ | // store time to determine touch duration | ||
+ | time: +new Date | ||
+ | |||
+ | }; | ||
+ | |||
+ | // used for testing first move event | ||
+ | isScrolling = undefined; | ||
+ | |||
+ | // reset delta and end measurements | ||
+ | delta = {}; | ||
+ | |||
+ | // attach touchmove and touchend listeners | ||
+ | element.addEventListener('touchmove', this, false); | ||
+ | element.addEventListener('touchend', this, false); | ||
+ | |||
+ | }, | ||
+ | move: function(event) { | ||
+ | |||
+ | // ensure swiping with one touch and not pinching | ||
+ | if ( event.touches.length > 1 || event.scale && event.scale !== 1) return | ||
+ | |||
+ | if (options.disableScroll) event.preventDefault(); | ||
+ | |||
+ | var touches = event.touches[0]; | ||
+ | |||
+ | // measure change in x and y | ||
+ | delta = { | ||
+ | x: touches.pageX - start.x, | ||
+ | y: touches.pageY - start.y | ||
+ | } | ||
+ | |||
+ | // determine if scrolling test has run - one time test | ||
+ | if ( typeof isScrolling == 'undefined') { | ||
+ | isScrolling = !!( isScrolling || Math.abs(delta.x) < Math.abs(delta.y) ); | ||
+ | } | ||
+ | |||
+ | // if user is not trying to scroll vertically | ||
+ | if (!isScrolling) { | ||
+ | |||
+ | // prevent native scrolling | ||
+ | event.preventDefault(); | ||
+ | |||
+ | // stop slideshow | ||
+ | stop(); | ||
+ | |||
+ | // increase resistance if first or last slide | ||
+ | if (options.continuous) { // we don't add resistance at the end | ||
+ | |||
+ | translate(circle(index-1), delta.x + slidePos[circle(index-1)], 0); | ||
+ | translate(index, delta.x + slidePos[index], 0); | ||
+ | translate(circle(index+1), delta.x + slidePos[circle(index+1)], 0); | ||
+ | |||
+ | } else { | ||
+ | |||
+ | delta.x = | ||
+ | delta.x / | ||
+ | ( (!index && delta.x > 0 // if first slide and sliding left | ||
+ | || index == slides.length - 1 // or if last slide and sliding right | ||
+ | && delta.x < 0 // and if sliding at all | ||
+ | ) ? | ||
+ | ( Math.abs(delta.x) / width + 1 ) // determine resistance level | ||
+ | : 1 ); // no resistance if false | ||
+ | |||
+ | // translate 1:1 | ||
+ | translate(index-1, delta.x + slidePos[index-1], 0); | ||
+ | translate(index, delta.x + slidePos[index], 0); | ||
+ | translate(index+1, delta.x + slidePos[index+1], 0); | ||
+ | } | ||
+ | |||
+ | } | ||
+ | |||
+ | }, | ||
+ | end: function(event) { | ||
+ | |||
+ | // measure duration | ||
+ | var duration = +new Date - start.time; | ||
+ | |||
+ | // determine if slide attempt triggers next/prev slide | ||
+ | var isValidSlide = | ||
+ | Number(duration) < 250 // if slide duration is less than 250ms | ||
+ | && Math.abs(delta.x) > 20 // and if slide amt is greater than 20px | ||
+ | || Math.abs(delta.x) > width/2; // or if slide amt is greater than half the width | ||
+ | |||
+ | // determine if slide attempt is past start and end | ||
+ | var isPastBounds = | ||
+ | !index && delta.x > 0 // if first slide and slide amt is greater than 0 | ||
+ | || index == slides.length - 1 && delta.x < 0; // or if last slide and slide amt is less than 0 | ||
+ | |||
+ | if (options.continuous) isPastBounds = false; | ||
+ | |||
+ | // determine direction of swipe (true:right, false:left) | ||
+ | var direction = delta.x < 0; | ||
+ | |||
+ | // if not scrolling vertically | ||
+ | if (!isScrolling) { | ||
+ | |||
+ | if (isValidSlide && !isPastBounds) { | ||
+ | |||
+ | if (direction) { | ||
+ | |||
+ | if (options.continuous) { // we need to get the next in this direction in place | ||
+ | |||
+ | move(circle(index-1), -width, 0); | ||
+ | move(circle(index+2), width, 0); | ||
+ | |||
+ | } else { | ||
+ | move(index-1, -width, 0); | ||
+ | } | ||
+ | |||
+ | move(index, slidePos[index]-width, speed); | ||
+ | move(circle(index+1), slidePos[circle(index+1)]-width, speed); | ||
+ | index = circle(index+1); | ||
+ | |||
+ | } else { | ||
+ | if (options.continuous) { // we need to get the next in this direction in place | ||
+ | |||
+ | move(circle(index+1), width, 0); | ||
+ | move(circle(index-2), -width, 0); | ||
+ | |||
+ | } else { | ||
+ | move(index+1, width, 0); | ||
+ | } | ||
+ | |||
+ | move(index, slidePos[index]+width, speed); | ||
+ | move(circle(index-1), slidePos[circle(index-1)]+width, speed); | ||
+ | index = circle(index-1); | ||
+ | |||
+ | } | ||
+ | |||
+ | options.callback && options.callback(index, slides[index]); | ||
+ | |||
+ | } else { | ||
+ | |||
+ | if (options.continuous) { | ||
+ | |||
+ | move(circle(index-1), -width, speed); | ||
+ | move(index, 0, speed); | ||
+ | move(circle(index+1), width, speed); | ||
+ | |||
+ | } else { | ||
+ | |||
+ | move(index-1, -width, speed); | ||
+ | move(index, 0, speed); | ||
+ | move(index+1, width, speed); | ||
+ | } | ||
+ | |||
+ | } | ||
+ | |||
+ | } | ||
+ | |||
+ | // kill touchmove and touchend event listeners until touchstart called again | ||
+ | element.removeEventListener('touchmove', events, false) | ||
+ | element.removeEventListener('touchend', events, false) | ||
+ | |||
+ | }, | ||
+ | transitionEnd: function(event) { | ||
+ | |||
+ | if (parseInt(event.target.getAttribute('data-index'), 10) == index) { | ||
+ | |||
+ | if (delay) begin(); | ||
+ | |||
+ | options.transitionEnd && options.transitionEnd.call(event, index, slides[index]); | ||
+ | |||
+ | } | ||
+ | |||
+ | } | ||
+ | |||
+ | } | ||
+ | |||
+ | // trigger setup | ||
+ | setup(); | ||
+ | |||
+ | // start auto slideshow if applicable | ||
+ | if (delay) begin(); | ||
+ | |||
+ | |||
+ | // add event listeners | ||
+ | if (browser.addEventListener) { | ||
+ | |||
+ | // set touchstart event on element | ||
+ | if (browser.touch) element.addEventListener('touchstart', events, false); | ||
+ | |||
+ | if (browser.transitions) { | ||
+ | element.addEventListener('webkitTransitionEnd', events, false); | ||
+ | element.addEventListener('msTransitionEnd', events, false); | ||
+ | element.addEventListener('oTransitionEnd', events, false); | ||
+ | element.addEventListener('otransitionend', events, false); | ||
+ | element.addEventListener('transitionend', events, false); | ||
+ | } | ||
+ | |||
+ | // set resize event on window | ||
+ | window.addEventListener('resize', events, false); | ||
+ | |||
+ | } else { | ||
+ | |||
+ | window.onresize = function () { setup() }; // to play nice with old IE | ||
+ | |||
+ | } | ||
+ | |||
+ | // expose the Swipe API | ||
+ | return { | ||
+ | setup: function() { | ||
+ | |||
+ | setup(); | ||
+ | |||
+ | }, | ||
+ | slide: function(to, speed) { | ||
+ | |||
+ | // cancel slideshow | ||
+ | stop(); | ||
+ | |||
+ | slide(to, speed); | ||
+ | |||
+ | }, | ||
+ | prev: function() { | ||
+ | |||
+ | // cancel slideshow | ||
+ | stop(); | ||
+ | |||
+ | prev(); | ||
+ | |||
+ | }, | ||
+ | next: function() { | ||
+ | |||
+ | // cancel slideshow | ||
+ | stop(); | ||
+ | |||
+ | next(); | ||
+ | |||
+ | }, | ||
+ | getPos: function() { | ||
+ | |||
+ | // return current index position | ||
+ | return index; | ||
+ | |||
+ | }, | ||
+ | getNumSlides: function() { | ||
+ | |||
+ | // return total number of slides | ||
+ | return length; | ||
+ | }, | ||
+ | kill: function() { | ||
+ | |||
+ | // cancel slideshow | ||
+ | stop(); | ||
+ | |||
+ | // reset element | ||
+ | element.style.width = 'auto'; | ||
+ | element.style.left = 0; | ||
+ | |||
+ | // reset slides | ||
+ | var pos = slides.length; | ||
+ | while(pos--) { | ||
+ | |||
+ | var slide = slides[pos]; | ||
+ | slide.style.width = '100%'; | ||
+ | slide.style.left = 0; | ||
+ | |||
+ | if (browser.transitions) translate(pos, 0, 0); | ||
+ | |||
+ | } | ||
+ | |||
+ | // removed event listeners | ||
+ | if (browser.addEventListener) { | ||
+ | |||
+ | // remove current event listeners | ||
+ | element.removeEventListener('touchstart', events, false); | ||
+ | element.removeEventListener('webkitTransitionEnd', events, false); | ||
+ | element.removeEventListener('msTransitionEnd', events, false); | ||
+ | element.removeEventListener('oTransitionEnd', events, false); | ||
+ | element.removeEventListener('otransitionend', events, false); | ||
+ | element.removeEventListener('transitionend', events, false); | ||
+ | window.removeEventListener('resize', events, false); | ||
+ | |||
+ | } | ||
+ | else { | ||
+ | |||
+ | window.onresize = null; | ||
+ | |||
+ | } | ||
+ | |||
+ | } | ||
+ | } | ||
+ | |||
+ | } | ||
+ | |||
+ | |||
+ | if ( window.jQuery || window.Zepto ) { | ||
+ | (function($) { | ||
+ | $.fn.Swipe = function(params) { | ||
+ | return this.each(function() { | ||
+ | $(this).data('Swipe', new Swipe($(this)[0], params)); | ||
+ | }); | ||
+ | } | ||
+ | })( window.jQuery || window.Zepto ) | ||
+ | } | ||
+ | |||
+ | </script> | ||
+ | |||
+ | <script type="text/javascript"> | ||
+ | var Contact = { | ||
+ | |||
+ | initialized: false, | ||
+ | |||
+ | initialize: function() { | ||
+ | |||
+ | if (this.initialized) return; | ||
+ | this.initialized = true; | ||
+ | |||
+ | this.build(); | ||
+ | this.events(); | ||
+ | |||
+ | }, | ||
+ | |||
+ | build: function() { | ||
+ | |||
+ | this.validations(); | ||
+ | |||
+ | }, | ||
+ | |||
+ | events: function() { | ||
+ | |||
+ | |||
+ | |||
+ | }, | ||
+ | |||
+ | validations: function() { | ||
+ | |||
+ | $("#contactForm").validate({ | ||
+ | submitHandler: function(form) { | ||
+ | |||
+ | $.ajax({ | ||
+ | type: "POST", | ||
+ | url: "php/contact-form.php", | ||
+ | data: { | ||
+ | "name": $("#contactForm #name").val(), | ||
+ | "email": $("#contactForm #email").val(), | ||
+ | "subject": $("#contactForm #subject").val(), | ||
+ | "message": $("#contactForm #message").val() | ||
+ | }, | ||
+ | dataType: "json", | ||
+ | success: function (data) { | ||
+ | if (data.response == "success") { | ||
+ | |||
+ | $("#contactSuccess").removeClass("hidden"); | ||
+ | $("#contactError").addClass("hidden"); | ||
+ | |||
+ | $("#contactForm #name, #contactForm #email, #contactForm #subject, #contactForm #message") | ||
+ | .val("") | ||
+ | .blur() | ||
+ | .closest(".control-group") | ||
+ | .removeClass("success") | ||
+ | .removeClass("error"); | ||
+ | |||
+ | if(($("#contactSuccess").position().top - 80) < $(window).scrollTop()){ | ||
+ | $("html, body").animate({ | ||
+ | scrollTop: $("#contactSuccess").offset().top - 80 | ||
+ | }, 300); | ||
+ | } | ||
+ | |||
+ | } else { | ||
+ | |||
+ | $("#contactError").removeClass("hidden"); | ||
+ | $("#contactSuccess").addClass("hidden"); | ||
+ | |||
+ | if(($("#contactError").position().top - 80) < $(window).scrollTop()){ | ||
+ | $("html, body").animate({ | ||
+ | scrollTop: $("#contactError").offset().top - 80 | ||
+ | }, 300); | ||
+ | } | ||
+ | |||
+ | } | ||
+ | } | ||
+ | |||
+ | }); | ||
+ | }, | ||
+ | rules: { | ||
+ | name: { | ||
+ | required: true | ||
+ | }, | ||
+ | email: { | ||
+ | required: true, | ||
+ | email: true | ||
+ | }, | ||
+ | subject: { | ||
+ | required: true | ||
+ | }, | ||
+ | message: { | ||
+ | required: true | ||
+ | } | ||
+ | }, | ||
+ | highlight: function (element) { | ||
+ | $(element) | ||
+ | .closest(".control-group") | ||
+ | .removeClass("success") | ||
+ | .addClass("error"); | ||
+ | }, | ||
+ | success: function (element) { | ||
+ | $(element) | ||
+ | .closest(".control-group") | ||
+ | .removeClass("error") | ||
+ | .addClass("success"); | ||
+ | } | ||
+ | }); | ||
+ | |||
+ | } | ||
+ | |||
+ | }; | ||
+ | |||
+ | Contact.initialize(); | ||
+ | |||
+ | </script> | ||
+ | |||
+ | <script type="text/javascript"> | ||
+ | /*! WOW - v1.0.3 - 2015-01-14 | ||
+ | * Copyright (c) 2015 Matthieu Aussaguel; Licensed MIT */(function(){var a,b,c,d,e,f=function(a,b){return function(){return a.apply(b,arguments)}},g=[].indexOf||function(a){for(var b=0,c=this.length;c>b;b++)if(b in this&&this[b]===a)return b;return-1};b=function(){function a(){}return a.prototype.extend=function(a,b){var c,d;for(c in b)d=b[c],null==a[c]&&(a[c]=d);return a},a.prototype.isMobile=function(a){return/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(a)},a.prototype.addEvent=function(a,b,c){return null!=a.addEventListener?a.addEventListener(b,c,!1):null!=a.attachEvent?a.attachEvent("on"+b,c):a[b]=c},a.prototype.removeEvent=function(a,b,c){return null!=a.removeEventListener?a.removeEventListener(b,c,!1):null!=a.detachEvent?a.detachEvent("on"+b,c):delete a[b]},a.prototype.innerHeight=function(){return"innerHeight"in window?window.innerHeight:document.documentElement.clientHeight},a}(),c=this.WeakMap||this.MozWeakMap||(c=function(){function a(){this.keys=[],this.values=[]}return a.prototype.get=function(a){var b,c,d,e,f;for(f=this.keys,b=d=0,e=f.length;e>d;b=++d)if(c=f[b],c===a)return this.values[b]},a.prototype.set=function(a,b){var c,d,e,f,g;for(g=this.keys,c=e=0,f=g.length;f>e;c=++e)if(d=g[c],d===a)return void(this.values[c]=b);return this.keys.push(a),this.values.push(b)},a}()),a=this.MutationObserver||this.WebkitMutationObserver||this.MozMutationObserver||(a=function(){function a(){"undefined"!=typeof console&&null!==console&&console.warn("MutationObserver is not supported by your browser."),"undefined"!=typeof console&&null!==console&&console.warn("WOW.js cannot detect dom mutations, please call .sync() after loading new content.")}return a.notSupported=!0,a.prototype.observe=function(){},a}()),d=this.getComputedStyle||function(a){return this.getPropertyValue=function(b){var c;return"float"===b&&(b="styleFloat"),e.test(b)&&b.replace(e,function(a,b){return b.toUpperCase()}),(null!=(c=a.currentStyle)?c[b]:void 0)||null},this},e=/(\-([a-z]){1})/g,this.WOW=function(){function e(a){null==a&&(a={}),this.scrollCallback=f(this.scrollCallback,this),this.scrollHandler=f(this.scrollHandler,this),this.start=f(this.start,this),this.scrolled=!0,this.config=this.util().extend(a,this.defaults),this.animationNameCache=new c}return e.prototype.defaults={boxClass:"wow",animateClass:"animated",offset:0,mobile:!0,live:!0,callback:null},e.prototype.init=function(){var a;return this.element=window.document.documentElement,"interactive"===(a=document.readyState)||"complete"===a?this.start():this.util().addEvent(document,"DOMContentLoaded",this.start),this.finished=[]},e.prototype.start=function(){var b,c,d,e;if(this.stopped=!1,this.boxes=function(){var a,c,d,e;for(d=this.element.querySelectorAll("."+this.config.boxClass),e=[],a=0,c=d.length;c>a;a++)b=d[a],e.push(b);return e}.call(this),this.all=function(){var a,c,d,e;for(d=this.boxes,e=[],a=0,c=d.length;c>a;a++)b=d[a],e.push(b);return e}.call(this),this.boxes.length)if(this.disabled())this.resetStyle();else for(e=this.boxes,c=0,d=e.length;d>c;c++)b=e[c],this.applyStyle(b,!0);return this.disabled()||(this.util().addEvent(window,"scroll",this.scrollHandler),this.util().addEvent(window,"resize",this.scrollHandler),this.interval=setInterval(this.scrollCallback,50)),this.config.live?new a(function(a){return function(b){var c,d,e,f,g;for(g=[],e=0,f=b.length;f>e;e++)d=b[e],g.push(function(){var a,b,e,f;for(e=d.addedNodes||[],f=[],a=0,b=e.length;b>a;a++)c=e[a],f.push(this.doSync(c));return f}.call(a));return g}}(this)).observe(document.body,{childList:!0,subtree:!0}):void 0},e.prototype.stop=function(){return this.stopped=!0,this.util().removeEvent(window,"scroll",this.scrollHandler),this.util().removeEvent(window,"resize",this.scrollHandler),null!=this.interval?clearInterval(this.interval):void 0},e.prototype.sync=function(){return a.notSupported?this.doSync(this.element):void 0},e.prototype.doSync=function(a){var b,c,d,e,f;if(null==a&&(a=this.element),1===a.nodeType){for(a=a.parentNode||a,e=a.querySelectorAll("."+this.config.boxClass),f=[],c=0,d=e.length;d>c;c++)b=e[c],g.call(this.all,b)<0?(this.boxes.push(b),this.all.push(b),this.stopped||this.disabled()?this.resetStyle():this.applyStyle(b,!0),f.push(this.scrolled=!0)):f.push(void 0);return f}},e.prototype.show=function(a){return this.applyStyle(a),a.className=""+a.className+" "+this.config.animateClass,null!=this.config.callback?this.config.callback(a):void 0},e.prototype.applyStyle=function(a,b){var c,d,e;return d=a.getAttribute("data-wow-duration"),c=a.getAttribute("data-wow-delay"),e=a.getAttribute("data-wow-iteration"),this.animate(function(f){return function(){return f.customStyle(a,b,d,c,e)}}(this))},e.prototype.animate=function(){return"requestAnimationFrame"in window?function(a){return window.requestAnimationFrame(a)}:function(a){return a()}}(),e.prototype.resetStyle=function(){var a,b,c,d,e;for(d=this.boxes,e=[],b=0,c=d.length;c>b;b++)a=d[b],e.push(a.style.visibility="visible");return e},e.prototype.customStyle=function(a,b,c,d,e){return b&&this.cacheAnimationName(a),a.style.visibility=b?"hidden":"visible",c&&this.vendorSet(a.style,{animationDuration:c}),d&&this.vendorSet(a.style,{animationDelay:d}),e&&this.vendorSet(a.style,{animationIterationCount:e}),this.vendorSet(a.style,{animationName:b?"none":this.cachedAnimationName(a)}),a},e.prototype.vendors=["moz","webkit"],e.prototype.vendorSet=function(a,b){var c,d,e,f;f=[];for(c in b)d=b[c],a[""+c]=d,f.push(function(){var b,f,g,h;for(g=this.vendors,h=[],b=0,f=g.length;f>b;b++)e=g[b],h.push(a[""+e+c.charAt(0).toUpperCase()+c.substr(1)]=d);return h}.call(this));return f},e.prototype.vendorCSS=function(a,b){var c,e,f,g,h,i;for(e=d(a),c=e.getPropertyCSSValue(b),i=this.vendors,g=0,h=i.length;h>g;g++)f=i[g],c=c||e.getPropertyCSSValue("-"+f+"-"+b);return c},e.prototype.animationName=function(a){var b;try{b=this.vendorCSS(a,"animation-name").cssText}catch(c){b=d(a).getPropertyValue("animation-name")}return"none"===b?"":b},e.prototype.cacheAnimationName=function(a){return this.animationNameCache.set(a,this.animationName(a))},e.prototype.cachedAnimationName=function(a){return this.animationNameCache.get(a)},e.prototype.scrollHandler=function(){return this.scrolled=!0},e.prototype.scrollCallback=function(){var a;return!this.scrolled||(this.scrolled=!1,this.boxes=function(){var b,c,d,e;for(d=this.boxes,e=[],b=0,c=d.length;c>b;b++)a=d[b],a&&(this.isVisible(a)?this.show(a):e.push(a));return e}.call(this),this.boxes.length||this.config.live)?void 0:this.stop()},e.prototype.offsetTop=function(a){for(var b;void 0===a.offsetTop;)a=a.parentNode;for(b=a.offsetTop;a=a.offsetParent;)b+=a.offsetTop;return b},e.prototype.isVisible=function(a){var b,c,d,e,f;return c=a.getAttribute("data-wow-offset")||this.config.offset,f=window.pageYOffset,e=f+Math.min(this.element.clientHeight,this.util().innerHeight())-c,d=this.offsetTop(a),b=d+a.clientHeight,e>=d&&b>=f},e.prototype.util=function(){return null!=this._util?this._util:this._util=new b},e.prototype.disabled=function(){return!this.config.mobile&&this.util().isMobile(navigator.userAgent)},e}()}).call(this); | ||
+ | </script> | ||
+ | |||
+ | |||
+ | |||
Revision as of 03:31, 30 June 2017