You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
15 lines
111 KiB
15 lines
111 KiB
/** # Semantic UI
|
|
* Version: 0.1
|
|
* http://github.com/quirkyinc/semantic
|
|
*
|
|
*
|
|
* Copyright 2013 Contributors
|
|
* Released under the MIT license
|
|
* http://opensource.org/licenses/MIT
|
|
*
|
|
* Released: 08/06/2013
|
|
*/
|
|
!function(a,b,c,d){a.fn.accordion=function(b){var c,e=a(this),f=a.isPlainObject(b)?a.extend(!0,{},a.fn.accordion.settings,b):a.fn.accordion.settings,g=f.className,h=f.namespace,i=f.selector,j=f.errors,k="."+h,l="module-"+h,m=e.selector||"",n=(new Date).getTime(),o=[],p=arguments[0],q="string"==typeof p,r=[].slice.call(arguments,1);return e.each(function(){var b,e=a(this),h=e.find(i.title),s=(e.find(i.icon),e.find(i.content)),t=this,u=e.data(l);b={initialize:function(){b.debug("Initializing accordion with bound events",e),h.on("click"+k,b.event.click),b.instantiate()},instantiate:function(){e.data(l,b)},destroy:function(){b.debug("Destroying previous accordion for",e),e.off(k).removeData(l)},event:{click:function(){b.verbose("Title clicked",this);var c=a(this),d=h.index(c);b.toggle(d)},resetStyle:function(){b.verbose("Resetting styles on element",this),a(this).removeAttr("style").children().removeAttr("style")}},toggle:function(a){b.debug("Toggling content content at index",a);var c=h.eq(a),d=c.hasClass(g.active);d?f.collapsible?b.close(a):b.debug("Cannot close accordion content collapsing is disabled"):b.open(a)},open:function(c){var d=h.eq(c),e=d.next(s),i=h.filter("."+g.active),j=i.next(h),k=i.size()>0;e.is(":animated")||(b.debug("Opening accordion content",d),f.exclusive&&k&&(i.removeClass(g.active),j.stop().children().animate({opacity:0},f.speed,b.event.resetStyle).end().slideUp(f.speed,f.easing,function(){j.removeClass(g.active).removeAttr("style").children().removeAttr("style")})),d.addClass(g.active),e.stop().children().removeAttr("style").end().slideDown(f.speed,f.easing,function(){e.addClass(g.active).removeAttr("style"),a.proxy(f.onOpen,e)(),a.proxy(f.onChange,e)()}))},close:function(c){var d=h.eq(c),e=d.next(s);b.debug("Closing accordion content",d),d.removeClass(g.active),e.removeClass(g.active).show().stop().children().animate({opacity:0},f.speed,b.event.resetStyle).end().slideUp(f.speed,f.easing,function(){e.removeAttr("style"),a.proxy(f.onClose,e)(),a.proxy(f.onChange,e)()})},setting:function(c,e){return b.debug("Changing setting",c,e),e===d?f[c]:(a.isPlainObject(c)?a.extend(!0,f,c):f[c]=e,void 0)},internal:function(c,e){return b.debug("Changing internal",c,e),e===d?b[c]:(a.isPlainObject(c)?a.extend(!0,b,c):b[c]=e,void 0)},debug:function(){f.debug&&(f.performance?b.performance.log(arguments):(b.debug=Function.prototype.bind.call(console.info,console,f.moduleName+":"),b.debug.apply(console,arguments)))},verbose:function(){f.verbose&&f.debug&&(f.performance?b.performance.log(arguments):(b.verbose=Function.prototype.bind.call(console.info,console,f.moduleName+":"),b.verbose.apply(console,arguments)))},error:function(){b.error=Function.prototype.bind.call(console.error,console,f.moduleName+":"),b.error.apply(console,arguments)},performance:{log:function(a){var c,d,e;f.performance&&(c=(new Date).getTime(),e=n||c,d=c-e,n=c,o.push({Element:t,Name:a[0],Arguments:[].slice.call(a,1)||"","Execution Time":d})),clearTimeout(b.performance.timer),b.performance.timer=setTimeout(b.performance.display,100)},display:function(){var c=f.moduleName+":",e=0;n=!1,clearTimeout(b.performance.timer),a.each(o,function(a,b){e+=b["Execution Time"]}),c+=" "+e+"ms",m&&(c+=" '"+m+"'"),(console.group!==d||console.table!==d)&&o.length>0&&(console.groupCollapsed(c),console.table?console.table(o):a.each(o,function(a,b){console.log(b.Name+": "+b["Execution Time"]+"ms")}),console.groupEnd()),o=[]}},invoke:function(c,e,f){var g,h;return e=e||r,f=t||f,"string"==typeof c&&u!==d&&(c=c.split(/[\. ]/),g=c.length-1,a.each(c,function(c,e){return a.isPlainObject(u[e])&&c!=g?(u=u[e],!0):u[e]!==d?(h=u[e],!0):(b.error(j.method),!1)})),a.isFunction(h)?h.apply(f,e):h||!1}},q?(u===d&&b.initialize(),c=b.invoke(p)):(u!==d&&b.destroy(),b.initialize())}),c?c:this},a.fn.accordion.settings={moduleName:"Accordion",debug:!0,verbose:!0,performance:!0,exclusive:!0,collapsible:!0,onOpen:function(){},onClose:function(){},onChange:function(){},error:{method:"The method you called is not defined"},className:{active:"active",hover:"hover"},selector:{title:".title",icon:".icon",content:".content"},speed:500,easing:"easeInOutQuint"}}(jQuery,window,document),function(a,b,c,d){a.api=a.fn.api=function(c){var e,f,g=a.extend(!0,{},a.api.settings,c),h="function"!=typeof this?this:a("<div/>"),i=g.stateContext?a(g.stateContext):a(h),j="object"==typeof this?a(h):i,k=this,l=(new Date).getTime(),m=[],n=j.selector||"",o=g.namespace+"-module",p=g.className,q=g.metadata,r=g.errors,s=j.data(o),t=arguments[0],u=s!==d&&"string"==typeof t,v=[].slice.call(arguments,1);return e={initialize:function(){var c,f,h,k,l,m,n=(new Date).getTime(),o={},r={},s=g.errors;return g.serializeForm&&a(this).toJSON()!==d&&(o=e.get.formData(),e.debug("Adding form data to API Request",o),a.extend(!0,g.data,o)),c=a.proxy(g.beforeSend,j)(g),c===d||c?(k=e.get.url(e.get.templateURL()))?(h=a.Deferred().always(function(){g.stateContext&&i.removeClass(p.loading),a.proxy(g.complete,j)()}).done(function(b){e.debug("API request successful"),"json"==g.dataType?b.error!==d?a.proxy(g.failure,i)(b.error,g,j):a.isArray(b.errors)?a.proxy(g.failure,i)(b.errors[0],g,j):a.proxy(g.success,i)(b,g,j):a.proxy(g.success,i)(b,g,j)}).fail(function(b,c,f){var h,j=g.errors[c]!==d?g.errors[c]:f;if(b!==d)if(b.readyState!==d&&4==b.readyState){if(200!=b.status&&f!==d&&""!==f)e.error(s.statusMessage+f);else if("error"==c&&"json"==g.dataType)try{h=a.parseJSON(b.responseText),h&&h.error!==d&&(j=h.error)}catch(k){e.error(s.JSONParse)}i.removeClass(p.loading).addClass(p.error),g.errorLength>0&&setTimeout(function(){i.removeClass(p.error)},g.errorLength),e.debug("API Request error:",j),a.proxy(g.failure,i)(j,g,this)}else e.debug("Request Aborted (Most likely caused by page change)")}),a.extend(!0,r,g,{success:function(){},failure:function(){},complete:function(){},type:g.method||g.type,data:l,url:k,beforeSend:g.beforeXHR}),g.stateContext&&i.addClass(p.loading),g.progress&&(e.verbose("Adding progress events"),a.extend(!0,r,{xhr:function(){var c=new b.XMLHttpRequest;return c.upload.addEventListener("progress",function(b){var c;b.lengthComputable&&(c=Math.round(1e4*(b.loaded/b.total))/100+"%",a.proxy(g.progress,i)(c,b))},!1),c.addEventListener("progress",function(b){var c;b.lengthComputable&&(c=Math.round(1e4*(b.loaded/b.total))/100+"%",a.proxy(g.progress,i)(c,b))},!1),c}})),e.verbose("Creating AJAX request with settings: ",r),m=a.ajax(r).always(function(){f=g.loadingLength-((new Date).getTime()-n),g.loadingDelay=0>f?0:f}).done(function(a){var b=this;setTimeout(function(){h.resolveWith(b,[a])},g.loadingDelay)}).fail(function(a,b,c){var d=this;"abort"!=b?setTimeout(function(){h.rejectWith(d,[a,b,c])},g.loadingDelay):i.removeClass(p.error).removeClass(p.loading)}),g.stateContext&&j.data(q.promise,h).data(q.xhr,m),void 0):(e.error(s.missingURL),e.reset(),void 0):(e.error(s.beforeSend),e.reset(),void 0)},get:{formData:function(){return j.closest("form").toJSON()},templateURL:function(){var a,b=j.data(g.metadata.action)||g.action||!1;return b&&(e.debug("Creating url for: ",b),g.api[b]!==d?a=g.api[b]:e.error(r.missingAction)),g.url&&(a=g.url,e.debug("Getting url",a)),a},url:function(b,c){var f;return b&&(f=b.match(g.regExpTemplate),c=c||g.urlData,f&&(e.debug("Looking for URL variables",f),a.each(f,function(g,h){var i=h.substr(2,h.length-3),k=a.isPlainObject(c)&&c[i]!==d?c[i]:j.data(i)!==d?j.data(i):c[i];if(e.verbose("Looking for variable",i,j,j.data(i),c[i]),k===!1)e.debug("Removing variable from URL",f),b=b.replace("/"+h,"");else{if(k===d||!k)return e.error(r.missingParameter+i),b=!1,!1;b=b.replace(h,k)}}))),b}},reset:function(){j.data(q.promise,!1).data(q.xhr,!1),i.removeClass(p.error).removeClass(p.loading)},setting:function(b,c){return c===d?g[b]:(a.isPlainObject(b)?a.extend(!0,g,b):g[b]=c,void 0)},internal:function(b,c){return c===d?e[b]:(a.isPlainObject(b)?a.extend(!0,e,b):e[b]=c,void 0)},debug:function(){g.debug&&(g.performance?e.performance.log(arguments):(e.debug=Function.prototype.bind.call(console.info,console,g.moduleName+":"),e.debug.apply(console,arguments)))},verbose:function(){g.verbose&&g.debug&&(g.performance?e.performance.log(arguments):(e.verbose=Function.prototype.bind.call(console.info,console,g.moduleName+":"),e.verbose.apply(console,arguments)))},error:function(){e.error=Function.prototype.bind.call(console.error,console,g.moduleName+":"),e.error.apply(console,arguments)},performance:{log:function(a){var b,c,d;g.performance&&(b=(new Date).getTime(),d=l||b,c=b-d,l=b,m.push({Element:k,Name:a[0],Arguments:[].slice.call(a,1)||"","Execution Time":c})),clearTimeout(e.performance.timer),e.performance.timer=setTimeout(e.performance.display,100)},display:function(){var b=g.moduleName+":",c=0;clearTimeout(e.performance.timer),l=!1,a.each(m,function(a,b){c+=b["Execution Time"]}),b+=" "+c+"ms",n&&(b+=" '"+n+"'"),(console.group!==d||console.table!==d)&&m.length>0&&(console.groupCollapsed(b),console.table?console.table(m):a.each(m,function(a,b){console.log(b.Name+": "+b["Execution Time"]+"ms")}),console.groupEnd()),m=[]}},invoke:function(b,c,f){var g,h;return c=c||v,f=k||f,"string"==typeof b&&s!==d&&(b=b.split(/[\. ]/),g=b.length-1,a.each(b,function(b,c){a.isPlainObject(s[c])&&b!=g?s=s[c]:s[c]!==d?h=s[c]:e.error(r.method)})),a.isFunction(h)?(e.verbose("Executing invoked function",h),h.apply(f,c)):h||!1}},u?(s===d&&e.initialize(),f=e.invoke(t)):(s!==d&&e.destroy(),e.initialize()),f?f:this},a.fn.apiButton=function(b){return a(this).each(function(){var c,d=a(this),e=a(this).selector||"",f=a.isFunction(b)?a.extend(!0,{},a.api.settings,a.fn.apiButton.settings,{stateContext:this,success:b}):a.extend(!0,{},a.api.settings,a.fn.apiButton.settings,{stateContext:this},b);c={initialize:function(){f.context&&""!==e?a(f.context).on(e,"click."+f.namespace,c.click):d.on("click."+f.namespace,c.click)},click:function(){f.filter&&0!==a(this).filter(f.filter).size()||a.proxy(a.api,this)(f)}},c.initialize()}),this},a.api.settings={moduleName:"API",namespace:"api",debug:!0,verbose:!0,performance:!0,api:{},beforeSend:function(a){return a},beforeXHR:function(){},success:function(){},complete:function(){},failure:function(){},progress:!1,errors:{missingAction:"API action used but no url was defined",missingURL:"URL not specified for the API action",missingParameter:"Missing an essential URL parameter: ",timeout:"Your request timed out",error:"There was an error with your request",parseError:"There was an error parsing your request",JSONParse:"JSON could not be parsed during error handling",statusMessage:"Server gave an error: ",beforeSend:"The before send function has aborted the request",exitConditions:"API Request Aborted. Exit conditions met"},className:{loading:"loading",error:"error"},metadata:{action:"action",promise:"promise",xhr:"xhr"},regExpTemplate:/\{\$([A-z]+)\}/g,action:!1,url:!1,urlData:!1,serializeForm:!1,stateContext:!1,method:"get",data:{},dataType:"json",cache:!0,loadingLength:200,errorLength:2e3},a.fn.apiButton.settings={filter:".disabled, .loading",context:!1,stateContext:!1}}(jQuery,window,document),function(a,b,c,d){a.fn.colorize=function(b){var c=a.extend(!0,{},a.fn.colorize.settings,b),e=arguments||!1;return a(this).each(function(b){var f,g,h,i,j,k,l,m,n=a(this),o=a("<canvas />")[0],p=a("<canvas />")[0],q=a("<canvas />")[0],r=new Image,s=c.colors,t=(c.paths,c.namespace),u=c.errors,v=n.data("module-"+t);return m={checkPreconditions:function(){return m.debug("Checking pre-conditions"),!a.isPlainObject(s)||a.isEmptyObject(s)?(m.error(u.undefinedColors),!1):!0},async:function(a){c.async?setTimeout(a,0):a()},getMetadata:function(){m.debug("Grabbing metadata"),i=n.data("image")||c.image||d,j=n.data("name")||c.name||b,k=c.width||n.width(),l=c.height||n.height(),(0===k||0===l)&&m.error(u.undefinedSize)},initialize:function(){m.debug("Initializing with colors",s),m.checkPreconditions()&&m.async(function(){m.getMetadata(),m.canvas.create(),m.draw.image(function(){m.draw.colors(),m.canvas.merge()}),n.data("module-"+t,m)})},redraw:function(){m.debug("Redrawing image"),m.async(function(){m.canvas.clear(),m.draw.colors(),m.canvas.merge()})},change:{color:function(a,b){return m.debug("Changing color",a),s[a]===d?(m.error(u.missingColor),!1):(s[a]=b,m.redraw(),void 0)}},canvas:{create:function(){m.debug("Creating canvases"),o.width=k,o.height=l,p.width=k,p.height=l,q.width=k,q.height=l,f=o.getContext("2d"),g=p.getContext("2d"),h=q.getContext("2d"),n.append(o),f=n.children("canvas")[0].getContext("2d")},clear:function(){m.debug("Clearing canvas"),h.fillStyle="#FFFFFF",h.fillRect(0,0,k,l)},merge:function(){return a.isFunction(f.blendOnto)?(f.putImageData(g.getImageData(0,0,k,l),0,0),h.blendOnto(f,"multiply"),void 0):(m.error(u.missingPlugin),void 0)}},draw:{image:function(a){m.debug("Drawing image"),a=a||function(){},i?(r.src=i,r.onload=function(){g.drawImage(r,0,0),a()}):(m.error(u.noImage),a())},colors:function(){m.debug("Drawing color overlays",s),a.each(s,function(a,b){c.onDraw(h,j,a,b)})}},debug:function(a,b){c.debug&&(b!==d?console.info(c.moduleName+": "+a,b):console.info(c.moduleName+": "+a))},error:function(a){console.warn(c.moduleName+": "+a)},invoke:function(b,e,f){var g;return f=f||Array.prototype.slice.call(arguments,2),"string"==typeof b&&v!==d&&(b=b.split("."),a.each(b,function(b,d){return a.isPlainObject(v[d])?(v=v[d],!0):a.isFunction(v[d])?(g=v[d],!0):(m.error(c.errors.method),!1)})),a.isFunction(g)?g.apply(e,f):!1}},v!==d&&e?("invoke"==e[0]&&(e=Array.prototype.slice.call(e,1)),m.invoke(e[0],this,Array.prototype.slice.call(e,1))):(m.initialize(),void 0)}),this},a.fn.colorize.settings={moduleName:"Image Colorizer",debug:!0,namespace:"colorize",onDraw:function(){},async:!0,colors:{},metadata:{image:"image",name:"name"},errors:{noImage:"No tracing image specified",undefinedColors:"No default colors specified.",missingColor:"Attempted to change color that does not exist",missingPlugin:"Blend onto plug-in must be included",undefinedHeight:"The width or height of image canvas could not be automatically determined. Please specify a height."}}}(jQuery,window,document),function(a,b,c,d){a.fn.form=function(b,c){var e,f=a(this),g=a.extend(!0,{},a.fn.form.settings,c),h=a.extend({},a.fn.form.settings.defaults,b),i=g.namespace,j=g.metadata,k=g.selector,l=g.className,m=g.error,n="."+i,o="module-"+i,p=f.selector||"",q=(new Date).getTime(),r=[],s=arguments[0],t="string"==typeof s,u=[].slice.call(arguments,1);return f.each(function(){var b,c=a(this),f=a(this).find(k.field),i=a(this).find(k.group),v=a(this).find(k.message),w=(a(this).find(k.prompt),a(this).find(k.submit)),x=[],y=this,z=c.data(o);b={initialize:function(){b.verbose("Initializing form validation",c,h,g),g.keyboardShortcuts&&f.on("keydown"+n,b.event.field.keydown),c.on("submit"+n,b.validate.form),f.on("blur"+n,b.event.field.change),w.on("click"+n,b.submit),b.instantiate()},instantiate:function(){b.verbose("Storing instance of module",b),z=b,c.data(o,b)},destroy:function(){b.verbose("Destroying previous module",z),c.off(n).removeData(o)},refresh:function(){b.verbose("Refreshing selector cache"),f=c.find(k.field)},submit:function(){b.verbose("Submitting form",c),c.submit()},event:{field:{keydown:function(c){var d=a(this),e=c.which,f={enter:13,escape:27};return e==f.escape&&(b.verbose("Escape key pressed blurring field"),d.blur()),e==f.enter&&d.is(k.input)?(b.debug("Enter key pressed, submitting form"),w.addClass(l.down),d.one("keyup"+n,b.event.field.keyup),c.preventDefault(),!1):void 0},keyup:function(){b.verbose("Doing keyboard shortcut form submit"),w.removeClass(l.down),b.submit()},change:function(){var c=a(this),d=c.closest(i);d.hasClass(l.error)?(b.debug("Revalidating field",c,b.get.validation(c)),b.validate.field(b.get.validation(c))):"change"==g.on&&b.validate.field(b.get.validation(c))}}},get:{field:function(c){return b.verbose("Finding field with identifier",c),f.filter("#"+c).size()>0?f.filter("#"+c):f.filter('[name="'+c+'"]').size()>0?f.filter('[name="'+c+'"]'):f.filter("[data-"+j.validate+'="'+c+'"]').size()>0?f.filter("[data-"+j.validate+'="'+c+'"]'):a("<input/>")},validation:function(c){var d;return a.each(h,function(a,e){b.get.field(e.identifier).get(0)==c.get(0)&&(d=e)}),d||!1}},has:{field:function(a){return b.verbose("Checking for existence of a field with identifier",a),f.filter("#"+a).size()>0?!0:f.filter('[name="'+a+'"]').size()>0?!0:f.filter("[data-"+j.validate+'="'+a+'"]').size()>0?!0:!1}},add:{prompt:function(a,c){var d=b.get.field(a.identifier),e=d.closest(i),f=e.find(k.prompt),h=0!==f.size();b.verbose("Adding inline validation prompt"),e.addClass(l.error),g.inlineError&&(h||(f=g.templates.prompt(c),f.appendTo(e).hide()),f.html(c[0]),f.is(":not(:visible)")&&f.fadeIn(g.animateSpeed))},errors:function(a){b.debug("Adding form error messages",a),v.html(g.templates.error(a))}},remove:{prompt:function(a){var c=b.get.field(a.identifier),d=c.closest(i),e=d.find(k.prompt);d.removeClass(l.error),g.inlineError&&e.hide()}},validate:{form:function(d){var e=!0;return x=[],a.each(h,function(a,c){b.validate.field(c)||(e=!1)}),e?(b.debug("Form has no validation errors, submitting"),c.removeClass(l.error).addClass(l.success),a.proxy(g.onSuccess,this)(d),void 0):(b.debug("Form has errors"),c.addClass(l.error),g.inlineError||b.add.errors(x),a.proxy(g.onFailure,this)(x))},field:function(c){var e=b.get.field(c.identifier),f=!0,h=[];return c.rules!==d&&a.each(c.rules,function(a,d){b.has.field(c.identifier)&&!b.validate.rule(c,d)&&(b.debug("Field is invalid",c.identifier,d.type),h.push(d.prompt),f=!1)}),f?(b.remove.prompt(c,h),a.proxy(g.onValid,e)(),!0):(x=x.concat(h),b.add.prompt(c,h),a.proxy(g.onInvalid,e)(h),!1)},rule:function(e,f){var h,i,j=b.get.field(e.identifier),k=f.type,l=j.val(),m=/\[(.*?)\]/i,n=m.exec(k),o=!0;return n!==d&&null!==n?(h=n[1],i=k.replace(n[0],""),o=a.proxy(g.rules[i],c)(l,h)):o="checked"==k?j.filter(":checked").size()>0:g.rules[k](l),o}},setting:function(c,e){return b.debug("Changing setting",c,e),e===d?g[c]:(a.isPlainObject(c)?a.extend(!0,g,c):g[c]=e,void 0)},internal:function(c,e){return b.debug("Changing internal",c,e),e===d?b[c]:(a.isPlainObject(c)?a.extend(!0,b,c):b[c]=e,void 0)},debug:function(){g.debug&&(g.performance?b.performance.log(arguments):(b.debug=Function.prototype.bind.call(console.info,console,g.moduleName+":"),b.debug.apply(console,arguments)))},verbose:function(){g.verbose&&g.debug&&(g.performance?b.performance.log(arguments):(b.verbose=Function.prototype.bind.call(console.info,console,g.moduleName+":"),b.verbose.apply(console,arguments)))},error:function(){b.error=Function.prototype.bind.call(console.error,console,g.moduleName+":"),b.error.apply(console,arguments)},performance:{log:function(a){var c,d,e;g.performance&&(c=(new Date).getTime(),e=q||c,d=c-e,q=c,r.push({Element:y,Name:a[0],Arguments:[].slice.call(a,1)||"","Execution Time":d})),clearTimeout(b.performance.timer),b.performance.timer=setTimeout(b.performance.display,100)},display:function(){var c=g.moduleName+":",e=0;q=!1,clearTimeout(b.performance.timer),a.each(r,function(a,b){e+=b["Execution Time"]}),c+=" "+e+"ms",p&&(c+=" '"+p+"'"),(console.group!==d||console.table!==d)&&r.length>0&&(console.groupCollapsed(c),console.table?console.table(r):a.each(r,function(a,b){console.log(b.Name+": "+b["Execution Time"]+"ms")}),console.groupEnd()),r=[]}},invoke:function(c,e,f){var g,h;return e=e||u,f=y||f,"string"==typeof c&&z!==d&&(c=c.split(/[\. ]/),g=c.length-1,a.each(c,function(c,e){return a.isPlainObject(z[e])&&c!=g?(z=z[e],!0):z[e]!==d?(h=z[e],!0):(b.error(m.method),!1)})),a.isFunction(h)?h.apply(f,e):h||!1}},t?(z===d&&b.initialize(),e=b.invoke(s)):(z!==d&&b.destroy(),b.initialize())}),e?e:this},a.fn.form.settings={moduleName:"Form",debug:!0,verbose:!0,performance:!0,namespace:"form",keyboardShortcuts:!0,on:"submit",animateSpeed:150,inlineError:!1,onValid:function(){},onInvalid:function(){},onSuccess:function(){return!0},onFailure:function(){return!1},metadata:{validate:"validate"},selector:{message:".error.message",field:"input, textarea, select",group:".field",input:"input",prompt:".prompt",submit:".submit"},className:{error:"error",success:"success",down:"down",label:"ui label prompt"},error:{method:"The method you called is not defined."},templates:{error:function(b){var c='<ul class="list">';return a.each(b,function(a,b){c+="<li>"+b+"</li>"}),c+="</ul>",a(c)},prompt:function(b){return a("<div/>").addClass("ui red pointing prompt label").html(b[0])}},rules:{empty:function(a){return!(a===d||""===a)},email:function(a){var b=new RegExp("[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?");return b.test(a)},length:function(a,b){return a!==d?a.length>=b:!1},not:function(a,b){return a!=b},is:function(a,b){return a==b},maxLength:function(a,b){return a!==d?a.length<=b:!1},match:function(b,c){var e,f=a(this);return f.find("#"+c).size()>0?e=f.find("#"+c).val():f.find("[name="+c+"]").size()>0?e=f.find("[name="+c+"]").val():f.find('[data-validate="'+c+'"]').size()>0&&(e=f.find('[data-validate="'+c+'"]').val()),e!==d?b.toString()==e.toString():!1},url:function(a){var b=/(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/;return b.test(a)}}}}(jQuery,window,document),function(a,b,c,d){a.fn.state=function(b){var c,e=a(this),f=a.extend(!0,{},a.fn.state.settings,b),g=e.selector||"",h=(new Date).getTime(),i=[],j=arguments[0],k="string"==typeof j,l=[].slice.call(arguments,1),m=f.errors,n=f.metadata,o=f.className,p=f.namespace,q=f.states,r=f.text,s="."+p,t=p+"-module";return e.each(function(){var p,u=a(this),v=this,w=u.data(t);p={initialize:function(){p.verbose("Initializing module"),f.automatic&&p.add.defaults(),f.context&&""!==g?(p.allows("hover")&&a(v,f.context).on(g,"mouseenter"+s,p.enable.hover).on(g,"mouseleave"+s,p.disable.hover),p.allows("down")&&a(v,f.context).on(g,"mousedown"+s,p.enable.down).on(g,"mouseup"+s,p.disable.down),p.allows("focus")&&a(v,f.context).on(g,"focus"+s,p.enable.focus).on(g,"blur"+s,p.disable.focus),a(f.context).on(g,"mouseenter"+s,p.change.text).on(g,"mouseleave"+s,p.reset.text).on(g,"click"+s,p.toggle.state)):(p.allows("hover")&&u.on("mouseenter"+s,p.enable.hover).on("mouseleave"+s,p.disable.hover),p.allows("down")&&u.on("mousedown"+s,p.enable.down).on("mouseup"+s,p.disable.down),p.allows("focus")&&u.on("focus"+s,p.enable.focus).on("blur"+s,p.disable.focus),u.on("mouseenter"+s,p.change.text).on("mouseleave"+s,p.reset.text).on("click"+s,p.toggle.state)),p.instantiate()},instantiate:function(){p.verbose("Storing instance of module",p),w=p,u.data(t,p)},destroy:function(){p.verbose("Destroying previous module",w),u.off(s).removeData(t)},refresh:function(){p.verbose("Refreshing selector cache"),u=a(v)},add:{defaults:function(){var c=b&&a.isPlainObject(b.states)?b.states:{};a.each(f.defaults,function(b,e){p.is[b]!==d&&p.is[b]()&&(p.verbose("Adding default states",b,v),a.extend(f.states,e,c))})}},is:{active:function(){return u.hasClass(o.active)},loading:function(){return u.hasClass(o.loading)},inactive:function(){return!u.hasClass(o.active)},enabled:function(){return!u.is(f.filter.active)},disabled:function(){return u.is(f.filter.active)},textEnabled:function(){return!u.is(f.filter.text)},button:function(){return u.is(".button:not(a, .submit)")},input:function(){return u.is("input")}},allow:function(a){p.debug("Now allowing state",a),q[a]=!0},disallow:function(a){p.debug("No longer allowing",a),q[a]=!1},allows:function(a){return q[a]||!1},enable:{state:function(a){p.allows(a)&&u.addClass(o[a])},focus:function(){u.addClass(o.focus)},hover:function(){u.addClass(o.hover)},down:function(){u.addClass(o.down)}},disable:{state:function(a){p.allows(a)&&u.removeClass(o[a])},focus:function(){u.removeClass(o.focus)},hover:function(){u.removeClass(o.hover)},down:function(){u.removeClass(o.down)}},toggle:{state:function(){var a=u.data(n.promise);p.allows("active")&&p.is.enabled()&&(p.refresh(),a!==d?p.listenTo(a):p.change.state())}},textFor:function(a){return r[a]||!1},listenTo:function(b){p.debug("API request detected, waiting for state signal",b),b?(r.loading&&p.update.text(r.loading),a.when(b).then(function(){"resolved"==b.state()?(p.debug("API request succeeded"),f.activateTest=function(){return!0},f.deactivateTest=function(){return!0}):(p.debug("API request failed"),f.activateTest=function(){return!1},f.deactivateTest=function(){return!1}),p.change.state()})):(f.activateTest=function(){return!1},f.deactivateTest=function(){return!1})},change:{state:function(){p.debug("Determining state change direction"),p.is.inactive()?p.activate():p.deactivate(),f.sync&&p.sync(),a.proxy(f.onChange,v)()},text:function(){p.is.textEnabled()&&(p.is.active()?r.hover?(p.verbose("Changing text to hover text",r.hover),p.update.text(r.hover)):r.disable&&(p.verbose("Changing text to disable text",r.disable),p.update.text(r.disable)):r.hover?(p.verbose("Changing text to hover text",r.disable),p.update.text(r.hover)):r.enable&&(p.verbose("Changing text to enable text",r.enable),p.update.text(r.enable)))}},activate:function(){a.proxy(f.activateTest,v)()&&(p.debug("Setting state to active"),u.addClass(o.active),p.update.text(r.active)),a.proxy(f.onActivate,v)()},deactivate:function(){a.proxy(f.deactivateTest,v)()&&(p.debug("Setting state to inactive"),u.removeClass(o.active),p.update.text(r.inactive)),a.proxy(f.onDeactivate,v)()},sync:function(){p.verbose("Syncing other buttons to current state"),p.is.active()?e.not(u).state("activate"):e.not(u).state("deactivate")},get:{text:function(){return f.selector.text?u.find(f.selector.text).text():u.html()}},flash:{text:function(a,b){var c=p.get.text();p.debug("Flashing text message",a,b),a=a||f.text.flash,b=b||f.flashDuration,p.update.text(a),setTimeout(function(){p.update.text(c)},b)}},reset:{text:function(){var a=r.active||u.data(n.storedText),b=r.inactive||u.data(n.storedText);p.is.textEnabled()&&(p.is.active()&&a?(p.verbose("Resetting active text",a),p.update.text(a)):b&&(p.verbose("Resetting inactive text",a),p.update.text(b)))}},update:{text:function(a){var b=p.get.text();a&&a!==b?(p.debug("Updating text",a),f.selector.text?u.data(n.storedText,a).find(f.selector.text).text(a):u.data(n.storedText,a).html(a)):p.debug("Text is already sane, ignoring update",a)}},setting:function(b,c){return p.debug("Changing setting",b,c),c===d?f[b]:(a.isPlainObject(b)?a.extend(!0,f,b):f[b]=c,void 0)},internal:function(b,c){return p.debug("Changing internal",b,c),c===d?p[b]:(a.isPlainObject(b)?a.extend(!0,p,b):p[b]=c,void 0)},debug:function(){f.debug&&(f.performance?p.performance.log(arguments):(p.debug=Function.prototype.bind.call(console.info,console,f.moduleName+":"),p.debug.apply(console,arguments)))},verbose:function(){f.verbose&&f.debug&&(f.performance?p.performance.log(arguments):(p.verbose=Function.prototype.bind.call(console.info,console,f.moduleName+":"),p.verbose.apply(console,arguments)))},error:function(){p.error=Function.prototype.bind.call(console.error,console,f.moduleName+":"),p.error.apply(console,arguments)},performance:{log:function(a){var b,c,d;f.performance&&(b=(new Date).getTime(),d=h||b,c=b-d,h=b,i.push({Element:v,Name:a[0],Arguments:[].slice.call(a,1)||"","Execution Time":c})),clearTimeout(p.performance.timer),p.performance.timer=setTimeout(p.performance.display,100)},display:function(){var b=f.moduleName+":",c=0;h=!1,clearTimeout(p.performance.timer),a.each(i,function(a,b){c+=b["Execution Time"]}),b+=" "+c+"ms",g&&(b+=" '"+g+"'"),(console.group!==d||console.table!==d)&&i.length>0&&(console.groupCollapsed(b),console.table?console.table(i):a.each(i,function(a,b){console.log(b.Name+": "+b["Execution Time"]+"ms")}),console.groupEnd()),i=[]}},invoke:function(b,c,e){var f,g;return c=c||l,e=v||e,"string"==typeof b&&w!==d&&(b=b.split(/[\. ]/),f=b.length-1,a.each(b,function(b,c){return a.isPlainObject(w[c])&&b!=f?(w=w[c],!0):w[c]!==d?(g=w[c],!0):(p.error(m.method),!1)})),a.isFunction(g)?g.apply(e,c):g||!1}},k?(w===d&&p.initialize(),c=p.invoke(j)):(w!==d&&p.destroy(),p.initialize())}),c?c:this},a.fn.state.settings={moduleName:"State",debug:!0,verbose:!0,namespace:"state",performance:!0,onActivate:function(){},onDeactivate:function(){},onChange:function(){},activateTest:function(){return!0},deactivateTest:function(){return!0},automatic:!0,sync:!1,flashDuration:3e3,filter:{text:".loading, .disabled",active:".disabled"},context:!1,errors:{method:"The method you called is not defined."},metadata:{promise:"promise",storedText:"stored-text"},className:{focus:"focus",hover:"hover",down:"down",active:"active",loading:"loading"},selector:{text:!1},defaults:{input:{hover:!0,focus:!0,down:!0,loading:!1,active:!1},button:{hover:!0,focus:!1,down:!0,active:!1,loading:!0}},states:{hover:!0,focus:!0,down:!0,loading:!1,active:!1},text:{flash:!1,hover:!1,active:!1,inactive:!1,enable:!1,disable:!1}}}(jQuery,window,document),function(a,b,c,d){a.fn.carousel=function(b){var c,e=a(this),f=a.extend(!0,{},a.fn.carousel.settings,b),g=("."+f.namespace,"module-"+f.namespace,e.selector||""),h=(new Date).getTime(),i=[],j=arguments[0],k="string"==typeof j,l=[].slice.call(arguments,1);return e.each(function(){var b,m=a(this),n=(a(f.selector.arrows),a(f.selector.leftArrow)),o=a(f.selector.rightArrow),p=a(f.selector.content),q=(a(f.selector.navigation),a(f.selector.navItem)),r=(m.selector||"",this),s=m.data("module-"+f.namespace),t=f.className,u=f.namespace,v=f.errors;b={initialize:function(){b.openingAnimation(),b.marquee.autoAdvance(),n.on("click",b.marquee.left),o.on("click",b.marquee.right),q.on("click",b.marquee.change)},destroy:function(){b.verbose("Destroying previous module for",m),m.off(u)},left:function(){var a=p.filter("."+t.active),b=p.index(a),c=p.size(),d=-1!=b-1?b-1:c-1;q.eq(d).trigger("click")},right:function(){var a=p.filter("."+t.active),b=p.index(a),c=p.size(),d=b+1!=c?b+1:0;q.eq(d).trigger("click")},change:function(){var c=a(this),d=q.index(c),e=p.eq(d);b.marquee.autoAdvance(),c.addClass("active").siblings().removeClass("active"),e.addClass("active animated fadeIn").siblings("."+t.active).removeClass("animated fadeIn scaleIn").animate({opacity:0},500,function(){a(this).removeClass("active").removeAttr("style")})},autoAdvance:function(){clearInterval(b.timer),b.timer=setInterval(b.marquee.right,f.duration)},setting:function(c,e){return e===d?f[c]:(a.isPlainObject(c)?(b.verbose("Modifying settings object",c,e),a.extend(!0,f,c)):(b.verbose("Modifying setting",c,e),f[c]=e),void 0)},internal:function(c,e){return e===d?b[c]:(a.isPlainObject(c)?(b.verbose("Modifying internal property",c,e),a.extend(!0,b,c)):(b.verbose("Changing internal method to",e),b[c]=e),void 0)},debug:function(){f.debug&&(f.performance?b.performance.log(arguments):(b.debug=Function.prototype.bind.call(console.info,console,f.moduleName+":"),b.debug.apply(console,arguments)))},verbose:function(){f.verbose&&f.debug&&(f.performance?b.performance.log(arguments):(b.verbose=Function.prototype.bind.call(console.info,console,f.moduleName+":"),b.verbose.apply(console,arguments)))},error:function(){b.error=Function.prototype.bind.call(console.error,console,f.moduleName+":"),b.error.apply(console,arguments)},performance:{log:function(a){var c,d,e;f.performance&&(c=(new Date).getTime(),e=h||c,d=c-e,h=c,i.push({Element:r,Name:a[0],Arguments:a[1]||"None","Execution Time":d}),clearTimeout(b.performance.timer),b.performance.timer=setTimeout(b.performance.display,100))},display:function(){var b=f.moduleName,c=(f.moduleName+": "+g+"("+e.size()+" elements)",0);g&&(b+=" Performance ("+g+")"),(console.group!==d||console.table!==d)&&i.length>0&&(console.groupCollapsed(b),console.table?(a.each(i,function(a,b){c+=b["Execution Time"]}),console.table(i)):a.each(i,function(a,b){c+=b["Execution Time"],console.log(b.Name+": "+b["Execution Time"]+"ms")}),console.log("Total Execution Time:",c+"ms"),console.groupEnd(),i=[],h=!1)}},invoke:function(c,e,f){var g,h;return e=e||l,f=r||f,"string"==typeof c&&s!==d&&(c=c.split(/[\. ]/),g=c.length-1,a.each(c,function(c,e){return a.isPlainObject(s[e])&&c!=g?(s=s[e],!0):s[e]!==d?(h=s[e],!0):(b.error(v.method),!1)
|
|
})),a.isFunction(h)?h.apply(f,e):h||!1}},k?(s===d&&b.initialize(),c=b.invoke(j)):(s!==d&&b.destroy(),b.initialize())}),c?c:this},a.fn.carousel.settings={moduleName:"Carousel",namespace:"carousel",verbose:!0,debug:!0,performance:!0,duration:5e3,errors:{method:"The method you called is not defined."},selector:{arrows:".arrow",leftArrow:".left.arrow",rightArrow:".right.arrow",content:".content",navigation:".navigation",navItem:".navigation .icon"},className:{active:"active"}}}(jQuery,window,document),function(a,b,c,d){a.fn.chat=function(b,c,e){var f=a.extend(!0,{},a.fn.chat.settings,e),g=arguments||!1;return a(this).each(function(){var e,h,i,j,k,l,m,n=a(this),o=n.find(f.selector.expandButton),p=n.find(f.selector.userListButton),q=n.find(f.selector.userList),r=(n.find(f.selector.room),n.find(f.selector.userCount)),s=n.find(f.selector.log),t=(n.find(f.selector.message),n.find(f.selector.messageInput)),u=n.find(f.selector.messageButton),v=n.data("module"),w=f.className,x=f.namespace,y="",z={};return m={width:{log:s.width(),userList:q.outerWidth()},initialize:function(){return Pusher===d&&m.error(f.errors.pusher),b===d||c===d?(m.error(f.errors.key),!1):f.endpoint.message||f.endpoint.authentication?(l=new Pusher(b),Pusher.channel_auth_endpoint=f.endpoint.authentication,e=l.subscribe(c),e.bind("pusher:subscription_succeeded",m.user.list.create),e.bind("pusher:subscription_error",m.error),e.bind("pusher:member_added",m.user.joined),e.bind("pusher:member_removed",m.user.left),e.bind("update_messages",m.message.receive),a.each(f.customEvents,function(a,b){e.bind(a,b)}),p.on("click."+x,m.event.toggleUserList),o.on("click."+x,m.event.toggleExpand),t.on("keydown."+x,m.event.input.keydown).on("keyup."+x,m.event.input.keyup),u.on("mouseenter."+x,m.event.hover).on("mouseleave."+x,m.event.hover).on("click."+x,m.event.submit),s.animate({scrollTop:s.prop("scrollHeight")},400),n.data("module",m).addClass(w.loading),void 0):(m.error(f.errors.endpoint),!1)},refresh:function(){p.removeClass(w.active),m.width={log:s.width(),userList:q.outerWidth()},p.hasClass(w.active)&&m.user.list.hide(),n.data("module",m)},user:{updateCount:function(){f.userCount&&(z=n.data("users"),j=0,a.each(z,function(){j++}),r.html(f.templates.userCount(j)))},joined:function(b){z=n.data("users"),"anonymous"!=b.id&&z[b.id]===d&&(z[b.id]=b.info,f.randomColor&&b.info.color===d&&(b.info.color=f.templates.color(b.id)),y=f.templates.userList(b.info),b.info.isAdmin?a(y).prependTo(q):a(y).appendTo(q),f.partingMessages&&(s.append(f.templates.joined(b.info)),m.message.scroll.test()),m.user.updateCount())},left:function(a){z=n.data("users"),a!==d&&"anonymous"!==a.id&&(delete z[a.id],n.data("users",z),q.find("[data-id="+a.id+"]").remove(),f.partingMessages&&(s.append(f.templates.left(a.info)),m.message.scroll.test()),m.user.updateCount())},list:{create:function(b){z={},b.each(function(a){"anonymous"!==a.id&&"undefined"!==a.id&&(f.randomColor&&a.info.color===d&&(a.info.color=f.templates.color(a.id)),y=a.info.isAdmin?f.templates.userList(a.info)+y:y+f.templates.userList(a.info),z[a.id]=a.info)}),n.data("users",z).data("user",z[b.me.id]).removeClass(w.loading),q.html(y),m.user.updateCount(),a.proxy(f.onJoin,q.children())()},show:function(){s.animate({width:m.width.log-m.width.userList},{duration:f.speed,easing:f.easing,complete:m.message.scroll.move})},hide:function(){s.stop().animate({width:m.width.log},{duration:f.speed,easing:f.easing,complete:m.message.scroll.move})}}},message:{scroll:{test:function(){k=s.prop("scrollHeight")-s.height(),Math.abs(s.scrollTop()-k)<f.scrollArea&&m.message.scroll.move()},move:function(){k=s.prop("scrollHeight")-s.height(),s.scrollTop(k)}},send:function(b){m.utils.emptyString(b)||a.api({url:f.endpoint.message,method:"POST",data:{chat_message:{content:b,timestamp:(new Date).getTime()}}})},receive:function(a){i=a.data,z=n.data("users"),h=n.data("user"),z[i.userID]!==d&&(h===d||h.id!=i.userID)&&(i.user=z[i.userID],m.message.display(i))},display:function(b){s.append(f.templates.message(b)),m.message.scroll.test(),a.proxy(f.onMessage,s.children().last())()}},expand:function(){n.addClass(w.expand),a.proxy(f.onExpand,n)(),m.refresh()},contract:function(){n.removeClass(w.expand),a.proxy(f.onContract,n)(),m.refresh()},event:{input:{keydown:function(a){13==a.which&&u.addClass(w.down)},keyup:function(a){13==a.which&&(u.removeClass(w.down),m.event.submit())}},submit:function(){var a=t.val(),b=n.data("user");b===d||m.utils.emptyString(a)||(m.message.send(a),m.message.display({user:b,text:a}),m.message.scroll.move(),t.val(""))},toggleExpand:function(){n.hasClass(w.expand)?(o.removeClass(w.active),m.contract()):(o.addClass(w.active),m.expand())},toggleUserList:function(){s.is(":animated")||(p.hasClass(w.active)?(p.removeClass("active"),m.user.list.hide()):(p.addClass(w.active),m.user.list.show()))}},utils:{emptyString:function(a){return"string"==typeof a?-1==a.search(/\S/):!1}},debug:function(a){f.debug&&console.info(f.moduleName+": "+a)},error:function(a){console.warn(f.moduleName+": "+a)},invoke:function(b,c,e){var g;return e=e||Array.prototype.slice.call(arguments,2),"string"==typeof b&&v!==d&&(b=b.split("."),a.each(b,function(b,c){return a.isPlainObject(v[c])?(v=v[c],!0):a.isFunction(v[c])?(g=v[c],!0):(m.error(f.errors.method),!1)})),a.isFunction(g)?g.apply(c,e):!1}},v!==d&&g?("invoke"==g[0]&&(g=Array.prototype.slice.call(g,1)),m.invoke(g[0],this,Array.prototype.slice.call(g,1))):(m.initialize(),void 0)}),this},a.fn.chat.settings={moduleName:"Chat",debug:!1,namespace:"chat",onJoin:function(){},onMessage:function(){},onExpand:function(){},onContract:function(){},customEvents:{},partingMessages:!1,userCount:!0,randomColor:!0,speed:300,easing:"easeOutQuint",scrollArea:9999,endpoint:{message:!1,authentication:!1},errors:{method:"The method you called is not defined",endpoint:"Please define a message and authentication endpoint.",key:"You must specify a pusher key and channel.",pusher:"You must include the Pusher library."},className:{expand:"expand",active:"active",hover:"hover",down:"down",loading:"loading"},selector:{userCount:".actions .message",userListButton:".actions .button.user-list",expandButton:".actions .button.expand",room:".room",userList:".room .user-list",log:".room .log",message:".room .log .message",author:".room log .message .author",messageInput:".talk input",messageButton:".talk .send.button"},templates:{userCount:function(a){return a+" users in chat"},color:function(){var a=["#000000","#333333","#666666","#999999","#CC9999","#CC6666","#CC3333","#993333","#663333","#CC6633","#CC9966","#CC9933","#999966","#CCCC66","#99CC66","#669933","#669966","#33A3CC","#336633","#33CCCC","#339999","#336666","#336699","#6666CC","#9966CC","#333399","#663366","#996699","#993366","#CC6699"];return a[Math.floor(Math.random()*a.length)]},message:function(a){var b="";return a.user.isAdmin?(a.user.color="#55356A",b+='<div class="admin message">',b+='<span class="quirky ui flag team"></span>'):b+='<div class="message">',b+="<p>",b+=a.user.color!==d?'<span class="author" style="color: '+a.user.color+';">'+a.user.name+"</span>: ":'<span class="author">'+a.user.name+"</span>: ",b+=""+a.text+" </p>"+"</div>"},joined:function(a){return typeof a.name!==d?'<div class="status">'+a.name+" has joined the chat.</div>":!1},left:function(a){return typeof a.name!==d?'<div class="status">'+a.name+" has left the chat.</div>":!1},userList:function(a){var b="";return a.isAdmin&&(a.color="#55356A"),b+='<div class="user" data-id="'+a.id+'">'+' <div class="image">'+' <img src="'+a.avatarURL+'">'+" </div>",b+=a.color!==d?' <p><a href="/users/'+a.id+'" target="_blank" style="color: '+a.color+';">'+a.name+"</a></p>":' <p><a href="/users/'+a.id+'" target="_blank">'+a.name+"</a></p>",b+="</div>"}}}}(jQuery,window,document),function(a,b,c,d){a.fn.checkbox=function(b){var c,e=a(this),f=a.extend(!0,{},a.fn.checkbox.settings,b),g=e.selector||"",h=(new Date).getTime(),i=[],j=arguments[0],k="string"==typeof j,l=[].slice.call(arguments,1);return e.each(function(){var b,e=a(this),m=a(this).next(f.selector.label).first(),n=a(this).find(f.selector.input),o="."+f.namespace,p="module-"+f.namespace,q=e.selector||"",r=this,s=e.data(p),t=f.className,u=(f.namespace,f.errors);b={initialize:function(){b.verbose("Initializing checkbox"),f.context&&""!==q?(b.verbose("Adding delegated events"),a(r,f.context).on(q,"click"+o,b.toggle).on(q+" + "+f.selector.label,"click"+o,b.toggle)):(e.on("click"+o,b.toggle).data(p,b),m.on("click"+o,b.toggle)),b.instantiate()},instantiate:function(){b.verbose("Storing instance of module",b),s=b,e.data(p,b)},destroy:function(){b.verbose("Destroying previous module"),e.off(o).removeData(p)},is:{radio:function(){return e.hasClass(t.radio)}},can:{disable:function(){return"boolean"==typeof f.required?f.required:!b.is.radio()}},enable:function(){b.debug("Enabling checkbox"),n.prop("checked",!0),a.proxy(f.onChange,n.get())(),a.proxy(f.onEnable,n.get())()},disable:function(){b.debug("Disabling checkbox"),n.prop("checked",!1),a.proxy(f.onChange,n.get())(),a.proxy(f.onDisable,n.get())()},toggle:function(c){b.verbose("Determining new checkbox state",a(c.target)),n.prop("checked")!==d&&n.prop("checked")?b.can.disable()&&b.disable():b.enable()},setting:function(b,c){return c===d?f[b]:(a.isPlainObject(b)?a.extend(!0,f,b):f[b]=c,void 0)},internal:function(c,e){return e===d?b[c]:(a.isPlainObject(c)?a.extend(!0,b,c):b[c]=e,void 0)},debug:function(){f.debug&&(f.performance?b.performance.log(arguments):(b.debug=Function.prototype.bind.call(console.info,console,f.moduleName+":"),b.debug.apply(console,arguments)))},verbose:function(){f.verbose&&f.debug&&(f.performance?b.performance.log(arguments):(b.verbose=Function.prototype.bind.call(console.info,console,f.moduleName+":"),b.verbose.apply(console,arguments)))},error:function(){b.error=Function.prototype.bind.call(console.error,console,f.moduleName+":"),b.error.apply(console,arguments)},performance:{log:function(a){var c,d,e;f.performance&&(c=(new Date).getTime(),e=h||c,d=c-e,h=c,i.push({Element:r,Name:a[0],Arguments:[].slice.call(a,1)||"","Execution Time":d})),clearTimeout(b.performance.timer),b.performance.timer=setTimeout(b.performance.display,100)},display:function(){var c=f.moduleName+":",e=0;h=!1,clearTimeout(b.performance.timer),a.each(i,function(a,b){e+=b["Execution Time"]}),c+=" "+e+"ms",g&&(c+=" '"+g+"'"),(console.group!==d||console.table!==d)&&i.length>0&&(console.groupCollapsed(c),console.table?console.table(i):a.each(i,function(a,b){console.log(b.Name+": "+b["Execution Time"]+"ms")}),console.groupEnd()),i=[]}},invoke:function(c,e,f){var g,h;return e=e||l,f=r||f,"string"==typeof c&&s!==d&&(c=c.split(/[\. ]/),g=c.length-1,a.each(c,function(c,e){a.isPlainObject(s[e])&&c!=g?s=s[e]:s[e]!==d?h=s[e]:b.error(u.method)})),a.isFunction(h)?h.apply(f,e):h||!1}},k?(s===d&&b.initialize(),c=b.invoke(j)):(s!==d&&b.destroy(),b.initialize())}),c?c:this},a.fn.checkbox.settings={moduleName:"Checkbox",namespace:"checkbox",verbose:!0,debug:!0,performance:!0,context:!1,required:"auto",onChange:function(){},onEnable:function(){},onDisable:function(){},errors:{method:"The method you called is not defined."},selector:{input:"input",label:"label"},className:{radio:"radio"}}}(jQuery,window,document),function(a,b,c,d){a.fn.dimmer=function(b){var e,f=a(this),g=a.isPlainObject(b)?a.extend(!0,{},a.fn.dimmer.settings,b):a.fn.dimmer.settings,h=g.selector,i=g.namespace,j=g.className,k=g.error,l="."+i,m="module-"+i,n=f.selector||"",o=(new Date).getTime(),p=[],q=arguments[0],r="string"==typeof q,s=[].slice.call(arguments,1);return f.each(function(){var b,f=a(this),t=f.children(h.dimmer).first(),u=this,v=t.data(m);b={initialize:function(){b.is.dimmer()?(t=f,f=t.parent(),b.debug("Module initialized as dimmer")):(b.has.dimmer()?(t=f.find(h.dimmer),b.debug("Module initialized with found dimmer")):(t=g.template.dimmer(),t.appendTo(f),b.debug("Module initialized with created dimmer")),"hover"==g.on?f.on("mouseenter"+l,b.show).on("mouseleave"+l,b.hide):"click"==g.on&&f.on("click"+l,b.toggle)),f.addClass(j.dimmable),g.closable&&t.on("click",b.event.click),b.instantiate()},instantiate:function(){b.verbose("Storing instance of module"),v=b,t.data(m,v)},destroy:function(){b.verbose("Destroying previous module"),f.off(i)},event:{click:function(c){b.verbose("Determining if event occured on dimmer",c),(0===t.find(c.target).size()||a(c.target).is(h.content))&&b.hide()}},animate:{show:function(){b.set.dimmed(),"css"==g.animation.show?(b.verbose("Showing dimmer animation with css"),t.one(b.get.animationEndEvent(),function(){b.set.active(),t.removeClass(j.show)}).addClass(j.show)):"fade"==g.animation.show&&(b.verbose("Showing dimmer animation with javascript"),t.stop().css({opacity:0,width:"100%",height:"100%"}).fadeTo(g.duration,1,function(){t.removeAttr("style"),b.set.active()}))},hide:function(){b.remove.dimmed(),"css"==g.animation.hide?(b.verbose("Hiding dimmer with css"),t.one(b.get.animationEndEvent(),function(){b.remove.active(),t.removeClass(j.hide)}).addClass(j.hide)):"fade"==g.animation.hide?(b.verbose("Hiding dimmer with javascript"),t.stop().fadeOut(.75*g.duration,function(){t.removeAttr("style"),b.remove.active()})):a.isFunction(g.animation.hide)&&a.proxy(g.animation.hide,t)()}},get:{animationEndEvent:function(){var a,b=c.createElement("element"),e={animation:"animationend",OAnimation:"oAnimationEnd",MozAnimation:"animationend",WebkitAnimation:"webkitAnimationEnd"};for(a in e)if(b.style[a]!==d)return e[a]}},has:{dimmer:function(){return f.children(h.dimmer).size()>0}},is:{animating:function(){return t.hasClass(j.show)||t.hasClass(j.hide)||t.is(":animated")},dimmer:function(){return f.is(h.dimmer)},pageDimmer:function(){return f.is(h.pageDimmer)},dimmable:function(){return f.is(h.dimmable)},enabled:function(){return!f.hasClass(j.disabled)},disabled:function(){return f.hasClass(j.disabled)},active:function(){return t.hasClass(j.active)}},can:{show:function(){return!t.hasClass(j.disabled)}},set:{active:function(){t.addClass(j.active)},dimmed:function(){f.addClass(j.dimmed)},disabled:function(){t.addClass(j.disabled)}},remove:{active:function(){t.removeClass(j.active)},dimmed:function(){f.removeClass(j.dimmed)},disabled:function(){t.removeClass(j.disabled)}},show:function(){b.debug("Showing dimmer",t),b.is.active()&&!b.is.animating()||!b.is.enabled()?b.debug("Dimmer is already shown or disabled"):(b.animate.show(),a.proxy(g.onShow,u)(),a.proxy(g.onChange,u)())},hide:function(){b.is.active()||b.is.animating()?(b.debug("Hiding dimmer",t),b.animate.hide(),a.proxy(g.onHide,u)(),a.proxy(g.onChange,u)()):b.debug("Dimmer is not visible")},toggle:function(){b.verbose("Toggling dimmer visibility",t),b.is.hidden()?b.show():b.hide()},setting:function(b,c){return c===d?g[b]:(a.isPlainObject(b)?a.extend(!0,g,b):g[b]=c,void 0)},internal:function(c,e){return e===d?b[c]:(a.isPlainObject(c)?a.extend(!0,b,c):b[c]=e,void 0)},debug:function(){g.debug&&(g.performance?b.performance.log(arguments):(b.debug=Function.prototype.bind.call(console.info,console,g.moduleName+":"),b.debug.apply(console,arguments)))},verbose:function(){g.verbose&&g.debug&&(g.performance?b.performance.log(arguments):(b.verbose=Function.prototype.bind.call(console.info,console,g.moduleName+":"),b.verbose.apply(console,arguments)))},error:function(){b.error=Function.prototype.bind.call(console.error,console,g.moduleName+":"),b.error.apply(console,arguments)},performance:{log:function(a){var c,d,e;g.performance&&(c=(new Date).getTime(),e=o||c,d=c-e,o=c,p.push({Element:u,Name:a[0],Arguments:[].slice.call(a,1)||"","Execution Time":d})),clearTimeout(b.performance.timer),b.performance.timer=setTimeout(b.performance.display,100)},display:function(){var c=g.moduleName+":",e=0;o=!1,clearTimeout(b.performance.timer),a.each(p,function(a,b){e+=b["Execution Time"]}),c+=" "+e+"ms",n&&(c+=" '"+n+"'"),(console.group!==d||console.table!==d)&&p.length>0&&(console.groupCollapsed(c),console.table?console.table(p):a.each(p,function(a,b){console.log(b.Name+": "+b["Execution Time"]+"ms")}),console.groupEnd()),p=[]}},invoke:function(c,e,f){var g,h;return e=e||s,f=u||f,"string"==typeof c&&v!==d&&(c=c.split(/[\. ]/),g=c.length-1,a.each(c,function(c,e){a.isPlainObject(v[e])&&c!=g?v=v[e]:v[e]!==d?h=v[e]:b.error(k.method)})),a.isFunction(h)?h.apply(f,e):h||!1}},r?(v===d&&b.initialize(),e=b.invoke(q)):(v!==d&&b.destroy(),b.initialize())}),e?e:this},a.fn.dimmer.settings={moduleName:"Dimmer",namespace:"dimmer",verbose:!0,debug:!0,performance:!0,animation:{show:"css",hide:"css"},on:!1,closable:!0,duration:500,onChange:function(){},onShow:function(){},onHide:function(){},error:{method:"The method you called is not defined."},selector:{dimmable:".ui.dimmable",dimmer:".ui.dimmer",content:".ui.dimmer > .content, .ui.dimmer > .content > .center"},template:{dimmer:function(){return a("<div />").attr("class","ui dimmer")}},className:{active:"active",animating:"animating",dimmable:"ui dimmable",dimmed:"dimmed",disabled:"disabled",hide:"hide",show:"show"}}}(jQuery,window,document),function(a,b,c,d){a.fn.dropdown=function(b){var e,f=a(this),g=a(c),h=a.isPlainObject(b)?a.extend(!0,{},a.fn.dropdown.settings,b):a.fn.dropdown.settings,i=h.className,j=h.metadata,k=h.namespace,l=h.selector,m=h.errors,n="."+k,o="module-"+k,p=f.selector||"",q=(new Date).getTime(),r=[],s=arguments[0],t="string"==typeof s,u=[].slice.call(arguments,1);return f.each(function(){var b,v=a(this),w=a(this).find(l.menu),x=a(this).find(l.item),y=a(this).find(l.text),z=a(this).find(l.input),A="ontouchstart"in c.documentElement,B=this,C=v.data(o);b={initialize:function(){b.debug("Initializing dropdown with bound events",v),A?v.on("touchstart"+n,b.event.test.toggle):"click"==h.on?v.on("click"+n,b.event.test.toggle):"hover"==h.on?v.on("mouseenter"+n,b.delay.show).on("mouseleave"+n,b.delay.hide):v.on(h.on+n,b.toggle),"form"==h.action&&b.set.selected(),x.on(b.get.selectEvent()+n,b.event.item.click),b.instantiate()},instantiate:function(){b.verbose("Storing instance of module",b),v.data(o,b)},destroy:function(){b.verbose("Destroying previous module for",v),v.off(k).removeData(o)},event:{stopPropagation:function(a){a.stopPropagation()},test:{toggle:function(a){b.intent.test(a,b.toggle),a.stopPropagation()},hide:function(a){b.intent.test(a,b.hide),a.stopPropagation()}},item:{click:function(c){var d=a(this),e=d.data(j.text)||d.text(),f=d.data(j.value)||e;b.verbose("Adding active state to selected item"),x.removeClass(i.active),d.addClass(i.active),b.action.determine(e,f),a.proxy(h.onChange,v.get())(f,e),c.stopPropagation()}},resetStyle:function(){a(this).removeAttr("style")}},intent:{test:function(c,d){b.debug("Determining whether event occurred in dropdown",c.target),d=d||function(){},0===a(c.target).closest(w).size()?(b.verbose("Triggering event",d),d()):b.verbose("Event occurred in dropdown, canceling callback")},bind:function(){b.verbose("Binding hide intent event to document"),g.on(b.get.selectEvent(),b.event.test.hide)},unbind:function(){b.verbose("Removing hide intent event from document"),g.off(b.get.selectEvent())}},action:{determine:function(c,d){a.isFunction(b.action[h.action])?(b.verbose("Triggering preset action",h.action),b.action[h.action](c,d)):a.isFunction(h.action)?(b.verbose("Triggering user action",h.action),h.action(c,d)):b.error(m.action)},none:function(){},hide:function(){b.hide()},changeText:function(a){b.set.text(a),b.hide()},form:function(a,c){b.set.text(a),b.set.value(c),b.hide()}},get:{selectEvent:function(){return A?"touchstart":"click"},text:function(){return y.text()},value:function(){return z.val()},item:function(b){var c;return b=b||z.val(),x.each(function(){a(this).data(j.value)==b&&(c=a(this))}),c||!1}},set:{text:function(a){b.debug("Changing text",a,y),y.removeClass(i.placeholder),y.text(a)},value:function(a){b.debug("Adding selected value to hidden input",a,z),z.val(a)},visible:function(){v.addClass(i.visible)},selected:function(a){var c,d=b.get.item(a);d&&(b.debug("Setting selected menu item to",d),c=d.data(j.text)||d.text(),x.removeClass(i.active),d.addClass(i.active),b.set.text(c))}},remove:{visible:function(){v.removeClass(i.visible)}},is:{visible:function(){return w.is(":visible")},hidden:function(){return w.is(":not(:visible)")}},can:{click:function(){return A||"click"==h.on},show:function(){return!v.hasClass(i.disabled)}},animate:{show:function(c){b.verbose("Doing menu showing animation"),c=c||function(){},"none"==h.animation?c():a.fn.transition!==d?w.transition(h.animation,h.duration,c):"slide down"==h.animation?w.hide().clearQueue().children().clearQueue().css("opacity",0).delay(50).animate({opacity:1},h.duration,"easeOutQuad",b.event.resetStyle).end().slideDown(100,"easeOutQuad",function(){a.proxy(b.event.resetStyle,this)(),c()}):"fade"==h.animation?w.hide().clearQueue().fadeIn(h.duration,function(){a.proxy(b.event.resetStyle,this)(),c()}):b.error(m.animation)},hide:function(c){b.verbose("Doing menu hiding animation"),c=c||function(){},"none"==h.animation?c():a.fn.transition!==d?w.transition(h.animation,h.duration,c):"slide down"==h.animation?w.show().clearQueue().children().clearQueue().css("opacity",1).animate({opacity:0},100,"easeOutQuad",b.event.resetStyle).end().delay(50).slideUp(100,"easeOutQuad",function(){a.proxy(b.event.resetStyle,this)(),c()}):"fade"==h.animation?w.show().clearQueue().fadeOut(150,function(){a.proxy(b.event.resetStyle,this)(),c()}):b.error(m.animation)}},show:function(){b.debug("Checking if dropdown can show"),b.is.visible()||(b.hideOthers(),b.animate.show(b.set.visible),b.can.click()&&b.intent.bind(),a.proxy(h.onShow,B)())},hide:function(){b.is.hidden()||(b.debug("Hiding dropdown"),b.can.click()&&b.intent.unbind(),b.animate.hide(b.remove.visible),a.proxy(h.onHide,B)())},delay:{show:function(){b.verbose("Delaying show event to ensure user intent"),clearTimeout(b.graceTimer),b.graceTimer=setTimeout(b.show,h.delay.show)},hide:function(){b.verbose("Delaying hide event to ensure user intent"),clearTimeout(b.graceTimer),b.graceTimer=setTimeout(b.hide,h.delay.hide)}},hideOthers:function(){b.verbose("Finding other dropdowns to hide"),f.not(v).has(l.menu+":visible").dropdown("hide")},toggle:function(){b.verbose("Toggling menu visibility"),b.is.hidden()?b.show():b.hide()},setting:function(b,c){return c===d?h[b]:(a.isPlainObject(b)?a.extend(!0,h,b):h[b]=c,void 0)},internal:function(c,e){return e===d?b[c]:(a.isPlainObject(c)?a.extend(!0,b,c):b[c]=e,void 0)},debug:function(){h.debug&&(h.performance?b.performance.log(arguments):(b.debug=Function.prototype.bind.call(console.info,console,h.moduleName+":"),b.debug.apply(console,arguments)))},verbose:function(){h.verbose&&h.debug&&(h.performance?b.performance.log(arguments):(b.verbose=Function.prototype.bind.call(console.info,console,h.moduleName+":"),b.verbose.apply(console,arguments)))},error:function(){b.error=Function.prototype.bind.call(console.error,console,h.moduleName+":"),b.error.apply(console,arguments)},performance:{log:function(a){var c,d,e;h.performance&&(c=(new Date).getTime(),e=q||c,d=c-e,q=c,r.push({Element:B,Name:a[0],Arguments:[].slice.call(a,1)||"","Execution Time":d})),clearTimeout(b.performance.timer),b.performance.timer=setTimeout(b.performance.display,100)},display:function(){var c=h.moduleName+":",e=0;q=!1,clearTimeout(b.performance.timer),a.each(r,function(a,b){e+=b["Execution Time"]}),c+=" "+e+"ms",p&&(c+=" '"+p+"'"),(console.group!==d||console.table!==d)&&r.length>0&&(console.groupCollapsed(c),console.table?console.table(r):a.each(r,function(a,b){console.log(b.Name+": "+b["Execution Time"]+"ms")}),console.groupEnd()),r=[]}},invoke:function(c,e,f){var g,h;return e=e||u,f=B||f,"string"==typeof c&&C!==d&&(c=c.split(/[\. ]/),g=c.length-1,a.each(c,function(c,e){a.isPlainObject(C[e])&&c!=g?C=C[e]:C[e]!==d?h=C[e]:b.error(m.method)})),a.isFunction(h)?h.apply(f,e):h||!1}},t?(C===d&&b.initialize(),e=b.invoke(s)):(C!==d&&b.destroy(),b.initialize())}),e?e:this},a.fn.dropdown.settings={moduleName:"Dropdown",namespace:"dropdown",verbose:!0,debug:!0,performance:!0,on:"click",action:"hide",delay:{show:50,hide:300},animation:"slide down",duration:250,onChange:function(){},onShow:function(){},onHide:function(){},errors:{action:"You called a dropdown action that was not defined",method:"The method you called is not defined.",animation:"The requested animation was not found"},metadata:{text:"text",value:"value"},selector:{menu:".menu",item:".menu > .item",text:"> .text",input:'> input[type="hidden"]'},className:{active:"active",placeholder:"default",disabled:"disabled",visible:"visible"}}}(jQuery,window,document),function(a,b,c,d){a.dimScreen=function(b){var c="function"==typeof b?a.extend({},a.fn.modal.settings,{dim:b}):a.extend({},a.fn.modal.settings,b),d=a(c.context),e=d.children(c.selector.dimmer),f=e.size()>0,g=e.css("opacity");return f||(e=a("<div/>").attr("id","dimmer").html('<div class="content"></div>'),d.append(e)),g!=c.opacity&&(e.one("click",function(){c.unDim(),a.unDimScreen()}),0===c.duration?(e.css({visibility:"visible"}).find(".content").css({opacity:c.opacity,visibility:"visible"}),c.dim()):e.css({visibility:"visible"}).find(".content").css({opacity:0,visibility:"visible"}).fadeTo(c.duration,c.opacity,c.dim)),this},a.unDimScreen=function(b){var c="function"==typeof b?a.extend({},a.fn.modal.settings,{unDim:b}):a.extend({},a.fn.modal.settings,b),d=a(c.context),e=d.children(c.selector.dimmer),f=e.size()>0;return f&&(c.unDim(),0===c.duration?e.css({visibility:"hidden"}).remove():e.find(".content").fadeTo(c.duration,0,function(){e.remove()})),this},a.fn.modal=function(e){var f,g=a.extend(!0,{},a.fn.modal.settings,e),h=arguments[0],i=[].slice.call(arguments,1);return a(this).each(function(){var e,j=a(this),k=j.find(g.selector.closeButton),l=(a(g.context).find(g.selector.dimmer),a(g.context).children(g.selector.modal)),m=l.not(j),n=j.data("module-"+g.namespace),o="string"==typeof h,p=(g.className,g.namespace);e={initialize:function(){j.on("modalShow."+p,e.show).on("modalHide."+p,e.hide).data("module-"+p,e)},show:function(){var e,f,h,i,l=j.outerHeight(),n=a(b).height(),o=l>n,q=o?"absolute":"fixed";j.removeClass("absolute fixed").addClass(q),e=o?"0":"50%",f=o?n/8:-((l-g.closeSpacing)/2),h="absolute"==j.css("position")?f+a(b).prop("pageYOffset"):f,i=h+g.animationOffset,a.fn.popIn!==d?j.css({display:"block",opacity:0,top:e,marginTop:h+"px"}).popIn():j.css({display:"block",opacity:0,top:e,marginTop:i+"px"}).animate({opacity:1,marginTop:h+"px"},g.duration+300,g.easing),m.is(":visible")&&m.filter(":visible").hide(),a.dimScreen({context:g.context,duration:0,dim:function(){a(c).on("keyup."+p,function(a){var b=a.which,c=27;switch(b){case c:j.modal("hide"),a.preventDefault()}}),k.one("click",function(){j.modal("hide")}),g.dim()},unDim:function(){j.modal("hide"),k.unbind("click")}})},hide:function(){a(c).off("keyup."+p),a.unDimScreen({duration:0,unDim:function(){j.popOut(200),g.unDim()}})},setting:function(a,b){return b===d?g[a]:(g[a]=b,void 0)},debug:function(){var a=[],b=g.moduleName+": "+arguments[0],c=[].slice.call(arguments,1),d=console.info||console.log||function(){};g.debug&&(a.push(b),d.apply(console,a.concat(c)))},error:function(){var a=[],b=g.moduleName+": "+arguments[0],c=[].slice.call(arguments,1),d=console.warn||console.log||function(){};g.debug&&(a.push(b),a.concat(c),d.apply(console,a.concat(c)))},invoke:function(b,c,f){var h,i;return f=f||[].slice.call(arguments,2),"string"==typeof b&&n!==d&&(b=b.split(/[\. ]/),h=b.length-1,a.each(b,function(b,c){return a.isPlainObject(n[c])&&b!=h?(n=n[c],!0):n[c]!==d?(i=n[c],!0):(e.error(g.errors.method),!1)})),a.isFunction(i)?i.apply(c,f):i}},o?f=e.invoke(h,this,i):e.initialize()}),f?f:this},a.fn.modal.settings={moduleName:"Modal",debug:!1,namespace:"modal",errors:{method:"The method you called is not defined"},dim:function(){},unDim:function(){},hide:function(){},show:function(){},context:"body",opacity:.8,closeSpacing:25,animationOffset:15,duration:400,easing:"easeOutExpo",selector:{dimmer:"#dimmer",modal:".modal",closeButton:".close"}}}(jQuery,window,document),function(a,b,c,d){a.fn.nag=function(c){var e,f=a(this),g=a.extend(!0,{},a.fn.nag.settings,c),h=g.className,i=g.selector,j=g.errors,k=g.namespace,l="."+k,m=k+"-module",n=f.selector||"",o=(new Date).getTime(),p=[],q=arguments[0],r="string"==typeof q,s=[].slice.call(arguments,1);return a(this).each(function(){var c,f,k,t,u,v,w,x,y,z=a(this),A=z.find(i.close),B=a(g.context),C=this,D=z.data(m),E=b.requestAnimationFrame||b.mozRequestAnimationFrame||b.webkitRequestAnimationFrame||b.msRequestAnimationFrame||function(a){setTimeout(a,0)};y={initialize:function(){y.verbose("Initializing element"),c=z.offset(),f=z.outerHeight(),k=B.outerWidth(),t=B.outerHeight(),u=B.offset(),z.data(m,y),A.on("click"+l,y.dismiss),g.context==b&&"fixed"==g.position&&z.addClass(h.fixed),g.sticky&&(y.verbose("Adding scroll events"),"absolute"==g.position?B.on("scroll"+l,y.event.scroll).on("resize"+l,y.event.scroll):a(b).on("scroll"+l,y.event.scroll).on("resize"+l,y.event.scroll),a.proxy(y.event.scroll,this)()),g.displayTime>0&&setTimeout(y.hide,g.displayTime),y.should.show()?z.is(":visible")||y.show():y.hide()},destroy:function(){y.verbose("Destroying instance"),z.removeData(m).off(l),g.sticky&&B.off(l)},refresh:function(){y.debug("Refreshing cached calculations"),c=z.offset(),f=z.outerHeight(),k=B.outerWidth(),t=B.outerHeight(),u=B.offset()},show:function(){y.debug("Showing nag",g.animation.show),"fade"==g.animation.show?z.fadeIn(g.duration,g.easing):z.slideDown(g.duration,g.easing)},hide:function(){y.debug("Showing nag",g.animation.hide),"fade"==g.animation.show?z.fadeIn(g.duration,g.easing):z.slideUp(g.duration,g.easing)},onHide:function(){y.debug("Removing nag",g.animation.hide),z.remove(),g.onHide&&g.onHide()},stick:function(){if(y.refresh(),"fixed"==g.position){var c=a(b).prop("pageYOffset")||a(b).scrollTop(),d=z.hasClass(h.bottom)?u.top+(t-f)-c:u.top-c;z.css({position:"fixed",top:d,left:u.left,width:k-g.scrollBarWidth})}else z.css({top:w})},unStick:function(){z.css({top:""})},dismiss:function(a){g.storageMethod&&y.storage.set(g.storedKey,g.storedValue),y.hide(),a.stopImmediatePropagation(),a.preventDefault()},should:{show:function(){return g.persist?(y.debug("Persistent nag is set, can show nag"),!0):y.storage.get(g.storedKey)!=g.storedValue?(y.debug("Stored value is not set, can show nag",y.storage.get(g.storedKey)),!0):(y.debug("Stored value is set, cannot show nag",y.storage.get(g.storedKey)),!1)},stick:function(){return v=B.prop("pageYOffset")||B.scrollTop(),w=z.hasClass(h.bottom)?t-z.outerHeight()+v:v,w>c.top?!0:"fixed"==g.position?!0:!1}},storage:{set:function(c,e){y.debug("Setting stored value",c,e,g.storageMethod),"local"==g.storageMethod&&b.store!==d?b.store.set(c,e):a.cookie!==d?a.cookie(c,e):y.error(j.noStorage)},get:function(c){return y.debug("Getting stored value",c,g.storageMethod),"local"==g.storageMethod&&b.store!==d?b.store.get(c):a.cookie!==d?a.cookie(c):(y.error(j.noStorage),void 0)}},event:{scroll:function(){x!==d&&clearTimeout(x),x=setTimeout(function(){y.should.stick()?E(y.stick):y.unStick()},g.lag)}},setting:function(b,c){return y.debug("Changing setting",b,c),c===d?g[b]:(a.isPlainObject(b)?a.extend(!0,g,b):g[b]=c,void 0)},internal:function(b,c){return y.debug("Changing internal",b,c),c===d?y[b]:(a.isPlainObject(b)?a.extend(!0,y,b):y[b]=c,void 0)},debug:function(){g.debug&&(g.performance?y.performance.log(arguments):(y.debug=Function.prototype.bind.call(console.info,console,g.moduleName+":"),y.debug.apply(console,arguments)))},verbose:function(){g.verbose&&g.debug&&(g.performance?y.performance.log(arguments):(y.verbose=Function.prototype.bind.call(console.info,console,g.moduleName+":"),y.verbose.apply(console,arguments)))},error:function(){y.error=Function.prototype.bind.call(console.error,console,g.moduleName+":"),y.error.apply(console,arguments)},performance:{log:function(a){var b,c,d;g.performance&&(b=(new Date).getTime(),d=o||b,c=b-d,o=b,p.push({Element:C,Name:a[0],Arguments:[].slice.call(a,1)||"","Execution Time":c})),clearTimeout(y.performance.timer),y.performance.timer=setTimeout(y.performance.display,100)
|
|
},display:function(){var b=g.moduleName+":",c=0;o=!1,clearTimeout(y.performance.timer),a.each(p,function(a,b){c+=b["Execution Time"]}),b+=" "+c+"ms",n&&(b+=" '"+n+"'"),(console.group!==d||console.table!==d)&&p.length>0&&(console.groupCollapsed(b),console.table?console.table(p):a.each(p,function(a,b){console.log(b.Name+": "+b["Execution Time"]+"ms")}),console.groupEnd()),p=[]}},invoke:function(b,c,e){var f,g;return c=c||s,e=C||e,"string"==typeof b&&D!==d&&(b=b.split(/[\. ]/),f=b.length-1,a.each(b,function(b,c){return a.isPlainObject(D[c])&&b!=f?(D=D[c],!0):D[c]!==d?(g=D[c],!0):(y.error(j.method),!1)})),a.isFunction(g)?g.apply(e,c):g||!1}},r?(D===d&&y.initialize(),e=y.invoke(q)):(D!==d&&y.destroy(),y.initialize())}),e?e:this},a.fn.nag.settings={moduleName:"Nag",verbose:!0,debug:!0,performance:!0,namespace:"Nag",persist:!1,displayTime:0,animation:{show:"slide",hide:"slide"},position:"fixed",scrollBarWidth:18,storageMethod:"cookie",storedKey:"nag",storedValue:"dismiss",sticky:!1,lag:0,context:b,error:{noStorage:"Neither $.cookie or store is defined. A storage solution is required for storing state",method:"The method you called is not defined."},className:{bottom:"bottom",fixed:"fixed"},selector:{close:".icon.close"},speed:500,easing:"easeOutQuad",onHide:function(){}}}(jQuery,window,document),function(a,b,c,d){a.fn.popup=function(e){var f,g=a(this),h=a.isPlainObject(e)?a.extend(!0,{},a.fn.popup.settings,e):a.fn.popup.settings,i=g.selector||"",j=(new Date).getTime(),k=[],l=arguments[0],m="string"==typeof l,n=[].slice.call(arguments,1);return g.each(function(){var e,g=a(this),o=a(b),p=g.offsetParent(),q=h.inline?g.next(h.selector.popup):o.children(h.selector.popup).last(),r=0,s="."+h.namespace,t=h.namespace+"-module",u=h.selector,v=h.className,w=h.error,x=h.metadata,y=h.namespace,z=this,A=g.data(t);e={initialize:function(){e.debug("Initializing module",g),"hover"==h.on?g.on("mouseenter"+s,e.event.mouseenter).on("mouseleave"+s,e.event.mouseleave):g.on(h.on+""+s,e.event[h.on]),o.on("resize"+s,e.event.resize),e.instantiate()},instantiate:function(){e.verbose("Storing instance of module",e),A=e,g.data(t,A)},refresh:function(){q=h.inline?g.next(u.popup):o.children(u.popup).last(),p=g.offsetParent()},destroy:function(){e.debug("Destroying previous module"),g.off(s).removeData(t)},event:{mouseenter:function(b){var c=this;e.timer=setTimeout(function(){a.proxy(e.toggle,c)(),a(c).hasClass(v.visible)&&b.stopPropagation()},h.delay)},mouseleave:function(){clearTimeout(e.timer),g.is(":visible")&&e.hide()},click:function(b){a.proxy(e.toggle,this)(),a(this).hasClass(v.visible)&&b.stopPropagation()},resize:function(){q.is(":visible")&&e.position()}},create:function(){e.debug("Creating pop-up html");var b=g.data(x.html)||h.html,c=g.data(x.variation)||h.variation,d=g.data(x.title)||h.title,f=g.data(x.content)||g.attr("title")||h.content;b||f||d?(b||(b=h.template({title:d,content:f})),q=a("<div/>").addClass(v.popup).addClass(c).html(b),h.inline?(e.verbose("Inserting popup element inline"),q.insertAfter(g)):(e.verbose("Appending popup element to body"),q.appendTo(a("body"))),a.proxy(h.onInit,q)()):e.error(w.content)},remove:function(){e.debug("Removing popup"),q.remove()},get:{offstagePosition:function(){var c={top:a(b).scrollTop(),bottom:a(b).scrollTop()+a(b).height(),left:0,right:a(b).width()},d={width:q.width(),height:q.outerHeight(),position:q.offset()},e={},f=[];return d.position&&(e={top:d.position.top<c.top,bottom:d.position.top+d.height>c.bottom,right:d.position.left+d.width>c.right,left:d.position.left<c.left}),a.each(e,function(a,b){b&&f.push(a)}),f.length>0?f.join(" "):!1},nextPosition:function(a){switch(a){case"top left":a="bottom left";break;case"bottom left":a="top right";break;case"top right":a="bottom right";break;case"bottom right":a="top center";break;case"top center":a="bottom center";break;case"bottom center":a="right center";break;case"right center":a="left center";break;case"left center":a="top center"}return a}},toggle:function(){g=a(this),e.debug("Toggling pop-up"),e.refresh(),g.hasClass(v.visible)?e.hide():(e.hideAll(),e.show())},position:function(c,d){var f,i,j=(a(b).width(),a(b).height(),g.outerWidth()),k=g.outerHeight(),l=q.width(),m=q.outerHeight(),n=h.inline?g.position():g.offset(),s=h.inline?p.outerWidth():o.outerWidth(),t=h.inline?p.outerHeight():o.outerHeight();switch(c=c||g.data(x.position)||h.position,d=d||g.data(x.arrowOffset)||h.arrowOffset,e.debug("Calculating offset for position",c),c){case"top left":f={top:"auto",bottom:t-n.top+h.distanceAway,left:n.left+d};break;case"top center":f={bottom:t-n.top+h.distanceAway,left:n.left+j/2-l/2+d,top:"auto",right:"auto"};break;case"top right":f={bottom:t-n.top+h.distanceAway,right:s-n.left-j-d,top:"auto",left:"auto"};break;case"left center":f={top:n.top+k/2-m/2,right:s-n.left+h.distanceAway-d,left:"auto",bottom:"auto"};break;case"right center":f={top:n.top+k/2-m/2,left:n.left+j+h.distanceAway+d,bottom:"auto",right:"auto"};break;case"bottom left":f={top:n.top+k+h.distanceAway,left:n.left+d,bottom:"auto",right:"auto"};break;case"bottom center":f={top:n.top+k+h.distanceAway,left:n.left+j/2-l/2+d,bottom:"auto",right:"auto"};break;case"bottom right":f={top:n.top+k+h.distanceAway,right:s-n.left-j-d,left:"auto",bottom:"auto"}}return a.extend(f,{width:q.width()+1}),q.removeAttr("style").removeClass("top right bottom left center").css(f).addClass(c).addClass(v.loading),i=e.get.offstagePosition(),i?(e.debug("Element is outside boundaries ",i),r<h.maxSearchDepth?(c=e.get.nextPosition(c),r++,e.debug("Trying new position: ",c),e.position(c)):(e.error(w.recursion),r=0,!1)):(e.debug("Position is on stage",c),r=0,!0)},show:function(){e.debug("Showing pop-up",h.transition),0===q.size()&&e.create(),e.position(),g.addClass(v.visible),q.removeClass(v.loading),h.transition&&a.fn.transition!==d?q.transition(h.transition,h.duration):q.stop().fadeIn(h.duration,h.easing),"click"==h.on&&h.clicktoClose&&(e.debug("Binding popup close event"),a(c).on("click."+y,e.gracefully.hide)),a.proxy(h.onShow,q)()},hideAll:function(){a(u.popup).filter(":visible").popup("hide")},hide:function(){g.removeClass(v.visible),q.is(":visible")&&(e.debug("Hiding pop-up"),h.transition&&a.fn.transition!==d?q.transition(h.transition,h.duration):q.stop().fadeOut(h.duration,h.easing)),"click"==h.on&&h.clicktoClose&&a(c).off("click."+y),a.proxy(h.onHide,q)(),h.inline||e.remove()},gracefully:{hide:function(b){0===a(b.target).closest(u.popup).size()&&e.hide()}},setting:function(b,c){return c===d?h[b]:(a.isPlainObject(b)?a.extend(!0,h,b):h[b]=c,void 0)},internal:function(b,c){return c===d?e[b]:(a.isPlainObject(b)?a.extend(!0,e,b):e[b]=c,void 0)},debug:function(){h.debug&&(h.performance?e.performance.log(arguments):(e.debug=Function.prototype.bind.call(console.info,console,h.moduleName+":"),e.debug.apply(console,arguments)))},verbose:function(){h.verbose&&h.debug&&(h.performance?e.performance.log(arguments):(e.verbose=Function.prototype.bind.call(console.info,console,h.moduleName+":"),e.verbose.apply(console,arguments)))},error:function(){e.error=Function.prototype.bind.call(console.error,console,h.moduleName+":"),e.error.apply(console,arguments)},performance:{log:function(a){var b,c,d;h.performance&&(b=(new Date).getTime(),d=j||b,c=b-d,j=b,k.push({Element:z,Name:a[0],Arguments:[].slice.call(a,1)||"","Execution Time":c})),clearTimeout(e.performance.timer),e.performance.timer=setTimeout(e.performance.display,100)},display:function(){var b=h.moduleName+":",c=0;j=!1,clearTimeout(e.performance.timer),a.each(k,function(a,b){c+=b["Execution Time"]}),b+=" "+c+"ms",i&&(b+=" '"+i+"'"),(console.group!==d||console.table!==d)&&k.length>0&&(console.groupCollapsed(b),console.table?console.table(k):a.each(k,function(a,b){console.log(b.Name+": "+b["Execution Time"]+"ms")}),console.groupEnd()),k=[]}},invoke:function(b,c,f){var g,h;return c=c||n,f=z||f,"string"==typeof b&&A!==d&&(b=b.split(/[\. ]/),g=b.length-1,a.each(b,function(b,c){a.isPlainObject(A[c])&&b!=g?A=A[c]:A[c]!==d?h=A[c]:e.error(w.method)})),a.isFunction(h)?h.apply(f,c):h||!1}},m?(A===d&&e.initialize(),f=e.invoke(l)):(A!==d&&e.destroy(),e.initialize())}),f?f:this},a.fn.popup.settings={moduleName:"Popup",debug:!0,verbose:!0,performance:!0,namespace:"popup",onInit:function(){},onShow:function(){},onHide:function(){},variation:"",content:!1,html:!1,title:!1,on:"hover",clicktoClose:!0,position:"top center",delay:150,inline:!0,duration:150,easing:"easeOutQuint",transition:"scale",distanceAway:0,arrowOffset:0,maxSearchDepth:10,error:{content:"Your popup has no content specified",method:"The method you called is not defined.",recursion:"Popup attempted to reposition element to fit, but could not find an adequate position."},metadata:{arrowOffset:"arrowOffset",content:"content",html:"html",position:"position",title:"title",variation:"variation"},className:{popup:"ui popup",visible:"visible",loading:"loading"},selector:{popup:".ui.popup"},template:function(a){var b="";return typeof a!==d&&(typeof a.title!==d&&a.title&&(b+='<div class="header">'+a.title+'</div class="header">'),typeof a.content!==d&&a.content&&(b+='<div class="content">'+a.content+"</div>")),b}}}(jQuery,window,document),function(a,b,c,d){a.fn.search=function(c,e){var f,g=a(this),h=a.extend(!0,{},a.fn.search.settings,e),i=h.className,j=h.selector,k=h.errors,l=h.namespace,m="."+l,n=l+"-module",o=g.selector||"",p=(new Date).getTime(),q=[],r=arguments[0],s="string"==typeof r,t=[].slice.call(arguments,1);return a(this).each(function(){var e,g=a(this),l=g.find(j.prompt),u=g.find(j.searchButton),v=g.find(j.results),w=(g.find(j.result),g.find(j.category),this),x=g.data(n);e={initialize:function(){e.verbose("Initializing module");var a=l[0],b=a.oninput!==d?"input":a.onpropertychange!==d?"propertychange":"keyup";l.on("focus"+m,e.event.focus).on("blur"+m,e.event.blur).on("keydown"+m,e.handleKeyboard),h.automatic&&l.on(b+m,e.search.throttle),u.on("click"+m,e.search.query),v.on("click"+m,j.result,e.results.select),e.instantiate()},instantiate:function(){e.verbose("Storing instance of module",e),x=e,g.data(n,e)},destroy:function(){e.verbose("Destroying instance"),g.removeData(n)},event:{focus:function(){g.addClass(i.focus),e.results.show()},blur:function(){e.search.cancel(),g.removeClass(i.focus),e.results.hide()}},handleKeyboard:function(b){var c,d=g.find(j.result),f=g.find(j.category),h=b.which,k={backspace:8,enter:13,escape:27,upArrow:38,downArrow:40},m=i.active,n=d.index(d.filter("."+m)),o=d.size();if(h==k.escape&&(e.verbose("Escape key pressed, blurring search field"),l.trigger("blur")),v.filter(":visible").size()>0)if(h==k.enter){if(e.verbose("Enter key pressed, selecting active result"),d.filter("."+m).exists())return a.proxy(e.results.select,d.filter("."+m))(),b.preventDefault(),!1}else h==k.upArrow?(e.verbose("Up key pressed, changing active result"),c=0>n-1?n:n-1,f.removeClass(m),d.removeClass(m).eq(c).addClass(m).closest(f).addClass(m),b.preventDefault()):h==k.downArrow&&(e.verbose("Down key pressed, changing active result"),c=n+1>=o?n:n+1,f.removeClass(m),d.removeClass(m).eq(c).addClass(m).closest(f).addClass(m),b.preventDefault());else h==k.enter&&(e.verbose("Enter key pressed, executing query"),e.search.query(),u.addClass(i.down),l.one("keyup",function(){u.removeClass(i.down)}))},search:{cancel:function(){var a=g.data("xhr")||!1;a&&"resolved"!=a.state()&&(e.debug("Cancelling last search"),a.abort())},throttle:function(){var a=l.val(),b=a.length;clearTimeout(e.timer),b>=h.minCharacters?e.timer=setTimeout(e.search.query,h.searchThrottle):e.results.hide()},query:function(){var b=l.val(),d=e.search.cache.read(b);d?(e.debug("Reading result for '"+b+"' from cache"),e.results.add(d)):(e.debug("Querying for '"+b+"'"),"object"==typeof c?e.search.local(b):e.search.remote(b),a.proxy(h.onSearchQuery,g)(b))},local:function(b){var d,f=[],j=[],k=a.isArray(h.searchFields)?h.searchFields:[h.searchFields],l=new RegExp("(?:s|^)"+b,"i"),m=new RegExp(b,"i");g.addClass(i.loading),a.each(k,function(b,d){a.each(c,function(b,c){"string"==typeof c[d]&&-1==a.inArray(c,f)&&-1==a.inArray(c,j)&&(l.test(c[d])?f.push(c):m.test(c[d])&&j.push(c))})}),d=e.results.generate({results:a.merge(f,j)}),g.removeClass(i.loading),e.search.cache.write(b,d),e.results.add(d)},remote:function(b){var d,f={stateContext:g,url:c,urlData:{query:b},success:function(a){d=e.results.generate(a),e.search.cache.write(b,d),e.results.add(d)},failure:e.error};e.search.cancel(),e.debug("Executing search"),a.extend(!0,f,h.apiSettings),a.api(f)},cache:{read:function(a){var b=g.data("cache");return h.cache&&"object"==typeof b&&b[a]!==d?b[a]:!1},write:function(a,b){var c=g.data("cache")!==d?g.data("cache"):{};c[a]=b,g.data("cache",c)}}},results:{generate:function(b){e.debug("Generating html from response",b);var c=h.templates[h.type],d="";return a.isPlainObject(b.results)&&!a.isEmptyObject(b.results)||a.isArray(b.results)&&b.results.length>0?(h.maxResults>0&&(b.results=a.makeArray(b.results).slice(0,h.maxResults)),b.results.length>0&&(a.isFunction(c)?d=c(b):e.error(k.noTemplate,!1))):d=e.message(k.noResults,"empty"),a.proxy(h.onResults,g)(b),d},add:function(b){("default"==h.onResultsAdd||"default"==a.proxy(h.onResultsAdd,v)(b))&&v.html(b),e.results.show()},show:function(){0===v.filter(":visible").size()&&l.filter(":focus").size()>0&&""!==v.html()&&(v.stop().fadeIn(200),a.proxy(h.onResultsOpen,v)())},hide:function(){v.filter(":visible").size()>0&&(v.stop().fadeOut(200),a.proxy(h.onResultsClose,v)())},select:function(c){e.debug("Search result selected");var d=a(this),f=d.find(".title"),g=f.html();if("default"==h.onSelect||"default"==a.proxy(h.onSelect,this)(c)){var i=d.find("a[href]").eq(0),j=i.attr("href")||!1,k=i.attr("target")||!1;e.results.hide(),l.val(g),j&&("_blank"==k||c.ctrlKey?b.open(j):b.location.href=j)}}},setting:function(b,c){return e.debug("Changing setting",b,c),c===d?h[b]:(a.isPlainObject(b)?a.extend(!0,h,b):h[b]=c,void 0)},internal:function(b,c){return e.debug("Changing internal",b,c),c===d?e[b]:(a.isPlainObject(b)?a.extend(!0,e,b):e[b]=c,void 0)},debug:function(){h.debug&&(h.performance?e.performance.log(arguments):(e.debug=Function.prototype.bind.call(console.info,console,h.moduleName+":"),e.debug.apply(console,arguments)))},verbose:function(){h.verbose&&h.debug&&(h.performance?e.performance.log(arguments):(e.verbose=Function.prototype.bind.call(console.info,console,h.moduleName+":"),e.verbose.apply(console,arguments)))},error:function(){e.error=Function.prototype.bind.call(console.error,console,h.moduleName+":"),e.error.apply(console,arguments)},performance:{log:function(a){var b,c,d;h.performance&&(b=(new Date).getTime(),d=p||b,c=b-d,p=b,q.push({Element:w,Name:a[0],Arguments:[].slice.call(a,1)||"","Execution Time":c})),clearTimeout(e.performance.timer),e.performance.timer=setTimeout(e.performance.display,100)},display:function(){var b=h.moduleName+":",c=0;p=!1,clearTimeout(e.performance.timer),a.each(q,function(a,b){c+=b["Execution Time"]}),b+=" "+c+"ms",o&&(b+=" '"+o+"'"),(console.group!==d||console.table!==d)&&q.length>0&&(console.groupCollapsed(b),console.table?console.table(q):a.each(q,function(a,b){console.log(b.Name+": "+b["Execution Time"]+"ms")}),console.groupEnd()),q=[]}},invoke:function(b,c,f){var g,h;return c=c||t,f=w||f,"string"==typeof b&&x!==d&&(b=b.split(/[\. ]/),g=b.length-1,a.each(b,function(b,c){return a.isPlainObject(x[c])&&b!=g?(x=x[c],!0):x[c]!==d?(h=x[c],!0):(e.error(k.method),!1)})),a.isFunction(h)?h.apply(f,c):h||!1}},s?(x===d&&e.initialize(),f=e.invoke(r)):(x!==d&&e.destroy(),e.initialize())}),f?f:this},a.fn.search.settings={moduleName:"Search Module",namespace:"search",debug:!0,verbose:!0,performance:!0,onSelect:"default",onResultsAdd:"default",onSearchQuery:function(){},onResults:function(){},onResultsOpen:function(){},onResultsClose:function(){},automatic:"true",type:"simple",minCharacters:3,searchThrottle:300,maxResults:7,cache:!0,searchFields:["title","description"],apiSettings:{},className:{active:"active",down:"down",focus:"focus",empty:"empty",loading:"loading"},errors:{noResults:"Your search returned no results",logging:"Error in debug logging, exiting.",noTemplate:"A valid template name was not specified.",serverError:"There was an issue with querying the server.",method:"The method you called is not defined."},selector:{prompt:".prompt",searchButton:".search.button",results:".results",category:".category",result:".result"},templates:{message:function(a,b){var c="";return a!==d&&b!==d&&(c+='<div class="message '+b+'">',c+="empty"==b?'<div class="header">No Results</div class="header"><div class="description">'+a+'</div class="description">':' <div class="description">'+a+"</div>",c+="</div>"),c},categories:function(b){var c="";return b.results!==d?(a.each(b.results,function(b,e){e.results!==d&&e.results.length>0&&(c+='<div class="category"><div class="name">'+e.name+"</div>",a.each(e.results,function(a,b){c+='<div class="result">',c+='<a href="'+b.url+'"></a>',b.image!==d&&(c+='<div class="image"> <img src="'+b.image+'">'+"</div>"),c+='<div class="info">',b.price!==d&&(c+='<div class="price">'+b.price+"</div>"),b.title!==d&&(c+='<div class="title">'+b.title+"</div>"),b.description!==d&&(c+='<div class="description">'+b.description+"</div>"),c+="</div></div>"}),c+="</div>")}),b.resultPage&&(c+='<a href="'+b.resultPage.url+'" class="all">'+b.resultPage.text+"</a>"),c):!1},simple:function(b){var c="";return b.results!==d?(a.each(b.results,function(a,b){c+='<a class="result" href="'+b.url+'">',b.image!==d&&(c+='<div class="image"> <img src="'+b.image+'">'+"</div>"),c+='<div class="info">',b.price!==d&&(c+='<div class="price">'+b.price+"</div>"),b.title!==d&&(c+='<div class="title">'+b.title+"</div>"),b.description!==d&&(c+='<div class="description">'+b.description+"</div>"),c+="</div></a>"}),b.resultPage&&(c+='<a href="'+b.resultPage.url+'" class="all">'+b.resultPage.text+"</a>"),c):!1}}}}(jQuery,window,document),function(a,b,c,d){a.fn.shape=function(b){var e,f=a(this),g=f.selector||"",h=a.extend(!0,{},a.fn.shape.settings,b),i=h.namespace,j=h.selector,k=h.error,l=h.className,m="."+i,n="module-"+i,o=(new Date).getTime(),p=[],q=arguments[0],r="string"==typeof q,s=[].slice.call(arguments,1);return f.each(function(){var b,f,i,t=a(this),u=t.find(j.sides),v=t.find(j.side),w=this,x=t.data(n);i={initialize:function(){i.verbose("Initializing module for",w),i.set.defaultSide()},instantiate:function(){i.verbose("Storing instance of module",i),x=i,t.data(n,x)},destroy:function(){i.verbose("Destroying previous module for",w),t.removeData(n).off(m)},refresh:function(){i.verbose("Refreshing selector cache for",w),t=a(w),u=a(this).find(j.shape),v=a(this).find(j.side)},repaint:function(){i.verbose("Forcing repaint event");var a=u.get(0)||c.createElement("div");a.offsetWidth},animate:function(a,c){i.verbose("Animating box with properties",a),c=c||function(a){i.verbose("Executing animation callback"),a!==d&&a.stopPropagation(),i.reset(),i.set.active()},h.useCSS?i.get.transitionEvent()?(i.verbose("Starting CSS animation"),t.addClass(l.animating),i.set.stageSize(),i.repaint(),t.addClass(l.css),b.addClass(l.hidden),u.css(a).one(i.get.transitionEvent(),c)):c():(i.verbose("Starting javascript animation"),t.addClass(l.animating).removeClass(l.css),i.set.stageSize(),i.repaint(),b.animate({opacity:0},h.duration,h.easing),u.animate(a,h.duration,h.easing,c))},queue:function(a){i.debug("Queueing animation of",a),u.one(i.get.transitionEvent(),function(){i.debug("Executing queued animation"),setTimeout(function(){t.shape(a)},0)})},reset:function(){i.verbose("Animating states reset"),t.removeClass(l.css).removeClass(l.animating).attr("style","").removeAttr("style"),u.attr("style","").removeAttr("style"),v.attr("style","").removeAttr("style").removeClass(l.hidden),f.removeClass(l.animating).attr("style","").removeAttr("style")},is:{animating:function(){return t.hasClass(l.animating)}},get:{transform:{up:function(){var a={y:-((b.outerHeight()-f.outerHeight())/2),z:-(b.outerHeight()/2)};return{transform:"translateY("+a.y+"px) translateZ("+a.z+"px) rotateX(-90deg)"}},down:function(){var a={y:-((b.outerHeight()-f.outerHeight())/2),z:-(b.outerHeight()/2)};return{transform:"translateY("+a.y+"px) translateZ("+a.z+"px) rotateX(90deg)"}},left:function(){var a={x:-((b.outerWidth()-f.outerWidth())/2),z:-(b.outerWidth()/2)};return{transform:"translateX("+a.x+"px) translateZ("+a.z+"px) rotateY(90deg)"}},right:function(){var a={x:-((b.outerWidth()-f.outerWidth())/2),z:-(b.outerWidth()/2)};return{transform:"translateX("+a.x+"px) translateZ("+a.z+"px) rotateY(-90deg)"}},over:function(){var a={x:-((b.outerWidth()-f.outerWidth())/2)};return{transform:"translateX("+a.x+"px) rotateY(180deg)"}},back:function(){var a={x:-((b.outerWidth()-f.outerWidth())/2)};return{transform:"translateX("+a.x+"px) rotateY(-180deg)"}}},transitionEvent:function(){var a,b=c.createElement("element"),e={transition:"transitionend",OTransition:"oTransitionEnd",MozTransition:"transitionend",WebkitTransition:"webkitTransitionEnd"};for(a in e)if(b.style[a]!==d)return e[a]},nextSide:function(){return b.next(j.side).size()>0?b.next(j.side):t.find(j.side).first()}},set:{defaultSide:function(){b=t.find("."+h.className.active),f=b.next(j.side).size()>0?b.next(j.side):t.find(j.side).first(),i.verbose("Active side set to",b),i.verbose("Next side set to",f)},stageSize:function(){var a={width:f.outerWidth(),height:f.outerHeight()};i.verbose("Resizing stage to fit new content",a),t.css({width:a.width,height:a.height})},nextSide:function(a){f=t.find(a),0===f.size()&&i.error(k.side),i.verbose("Next side manually set to",f)},active:function(){i.verbose("Setting new side to active",f),v.removeClass(l.active),f.addClass(l.active),a.proxy(h.onChange,f)(),i.set.defaultSide()}},flip:{up:function(){i.debug("Flipping up",f),i.is.animating()?i.queue("flip up"):(i.stage.above(),i.animate(i.get.transform.up()))},down:function(){i.debug("Flipping down",f),i.is.animating()?i.queue("flip down"):(i.stage.below(),i.animate(i.get.transform.down()))},left:function(){i.debug("Flipping left",f),i.is.animating()?i.queue("flip left"):(i.stage.left(),i.animate(i.get.transform.left()))},right:function(){i.debug("Flipping right",f),i.is.animating()?i.queue("flip right"):(i.stage.right(),i.animate(i.get.transform.right()))},over:function(){i.debug("Flipping over",f),i.is.animating()?i.queue("flip over"):(i.stage.behind(),i.animate(i.get.transform.over()))},back:function(){i.debug("Flipping back",f),i.is.animating()?i.queue("flip back"):(i.stage.behind(),i.animate(i.get.transform.back()))}},stage:{above:function(){var a={origin:(b.outerHeight()-f.outerHeight())/2,depth:{active:f.outerHeight()/2,next:b.outerHeight()/2}};i.verbose("Setting the initial animation position as above",f,a),b.css({transform:"rotateY(0deg) translateZ("+a.depth.active+"px)"}),f.addClass(l.animating).css({display:"block",top:a.origin+"px",transform:"rotateX(90deg) translateZ("+a.depth.next+"px)"})},below:function(){var a={origin:(b.outerHeight()-f.outerHeight())/2,depth:{active:f.outerHeight()/2,next:b.outerHeight()/2}};i.verbose("Setting the initial animation position as below",f,a),b.css({transform:"rotateY(0deg) translateZ("+a.depth.active+"px)"}),f.addClass(l.animating).css({display:"block",top:a.origin+"px",transform:"rotateX(-90deg) translateZ("+a.depth.next+"px)"})},left:function(){var a={origin:(b.outerWidth()-f.outerWidth())/2,depth:{active:f.outerWidth()/2,next:b.outerWidth()/2}};i.verbose("Setting the initial animation position as left",f,a),b.css({transform:"rotateY(0deg) translateZ("+a.depth.active+"px)"}),f.addClass(l.animating).css({display:"block",left:a.origin+"px",transform:"rotateY(-90deg) translateZ("+a.depth.next+"px)"})},right:function(){var a={origin:(b.outerWidth()-f.outerWidth())/2,depth:{active:f.outerWidth()/2,next:b.outerWidth()/2}};i.verbose("Setting the initial animation position as left",f,a),b.css({transform:"rotateY(0deg) translateZ("+a.depth.active+"px)"}),f.addClass(l.animating).css({display:"block",left:a.origin+"px",transform:"rotateY(90deg) translateZ("+a.depth.next+"px)"})},behind:function(){var a={origin:(b.outerWidth()-f.outerWidth())/2,depth:{active:f.outerWidth()/2,next:b.outerWidth()/2}};i.verbose("Setting the initial animation position as behind",f,a),b.css({transform:"rotateY(0deg)"}),f.addClass(l.animating).css({display:"block",left:a.origin+"px",transform:"rotateY(-180deg)"})}},setting:function(b,c){return c===d?h[b]:(a.isPlainObject(b)?a.extend(!0,h,b):h[b]=c,void 0)},internal:function(b,c){return c===d?i[b]:(a.isPlainObject(b)?a.extend(!0,i,b):i[b]=c,void 0)},debug:function(){h.debug&&(h.performance?i.performance.log(arguments):(i.debug=Function.prototype.bind.call(console.info,console,h.moduleName+":"),i.debug.apply(console,arguments)))},verbose:function(){h.verbose&&h.debug&&(h.performance?i.performance.log(arguments):(i.verbose=Function.prototype.bind.call(console.info,console,h.moduleName+":"),i.verbose.apply(console,arguments)))},error:function(){i.error=Function.prototype.bind.call(console.error,console,h.moduleName+":"),i.error.apply(console,arguments)},performance:{log:function(a){var b,c,d;h.performance&&(b=(new Date).getTime(),d=o||b,c=b-d,o=b,p.push({Element:w,Name:a[0],Arguments:[].slice.call(a,1)||"","Execution Time":c})),clearTimeout(i.performance.timer),i.performance.timer=setTimeout(i.performance.display,100)},display:function(){var b=h.moduleName+":",c=0;o=!1,clearTimeout(i.performance.timer),a.each(p,function(a,b){c+=b["Execution Time"]}),b+=" "+c+"ms",g&&(b+=" '"+g+"'"),(console.group!==d||console.table!==d)&&p.length>0&&(console.groupCollapsed(b),console.table?console.table(p):a.each(p,function(a,b){console.log(b.Name+": "+b["Execution Time"]+"ms")}),console.groupEnd()),p=[]}},invoke:function(b,c,e){var f,g,h=x;return c=c||s,e=w||e,"string"==typeof b&&h!==d&&(b=b.split(/[\. ]/),f=b.length-1,a.each(b,function(b,c){return a.isPlainObject(h[c])&&b!=f?(h=h[c],!0):h[c]!==d?(g=h[c],!0):(i.error(k.method),!1)})),a.isFunction(g)?g.apply(e,c):g||!1}},r?(x===d&&i.initialize(),e=i.invoke(q)):(x!==d&&i.destroy(),i.initialize())}),e?e:this},a.fn.shape.settings={moduleName:"Shape Module",debug:!0,verbose:!0,performance:!0,namespace:"shape",beforeChange:function(){},onChange:function(){},useCSS:!0,duration:1e3,easing:"easeInOutQuad",error:{side:"You tried to switch to a side that does not exist.",method:"The method you called is not defined"},className:{css:"css",animating:"animating",hidden:"hidden",active:"active"},selector:{sides:".sides",side:".side"}}}(jQuery,window,document),function(a,b,c,d){a.fn.starReview=function(b){var c,e=a(this),f=e.selector||"",g=a.extend(!0,{},a.fn.starReview.settings,b),h=g.namespace,i=g.className,j=g.selector,k=g.error,l="."+h,m="module-"+h,n=(new Date).getTime(),o=[],p=arguments[0],q="string"==typeof p,r=[].slice.call(arguments,1);return e.each(function(){var b,e=a(this),h=e.find(j.star),s=this,t=e.data(m);b={initialize:function(){g.rateable&&(a.fn.state!==d&&(e.state(),h.state()),h.bind("mouseenter"+l,b.event.mouseenter).bind("mouseleave"+l,b.event.mouseleave).bind("click"+l,b.event.click)),e.addClass(i.initialize),b.instantiate()},instantiate:function(){e.data(m,b)},setRating:function(b){var c=h.eq(b-1);e.removeClass(i.hover),h.removeClass(i.hover),c.nextAll().removeClass(i.active),c.addClass(i.active).prevAll().addClass(i.active),a.proxy(g.onRate,e)()},event:{mouseenter:function(){var b=a(this);b.nextAll().removeClass(i.hover),e.addClass(i.hover),b.addClass(i.hover).prevAll().addClass(i.hover)},mouseleave:function(){h.removeClass(i.hover)},click:function(){var c=a(this);b.setRating(h.index(c)+1)}},setting:function(b,c){return c===d?g[b]:(a.isPlainObject(b)?a.extend(!0,g,b):g[b]=c,void 0)},internal:function(c,e){return e===d?b[c]:(a.isPlainObject(c)?a.extend(!0,b,c):b[c]=e,void 0)},debug:function(){g.debug&&(g.performance?b.performance.log(arguments):(b.debug=Function.prototype.bind.call(console.info,console,g.moduleName+":"),b.debug.apply(console,arguments)))},verbose:function(){g.verbose&&g.debug&&(g.performance?b.performance.log(arguments):(b.verbose=Function.prototype.bind.call(console.info,console,g.moduleName+":"),b.verbose.apply(console,arguments)))},error:function(){b.error=Function.prototype.bind.call(console.error,console,g.moduleName+":"),b.error.apply(console,arguments)},performance:{log:function(a){var c,d,e;g.performance&&(c=(new Date).getTime(),e=n||c,d=c-e,n=c,o.push({Element:s,Name:a[0],Arguments:[].slice.call(a,1)||"","Execution Time":d})),clearTimeout(b.performance.timer),b.performance.timer=setTimeout(b.performance.display,100)},display:function(){var c=g.moduleName+":",e=0;n=!1,clearTimeout(b.performance.timer),a.each(o,function(a,b){e+=b["Execution Time"]}),c+=" "+e+"ms",f&&(c+=" '"+f+"'"),(console.group!==d||console.table!==d)&&o.length>0&&(console.groupCollapsed(c),console.table?console.table(o):a.each(o,function(a,b){console.log(b.Name+": "+b["Execution Time"]+"ms")}),console.groupEnd()),o=[]}},invoke:function(c,e,f){var g,h,i=t;return e=e||r,f=s||f,"string"==typeof c&&i!==d&&(c=c.split(/[\. ]/),g=c.length-1,a.each(c,function(c,e){return a.isPlainObject(i[e])&&c!=g?(i=i[e],!0):i[e]!==d?(h=i[e],!0):(b.error(k.method),!1)})),a.isFunction(h)?h.apply(f,e):h||!1}},q?(t===d&&b.initialize(),c=b.invoke(p)):(t!==d&&b.destroy(),b.initialize())}),c?c:this},a.fn.starReview.settings={moduleName:"Star",namespace:"star",rateable:!0,onRate:function(){},error:{method:"The method you called is not defined"},className:{initialize:"initialize",loading:"loading",active:"active",hover:"hover",down:"down"},selector:{star:"i"}}}(jQuery,window,document),function(a,b,c,d){a.fn.tab=function(c){var e,f,g,h,i,j=a.extend(!0,{},a.fn.tab.settings,c),k=a(this),l=a(j.context).find(j.selector.tabs),m=k.selector||"",n={},o=!0,p=0,q=this,r=(new Date).getTime(),s=[],t=j.className,u=j.metadata,v=j.error,w="."+j.namespace,x=j.namespace+"-module",y=k.data(x),z=arguments[0],A=y!==d&&"string"==typeof z,B=[].slice.call(arguments,1);return h={initialize:function(){if(h.debug("Initializing Tabs",k),j.history){if(a.address===d)return h.error(v.state),!1;if(j.path===!1)return h.error(v.path),!1;j.auto&&(j.apiSettings={url:j.path+"/{$tab}"}),h.verbose("Address library found adding state change event"),a.address.state(j.path).unbind("change").bind("change",h.event.history.change)}a.isWindow(q)||k.on("click"+w,h.event.click),h.instantiate()},instantiate:function(){h.verbose("Storing instance of module",h),k.data(x,h)},destroy:function(){h.debug("Destroying tabs",k),k.off(w)},event:{click:function(){h.debug("Navigation clicked");var b=a(this).data(u.tab);b!==d?j.history?a.address.value(b):h.change(b):h.debug("No tab specified")},history:{change:function(b){var c=b.pathNames.join("/")||h.get.initialPath(),e=j.templates.determineTitle(c)||!1;h.debug("History change event",c,b),g=b,c!==d&&h.change(c),e&&a.address.title(e)}}},refresh:function(){e&&(h.debug("Refreshing tab",e),h.change(e))},cache:{read:function(a){return a!==d?n[a]:!1},add:function(a,b){a=a||e,h.debug("Adding cached content for",a),n[a]=b},remove:function(a){a=a||e,h.debug("Removing cached content for",a),delete n[a]}},change:function(c){var d=b.history&&b.history.pushState,i=d&&j.ignoreFirstLoad&&o,k=j.auto||a.isPlainObject(j.apiSettings),l=k&&!i?h.utils.pathToArray(c):h.get.defaultPathArray(c),c=h.utils.arrayToPath(l);h.deactivate.all(),a.each(l,function(b,d){var m,n,p,q=l.slice(0,b+1),r=h.utils.arrayToPath(q),s=h.is.tab(r),t=b+1==l.length,u=h.get.tabElement(r);return h.verbose("Looking for tab",d),s?(h.verbose("Tab was found",d),e=r,f=h.utils.filterArray(l,q),t?p=!0:(m=l.slice(0,b+2),n=h.utils.arrayToPath(m),p=!h.is.tab(n),p&&h.verbose("Tab parameters found",m)),p&&k?(i?(h.debug("Ignoring remote content on first tab load",r),o=!1,h.cache.add(c,u.html()),h.activate.all(r),a.proxy(j.onTabInit,u)(r,f,g),a.proxy(j.onTabLoad,u)(r,f,g)):(h.activate.navigation(r),h.content.fetch(r,c)),!1):(h.debug("Opened local tab",r),h.activate.all(r),a.proxy(j.onTabLoad,u)(r,f,g),void 0)):(h.error(v.missingTab,d),!1)
|
|
})},content:{fetch:function(b,c){var i=h.get.tabElement(b),c=c||b,k=h.cache.read(c),l={dataType:"html",stateContext:i,success:function(d){h.cache.add(c,d),h.content.update(b,d),b==e?(h.debug("Content loaded",b),h.activate.tab(b)):h.debug("Content loaded in background",b),a.proxy(j.onTabInit,i)(b,f,g),a.proxy(j.onTabLoad,i)(b,f,g)},urlData:{tab:c}},m=i.data(u.promise)||!1,n=m&&"pending"===m.state();j.cache&&k?(h.debug("Showing existing content",c),h.content.update(b,k),h.activate.tab(b),a.proxy(j.onTabLoad,i)(b,f,g)):n?(h.debug("Content is already loading",c),i.addClass(t.loading)):a.api!==d?(h.debug("Retrieving remote content",c),a.api(a.extend(!0,{headers:{"X-Remote":!0}},j.apiSettings,l))):h.error(v.api)},update:function(a,b){h.debug("Updating html for",a);var c=h.get.tabElement(a);c.html(b)}},activate:{all:function(a){h.activate.tab(a),h.activate.navigation(a)},tab:function(a){var b=h.get.tabElement(a);h.verbose("Showing tab content for",b),b.addClass(t.active)},navigation:function(a){var b=h.get.navElement(a);h.verbose("Activating tab navigation for",b,a),b.addClass(t.active)}},deactivate:{all:function(){h.deactivate.navigation(),h.deactivate.tabs()},navigation:function(){k.removeClass(t.active)},tabs:function(){l.removeClass(t.active+" "+t.loading)}},is:{tab:function(a){return a!==d?h.get.tabElement(a).size()>0:!1}},get:{initialPath:function(){return k.eq(0).data(u.tab)||l.eq(0).data(u.tab)},path:function(){return a.address.value()},defaultPathArray:function(a){return h.utils.pathToArray(h.get.defaultPath(a))},defaultPath:function(a){var b=k.filter("[data-"+u.tab+'^="'+a+'/"]').eq(0),c=b.data(u.tab)||!1;if(c){if(h.debug("Found default tab",c),p<j.maxDepth)return p++,h.get.defaultPath(c);h.error(v.recursion)}else h.debug("No default tabs found for",a);return p=0,a},navElement:function(a){return a=a||e,k.filter("[data-"+u.tab+'="'+a+'"]')},tabElement:function(a){var b,c,d,f;return a=a||e,d=h.utils.pathToArray(a),f=h.utils.last(d),b=l.filter("[data-"+u.tab+'="'+f+'"]'),c=l.filter("[data-"+u.tab+'="'+a+'"]'),b.size()>0?b:c},tab:function(){return e}},utils:{filterArray:function(b,c){return a.grep(b,function(b){return-1==a.inArray(b,c)})},last:function(b){return a.isArray(b)?b[b.length-1]:!1},pathToArray:function(a){return a===d&&(a=e),"string"==typeof a?a.split("/"):[a]},arrayToPath:function(b){return a.isArray(b)?b.join("/"):!1}},setting:function(b,c){return c===d?j[b]:(a.isPlainObject(b)?a.extend(!0,j,b):j[b]=c,void 0)},internal:function(b,c){return c===d?h[b]:(a.isPlainObject(b)?a.extend(!0,h,b):h[b]=c,void 0)},debug:function(){j.debug&&(j.performance?h.performance.log(arguments):(h.debug=Function.prototype.bind.call(console.info,console,j.moduleName+":"),h.debug.apply(console,arguments)))},verbose:function(){j.verbose&&j.debug&&(j.performance?h.performance.log(arguments):(h.verbose=Function.prototype.bind.call(console.info,console,j.moduleName+":"),h.verbose.apply(console,arguments)))},error:function(){h.error=Function.prototype.bind.call(console.error,console,j.moduleName+":"),h.error.apply(console,arguments)},performance:{log:function(a){var b,c,d;j.performance&&(b=(new Date).getTime(),d=r||b,c=b-d,r=b,s.push({Element:q,Name:a[0],Arguments:[].slice.call(a,1)||"","Execution Time":c})),clearTimeout(h.performance.timer),h.performance.timer=setTimeout(h.performance.display,100)},display:function(){var b=j.moduleName+":",c=0;r=!1,clearTimeout(h.performance.timer),a.each(s,function(a,b){c+=b["Execution Time"]}),b+=" "+c+"ms",m&&(b+=" '"+m+"'"),(console.group!==d||console.table!==d)&&s.length>0&&(console.groupCollapsed(b),console.table?console.table(s):a.each(s,function(a,b){console.log(b.Name+": "+b["Execution Time"]+"ms")}),console.groupEnd()),s=[]}},invoke:function(b,c,e){var f,g;return c=c||B,e=q||e,"string"==typeof b&&y!==d&&(b=b.split(/[\. ]/),f=b.length-1,a.each(b,function(b,c){a.isPlainObject(y[c])&&b!=f?y=y[c]:y[c]!==d?g=y[c]:h.error(v.method)})),a.isFunction(g)?(h.verbose("Executing invoked function",g),g.apply(e,c)):g||!1}},A?(y===d&&h.initialize(),i=h.invoke(z)):(y!==d&&h.destroy(),h.initialize()),i?i:this},a.tab=function(c){a(b).tab(c)},a.fn.tab.settings={moduleName:"Tab",verbose:!0,debug:!0,performance:!0,namespace:"tab",onTabInit:function(){},onTabLoad:function(){},templates:{determineTitle:function(){}},auto:!1,history:!1,path:!1,context:"body",maxDepth:25,ignoreFirstLoad:!0,alwaysRefresh:!1,cache:!0,apiSettings:!1,error:{api:"You attempted to load content without API module",noContent:"The tab you specified is missing a content url.",method:"The method you called is not defined",state:"The state library has not been initialized",missingTab:"Tab cannot be found",path:"History enabled, but no path was specified",recursion:"Max recursive depth reached"},metadata:{tab:"tab",loaded:"loaded",promise:"promise"},className:{loading:"loading",active:"active"},selector:{tabs:".tab"}}}(jQuery,window,document),function(a,b,c,d){a.fn.transition=function(){var e,f=a(this),g=f.selector||"",h=(new Date).getTime(),i=[],j=arguments,k=j[0],l=[].slice.call(arguments,1),m="string"==typeof k;return b.requestAnimationFrame||b.mozRequestAnimationFrame||b.webkitRequestAnimationFrame||b.msRequestAnimationFrame||function(a){setTimeout(a,0)},f.each(function(){var b,f,n,o,p,q,r,s,t,u,v=a(this),w=this;u={initialize:function(){b=u.get.settings.apply(w,j),u.verbose("Converted arguments into settings object",b),n=b.error,o=b.className,s=b.namespace,p=b.metadata,t="module-"+s,q=u.get.animationEvent(),r=u.get.animationName(),f=v.data(t),f===d&&u.instantiate(),m&&(e=u.invoke(k)),m&&e!==!1||u.animate()},instantiate:function(){u.verbose("Storing instance of module",u),f=u,v.data(t,f)},destroy:function(){u.verbose("Destroying previous module for",w),v.removeData(t)},animate:function(a){return b=a||b,u.is.animating()?(u.queue(b.animation),!1):(u.save.conditions(),u.set.duration(b.duration),u.set.animating(),u.repaint(),v.addClass(o.transition).addClass(b.animation).one(q,u.complete),!u.has.direction()&&u.can.transition()&&u.set.direction(),u.can.animate()?(u.show(),u.debug("Beginning animation",b.animation,v.attr("class")),void 0):(u.restore.conditions(),u.error(n.noAnimation),!1))},queue:function(a){u.debug("Queueing animation of",a),f.queuing=!0,v.one(q,function(){f.queuing=!1,u.animate.apply(this,b)})},complete:function(){u.verbose("CSS animation complete",b.animation),u.is.looping()||(v.hasClass(o.outward)&&!f.queuing?(u.restore.conditions(),u.hide()):v.hasClass(o.inward)&&!f.queuing?(u.restore.conditions(),u.show()):u.restore.conditions(),u.remove.animating()),b.complete()},repaint:function(a){u.verbose("Forcing repaint event"),a=w.offsetWidth},has:{direction:function(a){return a=a||b.animation,v.hasClass(o.inward)||v.hasClass(o.outward)?!0:void 0}},set:{animating:function(){v.addClass(o.animating)},direction:function(){v.is(":visible")?(u.debug("Automatically determining the direction of animation","Outward"),v.addClass(o.outward).removeClass(o.inward)):(u.debug("Automatically determining the direction of animation","Inward"),v.addClass(o.inward).removeClass(o.outward))},looping:function(){u.debug("Transition set to loop"),v.addClass(o.looping)},duration:function(a){a=a||b.duration,a="number"==typeof a?a+"ms":a,u.verbose("Setting animation duration",a),v.css({"-webkit-animation-duration":a,"-moz-animation-duration":a,"-ms-animation-duration":a,"-o-animation-duration":a,"animation-duration":a})}},save:{conditions:function(){u.cache={className:v.attr("class"),style:v.attr("style")},u.verbose("Saving original attributes",u.cache)}},restore:{conditions:function(){return typeof u.cache===d?(u.error(n.cache),!1):(u.cache.className?v.attr("class",u.cache.className):v.removeAttr("class"),u.cache.style?v.attr("style",u.cache.style):v.removeAttr("style"),u.is.looping()&&u.remove.looping(),u.verbose("Restoring original attributes",u.cache),void 0)}},remove:{animating:function(){v.removeClass(o.animating)},looping:function(){u.debug("Transitions are no longer looping"),v.removeClass(o.looping),u.repaint()}},get:{settings:function(b,c,d){return a.isPlainObject(b)?a.extend(!0,{},a.fn.transition.settings,b):"function"==typeof d?a.extend(!0,{},a.fn.transition.settings,{animation:b,complete:d,duration:c}):"string"==typeof c||"number"==typeof c?a.extend(!0,{},a.fn.transition.settings,{animation:b,duration:c}):"object"==typeof c?a.extend(!0,{},a.fn.transition.settings,c,{animation:b}):"function"==typeof c?a.extend(!0,{},a.fn.transition.settings,{animation:b,complete:c}):a.extend(!0,{},a.fn.transition.settings,{animation:b})},animationName:function(){var a,b=c.createElement("element"),e={animation:"animationName",OAnimation:"oAnimationName",MozAnimation:"mozAnimationName",WebkitAnimation:"webkitAnimationName"};for(a in e)if(b.style[a]!==d)return u.verbose("Determining animation vendor name property",e[a]),e[a];return!1},animationEvent:function(){var a,b=c.createElement("element"),e={animation:"animationend",OAnimation:"oAnimationEnd",MozAnimation:"mozAnimationEnd",WebkitAnimation:"webkitAnimationEnd"};for(a in e)if(b.style[a]!==d)return u.verbose("Determining animation vendor end event",e[a]),e[a];return!1}},can:{animate:function(){return"none"!==v.css(r)?(u.debug("CSS definition found"),!0):(u.debug("Unable to find css definition"),!1)},transition:function(){var a=v.css(r),b=v.addClass(o.inward).css(r);return a!=b?(u.debug("In/out transitions exist"),v.removeClass(o.inward),!0):(u.debug("Static animation found"),v.removeClass(o.inward),!1)}},is:{animating:function(){return v.hasClass(o.animating)},looping:function(){return v.hasClass(o.looping)},visible:function(){return v.is(":visible")}},hide:function(){u.verbose("Hiding element"),v.removeClass(o.visible).addClass(o.transition).addClass(o.hidden)},show:function(){u.verbose("Showing element"),v.removeClass(o.hidden).addClass(o.transition).addClass(o.visible)},start:function(){u.verbose("Starting animation"),v.removeClass(o.disabled)},stop:function(){u.debug("Stopping animation"),v.addClass(o.disabled)},toggle:function(){u.debug("Toggling play status"),v.toggleClass(o.disabled)},setting:function(c,e){return e===d?b[c]:(a.isPlainObject(c)?a.extend(!0,b,c):b[c]=e,void 0)},internal:function(b,c){return c===d?u[b]:(a.isPlainObject(b)?a.extend(!0,u,b):u[b]=c,void 0)},debug:function(){b.debug&&(b.performance?u.performance.log(arguments):(u.debug=Function.prototype.bind.call(console.info,console,b.moduleName+":"),u.debug.apply(console,arguments)))},verbose:function(){b.verbose&&b.debug&&(b.performance?u.performance.log(arguments):(u.verbose=Function.prototype.bind.call(console.info,console,b.moduleName+":"),u.verbose.apply(console,arguments)))},error:function(){u.error=Function.prototype.bind.call(console.error,console,b.moduleName+":"),u.error.apply(console,arguments)},performance:{log:function(a){var c,d,e;b.performance&&(c=(new Date).getTime(),e=h||c,d=c-e,h=c,i.push({Element:w,Name:a[0],Arguments:[].slice.call(a,1)||"","Execution Time":d})),clearTimeout(u.performance.timer),u.performance.timer=setTimeout(u.performance.display,100)},display:function(){var c=b.moduleName+":",e=0;h=!1,clearTimeout(u.performance.timer),a.each(i,function(a,b){e+=b["Execution Time"]}),c+=" "+e+"ms",g&&(c+=" '"+g+"'"),(console.group!==d||console.table!==d)&&i.length>0&&(console.groupCollapsed(c),console.table?console.table(i):a.each(i,function(a,b){console.log(b.Name+": "+b["Execution Time"]+"ms")}),console.groupEnd()),i=[]}},invoke:function(b,c,e){var g,h,i=f;return c=c||l,e=w||e,"string"==typeof b&&i!==d&&(b=b.split(/[\. ]/),g=b.length-1,a.each(b,function(b,c){return a.isPlainObject(i[c])&&b!=g?(i=i[c],!0):i[c]!==d?(h=i[c],!0):!1})),a.isFunction(h)?(f.verbose("Executing invoked function",h),h.apply(e,c)):h||!1}},u.initialize()}),e?e:this},a.fn.transition.settings={moduleName:"Transition",debug:!0,verbose:!0,performance:!0,namespace:"transition",complete:function(){},animation:"fade",duration:"700ms",className:{transition:"ui transition",animating:"animating",looping:"looping",disabled:"disabled",hidden:"hidden",visible:"visible",inward:"in",outward:"out"},error:{noAnimation:"There is no css animation matching the one you specified.",method:"The method you called is not defined"}}}(jQuery,window,document),function(a,b,c,d){a.fn.video=function(b){var c,e=a(this),f=a.isPlainObject(b)?a.extend(!0,{},a.fn.video.settings,b):a.fn.video.settings,g=e.selector||"",h=(new Date).getTime(),i=[],j=arguments[0],k="string"==typeof j,l=[].slice.call(arguments,1),m=f.selector,n=f.className,o=f.error,p=f.metadata,q=f.namespace,r="."+q,s=q+"-module";return e.each(function(){var b,e=a(this),q=e.find(m.placeholder),t=e.find(m.playButton),u=e.find(m.embed),v=this,w=e.data(s);b={initialize:function(){b.debug("Initializing video"),q.on("click"+r,b.play),t.on("click"+r,b.play),b.instantiate()},instantiate:function(){b.verbose("Storing instance of module",b),w=b,e.data(s,b)},destroy:function(){b.verbose("Destroying previous instance of video"),e.removeData(s).off(r)},change:function(a,c,d){b.debug("Changing video to ",a,c,d),e.data(p.source,a).data(p.id,c).data(p.url,d),f.onChange()},reset:function(){b.debug("Clearing video embed and showing placeholder"),e.removeClass(n.active),u.html(" "),q.show(),f.onReset()},play:function(){b.debug("Playing video");var a=e.data(p.source)||!1,c=e.data(p.url)||!1,d=e.data(p.id)||!1;u.html(b.generate.html(a,d,c)),e.addClass(n.active),f.onPlay()},generate:{html:function(a,c,d){b.debug("Generating embed html");var g,h="auto"==f.width?e.width():f.width,i="auto"==f.height?e.height():f.height;return a&&c?"vimeo"==a?g='<iframe src="http://player.vimeo.com/video/'+c+"?="+b.generate.url(a)+'"'+' width="'+h+'" height="'+i+'"'+' frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>':"youtube"==a&&(g='<iframe src="http://www.youtube.com/embed/'+c+"?="+b.generate.url(a)+'"'+' width="'+h+'" height="'+i+'"'+' frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>'):d?g='<iframe src="'+d+'"'+' width="'+h+'" height="'+i+'"'+' frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>':b.error(o.noVideo),g},url:function(a){var b=f.api?1:0,c=f.autoplay?1:0,d=f.hd?1:0,e=f.showUI?1:0,g=f.showUI?0:1,h="";return"vimeo"==a&&(h="api="+b+"&title="+e+"&byline="+e+"&portrait="+e+"&autoplay="+c,f.color&&(h+="&color="+f.color)),"ustream"==a?(h="autoplay="+c,f.color&&(h+="&color="+f.color)):"youtube"==a&&(h="enablejsapi="+b+"&autoplay="+c+"&autohide="+g+"&hq="+d+"&modestbranding=1",f.color&&(h+="&color="+f.color)),h}},setting:function(b,c){return c===d?f[b]:(a.isPlainObject(b)?a.extend(!0,f,b):f[b]=c,void 0)},internal:function(c,e){return e===d?b[c]:(a.isPlainObject(c)?a.extend(!0,b,c):b[c]=e,void 0)},debug:function(){f.debug&&(f.performance?b.performance.log(arguments):(b.debug=Function.prototype.bind.call(console.info,console,f.moduleName+":"),b.debug.apply(console,arguments)))},verbose:function(){f.verbose&&f.debug&&(f.performance?b.performance.log(arguments):(b.verbose=Function.prototype.bind.call(console.info,console,f.moduleName+":"),b.verbose.apply(console,arguments)))},error:function(){b.error=Function.prototype.bind.call(console.error,console,f.moduleName+":"),b.error.apply(console,arguments)},performance:{log:function(a){var c,d,e;f.performance&&(c=(new Date).getTime(),e=h||c,d=c-e,h=c,i.push({Element:v,Name:a[0],Arguments:[].slice.call(a,1)||"","Execution Time":d})),clearTimeout(b.performance.timer),b.performance.timer=setTimeout(b.performance.display,100)},display:function(){var c=f.moduleName+":",e=0;h=!1,clearTimeout(b.performance.timer),a.each(i,function(a,b){e+=b["Execution Time"]}),c+=" "+e+"ms",g&&(c+=" '"+g+"'"),(console.group!==d||console.table!==d)&&i.length>0&&(console.groupCollapsed(c),console.table?console.table(i):a.each(i,function(a,b){console.log(b.Name+": "+b["Execution Time"]+"ms")}),console.groupEnd()),i=[]}},invoke:function(c,e,f){var g,h;return e=e||l,f=v||f,"string"==typeof c&&w!==d&&(c=c.split(/[\. ]/),g=c.length-1,a.each(c,function(c,e){a.isPlainObject(w[e])&&c!=g?w=w[e]:w[e]!==d?h=w[e]:b.error(o.method)})),a.isFunction(h)?h.apply(f,e):h||!1}},k?(w===d&&b.initialize(),c=b.invoke(j)):(w!==d&&b.destroy(),b.initialize())}),c?c:this},a.fn.video.settings={moduleName:"Video",namespace:"video",debug:!0,verbose:!0,performance:!0,metadata:{source:"source",id:"id",url:"url"},onPlay:function(){},onReset:function(){},onChange:function(){},onPause:function(){},onStop:function(){},width:"auto",height:"auto",autoplay:!1,color:"#442359",hd:!0,showUI:!1,api:!0,error:{noVideo:"No video specified",method:"The method you called is not defined"},className:{active:"active"},selector:{embed:".embed",placeholder:".placeholder",playButton:".play"}}}(jQuery,window,document);
|