this.containment[2]&&(a=this.containment[2]+this.offset.click.left),t.pageY-this.offset.click.top>this.containment[3]&&(o=this.containment[3]+this.offset.click.top)),n.grid&&(i=this.originalPageY+Math.round((o-this.originalPageY)/n.grid[1])*n.grid[1],o=this.containment?i-this.offset.click.top>=this.containment[1]&&i-this.offset.click.top<=this.containment[3]?i:i-this.offset.click.top>=this.containment[1]?i-n.grid[1]:i+n.grid[1]:i,s=this.originalPageX+Math.round((a-this.originalPageX)/n.grid[0])*n.grid[0],a=this.containment?s-this.offset.click.left>=this.containment[0]&&s-this.offset.click.left<=this.containment[2]?s:s-this.offset.click.left>=this.containment[0]?s-n.grid[0]:s+n.grid[0]:s)),{top:o-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+("fixed"===this.cssPosition?-this.scrollParent.scrollTop():h?0:r.scrollTop()),left:a-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+("fixed"===this.cssPosition?-this.scrollParent.scrollLeft():h?0:r.scrollLeft())}},_rearrange:function(e,t,i,s){i?i[0].appendChild(this.placeholder[0]):t.item[0].parentNode.insertBefore(this.placeholder[0],"down"===this.direction?t.item[0]:t.item[0].nextSibling),this.counter=this.counter?++this.counter:1;var n=this.counter;this._delay(function(){n===this.counter&&this.refreshPositions(!s)})},_clear:function(e,t){function i(e,t,i){return function(s){i._trigger(e,s,t._uiHash(t))}}this.reverting=!1;var s,n=[];if(!this._noFinalSort&&this.currentItem.parent().length&&this.placeholder.before(this.currentItem),this._noFinalSort=null,this.helper[0]===this.currentItem[0]){for(s in this._storedCSS)("auto"===this._storedCSS[s]||"static"===this._storedCSS[s])&&(this._storedCSS[s]="");this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper")}else this.currentItem.show();for(this.fromOutside&&!t&&n.push(function(e){this._trigger("receive",e,this._uiHash(this.fromOutside))}),!this.fromOutside&&this.domPosition.prev===this.currentItem.prev().not(".ui-sortable-helper")[0]&&this.domPosition.parent===this.currentItem.parent()[0]||t||n.push(function(e){this._trigger("update",e,this._uiHash())}),this!==this.currentContainer&&(t||(n.push(function(e){this._trigger("remove",e,this._uiHash())}),n.push(function(e){return function(t){e._trigger("receive",t,this._uiHash(this))}}.call(this,this.currentContainer)),n.push(function(e){return function(t){e._trigger("update",t,this._uiHash(this))}}.call(this,this.currentContainer)))),s=this.containers.length-1;s>=0;s--)t||n.push(i("deactivate",this,this.containers[s])),this.containers[s].containerCache.over&&(n.push(i("out",this,this.containers[s])),this.containers[s].containerCache.over=0);if(this.storedCursor&&(this.document.find("body").css("cursor",this.storedCursor),this.storedStylesheet.remove()),this._storedOpacity&&this.helper.css("opacity",this._storedOpacity),this._storedZIndex&&this.helper.css("zIndex","auto"===this._storedZIndex?"":this._storedZIndex),this.dragging=!1,t||this._trigger("beforeStop",e,this._uiHash()),this.placeholder[0].parentNode.removeChild(this.placeholder[0]),this.cancelHelperRemoval||(this.helper[0]!==this.currentItem[0]&&this.helper.remove(),this.helper=null),!t){for(s=0;n.length>s;s++)n[s].call(this,e);this._trigger("stop",e,this._uiHash())}return this.fromOutside=!1,!this.cancelHelperRemoval},_trigger:function(){e.Widget.prototype._trigger.apply(this,arguments)===!1&&this.cancel()},_uiHash:function(t){var i=t||this;return{helper:i.helper,placeholder:i.placeholder||e([]),position:i.position,originalPosition:i.originalPosition,offset:i.positionAbs,item:i.currentItem,sender:t?t.element:null}}});var o="ui-effects-",r=e;e.effects={effect:{}},function(e,t){function i(e,t,i){var s=d[t.type]||{};return null==e?i||!t.def?null:t.def:(e=s.floor?~~e:parseFloat(e),isNaN(e)?t.def:s.mod?(e+s.mod)%s.mod:0>e?0:e>s.max?s.max:e)}function s(i){var s=l(),n=s._rgba=[];return i=i.toLowerCase(),f(h,function(e,a){var o,r=a.re.exec(i),h=r&&a.parse(r),l=a.space||"rgba";return h?(o=s[l](h),s[u[l].cache]=o[u[l].cache],n=s._rgba=o._rgba,!1):t}),n.length?("0,0,0,0"===n.join()&&e.extend(n,a.transparent),s):a[i]}function n(e,t,i){return i=(i+1)%1,1>6*i?e+6*(t-e)*i:1>2*i?t:2>3*i?e+6*(t-e)*(2/3-i):e}var a,o="backgroundColor borderBottomColor borderLeftColor borderRightColor borderTopColor color columnRuleColor outlineColor textDecorationColor textEmphasisColor",r=/^([\-+])=\s*(\d+\.?\d*)/,h=[{re:/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,parse:function(e){return[e[1],e[2],e[3],e[4]]}},{re:/rgba?\(\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,parse:function(e){return[2.55*e[1],2.55*e[2],2.55*e[3],e[4]]}},{re:/#([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})/,parse:function(e){return[parseInt(e[1],16),parseInt(e[2],16),parseInt(e[3],16)]}},{re:/#([a-f0-9])([a-f0-9])([a-f0-9])/,parse:function(e){return[parseInt(e[1]+e[1],16),parseInt(e[2]+e[2],16),parseInt(e[3]+e[3],16)]}},{re:/hsla?\(\s*(\d+(?:\.\d+)?)\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,space:"hsla",parse:function(e){return[e[1],e[2]/100,e[3]/100,e[4]]}}],l=e.Color=function(t,i,s,n){return new e.Color.fn.parse(t,i,s,n)},u={rgba:{props:{red:{idx:0,type:"byte"},green:{idx:1,type:"byte"},blue:{idx:2,type:"byte"}}},hsla:{props:{hue:{idx:0,type:"degrees"},saturation:{idx:1,type:"percent"},lightness:{idx:2,type:"percent"}}}},d={"byte":{floor:!0,max:255},percent:{max:1},degrees:{mod:360,floor:!0}},c=l.support={},p=e("")[0],f=e.each;p.style.cssText="background-color:rgba(1,1,1,.5)",c.rgba=p.style.backgroundColor.indexOf("rgba")>-1,f(u,function(e,t){t.cache="_"+e,t.props.alpha={idx:3,type:"percent",def:1}}),l.fn=e.extend(l.prototype,{parse:function(n,o,r,h){if(n===t)return this._rgba=[null,null,null,null],this;(n.jquery||n.nodeType)&&(n=e(n).css(o),o=t);var d=this,c=e.type(n),p=this._rgba=[];return o!==t&&(n=[n,o,r,h],c="array"),"string"===c?this.parse(s(n)||a._default):"array"===c?(f(u.rgba.props,function(e,t){p[t.idx]=i(n[t.idx],t)}),this):"object"===c?(n instanceof l?f(u,function(e,t){n[t.cache]&&(d[t.cache]=n[t.cache].slice())}):f(u,function(t,s){var a=s.cache;f(s.props,function(e,t){if(!d[a]&&s.to){if("alpha"===e||null==n[e])return;d[a]=s.to(d._rgba)}d[a][t.idx]=i(n[e],t,!0)}),d[a]&&0>e.inArray(null,d[a].slice(0,3))&&(d[a][3]=1,s.from&&(d._rgba=s.from(d[a])))}),this):t},is:function(e){var i=l(e),s=!0,n=this;return f(u,function(e,a){var o,r=i[a.cache];return r&&(o=n[a.cache]||a.to&&a.to(n._rgba)||[],f(a.props,function(e,i){return null!=r[i.idx]?s=r[i.idx]===o[i.idx]:t})),s}),s},_space:function(){var e=[],t=this;return f(u,function(i,s){t[s.cache]&&e.push(i)}),e.pop()},transition:function(e,t){var s=l(e),n=s._space(),a=u[n],o=0===this.alpha()?l("transparent"):this,r=o[a.cache]||a.to(o._rgba),h=r.slice();return s=s[a.cache],f(a.props,function(e,n){var a=n.idx,o=r[a],l=s[a],u=d[n.type]||{};null!==l&&(null===o?h[a]=l:(u.mod&&(l-o>u.mod/2?o+=u.mod:o-l>u.mod/2&&(o-=u.mod)),h[a]=i((l-o)*t+o,n)))}),this[n](h)},blend:function(t){if(1===this._rgba[3])return this;var i=this._rgba.slice(),s=i.pop(),n=l(t)._rgba;return l(e.map(i,function(e,t){return(1-s)*n[t]+s*e}))},toRgbaString:function(){var t="rgba(",i=e.map(this._rgba,function(e,t){return null==e?t>2?1:0:e});return 1===i[3]&&(i.pop(),t="rgb("),t+i.join()+")"},toHslaString:function(){var t="hsla(",i=e.map(this.hsla(),function(e,t){return null==e&&(e=t>2?1:0),t&&3>t&&(e=Math.round(100*e)+"%"),e});return 1===i[3]&&(i.pop(),t="hsl("),t+i.join()+")"},toHexString:function(t){var i=this._rgba.slice(),s=i.pop();return t&&i.push(~~(255*s)),"#"+e.map(i,function(e){return e=(e||0).toString(16),1===e.length?"0"+e:e}).join("")},toString:function(){return 0===this._rgba[3]?"transparent":this.toRgbaString()}}),l.fn.parse.prototype=l.fn,u.hsla.to=function(e){if(null==e[0]||null==e[1]||null==e[2])return[null,null,null,e[3]];var t,i,s=e[0]/255,n=e[1]/255,a=e[2]/255,o=e[3],r=Math.max(s,n,a),h=Math.min(s,n,a),l=r-h,u=r+h,d=.5*u;return t=h===r?0:s===r?60*(n-a)/l+360:n===r?60*(a-s)/l+120:60*(s-n)/l+240,i=0===l?0:.5>=d?l/u:l/(2-u),[Math.round(t)%360,i,d,null==o?1:o]},u.hsla.from=function(e){if(null==e[0]||null==e[1]||null==e[2])return[null,null,null,e[3]];var t=e[0]/360,i=e[1],s=e[2],a=e[3],o=.5>=s?s*(1+i):s+i-s*i,r=2*s-o;return[Math.round(255*n(r,o,t+1/3)),Math.round(255*n(r,o,t)),Math.round(255*n(r,o,t-1/3)),a]},f(u,function(s,n){var a=n.props,o=n.cache,h=n.to,u=n.from;l.fn[s]=function(s){if(h&&!this[o]&&(this[o]=h(this._rgba)),s===t)return this[o].slice();var n,r=e.type(s),d="array"===r||"object"===r?s:arguments,c=this[o].slice();return f(a,function(e,t){var s=d["object"===r?e:t.idx];null==s&&(s=c[t.idx]),c[t.idx]=i(s,t)}),u?(n=l(u(c)),n[o]=c,n):l(c)},f(a,function(t,i){l.fn[t]||(l.fn[t]=function(n){var a,o=e.type(n),h="alpha"===t?this._hsla?"hsla":"rgba":s,l=this[h](),u=l[i.idx];return"undefined"===o?u:("function"===o&&(n=n.call(this,u),o=e.type(n)),null==n&&i.empty?this:("string"===o&&(a=r.exec(n),a&&(n=u+parseFloat(a[2])*("+"===a[1]?1:-1))),l[i.idx]=n,this[h](l)))})})}),l.hook=function(t){var i=t.split(" ");f(i,function(t,i){e.cssHooks[i]={set:function(t,n){var a,o,r="";if("transparent"!==n&&("string"!==e.type(n)||(a=s(n)))){if(n=l(a||n),!c.rgba&&1!==n._rgba[3]){for(o="backgroundColor"===i?t.parentNode:t;(""===r||"transparent"===r)&&o&&o.style;)try{r=e.css(o,"backgroundColor"),o=o.parentNode}catch(h){}n=n.blend(r&&"transparent"!==r?r:"_default")}n=n.toRgbaString()}try{t.style[i]=n}catch(h){}}},e.fx.step[i]=function(t){t.colorInit||(t.start=l(t.elem,i),t.end=l(t.end),t.colorInit=!0),e.cssHooks[i].set(t.elem,t.start.transition(t.end,t.pos))
-}})},l.hook(o),e.cssHooks.borderColor={expand:function(e){var t={};return f(["Top","Right","Bottom","Left"],function(i,s){t["border"+s+"Color"]=e}),t}},a=e.Color.names={aqua:"#00ffff",black:"#000000",blue:"#0000ff",fuchsia:"#ff00ff",gray:"#808080",green:"#008000",lime:"#00ff00",maroon:"#800000",navy:"#000080",olive:"#808000",purple:"#800080",red:"#ff0000",silver:"#c0c0c0",teal:"#008080",white:"#ffffff",yellow:"#ffff00",transparent:[null,null,null,0],_default:"#ffffff"}}(r),function(){function t(t){var i,s,n=t.ownerDocument.defaultView?t.ownerDocument.defaultView.getComputedStyle(t,null):t.currentStyle,a={};if(n&&n.length&&n[0]&&n[n[0]])for(s=n.length;s--;)i=n[s],"string"==typeof n[i]&&(a[e.camelCase(i)]=n[i]);else for(i in n)"string"==typeof n[i]&&(a[i]=n[i]);return a}function i(t,i){var s,a,o={};for(s in i)a=i[s],t[s]!==a&&(n[s]||(e.fx.step[s]||!isNaN(parseFloat(a)))&&(o[s]=a));return o}var s=["add","remove","toggle"],n={border:1,borderBottom:1,borderColor:1,borderLeft:1,borderRight:1,borderTop:1,borderWidth:1,margin:1,padding:1};e.each(["borderLeftStyle","borderRightStyle","borderBottomStyle","borderTopStyle"],function(t,i){e.fx.step[i]=function(e){("none"!==e.end&&!e.setAttr||1===e.pos&&!e.setAttr)&&(r.style(e.elem,i,e.end),e.setAttr=!0)}}),e.fn.addBack||(e.fn.addBack=function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}),e.effects.animateClass=function(n,a,o,r){var h=e.speed(a,o,r);return this.queue(function(){var a,o=e(this),r=o.attr("class")||"",l=h.children?o.find("*").addBack():o;l=l.map(function(){var i=e(this);return{el:i,start:t(this)}}),a=function(){e.each(s,function(e,t){n[t]&&o[t+"Class"](n[t])})},a(),l=l.map(function(){return this.end=t(this.el[0]),this.diff=i(this.start,this.end),this}),o.attr("class",r),l=l.map(function(){var t=this,i=e.Deferred(),s=e.extend({},h,{queue:!1,complete:function(){i.resolve(t)}});return this.el.animate(this.diff,s),i.promise()}),e.when.apply(e,l.get()).done(function(){a(),e.each(arguments,function(){var t=this.el;e.each(this.diff,function(e){t.css(e,"")})}),h.complete.call(o[0])})})},e.fn.extend({addClass:function(t){return function(i,s,n,a){return s?e.effects.animateClass.call(this,{add:i},s,n,a):t.apply(this,arguments)}}(e.fn.addClass),removeClass:function(t){return function(i,s,n,a){return arguments.length>1?e.effects.animateClass.call(this,{remove:i},s,n,a):t.apply(this,arguments)}}(e.fn.removeClass),toggleClass:function(t){return function(i,s,n,a,o){return"boolean"==typeof s||void 0===s?n?e.effects.animateClass.call(this,s?{add:i}:{remove:i},n,a,o):t.apply(this,arguments):e.effects.animateClass.call(this,{toggle:i},s,n,a)}}(e.fn.toggleClass),switchClass:function(t,i,s,n,a){return e.effects.animateClass.call(this,{add:i,remove:t},s,n,a)}})}(),function(){function t(t,i,s,n){return e.isPlainObject(t)&&(i=t,t=t.effect),t={effect:t},null==i&&(i={}),e.isFunction(i)&&(n=i,s=null,i={}),("number"==typeof i||e.fx.speeds[i])&&(n=s,s=i,i={}),e.isFunction(s)&&(n=s,s=null),i&&e.extend(t,i),s=s||i.duration,t.duration=e.fx.off?0:"number"==typeof s?s:s in e.fx.speeds?e.fx.speeds[s]:e.fx.speeds._default,t.complete=n||i.complete,t}function i(t){return!t||"number"==typeof t||e.fx.speeds[t]?!0:"string"!=typeof t||e.effects.effect[t]?e.isFunction(t)?!0:"object"!=typeof t||t.effect?!1:!0:!0}e.extend(e.effects,{version:"1.11.4",save:function(e,t){for(var i=0;t.length>i;i++)null!==t[i]&&e.data(o+t[i],e[0].style[t[i]])},restore:function(e,t){var i,s;for(s=0;t.length>s;s++)null!==t[s]&&(i=e.data(o+t[s]),void 0===i&&(i=""),e.css(t[s],i))},setMode:function(e,t){return"toggle"===t&&(t=e.is(":hidden")?"show":"hide"),t},getBaseline:function(e,t){var i,s;switch(e[0]){case"top":i=0;break;case"middle":i=.5;break;case"bottom":i=1;break;default:i=e[0]/t.height}switch(e[1]){case"left":s=0;break;case"center":s=.5;break;case"right":s=1;break;default:s=e[1]/t.width}return{x:s,y:i}},createWrapper:function(t){if(t.parent().is(".ui-effects-wrapper"))return t.parent();var i={width:t.outerWidth(!0),height:t.outerHeight(!0),"float":t.css("float")},s=e("
").addClass("ui-effects-wrapper").css({fontSize:"100%",background:"transparent",border:"none",margin:0,padding:0}),n={width:t.width(),height:t.height()},a=document.activeElement;try{a.id}catch(o){a=document.body}return t.wrap(s),(t[0]===a||e.contains(t[0],a))&&e(a).focus(),s=t.parent(),"static"===t.css("position")?(s.css({position:"relative"}),t.css({position:"relative"})):(e.extend(i,{position:t.css("position"),zIndex:t.css("z-index")}),e.each(["top","left","bottom","right"],function(e,s){i[s]=t.css(s),isNaN(parseInt(i[s],10))&&(i[s]="auto")}),t.css({position:"relative",top:0,left:0,right:"auto",bottom:"auto"})),t.css(n),s.css(i).show()},removeWrapper:function(t){var i=document.activeElement;return t.parent().is(".ui-effects-wrapper")&&(t.parent().replaceWith(t),(t[0]===i||e.contains(t[0],i))&&e(i).focus()),t},setTransition:function(t,i,s,n){return n=n||{},e.each(i,function(e,i){var a=t.cssUnit(i);a[0]>0&&(n[i]=a[0]*s+a[1])}),n}}),e.fn.extend({effect:function(){function i(t){function i(){e.isFunction(a)&&a.call(n[0]),e.isFunction(t)&&t()}var n=e(this),a=s.complete,r=s.mode;(n.is(":hidden")?"hide"===r:"show"===r)?(n[r](),i()):o.call(n[0],s,i)}var s=t.apply(this,arguments),n=s.mode,a=s.queue,o=e.effects.effect[s.effect];return e.fx.off||!o?n?this[n](s.duration,s.complete):this.each(function(){s.complete&&s.complete.call(this)}):a===!1?this.each(i):this.queue(a||"fx",i)},show:function(e){return function(s){if(i(s))return e.apply(this,arguments);var n=t.apply(this,arguments);return n.mode="show",this.effect.call(this,n)}}(e.fn.show),hide:function(e){return function(s){if(i(s))return e.apply(this,arguments);var n=t.apply(this,arguments);return n.mode="hide",this.effect.call(this,n)}}(e.fn.hide),toggle:function(e){return function(s){if(i(s)||"boolean"==typeof s)return e.apply(this,arguments);var n=t.apply(this,arguments);return n.mode="toggle",this.effect.call(this,n)}}(e.fn.toggle),cssUnit:function(t){var i=this.css(t),s=[];return e.each(["em","px","%","pt"],function(e,t){i.indexOf(t)>0&&(s=[parseFloat(i),t])}),s}})}(),function(){var t={};e.each(["Quad","Cubic","Quart","Quint","Expo"],function(e,i){t[i]=function(t){return Math.pow(t,e+2)}}),e.extend(t,{Sine:function(e){return 1-Math.cos(e*Math.PI/2)},Circ:function(e){return 1-Math.sqrt(1-e*e)},Elastic:function(e){return 0===e||1===e?e:-Math.pow(2,8*(e-1))*Math.sin((80*(e-1)-7.5)*Math.PI/15)},Back:function(e){return e*e*(3*e-2)},Bounce:function(e){for(var t,i=4;((t=Math.pow(2,--i))-1)/11>e;);return 1/Math.pow(4,3-i)-7.5625*Math.pow((3*t-2)/22-e,2)}}),e.each(t,function(t,i){e.easing["easeIn"+t]=i,e.easing["easeOut"+t]=function(e){return 1-i(1-e)},e.easing["easeInOut"+t]=function(e){return.5>e?i(2*e)/2:1-i(-2*e+2)/2}})}(),e.effects,e.effects.effect.blind=function(t,i){var s,n,a,o=e(this),r=/up|down|vertical/,h=/up|left|vertical|horizontal/,l=["position","top","bottom","left","right","height","width"],u=e.effects.setMode(o,t.mode||"hide"),d=t.direction||"up",c=r.test(d),p=c?"height":"width",f=c?"top":"left",m=h.test(d),g={},v="show"===u;o.parent().is(".ui-effects-wrapper")?e.effects.save(o.parent(),l):e.effects.save(o,l),o.show(),s=e.effects.createWrapper(o).css({overflow:"hidden"}),n=s[p](),a=parseFloat(s.css(f))||0,g[p]=v?n:0,m||(o.css(c?"bottom":"right",0).css(c?"top":"left","auto").css({position:"absolute"}),g[f]=v?a:n+a),v&&(s.css(p,0),m||s.css(f,a+n)),s.animate(g,{duration:t.duration,easing:t.easing,queue:!1,complete:function(){"hide"===u&&o.hide(),e.effects.restore(o,l),e.effects.removeWrapper(o),i()}})},e.effects.effect.bounce=function(t,i){var s,n,a,o=e(this),r=["position","top","bottom","left","right","height","width"],h=e.effects.setMode(o,t.mode||"effect"),l="hide"===h,u="show"===h,d=t.direction||"up",c=t.distance,p=t.times||5,f=2*p+(u||l?1:0),m=t.duration/f,g=t.easing,v="up"===d||"down"===d?"top":"left",y="up"===d||"left"===d,b=o.queue(),_=b.length;for((u||l)&&r.push("opacity"),e.effects.save(o,r),o.show(),e.effects.createWrapper(o),c||(c=o["top"===v?"outerHeight":"outerWidth"]()/3),u&&(a={opacity:1},a[v]=0,o.css("opacity",0).css(v,y?2*-c:2*c).animate(a,m,g)),l&&(c/=Math.pow(2,p-1)),a={},a[v]=0,s=0;p>s;s++)n={},n[v]=(y?"-=":"+=")+c,o.animate(n,m,g).animate(a,m,g),c=l?2*c:c/2;l&&(n={opacity:0},n[v]=(y?"-=":"+=")+c,o.animate(n,m,g)),o.queue(function(){l&&o.hide(),e.effects.restore(o,r),e.effects.removeWrapper(o),i()}),_>1&&b.splice.apply(b,[1,0].concat(b.splice(_,f+1))),o.dequeue()},e.effects.effect.clip=function(t,i){var s,n,a,o=e(this),r=["position","top","bottom","left","right","height","width"],h=e.effects.setMode(o,t.mode||"hide"),l="show"===h,u=t.direction||"vertical",d="vertical"===u,c=d?"height":"width",p=d?"top":"left",f={};e.effects.save(o,r),o.show(),s=e.effects.createWrapper(o).css({overflow:"hidden"}),n="IMG"===o[0].tagName?s:o,a=n[c](),l&&(n.css(c,0),n.css(p,a/2)),f[c]=l?a:0,f[p]=l?0:a/2,n.animate(f,{queue:!1,duration:t.duration,easing:t.easing,complete:function(){l||o.hide(),e.effects.restore(o,r),e.effects.removeWrapper(o),i()}})},e.effects.effect.drop=function(t,i){var s,n=e(this),a=["position","top","bottom","left","right","opacity","height","width"],o=e.effects.setMode(n,t.mode||"hide"),r="show"===o,h=t.direction||"left",l="up"===h||"down"===h?"top":"left",u="up"===h||"left"===h?"pos":"neg",d={opacity:r?1:0};e.effects.save(n,a),n.show(),e.effects.createWrapper(n),s=t.distance||n["top"===l?"outerHeight":"outerWidth"](!0)/2,r&&n.css("opacity",0).css(l,"pos"===u?-s:s),d[l]=(r?"pos"===u?"+=":"-=":"pos"===u?"-=":"+=")+s,n.animate(d,{queue:!1,duration:t.duration,easing:t.easing,complete:function(){"hide"===o&&n.hide(),e.effects.restore(n,a),e.effects.removeWrapper(n),i()}})},e.effects.effect.explode=function(t,i){function s(){b.push(this),b.length===d*c&&n()}function n(){p.css({visibility:"visible"}),e(b).remove(),m||p.hide(),i()}var a,o,r,h,l,u,d=t.pieces?Math.round(Math.sqrt(t.pieces)):3,c=d,p=e(this),f=e.effects.setMode(p,t.mode||"hide"),m="show"===f,g=p.show().css("visibility","hidden").offset(),v=Math.ceil(p.outerWidth()/c),y=Math.ceil(p.outerHeight()/d),b=[];for(a=0;d>a;a++)for(h=g.top+a*y,u=a-(d-1)/2,o=0;c>o;o++)r=g.left+o*v,l=o-(c-1)/2,p.clone().appendTo("body").wrap("
").css({position:"absolute",visibility:"visible",left:-o*v,top:-a*y}).parent().addClass("ui-effects-explode").css({position:"absolute",overflow:"hidden",width:v,height:y,left:r+(m?l*v:0),top:h+(m?u*y:0),opacity:m?0:1}).animate({left:r+(m?0:l*v),top:h+(m?0:u*y),opacity:m?1:0},t.duration||500,t.easing,s)},e.effects.effect.fade=function(t,i){var s=e(this),n=e.effects.setMode(s,t.mode||"toggle");s.animate({opacity:n},{queue:!1,duration:t.duration,easing:t.easing,complete:i})},e.effects.effect.fold=function(t,i){var s,n,a=e(this),o=["position","top","bottom","left","right","height","width"],r=e.effects.setMode(a,t.mode||"hide"),h="show"===r,l="hide"===r,u=t.size||15,d=/([0-9]+)%/.exec(u),c=!!t.horizFirst,p=h!==c,f=p?["width","height"]:["height","width"],m=t.duration/2,g={},v={};e.effects.save(a,o),a.show(),s=e.effects.createWrapper(a).css({overflow:"hidden"}),n=p?[s.width(),s.height()]:[s.height(),s.width()],d&&(u=parseInt(d[1],10)/100*n[l?0:1]),h&&s.css(c?{height:0,width:u}:{height:u,width:0}),g[f[0]]=h?n[0]:u,v[f[1]]=h?n[1]:0,s.animate(g,m,t.easing).animate(v,m,t.easing,function(){l&&a.hide(),e.effects.restore(a,o),e.effects.removeWrapper(a),i()})},e.effects.effect.highlight=function(t,i){var s=e(this),n=["backgroundImage","backgroundColor","opacity"],a=e.effects.setMode(s,t.mode||"show"),o={backgroundColor:s.css("backgroundColor")};"hide"===a&&(o.opacity=0),e.effects.save(s,n),s.show().css({backgroundImage:"none",backgroundColor:t.color||"#ffff99"}).animate(o,{queue:!1,duration:t.duration,easing:t.easing,complete:function(){"hide"===a&&s.hide(),e.effects.restore(s,n),i()}})},e.effects.effect.size=function(t,i){var s,n,a,o=e(this),r=["position","top","bottom","left","right","width","height","overflow","opacity"],h=["position","top","bottom","left","right","overflow","opacity"],l=["width","height","overflow"],u=["fontSize"],d=["borderTopWidth","borderBottomWidth","paddingTop","paddingBottom"],c=["borderLeftWidth","borderRightWidth","paddingLeft","paddingRight"],p=e.effects.setMode(o,t.mode||"effect"),f=t.restore||"effect"!==p,m=t.scale||"both",g=t.origin||["middle","center"],v=o.css("position"),y=f?r:h,b={height:0,width:0,outerHeight:0,outerWidth:0};"show"===p&&o.show(),s={height:o.height(),width:o.width(),outerHeight:o.outerHeight(),outerWidth:o.outerWidth()},"toggle"===t.mode&&"show"===p?(o.from=t.to||b,o.to=t.from||s):(o.from=t.from||("show"===p?b:s),o.to=t.to||("hide"===p?b:s)),a={from:{y:o.from.height/s.height,x:o.from.width/s.width},to:{y:o.to.height/s.height,x:o.to.width/s.width}},("box"===m||"both"===m)&&(a.from.y!==a.to.y&&(y=y.concat(d),o.from=e.effects.setTransition(o,d,a.from.y,o.from),o.to=e.effects.setTransition(o,d,a.to.y,o.to)),a.from.x!==a.to.x&&(y=y.concat(c),o.from=e.effects.setTransition(o,c,a.from.x,o.from),o.to=e.effects.setTransition(o,c,a.to.x,o.to))),("content"===m||"both"===m)&&a.from.y!==a.to.y&&(y=y.concat(u).concat(l),o.from=e.effects.setTransition(o,u,a.from.y,o.from),o.to=e.effects.setTransition(o,u,a.to.y,o.to)),e.effects.save(o,y),o.show(),e.effects.createWrapper(o),o.css("overflow","hidden").css(o.from),g&&(n=e.effects.getBaseline(g,s),o.from.top=(s.outerHeight-o.outerHeight())*n.y,o.from.left=(s.outerWidth-o.outerWidth())*n.x,o.to.top=(s.outerHeight-o.to.outerHeight)*n.y,o.to.left=(s.outerWidth-o.to.outerWidth)*n.x),o.css(o.from),("content"===m||"both"===m)&&(d=d.concat(["marginTop","marginBottom"]).concat(u),c=c.concat(["marginLeft","marginRight"]),l=r.concat(d).concat(c),o.find("*[width]").each(function(){var i=e(this),s={height:i.height(),width:i.width(),outerHeight:i.outerHeight(),outerWidth:i.outerWidth()};f&&e.effects.save(i,l),i.from={height:s.height*a.from.y,width:s.width*a.from.x,outerHeight:s.outerHeight*a.from.y,outerWidth:s.outerWidth*a.from.x},i.to={height:s.height*a.to.y,width:s.width*a.to.x,outerHeight:s.height*a.to.y,outerWidth:s.width*a.to.x},a.from.y!==a.to.y&&(i.from=e.effects.setTransition(i,d,a.from.y,i.from),i.to=e.effects.setTransition(i,d,a.to.y,i.to)),a.from.x!==a.to.x&&(i.from=e.effects.setTransition(i,c,a.from.x,i.from),i.to=e.effects.setTransition(i,c,a.to.x,i.to)),i.css(i.from),i.animate(i.to,t.duration,t.easing,function(){f&&e.effects.restore(i,l)})})),o.animate(o.to,{queue:!1,duration:t.duration,easing:t.easing,complete:function(){0===o.to.opacity&&o.css("opacity",o.from.opacity),"hide"===p&&o.hide(),e.effects.restore(o,y),f||("static"===v?o.css({position:"relative",top:o.to.top,left:o.to.left}):e.each(["top","left"],function(e,t){o.css(t,function(t,i){var s=parseInt(i,10),n=e?o.to.left:o.to.top;return"auto"===i?n+"px":s+n+"px"})})),e.effects.removeWrapper(o),i()}})},e.effects.effect.scale=function(t,i){var s=e(this),n=e.extend(!0,{},t),a=e.effects.setMode(s,t.mode||"effect"),o=parseInt(t.percent,10)||(0===parseInt(t.percent,10)?0:"hide"===a?0:100),r=t.direction||"both",h=t.origin,l={height:s.height(),width:s.width(),outerHeight:s.outerHeight(),outerWidth:s.outerWidth()},u={y:"horizontal"!==r?o/100:1,x:"vertical"!==r?o/100:1};n.effect="size",n.queue=!1,n.complete=i,"effect"!==a&&(n.origin=h||["middle","center"],n.restore=!0),n.from=t.from||("show"===a?{height:0,width:0,outerHeight:0,outerWidth:0}:l),n.to={height:l.height*u.y,width:l.width*u.x,outerHeight:l.outerHeight*u.y,outerWidth:l.outerWidth*u.x},n.fade&&("show"===a&&(n.from.opacity=0,n.to.opacity=1),"hide"===a&&(n.from.opacity=1,n.to.opacity=0)),s.effect(n)},e.effects.effect.puff=function(t,i){var s=e(this),n=e.effects.setMode(s,t.mode||"hide"),a="hide"===n,o=parseInt(t.percent,10)||150,r=o/100,h={height:s.height(),width:s.width(),outerHeight:s.outerHeight(),outerWidth:s.outerWidth()};e.extend(t,{effect:"scale",queue:!1,fade:!0,mode:n,complete:i,percent:a?o:100,from:a?h:{height:h.height*r,width:h.width*r,outerHeight:h.outerHeight*r,outerWidth:h.outerWidth*r}}),s.effect(t)},e.effects.effect.pulsate=function(t,i){var s,n=e(this),a=e.effects.setMode(n,t.mode||"show"),o="show"===a,r="hide"===a,h=o||"hide"===a,l=2*(t.times||5)+(h?1:0),u=t.duration/l,d=0,c=n.queue(),p=c.length;for((o||!n.is(":visible"))&&(n.css("opacity",0).show(),d=1),s=1;l>s;s++)n.animate({opacity:d},u,t.easing),d=1-d;n.animate({opacity:d},u,t.easing),n.queue(function(){r&&n.hide(),i()}),p>1&&c.splice.apply(c,[1,0].concat(c.splice(p,l+1))),n.dequeue()},e.effects.effect.shake=function(t,i){var s,n=e(this),a=["position","top","bottom","left","right","height","width"],o=e.effects.setMode(n,t.mode||"effect"),r=t.direction||"left",h=t.distance||20,l=t.times||3,u=2*l+1,d=Math.round(t.duration/u),c="up"===r||"down"===r?"top":"left",p="up"===r||"left"===r,f={},m={},g={},v=n.queue(),y=v.length;for(e.effects.save(n,a),n.show(),e.effects.createWrapper(n),f[c]=(p?"-=":"+=")+h,m[c]=(p?"+=":"-=")+2*h,g[c]=(p?"-=":"+=")+2*h,n.animate(f,d,t.easing),s=1;l>s;s++)n.animate(m,d,t.easing).animate(g,d,t.easing);n.animate(m,d,t.easing).animate(f,d/2,t.easing).queue(function(){"hide"===o&&n.hide(),e.effects.restore(n,a),e.effects.removeWrapper(n),i()}),y>1&&v.splice.apply(v,[1,0].concat(v.splice(y,u+1))),n.dequeue()},e.effects.effect.slide=function(t,i){var s,n=e(this),a=["position","top","bottom","left","right","width","height"],o=e.effects.setMode(n,t.mode||"show"),r="show"===o,h=t.direction||"left",l="up"===h||"down"===h?"top":"left",u="up"===h||"left"===h,d={};e.effects.save(n,a),n.show(),s=t.distance||n["top"===l?"outerHeight":"outerWidth"](!0),e.effects.createWrapper(n).css({overflow:"hidden"}),r&&n.css(l,u?isNaN(s)?"-"+s:-s:s),d[l]=(r?u?"+=":"-=":u?"-=":"+=")+s,n.animate(d,{queue:!1,duration:t.duration,easing:t.easing,complete:function(){"hide"===o&&n.hide(),e.effects.restore(n,a),e.effects.removeWrapper(n),i()}})},e.effects.effect.transfer=function(t,i){var s=e(this),n=e(t.to),a="fixed"===n.css("position"),o=e("body"),r=a?o.scrollTop():0,h=a?o.scrollLeft():0,l=n.offset(),u={top:l.top-r,left:l.left-h,height:n.innerHeight(),width:n.innerWidth()},d=s.offset(),c=e("
").appendTo(document.body).addClass(t.className).css({top:d.top-r,left:d.left-h,height:s.innerHeight(),width:s.innerWidth(),position:a?"fixed":"absolute"}).animate(u,t.duration,t.easing,function(){c.remove(),i()})}});
-/* Jquery ui end */
-
-// Format currency
-(function($){$.formatCurrency={};$.formatCurrency.regions=[];$.formatCurrency.regions[""]={symbol:"$",positiveFormat:"%s%n",negativeFormat:"(%s%n)",decimalSymbol:".",digitGroupSymbol:",",groupDigits:true};
-$.fn.formatCurrency=function(destination,settings){if(arguments.length==1&&typeof destination!=="string"){settings=destination;destination=false
-}var defaults={name:"formatCurrency",colorize:false,region:"",global:true,roundToDecimalPlace:2,eventOnDecimalsEntered:false};defaults=$.extend(defaults,$.formatCurrency.regions[""]);
-settings=$.extend(defaults,settings);if(settings.region.length>0){settings=$.extend(settings,getRegionOrCulture(settings.region))}settings.regex=generateRegex(settings);
-return this.each(function(){$this=$(this);var num="0";num=$this[$this.is("input, select, textarea")?"val":"html"]();if(num.search("\\(")>=0){num="-"+num
-}if(num===""||(num==="-"&&settings.roundToDecimalPlace===-1)){return}if(isNaN(num)){num=num.replace(settings.regex,"");if(num===""||(num==="-"&&settings.roundToDecimalPlace===-1)){return
-}if(settings.decimalSymbol!="."){num=num.replace(settings.decimalSymbol,".")}if(isNaN(num)){num="0"}}var numParts=String(num).split(".");var isPositive=(num==Math.abs(num));
-var hasDecimals=(numParts.length>1);var decimals=(hasDecimals?numParts[1].toString():"0");var originalDecimals=decimals;num=Math.abs(numParts[0]);
-num=isNaN(num)?0:num;if(settings.roundToDecimalPlace>=0){decimals=parseFloat("1."+decimals);decimals=decimals.toFixed(settings.roundToDecimalPlace);
-if(decimals.substring(0,1)=="2"){num=Number(num)+1}decimals=decimals.substring(2)}num=String(num);if(settings.groupDigits){for(var i=0;i0){num+=settings.decimalSymbol+decimals
-}var format=isPositive?settings.positiveFormat:settings.negativeFormat;var money=format.replace(/%s/g,settings.symbol);money=money.replace(/%n/g,num);
-var $destination=$([]);if(!destination){$destination=$this}else{$destination=$(destination)}$destination[$destination.is("input, select, textarea")?"val":"html"](money);
-if(hasDecimals&&settings.eventOnDecimalsEntered&&originalDecimals.length>settings.roundToDecimalPlace){$destination.trigger("decimalsEntered",originalDecimals)
-}if(settings.colorize){$destination.css("color",isPositive?"black":"red")}})};$.fn.toNumber=function(settings){var defaults=$.extend({name:"toNumber",region:"",global:true},$.formatCurrency.regions[""]);
-settings=jQuery.extend(defaults,settings);if(settings.region.length>0){settings=$.extend(settings,getRegionOrCulture(settings.region))}settings.regex=generateRegex(settings);
-return this.each(function(){var method=$(this).is("input, select, textarea")?"val":"html";$(this)[method]($(this)[method]().replace("(","(-").replace(settings.regex,""))
-})};$.fn.asNumber=function(settings){var defaults=$.extend({name:"asNumber",region:"",parse:true,parseType:"Float",global:true},$.formatCurrency.regions[""]);
-settings=jQuery.extend(defaults,settings);if(settings.region.length>0){settings=$.extend(settings,getRegionOrCulture(settings.region))}settings.regex=generateRegex(settings);
-settings.parseType=validateParseType(settings.parseType);var method=$(this).is("input, select, textarea")?"val":"html";var num=$(this)[method]();
-num=num?num:"";num=num.replace("(","(-");num=num.replace(settings.regex,"");if(!settings.parse){return num}if(num.length==0){num="0"}if(settings.decimalSymbol!="."){num=num.replace(settings.decimalSymbol,".")
-}return window["parse"+settings.parseType](num)};function getRegionOrCulture(region){var regionInfo=$.formatCurrency.regions[region];if(regionInfo){return regionInfo
-}else{if(/(\w+)-(\w+)/g.test(region)){var culture=region.replace(/(\w+)-(\w+)/g,"$1");return $.formatCurrency.regions[culture]}}return null}function validateParseType(parseType){switch(parseType.toLowerCase()){case"int":return"Int";
-case"float":return"Float";default:throw"invalid parseType"}}function generateRegex(settings){if(settings.symbol===""){return new RegExp("[^\\d"+settings.decimalSymbol+"-]","g")
-}else{var symbol=settings.symbol.replace("$","\\$").replace(".","\\.");return new RegExp(symbol+"|[^\\d"+settings.decimalSymbol+"-]","g")}}})(jQuery);
-
-/*!
- * JavaScript Cookie v2.0.0-pre
- * https://github.com/js-cookie/js-cookie
- *
- * Copyright 2006, 2015 Klaus Hartl
- * Released under the MIT license
- */
-!function(e){if("function"==typeof define&&define.amd)define(e);else if("object"==typeof exports)module.exports=e();else{var n=window.Cookies,o=window.Cookies=e(window.jQuery);o.noConflict=function(){return window.Cookies=n,o}}}(function(){function e(){for(var e=0,n={};e1){if(i=e({path:"/"},t.defaults,i),"number"==typeof i.expires){var s=new Date;s.setMilliseconds(s.getMilliseconds()+864e5*i.expires),i.expires=s}try{c=JSON.stringify(r),/^[\{\[]/.test(c)&&(r=c)}catch(a){}return r=encodeURIComponent(String(r)),r=r.replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g,decodeURIComponent),n=encodeURIComponent(String(n)),n=n.replace(/%(23|24|26|2B|5E|60|7C)/g,decodeURIComponent),n=n.replace(/[\(\)]/g,escape),document.cookie=[n,"=",r,i.expires&&"; expires="+i.expires.toUTCString(),i.path&&"; path="+i.path,i.domain&&"; domain="+i.domain,i.secure&&"; secure"].join("")}n||(c={});for(var p=document.cookie?document.cookie.split("; "):[],u=/(%[0-9A-Z]{2})+/g,d=0;d
- */
-
-/**
- * Peafowl DOM functions and event listeners
- */
-$(function(){
-
- $.ajaxSetup({
- "url": PF.obj.config.json_api,
- "cache": false,
- "dataType": "json",
- "data": {auth_token: PF.obj.config.auth_token}
- });
-
- /**
- * WINDOW LISTENERS
- * -------------------------------------------------------------------------------------------------
- */
- $(window).bind("beforeunload",function(){
- if($("form", PF.obj.modal.selectors.root).data("beforeunload") == "continue") return;
- if($(PF.obj.modal.selectors.root).is(":visible") && PF.fn.form_modal_has_changed()) {
- return PF.fn._s("All the changes that you have made will be lost if you continue.");
- }
- });
-
- $(window).bind("hashchange", function(){
- // Call edit modal on #edit
- if(window.location.hash=="#edit" && !$(PF.obj.modal.selectors.root).exists()) $("[data-modal=edit]").first().click();
- });
-
- // Blind the tipTips on load
- PF.fn.bindtipTip();
-
- var resizeTimer, scrollTimer, width = $(window).width();
- // Fluid width on resize
- $(window).on("resize", function(){
-
- PF.fn.growl.fixPosition();
- PF.fn.modal.fixScrollbars();
-
- var device = PF.fn.getDeviceName(),
- handled = ["phone", "phablet"],
- desktop = ["tablet", "laptop", "desktop"];
-
- clearTimeout(resizeTimer);
- clearTimeout(scrollTimer);
-
- scrollTimer = setTimeout(function() {
- PF.obj.follow_scroll.set();
- }, 100);
-
- //PF.fn.window_to_device(); // handled by window event parent
- var new_device = PF.fn.getDeviceName();
-
- if(new_device !== device && ($.inArray(device, handled) >= 0 && $.inArray(new_device, handled) == -1) || ($.inArray(device, desktop) >= 0 && $.inArray(new_device, desktop) == -1)) {
- PF.fn.close_pops();
- }
-
- $(".top-bar").css("top", "");
- $(PF.fn.topMenu.vars.menu).css("height", $(window).height());
-
- $("body").css({position: "", height: ""});
-
- $(".antiscroll").removeClass("jsly").data("antiscroll", ""); // Destroy for this?
- $(".antiscroll-inner").css({height: "", width: "", maxheight: ""}); // .pop-box, .pop-box-inner ?
-
- PF.fn.list_fluid_width();
-
- if(width !== $(window).width()) {
-
- if($("[data-action=top-bar-menu-full]", "#top-bar").hasClass("current")) {
- PF.fn.topMenu.hide(0);
- }
-
- var cols_fn = function() {
- PF.fn.listing.columnizer(true, 0);
- $(PF.obj.listing.selectors.list_item).show();
- };
- cols_fn();
- }
-
- width = $(window).width();
-
- PF.obj.follow_scroll.process();
-
- });
-
- // Close the opened pop-boxes on HTML click
- $(document).on("click", "html", function(){
- PF.fn.close_pops();
- });
-
-
- /**
- * SMALL HELPERS AND THINGS
- * -------------------------------------------------------------------------------------------------
- */
-
- // Attemp to replace .svg with .png for browsers that doesn't support it
- if($("html").hasClass("no-svg")){
- $("img.replace-svg").replace_svg();
- }
-
- // Keydown numeric input (prevents non numeric keys)
- $(document).on("keydown", ".numeric-input", function(e){
- e.keydown_numeric();
- });
-
- // The handly data-scrollto. IT will scroll the elements to the target
- $(document).on("click", "[data-scrollto]", function(e) {
- var target = $(this).data("scrollto"),
- $target = $(!target.match(/^\#|\./) ? "#"+target : target);
-
- if($target.exists()) {
- PF.fn.scroll($target);
- } else {
- console.log("PF scrollto error: target doesn't exists", $target);
- }
- });
-
- // The handly data-trigger. It will trigger click for elements with data-trigger
- $(document).on("click", "[data-trigger]", function(e) {
-
- var trigger = $(this).data("trigger"),
- $target = $(!trigger.match(/^\#|\./) ? "#"+trigger : trigger);
-
- if($target.exists()) {
- e.stopPropagation();
- e.preventDefault();
- if(!$target.closest(PF.obj.modal.selectors.root).length) {
- PF.fn.modal.close();
- }
- $target.click();
- } else {
- console.log("PF trigger error: target doesn't exists", $target);
- }
- });
-
-
- // Fix the auth_token inputs
- $("form[method=post]").each(function() {
- if(!$("input[name=auth_token]", this).exists()) {
- $(this).append($(' ', {type: 'hidden', name: "auth_token", value: PF.obj.config.auth_token}));
- }
- });
-
- // Clear form like magic
- $(document).on("click", ".clear-form", function(){
- $(this).closest("form")[0].reset();
- });
-
- $(document).on("submit", "form[data-action=validate]", function(e) {
-
- var type = $(this).data("type"),
- errors = false,
- $validate = $(this).find("[required], [data-validate]");
-
- $validate.each(function() {
-
- var input_type = $(this).attr("type"),
- pattern = $(this).attr("pattern"),
- errorFn = function(el) {
- $(el).highlight();
- errors = true;
- };
-
- if($(this).is("[required]") && $(this).val() == "") {
- if($(this).is(":hidden")) {
- var $hidden_target = $($($(this).data("highlight")).exists() ? $(this).data("highlight") : "#" + $(this).data("highlight"));
- $($hidden_target).highlight();
- }
- errorFn(this);
- }
-
- if(typeof pattern == "undefined" && /mail|url/.test(input_type) == false) {
- return true;
- }
-
- if(pattern) {
- pattern = new RegExp(pattern);
- if(!pattern.test($(this).val())) {
- errorFn(this);
- }
- }
-
- if(input_type == "email" && !$(this).val().isEmail()) {
- errorFn(this);
- }
-
- });
-
- if(errors) {
- PF.fn.growl.expirable(PF.fn._s("Check the errors in the form to continue."));
- return false;
- }
- });
-
- // Co-combo breaker
- $(document).on("change", "select[data-combo]", function(){
-
- var $combo = $("#"+$(this).data("combo"));
-
- if($combo.exists()) {
- $combo.children(".switch-combo").hide();
- }
-
- var $combo_container = $("#" + $(this).closest("select").data("combo")),
- $combo_target = $("[data-combo-value~=" + $("option:selected", this).attr("value") + "]", $combo_container);
-
- if($combo_target.exists()){
- $combo_target
- .show()
- .find("[data-required]")
- .each(function() {
- $(this).attr("required", "required"); // re-enable any disabled required
- });
- }
-
- // Disable [required] in hidden combos
- $(".switch-combo", $combo_container).each(function() {
- if($(this).is(":visible")) return;
- $("[required]", this).attr("data-required", true).removeAttr("required");
- });
-
- });
-
- // Y COMO DICE: ESCAPE FROM THE PLANET OF THE APES
- $(document).on("keyup", function(e) {
- $this = $(e.target);
- if(e.keyCode == 27) {
- if($(PF.obj.modal.selectors.root).is(":visible") && !$this.is(":input")) {
- $("[data-action=cancel],[data-action=close-modal]", PF.obj.modal.selectors.root).first().click();
- }
- }
- });
-
- // Input events
- $(document).on("change", ":input", function(e){
- PF.fn.growl.close();
- });
- $(document).on("keyup", ":input", function(e){
- $(".input-warning", $(this).closest(".input-label")).html("");
- });
- $(document).on("blur", ":input", function(){
- var this_val = $.trim($(this).prop("value"));
- $(this).prop("value", this_val);
- });
-
- // Select all on an input type
- $(document).on("click", ":input[data-focus=select-all]", function() {
- this.select();
- });
-
- // Input password strength
- $(document).on("keyup change blur", ":input[type=password]", function(){
- var password = testPassword($(this).val()),
- $parent = $(this).closest("div");
-
- if($(this).val() == "") {
- password.percent = 0;
- password.verdict = "";
- }
-
- $("[data-content=password-meter-bar]", $parent).width(password.percent);
- $("[data-text=password-meter-message]", $parent).removeClass("red-warning").text(password.verdict !== "" ? PF.fn._s(password.verdict) : "");
-
- });
-
- // Popup links
- $(document).on("click", "[rel=popup-link], .popup-link", function(e){
- e.preventDefault();
- var href = $(this)[typeof $(this).attr("href") !== "undefined" ? "attr" : "data"]("href");
- if(typeof href == "undefined") {
- return;
- }
- if(href.substring(0, 6) == "mailto" && PF.fn.isDevice(["phone", "phablet"])) {
- window.location = href;
- return false;
- }
- PF.fn.popup({href: href});
- });
-
- /**
- * FOWLLOW SCROLL
- * -------------------------------------------------------------------------------------------------
- */
- $(window).scroll(function(){
- PF.obj.follow_scroll.process(); // todo:optimize
- });
-
-
- /**
- * MODAL
- * -------------------------------------------------------------------------------------------------
- */
-
- // Call plain simple HTML modal
- $(document).on("click", "[data-modal=simple],[data-modal=html]", function(){
- var $target = $("[data-modal=" + $(this).data("target") + "], #"+$(this).data("target")).first();
- PF.fn.modal.call({template: $target.html(), buttons: false});
- });
-
- // Prevent modal submit form since we only use the form in the modal to trigger HTML5 validation
- $(document).on("submit", PF.obj.modal.selectors.root + " form", function(e){
- if($(this).data("prevented")) return false; // Don't send the form if is prevented
- if(typeof $(this).attr("method") !== "undefined") return; // Don't bind anything extra if is normal form
- return false; // Prevent default form handling
- });
-
- // Form/editable/confirm modal
- $(document).on("click", "[data-modal=edit],[data-modal=form],[data-confirm]", function(e){
-
- e.preventDefault();
-
- var $this = $(this),
- $target, submit_function, cancel_function, onload_function, submit_done_msg;
-
- if($this.is("[data-confirm]")) {
- $target = $this;
- PF.obj.modal.type = "confirm";
- } else {
-
- $target = $("[data-modal=" + $this.data("target") + "], #"+$this.data("target")).first();
-
- if($target.length == 0) {
- $target = $("[data-modal=form-modal], #form-modal").first();
- }
-
- if($target.length == 0) {
- console.log("PF Error: Modal target doesn't exists.");
- }
-
- PF.obj.modal.type = $this.data("modal");
- }
-
- var args = $this.data("args"),
- submit_function = window[$target.data("submit-fn")],
- cancel_function = window[$target.data("cancel-fn")],
- onload_function = window[$target.data("load-fn")],
- submit_done_msg = $target.data("submit-done"),
- ajax = {
- url: $target.data("ajax-url"),
- deferred: window[$target.data("ajax-deferred")]
- };
-
- // Window functions failed? Maybe those are named fn...
- if(typeof submit_function !== "function" && $target.data("submit-fn")) {
- var submit_fn_split = $target.data("submit-fn").split(".");
- submit_function = window;
- for(var i=0; i'+PF.fn._s("All the changes that you have made will be lost if you continue.")+' ');
- $(PF.obj.modal.selectors.changes_confirm).css("margin-top", -$(PF.obj.modal.selectors.changes_confirm).outerHeight(true)/2).hide().fadeIn("fast");
- } else {
- PF.fn.modal.close();
- if(window.location.hash=="#edit") window.location.hash = "";
- }
- },
- load: function() {
- if(typeof load_function == "function") load_function();
- },
- callback: function(){},
- ajax: ajax
- };
- PF.fn.modal.call($.extend(default_options, inline_options));
- }
-
- });
-
- // Check user login modal -> Must be login to continue
- if(!PF.fn.is_user_logged()){
- $("[data-login-needed]:input, [data-user-logged=must]:input").each(function(){
- $(this).attr("readonly", true);
- });
- }
- // nota: update junkstr
- $(document).on("click focus", "[data-login-needed], [data-user-logged=must]", function(e) {
- if(!PF.fn.is_user_logged()){
- e.preventDefault();
- e.stopPropagation();
- if($(this).is(":input")) $(this).attr("readonly", true).blur();
- PF.fn.modal.call({type: "login"});
- }
- });
-
- // Modal form keydown listener
- $(document).on("keydown", PF.obj.modal.selectors.root + " input", function(e){ // nota: solia ser keyup
- var $this = $(e.target),
- key = e.charCode || e.keyCode;
- if(key !== 13){
- PF.fn.growl.close();
- return;
- }
- if(key==13 && $("[data-action=submit]", PF.obj.modal.selectors.root).exists() && !$this.is(".prevent-submit")){ // 13 == enter key
- $("[data-action=submit]", PF.obj.modal.selectors.root).click();
- }
- });
-
-
- // Trigger modal edit on hash #edit
- // It must be placed after the event listener
- if(window.location.hash && window.location.hash=="#edit"){
- $("[data-modal=edit]").first().click();
- }
-
- /**
- * MOBILE TOP BAR MENU
- * -------------------------------------------------------------------------------------------------
- */
- $(document).on("click", "[data-action=top-bar-menu-full]", function() {
- var hasClass = $('[data-action=top-bar-menu-full]', "#top-bar").hasClass("current");
- PF.fn.topMenu[hasClass ? "hide" : "show"]();
- });
-
- /**
- * SEARCH INPUT
- * -------------------------------------------------------------------------------------------------
- */
-
- // Top-search feature
- $(document).on("click", "[data-action=top-bar-search]", function(){
- $("[data-action=top-bar-search-input]", ".top-bar").removeClass("hidden").show();
- $("[data-action=top-bar-search-input]:visible input").first().focus();
- if(is_ios() && !$(this).closest(PF.fn.topMenu.vars.menu).exists()) {
- $('.top-bar').css('position', 'absolute');
- }
- $("[data-action=top-bar-search]", ".top-bar").hide();
- });
-
- // Search icon click -> focus input
- $(document).on("click", ".input-search .icon-search", function(e){
- $("input", e.currentTarget.offsetParent).focus();
- });
-
- // Clean search input
- $(document).on("click", ".input-search .icon-close, .input-search [data-action=clear-search]", function(e){
- var $input = $("input", e.currentTarget.offsetParent);
-
- if($input.val()==""){
- if($(this).closest("[data-action=top-bar-search-input]").exists()){
- $("[data-action=top-bar-search-input]", ".top-bar").hide();
- $("[data-action=top-bar-search]", ".top-bar").removeClass("opened").show();
- if(is_ios() && $(this).closest("#top-bar").css("position") !== "fixed") {
- $('.top-bar').css('position', 'fixed');
- }
- }
- } else {
- if(!$(this).closest("[data-action=top-bar-search-input]").exists()){
- $(this).hide();
- }
- $input.val("").change();
- }
- });
-
- // Input search clear search toggle
- $(document).on("keyup change", "input.search", function(e){
- var $input = $(this),
- $div = $(this).closest(".input-search");
- if(!$(this).closest("[data-action=top-bar-search-input]").exists()) {
- var todo = $input.val() == "" ? "hide" : "show";
- $(".icon-close, [data-action=clear-search]", $div)[todo]();
- }
- });
-
- /**
- * POP BOXES (MENUS)
- * -------------------------------------------------------------------------------------------------
- */
- $(document).on("click mouseenter", ".pop-btn", function(e) {
-
- if(PF.fn.isDevice(["phone", "phablet"]) && (e.type=="mouseenter" || $(this).hasClass("pop-btn-desktop"))) {
- return;
- }
-
- var $this_click = $(e.target),
- $pop_btn, $pop_box,
- devices = $.makeArray(["phone", "phablet"]);
-
- var $this = $(this);
-
- if(e.type=="mouseenter" && !$(this).hasClass("pop-btn-auto")) return;
- if($(this).hasClass("disabled") || (($this_click.closest(".current").exists() && !PF.fn.isDevice("phone")) && !$this_click.closest(".pop-btn-show").exists())) {
- return;
- }
-
- PF.fn.growl.close();
-
- e.stopPropagation();
-
- $pop_btn = $(this);
- $pop_box = $(".pop-box", $pop_btn);
- $pop_btn.addClass("opened");
-
- $(".pop-box-inner", $pop_box).css("max-height", "");
-
- if(PF.fn.isDevice(devices)) {
- var text = $('.btn-text,.text,.pop-btn-text', $pop_btn).first().text();
- if(typeof text == "undefined" || text == "") {
- text = PF.fn._s("Select");
- }
- if(!$(".pop-box-header", $pop_box).exists()) {
- $pop_box.prepend($('
', {
- "class": 'pop-box-header',
- "html": text + ' '
- }));
- }
- } else {
- $('.pop-box-header', $pop_box).remove();
- $pop_box.css({bottom: ''});
- }
-
- if($pop_box.hasClass("anchor-center")){
- if(!PF.fn.isDevice(devices)) {
- $pop_box.css("margin-left", -($pop_box.width()/2));
- } else {
- $pop_box.css("margin-left", "");
- }
- }
-
- // Pop button changer
- if($this_click.is("[data-change]")){
- $("li", $pop_box).removeClass("current");
- $this_click.closest("li").addClass("current");
- $("[data-text-change]", $pop_btn).text($("li.current a", $pop_box).text());
- e.preventDefault();
- }
-
- if(!$pop_box.exists()) return;
-
- // Click inside the bubble only for .pop-keep-click
- var $this = e.istriggered ? $(e.target) : $(this);
- if($pop_box.is(":visible") && $(e.target).closest(".pop-box-inner").exists() && $this.hasClass("pop-keep-click")){
- return;
- }
-
- $(".pop-box:visible").not($pop_box).hide().closest(".pop-btn").removeClass("opened");
-
- var callback = function($pop_box) {
- if(!$pop_box.is(":visible")){
- $pop_box.closest(".pop-btn").removeClass("opened");
- } else {
- if(!PF.fn.isDevice(devices)) {
- $(".antiscroll-wrap:not(.jsly):visible", $pop_box).addClass("jsly").antiscroll();
- } else {
- $(".antiscroll-inner", $pop_box).height("100%");
- }
- }
- };
-
- if(PF.fn.isDevice(devices)) {
-
- if($(this).is("[data-action=top-bar-notifications]")) {
- $pop_box.css({height: $(window).height()});
- }
- var pop_box_h = $pop_box.height()+'px';
-
- var menu_top = (parseInt($(".top-bar").outerHeight()) + parseInt($(".top-bar").css("top")) + parseInt($(".top-bar").css("margin-top")) + parseInt($(".top-bar").css("margin-bottom"))) + "px";
-
- // hide
- if($pop_box.is(":visible")) {
- $('#pop-box-mask').css({opacity: 0});
- $pop_box.css({transform: "none"});
- if($this.closest(PF.fn.topMenu.vars.menu).exists()) {
- $(".top-bar").css({transform: "none"});
- $(PF.fn.topMenu.vars.menu).css({
- height: $(window).height() + parseInt(menu_top),
- });
- }
- setTimeout(function() {
- $pop_box.hide().attr("style", "");
- $('#pop-box-mask').remove();
- callback($pop_box);
- if($this.closest(PF.fn.topMenu.vars.menu).exists()) {
- $(PF.fn.topMenu.vars.menu).css({
- height: "",
- });
- $(PF.fn.topMenu.vars.menu).animate({scrollTop: PF.fn.topMenu.vars.scrollTop}, PF.obj.config.animation.normal / 2);
- }
- }, PF.obj.config.animation.normal);
- if(!$("body").data("hasOverflowHidden")) {
- $("body").removeClass("overflow-hidden");
- }
-
-
- } else { // show
- $('#pop-box-mask').remove();
- $pop_box.parent().prepend($('
', {
- "id": 'pop-box-mask',
- "class": 'fullscreen soft-black'
- }).css({
- zIndex: 400,
- display: "block"
- }));
- PF.fn.topMenu.vars.scrollTop = $(PF.fn.topMenu.vars.menu).scrollTop();
- setTimeout(function() {
- $("#pop-box-mask").css({opacity: 1});
- setTimeout(function() {
- $pop_box.show().css({
- bottom: '-' + pop_box_h,
- maxHeight: $(window).height(),
- zIndex: 1000,
- transform: "translate(0,-"+pop_box_h+")"
- });
-
- setTimeout(function() {
- callback($pop_box);
- }, PF.obj.config.animation.normal);
-
- if($("body").hasClass("overflow-hidden")) {
- $("body").data("hasOverflowHidden", 1);
- } else {
- $("body").addClass("overflow-hidden");
- }
-
- if($this.closest(PF.fn.topMenu.vars.menu).exists()) {
- $(".top-bar").css({transform: "translate(0, -" + menu_top + ")"});
- $(PF.fn.topMenu.vars.menu).css({
- height: $(window).height() + parseInt(menu_top),
- });
- }
- $(".pop-box-inner", $pop_box).css("height", $pop_box.height() - $('.pop-box-header', $pop_box).outerHeight(true));
-
- }, 1);
-
- }, 1);
-
-
- }
- } else {
- $pop_box["fade" + ($pop_box.is(":visible") ? "Out" : "In")](50, function() {
- callback($pop_box);
- });
- //$pop_box.toggle();
- //callback($pop_box);
- }
-
-
- }).on("mouseleave", ".pop-btn", function(){
- if(!PF.fn.isDevice(["laptop", "desktop"])) {
- return;
- }
- var $pop_btn = $(this),
- $pop_box = $(".pop-box", $pop_btn);
-
- if(!$pop_btn.hasClass("pop-btn-auto") || (PF.fn.isDevice(["phone", "phablet"]) && $pop_btn.hasClass("pop-btn-auto"))) {
- return;
- }
-
- if(!PF.fn.isDevice(['phone', 'phablet', 'tablet']) && $(this).hasClass("pop-btn-delayed")) {
- $(this).removeClass("pop-btn-auto");
- }
-
- $pop_box.hide().closest(".pop-btn").removeClass("opened");
- });
-
- $(".pop-btn-delayed").delayedAction(
- {
- delayedAction: function($element) {
- if(PF.fn.isDevice(['phone', 'phablet', 'tablet'])) return;
- var $el = $(".pop-box-inner", $element);
- if($el.is(":hidden")) {
- $element.addClass("pop-btn-auto").click();
- }
- },
- hoverTime: 2000
- }
- );
-
- /**
- * TABS
- * -------------------------------------------------------------------------------------------------
- */
-
- // Hash on load (static tabs) changer
- if(window.location.hash){
- /*
- var $hash_node = $("[href="+ window.location.hash +"]");
-
- if($hash_node.exists()) {
- $.each($("[href="+ window.location.hash +"]")[0].attributes, function(){
- PF.obj.tabs.hashdata[this.name] = this.value;
- });
- PF.obj.tabs.hashdata.pushed = "tabs";
- History.replaceState({
- href: window.location.hash,
- "data-tab": $("[href="+ window.location.hash +"]").data("tab"),
- pushed: "tabs",
- statenum: 0
- }, null, null);
- }
- */
- }
-
- // Stock tab onload data
- if($(".content-tabs").exists()/* && !window.location.hash*/) {
- var $tab = $("a", ".content-tabs .current");
- History.replaceState({
- href: $tab.attr("href"),
- "data-tab": $tab.data("tab"),
- pushed: "tabs",
- statenum: 0
- }, null, null);
- }
-
- // Keep scroll position (history.js)
- var State = History.getState();
- if(typeof State.data == "undefined") {
- History.replaceState({scrollTop: 0}, document.title, window.location.href); // Stock initial scroll
- }
- History.Adapter.bind(window,"popstate", function(){
- var State = History.getState();
- if(State.data && typeof State.data.scrollTop !== "undefined") {
- if($(window).scrollTop() !== State.data.scrollTop) {
- $(window).scrollTop(State.data.scrollTop);
- }
- }
- return;
- });
-
- // Toggle tab display
- $("a", ".content-tabs").click(function(e) {
-
- if($(this).data("link") == true) {
- $(this).data("tab", false);
- }
-
- if($(this).closest(".current,.disabled").exists()){
- e.preventDefault();
- return;
- }
- if(typeof $(this).data("tab") == "undefined") return;
-
- var dataTab = {};
- $.each(this.attributes, function(){
- dataTab[this.name] = this.value;
- });
- dataTab.pushed = "tabs";
-
- // This helps to avoid issues on ?same and ?same#else
- /*dataTab.statenum = 0;
- console.log({
- data: History.getState().data,
- state: History.getState().data.statenum
- })
- if(History.getState().data && typeof History.getState().data.statenum !== "undefined") {
- dataTab.statenum = History.getState().data.statenum + 1
- }*/
-
- /*if($(this).attr("href") && $(this).attr("href").indexOf("#") === 0) { // to ->#Hash
- PF.obj.tabs.hashdata = dataTab;
- if(typeof e.originalEvent == "undefined") {
- window.location.hash = PF.obj.tabs.hashdata.href.substring(1);
- }
- } else { // to ->?anything
- if($("#" + dataTab["data-tab"]).data("load") != "classic") {
- History.pushState(dataTab, document.title, $(this).attr("href"));
- e.preventDefault();
- }
- }
- */
- if($("#" + dataTab["data-tab"]).data("load") != "classic") {
- if(window.location.hash) {
- var url = window.location.href;
- url = url.replace(window.location.hash, "");
- }
- History.pushState(dataTab, document.title, (typeof url !== "undefined") ? url : $(this).attr("href"));
- e.preventDefault();
- }
-
- var $tab_menu = $("[data-action=tab-menu]", $(this).closest(".header"));
-
- $tab_menu.find("[data-content=current-tab-label]").text($(this).text());
-
- if($tab_menu.is(":visible")) {
- $tab_menu.click();
- }
-
- });
-
- $(document).on("click", "[data-action=tab-menu]", function() {
- var $tabs = $(this).closest(".header").find(".content-tabs"),
- visible = $tabs.is(":visible"),
- $this = $(this);
- if(!visible) {
- $tabs.data("classes", $tabs.attr("class"));
- $tabs.removeClass(function (index, css) {
- return (css.match(/\b\w+-hide/g) || []).join(' ');
- });
- $tabs.hide();
- }
- if(!visible) {
- $this.removeClass("current");
- }
- $tabs[visible ? "hide" : "show"]();
- if(visible) {
- $tabs.css("display", "").addClass($tabs.data("classes"));
- $this.addClass("current");
- }
- });
-
- // On state change bind tab changes
- $(window).bind("statechange", function(e) {
- PF.fn.growl.close();
- var dataTab;
- dataTab = History.getState().data;
- /*
- if(e.type == "statechange"){
- dataTab = History.getState().data;
- } else if(e.type == "hashchange"){
-
- if(typeof PF.obj.tabs.hashdata !== "undefined" && typeof PF.obj.tabs.hashdata.href !== "undefined" && PF.obj.tabs.hashdata.href !== window.location.hash) {
- PF.obj.tabs.hashdata = null;
- }
- if(PF.obj.tabs.hashdata == null) {
- var $target = $("[href="+ window.location.hash +"]", ".content-tabs");
- if(!$target.exists()) $target = $(window.location.hash);
- if(!$target.exists()) $target = $("a", ".content-tabs").first();
- if(typeof $target.data("tab") !== "undefined") {
- PF.obj.tabs.hashdata = {};
- $.each($target[0].attributes, function(){
- PF.obj.tabs.hashdata[this.name] = this.value;
- });
- PF.obj.tabs.hashdata.pushed = "tabs";
- }
- }
- dataTab = (typeof PF.obj.tabs.hashdata !== "undefined") ? PF.obj.tabs.hashdata : null;
- }
- */
- if(dataTab && dataTab.pushed == "tabs"){
- PF.fn.show_tab(dataTab["data-tab"]);
- }
- });
-
- /**
- * LISTING
- * -------------------------------------------------------------------------------------------------
- */
-
- // Stock the scroll position on list element click
- $(document).on("click", ".list-item a", function(e) {
- if($(this).attr("src") == "") return;
- History.replaceState({scrollTop: $(window).scrollTop()}, document.title, window.location.href);
- });
-
- // Load more (listing +1 page)
- $(document).on("click", "[data-action=load-more]", function(e){
-
- $(this).closest('.content-listing-more').hide();
-
- if(!PF.fn.is_listing() || $(this).closest(PF.obj.listing.selectors.content_listing).is(":hidden") || $(this).closest("#content-listing-template").exists() || PF.obj.listing.calling) return;
-
- PF.fn.listing.queryString.stock_new();
-
- // Page hack
- PF.obj.listing.query_string.page = $(PF.obj.listing.selectors.content_listing_visible).data("page");
- PF.obj.listing.query_string.page++;
-
- // Offset hack
- var offset = $(PF.obj.listing.selectors.content_listing_visible).data("offset");
-
- if(typeof offset !== "undefined") {
- PF.obj.listing.query_string.offset = offset;
- if(typeof PF.obj.listing.hidden_params == "undefined") {
- PF.obj.listing.hidden_params = {};
- }
- PF.obj.listing.hidden_params.offset = offset;
- } else {
- if(typeof PF.obj.listing.query_string.offset !== "undefined") {
- delete PF.obj.listing.query_string.offset;
- }
- if(PF.obj.listing.hidden_params && typeof PF.obj.listing.hidden_params.offset !== "undefined") {
- delete PF.obj.listing.hidden_params.offset;
- }
- }
-
- PF.fn.listing.ajax();
- e.preventDefault();
-
- });
-
- // List found on load html -> Do the columns!
- if($(PF.obj.listing.selectors.list_item).length > 0){
-
- PF.fn.listing.show();
-
- // Bind the infinte scroll
- $(window).scroll(function() {
- if(($(window).scrollTop() + $(window).height() > $(document).height() - 200) && PF.obj.listing.calling == false) {
- $(PF.obj.listing.selectors.content_listing_visible).find(PF.obj.listing.selectors.content_listing_pagination).find("[data-action=load-more]").click();
- }
- });
-
- }
-
- // Multi-selection tools
- $(document).on("click", PF.obj.modal.selectors.root+ " [data-switch]", function(){
- var $this_modal = $(this).closest(PF.obj.modal.selectors.root);
- $("[data-view=switchable]", $this_modal).hide();
- $("#"+$(this).attr("data-switch"), $this_modal).show();
- });
-
- $(document).on("click", "[data-toggle]", function() {
- var $target = $("[data-content=" + $(this).data("toggle") + "]"),
- show = !$target.is(":visible");
-
- $(this).html($(this).data('html-' + (show ? 'on' : 'off')));
-
- $target.toggle();
- });
-
- // Cookie law thing
- $(document).on("click", "[data-action=cookie-law-close]", function(){
- $("#cookie-law-banner").animate({bottom: "-100%"}, 300, function() {
- var cookieName = (typeof $(this).data("cookie") !== typeof undefined) ? $(this).data("cookie") : "PF_COOKIE_LAW_DISPLAY";
- Cookies.set(cookieName, 0, {expires: 365});
- $(this).remove();
- });
- });
-
- // One-click input copy
- $(document).on("click", "[data-action=copy]", function() {
-
- });
- Clipboard = new Clipboard("[data-action=copy]", {
- text: function(trigger) {
- var $target = $(trigger.getAttribute("data-action-target"));
- var text = $target.is(":input") ? $target.val() : $target.text();
- return text.trim();
- }
- });
- Clipboard.on('success', function(e) {
- var $target = $(e.trigger.getAttribute("data-action-target"));
- $target.highlight();
- e.clearSelection();
- });
-
-});
-
-/**
- * PEAFOWL OBJECT
- * -------------------------------------------------------------------------------------------------
- */
-var PF = {fn: {}, str: {}, obj: {}};
-
-/**
- * PEAFOWL CONFIG
- * -------------------------------------------------------------------------------------------------
- */
-PF.obj.config = {
- base_url: "",
- json_api: "/json/",
- listing: {
- items_per_page: 24
- },
- animation: {
- easingFn: "ease",
- normal: 400,
- fast: 250
- }
-};
-
-/**
- * WINDOW VARS
- * -------------------------------------------------------------------------------------------------
- */
-
-/**
- * LANGUAGE FUNCTIONS
- * -------------------------------------------------------------------------------------------------
- */
-PF.obj.l10n = {};
-
-/**
- * Get lang string by key
- * @argument string (lang key string)
- */
-// pf: get_pf_lang
-PF.fn._s = function(string, s){
- var string;
- if(typeof string == "undefined") {
- return string;
- }
- if(typeof PF.obj.l10n !== "undefined" && typeof PF.obj.l10n[string] !== "undefined") {
- string = PF.obj.l10n[string][0];
- if(typeof string == "undefined") {
- string = string;
- }
- } else {
- string = string;
- }
- string = string.toString();
- if(typeof s !== "undefined") {
- string = sprintf(string, s);
- }
- return string;
-};
-
-PF.fn._n = function(singular, plural, n){
- var string;
- if(typeof PF.obj.l10n !== "undefined" && typeof PF.obj.l10n[singular] !== "undefined") {
- string = PF.obj.l10n[singular][n == 1 ? 0 : 1];
- } else {
- string = n == 1 ? singular : plural;
- }
- string = typeof string == "undefined" ? singular : string.toString();
- if(typeof n !== "undefined") {
- string = sprintf(string, n);
- }
- return string;
-};
-
-/**
- * Extend Peafowl lang
- * Useful to add or replace strings
- * @argument strings obj
- */
-// pf: extend_pf_lang
-PF.fn.extend_lang = function(strings){
- $.each(PF.obj.lang_strings, function(i,v){
- if(typeof strings[i] !== "undefined") {
- $.extend(PF.obj.lang_strings[i], strings[i]);
- }
- });
-};
-
-/**
- * HELPER FUNCTIONS
- * -------------------------------------------------------------------------------------------------
- */
-
-PF.fn.get_url_vars = function(){
- var match,
- pl = /\+/g, // Regex for replacing addition symbol with a space
- search = /([^&=]+)=?([^&]*)/g,
- decode = function (s) {
- return decodeURIComponent(escape(s.replace(pl, " ")));
- },
- query = window.location.search.substring(1),
- urlParams = {};
-
- while(match = search.exec(query)){
- urlParams[decode(match[1])] = decode(match[2]);
- }
-
- return urlParams;
-
-};
-
-PF.fn.get_url_var = function(name){
- return PF.fn.get_url_vars()[name];
-};
-
-PF.fn.is_user_logged = function() {
- return $("#top-bar-user").is(":visible"); // nota: default version
- // It should use backend conditional
-};
-
-PF.fn.generate_random_string = function(len){
- if(typeof len == "undefined") len = 5;
- var text = "";
- var possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
- for(var i=0; i < len; i++){
- text += possible.charAt(Math.floor(Math.random() * possible.length));
- }
- return text;
-};
-
-PF.fn.getDateTime = function() {
- var now = new Date();
- var year = now.getFullYear();
- var month = now.getMonth()+1;
- var day = now.getDate();
- var hour = now.getHours();
- var minute = now.getMinutes();
- var second = now.getSeconds();
- if(month.toString().length == 1) {
- var month = '0'+month;
- }
- if(day.toString().length == 1) {
- var day = '0'+day;
- }
- if(hour.toString().length == 1) {
- var hour = '0'+hour;
- }
- if(minute.toString().length == 1) {
- var minute = '0'+minute;
- }
- if(second.toString().length == 1) {
- var second = '0'+second;
- }
- var dateTime = year+'-'+month+'-'+day+' '+hour+':'+minute+':'+second;
- return dateTime;
-};
-
-PF.fn.htmlEncode = function(value) {
- return $('
').text($.trim(value)).html();
-};
-
-PF.fn.htmlDecode = function(value) {
- return $('
').html($.trim(value)).text();
-};
-
-PF.fn.nl2br = function(str) {
- var breakTag = ' ';
- return (str + '').replace(/([^>\r\n]?)(\r\n|\n\r|\r|\n)/g, '$1'+ breakTag +'$2');
-};
-
-// https://gist.github.com/alexey-bass/1115557
-PF.fn.versionCompare = function(left, right) {
- if (typeof left + typeof right != 'stringstring')
- return false;
-
- var a = left.split('.')
- , b = right.split('.')
- , i = 0, len = Math.max(a.length, b.length);
-
- for (; i < len; i++) {
- if ((a[i] && !b[i] && parseInt(a[i]) > 0) || (parseInt(a[i]) > parseInt(b[i]))) {
- return 1;
- } else if ((b[i] && !a[i] && parseInt(b[i]) > 0) || (parseInt(a[i]) < parseInt(b[i]))) {
- return -1;
- }
- }
-
- return 0;
-}
-
-/**
- * Basename
- * http://stackoverflow.com/questions/3820381/need-a-basename-function-in-javascript
- */
-PF.fn.baseName = function(str) {
- var base = new String(str).substring(str.lastIndexOf('/') + 1);
- if(base.lastIndexOf(".") != -1) {
- base = base.substring(0, base.lastIndexOf("."));
- }
- return base;
-}
-
-PF.fn.guid = function() {
- function s4() {
- return Math.floor((1 + Math.random()) * 0x10000)
- .toString(16)
- .substring(1);
- }
- return s4() + s4() + '-' + s4() + '-' + s4() + '-' + s4() + '-' + s4() + s4() + s4();
-}
-
-PF.fn.md5 = function(string) {
- return SparkMD5.hash(string);
-}
-
-/**
- * dataURI to BLOB
- * http://stackoverflow.com/questions/4998908/convert-data-uri-to-file-then-append-to-formdata
- */
-PF.fn.dataURItoBlob = function(dataURI) {
- // convert base64/URLEncoded data component to raw binary data held in a string
- var byteString;
- if (dataURI.split(',')[0].indexOf('base64') >= 0) {
- byteString = atob(dataURI.split(',')[1]);
- } else {
- byteString = unescape(dataURI.split(',')[1]);
- }
- // separate out the mime component
- var mimeString = dataURI.split(',')[0].split(':')[1].split(';')[0];
- // write the bytes of the string to a typed array
- var ia = new Uint8Array(byteString.length);
- for (var i = 0; i < byteString.length; i++) {
- ia[i] = byteString.charCodeAt(i);
- }
- return new Blob([ia], {type:mimeString});
-}
-
-PF.fn.clean_facebook_hash = function() {
- if(window.location.hash == "#_=_") {
- window.location.hash = "";
- }
-};
-PF.fn.clean_facebook_hash();
-
-/**
- * Get the min and max value from 1D array
- */
-Array.min = function(array){
- return Math.min.apply(Math, array);
-};
-Array.max = function(array){
- return Math.max.apply(Math, array);
-};
-
-/**
- * Return the sum of all the values in a 1D array
- */
-Array.sum = function(array){
- return array.reduce(function(pv, cv){ return cv + pv});
-};
-
-/**
- * Return the size of an object
- */
-Object.size = function(obj) {
- var size = 0, key;
- for (key in obj) {
- if (obj.hasOwnProperty(key)) size++;
- }
- return size;
-};
-
-/**
- * Flatten an object
- */
-Object.flatten = function(obj, prefix) {
-
- if(typeof prefix == "undefined") var prefix = "";
-
- var result = {};
-
- $.each(obj, function(key, value) {
- if(!value) return;
- if(typeof value == "object") {
- result = $.extend({}, result, Object.flatten(value, prefix + key + '_'));
- } else {
- result[prefix + key] = value;
- }
- });
-
- return result;
-};
-
-/**
- * Tells if the string is a number or not
- */
-String.prototype.isNumeric = function(){
- return !isNaN(parseFloat(this)) && isFinite(this);
-};
-
-/**
- * Repeats an string
- */
-String.prototype.repeat = function(num){
- return new Array(num + 1).join(this);
-};
-
-/**
- * Ucfirst
- */
-String.prototype.capitalizeFirstLetter = function() {
- return this.charAt(0).toUpperCase() + this.slice(1);
-}
-
-
-/**
- * Tells if the string is a email or not
- */
-String.prototype.isEmail = function(){
- var regex = /^([a-zA-Z0-9_\.\-\+])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
- return regex.test(this);
-};
-
-// http://phpjs.org/functions/round/
-String.prototype.getRounded = function(precision, mode) {
- var m, f, isHalf, sgn; // helper variables
- precision |= 0; // making sure precision is integer
- m = Math.pow(10, precision);
- value = this;
- value *= m;
- sgn = (value > 0) | -(value < 0); // sign of the number
- isHalf = value % 1 === 0.5 * sgn;
- f = Math.floor(value);
-
- if(isHalf) {
- switch (mode) {
- case 'PHP_ROUND_HALF_DOWN':
- value = f + (sgn < 0); // rounds .5 toward zero
- break;
- case 'PHP_ROUND_HALF_EVEN':
- value = f + (f % 2 * sgn); // rouds .5 towards the next even integer
- break;
- case 'PHP_ROUND_HALF_ODD':
- value = f + !(f % 2); // rounds .5 towards the next odd integer
- break;
- default:
- value = f + (sgn > 0); // rounds .5 away from zero
- }
- }
-
- return (isHalf ? value : Math.round(value)) / m;
-};
-
-/**
- * Return bytes from Size + Suffix like "10 MB"
- */
-String.prototype.getBytes = function(){
- var units = ["KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"],
- suffix = this.toUpperCase().substr(-2);
- if(units.indexOf(suffix) == -1) {
- return this;
- }
- var pow_factor = units.indexOf(suffix) + 1;
- return parseFloat(this) * Math.pow(1000, pow_factor);
-};
-
-/**
- * Return size formatted from size bytes
- */
-String.prototype.formatBytes = function(round) {
- var bytes = parseInt(this),
- units = ["KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"];
- if(!$.isNumeric(this)) {
- return false;
- }
- if (bytes < 1000) return bytes + " B";
- if(typeof round == "undefined") var round = 2;
- for(var i=0; i= acceptable_shortness && stop_chars.indexOf(s[i]) >= 0) {
- break;
- }
- };
- if(reverse){ return short_s.split("").reverse().join(""); }
- return short_s;
- };
-
- return shortString(url, chunk_l, false) + "..." + shortString(url, chunk_l, true);
-};
-
-
-/**
- * Compare 2 arrays/objects
- * http://stackoverflow.com/questions/1773069/using-jquery-to-compare-two-arrays
- */
-jQuery.extend({
- compare: function (a,b) {
- var obj_str = '[object Object]',
- arr_str = '[object Array]',
- a_type = Object.prototype.toString.apply(a),
- b_type = Object.prototype.toString.apply(b);
- if(a_type !== b_type){
- return false;
- } else if(a_type === obj_str){
- return $.compareObject(a,b);
- } else if(a_type === arr_str){
- return $.compareArray(a,b);
- }
- return (a === b);
- },
- compareArray: function (arrayA, arrayB) {
- var a,b,i,a_type,b_type;
- if (arrayA === arrayB) { return true;}
- if (arrayA.length != arrayB.length) { return false; }
- a = jQuery.extend(true, [], arrayA);
- b = jQuery.extend(true, [], arrayB);
- a.sort();
- b.sort();
- for (i = 0, l = a.length; i < l; i+=1) {
- a_type = Object.prototype.toString.apply(a[i]);
- b_type = Object.prototype.toString.apply(b[i]);
- if(a_type !== b_type){
- return false;
- }
- if($.compare(a[i],b[i]) === false){
- return false;
- }
- }
- return true;
- },
- compareObject: function(objA,objB){
- var i,a_type,b_type;
- // Compare if they are references to each other
- if (objA === objB) { return true;}
- if (Object.keys(objA).length !== Object.keys(objB).length) { return false;}
- for (i in objA) {
- if (objA.hasOwnProperty(i)) {
- if(typeof objB[i] === 'undefined'){
- return false;
- } else {
- a_type = Object.prototype.toString.apply(objA[i]);
- b_type = Object.prototype.toString.apply(objB[i]);
- if (a_type !== b_type) {
- return false;
- }
- }
- }
- if($.compare(objA[i],objB[i]) === false){
- return false;
- }
- }
- return true;
- }
-});
-
-/**
- * Tells if a selector exits in the dom
- */
-jQuery.fn.exists = function(){
- return this.length > 0;
-};
-
-/**
- * Replace .svg for .png
- */
-jQuery.fn.replace_svg = function(){
- if(!this.attr("src")) return;
- $(this).each(function(){
- $(this).attr("src", $(this).attr("src").replace(".svg", ".png"));
- });
-};
-
-/**
- * Detect fluid layout
- * nota: deberia ir en PF
- */
-jQuery.fn.is_fluid = function(){
- return true;
- return(this.hasClass("fluid") || this.css("width")=="100%");
-};
-
-/**
- * jQueryfy the form data
- * Bind the attributes and values of form data to be manipulated by DOM fn
- */
-jQuery.fn.bindFormData = function() {
- $(":input", this).each(function() {
- var safeVal = PF.fn.htmlEncode($(this).val());
-
- if($(this).is("input")){
- this.setAttribute("value", this.value);
- if(this.checked) {
- this.setAttribute("checked", "checked");
- } else {
- this.removeAttribute("checked");
- }
- }
- if($(this).is("textarea")){
- $(this).html(safeVal);
- }
- if($(this).is("select")){
- var index = this.selectedIndex,
- i = 0;
- $(this).children("option").each(function() {
- if (i++ != index) {
- this.removeAttribute("selected");
- } else {
- this.setAttribute("selected","selected");
- }
- });
- }
- });
- return this;
-};
-
-/** jQuery.formValues: get or set all of the name/value pairs from child input controls
- * @argument data {array} If included, will populate all child controls.
- * @returns element if data was provided, or array of values if not
- * http://stackoverflow.com/questions/1489486/jquery-plugin-to-serialize-a-form-and-also-restore-populate-the-form
- */
-jQuery.fn.formValues = function(data) {
- var els = $(":input", this);
- if(typeof data != "object"){
- data = {};
- $.each(els, function(){
- if(this.name && !this.disabled && (this.checked || /select|textarea/i.test(this.nodeName) || /color|date|datetime|datetime-local|email|month|range|search|tel|time|url|week|text|number|hidden|password/i.test(this.type))){
- if(this.name.match(/^.*\[\]$/) && this.checked) {
- if(typeof data[this.name] == "undefined") {
- data[this.name] = [];
- }
- data[this.name].push($(this).val());
- } else {
- data[this.name] = $(this).val();
- }
- }
- });
- return data;
- } else {
- $.each(els, function() {
- if(this.name.match(/^.*\[\]$/) && typeof data[this.name] == "object") {
- $(this).prop("checked", data[this.name].indexOf($(this).val()) !== -1);
- } else {
- if(this.name && data[this.name]){
- if(/checkbox|radio/i.test(this.type)) {
- $(this).prop("checked", (data[this.name] == $(this).val()));
- } else {
- $(this).val(data[this.name]);
- }
- } else if(/checkbox|radio/i.test(this.type)){
- $(this).removeProp("checked");
- }
- }
- });
- return $(this);
- }
-};
-
-jQuery.fn.storeformData = function(dataname){
- if(typeof dataname == "undefined" && typeof $(this).attr("id") !== "undefined"){
- dataname = $(this).attr("id");
- }
- if(typeof dataname !== "undefined") $(this).data(dataname, $(this).formValues());
- return this;
-};
-
-/**
- * Compare the $.data values against the current DOM values
- * It relies in using $.data to store the previous value
- * Data must be stored using $.formValues()
- *
- * @argument dataname string name for the data key
- */
-jQuery.fn.is_sameformData = function(dataname){
- var $this = $(this);
- if(typeof dataname == "undefined") dataname = $this.attr("id");
- return jQuery.compare($this.formValues(), $this.data(dataname));
-};
-
-/**
- * Prevent non-numeric keydown
- * Allows only numeric keys to be entered on the target event
- */
-jQuery.Event.prototype.keydown_numeric = function(){
- var e = this;
-
- if(e.shiftKey) {
- e.preventDefault();
- return false;
- }
-
- var key = e.charCode || e.keyCode,
- target = e.target,
- value = ($(target).val()=="") ? 0 : parseInt($(target).val());
-
- if(key == 13) { // Allow enter key
- return true;
- }
-
- if(key == 46 || key == 8 || key == 9 || key == 27 ||
- // Allow: Ctrl+A
- (key == 65 && e.ctrlKey === true) ||
- // Allow: home, end, left, right
- (key >= 35 && key <= 40)){
- // let it happen, don't do anything
- return true;
- } else {
- // Ensure that it is a number and stop the keypress
- if ((key < 48 || key > 57) && (key < 96 || key > 105 )){
- e.preventDefault();
- }
- }
-};
-
-/**
- * Detect canvas support
- */
-PF.fn.is_canvas_supported = function(){
- var elem = document.createElement("canvas");
- return !!(elem.getContext && elem.getContext("2d"));
-};
-
-/**
- * Detect validity support
- */
-PF.fn.is_validity_supported = function(){
- var i = document.createElement("input");
- return typeof i.validity === "object";
-};
-
-PF.fn.getScrollBarWidth = function() {
- var inner = document.createElement('p');
- inner.style.width = "100%";
- inner.style.height = "200px";
-
- var outer = document.createElement('div');
- outer.style.position = "absolute";
- outer.style.top = "0px";
- outer.style.left = "0px";
- outer.style.visibility = "hidden";
- outer.style.width = "200px";
- outer.style.height = "150px";
- outer.style.overflow = "hidden";
- outer.appendChild (inner);
-
- document.body.appendChild (outer);
- var w1 = inner.offsetWidth;
- outer.style.overflow = 'scroll';
- var w2 = inner.offsetWidth;
- if (w1 == w2) w2 = outer.clientWidth;
-
- document.body.removeChild (outer);
-
- return (w1 - w2);
-};
-
-PF.str.ScrollBarWidth = PF.fn.getScrollBarWidth();
-
-/**
- * Updates the notifications button
- */
-PF.fn.top_notifications_viewed = function(){
- var $top_bar_notifications = $("[data-action=top-bar-notifications]"),
- $notifications_lists = $(".top-bar-notifications-list", $top_bar_notifications),
- $notifications_count = $(".top-btn-number", $top_bar_notifications);
-
- if($(".persistent", $top_bar_notifications).exists()){
- $notifications_count.text($(".persistent", $top_bar_notifications).length).addClass("on");
- } else {
- $notifications_count.removeClass("on");
- }
-};
-
-/**
- * bind tipTip for the $target with options
- * @argument $target selector or jQuery obj
- * @argument options obj
- */
-PF.fn.bindtipTip = function($target, options) {
- if(typeof $target == "undefined") $target = $("body");
- if($target instanceof jQuery == false) $target = $($target);
- var bindtipTipoptions = {
- delay: 0,
- content: false,
- fadeIn: 0
- };
- if(typeof options !== "undefined"){
- if(typeof options.delay !== "undefined") bindtipTipoptions.delay = options.delay;
- if(typeof options.content !== "undefined") bindtipTipoptions.content = options.content;
- if(typeof options.content !== "undefined") bindtipTipoptions.fadeIn = options.fadeIn;
- }
- if($target.attr("rel") !== "tooltip") $target = $("[rel=tooltip]", $target);
-
- $target.each(function(){
- if((typeof $(this).attr("href") !== "undefined" || typeof $(this).data("href") !== "undefined") && PF.fn.isDevice(["phone", "phablet", "tablet"])) {
- return true;
- }
- var position = typeof $(this).data("tiptip") == "undefined" ? "bottom" : $(this).data("tiptip");
- if(PF.fn.isDevice(["phone", "phablet"])) {
- position = "top";
- }
- $(this).tipTip({delay: bindtipTipoptions.delay, defaultPosition: position, content: bindtipTipoptions.content, fadeIn: bindtipTipoptions.fadeIn, fadeOut: 0});
- });
-};
-
-/**
- * form modal changed
- * Detects if the form modal (fullscreen) has changed or not
- * Note: It relies in that you save a serialized data to the
- */
-PF.fn.form_modal_has_changed = function() {
- if($(PF.obj.modal.selectors.root).is(":hidden")) return;
- if(typeof $("html").data("modal-form-values") == typeof undefined) return;
-
- var data_stored = $("html").data("modal-form-values");
- var data_modal = PF.fn.deparam($(":input:visible", PF.obj.modal.selectors.root).serialize());
- var has_changed = false;
- var keys = $.extend({}, data_stored, data_modal);
-
- for(var k in keys) {
- if(data_stored[k] !== data_modal[k]) {
- has_changed = true;
- break;
- }
- }
-
- return has_changed;
-};
-
-/**
- * PEAFOWL CONDITIONALS
- * -------------------------------------------------------------------------------------------------
- */
-
-PF.fn.is_listing = function(){
- return $(PF.obj.listing.selectors.content_listing).exists();
-};
-
-PF.fn.is_tabs = function(){
- return $(".content-tabs").exists();
-};
-
-/**
- * PEAFOWL EFFECTS
- * -------------------------------------------------------------------------------------------------
- */
-
-/**
- * Shake effect
- * Shakes the element using CSS animations.
- * @argument callback fn
- */
-jQuery.fn.shake = function(callback){
- this.each(function(init){
- var jqNode = $(this),
- jqNode_position = jqNode.css("position");
-
- if(!jqNode_position.match("relative|absolute|fixed")) jqNode.css({position: "relative"});
-
- var jqNode_left = parseInt(jqNode.css("left"));
-
- if(!jqNode_left.toString().isNumeric()) jqNode_left = 0;
-
- if(!jqNode.is(":animated")){
- for(var x = 1; x <= 2; x++){
- jqNode.animate({
- left: jqNode_left-10
- }, 0).animate({
- left: jqNode_left
- }, 30).animate({
- left: jqNode_left+10
- }, 30).animate({
- left: jqNode_left
- }, 30);
- };
- if(jqNode_position!=="static") jqNode.css({position: jqNode_position});
- };
- });
- if(typeof callback == "function") callback();
- return this;
-};
-
-/**
- * Highlight effect
- * Changes the background of the element to a highlight color and revert to original
- * @argument string (yellow|red|hex-color)
- */
-jQuery.fn.highlight = function(color){
- if(this.is(":animated") || !this.exists()) return this;
- if(typeof color == "undefined") color = "yellow";
-
- var fadecolor = color;
-
- switch(color){
- case "yellow":
- fadecolor = "#FFFBA2";
- break;
- case "red":
- fadecolor = "#FF7F7F";
- break;
- default:
- fadecolor = color;
- break;
- };
- var base_background_color = $(this).css("background-color"),
- base_background = $(this).css("background");
-
- $(this).css({background: "", backgroundColor: fadecolor}).animate({backgroundColor: base_background_color }, 800, function(){
- $(this).css("background", "");
- });
- return this;
-};
-
-/**
- * Peafowl slidedown effect
- * Bring the element using slideDown-type effect
- * @argument speed (fast|normal|slow|int)
- * @argument callback fn
- */
-jQuery.fn.pf_slideDown = function(speed, callback){
-
- var default_speed = "normal",
- this_length = $(this).length,
- css_prechanges, css_animation, animation_speed;
-
- if(typeof speed == "function"){
- callback = speed;
- speed = default_speed;
- }
- if(typeof speed == "undefined"){
- speed = default_speed;
- }
-
- $(this).each(function(index){
- var this_css_top = parseInt($(this).css("top")),
- to_top = this_css_top > 0 ? this_css_top : 0;
-
- if(speed == 0){
- css_prechanges = {display: "block", opacity: 0},
- css_animation = {opacity: 1},
- animation_speed = jQuery.speed("fast").duration;
- } else {
- css_prechanges = {top: -$(this).outerHeight(true), opacity: 1, display: "block"};
- css_animation = {top: to_top};
- animation_speed = jQuery.speed(speed).duration;
- }
-
- $(this).data("originalTop", $(this).css("top"));
- $(this).css(css_prechanges).animate(css_animation, animation_speed, function(){
- if (index == this_length - 1){
- if(typeof callback == "function"){
- callback();
- }
- }
- });
- });
-
- return this;
-};
-
-/**
- * Peafowl slideUp effect
- * Move the element using slideUp-type effect
- * @argument speed (fast|normal|slow|int)
- * @argument callback fn
- */
-jQuery.fn.pf_slideUp = function(speed, callback){
-
- var default_speed = "normal",
- this_length = $(this).length;
-
- if(typeof speed == "function"){
- callback = speed;
- speed = default_speed;
- }
- if(typeof speed == "undefined"){
- speed = default_speed;
- }
-
- $(this).each(function(index){
- $(this).animate({top: -$(this).outerHeight(true)}, jQuery.speed(speed).duration, function(){
- $(this).css({display: "none", top: $(this).data("originalTop")});
- if(index == this_length - 1){
- if(typeof callback == "function"){
- callback();
- }
- }
- });
- });
-
- return this;
-};
-
-/**
- * Peafowl visible on viewport
- */
-jQuery.fn.is_in_viewport = function(){
- var rect = $(this)[0].getBoundingClientRect();
- return (
- rect.top >= 0 &&
- rect.left >= 0 &&
- rect.bottom <= (window.innerHeight || document. documentElement.clientHeight) && /*or $(window).height() */
- rect.right <= (window.innerWidth || document. documentElement.clientWidth) /*or $(window).width() */
- );
-};
-
-/**
- * Scroll the window to the target.
- * @argument target selector
- * @argument callback fn
- */
-PF.fn.scroll = function(target, callback){
- if(typeof target == "function") {
- var callback = target,
- target = "";
- }
-
- var pxtop = parseInt($("body").css("margin-top"));
- if(pxtop==0 && $(".top-bar-placeholder").exists()) {
- pxtop = $(".top-bar-placeholder").height();
- }
-
- if(!$(target).exists()) target = "html";
- $("body,html").animate({scrollTop: $(target).offset().top - pxtop}, "normal", function(){
- if(typeof callback == "function") callback();
- });
-};
-
-PF.fn.close_pops = function(e){
- $(".pop-box:visible").each(function(){
- $(this).closest(".pop-btn").click();
- });
-};
-
-/**
- * Bring up a nice growl-like alert
- */
-PF.fn.growl = {
-
- selectors: {
- root: "#growl"
- },
-
- str: {
- timeout: null,
- timeoutcall: false
- },
-
- /**
- * Fires the growl
- * @argument options object
- */
- call: function(options){
- if(typeof options == "undefined") return;
- if(typeof options == "string"){
- options = {message: options};
- }
- if(typeof options.message == "undefined") return;
-
- var growl_options, $growl, growl_class, growl_color;
-
- growl_options = {
- message: options.message,
- insertTo: "body",
- where: "before",
- color: "default",
- css: {},
- classes: "",
- expires: 0,
- callback: function(){}
- };
-
- for(key in growl_options) {
- if(typeof options[key] !== "undefined") {
- if(key.match("/^(callback)$/")) {
- if(typeof options[key] == "function") {
- growl_options[key] = options[key];
- }
- } else {
- growl_options[key] = options[key];
- }
-
- }
- }
-
- if(!$(growl_options.insertTo).exists()){
- growl_options.insertTo = "body";
- }
-
- if($(PF.fn.growl.selectors.root).exists()){
- if($(PF.fn.growl.selectors.root).text() == growl_options.message){
- $(PF.fn.growl.selectors.root).shake();
- return;
- }
- $(PF.fn.growl.selectors.root).remove();
- }
-
- $growl = $(''+growl_options.message+'
').css(growl_options.css).addClass(growl_options.classes);
-
- growl_class = growl_options.insertTo !== "body" ? "static" : "";
-
- switch(growl_options.color){
- case "dark":
- growl_color = "dark";
- break;
- default:
- growl_color = "";
- break;
- }
-
- $growl.addClass(growl_class+" "+growl_color);
-
- if(growl_options.where == "before"){
- $(growl_options.insertTo).prepend($growl.hide());
- } else {
- $(growl_options.insertTo).append($growl.hide());
- }
-
- if($(".fullscreen").is(":visible")){
- $growl.css({"z-index": parseInt($(".fullscreen").css("z-index"))+1});
- }
-
- if($(PF.obj.modal.selectors.root).is(":visible")){
- var $modal_box = $(PF.obj.modal.selectors.box, PF.obj.modal.selectors.root);
- $growl.show();
- $growl.css("top", ($("#top-bar").outerHeight(true) - $growl.outerHeight(true))/2);
-
- PF.fn.growl.fixPosition();
-
- $growl.hide();
- }
-
-
- $growl.pf_slideDown(growl_class == "static" ? 0 : 200, function(){
- if(typeof growl_options.callback == "function"){
- growl_options.callback();
- }
- });
-
- $(document).on("click", ".growl", function(e){
- if(PF.fn.isDevice(["phone", "phablet"]) || $(e.target).is("[data-action=close]")) {
- PF.fn.growl.close(true);
- }
- });
-
- if(growl_options.expires > 0){
- if(typeof this.str.timeout == "number"){
- clearTimeout(this.str.timeout);
- }
- this.str.timeout = setTimeout(function(){
- PF.fn.growl.str.timeoutcall = true;
- PF.fn.growl.close();
- }, growl_options.expires);
- }
-
- },
-
- /**
- * Fires an expirable growl (will close after time)
- * @argument msg string
- * @argument time int (ms)
- */
- expirable: function(msg, time){
- if(typeof msg == "undefined") return;
- if(typeof time == "undefined") time = 5000;
- PF.fn.growl.call({message: msg, expires: time});
- },
-
- /**
- * Closes the growl
- * @argument callback fn
- */
- close: function(forced, callback){
- var $growl = $(PF.fn.growl.selectors.root);
-
- if(forced) {
- this.str.timeout = null;
- this.str.timeoutcall = false;
- clearTimeout(this.str.timeout);
- }
-
- if(!$growl.exists() || (typeof this.str.timeout == "number" && !this.str.timeoutcall)) {
- return;
- }
-
- $growl.fadeOut("fast", function(){
- $(this).remove();
- if(typeof callback == "function"){
- callback();
- }
- });
- },
-
- fixPosition: function() {
-
- var $growl = $(PF.fn.growl.selectors.root);
-
- if(!$growl.exists() || !$(PF.obj.modal.selectors.root).exists()) {
- return;
- }
-
- if($growl.data("fixedPosition") == "scrollbar" && $(PF.obj.modal.selectors.root).hasScrollBar().vertical) {
- return;
- }
-
- var offsetX = {
- modal: $(PF.obj.modal.selectors.box).offset().left,
- growl: $growl.offset().left
- },
- growlCompensate = offsetX.modal - offsetX.growl,
- marginLeft = growlCompensate < 0 ? ("-=" + Math.abs(growlCompensate)) : "-" + parseInt($growl.css("width"))/2;
-
- if(!PF.fn.isDevice(["phone", "phablet"])) {
- $growl.css("marginLeft", marginLeft + "px");
- }
-
- $growl.data("fixedPosition", $(PF.obj.modal.selectors.root).hasScrollBar().vertical ? "scrollbar" : "no-scrollbar");
-
- }
-
-};
-
-/**
- * Bring up a nice fullscreen modal
- */
-PF.obj.modal = {
- type: "",
- selectors: {
- root: "#fullscreen-modal",
- box: "#fullscreen-modal-box",
- body: "#fullscreen-modal-body",
- login: "[data-modal=login]",
- changes_confirm: "#fullscreen-changes-confirm",
- btn_container: ".btn-container",
- close_buttons: ".close-modal,.cancel-modal,[data-action=cancel],[data-action-close]",
- submit_button: "[data-action=submit]",
- growl_placeholder: "#fullscreen-growl-placeholder"
- },
- ajax: {
- url: "",
- deferred: {}
- },
- locked: false,
- form_data: {},
- XHR: {},
- prevented: false
-};
-PF.obj.modal.$close_buttons = $(PF.obj.modal.selectors.close_buttons, PF.obj.modal.selectors.root);
-PF.obj.modal.$submit_button = $(PF.obj.modal.selectors.submit_button, PF.obj.modal.selectors.root);
-
-PF.fn.modal = {
-
- str: {
- transition: "all " + PF.obj.config.animation.fast + "ms ease"
- },
-
- /**
- * Fires the modal
- * @argument options object
- */
- call:
- function(options){
- var modal_options, modal_base_template, modal_message;
-
- if(typeof options == "undefined") return;
- if(typeof options.template !== "undefined" && typeof options.type == "undefined") options.type = "html";
- if((typeof options.title == "undefined" || typeof options.message == "undefined") && (options.type !== "login" && options.type !== "html")) return;
-
- PF.fn.growl.close();
-
- modal_options = {
- forced: false,
- type: "confirm",
- title: options.title,
- message: options.message,
- html: false,
- template: options.template,
- buttons: true,
- button_submit: PF.fn._s("Submit"),
- txt_or: PF.fn._s("or"),
- button_cancel: PF.fn._s("cancel"),
- ajax: {url: null, data: null, deferred: {}},
- confirm: function(){},
- cancel: function(){
- PF.fn.modal.close();
- },
- load: function(){},
- callback: function() {}
- };
-
- for(key in modal_options) {
- if(typeof options[key] !== "undefined") {
- if((/^cancel|confirm|callback$/).test(key)) {
- if(typeof options[key] == "function") {
- modal_options[key] = options[key];
- }
- } else {
- modal_options[key] = options[key];
- }
-
- }
- }
-
- if(typeof options.ajax !== "undefined" && !options.ajax.url && options.ajax.deferred) {
- modal_options.ajax.url = PF.obj.config.json_api;
- }
-
- if(modal_options.type == "login"){
- modal_options.buttons = false;
- }
-
- if(modal_options.type == "confirm") {
- modal_options.button_submit = PF.fn._s("Confirm");
- }
-
- var overlay_background = "soft-black";
- if($("html").hasClass("tone-dark")) {
- overlay_background = "black";
- }
-
- var modal_base_template = [
- '%MODAL_BODY%
%MODAL_BUTTONS%
'
- ].join("");
-
- var modal_buttons = modal_options.buttons ? [''].join("") : "";
-
- if(modal_options.type == "login"){
- modal_options.template = typeof modal_options.template == "undefined" ? $(PF.obj.modal.selectors.login).html() : modal_options.template;
- }
-
- var modalBodyHTML;
-
- switch(modal_options.type){
- case "html":
- case "login":
- modalBodyHTML = modal_options.template;
- break;
- case "confirm": default:
- modal_message = modal_options.message;
- if(!modal_options.html){
- modal_message = ''+modal_message+'
';
- }
- modalBodyHTML = ''+modal_options.title+' '+modal_message;
- break;
- }
-
- if(typeof modalBodyHTML == "undefined") {
- console.log("PF Error: Modal content is empty");
- return;
- }
-
- modal_base_template = modal_base_template
- .replace("%MODAL_BODY%", modalBodyHTML)
- .replace("%MODAL_BUTTONS%", modal_buttons)
- .replace(/template-tooltip/g, "tooltip");
-
- $(PF.obj.modal.selectors.root).remove();
-
- $("body").data("overflow-hidden", $("body").hasClass("overflow-hidden"));
- $("body").prepend(modal_base_template).addClass("overflow-hidden");
-
- this.fixScrollbars();
-
- $("[rel=tooltip]", PF.obj.modal.selectors.root).each(function(){
- PF.fn.bindtipTip(this, {content:$(this).data("title")});
- });
-
- if($(":button, input[type=submit], input[type=reset]", PF.obj.modal.selectors.root).length > 0) {
- var $form = $("form", PF.obj.modal.selectors.root);
- if($form.exists()) {
- $form.append($($(PF.obj.modal.selectors.btn_container, PF.obj.modal.selectors.root).html()).wrapInner(PF.obj.modal.selectors.btn_container.replace(".", "")));
- $(PF.obj.modal.selectors.btn_container, PF.obj.modal.selectors.root).each(function() {
- if(!$(this).closest("form").exists()) {
- $(this).remove();
- }
- });
- } else {
- $(PF.obj.modal.selectors.box, PF.obj.modal.selectors.root).wrapInner('');
- }
- }
-
- modal_options.callback();
-
- $(PF.obj.modal.selectors.box).css({transform: "scale(0.7)", opacity: 0, transition: PF.fn.modal.str.transition});
- $(PF.obj.modal.selectors.root).css({display: "block"});
- setTimeout(function() {
- $(PF.obj.modal.selectors.root).css({opacity: 1});
- $(PF.obj.modal.selectors.box).css({transform: "scale(1)", opacity: 1});
- setTimeout(function() {
- if(typeof modal_options.load == "function") {
- modal_options.load();
- }
- // Stock the default modal values
- $("html").data("modal-form-values", PF.fn.deparam($(":input:visible", PF.obj.modal.selectors.root).serialize()));
-
- }, PF.obj.config.animation.fast);
- }, 1);
-
- // Bind the modal events
- $(PF.obj.modal.selectors.root).click(function(e){
-
- var $this = $(e.target),
- _this = this;
-
- if(PF.obj.modal.locked) {
- return;
- }
-
- // Changes confirm?
- if($this.closest(PF.obj.modal.selectors.changes_confirm).exists() && ($this.is(PF.obj.modal.selectors.close_buttons) || $this.is(PF.obj.modal.selectors.submit_button))) {
-
- $(PF.obj.modal.selectors.changes_confirm).remove();
-
- if($this.is(PF.obj.modal.selectors.close_buttons)) {
- $(PF.obj.modal.selectors.box, _this).fadeIn("fast", function() {
- $(this).css("transition", PF.fn.modal.str.transition);
- });
- } else {
- PF.fn.modal.close();
- }
-
- // Modal
- } else {
-
- if(!$this.closest(".clickable").exists() || $this.is(PF.obj.modal.selectors.close_buttons)) {
- PF.fn.growl.close();
- modal_options.cancel();
- }
-
- if($this.is(PF.obj.modal.selectors.submit_button)) {
-
- if(modal_options.confirm() === false) {
- return;
- }
-
- var modal_submit_continue = true;
- if($("input, textarea, select", PF.obj.modal.selectors.root).not(":input[type=button], :input[type=submit], :input[type=reset]").length > 0 && !PF.fn.form_modal_has_changed() && !modal_options.forced) {
- modal_submit_continue = false;
- }
-
- if(modal_submit_continue) {
-
- if(modal_options.ajax.url) {
-
- var $btn_container = $(PF.obj.modal.selectors.btn_container, PF.obj.modal.selectors.root);
- PF.obj.modal.locked = true;
-
- $btn_container.first().clone().height($btn_container.height()).html("").addClass("loading").appendTo(PF.obj.modal.selectors.root + " form");
- $btn_container.hide();
-
- PF.obj.modal.$close_buttons.hide();
-
- var modal_loading_msg;
-
- switch(PF.obj.modal.type) {
- case "edit":
- modal_loading_msg = PF.fn._s("Saving");
- break;
- case "confirm":
- case "form":
- default:
- modal_loading_msg = PF.fn._s("Sending");
- break;
- }
-
- PF.fn.loading.inline($(PF.obj.modal.selectors.btn_container+".loading", PF.obj.modal.selectors.root), {size: "small", message: modal_loading_msg, valign: "center"});
-
- $(PF.obj.modal.selectors.root).disableForm();
-
- if(!$.isEmptyObject(PF.obj.modal.form_data) || (typeof options.ajax !== "undefined" && typeof options.ajax.data == "undefined")) {
- modal_options.ajax.data = PF.obj.modal.form_data;
- }
-
- PF.obj.modal.XHR = $.ajax({
- url: modal_options.ajax.url,
- type: "POST",
- data: modal_options.ajax.data //PF.obj.modal.form_data // $.param ?
- }).complete(function(XHR){
-
- PF.obj.modal.locked = false;
-
- if(XHR.status == 200) {
-
- var success_fn = typeof modal_options.ajax.deferred !== "undefined" && typeof modal_options.ajax.deferred.success !== "undefined" ? modal_options.ajax.deferred.success : null;
-
- if(typeof success_fn == "function") {
- PF.fn.modal.close(function() {
- if(typeof success_fn == "function") {
- success_fn(XHR);
- }
- });
- } else if(typeof success_fn == "object") {
-
- if(typeof success_fn.before == "function") {
- success_fn.before(XHR);
- }
- if(typeof success_fn.done == "function") {
- success_fn.done(XHR);
- }
- }
-
- } else {
-
- $(PF.obj.modal.selectors.root).enableForm();
- $(PF.obj.modal.selectors.btn_container+".loading", PF.obj.modal.selectors.root).remove();
- $btn_container.css("display", "");
-
- if(typeof modal_options.ajax.deferred !== "undefined" && typeof modal_options.ajax.deferred.error == "function") {
- modal_options.ajax.deferred.error(XHR);
- } else {
- var message = PF.fn._s("An error occurred. Please try again later.");
- /*
- if(XHR.responseJSON.error.message) {
- message = XHR.responseJSON.error.message;
- }
- */
- PF.fn.growl.call(message);
- }
-
- }
- });
-
- } else {
- // No ajax behaviour
- PF.fn.modal.close(modal_options.callback());
- }
-
- }
- }
- }
- });
- },
-
- /**
- * Fires a confirm modal
- * @argument options object
- */
- confirm:
- function(options){
- options.type = "confirm";
- if(typeof options.title == "undefined"){
- options.title = PF.fn._s("Confirm action");
- }
- PF.fn.modal.call(options);
- },
-
- /**
- * Fires a simple info modal
- */
- simple:
- function(options){
- if(typeof options == "string") options = {message: options};
- if(typeof options.buttons == "undefined") options.buttons = false;
- if(typeof options.title == "undefined") options.title = PF.fn._s("information");
- PF.fn.modal.call(options);
- },
-
- fixScrollbars:
- function() {
- if(!$(PF.obj.modal.selectors.root).exists()) {
- return;
- }
- var $targets = {
- padding: $(".top-bar, .fixed, .position-fixed"),
- margin: $("html"),
- }
- var properties = {}
- if(PF.str.ScrollBarWidth > 0 && $("html").hasScrollBar().vertical && !$("body").data("overflow-hidden")) {
- properties.padding = PF.str.ScrollBarWidth + "px";
- properties.margin = PF.str.ScrollBarWidth + "px";
- } else {
- properties.padding = "";
- properties.margin = "";
- }
- $targets.padding.css({paddingRight: properties.padding});
- $targets.margin.css({marginRight: properties.margin});
- },
-
- /**
- * Closes the modal
- * @argument callback fn
- */
- close:
- function(callback){
- if(!$(PF.obj.modal.selectors.root).exists()) {
- return;
- }
- PF.fn.growl.close(true);
- $("[rel=tooltip]", PF.obj.modal.selectors.root).tipTip("hide");
- $(PF.obj.modal.selectors.box).css({transform: "scale(0.5)", opacity: 0});
- $(PF.obj.modal.selectors.root).css({opacity: 0});
- setTimeout(function() {
- if(PF.str.ScrollBarWidth > 0 && $("html").hasScrollBar().vertical) {
- $(".top-bar, .fixed, .position-fixed").css({paddingRight: ""});
- }
- $("html").css({marginRight: ""});
- if(!$("body").data("overflow-hidden")) {
- $("body").removeClass("overflow-hidden");
- }
- $("body").removeData("overflow-hidden");
- $(PF.obj.modal.selectors.root).remove();
- if(typeof callback == "function") callback();
- }, PF.obj.config.animation.normal);
- },
-
-};
-
-/**
- * Peafowlesque popups
- */
-PF.fn.popup = function(options){
-
- var settings = {
- height: options.height || 500,
- width: options.width || 650,
- scrollTo: 0,
- resizable: 0,
- scrollbars: 0,
- location: 0
- };
-
- settings.top = (screen.height/2) - (settings.height/2);
- settings.left = (screen.width/2) - (settings.width/2);
-
- var settings_ = "";
- for(var key in settings){
- settings_ += key + "=" + settings[key] + ",";
- }
- settings_ = settings_.slice(0, -1); // remove the last comma
-
- window.open(options.href, "Popup", settings_);
- return;
-};
-
-/**
- * PEAFOWL FLUID WIDTH FIXER
- * -------------------------------------------------------------------------------------------------
- */
-PF.fn.list_fluid_width = function() {
- if(!$("body").is_fluid()) return;
-
- var $content_listing = $(PF.obj.listing.selectors.content_listing_visible),
- $pad_content_listing = $(PF.obj.listing.selectors.pad_content, $content_listing),
- $list_item = $(PF.obj.listing.selectors.list_item, $content_listing),
- list_item_width = $list_item.outerWidth(true),
- list_item_gutter = $list_item.outerWidth(true) - $list_item.width();
-
- PF.obj.listing.content_listing_ratio = parseInt(($content_listing.width()+list_item_gutter) / list_item_width);
-
- if($list_item.length < PF.obj.listing.content_listing_ratio) {
- $pad_content_listing.css("width", "100%");
- return;
- }
-
- if(PF.fn.isDevice(["tablet", "laptop", "desktop"])) {
- // $pad_content_listing.width((PF.obj.listing.content_listing_ratio * list_item_width) - list_item_gutter);
- }
-
-
- if(PF.obj.follow_scroll.$node.hasClass("position-fixed")) {
- PF.obj.follow_scroll.$node.width($(".content-width").first().width());
- }
-
-};
-
-/**
- * PEAFOWL TABS
- * -------------------------------------------------------------------------------------------------
- */
-
-PF.obj.tabs = {
- hashdata: {}
-};
-
-PF.fn.show_tab = function(tab) {
-
- if(typeof tab == "undefined") return;
- var $this = $("a[data-tab=" + tab + "]", ".content-tabs");
-
- $("li", $this.closest("ul")).removeClass("current");
- $this.closest("li").addClass("current");
-
- var $tab_content_group = $("#tabbed-content-group");
- $target = $("#"+$this.data("tab"));
-
- $(".tabbed-content", $tab_content_group).removeClass("visible").hide();
- $($target, $tab_content_group).addClass("visible").show();
-
- // Show/hide the listing sorting
- $("[data-content=list-selection]").removeClass("visible").addClass("hidden");
- $("[data-content=list-selection][data-tab="+$this.data("tab")+"]").removeClass("hidden").addClass("visible");
-
- if($tab_content_group.exists()){
-
- var $list_item_target = $(PF.obj.listing.selectors.list_item+":not(.jsly)", $target),
- target_fade = !$target.hasClass("jsly");
-
- if($target.data("load") == "ajax" && $target.data("empty") !== "true" && !$(PF.obj.listing.selectors.list_item, $target).exists()){
- PF.fn.listing.queryString.stock_load();
- $target.html(PF.obj.listing.template.fill);
- PF.fn.loading.inline($(PF.obj.listing.selectors.content_listing_loading, $target));
- PF.fn.listing.queryString.stock_new();
- PF.fn.listing.ajax();
- } else {
- PF.fn.listing.queryString.stock_current();
- PF.fn.listing.columnizer(false, 0, false);
- $list_item_target[target_fade ? "fadeIn" : "show"]();
- }
-
- }
-
- PF.fn.listing.columnizerQueue();
-
- if($(PF.obj.listing.selectors.content_listing_visible).data("queued") == true) {
- PF.fn.listing.columnizer(true, 0);
- }
-
-};
-
-/**
- * PEAFOWL LISTINGS
- * -------------------------------------------------------------------------------------------------
- */
-PF.obj.listing = {
- columns: "",
- columns_number: 1,
- current_column: "",
- current_column: "",
- XHR: {},
- query_string: PF.fn.get_url_vars(),
- calling: false,
- content_listing_ratio: 1,
- selectors: {
- sort: ".sort-listing .current [data-sort]",
- content_listing: ".content-listing",
- content_listing_visible: ".content-listing:visible",
- content_listing_loading: ".content-listing-loading",
- content_listing_load_more: ".content-listing-more",
- content_listing_pagination: ".content-listing-pagination",
- empty_icon: ".icon icon-drawer",
- pad_content: ".pad-content-listing",
- list_item: ".list-item",
- },
- template: {
- fill: $("[data-template=content-listing]").html(),
- empty: $("[data-template=content-listing-empty]").html(),
- loading: $("[data-template=content-listing-loading]").html()
- }
-};
-
-PF.fn.listing = {};
-
-PF.fn.listing.show = function(response, callback) {
- $content_listing = $("#content-listing-tabs").exists() ? $(PF.obj.listing.selectors.content_listing_visible, "#content-listing-tabs") : $(PF.obj.listing.selectors.content_listing);
-
- PF.fn.loading.inline(PF.obj.listing.selectors.content_listing_loading);
-
- //$(PF.obj.listing.selectors.list_item+":not(.jsly)", $content_listing).imagesLoaded(function(){
-
- var items = PF.obj.listing.selectors.list_item,
- $subjects = $(items+":visible", PF.obj.listing.selectors.content_listing_visible),
- $targets = $(items+":hidden", PF.obj.listing.selectors.content_listing_visible);
-
- if((typeof response !== "undefined" && $(response.html).length < PF.obj.config.listing.items_per_page) || $(PF.obj.listing.selectors.list_item, $content_listing).length < PF.obj.config.listing.items_per_page) {
- PF.fn.listing.removeLoader($content_listing);
- }
- if($(PF.obj.listing.selectors.content_listing_pagination, $content_listing).is("[data-type=classic]") || !$("[data-action=load-more]", $content_listing).exists()) {
- $(PF.obj.listing.selectors.content_listing_loading, $content_listing).remove();
- }
-
- if($subjects.length == 0) {
- $targets.show();
- PF.fn.listing.columnizer(false, 0);
- PF.obj.listing.recolumnize = true;
- }
-
- var animation_time = $subjects.length == 0 ? 0 : null;
- animation_time = 0;
-
- PF.fn.listing.columnizer(PF.obj.listing.recolumnize, animation_time, $subjects.length == 0);
- $targets.hide();
- PF.obj.listing.recolumnize = false;
-
- if(PF.fn.isDevice(["laptop", "desktop"])) {
-
- $targets.each(function() { // too much CPU for this
-
- $(this).show().find(".image-container").hide();
-
- var callTime = $.now();
- var $this = $(this);
- var $target = $(".image-container", $this);
-
- $(".image-container", this).imagesLoaded(function(){
- var loadTime = $.now() - callTime;
-
- if($subjects.length == 0) {
- if(loadTime > PF.obj.config.animation.normal) {
- $target.fadeIn(PF.obj.config.animation.normal);
- } else {
- $target.show();
- }
- } else {
- $target.fadeIn(PF.obj.config.animation.normal);
- }
- });
- });
- } else {
- $targets.show();
- }
-
- PF.obj.listing.calling = false;
-
- var visible_loading = $(PF.obj.listing.selectors.content_listing_loading, $content_listing).exists() && ($(PF.obj.listing.selectors.content_listing_loading, $content_listing).is_in_viewport());
- if(typeof PF.obj.listing.show_load_more == typeof undefined) {
- PF.obj.listing.show_load_more = visible_loading;
- }
-
- $(PF.obj.listing.selectors.content_listing_loading, $content_listing)[(visible_loading ? "add" : "remove") + "Class"]("visibility-hidden");
- $(PF.obj.listing.selectors.content_listing_load_more, $content_listing)[(PF.obj.listing.show_load_more ? "show" : "hide")]();
-
- var State = History.getState();
- if(State.data && typeof State.data.scrollTop !== "undefined") {
- if($(window).scrollTop() !== State.data.scrollTop) {
- //$(window).scrollTop(State.data.scrollTop);
- }
- }
-
- if(typeof callback == "function") {
- callback();
- }
-
- //});
-};
-
-PF.fn.listing.removeLoader = function(obj) {
-
- var remove = [PF.obj.listing.selectors.content_listing_load_more, PF.obj.listing.selectors.content_listing_loading];
-
- if($(PF.obj.listing.selectors.content_listing_pagination, $content_listing).is("[data-type=endless]")) {
- remove.push(PF.obj.listing.selectors.content_listing_pagination);
- }
-
- $.each(remove, function(i,v) {
- $(v, obj).remove();
- });
-};
-
-PF.fn.listing.queryString = {
-
- // Stock the querystring values from initial load
- stock_load: function() {
-
- var $content_listing = $(PF.obj.listing.selectors.content_listing_visible),
- params = PF.fn.deparam($content_listing.data("params"));
-
- PF.obj.listing.hidden_params = typeof $content_listing.data("params-hidden") !== "undefined" ? PF.fn.deparam($content_listing.data("params-hidden")) : null;
-
- if(typeof PF.obj.listing.query_string.action == "undefined") {
- PF.obj.listing.query_string.action = $content_listing.data("action") || "list";
- }
- if(typeof PF.obj.listing.query_string.list == "undefined") {
- PF.obj.listing.query_string.list = $content_listing.data("list");
- }
- if(typeof PF.obj.listing.query_string.sort == "undefined") {
- if(typeof params !== "undefined" && typeof params.sort !== "undefined") {
- PF.obj.listing.query_string.sort = params.sort;
- } else {
- PF.obj.listing.query_string.sort = $(":visible"+PF.obj.listing.selectors.sort).data("sort");
- }
- }
- if(typeof PF.obj.listing.query_string.page == "undefined") {
- PF.obj.listing.query_string.page = 1;
- }
- $content_listing.data("page", PF.obj.listing.query_string.page);
-
- // Stock the real ajaxed hrefs for ajax loads
- $(PF.obj.listing.selectors.content_listing+"[data-load=ajax]").each(function(){
-
- var $sortable_switch = $("[data-tab="+$(this).attr("id")+"]"+PF.obj.listing.selectors.sort);
- var dataParams = PF.fn.deparam($(this).data("params")),
- dataParamsHidden = PF.fn.deparam($(this).data("params-hidden")),
- params = {
- q: dataParams && dataParams.q ? dataParams.q : null,
- list: $(this).data("list"),
- sort: $sortable_switch.exists() ? $sortable_switch.data("sort") : (dataParams && dataParams.sort ? dataParams.sort: null),
- page: dataParams && dataParams.page ? dataParams.page : 1
- };
-
- if(dataParamsHidden && dataParamsHidden.list) {
- delete params.list;
- }
-
- for(var k in params) {
- if(!params[k]) delete params[k];
- }
-
- });
-
- // The additional params setted in data-params=""
- for(var k in params) {
- if(/action|list|sort|page/.test(k) == false) {
- PF.obj.listing.query_string[k] = params[k];
- }
- }
- // The additional params setted in data-hidden-params=""
- for(var k in PF.obj.listing.hidden_params) {
- if(/action|list|sort|page/.test(k) == false) {
- PF.obj.listing.query_string[k] = PF.obj.listing.hidden_params[k];
- }
- }
-
- },
-
- // Stock new querystring values for initial ajax call
- stock_new: function(){
- var $content_listing = $(PF.obj.listing.selectors.content_listing_visible),
- params = PF.fn.deparam($content_listing.data("params"));
-
- if($content_listing.data("offset")) {
- PF.obj.listing.query_string.offset = $content_listing.data("offset");
- } else {
- delete PF.obj.listing.query_string.offset;
- }
-
- PF.obj.listing.query_string.action = $content_listing.data("action") || "list";
- PF.obj.listing.query_string.list = $content_listing.data("list");
-
- if(typeof params !== "undefined" && typeof params.sort !== "undefined") {
- PF.obj.listing.query_string.sort = params.sort;
- } else {
- PF.obj.listing.query_string.sort = $(":visible"+PF.obj.listing.selectors.sort).data("sort");
- }
-
- PF.obj.listing.query_string.page = 1;
- },
-
- // Stock querystring values for static tab change
- stock_current: function(){
- this.stock_new();
- PF.obj.listing.query_string.page = $(PF.obj.listing.selectors.content_listing_visible).data("page");
- }
-};
-
-// Initial load -> Stock the current querystring
-PF.fn.listing.queryString.stock_load();
-
-PF.fn.listing.ajax = function() {
-
- if(PF.obj.listing.calling == true) {
- return;
- }
-
- PF.obj.listing.calling = true;
-
- var $content_listing = $(PF.obj.listing.selectors.content_listing_visible),
- $pad_content_listing = $(PF.obj.listing.selectors.pad_content, $content_listing);
-
- $(PF.obj.listing.selectors.content_listing_load_more, $content_listing).hide();
- $(PF.obj.listing.selectors.content_listing_loading, $content_listing).removeClass("visibility-hidden").show();
-
- PF.obj.listing.XHR = $.ajax({
- type: "POST",
- data: $.param($.extend({}, PF.obj.listing.query_string, $.ajaxSettings.data))
- }).complete(function(XHR) {
-
- var response = XHR.responseJSON;
- var removePagination = function() {
- $(PF.obj.listing.selectors.content_listing_loading+","+PF.obj.listing.selectors.content_listing_pagination+":not([data-visibility=visible])", $content_listing).remove();
- },
- setEmptyTemplate = function() {
- $content_listing.data("empty", "true").html(PF.obj.listing.template.empty);
- $("[data-content=list-selection][data-tab="+$content_listing.attr("id")+"]").addClass("disabled");
- };
-
- if(XHR.readyState == 4 && typeof response !== "undefined") {
-
- $("[data-content=list-selection][data-tab="+$content_listing.attr("id")+"]").removeClass("disabled");
-
- // Bad Request Bad Request what you gonna do when they come for ya?
- if(XHR.status !== 200) {
- // This is here to inherit the emptys
- var response_output = typeof response.error !== "undefined" && typeof response.error.message !== "undefined" ? response.error.message : "Bad request";
- PF.fn.growl.call("Error: "+response_output);
- $content_listing.data("load", "");
- }
- // Empty HTML
- if((typeof response.html == "undefined" || response.html == "") && $(PF.obj.listing.selectors.list_item, $content_listing).length == 0) {
- setEmptyTemplate();
- }
- // End of the line
- if(typeof response.html == "undefined" || response.html == "") {
- removePagination();
- PF.obj.listing.calling = false;
- if(typeof PF.fn.listing_end == "function") {
- PF.fn.listing_end();
- }
- return;
- }
-
- // Listing stuff
- $content_listing.data({
- "load": "",
- "page": PF.obj.listing.query_string.page
- });
-
- var url_object = $.extend({}, PF.obj.listing.query_string);
- for(var k in PF.obj.listing.hidden_params) {
- if(typeof url_object[k] !== "undefined") {
- delete url_object[k];
- }
- }
-
- delete url_object["action"];
-
- for(var k in url_object) {
- if(!url_object[k]) delete url_object[k];
- }
-
- // get the fancy URL with scrollTop attached
- if(document.URL.indexOf("?" + $.param(url_object)) == -1) {
- var url = window.location.href;
- url = url.split("?")[0].replace(/\/$/, "") + "/?" + $.param(url_object);
- if(window.location.hash) {
- url = url.replace(window.location.hash, '');
- }
- History.pushState({pushed: "pagination", scrollTop: $(window).scrollTop()}, document.title, url);
- }
-
- $("a[data-tab="+$content_listing.attr("id")+"]").attr("href", document.URL);
-
- $pad_content_listing.append(response.html);
-
- PF.fn.listing.show(response, function() {
- $(PF.obj.listing.selectors.content_listing_loading, $content_listing).addClass("visibility-hidden");
- });
-
- } else {
- // Network error, abort or something similar
- PF.obj.listing.calling = false;
- $content_listing.data("load", "");
- removePagination();
- if($(PF.obj.listing.selectors.list_item, $content_listing).length == 0) {
- setEmptyTemplate();
- }
- if(XHR.readyState !== 0) {
- PF.fn.growl.call(PF.fn._s("An error occurred. Please try again later."));
- }
- }
-
- if(typeof PF.fn.listing.ajax.callback == "function") {
- PF.fn.listing.ajax.callback(XHR);
- }
-
- });
-
-};
-
-PF.fn.listing.columnizerQueue = function() {
- $(PF.obj.listing.selectors.content_listing+":hidden").data("queued", true);
-};
-
-PF.fn.listing.refresh = function(animation_time) {
- PF.fn.listing.columnizer(true, animation_time, false);
- $(PF.obj.listing.selectors.list_item).show();
-};
-
-// Peafowl's masonry approach... Just because godlike.
-var width = $(window).width();
-PF.fn.listing.columnizer = function(forced, animation_time, hard_forced) {
-
- var device_to_columns = { // default
- phone: 1,
- phablet: 3,
- tablet: 4,
- laptop: 5,
- desktop: 6,
- largescreen: 7,
- };
-
- if(typeof forced !== "boolean") var forced = false;
- if(typeof PF.obj.listing.mode == "undefined") forced = true;
- if(typeof hard_forced !== "boolean") {
- var hard_forced = false,
- default_hard_forced = true;
- } else {
- var default_hard_forced = false;
- }
- if(!hard_forced && default_hard_forced) {
- if(width !== $(window).width() || forced) {
- hard_forced = true;
- }
- }
-
- if(typeof animation_time == typeof undefined) var animation_time = PF.obj.config.animation.normal;
-
- //animation_time = 0;
-
- var $container = $("#content-listing-tabs").exists() ? $(PF.obj.listing.selectors.content_listing_visible, "#content-listing-tabs") : $(PF.obj.listing.selectors.content_listing),
- $pad_content_listing = $(PF.obj.listing.selectors.pad_content, $container),
- list_mode = "responsive",
- $list_item = $(forced || hard_forced ? PF.obj.listing.selectors.list_item : PF.obj.listing.selectors.list_item+":not(.jsly)", $container);
-
- $container.addClass("jsly");
-
- // Get the device columns from global config
- if(typeof PF.obj.config.listing.device_to_columns !== "undefined") {
- device_to_columns = $.extend({}, device_to_columns, PF.obj.config.listing.device_to_columns);
- }
-
- // Get the device columns from the dom
- if($container.data("device-columns")) {
- device_to_columns = $.extend({}, device_to_columns, $container.data("device-columns"));
- }
-
- PF.obj.listing.mode = list_mode;
- PF.obj.listing.device = PF.fn.getDeviceName();
-
- if(!$list_item.exists()) return;
-
- if(typeof $container.data("columns") !== "undefined" && !forced && !hard_forced){
- PF.obj.listing.columns = $container.data("columns");
- PF.obj.listing.columns_number = $container.data("columns").length - 1;
- PF.obj.listing.current_column = $container.data("current_column");
- } else {
-
- var $list_item_1st = $list_item.first();
- $list_item_1st.css("width", "");
-
- PF.obj.listing.columns = new Array();
- PF.obj.listing.columns_number = device_to_columns[PF.fn.getDeviceName()];
-
- for(i=0; i 6 ? "small-cols" : "");
-
- $pad_content_listing.css("width", "100%");
-
- var delay = 0;
-
- $list_item.each(function(index) {
-
- $(this).addClass("jsly");
-
- var $list_item_img = $(".list-item-image", this),
- $list_item_src = $(".list-item-image img", this),
- $list_item_thumbs = $(".list-item-thumbs", this),
- isJslyLoaded = $list_item_src.hasClass("jsly-loaded");
-
- $list_item_src.show();
-
- if(hard_forced) {
- $(this).css({top: "", left: "", height: "", position: ""});
- $list_item_img.css({maxHeight: "", height: ""});
- $list_item_src.removeClass("jsly").css({width: "", height: ""}).parent().css({
- marginLeft: "",
- marginTop: ""
- });
- $("li", $list_item_thumbs).css({width: "", height: ""});
- }
-
- var width_responsive = PF.obj.listing.columns_number == 1 ? "100%" : parseInt((1/PF.obj.listing.columns_number)*($container.width() - (10 * (PF.obj.listing.columns_number - 1))) + "px");
- $(this).css("width", width_responsive);
-
- if(PF.obj.listing.current_column > PF.obj.listing.columns_number){
- PF.obj.listing.current_column = 1
- }
-
- $(this).attr("data-col", PF.obj.listing.current_column);
-
- if(!$list_item_src.exists()){
- var empty = true;
- $list_item_src = $(".image-container .empty", this);
- }
-
- var already_shown = $(this).is(":visible");
- $list_item.show();
-
- var isFixed = $list_item_img.hasClass("fixed-size");
-
- var image = {
- w: parseInt($list_item_src.attr("width")),
- h: parseInt($list_item_src.attr("height"))
- };
- image.ratio = image.w / image.h;
-
- //$list_item_src.removeAttr("width height"); // para fixed
-
- if(hard_forced && PF.obj.listing.columns_number > 1) {
- $list_item_src.css({width: "auto", height: "auto"});
- $(".image-container:not(.list-item-avatar-cover)", this).css({width: "", height: "auto"});
- } else {
- if(image.w > $container.width()) {
- $(".image-container:not(.list-item-avatar-cover)", this).css(image.ratio < 1 ? {maxWidth: "100%", height: "auto"} : {height: "100%", width: "auto"});
- $list_item_src.css(image.ratio < 1 ? {maxWidth: "100%", height: "auto"} : {height: "100%", width: "auto"});
- }
- }
-
- // Meet the minHeight?
-
- if(empty || ($list_item_img.css("min-height") && !$list_item_src.hasClass("jsly"))) {
-
- var list_item_img_min_height = parseInt($list_item_img.css("height")),
- col = {
- w: $(this).width(),
- h: isFixed ? $(this).width() : null
- },
- magicWidth = Math.min(image.w, image.w < col.w ? image.w : col.w);
-
-
- if(isFixed){
- $list_item_img.css({height: col.w}); // Sets the item container height
- if(image.ratio <= 3 && (image.ratio > 1 || image.ratio==1)) { // Landscape or square
- image.h = Math.min(image.h, image.w < col.w ? image.w : col.w);
- image.w = image.h * image.ratio;
- } else { // Portrait
- image.w = magicWidth;
- image.h = image.w / image.ratio;
- }
- var list_item_img_min_h = parseInt($list_item_img.css("min-height"));
- $list_item_img.css("min-height", 0);
- } else { // Fluid height
- image.w = magicWidth;
- if(image.ratio >= 3 || image.ratio < 1 || image.ratio==1){ // Portrait or square
- image.h = image.w / image.ratio;
- } else { // Landscape
- image.h = Math.min(image.h, image.w);
- image.w = image.h * image.ratio;
- }
- if(empty) {
- image.h = col.w;
- }
- $list_item_img.css({height: image.h}); // Fill some gaps
- }
- $list_item_src.css({width: image.w, height: image.h});
-
- if($list_item_src.width() == 0) {
- $list_item_src.css({width: magicWidth, height: magicWidth / image.ratio});
- }
-
- if($(".image-container", this).is(".list-item-avatar-cover")) {
- $list_item_src.css(isFixed ? {width: "auto", height: "100%"} : {width: "100%", height: "auto"});
- }
- if($list_item_src.height() !== 0 && ($list_item_img.height() > $list_item_src.height() || isFixed)){
- $list_item_src.parent().css({
- "marginTop": ($list_item_img.outerHeight() - $list_item_src.height())/2
- });
- }
- if($list_item_img.width() < $list_item_src.width()){
- $list_item_src.parent().css({
- "marginLeft": - (($list_item_src.outerWidth()-$list_item_img.width())/2) + "px"
- });
- }
-
- var list_item_src_pitfall_x = Math.max($list_item_src.position().left * 2, 0),
- list_item_src_pitfall_y = Math.max($list_item_src.position().top * 2, 0);
-
- // Do we need upscale, and is safe to upscale the image?
- if(PF.obj.listing.columns_number > 6 && (list_item_src_pitfall_x > 0 || list_item_src_pitfall_y > 0)){
- var pitfall_ratio_x = list_item_src_pitfall_x/$list_item_img.width(),
- pitfall_ratio_y = list_item_src_pitfall_y/$list_item_img.height(),
- pitfall = {};
- if(pitfall_ratio_x <= .25 && pitfall_ratio_y <= .25){
- if(pitfall_ratio_x > pitfall_ratio_y){
- pitfall.width = list_item_src_pitfall_x + $list_item_img.width();
- pitfall.height = pitfall.width / image.ratio;
- } else {
- pitfall.height = list_item_src_pitfall_y + $list_item_src.height();
- pitfall.width = pitfall.height * image.ratio;
- }
- $list_item_src.css(pitfall);
- $list_item_src.parent().css({
- "marginLeft": -(($list_item_src.width()-$list_item_img.width())/2),
- "marginTop": 0
- });
- }
- }
-
- if($list_item_thumbs.exists()) {
- $("li", $list_item_thumbs).css({width: 100/$("li", $list_item_thumbs).length + "%"}).css({height: $("li", $list_item_thumbs).width()});
- }
-
- if(!already_shown) {
- $list_item.hide();
- }
-
- }
-
- //$pad_content_listing.css("visibility", "visible");
-
- if(!$list_item_src.hasClass("jsly") && $(this).is(":hidden")) {
- $(this).css('top', "100%");
- }
-
- PF.obj.listing.columns[PF.obj.listing.current_column] += $(this).outerHeight(true);
-
- if(PF.obj.listing.columns_number == 1) {
- $(this).removeClass("position-absolute");
- } else {
- if($(this).is(":animated")) {
- animation_time = 0;
- }
- $(this).addClass("position-absolute");
-
- var new_left = $(this).outerWidth(true)*(PF.obj.listing.current_column - 1);
- var must_change_left = parseInt($(this).css("left")) != new_left;
- if(must_change_left) {
- animate_grid = true;
- $(this).animate({
- left: new_left
- }, animation_time);
- }
-
- var new_top = PF.obj.listing.columns[PF.obj.listing.current_column] - $(this).outerHeight(true);
- if(parseInt($(this).css("top")) != new_top) {
- animate_grid = true;
- $(this).animate({
- top: new_top
- }, animation_time);
- if(must_change_left) {
- delay = 1;
- }
- }
- }
-
- if(already_shown) {
- $list_item.show();
- }
-
- if(!isJslyLoaded) {
- $list_item_src.addClass("jsly").hide().imagesLoaded(function(){
- $(this).show().addClass("jsly-loaded");
- });
- }
-
- // Fill the shortest column (fluid view only)
- if(!isFixed) {
- var minCol, minH, currentH;
- for(var i=1; i<=PF.obj.listing.columns_number; i++){
- currentH = PF.obj.listing.columns[i];
-
- if(typeof minH == "undefined") {
- minH = currentH;
- minCol = i;
- }
-
- if(PF.obj.listing.columns[i] == 0) {
- minCol = i;
- break;
- }
- if(currentH < minH) {
- minH = PF.obj.listing.columns[i];
- minCol = i;
- }
- }
-
- PF.obj.listing.current_column = minCol;
- } else {
- PF.obj.listing.current_column++;
- }
-
- });
-
- $container.data({"columns": PF.obj.listing.columns, "current_column": PF.obj.listing.current_column});
-
- var content_listing_height = 0;
- $.each(PF.obj.listing.columns, function(i, v){
- if(v>content_listing_height) {
- content_listing_height = v;
- }
- });
-
- PF.obj.listing.width = $container.width();
-
- if(typeof PF.obj.listing.height !== typeof undefined) {
- var old_listing_height = PF.obj.listing.height;
- }
- PF.obj.listing.height = content_listing_height;
-
- var do_listing_h_resize = typeof old_listing_height !== typeof undefined && old_listing_height !== PF.obj.listing.height;
-
- if(!do_listing_h_resize) {
- $pad_content_listing.height(content_listing_height);
- PF.fn.list_fluid_width();
- }
-
- // Magic!
- if(do_listing_h_resize) {
- $pad_content_listing.height(old_listing_height);
- setTimeout(function() {
- $pad_content_listing.animate({height: content_listing_height}, animation_time, function() {
- PF.fn.list_fluid_width();
- });
- }, animation_time * delay);
- }
-
- $container.data("list-mode", PF.obj.listing.mode);
- $(PF.obj.listing.selectors.content_listing_visible).data("queued", false);
-
-};
-
-
-/**
- * PEAFOWL LOADERS
- * -------------------------------------------------------------------------------------------------
- */
-PF.fn.loading = {
- spin: {
- small: {lines: 11, length: 0, width: 3, radius: 7, speed: 1, trail: 45, blocksize: 20}, // 20x20
- normal: {lines: 11, length: 0, width: 5, radius: 10, speed: 1, trail: 45, blocksize: 30}, // 30x30
- big: {lines: 11, length: 0, width: 7, radius: 13, speed: 1, trail: 45, blocksize: 40}, // 40x40
- huge: {lines: 11, length: 0, width: 9, radius: 16, speed: 1, trail: 45, blocksize: 50} // 50x50
- },
- inline: function($target, options){
-
- if(typeof $target == "undefined") return;
-
- if($target instanceof jQuery == false) {
- var $target = $($target);
- }
-
- var defaultoptions = {
- size: "normal",
- color: $("body").css("color"),
- center: false,
- position: "absolute",
- shadow: false,
- valign: "top"
- };
-
- if(typeof options == "undefined"){
- options = defaultoptions;
- } else {
- for(var k in defaultoptions) {
- if(typeof options[k] == "undefined") {
- options[k] = defaultoptions[k];
- }
- }
- }
-
- var size = PF.fn.loading.spin[options.size];
-
- PF.fn.loading.spin[options.size].color = options.color;
- PF.fn.loading.spin[options.size].shadow = options.shadow;
-
- $target.html(' ' + (typeof options.message !== "undefined" ? ''+ options.message +' ' : '')).css({"line-height": PF.fn.loading.spin[options.size].blocksize + "px"});
-
- $(".loading-indicator", $target).css({width: PF.fn.loading.spin[options.size].blocksize, height: PF.fn.loading.spin[options.size].blocksize}).spin(PF.fn.loading.spin[options.size]);
-
- if(options.center){
- $(".loading-indicator", $target.css("textAlign", "center")).css({
- position: options.position,
- top: "50%",
- left: "50%",
- marginTop: -(PF.fn.loading.spin[options.size].blocksize/2),
- marginLeft: -(PF.fn.loading.spin[options.size].blocksize/2)
- });
- }
- if(options.valign == "center") {
- $(".loading-indicator,.loading-text", $target).css("marginTop", ($target.height()-PF.fn.loading.spin[options.size].blocksize)/2 + "px");
- }
-
- $(".spinner", $target).css({top: PF.fn.loading.spin[options.size].blocksize/2 + "px", left: PF.fn.loading.spin[options.size].blocksize/2 + "px"});
-
- },
- fullscreen: function(){
- $("body").append('' + PF.fn._s("loading") + '
');
- $(".fullscreen-loader", "#pf-fullscreen-loader").spin(PF.fn.loading.spin.huge);
- $("#pf-fullscreen-loader").css("opacity", 1);
- },
- destroy : function($target){
- var $loader_fs = $("#pf-fullscreen-loader"),
- $loader_os = $("#pf-onscreen-loader");
-
- if($target == "fullscreen") $target = $loader_fs;
- if($target == "onscreen") $target = $loader_os;
-
- if(typeof $target !== "undefined"){
- $target.remove();
- } else {
- $loader_fs.remove();
- $loader_os.remove();
- }
- }
-};
-
-/**
- * PEAFOWL FORM HELPERS
- * -------------------------------------------------------------------------------------------------
- */
-jQuery.fn.disableForm = function(){
- $(this).data("disabled", true);
- $(":input", this).each(function(){
- $(this).attr("disabled", true);
- });
- return this;
-};
-jQuery.fn.enableForm = function(){
- $(this).data("disabled", false);
- $(":input", this).removeAttr("disabled");
- return this;
-};
-
-/**
- * PEAFOWL FOLLOW SCROLL
- * -------------------------------------------------------------------------------------------------
- */
-PF.obj.follow_scroll = {
- Y: 0,
- y: 0,
- $node: $(".follow-scroll"),
- node_h: 0,
- set: function() {
- var exists = PF.obj.follow_scroll.$node.closest(".follow-scroll-wrapper").exists();
- if(exists) {
- PF.obj.follow_scroll.$node.closest(".follow-scroll-wrapper").css("position", "static");
- }
- PF.obj.follow_scroll.y = PF.obj.follow_scroll.$node.exists() ? PF.obj.follow_scroll.$node.offset().top : null;
- PF.obj.follow_scroll.node_h = PF.obj.follow_scroll.$node.outerHeight();
- if(exists) {
- PF.obj.follow_scroll.$node.closest(".follow-scroll-wrapper").css("position", "");
- }
- },
- checkDocumentHeight: function(){
- var lastHeight = document.body.clientHeight, newHeight, timer;
- (function run(){
- newHeight = document.body.clientHeight;
- if(lastHeight != newHeight)
- PF.obj.follow_scroll.set();
- lastHeight = newHeight;
- timer = setTimeout(run, 200);
- })();
- }
-};
-PF.obj.follow_scroll.set();
-PF.obj.follow_scroll.checkDocumentHeight();
-
-PF.obj.follow_scroll.process = function(){
-
- if(!PF.obj.follow_scroll.$node.exists() || PF.fn.isDevice("phone")) return; // Nothing to do here
-
- var $parent = PF.obj.follow_scroll.$node.closest("[data-content=follow-scroll-parent]");
- if(!$parent.exists()) {
- $parent = PF.obj.follow_scroll.$node.closest(".content-width");
- }
-
- var top = PF.obj.follow_scroll.node_h, // - parseInt($("#top-bar").css("top"))
- cond = $(window).scrollTop() > PF.obj.follow_scroll.y - top;
-
- if($("#top-bar").css("position") !== "fixed") {
- PF.obj.follow_scroll.Y -= $(window).scrollTop();
- if(PF.obj.follow_scroll.Y < 0) PF.obj.follow_scroll.Y = 0;
- cond = cond && $(window).scrollTop() > PF.obj.follow_scroll.y;
- }
-
- var $wrapper = PF.obj.follow_scroll.$node.closest('.follow-scroll-wrapper');
-
- if((cond && $wrapper.hasClass("position-fixed")) || (!cond && !$wrapper.hasClass("position-fixed"))) {
- return;
- }
-
- if(!$wrapper.exists()) {
- PF.obj.follow_scroll.$node.wrapAll('
');
- $wrapper = PF.obj.follow_scroll.$node.closest('.follow-scroll-wrapper');
- }
-
- $wrapper.height(PF.obj.follow_scroll.node_h);
-
- PF.obj.follow_scroll.Y = $("#top-bar").outerHeight(true) + parseInt($("#top-bar").css("top"));
-
- if(cond){
- var placeholderHeight = PF.obj.follow_scroll.$node.outerHeight(true);
- $wrapper
- .addClass("position-fixed")
- .css({top: PF.obj.follow_scroll.Y});
- if(!$wrapper.next().is(".follow-scroll-placeholder")) {
- $wrapper.after($('
').css("height", placeholderHeight));
- } else {
- $wrapper.parent().find(".follow-scroll-placeholder").show();
- }
- } else {
- $wrapper.removeClass("position-fixed").css({top: "", width: "", height: ""});
- $wrapper.parent().find(".follow-scroll-placeholder").hide();
- }
-
-
- $("[data-show-on=follow-scroll]")[(cond ? "remove" : "add") + "Class"]("hidden soft-hidden");
-
- if(!$("html").data("top-bar-box-shadow-prevent")) {
- $("html")[(cond ? "add" : "remove") + "Class"]("top-bar-box-shadow-none");
- }
-
- PF.obj.follow_scroll.$node[(cond ? "add" : "remove") + "Class"]("content-width");
-
-};
-
-PF.fn.isDevice = function(device) {
- if(typeof device == "object") {
- var device = '.' + device.join(",.");
- } else {
- var device = '.' + device;
- }
- return $("html").is(device);
-};
-
-PF.fn.getDeviceName = function() {
- var current_device;
- $.each(PF.obj.devices, function(i,v) {
- if(PF.fn.isDevice(v)) {
- current_device = v;
- return true;
- }
- });
- return current_device;
-};
-
-PF.fn.topMenu = {
- vars : {
- $button : $("[data-action=top-bar-menu-full]", "#top-bar"),
- menu : "#menu-fullscreen",
- speed: PF.obj.config.animation.fast,
- menu_top: (parseInt($("#top-bar").outerHeight()) + parseInt($("#top-bar").css("top")) + parseInt($("#top-bar").css("margin-top")) + parseInt($("#top-bar").css("margin-bottom")) - parseInt($("#top-bar").css("border-bottom-width"))) + "px"
- },
- show: function(speed) {
-
- if($("body").is(":animated")) return;
-
- if(typeof speed == "undefined") {
- var speed = this.vars.speed;
- }
-
- this.vars.$button.addClass("current");
- $("html").addClass("menu-fullscreen-visible");
- $("#top-bar").css("position", "fixed").append($("
", {
- id: "menu-fullscreen",
- "class": "touch-scroll",
- html: $('', {
- html: $(".top-bar-left").html() + $(".top-bar-right").html()
- })
- }).css({
- borderTopWidth: this.vars.menu_top,
- left: "-100%",
- //height: $(window).height(), // aca
- }));
-
- var $menu = $(this.vars.menu);
-
- $("li.phone-hide, li > .top-btn-text, li > .top-btn-text > span, li > a > .top-btn-text > span", $menu).each(function() {
- $(this).removeClass("phone-hide");
- });
- $("[data-action=top-bar-menu-full]", $menu).remove();
- $(".btn.black, .btn.default, .btn.blue, .btn.green, .btn.orange, .btn.red, .btn.transparent", $menu).removeClass("btn black default blue green orange red transparent");
-
- setTimeout(function() {
- $menu.css({transform: "translate(100%, 0)"});
- }, 1);
- setTimeout(function() {
- $("html").css({backgroundColor: ""});
- }, this.vars.speed);
- },
- hide: function(speed) {
-
- if($("body").is(":animated")) return;
-
- if(!$(this.vars.menu).is(":visible")) return;
-
- if(typeof speed == "undefined") {
- var speed = this.vars.speed;
- }
-
- $("#top-bar").css("position", "");
-
- this.vars.$button.removeClass("current");
- $("html").removeClass("menu-fullscreen-visible");
- var $menu = $(this.vars.menu);
- $menu.css({
- transform: "none"
- });
- setTimeout(function() {
- $menu.remove();
- }, speed);
- }
-};
-
-/**
- * PEAFOWL FULL SCREEN VIEWER
- * -------------------------------------------------------------------------------------------------
- */
-// nota: incompleto
-/*$("img", ".list-item-image").click(function(e){
- if(!$(this).closest(".fullscreen-enable").exists()) return;
- e.preventDefault();
- $(this).closest(PF.obj.listing.selectors.content_listing).find(".navigation-pointer").removeClass("navigation-pointer");
- $(this).closest(".list-item").addClass("navigation-pointer");
- PF.fn.fullscreen.content($(this).attr("src").replace("_e",""));
- PF.fn.fullscreen.call();
-});
-
-$("a", ".fullscreen-viewer-navigation").click(function(){
- if($(this).hasClass("disabled")) return;
- $current_navigation_pointer = $(".navigation-pointer", PF.obj.listing.selectors.content_listing);
-
- switch($(this).attr("data-action")){
- case "prev":
- if(!$current_navigation_pointer.prev().exists()) return;
- $target = $current_navigation_pointer.prev();
- break;
- case "next":
- if(!$current_navigation_pointer.next().exists()) return;
- $target = $current_navigation_pointer.next();
- break;
- case "close":
- $(this).closest(".fullscreen").hide().find(".fullscreen-viewer-content img").attr("src", "");
- $("body").removeClass("overflow-hidden");
- return;
- break;
- }
-
- $current_navigation_pointer.removeClass("navigation-pointer");
- $target.addClass("navigation-pointer");
-
- $new_navigation_pointer = $(".navigation-pointer", PF.obj.listing.selectors.content_listing);
-
- PF.fn.fullscreen.content($new_navigation_pointer.find(".list-item-image img").attr("src").replace("_e",""));
-
- PF.fn.fullscreen.call();
-
-});*/
-/*
-PF.fn.fullscreen = {
- selectors: {
- fullscreen: ".fullscreen",
- container: "#fullscreen-viewer",
- content: ".fullscreen-viewer-content",
- top: ".fullscreen-viewer-top",
- nav: ".fullscreen-viewer-navigation"
- },
- call: function(){
- PF.fn.fullscreen.update_nav();
- if(!$(this.str.fullscreen).is(":visible")){
- $(this.str.fullscreen).show();
- $("body").addClass("overflow-hidden");
- PF.fn.fullscreen.size();
- }
-
- $(this.str.content).hide().imagesLoaded(function(){
- PF.fn.fullscreen.size();
- $(this).show();
- });
- },
-
- // Fix the fullscreen size
- size: function(){
- if(!$(this.str.container).is(":visible")) return;
- $("img", this.str.content).css("margin-top", 0);
-
- var window_height = $(window).height();
- $(this.str.fullscreen).height(window_height);
- var fullscreen_content_height = window_height - ($(this.str.top).length > 0 ? $(this.str.top).height() : 0);
-
- $(this.str.content).height(fullscreen_content_height).show();
-
- var $fullscreen_content_img = $("img", this.str.content),
- fullscreen_content_img_height = $("img", this.str.content).height();
-
- $("img", this.str.content).css("margin-top", (fullscreen_content_height - fullscreen_content_img_height)/2);
- },
- update_nav: function(){
- var $navigation_pointer = $(".navigation-pointer"),
- $next_button_nav = $(this.str.nav).find('[data-action="next"]'),
- $prev_button_nav = $(this.str.nav).find('[data-action="prev"]');
-
- $next_button_nav.toggleClass("disabled", !$navigation_pointer.next().exists());
- $prev_button_nav.toggleClass("disabled", !$navigation_pointer.prev().exists());
- },
- content: function(src){
- $("img", this.str.content).remove();
- $(".img-src-parent", this.str.content).append(' ');
- },
- next: function(){
- },
- prev: function(){
- }
-};
-*/
-/**
- * JQUERY PLUGINS (strictly needed plugins)
- * -------------------------------------------------------------------------------------------------
- */
-
- // http://phpjs.org/functions/sprintf/
-function sprintf(){var e=/%%|%(\d+\$)?([-+\'#0 ]*)(\*\d+\$|\*|\d+)?(\.(\*\d+\$|\*|\d+))?([scboxXuideEfFgG])/g;var t=arguments;var n=0;var r=t[n++];var i=function(e,t,n,r){if(!n){n=" "}var i=e.length>=t?"":(new Array(1+t-e.length>>>0)).join(n);return r?e+i:i+e};var s=function(e,t,n,r,s,o){var u=r-e.length;if(u>0){if(n||!s){e=i(e,r,o,n)}else{e=e.slice(0,t.length)+i("",u,"0",true)+e.slice(t.length)}}return e};var o=function(e,t,n,r,o,u,a){var f=e>>>0;n=n&&f&&{2:"0b",8:"0",16:"0x"}[t]||"";e=n+i(f.toString(t),u||0,"0",false);return s(e,n,r,o,a)};var u=function(e,t,n,r,i,o){if(r!=null){e=e.slice(0,r)}return s(e,"",t,n,i,o)};var a=function(e,r,a,f,l,c,h){var p,d,v,m,g;if(e==="%%"){return"%"}var y=false;var b="";var w=false;var E=false;var S=" ";var x=a.length;for(var T=0;a&&T-1?6:h==="d"?0:undefined}else if(c==="*"){c=+t[n++]}else if(c.charAt(0)=="*"){c=+t[c.slice(1,-1)]}else{c=+c}g=r?t[r.slice(0,-1)]:t[n++];switch(h){case"s":return u(String(g),y,f,c,w,S);case"c":return u(String.fromCharCode(+g),y,f,c,w);case"b":return o(g,2,E,y,f,c,w);case"o":return o(g,8,E,y,f,c,w);case"x":return o(g,16,E,y,f,c,w);case"X":return o(g,16,E,y,f,c,w).toUpperCase();case"u":return o(g,10,E,y,f,c,w);case"i":case"d":p=+g||0;p=Math.round(p-p%1);d=p<0?"-":b;g=d+i(String(Math.abs(p)),c,"0",false);return s(g,d,y,f,w);case"e":case"E":case"f":case"F":case"g":case"G":p=+g;d=p<0?"-":b;v=["toExponential","toFixed","toPrecision"]["efg".indexOf(h.toLowerCase())];m=["toString","toUpperCase"]["eEfFgG".indexOf(h)%2];g=d+Math.abs(p)[v](c);return s(g,d,y,f,w)[m]();default:return e}};return r.replace(e,a)};
-
-/**
- * jQuery imagesLoaded plugin v1.1.0
- * http://github.com/desandro/imagesloaded
- * MIT License. by Paul Irish et al.
- */
-jQuery.fn.imagesLoaded=function(e){function o(){e.call(t,n)}function u(e){var t=e.target;if(t.src!==i&&$.inArray(t,s)===-1){s.push(t);if(--r<=0){setTimeout(o);n.unbind(".imagesLoaded",u)}}}var t=this,n=t.find("img").add(t.filter("img")),r=n.length,i="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw==",s=[];if(!r)o();n.bind("load.imagesLoaded error.imagesLoaded",u).each(function(){var e=this.src;this.src=i;this.src=e});return t};
-
-/**
- * TipTip
- * Copyright 2010 Drew Wilson
- * code.drewwilson.com/entry/tiptip-jquery-plugin
- *
- * Version 1.3(modified) - Updated: Jun. 23, 2011
- * http://drew.tenderapp.com/discussions/tiptip/70-updated-tiptip-with-new-features
- *
- * This TipTip jQuery plug-in is dual licensed under the MIT and GPL licenses:
- * http://www.opensource.org/licenses/mit-license.php
- * http://www.gnu.org/licenses/gpl.html
- */
-(function($){$.fn.tipTip=function(options){var defaults={activation:"hover",keepAlive:false,maxWidth:"200px",edgeOffset:6,defaultPosition:"bottom",delay:400,fadeIn:200,fadeOut:200,attribute:"title",content:false,enter:function(){},afterEnter:function(){},exit:function(){},afterExit:function(){},cssClass:""};if($("#tiptip_holder").length<=0){var tiptip_holder=$('
');var tiptip_content=$('
');var tiptip_arrow=$('
');$("body").append(tiptip_holder.html(tiptip_content).prepend(tiptip_arrow.html('
')))}else{var tiptip_holder=$("#tiptip_holder");var tiptip_content=$("#tiptip_content");var tiptip_arrow=$("#tiptip_arrow")}return this.each(function(){var org_elem=$(this),data=org_elem.data("tipTip"),opts=data&&data.options||$.extend(defaults,options),callback_data={holder:tiptip_holder,content:tiptip_content,arrow:tiptip_arrow,options:opts};if(data){switch(options){case"show":active_tiptip();break;case"hide":deactive_tiptip();break;case"destroy":org_elem.unbind(".tipTip").removeData("tipTip");break}}else{var timeout=false;org_elem.data("tipTip",{options:opts});if(opts.activation=="hover"){org_elem.bind("mouseenter.tipTip",function(){active_tiptip()}).bind("mouseleave.tipTip",function(){if(!opts.keepAlive){deactive_tiptip()}else{tiptip_holder.one("mouseleave.tipTip",function(){deactive_tiptip()})}})}else{if(opts.activation=="focus"){org_elem.bind("focus.tipTip",function(){active_tiptip()}).bind("blur.tipTip",function(){deactive_tiptip()})}else{if(opts.activation=="click"){org_elem.bind("click.tipTip",function(e){e.preventDefault();active_tiptip();return false}).bind("mouseleave.tipTip",function(){if(!opts.keepAlive){deactive_tiptip()}else{tiptip_holder.one("mouseleave.tipTip",function(){deactive_tiptip()})}})}else{if(opts.activation=="manual"){}}}}}function active_tiptip(){if(opts.enter.call(org_elem,callback_data)===false){return}var org_title;if(opts.content){org_title=$.isFunction(opts.content)?opts.content.call(org_elem,callback_data):opts.content}else{org_title=opts.content=org_elem.attr(opts.attribute);org_elem.removeAttr(opts.attribute)}if(!org_title){return}tiptip_content.html(org_title);tiptip_holder.hide().removeAttr("class").css({margin:"0px","max-width":opts.maxWidth});if(opts.cssClass){tiptip_holder.addClass(opts.cssClass)}tiptip_arrow.removeAttr("style");var top=parseInt(org_elem.offset()["top"]),left=parseInt(org_elem.offset()["left"]),org_width=parseInt(org_elem.outerWidth()),org_height=parseInt(org_elem.outerHeight()),tip_w=tiptip_holder.outerWidth(),tip_h=tiptip_holder.outerHeight(),w_compare=Math.round((org_width-tip_w)/2),h_compare=Math.round((org_height-tip_h)/2),marg_left=Math.round(left+w_compare),marg_top=Math.round(top+org_height+opts.edgeOffset),t_class="",arrow_top="",arrow_left=Math.round(tip_w-12)/2;if(opts.defaultPosition=="bottom"){t_class="_bottom"}else{if(opts.defaultPosition=="top"){t_class="_top"}else{if(opts.defaultPosition=="left"){t_class="_left"}else{if(opts.defaultPosition=="right"){t_class="_right"}}}}var right_compare=(w_compare+left)parseInt($(window).width());if((right_compare&&w_compare<0)||(t_class=="_right"&&!left_compare)||(t_class=="_left"&&left<(tip_w+opts.edgeOffset+5))){t_class="_right";arrow_top=Math.round(tip_h-13)/2;arrow_left=-12;marg_left=Math.round(left+org_width+opts.edgeOffset);marg_top=Math.round(top+h_compare)}else{if((left_compare&&w_compare<0)||(t_class=="_left"&&!right_compare)){t_class="_left";arrow_top=Math.round(tip_h-13)/2;arrow_left=Math.round(tip_w);marg_left=Math.round(left-(tip_w+opts.edgeOffset+5));marg_top=Math.round(top+h_compare)}}var top_compare=(top+org_height+opts.edgeOffset+tip_h+8)>parseInt($(window).height()+$(window).scrollTop()),bottom_compare=((top+org_height)-(opts.edgeOffset+tip_h+8))<0;if(top_compare||(t_class=="_bottom"&&top_compare)||(t_class=="_top"&&!bottom_compare)){if(t_class=="_top"||t_class=="_bottom"){t_class="_top"}else{t_class=t_class+"_top"}arrow_top=tip_h;marg_top=Math.round(top-(tip_h+5+opts.edgeOffset))}else{if(bottom_compare|(t_class=="_top"&&bottom_compare)||(t_class=="_bottom"&&!top_compare)){if(t_class=="_top"||t_class=="_bottom"){t_class="_bottom"}else{t_class=t_class+"_bottom"}arrow_top=-12;marg_top=Math.round(top+org_height+opts.edgeOffset)}}if(t_class=="_right_top"||t_class=="_left_top"){marg_top=marg_top+5}else{if(t_class=="_right_bottom"||t_class=="_left_bottom"){marg_top=marg_top-5}}if(t_class=="_left_top"||t_class=="_left_bottom"){marg_left=marg_left+5}tiptip_arrow.css({"margin-left":arrow_left+"px","margin-top":arrow_top+"px"});tiptip_holder.css({"margin-left":marg_left+"px","margin-top":marg_top+"px"}).addClass("tip"+t_class);if(timeout){clearTimeout(timeout)}timeout=setTimeout(function(){tiptip_holder.stop(true,true).fadeIn(opts.fadeIn)},opts.delay);opts.afterEnter.call(org_elem,callback_data)}function deactive_tiptip(){if(opts.exit.call(org_elem,callback_data)===false){return}if(timeout){clearTimeout(timeout)}tiptip_holder.fadeOut(opts.fadeOut);opts.afterExit.call(org_elem,callback_data)}})}})(jQuery);
-
-/**
- * jQuery UI Touch Punch 0.2.2
- * Copyright 2011, Dave Furfero
- * Dual licensed under the MIT or GPL Version 2 licenses.
- * Depends: jquery.ui.widget jquery.ui.mouse
- */
-(function(b){b.support.touch="ontouchend" in document;if(!b.support.touch){return;}var c=b.ui.mouse.prototype,e=c._mouseInit,a;function d(g,h){if(g.originalEvent.touches.length>1){return;}g.preventDefault();var i=g.originalEvent.changedTouches[0],f=document.createEvent("MouseEvents");f.initMouseEvent(h,true,true,window,1,i.screenX,i.screenY,i.clientX,i.clientY,false,false,false,false,0,null);g.target.dispatchEvent(f);}c._touchStart=function(g){var f=this;if(a||!f._mouseCapture(g.originalEvent.changedTouches[0])){return;}a=true;f._touchMoved=false;d(g,"mouseover");d(g,"mousemove");d(g,"mousedown");};c._touchMove=function(f){if(!a){return;}this._touchMoved=true;d(f,"mousemove");};c._touchEnd=function(f){if(!a){return;}d(f,"mouseup");d(f,"mouseout");if(!this._touchMoved){d(f,"click");}a=false;};c._mouseInit=function(){var f=this;f.element.bind("touchstart",b.proxy(f,"_touchStart")).bind("touchmove",b.proxy(f,"_touchMove")).bind("touchend",b.proxy(f,"_touchEnd"));e.call(f);};})(jQuery);
-
-/**
- * fileOverview TouchSwipe - jQuery Plugin
- * version 1.6.5
-*/
-(function(a){if(typeof define==="function"&&define.amd&&define.amd.jQuery){define(["jquery"],a)}else{a(jQuery)}}(function(e){var o="left",n="right",d="up",v="down",c="in",w="out",l="none",r="auto",k="swipe",s="pinch",x="tap",i="doubletap",b="longtap",A="horizontal",t="vertical",h="all",q=10,f="start",j="move",g="end",p="cancel",a="ontouchstart" in window,y="TouchSwipe";var m={fingers:1,threshold:75,cancelThreshold:null,pinchThreshold:20,maxTimeThreshold:null,fingerReleaseThreshold:250,longTapThreshold:500,doubleTapThreshold:200,swipe:null,swipeLeft:null,swipeRight:null,swipeUp:null,swipeDown:null,swipeStatus:null,pinchIn:null,pinchOut:null,pinchStatus:null,click:null,tap:null,doubleTap:null,longTap:null,triggerOnTouchEnd:true,triggerOnTouchLeave:false,allowPageScroll:"auto",fallbackToMouseEvents:true,excludedElements:"label, button, input, select, textarea, a, .noSwipe"};e.fn.swipe=function(D){var C=e(this),B=C.data(y);if(B&&typeof D==="string"){if(B[D]){return B[D].apply(this,Array.prototype.slice.call(arguments,1))}else{e.error("Method "+D+" does not exist on jQuery.swipe")}}else{if(!B&&(typeof D==="object"||!D)){return u.apply(this,arguments)}}return C};e.fn.swipe.defaults=m;e.fn.swipe.phases={PHASE_START:f,PHASE_MOVE:j,PHASE_END:g,PHASE_CANCEL:p};e.fn.swipe.directions={LEFT:o,RIGHT:n,UP:d,DOWN:v,IN:c,OUT:w};e.fn.swipe.pageScroll={NONE:l,HORIZONTAL:A,VERTICAL:t,AUTO:r};e.fn.swipe.fingers={ONE:1,TWO:2,THREE:3,ALL:h};function u(B){if(B&&(B.allowPageScroll===undefined&&(B.swipe!==undefined||B.swipeStatus!==undefined))){B.allowPageScroll=l}if(B.click!==undefined&&B.tap===undefined){B.tap=B.click}if(!B){B={}}B=e.extend({},e.fn.swipe.defaults,B);return this.each(function(){var D=e(this);var C=D.data(y);if(!C){C=new z(this,B);D.data(y,C)}})}function z(a0,aq){var av=(a||!aq.fallbackToMouseEvents),G=av?"touchstart":"mousedown",au=av?"touchmove":"mousemove",R=av?"touchend":"mouseup",P=av?null:"mouseleave",az="touchcancel";var ac=0,aL=null,Y=0,aX=0,aV=0,D=1,am=0,aF=0,J=null;var aN=e(a0);var W="start";var T=0;var aM=null;var Q=0,aY=0,a1=0,aa=0,K=0;var aS=null;try{aN.bind(G,aJ);aN.bind(az,a5)}catch(ag){e.error("events not supported "+G+","+az+" on jQuery.swipe")}this.enable=function(){aN.bind(G,aJ);aN.bind(az,a5);return aN};this.disable=function(){aG();return aN};this.destroy=function(){aG();aN.data(y,null);return aN};this.option=function(a8,a7){if(aq[a8]!==undefined){if(a7===undefined){return aq[a8]}else{aq[a8]=a7}}else{e.error("Option "+a8+" does not exist on jQuery.swipe.options")}return null};function aJ(a9){if(ax()){return}if(e(a9.target).closest(aq.excludedElements,aN).length>0){return}var ba=a9.originalEvent?a9.originalEvent:a9;var a8,a7=a?ba.touches[0]:ba;W=f;if(a){T=ba.touches.length}else{a9.preventDefault()}ac=0;aL=null;aF=null;Y=0;aX=0;aV=0;D=1;am=0;aM=af();J=X();O();if(!a||(T===aq.fingers||aq.fingers===h)||aT()){ae(0,a7);Q=ao();if(T==2){ae(1,ba.touches[1]);aX=aV=ap(aM[0].start,aM[1].start)}if(aq.swipeStatus||aq.pinchStatus){a8=L(ba,W)}}else{a8=false}if(a8===false){W=p;L(ba,W);return a8}else{ak(true)}return null}function aZ(ba){var bd=ba.originalEvent?ba.originalEvent:ba;if(W===g||W===p||ai()){return}var a9,a8=a?bd.touches[0]:bd;var bb=aD(a8);aY=ao();if(a){T=bd.touches.length}W=j;if(T==2){if(aX==0){ae(1,bd.touches[1]);aX=aV=ap(aM[0].start,aM[1].start)}else{aD(bd.touches[1]);aV=ap(aM[0].end,aM[1].end);aF=an(aM[0].end,aM[1].end)}D=a3(aX,aV);am=Math.abs(aX-aV)}if((T===aq.fingers||aq.fingers===h)||!a||aT()){aL=aH(bb.start,bb.end);ah(ba,aL);ac=aO(bb.start,bb.end);Y=aI();aE(aL,ac);if(aq.swipeStatus||aq.pinchStatus){a9=L(bd,W)}if(!aq.triggerOnTouchEnd||aq.triggerOnTouchLeave){var a7=true;if(aq.triggerOnTouchLeave){var bc=aU(this);a7=B(bb.end,bc)}if(!aq.triggerOnTouchEnd&&a7){W=ay(j)}else{if(aq.triggerOnTouchLeave&&!a7){W=ay(g)}}if(W==p||W==g){L(bd,W)}}}else{W=p;L(bd,W)}if(a9===false){W=p;L(bd,W)}}function I(a7){var a8=a7.originalEvent;if(a){if(a8.touches.length>0){C();return true}}if(ai()){T=aa}a7.preventDefault();aY=ao();Y=aI();if(a6()){W=p;L(a8,W)}else{if(aq.triggerOnTouchEnd||(aq.triggerOnTouchEnd==false&&W===j)){W=g;L(a8,W)}else{if(!aq.triggerOnTouchEnd&&a2()){W=g;aB(a8,W,x)}else{if(W===j){W=p;L(a8,W)}}}}ak(false);return null}function a5(){T=0;aY=0;Q=0;aX=0;aV=0;D=1;O();ak(false)}function H(a7){var a8=a7.originalEvent;if(aq.triggerOnTouchLeave){W=ay(g);L(a8,W)}}function aG(){aN.unbind(G,aJ);aN.unbind(az,a5);aN.unbind(au,aZ);aN.unbind(R,I);if(P){aN.unbind(P,H)}ak(false)}function ay(bb){var ba=bb;var a9=aw();var a8=aj();var a7=a6();if(!a9||a7){ba=p}else{if(a8&&bb==j&&(!aq.triggerOnTouchEnd||aq.triggerOnTouchLeave)){ba=g}else{if(!a8&&bb==g&&aq.triggerOnTouchLeave){ba=p}}}return ba}function L(a9,a7){var a8=undefined;if(F()||S()){a8=aB(a9,a7,k)}else{if((M()||aT())&&a8!==false){a8=aB(a9,a7,s)}}if(aC()&&a8!==false){a8=aB(a9,a7,i)}else{if(al()&&a8!==false){a8=aB(a9,a7,b)}else{if(ad()&&a8!==false){a8=aB(a9,a7,x)}}}if(a7===p){a5(a9)}if(a7===g){if(a){if(a9.touches.length==0){a5(a9)}}else{a5(a9)}}return a8}function aB(ba,a7,a9){var a8=undefined;if(a9==k){aN.trigger("swipeStatus",[a7,aL||null,ac||0,Y||0,T]);if(aq.swipeStatus){a8=aq.swipeStatus.call(aN,ba,a7,aL||null,ac||0,Y||0,T);if(a8===false){return false}}if(a7==g&&aR()){aN.trigger("swipe",[aL,ac,Y,T]);if(aq.swipe){a8=aq.swipe.call(aN,ba,aL,ac,Y,T);if(a8===false){return false}}switch(aL){case o:aN.trigger("swipeLeft",[aL,ac,Y,T]);if(aq.swipeLeft){a8=aq.swipeLeft.call(aN,ba,aL,ac,Y,T)}break;case n:aN.trigger("swipeRight",[aL,ac,Y,T]);if(aq.swipeRight){a8=aq.swipeRight.call(aN,ba,aL,ac,Y,T)}break;case d:aN.trigger("swipeUp",[aL,ac,Y,T]);if(aq.swipeUp){a8=aq.swipeUp.call(aN,ba,aL,ac,Y,T)}break;case v:aN.trigger("swipeDown",[aL,ac,Y,T]);if(aq.swipeDown){a8=aq.swipeDown.call(aN,ba,aL,ac,Y,T)}break}}}if(a9==s){aN.trigger("pinchStatus",[a7,aF||null,am||0,Y||0,T,D]);if(aq.pinchStatus){a8=aq.pinchStatus.call(aN,ba,a7,aF||null,am||0,Y||0,T,D);if(a8===false){return false}}if(a7==g&&a4()){switch(aF){case c:aN.trigger("pinchIn",[aF||null,am||0,Y||0,T,D]);if(aq.pinchIn){a8=aq.pinchIn.call(aN,ba,aF||null,am||0,Y||0,T,D)}break;case w:aN.trigger("pinchOut",[aF||null,am||0,Y||0,T,D]);if(aq.pinchOut){a8=aq.pinchOut.call(aN,ba,aF||null,am||0,Y||0,T,D)}break}}}if(a9==x){if(a7===p||a7===g){clearTimeout(aS);if(V()&&!E()){K=ao();aS=setTimeout(e.proxy(function(){K=null;aN.trigger("tap",[ba.target]);if(aq.tap){a8=aq.tap.call(aN,ba,ba.target)}},this),aq.doubleTapThreshold)}else{K=null;aN.trigger("tap",[ba.target]);if(aq.tap){a8=aq.tap.call(aN,ba,ba.target)}}}}else{if(a9==i){if(a7===p||a7===g){clearTimeout(aS);K=null;aN.trigger("doubletap",[ba.target]);if(aq.doubleTap){a8=aq.doubleTap.call(aN,ba,ba.target)}}}else{if(a9==b){if(a7===p||a7===g){clearTimeout(aS);K=null;aN.trigger("longtap",[ba.target]);if(aq.longTap){a8=aq.longTap.call(aN,ba,ba.target)}}}}}return a8}function aj(){var a7=true;if(aq.threshold!==null){a7=ac>=aq.threshold}return a7}function a6(){var a7=false;if(aq.cancelThreshold!==null&&aL!==null){a7=(aP(aL)-ac)>=aq.cancelThreshold}return a7}function ab(){if(aq.pinchThreshold!==null){return am>=aq.pinchThreshold}return true}function aw(){var a7;if(aq.maxTimeThreshold){if(Y>=aq.maxTimeThreshold){a7=false}else{a7=true}}else{a7=true}return a7}function ah(a7,a8){if(aq.allowPageScroll===l||aT()){a7.preventDefault()}else{var a9=aq.allowPageScroll===r;switch(a8){case o:if((aq.swipeLeft&&a9)||(!a9&&aq.allowPageScroll!=A)){a7.preventDefault()}break;case n:if((aq.swipeRight&&a9)||(!a9&&aq.allowPageScroll!=A)){a7.preventDefault()}break;case d:if((aq.swipeUp&&a9)||(!a9&&aq.allowPageScroll!=t)){a7.preventDefault()}break;case v:if((aq.swipeDown&&a9)||(!a9&&aq.allowPageScroll!=t)){a7.preventDefault()}break}}}function a4(){var a8=aK();var a7=U();var a9=ab();return a8&&a7&&a9}function aT(){return !!(aq.pinchStatus||aq.pinchIn||aq.pinchOut)}function M(){return !!(a4()&&aT())}function aR(){var ba=aw();var bc=aj();var a9=aK();var a7=U();var a8=a6();var bb=!a8&&a7&&a9&&bc&&ba;return bb}function S(){return !!(aq.swipe||aq.swipeStatus||aq.swipeLeft||aq.swipeRight||aq.swipeUp||aq.swipeDown)}function F(){return !!(aR()&&S())}function aK(){return((T===aq.fingers||aq.fingers===h)||!a)}function U(){return aM[0].end.x!==0}function a2(){return !!(aq.tap)}function V(){return !!(aq.doubleTap)}function aQ(){return !!(aq.longTap)}function N(){if(K==null){return false}var a7=ao();return(V()&&((a7-K)<=aq.doubleTapThreshold))}function E(){return N()}function at(){return((T===1||!a)&&(isNaN(ac)||ac===0))}function aW(){return((Y>aq.longTapThreshold)&&(ac=0)){return o}else{if((a9<=360)&&(a9>=315)){return o}else{if((a9>=135)&&(a9<=225)){return n}else{if((a9>45)&&(a9<135)){return v}else{return d}}}}}function ao(){var a7=new Date();return a7.getTime()}function aU(a7){a7=e(a7);var a9=a7.offset();var a8={left:a9.left,right:a9.left+a7.outerWidth(),top:a9.top,bottom:a9.top+a7.outerHeight()};return a8}function B(a7,a8){return(a7.x>a8.left&&a7.xa8.top&&a7.y g ? (c.maxWidth = f * g, c.maxHeight = f) : (c.maxWidth = e, c.maxHeight = e / g), c
- }, b.renderImageToCanvas = function(a, b, c, d, e, f, g, h, i, j) {
- return a.getContext("2d").drawImage(b, c, d, e, f, g, h, i, j), a
- }, b.hasCanvasOption = function(a) {
- return a.canvas || a.crop || a.aspectRatio
- }, b.scale = function(a, c) {
- c = c || {};
- var d, e, f, g, h, i, j, k, l, m = document.createElement("canvas"),
- n = a.getContext || b.hasCanvasOption(c) && m.getContext,
- o = a.naturalWidth || a.width,
- p = a.naturalHeight || a.height,
- q = o,
- r = p,
- s = function() {
- var a = Math.max((f || q) / q, (g || r) / r);
- a > 1 && (q *= a, r *= a)
- },
- t = function() {
- var a = Math.min((d || q) / q, (e || r) / r);
- 1 > a && (q *= a, r *= a)
- };
- return n && (c = b.getTransformedOptions(a, c), j = c.left || 0, k = c.top || 0, c.sourceWidth ? (h = c.sourceWidth, void 0 !== c.right && void 0 === c.left && (j = o - h - c.right)) : h = o - j - (c.right || 0), c.sourceHeight ? (i = c.sourceHeight, void 0 !== c.bottom && void 0 === c.top && (k = p - i - c.bottom)) : i = p - k - (c.bottom || 0), q = h, r = i), d = c.maxWidth, e = c.maxHeight, f = c.minWidth, g = c.minHeight, n && d && e && c.crop ? (q = d, r = e, l = h / i - d / e, 0 > l ? (i = e * h / d, void 0 === c.top && void 0 === c.bottom && (k = (p - i) / 2)) : l > 0 && (h = d * i / e, void 0 === c.left && void 0 === c.right && (j = (o - h) / 2))) : ((c.contain || c.cover) && (f = d = d || f, g = e = e || g), c.cover ? (t(), s()) : (s(), t())), n ? (m.width = q, m.height = r, b.transformCoordinates(m, c), b.renderImageToCanvas(m, a, j, k, h, i, 0, 0, q, r)) : (a.width = q, a.height = r, a)
- }, b.createObjectURL = function(a) {
- return c ? c.createObjectURL(a) : !1
- }, b.revokeObjectURL = function(a) {
- return c ? c.revokeObjectURL(a) : !1
- }, b.readFile = function(a, b, c) {
- if (window.FileReader) {
- var d = new FileReader;
- if (d.onload = d.onerror = b, c = c || "readAsDataURL", d[c]) return d[c](a), d
- }
- return !1
- }, "function" == typeof define && define.amd ? define(function() {
- return b
- }) : a.loadImage = b
-}(this),
-function(a) {
- "use strict";
- "function" == typeof define && define.amd ? define(["load-image"], a) : a(window.loadImage)
-}(function(a) {
- "use strict";
- if (window.navigator && window.navigator.platform && /iP(hone|od|ad)/.test(window.navigator.platform)) {
- var b = a.renderImageToCanvas;
- a.detectSubsampling = function(a) {
- var b, c;
- return a.width * a.height > 1048576 ? (b = document.createElement("canvas"), b.width = b.height = 1, c = b.getContext("2d"), c.drawImage(a, -a.width + 1, 0), 0 === c.getImageData(0, 0, 1, 1).data[3]) : !1
- }, a.detectVerticalSquash = function(a, b) {
- var c, d, e, f, g, h = a.naturalHeight || a.height,
- i = document.createElement("canvas"),
- j = i.getContext("2d");
- for (b && (h /= 2), i.width = 1, i.height = h, j.drawImage(a, 0, 0), c = j.getImageData(0, 0, 1, h).data, d = 0, e = h, f = h; f > d;) g = c[4 * (f - 1) + 3], 0 === g ? e = f : d = f, f = e + d >> 1;
- return f / h || 1
- }, a.renderImageToCanvas = function(c, d, e, f, g, h, i, j, k, l) {
- if ("image/jpeg" === d._type) {
- var m, n, o, p, q = c.getContext("2d"),
- r = document.createElement("canvas"),
- s = 1024,
- t = r.getContext("2d");
- if (r.width = s, r.height = s, q.save(), m = a.detectSubsampling(d), m && (e /= 2, f /= 2, g /= 2, h /= 2), n = a.detectVerticalSquash(d, m), m || 1 !== n) {
- for (f *= n, k = Math.ceil(s * k / g), l = Math.ceil(s * l / h / n), j = 0, p = 0; h > p;) {
- for (i = 0, o = 0; g > o;) t.clearRect(0, 0, s, s), t.drawImage(d, e, f, g, h, -o, -p, g, h), q.drawImage(r, 0, 0, s, s, i, j, k, l), o += s, i += k;
- p += s, j += l
- }
- return q.restore(), c
- }
- }
- return b(c, d, e, f, g, h, i, j, k, l)
- }
- }
-}),
-function(a) {
- "use strict";
- "function" == typeof define && define.amd ? define(["load-image"], a) : a(window.loadImage)
-}(function(a) {
- "use strict";
- var b = a.hasCanvasOption,
- c = a.transformCoordinates,
- d = a.getTransformedOptions;
- a.hasCanvasOption = function(c) {
- return b.call(a, c) || c.orientation
- }, a.transformCoordinates = function(b, d) {
- c.call(a, b, d);
- var e = b.getContext("2d"),
- f = b.width,
- g = b.height,
- h = d.orientation;
- if (h && !(h > 8)) switch (h > 4 && (b.width = g, b.height = f), h) {
- case 2:
- e.translate(f, 0), e.scale(-1, 1);
- break;
- case 3:
- e.translate(f, g), e.rotate(Math.PI);
- break;
- case 4:
- e.translate(0, g), e.scale(1, -1);
- break;
- case 5:
- e.rotate(.5 * Math.PI), e.scale(1, -1);
- break;
- case 6:
- e.rotate(.5 * Math.PI), e.translate(0, -g);
- break;
- case 7:
- e.rotate(.5 * Math.PI), e.translate(f, -g), e.scale(-1, 1);
- break;
- case 8:
- e.rotate(-.5 * Math.PI), e.translate(-f, 0)
- }
- }, a.getTransformedOptions = function(b, c) {
- var e, f, g = d.call(a, b, c),
- h = g.orientation;
- if (!h || h > 8 || 1 === h) return g;
- e = {};
- for (f in g) g.hasOwnProperty(f) && (e[f] = g[f]);
- switch (g.orientation) {
- case 2:
- e.left = g.right, e.right = g.left;
- break;
- case 3:
- e.left = g.right, e.top = g.bottom, e.right = g.left, e.bottom = g.top;
- break;
- case 4:
- e.top = g.bottom, e.bottom = g.top;
- break;
- case 5:
- e.left = g.top, e.top = g.left, e.right = g.bottom, e.bottom = g.right;
- break;
- case 6:
- e.left = g.top, e.top = g.right, e.right = g.bottom, e.bottom = g.left;
- break;
- case 7:
- e.left = g.bottom, e.top = g.right, e.right = g.top, e.bottom = g.left;
- break;
- case 8:
- e.left = g.bottom, e.top = g.left, e.right = g.top, e.bottom = g.right
- }
- return g.orientation > 4 && (e.maxWidth = g.maxHeight, e.maxHeight = g.maxWidth, e.minWidth = g.minHeight, e.minHeight = g.minWidth, e.sourceWidth = g.sourceHeight, e.sourceHeight = g.sourceWidth), e
- }
-}),
-function(a) {
- "use strict";
- "function" == typeof define && define.amd ? define(["load-image"], a) : a(window.loadImage)
-}(function(a) {
- "use strict";
- var b = window.Blob && (Blob.prototype.slice || Blob.prototype.webkitSlice || Blob.prototype.mozSlice);
- a.blobSlice = b && function() {
- var a = this.slice || this.webkitSlice || this.mozSlice;
- return a.apply(this, arguments)
- }, a.metaDataParsers = {
- jpeg: {
- 65505: []
- }
- }, a.parseMetaData = function(b, c, d) {
- d = d || {};
- var e = this,
- f = d.maxMetaDataSize || 262144,
- g = {},
- h = !(window.DataView && b && b.size >= 12/* && "image/jpeg" === b.type*/ && a.blobSlice),
- t = b.type;
- (h || !a.readFile(a.blobSlice.call(b, 0, f), function(b) {
- if (b.target.error) return console.log(b.target.error), void c(g);
- var f, h, i, j, k = b.target.result,
- l = new DataView(k),
- m = 2,
- n = l.byteLength - 4,
- o = m;
- g.buffer = k;
- if("image/jpeg" !== t) {
- c(g);
- return;
- };
- if (65496 === l.getUint16(0)) {
- for (; n > m && (f = l.getUint16(m), f >= 65504 && 65519 >= f || 65534 === f);) {
- if (h = l.getUint16(m + 2) + 2, m + h > l.byteLength) {
- console.log("Invalid meta data: Invalid segment size.");
- break
- }
- if (i = a.metaDataParsers.jpeg[f])
- for (j = 0; j < i.length; j += 1) i[j].call(e, l, m, h, g, d);
- m += h, o = m
- }!d.disableImageHead && o > 6 && (g.imageHead = k.slice ? k.slice(0, o) : new Uint8Array(k).subarray(0, o))
- } else console.log("Invalid JPEG file: Missing JPEG marker.");
- c(g)
- }, "readAsArrayBuffer")) && c(g)
- }
-}),
-function(a) {
- "use strict";
- "function" == typeof define && define.amd ? define(["load-image", "load-image-meta"], a) : a(window.loadImage)
-}(function(a) {
- "use strict";
- a.ExifMap = function() {
- return this
- }, a.ExifMap.prototype.map = {
- Orientation: 274
- }, a.ExifMap.prototype.get = function(a) {
- return this[a] || this[this.map[a]]
- }, a.getExifThumbnail = function(a, b, c) {
- var d, e, f;
- if (!c || b + c > a.byteLength) return void console.log("Invalid Exif data: Invalid thumbnail data.");
- for (d = [], e = 0; c > e; e += 1) f = a.getUint8(b + e), d.push((16 > f ? "0" : "") + f.toString(16));
- return "data:image/jpeg,%" + d.join("%")
- }, a.exifTagTypes = {
- 1: {
- getValue: function(a, b) {
- return a.getUint8(b)
- },
- size: 1
- },
- 2: {
- getValue: function(a, b) {
- return String.fromCharCode(a.getUint8(b))
- },
- size: 1,
- ascii: !0
- },
- 3: {
- getValue: function(a, b, c) {
- return a.getUint16(b, c)
- },
- size: 2
- },
- 4: {
- getValue: function(a, b, c) {
- return a.getUint32(b, c)
- },
- size: 4
- },
- 5: {
- getValue: function(a, b, c) {
- return a.getUint32(b, c) / a.getUint32(b + 4, c)
- },
- size: 8
- },
- 9: {
- getValue: function(a, b, c) {
- return a.getInt32(b, c)
- },
- size: 4
- },
- 10: {
- getValue: function(a, b, c) {
- return a.getInt32(b, c) / a.getInt32(b + 4, c)
- },
- size: 8
- }
- }, a.exifTagTypes[7] = a.exifTagTypes[1], a.getExifValue = function(b, c, d, e, f, g) {
- var h, i, j, k, l, m, n = a.exifTagTypes[e];
- if (!n) return void console.log("Invalid Exif data: Invalid tag type.");
- if (h = n.size * f, i = h > 4 ? c + b.getUint32(d + 8, g) : d + 8, i + h > b.byteLength) return void console.log("Invalid Exif data: Invalid data offset.");
- if (1 === f) return n.getValue(b, i, g);
- for (j = [], k = 0; f > k; k += 1) j[k] = n.getValue(b, i + k * n.size, g);
- if (n.ascii) {
- for (l = "", k = 0; k < j.length && (m = j[k], "\x00" !== m); k += 1) l += m;
- return l
- }
- return j
- }, a.parseExifTag = function(b, c, d, e, f) {
- var g = b.getUint16(d, e);
- f.exif[g] = a.getExifValue(b, c, d, b.getUint16(d + 2, e), b.getUint32(d + 4, e), e)
- }, a.parseExifTags = function(a, b, c, d, e) {
- var f, g, h;
- if (c + 6 > a.byteLength) return void console.log("Invalid Exif data: Invalid directory offset.");
- if (f = a.getUint16(c, d), g = c + 2 + 12 * f, g + 4 > a.byteLength) return void console.log("Invalid Exif data: Invalid directory size.");
- for (h = 0; f > h; h += 1) this.parseExifTag(a, b, c + 2 + 12 * h, d, e);
- return a.getUint32(g, d)
- }, a.parseExifData = function(b, c, d, e, f) {
- if (!f.disableExif) {
- var g, h, i, j = c + 10;
- if (1165519206 === b.getUint32(c + 4)) {
- if (j + 8 > b.byteLength) return void console.log("Invalid Exif data: Invalid segment size.");
- if (0 !== b.getUint16(c + 8)) return void console.log("Invalid Exif data: Missing byte alignment offset.");
- switch (b.getUint16(j)) {
- case 18761:
- g = !0;
- break;
- case 19789:
- g = !1;
- break;
- default:
- return void console.log("Invalid Exif data: Invalid byte alignment marker.")
- }
- if (42 !== b.getUint16(j + 2, g)) return void console.log("Invalid Exif data: Missing TIFF marker.");
- h = b.getUint32(j + 4, g), e.exif = new a.ExifMap, h = a.parseExifTags(b, j, j + h, g, e), h && !f.disableExifThumbnail && (i = {
- exif: {}
- }, h = a.parseExifTags(b, j, j + h, g, i), i.exif[513] && (e.exif.Thumbnail = a.getExifThumbnail(b, j + i.exif[513], i.exif[514]))), e.exif[34665] && !f.disableExifSub && a.parseExifTags(b, j, j + e.exif[34665], g, e), e.exif[34853] && !f.disableExifGps && a.parseExifTags(b, j, j + e.exif[34853], g, e)
- }
- }
- }, a.metaDataParsers.jpeg[65505].push(a.parseExifData)
-}),
-function(a) {
- "use strict";
- "function" == typeof define && define.amd ? define(["load-image", "load-image-exif"], a) : a(window.loadImage)
-}(function(a) {
- "use strict";
- a.ExifMap.prototype.tags = {
- 256: "ImageWidth",
- 257: "ImageHeight",
- 34665: "ExifIFDPointer",
- 34853: "GPSInfoIFDPointer",
- 40965: "InteroperabilityIFDPointer",
- 258: "BitsPerSample",
- 259: "Compression",
- 262: "PhotometricInterpretation",
- 274: "Orientation",
- 277: "SamplesPerPixel",
- 284: "PlanarConfiguration",
- 530: "YCbCrSubSampling",
- 531: "YCbCrPositioning",
- 282: "XResolution",
- 283: "YResolution",
- 296: "ResolutionUnit",
- 273: "StripOffsets",
- 278: "RowsPerStrip",
- 279: "StripByteCounts",
- 513: "JPEGInterchangeFormat",
- 514: "JPEGInterchangeFormatLength",
- 301: "TransferFunction",
- 318: "WhitePoint",
- 319: "PrimaryChromaticities",
- 529: "YCbCrCoefficients",
- 532: "ReferenceBlackWhite",
- 306: "DateTime",
- 270: "ImageDescription",
- 271: "Make",
- 272: "Model",
- 305: "Software",
- 315: "Artist",
- 33432: "Copyright",
- 36864: "ExifVersion",
- 40960: "FlashpixVersion",
- 40961: "ColorSpace",
- 40962: "PixelXDimension",
- 40963: "PixelYDimension",
- 42240: "Gamma",
- 37121: "ComponentsConfiguration",
- 37122: "CompressedBitsPerPixel",
- 37500: "MakerNote",
- 37510: "UserComment",
- 40964: "RelatedSoundFile",
- 36867: "DateTimeOriginal",
- 36868: "DateTimeDigitized",
- 37520: "SubSecTime",
- 37521: "SubSecTimeOriginal",
- 37522: "SubSecTimeDigitized",
- 33434: "ExposureTime",
- 33437: "FNumber",
- 34850: "ExposureProgram",
- 34852: "SpectralSensitivity",
- 34855: "PhotographicSensitivity",
- 34856: "OECF",
- 34864: "SensitivityType",
- 34865: "StandardOutputSensitivity",
- 34866: "RecommendedExposureIndex",
- 34867: "ISOSpeed",
- 34868: "ISOSpeedLatitudeyyy",
- 34869: "ISOSpeedLatitudezzz",
- 37377: "ShutterSpeedValue",
- 37378: "ApertureValue",
- 37379: "BrightnessValue",
- 37380: "ExposureBias",
- 37381: "MaxApertureValue",
- 37382: "SubjectDistance",
- 37383: "MeteringMode",
- 37384: "LightSource",
- 37385: "Flash",
- 37396: "SubjectArea",
- 37386: "FocalLength",
- 41483: "FlashEnergy",
- 41484: "SpatialFrequencyResponse",
- 41486: "FocalPlaneXResolution",
- 41487: "FocalPlaneYResolution",
- 41488: "FocalPlaneResolutionUnit",
- 41492: "SubjectLocation",
- 41493: "ExposureIndex",
- 41495: "SensingMethod",
- 41728: "FileSource",
- 41729: "SceneType",
- 41730: "CFAPattern",
- 41985: "CustomRendered",
- 41986: "ExposureMode",
- 41987: "WhiteBalance",
- 41988: "DigitalZoomRatio",
- 41989: "FocalLengthIn35mmFilm",
- 41990: "SceneCaptureType",
- 41991: "GainControl",
- 41992: "Contrast",
- 41993: "Saturation",
- 41994: "Sharpness",
- 41995: "DeviceSettingDescription",
- 41996: "SubjectDistanceRange",
- 42016: "ImageUniqueID",
- 42032: "CameraOwnerName",
- 42033: "BodySerialNumber",
- 42034: "LensSpecification",
- 42035: "LensMake",
- 42036: "LensModel",
- 42037: "LensSerialNumber",
- 0: "GPSVersionID",
- 1: "GPSLatitudeRef",
- 2: "GPSLatitude",
- 3: "GPSLongitudeRef",
- 4: "GPSLongitude",
- 5: "GPSAltitudeRef",
- 6: "GPSAltitude",
- 7: "GPSTimeStamp",
- 8: "GPSSatellites",
- 9: "GPSStatus",
- 10: "GPSMeasureMode",
- 11: "GPSDOP",
- 12: "GPSSpeedRef",
- 13: "GPSSpeed",
- 14: "GPSTrackRef",
- 15: "GPSTrack",
- 16: "GPSImgDirectionRef",
- 17: "GPSImgDirection",
- 18: "GPSMapDatum",
- 19: "GPSDestLatitudeRef",
- 20: "GPSDestLatitude",
- 21: "GPSDestLongitudeRef",
- 22: "GPSDestLongitude",
- 23: "GPSDestBearingRef",
- 24: "GPSDestBearing",
- 25: "GPSDestDistanceRef",
- 26: "GPSDestDistance",
- 27: "GPSProcessingMethod",
- 28: "GPSAreaInformation",
- 29: "GPSDateStamp",
- 30: "GPSDifferential",
- 31: "GPSHPositioningError"
- }, a.ExifMap.prototype.stringValues = {
- ExposureProgram: {
- 0: "Undefined",
- 1: "Manual",
- 2: "Normal program",
- 3: "Aperture priority",
- 4: "Shutter priority",
- 5: "Creative program",
- 6: "Action program",
- 7: "Portrait mode",
- 8: "Landscape mode"
- },
- MeteringMode: {
- 0: "Unknown",
- 1: "Average",
- 2: "CenterWeightedAverage",
- 3: "Spot",
- 4: "MultiSpot",
- 5: "Pattern",
- 6: "Partial",
- 255: "Other"
- },
- LightSource: {
- 0: "Unknown",
- 1: "Daylight",
- 2: "Fluorescent",
- 3: "Tungsten (incandescent light)",
- 4: "Flash",
- 9: "Fine weather",
- 10: "Cloudy weather",
- 11: "Shade",
- 12: "Daylight fluorescent (D 5700 - 7100K)",
- 13: "Day white fluorescent (N 4600 - 5400K)",
- 14: "Cool white fluorescent (W 3900 - 4500K)",
- 15: "White fluorescent (WW 3200 - 3700K)",
- 17: "Standard light A",
- 18: "Standard light B",
- 19: "Standard light C",
- 20: "D55",
- 21: "D65",
- 22: "D75",
- 23: "D50",
- 24: "ISO studio tungsten",
- 255: "Other"
- },
- Flash: {
- 0: "Flash did not fire",
- 1: "Flash fired",
- 5: "Strobe return light not detected",
- 7: "Strobe return light detected",
- 9: "Flash fired, compulsory flash mode",
- 13: "Flash fired, compulsory flash mode, return light not detected",
- 15: "Flash fired, compulsory flash mode, return light detected",
- 16: "Flash did not fire, compulsory flash mode",
- 24: "Flash did not fire, auto mode",
- 25: "Flash fired, auto mode",
- 29: "Flash fired, auto mode, return light not detected",
- 31: "Flash fired, auto mode, return light detected",
- 32: "No flash function",
- 65: "Flash fired, red-eye reduction mode",
- 69: "Flash fired, red-eye reduction mode, return light not detected",
- 71: "Flash fired, red-eye reduction mode, return light detected",
- 73: "Flash fired, compulsory flash mode, red-eye reduction mode",
- 77: "Flash fired, compulsory flash mode, red-eye reduction mode, return light not detected",
- 79: "Flash fired, compulsory flash mode, red-eye reduction mode, return light detected",
- 89: "Flash fired, auto mode, red-eye reduction mode",
- 93: "Flash fired, auto mode, return light not detected, red-eye reduction mode",
- 95: "Flash fired, auto mode, return light detected, red-eye reduction mode"
- },
- SensingMethod: {
- 1: "Undefined",
- 2: "One-chip color area sensor",
- 3: "Two-chip color area sensor",
- 4: "Three-chip color area sensor",
- 5: "Color sequential area sensor",
- 7: "Trilinear sensor",
- 8: "Color sequential linear sensor"
- },
- SceneCaptureType: {
- 0: "Standard",
- 1: "Landscape",
- 2: "Portrait",
- 3: "Night scene"
- },
- SceneType: {
- 1: "Directly photographed"
- },
- CustomRendered: {
- 0: "Normal process",
- 1: "Custom process"
- },
- WhiteBalance: {
- 0: "Auto white balance",
- 1: "Manual white balance"
- },
- GainControl: {
- 0: "None",
- 1: "Low gain up",
- 2: "High gain up",
- 3: "Low gain down",
- 4: "High gain down"
- },
- Contrast: {
- 0: "Normal",
- 1: "Soft",
- 2: "Hard"
- },
- Saturation: {
- 0: "Normal",
- 1: "Low saturation",
- 2: "High saturation"
- },
- Sharpness: {
- 0: "Normal",
- 1: "Soft",
- 2: "Hard"
- },
- SubjectDistanceRange: {
- 0: "Unknown",
- 1: "Macro",
- 2: "Close view",
- 3: "Distant view"
- },
- FileSource: {
- 3: "DSC"
- },
- ComponentsConfiguration: {
- 0: "",
- 1: "Y",
- 2: "Cb",
- 3: "Cr",
- 4: "R",
- 5: "G",
- 6: "B"
- },
- Orientation: {
- 1: "top-left",
- 2: "top-right",
- 3: "bottom-right",
- 4: "bottom-left",
- 5: "left-top",
- 6: "right-top",
- 7: "right-bottom",
- 8: "left-bottom"
- }
- }, a.ExifMap.prototype.getText = function(a) {
- var b = this.get(a);
- switch (a) {
- case "LightSource":
- case "Flash":
- case "MeteringMode":
- case "ExposureProgram":
- case "SensingMethod":
- case "SceneCaptureType":
- case "SceneType":
- case "CustomRendered":
- case "WhiteBalance":
- case "GainControl":
- case "Contrast":
- case "Saturation":
- case "Sharpness":
- case "SubjectDistanceRange":
- case "FileSource":
- case "Orientation":
- return this.stringValues[a][b];
- case "ExifVersion":
- case "FlashpixVersion":
- return String.fromCharCode(b[0], b[1], b[2], b[3]);
- case "ComponentsConfiguration":
- return this.stringValues[a][b[0]] + this.stringValues[a][b[1]] + this.stringValues[a][b[2]] + this.stringValues[a][b[3]];
- case "GPSVersionID":
- return b[0] + "." + b[1] + "." + b[2] + "." + b[3]
- }
- return String(b)
- },
- function(a) {
- var b, c = a.tags,
- d = a.map;
- for (b in c) c.hasOwnProperty(b) && (d[c[b]] = b)
- }(a.ExifMap.prototype), a.ExifMap.prototype.getAll = function() {
- var a, b, c = {};
- for (a in this) this.hasOwnProperty(a) && (b = this.tags[a], b && (c[b] = this.getText(b)));
- return c
- }
-});
-
-/**
- * History.js Core
- * @author Benjamin Arthur Lupton
- * @copyright 2010-2011 Benjamin Arthur Lupton
- * @license New BSD License
- */
-typeof JSON!="object"&&(JSON={}),function(){"use strict";function f(e){return e<10?"0"+e:e}function quote(e){return escapable.lastIndex=0,escapable.test(e)?'"'+e.replace(escapable,function(e){var t=meta[e];return typeof t=="string"?t:"\\u"+("0000"+e.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+e+'"'}function str(e,t){var n,r,i,s,o=gap,u,a=t[e];a&&typeof a=="object"&&typeof a.toJSON=="function"&&(a=a.toJSON(e)),typeof rep=="function"&&(a=rep.call(t,e,a));switch(typeof a){case"string":return quote(a);case"number":return isFinite(a)?String(a):"null";case"boolean":case"null":return String(a);case"object":if(!a)return"null";gap+=indent,u=[];if(Object.prototype.toString.apply(a)==="[object Array]"){s=a.length;for(n=0;n ")&&n[0]);return e>4?e:!1}();return e},h.isInternetExplorer=function(){var e=h.isInternetExplorer.cached=typeof h.isInternetExplorer.cached!="undefined"?h.isInternetExplorer.cached:Boolean(h.getInternetExplorerMajorVersion());return e},h.options.html4Mode?h.emulated={pushState:!0,hashChange:!0}:h.emulated={pushState:!Boolean(e.history&&e.history.pushState&&e.history.replaceState&&!/ Mobile\/([1-7][a-z]|(8([abcde]|f(1[0-8]))))/i.test(i.userAgent)&&!/AppleWebKit\/5([0-2]|3[0-2])/i.test(i.userAgent)),hashChange:Boolean(!("onhashchange"in e||"onhashchange"in r)||h.isInternetExplorer()&&h.getInternetExplorerMajorVersion()<8)},h.enabled=!h.emulated.pushState,h.bugs={setHash:Boolean(!h.emulated.pushState&&i.vendor==="Apple Computer, Inc."&&/AppleWebKit\/5([0-2]|3[0-3])/.test(i.userAgent)),safariPoll:Boolean(!h.emulated.pushState&&i.vendor==="Apple Computer, Inc."&&/AppleWebKit\/5([0-2]|3[0-3])/.test(i.userAgent)),ieDoubleCheck:Boolean(h.isInternetExplorer()&&h.getInternetExplorerMajorVersion()<8),hashEscape:Boolean(h.isInternetExplorer()&&h.getInternetExplorerMajorVersion()<7)},h.isEmptyObject=function(e){for(var t in e)if(e.hasOwnProperty(t))return!1;return!0},h.cloneObject=function(e){var t,n;return e?(t=l.stringify(e),n=l.parse(t)):n={},n},h.getRootUrl=function(){var e=r.location.protocol+"//"+(r.location.hostname||r.location.host);if(r.location.port||!1)e+=":"+r.location.port;return e+="/",e},h.getBaseHref=function(){var e=r.getElementsByTagName("base"),t=null,n="";return e.length===1&&(t=e[0],n=t.href.replace(/[^\/]+$/,"")),n=n.replace(/\/+$/,""),n&&(n+="/"),n},h.getBaseUrl=function(){var e=h.getBaseHref()||h.getBasePageUrl()||h.getRootUrl();return e},h.getPageUrl=function(){var e=h.getState(!1,!1),t=(e||{}).url||h.getLocationHref(),n;return n=t.replace(/\/+$/,"").replace(/[^\/]+$/,function(e,t,n){return/\./.test(e)?e:e+"/"}),n},h.getBasePageUrl=function(){var e=h.getLocationHref().replace(/[#\?].*/,"").replace(/[^\/]+$/,function(e,t,n){return/[^\/]$/.test(e)?"":e}).replace(/\/+$/,"")+"/";return e},h.getFullUrl=function(e,t){var n=e,r=e.substring(0,1);return t=typeof t=="undefined"?!0:t,/[a-z]+\:\/\//.test(e)||(r==="/"?n=h.getRootUrl()+e.replace(/^\/+/,""):r==="#"?n=h.getPageUrl().replace(/#.*/,"")+e:r==="?"?n=h.getPageUrl().replace(/[\?#].*/,"")+e:t?n=h.getBaseUrl()+e.replace(/^(\.\/)+/,""):n=h.getBasePageUrl()+e.replace(/^(\.\/)+/,"")),n.replace(/\#$/,"")},h.getShortUrl=function(e){var t=e,n=h.getBaseUrl(),r=h.getRootUrl();return h.emulated.pushState&&(t=t.replace(n,"")),t=t.replace(r,"/"),h.isTraditionalAnchor(t)&&(t="./"+t),t=t.replace(/^(\.\/)+/g,"./").replace(/\#$/,""),t},h.getLocationHref=function(e){return e=e||r,e.URL===e.location.href?e.location.href:e.location.href===decodeURIComponent(e.URL)?e.URL:e.location.hash&&decodeURIComponent(e.location.href.replace(/^[^#]+/,""))===e.location.hash?e.location.href:e.URL.indexOf("#")==-1&&e.location.href.indexOf("#")!=-1?e.location.href:e.URL||e.location.href},h.store={},h.idToState=h.idToState||{},h.stateToId=h.stateToId||{},h.urlToId=h.urlToId||{},h.storedStates=h.storedStates||[],h.savedStates=h.savedStates||[],h.normalizeStore=function(){h.store.idToState=h.store.idToState||{},h.store.urlToId=h.store.urlToId||{},h.store.stateToId=h.store.stateToId||{}},h.getState=function(e,t){typeof e=="undefined"&&(e=!0),typeof t=="undefined"&&(t=!0);var n=h.getLastSavedState();return!n&&t&&(n=h.createStateObject()),e&&(n=h.cloneObject(n),n.url=n.cleanUrl||n.url),n},h.getIdByState=function(e){var t=h.extractId(e.url),n;if(!t){n=h.getStateString(e);if(typeof h.stateToId[n]!="undefined")t=h.stateToId[n];else if(typeof h.store.stateToId[n]!="undefined")t=h.store.stateToId[n];else{for(;;){t=(new Date).getTime()+String(Math.random()).replace(/\D/g,"");if(typeof h.idToState[t]=="undefined"&&typeof h.store.idToState[t]=="undefined")break}h.stateToId[n]=t,h.idToState[t]=e}}return t},h.normalizeState=function(e){var t,n;if(!e||typeof e!="object")e={};if(typeof e.normalized!="undefined")return e;if(!e.data||typeof e.data!="object")e.data={};return t={},t.normalized=!0,t.title=e.title||"",t.url=h.getFullUrl(e.url?e.url:h.getLocationHref()),t.hash=h.getShortUrl(t.url),t.data=h.cloneObject(e.data),t.id=h.getIdByState(t),t.cleanUrl=t.url.replace(/\??\&_suid.*/,""),t.url=t.cleanUrl,n=!h.isEmptyObject(t.data),(t.title||n)&&h.options.disableSuid!==!0&&(t.hash=h.getShortUrl(t.url).replace(/\??\&_suid.*/,""),/\?/.test(t.hash)||(t.hash+="?"),t.hash+="&_suid="+t.id),t.hashedUrl=h.getFullUrl(t.hash),(h.emulated.pushState||h.bugs.safariPoll)&&h.hasUrlDuplicate(t)&&(t.url=t.hashedUrl),t},h.createStateObject=function(e,t,n){var r={data:e,title:t,url:n};return r=h.normalizeState(r),r},h.getStateById=function(e){e=String(e);var n=h.idToState[e]||h.store.idToState[e]||t;return n},h.getStateString=function(e){var t,n,r;return t=h.normalizeState(e),n={data:t.data,title:e.title,url:e.url},r=l.stringify(n),r},h.getStateId=function(e){var t,n;return t=h.normalizeState(e),n=t.id,n},h.getHashByState=function(e){var t,n;return t=h.normalizeState(e),n=t.hash,n},h.extractId=function(e){var t,n,r,i;return e.indexOf("#")!=-1?i=e.split("#")[0]:i=e,n=/(.*)\&_suid=([0-9]+)$/.exec(i),r=n?n[1]||e:e,t=n?String(n[2]||""):"",t||!1},h.isTraditionalAnchor=function(e){var t=!/[\/\?\.]/.test(e);return t},h.extractState=function(e,t){var n=null,r,i;return t=t||!1,r=h.extractId(e),r&&(n=h.getStateById(r)),n||(i=h.getFullUrl(e),r=h.getIdByUrl(i)||!1,r&&(n=h.getStateById(r)),!n&&t&&!h.isTraditionalAnchor(e)&&(n=h.createStateObject(null,null,i))),n},h.getIdByUrl=function(e){var n=h.urlToId[e]||h.store.urlToId[e]||t;return n},h.getLastSavedState=function(){return h.savedStates[h.savedStates.length-1]||t},h.getLastStoredState=function(){return h.storedStates[h.storedStates.length-1]||t},h.hasUrlDuplicate=function(e){var t=!1,n;return n=h.extractState(e.url),t=n&&n.id!==e.id,t},h.storeState=function(e){return h.urlToId[e.url]=e.id,h.storedStates.push(h.cloneObject(e)),e},h.isLastSavedState=function(e){var t=!1,n,r,i;return h.savedStates.length&&(n=e.id,r=h.getLastSavedState(),i=r.id,t=n===i),t},h.saveState=function(e){return h.isLastSavedState(e)?!1:(h.savedStates.push(h.cloneObject(e)),!0)},h.getStateByIndex=function(e){var t=null;return typeof e=="undefined"?t=h.savedStates[h.savedStates.length-1]:e<0?t=h.savedStates[h.savedStates.length+e]:t=h.savedStates[e],t},h.getCurrentIndex=function(){var e=null;return h.savedStates.length<1?e=0:e=h.savedStates.length-1,e},h.getHash=function(e){var t=h.getLocationHref(e),n;return n=h.getHashByUrl(t),n},h.unescapeHash=function(e){var t=h.normalizeHash(e);return t=decodeURIComponent(t),t},h.normalizeHash=function(e){var t=e.replace(/[^#]*#/,"").replace(/#.*/,"");return t},h.setHash=function(e,t){var n,i;return t!==!1&&h.busy()?(h.pushQueue({scope:h,callback:h.setHash,args:arguments,queue:t}),!1):(h.busy(!0),n=h.extractState(e,!0),n&&!h.emulated.pushState?h.pushState(n.data,n.title,n.url,!1):h.getHash()!==e&&(h.bugs.setHash?(i=h.getPageUrl(),h.pushState(null,null,i+"#"+e,!1)):r.location.hash=e),h)},h.escapeHash=function(t){var n=h.normalizeHash(t);return n=e.encodeURIComponent(n),h.bugs.hashEscape||(n=n.replace(/\%21/g,"!").replace(/\%26/g,"&").replace(/\%3D/g,"=").replace(/\%3F/g,"?")),n},h.getHashByUrl=function(e){var t=String(e).replace(/([^#]*)#?([^#]*)#?(.*)/,"$2");return t=h.unescapeHash(t),t},h.setTitle=function(e){var t=e.title,n;t||(n=h.getStateByIndex(0),n&&n.url===e.url&&(t=n.title||h.options.initialTitle));try{r.getElementsByTagName("title")[0].innerHTML=t.replace("<","<").replace(">",">").replace(" & "," & ")}catch(i){}return r.title=t,h},h.queues=[],h.busy=function(e){typeof e!="undefined"?h.busy.flag=e:typeof h.busy.flag=="undefined"&&(h.busy.flag=!1);if(!h.busy.flag){u(h.busy.timeout);var t=function(){var e,n,r;if(h.busy.flag)return;for(e=h.queues.length-1;e>=0;--e){n=h.queues[e];if(n.length===0)continue;r=n.shift(),h.fireQueueItem(r),h.busy.timeout=o(t,h.options.busyDelay)}};h.busy.timeout=o(t,h.options.busyDelay)}return h.busy.flag},h.busy.flag=!1,h.fireQueueItem=function(e){return e.callback.apply(e.scope||h,e.args||[])},h.pushQueue=function(e){return h.queues[e.queue||0]=h.queues[e.queue||0]||[],h.queues[e.queue||0].push(e),h},h.queue=function(e,t){return typeof e=="function"&&(e={callback:e}),typeof t!="undefined"&&(e.queue=t),h.busy()?h.pushQueue(e):h.fireQueueItem(e),h},h.clearQueue=function(){return h.busy.flag=!1,h.queues=[],h},h.stateChanged=!1,h.doubleChecker=!1,h.doubleCheckComplete=function(){return h.stateChanged=!0,h.doubleCheckClear(),h},h.doubleCheckClear=function(){return h.doubleChecker&&(u(h.doubleChecker),h.doubleChecker=!1),h},h.doubleCheck=function(e){return h.stateChanged=!1,h.doubleCheckClear(),h.bugs.ieDoubleCheck&&(h.doubleChecker=o(function(){return h.doubleCheckClear(),h.stateChanged||e(),!0},h.options.doubleCheckInterval)),h},h.safariStatePoll=function(){var t=h.extractState(h.getLocationHref()),n;if(!h.isLastSavedState(t))return n=t,n||(n=h.createStateObject()),h.Adapter.trigger(e,"popstate"),h;return},h.back=function(e){return e!==!1&&h.busy()?(h.pushQueue({scope:h,callback:h.back,args:arguments,queue:e}),!1):(h.busy(!0),h.doubleCheck(function(){h.back(!1)}),p.go(-1),!0)},h.forward=function(e){return e!==!1&&h.busy()?(h.pushQueue({scope:h,callback:h.forward,args:arguments,queue:e}),!1):(h.busy(!0),h.doubleCheck(function(){h.forward(!1)}),p.go(1),!0)},h.go=function(e,t){var n;if(e>0)for(n=1;n<=e;++n)h.forward(t);else{if(!(e<0))throw new Error("History.go: History.go requires a positive or negative integer passed.");for(n=-1;n>=e;--n)h.back(t)}return h};if(h.emulated.pushState){var v=function(){};h.pushState=h.pushState||v,h.replaceState=h.replaceState||v}else h.onPopState=function(t,n){var r=!1,i=!1,s,o;return h.doubleCheckComplete(),s=h.getHash(),s?(o=h.extractState(s||h.getLocationHref(),!0),o?h.replaceState(o.data,o.title,o.url,!1):(h.Adapter.trigger(e,"anchorchange"),h.busy(!1)),h.expectedStateId=!1,!1):(r=h.Adapter.extractEventData("state",t,n)||!1,r?i=h.getStateById(r):h.expectedStateId?i=h.getStateById(h.expectedStateId):i=h.extractState(h.getLocationHref()),i||(i=h.createStateObject(null,null,h.getLocationHref())),h.expectedStateId=!1,h.isLastSavedState(i)?(h.busy(!1),!1):(h.storeState(i),h.saveState(i),h.setTitle(i),h.Adapter.trigger(e,"statechange"),h.busy(!1),!0))},h.Adapter.bind(e,"popstate",h.onPopState),h.pushState=function(t,n,r,i){if(h.getHashByUrl(r)&&h.emulated.pushState)throw new Error("History.js does not support states with fragement-identifiers (hashes/anchors).");if(i!==!1&&h.busy())return h.pushQueue({scope:h,callback:h.pushState,args:arguments,queue:i}),!1;h.busy(!0);var s=h.createStateObject(t,n,r);return h.isLastSavedState(s)?h.busy(!1):(h.storeState(s),h.expectedStateId=s.id,p.pushState(s.id,s.title,s.url),h.Adapter.trigger(e,"popstate")),!0},h.replaceState=function(t,n,r,i){if(h.getHashByUrl(r)&&h.emulated.pushState)throw new Error("History.js does not support states with fragement-identifiers (hashes/anchors).");if(i!==!1&&h.busy())return h.pushQueue({scope:h,callback:h.replaceState,args:arguments,queue:i}),!1;h.busy(!0);var s=h.createStateObject(t,n,r);return h.isLastSavedState(s)?h.busy(!1):(h.storeState(s),h.expectedStateId=s.id,p.replaceState(s.id,s.title,s.url),h.Adapter.trigger(e,"popstate")),!0};if(s){try{h.store=l.parse(s.getItem("History.store"))||{}}catch(m){h.store={}}h.normalizeStore()}else h.store={},h.normalizeStore();h.Adapter.bind(e,"unload",h.clearAllIntervals),h.saveState(h.storeState(h.extractState(h.getLocationHref(),!0))),s&&(h.onUnload=function(){var e,t,n;try{e=l.parse(s.getItem("History.store"))||{}}catch(r){e={}}e.idToState=e.idToState||{},e.urlToId=e.urlToId||{},e.stateToId=e.stateToId||{};for(t in h.idToState){if(!h.idToState.hasOwnProperty(t))continue;e.idToState[t]=h.idToState[t]}for(t in h.urlToId){if(!h.urlToId.hasOwnProperty(t))continue;e.urlToId[t]=h.urlToId[t]}for(t in h.stateToId){if(!h.stateToId.hasOwnProperty(t))continue;e.stateToId[t]=h.stateToId[t]}h.store=e,h.normalizeStore(),n=l.stringify(e);try{s.setItem("History.store",n)}catch(i){if(i.code!==DOMException.QUOTA_EXCEEDED_ERR)throw i;s.length&&(s.removeItem("History.store"),s.setItem("History.store",n))}},h.intervalList.push(a(h.onUnload,h.options.storeInterval)),h.Adapter.bind(e,"beforeunload",h.onUnload),h.Adapter.bind(e,"unload",h.onUnload));if(!h.emulated.pushState){h.bugs.safariPoll&&h.intervalList.push(a(h.safariStatePoll,h.options.safariPollInterval));if(i.vendor==="Apple Computer, Inc."||(i.appCodeName||"")==="Mozilla")h.Adapter.bind(e,"hashchange",function(){h.Adapter.trigger(e,"popstate")}),h.getHash()&&h.Adapter.onDomLoad(function(){h.Adapter.trigger(e,"hashchange")})}},(!h.options||!h.options.delayInit)&&h.init()}(window);
-
-/*
- * jQuery Iframe Transport Plugin 1.7
- * https://github.com/blueimp/jQuery-File-Upload
- *
- * Copyright 2011, Sebastian Tschan
- * https://blueimp.net
- *
- * Licensed under the MIT license:
- * http://www.opensource.org/licenses/MIT
- */
-
-/*jslint unparam: true, nomen: true */
-/*global define, window, document */
-
-(function(factory){if(typeof define==="function"&&define.amd){define(["jquery"],factory)}else{factory(window.jQuery)}}(function($){var counter=0;$.ajaxTransport("iframe",function(options){if(options.async){var form,iframe,addParamChar;return{send:function(_,completeCallback){form=$('');form.attr("accept-charset",options.formAcceptCharset);addParamChar=/\?/.test(options.url)?"&":"?";if(options.type==="DELETE"){options.url=options.url+addParamChar+"_method=DELETE";options.type="POST"}else{if(options.type==="PUT"){options.url=options.url+addParamChar+"_method=PUT";options.type="POST"}else{if(options.type==="PATCH"){options.url=options.url+addParamChar+"_method=PATCH";options.type="POST"}}}counter+=1;iframe=$('').bind("load",function(){var fileInputClones,paramNames=$.isArray(options.paramName)?options.paramName:[options.paramName];iframe.unbind("load").bind("load",function(){var response;try{response=iframe.contents();if(!response.length||!response[0].firstChild){throw new Error()}}catch(e){response=undefined}completeCallback(200,"success",{iframe:response});$('').appendTo(form);window.setTimeout(function(){form.remove()},0)});form.prop("target",iframe.prop("name")).prop("action",options.url).prop("method",options.type);if(options.formData){$.each(options.formData,function(index,field){$(' ').prop("name",field.name).val(field.value).appendTo(form)})}if(options.fileInput&&options.fileInput.length&&options.type==="POST"){fileInputClones=options.fileInput.clone();options.fileInput.after(function(index){return fileInputClones[index]});if(options.paramName){options.fileInput.each(function(index){$(this).prop("name",paramNames[index]||options.paramName)})}form.append(options.fileInput).prop("enctype","multipart/form-data").prop("encoding","multipart/form-data")}form.submit();if(fileInputClones&&fileInputClones.length){options.fileInput.each(function(index,input){var clone=$(fileInputClones[index]);$(input).prop("name",clone.prop("name"));clone.replaceWith(input)})}});form.append(iframe).appendTo(document.body)},abort:function(){if(iframe){iframe.unbind("load").prop("src","javascript".concat(":false;"))}if(form){form.remove()}}}}});$.ajaxSetup({converters:{"iframe text":function(iframe){return iframe&&$(iframe[0].body).text()},"iframe json":function(iframe){return iframe&&$.parseJSON($(iframe[0].body).text())},"iframe html":function(iframe){return iframe&&$(iframe[0].body).html()},"iframe xml":function(iframe){var xmlDoc=iframe&&iframe[0];return xmlDoc&&$.isXMLDoc(xmlDoc)?xmlDoc:$.parseXML((xmlDoc.XMLDocument&&xmlDoc.XMLDocument.xml)||$(xmlDoc.body).html())},"iframe script":function(iframe){return iframe&&$.globalEval($(iframe[0].body).text())}}})}));
-
-/**
- * Copyright (c) 2011-2013 Felix Gnass
- * Licensed under the MIT license
- */
-//fgnass.github.com/spin.js#v1.3.2
-(function(root,factory){if(typeof exports=="object"){module.exports=factory()}else{if(typeof define=="function"&&define.amd){define(factory)}else{root.Spinner=factory()}}}(this,function(){var prefixes=["webkit","Moz","ms","O"],animations={},useCssAnimations;function createEl(tag,prop){var el=document.createElement(tag||"div"),n;for(n in prop){el[n]=prop[n]}return el}function ins(parent){for(var i=1,n=arguments.length;i>1):parseInt(o.left,10)+mid)+"px",top:(o.top=="auto"?tp.y-ep.y+(target.offsetHeight>>1):parseInt(o.top,10)+mid)+"px"})}el.setAttribute("role","progressbar");self.lines(el,self.opts);if(!useCssAnimations){var i=0,start=(o.lines-1)*(1-o.direction)/2,alpha,fps=o.fps,f=fps/o.speed,ostep=(1-o.opacity)/(f*o.trail/100),astep=f/o.lines;(function anim(){i++;for(var j=0;j>1)+"px"})}for(;i',attr)}sheet.addRule(".spin-vml","behavior:url(#default#VML)");Spinner.prototype.lines=function(el,o){var r=o.length+o.width,s=2*r;function grp(){return css(vml("group",{coordsize:s+" "+s,coordorigin:-r+" "+-r}),{width:s,height:s})}var margin=-(o.width+o.length)*2+"px",g=css(grp(),{position:"absolute",top:margin,left:margin}),i;function seg(i,dx,filter){ins(g,ins(css(grp(),{rotation:360/o.lines*i+"deg",left:~~dx}),ins(css(vml("roundrect",{arcsize:o.corners}),{width:r,height:o.width,left:o.radius,top:-o.width>>1,filter:filter}),vml("fill",{color:getColor(o.color,i),opacity:o.opacity}),vml("stroke",{opacity:0}))))}if(o.shadow){for(i=1;i<=o.lines;i++){seg(i,-2,"progid:DXImageTransform.Microsoft.Blur(pixelradius=2,makeshadow=1,shadowopacity=.3)")}}for(i=1;i<=o.lines;i++){seg(i)}return ins(el,g)};Spinner.prototype.opacity=function(el,i,val,o){var c=el.firstChild;o=o.shadow&&o.lines||0;if(c&&i+ot.clientHeight?true:false;e.horizontal=t.scrollWidth>t.clientWidth?true:false;return e}})(jQuery);
-
-/**
- * Antiscroll
- * https://github.com/LearnBoost/antiscroll
- */
-(function($){$.fn.antiscroll=function(options){return this.each(function(){if($(this).data("antiscroll"))$(this).data("antiscroll").destroy();$(this).data("antiscroll",new $.Antiscroll(this,options))})};$.Antiscroll=Antiscroll;function Antiscroll(el,opts){this.el=$(el);this.options=opts||{};this.x=false!==this.options.x||this.options.forceHorizontal;this.y=false!==this.options.y||this.options.forceVertical;this.autoHide=false!==this.options.autoHide;this.padding=undefined==this.options.padding?2:
-this.options.padding;this.inner=this.el.find(".antiscroll-inner");this.inner.css({"width":"+="+(this.y?scrollbarSize():0),"height":"+="+(this.x?scrollbarSize():0)});this.refresh()}Antiscroll.prototype.refresh=function(){var needHScroll=this.inner.get(0).scrollWidth>this.el.width()+(this.y?scrollbarSize():0),needVScroll=this.inner.get(0).scrollHeight>this.el.height()+(this.x?scrollbarSize():0);if(this.x)if(!this.horizontal&&needHScroll)this.horizontal=new Scrollbar.Horizontal(this);else if(this.horizontal&&
-!needHScroll){this.horizontal.destroy();this.horizontal=null}else if(this.horizontal)this.horizontal.update();if(this.y)if(!this.vertical&&needVScroll)this.vertical=new Scrollbar.Vertical(this);else if(this.vertical&&!needVScroll){this.vertical.destroy();this.vertical=null}else if(this.vertical)this.vertical.update()};Antiscroll.prototype.destroy=function(){if(this.horizontal){this.horizontal.destroy();this.horizontal=null}if(this.vertical){this.vertical.destroy();this.vertical=null}return this};
-Antiscroll.prototype.rebuild=function(){this.destroy();this.inner.attr("style","");Antiscroll.call(this,this.el,this.options);return this};function Scrollbar(pane){this.pane=pane;this.pane.el.append(this.el);this.innerEl=this.pane.inner.get(0);this.dragging=false;this.enter=false;this.shown=false;this.pane.el.mouseenter($.proxy(this,"mouseenter"));this.pane.el.mouseleave($.proxy(this,"mouseleave"));this.el.mousedown($.proxy(this,"mousedown"));this.innerPaneScrollListener=$.proxy(this,"scroll");this.pane.inner.scroll(this.innerPaneScrollListener);
-this.innerPaneMouseWheelListener=$.proxy(this,"mousewheel");this.pane.inner.bind("mousewheel",this.innerPaneMouseWheelListener);var initialDisplay=this.pane.options.initialDisplay;if(initialDisplay!==false){this.show();if(this.pane.autoHide)this.hiding=setTimeout($.proxy(this,"hide"),parseInt(initialDisplay,10)||3E3)}}Scrollbar.prototype.destroy=function(){this.el.remove();this.pane.inner.unbind("scroll",this.innerPaneScrollListener);this.pane.inner.unbind("mousewheel",this.innerPaneMouseWheelListener);
-return this};Scrollbar.prototype.mouseenter=function(){this.enter=true;this.show()};Scrollbar.prototype.mouseleave=function(){this.enter=false;if(!this.dragging)if(this.pane.autoHide)this.hide()};Scrollbar.prototype.scroll=function(){if(!this.shown){this.show();if(!this.enter&&!this.dragging)if(this.pane.autoHide)this.hiding=setTimeout($.proxy(this,"hide"),1500)}this.update()};Scrollbar.prototype.mousedown=function(ev){ev.preventDefault();this.dragging=true;this.startPageY=ev.pageY-parseInt(this.el.css("top"),
-10);this.startPageX=ev.pageX-parseInt(this.el.css("left"),10);this.el[0].ownerDocument.onselectstart=function(){return false};var pane=this.pane,move=$.proxy(this,"mousemove"),self=this;$(this.el[0].ownerDocument).mousemove(move).mouseup(function(){self.dragging=false;this.onselectstart=null;$(this).unbind("mousemove",move);if(!self.enter)self.hide()})};Scrollbar.prototype.show=function(duration){if(!this.shown&&this.update()){this.el.addClass("antiscroll-scrollbar-shown");if(this.hiding){clearTimeout(this.hiding);
-this.hiding=null}this.shown=true}};Scrollbar.prototype.hide=function(){if(this.pane.autoHide!==false&&this.shown){this.el.removeClass("antiscroll-scrollbar-shown");this.shown=false}};Scrollbar.Horizontal=function(pane){this.el=$('