No Results
"+e+"
":'diff --git a/build/minified/modules/dropdown.js b/build/minified/modules/dropdown.js index b39a96b9b..ce5a41dfa 100644 --- a/build/minified/modules/dropdown.js +++ b/build/minified/modules/dropdown.js @@ -78,7 +78,9 @@ $.fn.dropdown = function(parameters) { .on(settings.on + eventNamespace, module.toggle) ; } - + if(settings.action == 'form') { + module.set.selected(); + } $item .on(module.get.selectEvent() + eventNamespace, module.event.item.click) ; @@ -116,8 +118,8 @@ $.fn.dropdown = function(parameters) { click: function () { var $choice = $(this), - name = $choice.data(metadata.name) || $choice.text(), - value = $choice.data(metadata.value) || name + text = $choice.data(metadata.text) || $choice.text(), + value = $choice.data(metadata.value) || text ; module.verbose('Adding active state to selected item'); $item @@ -126,8 +128,8 @@ $.fn.dropdown = function(parameters) { $choice .addClass(className.active) ; - module.action.determine(name, value); - $.proxy(settings.onChange, $menu.get())(name, value); + module.action.determine(text, value); + $.proxy(settings.onChange, $menu.get())(text, value); } } @@ -139,8 +141,8 @@ $.fn.dropdown = function(parameters) { test: function(event, callback) { module.debug('Determining whether event occurred in dropdown', event.target); callback = callback || function(){}; - if( $(event.target).closest($menu).size() == 0 ) { - module.verbose('Triggering event', callback) + if( $(event.target).closest($menu).size() === 0 ) { + module.verbose('Triggering event', callback); callback(); } else { @@ -166,14 +168,14 @@ $.fn.dropdown = function(parameters) { action: { - determine: function(name, value) { + determine: function(text, value) { if( $.isFunction( module.action[settings.action] ) ) { module.verbose('Triggering preset action', settings.action); - module.action[ settings.action ](name, value); + module.action[ settings.action ](text, value); } else if( $.isFunction(settings.action) ) { module.verbose('Triggering user action', settings.action); - settings.action(name, value); + settings.action(text, value); } else { module.error(errors.action); @@ -186,16 +188,14 @@ $.fn.dropdown = function(parameters) { module.hide(); }, - changeText: function(name, value) { - module.debug('Changing text', name); - $text.text(name); + changeText: function(text, value) { + module.set.text(text); module.hide(); }, - form: function(name, value) { - module.debug('Adding selected value to hidden input', name, value); - $text.text(name); - $input.val(value); + form: function(text, value) { + module.set.text(text); + module.set.value(value); module.hide(); } @@ -207,6 +207,52 @@ $.fn.dropdown = function(parameters) { ? 'touchstart' : 'click' ; + }, + text: function() { + return $text.text(); + }, + value: function() { + return $input.val(); + }, + item: function(value) { + var + $selectedItem + ; + value = value || $input.val(); + $item + .each(function() { + if( $(this).data(metadata.value) == value ) { + $selectedItem = $(this); + } + }) + ; + return $selectedItem; + } + }, + + set: { + text: function(text) { + module.debug('Changing text', text); + $text.text(text); + }, + value: function(value) { + module.debug('Adding selected value to hidden input', value); + $input.val(value); + }, + selected: function(value) { + var + selectedValue = value || $input.val(), + $selectedItem = module.get.item(value), + selectedText = $selectedItem.data(metadata.text) || $selectedItem.text() + ; + module.debug('Setting selected menu item to', $selectedItem); + $item + .removeClass(className.active) + ; + $selectedItem + .addClass(className.active) + ; + module.set.text(selectedText); } }, @@ -348,7 +394,7 @@ $.fn.dropdown = function(parameters) { debug: function() { if(settings.debug) { module.performance.log(arguments[0]); - module.debug = Function.prototype.bind.call(console.info, console, settings.moduleName + ':'); + module.debug = Function.prototype.bind.call(console.log, console, settings.moduleName + ':'); } }, verbose: function() { @@ -358,9 +404,7 @@ $.fn.dropdown = function(parameters) { } }, error: function() { - if(console.log !== undefined) { - module.error = Function.prototype.bind.call(console.log, console, settings.moduleName + ':'); - } + module.error = Function.prototype.bind.call(console.log, console, settings.moduleName + ':'); }, performance: { log: function(message) { @@ -491,7 +535,7 @@ $.fn.dropdown.settings = { }, metadata: { - name : 'name', + text : 'text', value : 'value' }, @@ -499,7 +543,7 @@ $.fn.dropdown.settings = { menu : '.menu', item : '.menu > .item', text : '> .text', - input : '> input[type="hidden"]', + input : '> input[type="hidden"]' }, className : { diff --git a/build/minified/modules/dropdown.min.js b/build/minified/modules/dropdown.min.js index 401f0b3bc..5e563d5d8 100644 --- a/build/minified/modules/dropdown.min.js +++ b/build/minified/modules/dropdown.min.js @@ -1 +1 @@ -(function(e,t,n,o){e.fn.dropdown=function(t){var i,a=e(this),s=e(n),r=e.extend(!0,{},e.fn.dropdown.settings,t),c="."+r.namespace,l="module-"+r.namespace,u=(a.selector||"",(new Date).getTime()),d=[],f=arguments[0],m="string"==typeof f,g=[].slice.call(arguments,1);return a.each(function(){var t,p=e(this),h=e(this).find(r.selector.menu),v=e(this).find(r.selector.item),b=e(this).find(r.selector.text),y=e(this).find(r.selector.input),x="ontouchstart"in n.documentElement,C=p.selector||"",w=this,T=p.data("module-"+r.namespace),k=r.className,N=r.metadata,z=r.namespace,P=r.animation,D=r.errors;t={initialize:function(){t.verbose("Initializing dropdown with bound events",p),x?p.on("touchstart"+c,t.event.test.toggle):"click"==r.on?p.on("click"+c,t.event.test.toggle):"hover"==r.on?p.on("mouseenter"+c,t.show).on("mouseleave"+c,t.delayedHide):p.on(r.on+c,t.toggle),v.on(t.get.selectEvent()+c,t.event.item.click),p.data(l,t)},destroy:function(){t.verbose("Destroying previous module for",p),p.off(z)},event:{stopPropagation:function(e){e.stopPropagation()},test:{toggle:function(e){t.intent.test(e,t.toggle),e.stopPropagation()},hide:function(e){t.intent.test(e,t.hide),e.stopPropagation()}},item:{click:function(){var n=e(this),o=n.data(N.name)||n.text(),i=n.data(N.value)||o;t.verbose("Adding active state to selected item"),v.removeClass(k.active),n.addClass(k.active),t.action.determine(o,i),e.proxy(r.onChange,h.get())(o,i)}}},intent:{test:function(n,o){t.debug("Determining whether event occurred in dropdown",n.target),o=o||function(){},0==e(n.target).closest(h).size()?(t.verbose("Triggering event",o),o()):t.verbose("Event occurred in dropdown, canceling callback")},bind:function(){t.verbose("Binding hide intent event to document"),s.on(t.get.selectEvent(),t.event.test.hide)},unbind:function(){t.verbose("Removing hide intent event from document"),s.off(t.get.selectEvent())}},action:{determine:function(n,o){e.isFunction(t.action[r.action])?(t.verbose("Triggering preset action",r.action),t.action[r.action](n,o)):e.isFunction(r.action)?(t.verbose("Triggering user action",r.action),r.action(n,o)):t.error(D.action)},nothing:function(){},hide:function(){t.hide()},changeText:function(e){t.debug("Changing text",e),b.text(e),t.hide()},form:function(e,n){t.debug("Adding selected value to hidden input",e,n),b.text(e),y.val(n),t.hide()}},get:{selectEvent:function(){return x?"touchstart":"click"}},is:{visible:function(){return h.is(":visible")},hidden:function(){return h.is(":not(:visible)")}},can:{click:function(){return x||"click"==r.on},show:function(){return!p.hasClass(k.disabled)}},animate:{show:function(){t.verbose("Doing menu showing animation"),"show"==P.show?h.show():"slide"==P.show&&h.clearQueue().children().clearQueue().css("opacity",0).delay(100).animate({opacity:1},300,"easeOutQuad").end().slideDown(200,"easeOutQuad")},hide:function(){t.verbose("Doing menu hiding animation"),"hide"==P.hide?h.hide():"slide"==P.hide&&h.clearQueue().children().clearQueue().css("opacity",1).animate({opacity:0},300,"easeOutQuad").end().delay(100).slideUp(200,"easeOutQuad")}},show:function(){clearTimeout(t.graceTimer),t.is.visible()||(t.debug("Showing dropdown"),p.addClass(k.visible),t.animate.show(),t.can.click()&&t.intent.bind(),e.proxy(r.onShow,h.get())())},delayedHide:function(){t.verbose("User moused away setting timer to hide dropdown"),t.graceTimer=setTimeout(t.hide,r.gracePeriod)},hide:function(){t.is.hidden()||(t.debug("Hiding dropdown"),p.removeClass(k.visible),t.can.click()&&t.intent.unbind(),t.animate.hide(),e.proxy(r.onHide,h.get())())},toggle:function(){t.verbose("Toggling menu visibility"),t.can.show()?t.show():t.hide()},setting:function(t,n){return n===o?r[t]:(e.isPlainObject(t)?e.extend(!0,r,t):r[t]=n,o)},internal:function(n,i){return i===o?t[n]:(e.isPlainObject(n)?e.extend(!0,t,n):t[n]=i,o)},debug:function(){r.debug&&(t.performance.log(arguments[0]),t.debug=Function.prototype.bind.call(console.info,console,r.moduleName+":"))},verbose:function(){r.verbose&&r.debug&&(t.performance.log(arguments[0]),t.verbose=Function.prototype.bind.call(console.info,console,r.moduleName+":"))},error:function(){console.log!==o&&(t.error=Function.prototype.bind.call(console.log,console,r.moduleName+":"))},performance:{log:function(e){var n,o,i;r.performance&&(n=(new Date).getTime(),i=u||n,o=n-i,u=n,d.push({Element:w,Name:e,"Execution Time":o}),clearTimeout(t.performance.timer),t.performance.timer=setTimeout(t.performance.display,100))},display:function(){var t=r.moduleName,n=(r.moduleName+": "+C+"("+a.size()+" elements)",0);C&&(t+="Performance ("+C+")"),(console.group!==o||console.table!==o)&&d.length>0&&(console.groupCollapsed(t),console.table?(e.each(d,function(e,t){n+=t["Execution Time"]}),console.table(d)):e.each(d,function(e,t){n+=t["Execution Time"]}),console.log("Total Execution Time:",n+"ms"),console.groupEnd(),d=[],u=!1)}},invoke:function(n,i,a){var s,r;return i=i||g,a=w||a,"string"==typeof n&&T!==o&&(n=n.split("."),s=n.length-1,e.each(n,function(n,i){return e.isPlainObject(T[i])&&n!=s?(T=T[i],!0):T[i]!==o?(r=T[i],!0):(t.error(D.method),!1)})),e.isFunction(r)?(t.verbose("Executing invoked function",r),r.apply(a,i)):r||!1}},m?(T===o&&t.initialize(),i=t.invoke(f)):(T!==o&&t.destroy(),t.initialize())}),i?i:this},e.fn.dropdown.settings={moduleName:"Dropdown Module",namespace:"dropdown",verbose:!0,debug:!0,performance:!1,on:"click",gracePeriod:300,action:"hide",animation:{show:"slide",hide:"slide"},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."},metadata:{name:"name",value:"value"},selector:{menu:".menu",item:".menu > .item",text:"> .text",input:'> input[type="hidden"]'},className:{active:"active",disabled:"disabled",visible:"visible"}}})(jQuery,window,document); \ No newline at end of file +(function(e,t,n,o){e.fn.dropdown=function(t){var i,a=e(this),s=e(n),r=e.extend(!0,{},e.fn.dropdown.settings,t),c="."+r.namespace,l="module-"+r.namespace,u=(a.selector||"",(new Date).getTime()),d=[],f=arguments[0],m="string"==typeof f,g=[].slice.call(arguments,1);return a.each(function(){var t,p=e(this),h=e(this).find(r.selector.menu),v=e(this).find(r.selector.item),b=e(this).find(r.selector.text),y=e(this).find(r.selector.input),x="ontouchstart"in n.documentElement,C=p.selector||"",w=this,T=p.data("module-"+r.namespace),k=r.className,N=r.metadata,z=r.namespace,P=r.animation,D=r.errors;t={initialize:function(){t.verbose("Initializing dropdown with bound events",p),x?p.on("touchstart"+c,t.event.test.toggle):"click"==r.on?p.on("click"+c,t.event.test.toggle):"hover"==r.on?p.on("mouseenter"+c,t.show).on("mouseleave"+c,t.delayedHide):p.on(r.on+c,t.toggle),"form"==r.action&&t.set.selected(),v.on(t.get.selectEvent()+c,t.event.item.click),p.data(l,t)},destroy:function(){t.verbose("Destroying previous module for",p),p.off(z)},event:{stopPropagation:function(e){e.stopPropagation()},test:{toggle:function(e){t.intent.test(e,t.toggle),e.stopPropagation()},hide:function(e){t.intent.test(e,t.hide),e.stopPropagation()}},item:{click:function(){var n=e(this),o=n.data(N.text)||n.text(),i=n.data(N.value)||o;t.verbose("Adding active state to selected item"),v.removeClass(k.active),n.addClass(k.active),t.action.determine(o,i),e.proxy(r.onChange,h.get())(o,i)}}},intent:{test:function(n,o){t.debug("Determining whether event occurred in dropdown",n.target),o=o||function(){},0===e(n.target).closest(h).size()?(t.verbose("Triggering event",o),o()):t.verbose("Event occurred in dropdown, canceling callback")},bind:function(){t.verbose("Binding hide intent event to document"),s.on(t.get.selectEvent(),t.event.test.hide)},unbind:function(){t.verbose("Removing hide intent event from document"),s.off(t.get.selectEvent())}},action:{determine:function(n,o){e.isFunction(t.action[r.action])?(t.verbose("Triggering preset action",r.action),t.action[r.action](n,o)):e.isFunction(r.action)?(t.verbose("Triggering user action",r.action),r.action(n,o)):t.error(D.action)},nothing:function(){},hide:function(){t.hide()},changeText:function(e){t.set.text(e),t.hide()},form:function(e,n){t.set.text(e),t.set.value(n),t.hide()}},get:{selectEvent:function(){return x?"touchstart":"click"},text:function(){return b.text()},value:function(){return y.val()},item:function(t){var n;return t=t||y.val(),v.each(function(){e(this).data(N.value)==t&&(n=e(this))}),n}},set:{text:function(e){t.debug("Changing text",e),b.text(e)},value:function(e){t.debug("Adding selected value to hidden input",e),y.val(e)},selected:function(e){var n=(e||y.val(),t.get.item(e)),o=n.data(N.text)||n.text();t.debug("Setting selected menu item to",n),v.removeClass(k.active),n.addClass(k.active),t.set.text(o)}},is:{visible:function(){return h.is(":visible")},hidden:function(){return h.is(":not(:visible)")}},can:{click:function(){return x||"click"==r.on},show:function(){return!p.hasClass(k.disabled)}},animate:{show:function(){t.verbose("Doing menu showing animation"),"show"==P.show?h.show():"slide"==P.show&&h.clearQueue().children().clearQueue().css("opacity",0).delay(100).animate({opacity:1},300,"easeOutQuad").end().slideDown(200,"easeOutQuad")},hide:function(){t.verbose("Doing menu hiding animation"),"hide"==P.hide?h.hide():"slide"==P.hide&&h.clearQueue().children().clearQueue().css("opacity",1).animate({opacity:0},300,"easeOutQuad").end().delay(100).slideUp(200,"easeOutQuad")}},show:function(){clearTimeout(t.graceTimer),t.is.visible()||(t.debug("Showing dropdown"),p.addClass(k.visible),t.animate.show(),t.can.click()&&t.intent.bind(),e.proxy(r.onShow,h.get())())},delayedHide:function(){t.verbose("User moused away setting timer to hide dropdown"),t.graceTimer=setTimeout(t.hide,r.gracePeriod)},hide:function(){t.is.hidden()||(t.debug("Hiding dropdown"),p.removeClass(k.visible),t.can.click()&&t.intent.unbind(),t.animate.hide(),e.proxy(r.onHide,h.get())())},toggle:function(){t.verbose("Toggling menu visibility"),t.can.show()?t.show():t.hide()},setting:function(t,n){return n===o?r[t]:(e.isPlainObject(t)?e.extend(!0,r,t):r[t]=n,o)},internal:function(n,i){return i===o?t[n]:(e.isPlainObject(n)?e.extend(!0,t,n):t[n]=i,o)},debug:function(){r.debug&&(t.performance.log(arguments[0]),t.debug=Function.prototype.bind.call(console.log,console,r.moduleName+":"))},verbose:function(){r.verbose&&r.debug&&(t.performance.log(arguments[0]),t.verbose=Function.prototype.bind.call(console.info,console,r.moduleName+":"))},error:function(){t.error=Function.prototype.bind.call(console.log,console,r.moduleName+":")},performance:{log:function(e){var n,o,i;r.performance&&(n=(new Date).getTime(),i=u||n,o=n-i,u=n,d.push({Element:w,Name:e,"Execution Time":o}),clearTimeout(t.performance.timer),t.performance.timer=setTimeout(t.performance.display,100))},display:function(){var t=r.moduleName,n=(r.moduleName+": "+C+"("+a.size()+" elements)",0);C&&(t+="Performance ("+C+")"),(console.group!==o||console.table!==o)&&d.length>0&&(console.groupCollapsed(t),console.table?(e.each(d,function(e,t){n+=t["Execution Time"]}),console.table(d)):e.each(d,function(e,t){n+=t["Execution Time"]}),console.log("Total Execution Time:",n+"ms"),console.groupEnd(),d=[],u=!1)}},invoke:function(n,i,a){var s,r;return i=i||g,a=w||a,"string"==typeof n&&T!==o&&(n=n.split("."),s=n.length-1,e.each(n,function(n,i){return e.isPlainObject(T[i])&&n!=s?(T=T[i],!0):T[i]!==o?(r=T[i],!0):(t.error(D.method),!1)})),e.isFunction(r)?(t.verbose("Executing invoked function",r),r.apply(a,i)):r||!1}},m?(T===o&&t.initialize(),i=t.invoke(f)):(T!==o&&t.destroy(),t.initialize())}),i?i:this},e.fn.dropdown.settings={moduleName:"Dropdown Module",namespace:"dropdown",verbose:!0,debug:!0,performance:!1,on:"click",gracePeriod:300,action:"hide",animation:{show:"slide",hide:"slide"},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."},metadata:{text:"text",value:"value"},selector:{menu:".menu",item:".menu > .item",text:"> .text",input:'> input[type="hidden"]'},className:{active:"active",disabled:"disabled",visible:"visible"}}})(jQuery,window,document); \ No newline at end of file diff --git a/build/packaged/modules/dropdown.js b/build/packaged/modules/dropdown.js index b39a96b9b..ce5a41dfa 100644 --- a/build/packaged/modules/dropdown.js +++ b/build/packaged/modules/dropdown.js @@ -78,7 +78,9 @@ $.fn.dropdown = function(parameters) { .on(settings.on + eventNamespace, module.toggle) ; } - + if(settings.action == 'form') { + module.set.selected(); + } $item .on(module.get.selectEvent() + eventNamespace, module.event.item.click) ; @@ -116,8 +118,8 @@ $.fn.dropdown = function(parameters) { click: function () { var $choice = $(this), - name = $choice.data(metadata.name) || $choice.text(), - value = $choice.data(metadata.value) || name + text = $choice.data(metadata.text) || $choice.text(), + value = $choice.data(metadata.value) || text ; module.verbose('Adding active state to selected item'); $item @@ -126,8 +128,8 @@ $.fn.dropdown = function(parameters) { $choice .addClass(className.active) ; - module.action.determine(name, value); - $.proxy(settings.onChange, $menu.get())(name, value); + module.action.determine(text, value); + $.proxy(settings.onChange, $menu.get())(text, value); } } @@ -139,8 +141,8 @@ $.fn.dropdown = function(parameters) { test: function(event, callback) { module.debug('Determining whether event occurred in dropdown', event.target); callback = callback || function(){}; - if( $(event.target).closest($menu).size() == 0 ) { - module.verbose('Triggering event', callback) + if( $(event.target).closest($menu).size() === 0 ) { + module.verbose('Triggering event', callback); callback(); } else { @@ -166,14 +168,14 @@ $.fn.dropdown = function(parameters) { action: { - determine: function(name, value) { + determine: function(text, value) { if( $.isFunction( module.action[settings.action] ) ) { module.verbose('Triggering preset action', settings.action); - module.action[ settings.action ](name, value); + module.action[ settings.action ](text, value); } else if( $.isFunction(settings.action) ) { module.verbose('Triggering user action', settings.action); - settings.action(name, value); + settings.action(text, value); } else { module.error(errors.action); @@ -186,16 +188,14 @@ $.fn.dropdown = function(parameters) { module.hide(); }, - changeText: function(name, value) { - module.debug('Changing text', name); - $text.text(name); + changeText: function(text, value) { + module.set.text(text); module.hide(); }, - form: function(name, value) { - module.debug('Adding selected value to hidden input', name, value); - $text.text(name); - $input.val(value); + form: function(text, value) { + module.set.text(text); + module.set.value(value); module.hide(); } @@ -207,6 +207,52 @@ $.fn.dropdown = function(parameters) { ? 'touchstart' : 'click' ; + }, + text: function() { + return $text.text(); + }, + value: function() { + return $input.val(); + }, + item: function(value) { + var + $selectedItem + ; + value = value || $input.val(); + $item + .each(function() { + if( $(this).data(metadata.value) == value ) { + $selectedItem = $(this); + } + }) + ; + return $selectedItem; + } + }, + + set: { + text: function(text) { + module.debug('Changing text', text); + $text.text(text); + }, + value: function(value) { + module.debug('Adding selected value to hidden input', value); + $input.val(value); + }, + selected: function(value) { + var + selectedValue = value || $input.val(), + $selectedItem = module.get.item(value), + selectedText = $selectedItem.data(metadata.text) || $selectedItem.text() + ; + module.debug('Setting selected menu item to', $selectedItem); + $item + .removeClass(className.active) + ; + $selectedItem + .addClass(className.active) + ; + module.set.text(selectedText); } }, @@ -348,7 +394,7 @@ $.fn.dropdown = function(parameters) { debug: function() { if(settings.debug) { module.performance.log(arguments[0]); - module.debug = Function.prototype.bind.call(console.info, console, settings.moduleName + ':'); + module.debug = Function.prototype.bind.call(console.log, console, settings.moduleName + ':'); } }, verbose: function() { @@ -358,9 +404,7 @@ $.fn.dropdown = function(parameters) { } }, error: function() { - if(console.log !== undefined) { - module.error = Function.prototype.bind.call(console.log, console, settings.moduleName + ':'); - } + module.error = Function.prototype.bind.call(console.log, console, settings.moduleName + ':'); }, performance: { log: function(message) { @@ -491,7 +535,7 @@ $.fn.dropdown.settings = { }, metadata: { - name : 'name', + text : 'text', value : 'value' }, @@ -499,7 +543,7 @@ $.fn.dropdown.settings = { menu : '.menu', item : '.menu > .item', text : '> .text', - input : '> input[type="hidden"]', + input : '> input[type="hidden"]' }, className : { diff --git a/build/packaged/semantic.min.js b/build/packaged/semantic.min.js index 0657a2437..2c4195be9 100644 --- a/build/packaged/semantic.min.js +++ b/build/packaged/semantic.min.js @@ -10,5 +10,5 @@ * Released: 05/28/2013 */ (function(e,t,n,o){e.fn.accordion=function(t){var n=e.extend(!0,{},e.fn.accordion.settings,t),i=arguments||!1;return e(this).each(function(){var t,a=e(this),s=a.find(n.selector.title),r=(a.find(n.selector.icon),a.find(n.selector.content)),l=a.data("module"),c=n.className;return t={initialize:function(){s.on("click",t.change),a.data("module",t)},change:function(){var o=e(this),i=(o.next(r),o.hasClass(c.active));i?n.collapsible&&e.proxy(t.close,o)():e.proxy(t.open,o)()},open:function(){var t=e(this),o=t.next(r),i=s.filter("."+c.active),a=i.next(s);n.exclusive&&i.size()>0&&(i.removeClass("active"),a.stop().slideUp(n.speed,n.easing,function(){e(this).removeClass("active").removeAttr("style")})),t.addClass(c.active),o.hide().addClass(c.active).stop().slideDown(n.speed,n.easing,function(){e(this).removeAttr("style")})},close:function(){var t=e(this),o=t.next(r);t.removeClass(c.active),o.removeClass(c.active).show().stop().slideUp(n.speed,n.easing,function(){e(this).removeAttr("style")})},debug:function(e){n.debug&&console.info(n.moduleName+": "+e)},error:function(e){console.warn(n.moduleName+": "+e)},invoke:function(i,a,s){var r;return s=s||Array.prototype.slice.call(arguments,2),"string"==typeof i&&l!==o&&(i=i.split("."),e.each(i,function(o,i){return e.isPlainObject(l[i])?(l=l[i],!0):e.isFunction(l[i])?(r=l[i],!0):(t.error(n.errors.method),!1)})),e.isFunction(r)?r.apply(a,s):r}},l!==o&&i?("invoke"==i[0]&&(i=Array.prototype.slice.call(i,1)),t.invoke(i[0],this,Array.prototype.slice.call(i,1))):(t.initialize(),o)}),this},e.fn.accordion.settings={moduleName:"Accordion",debug:!1,exclusive:!0,collapsible:!0,errors:{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(e,t,n,o){e.animationSettings=function(t,n,i,a){return t=n===o?t:"object"==typeof n?e.extend({},t,n):"function"==typeof i?e.extend({},t,{duration:n,complete:i}):"object"==typeof i?e.extend(!0,{},t,{duration:n},i):e.extend({},t,{duration:n,easing:i,complete:a})},e.fn.popIn=function(t,n,o){var i=e.animationSettings(e.fn.popIn.settings,t,n,o),a=e(this),s=a.size(),r=0,l=function(){0==a.filter(":animated").size(),r++,e(this).css("transform","").removeClass(i.className.init),e.proxy(i.eachComplete,this)(),r==s&&e.proxy(i.complete,a)()},c=function(t){e(this).delay(i.delay*t).animate({opacity:i.endOpacity,transform:"scale("+i.endScale+")"},i.duration,i.easing,l)};return i.isLegacyBrowser?a.show():a.addClass(i.className.init).show().css({opacity:i.startOpacity,transform:"scale("+i.startScale+")"}).each(c),e(this)},e.fn.popOut=function(t,n,o){var i=e.animationSettings(e.fn.popIn.settings,t,n,o),a={complete:function(){e(this).hide(),e.proxy(i.complete,this)()},startOpacity:i.endOpacity,endOpacity:0,startScale:i.endScale,endScale:i.startScale},s=e.extend(!0,{},i,a);e(this).popIn(s)},e.fn.popIn.settings={isLegacyBrowser:!1,className:{init:"init"},duration:450,easing:"easeOutExpo",delay:100,startOpacity:0,endOpacity:1,startScale:.7,endScale:1,eachComplete:function(){},complete:function(){}},e.fn.kenBurns=function(t,n,i){var a=e.animationSettings(e.fn.kenBurns.settings,t,n,i),s={randomPosition:function(e,t,n){var n=n!==o?n:t,i=Math.random()*(e+n-(e-t))+(e-t);return parseInt(i,10)},animate:function(){var t={},n={};t=a.useStartPosition?{x:parseInt(e(this).css("background-position-x"),10),y:parseInt(e(this).css("background-position-y"),10)}:{x:s.randomPosition(50,a.xRange),y:s.randomPosition(50,a.yRange)},n.x=t.x>50?s.randomPosition(t.x,a.xMaxTravelDistance,-a.xMinTravelDistance):s.randomPosition(t.x,-a.xMinTravelDistance,a.xMaxTravelDistance),n.y=t.y>50?s.randomPosition(t.y,a.yMaxTravelDistance,-a.yMinTravelDistance):s.randomPosition(t.y,-a.yMinTravelDistance,a.yMaxTravelDistance),e(this).css({backgroundPosition:t.x+"%",backgroundPositionY:t.y+"%"}).stop().animate({backgroundPosition:n.x+"%",backgroundPositionY:n.y+"%"},a.duration,a.easing,a.complete)}};return a.isLegacyBrowser||e(this).each(s.animate),e(this)},e.fn.kenBurns.settings={isLegacyBrowser:!1,duration:1e4,easing:"linear",useStartPosition:!1,xRange:40,yRange:20,xMinTravelDistance:30,xMaxTravelDistance:60,yMinTravelDistance:20,yMaxTravelDistance:40,scale:.1,complete:function(){}}}(jQuery,window,document),function(e,t,n,o){e.api=e.fn.api=function(n){var i,a=e.extend(!0,{},e.api.settings,n),s="function"!=typeof this?this:e("
"),r=a.stateContext?e(a.stateContext):e(s),l="object"==typeof this?e(s):r,c=l.data(a.metadata.action)||a.action||!1,u=a.className,d=a.metadata,f=a.errors;return i={initialize:function(){var s,f,p,m,g,h,v,b=!1,y=(new Date).getTime(),x={},w={},C=a.errors;return a.serializeForm&&e(this).toJSON()!==o&&(x=l.closest("form").toJSON(),e.extend(!0,a.data,x),i.debug("Adding form data to API Request",x)),s=e.proxy(a.beforeSend,l)(a),s===o||s?(c&&(i.debug("Initializing API Request for: ",c),a.api[c]!==o?m=a.api[c]:i.error(C.missingAction)),a.url&&(m=a.url,i.debug("Using specified url: ",m)),m||(i.error(C.missingURL),i.reset()),g=m.match(a.regExpTemplate),g&&(i.debug("Looking for URL variables",g),e.each(g,function(t,s){var r=s.substr(2,s.length-3),c=e.isPlainObject(n.urlData)&&n.urlData[r]!==o?n.urlData[r]:l.data(r)!==o?l.data(r):a.urlData[r];i.verbose("Looking for variable",r,l,l.data(r),a.urlData[r]),c===!1?(i.debug("Removing variable from URL",g),m=m.replace("/"+s,"")):c!==o&&c?m=m.replace(s,c):(i.error(C.missingParameter+r),b=!0)})),b?(i.reset(),o):(p=e.Deferred().always(function(){a.stateContext&&r.removeClass(u.loading),e.proxy(a.complete,l)()}).done(function(t){i.debug("API request successful"),"json"==a.dataType?t.success===!0?e.proxy(a.success,r)(t,a,l):(i.debug("JSON success flag is not set."),t.error!==o?e.proxy(a.failure,r)(t.error,a,l):e.isArray(t.errors)?e.proxy(a.failure,r)(t.errors[0],a,l):t.message!==o?e.proxy(a.failure,r)(t.message,a,l):e.proxy(a.failure,r)(C.error,a,l)):e.proxy(a.success,r)(t,a,l)}).fail(function(t,n,s){var l,c=a.errors[n]!==o?a.errors[n]:s;if(t!==o)if(t.readyState!==o&&4==t.readyState){if(200!=t.status&&s!==o&&""!==s)i.error(C.statusMessage+s);else if("error"==n&&"json"==a.dataType)try{l=e.parseJSON(t.responseText),l&&l.error!==o&&(c=l.error)}catch(d){i.error(C.JSONParse)}r.removeClass(u.loading).addClass(u.error),a.errorLength>0&&setTimeout(function(){r.removeClass(u.error)},a.errorLength),i.debug("API Request error:",c),e.proxy(a.failure,r)(c,a,this)}else i.debug("Request Aborted (Most likely caused by page change)")}),e.extend(!0,w,a,{type:a.method||a.type,data:h,url:m,beforeSend:a.beforeXHR}),a.stateContext&&r.addClass(u.loading),a.progress&&(i.verbose("Adding progress events"),e.extend(!0,w,{xhr:function(){var n=new t.XMLHttpRequest;return n.upload.addEventListener("progress",function(t){var n;t.lengthComputable&&(n=Math.round(1e4*(t.loaded/t.total))/100+"%",e.proxy(a.progress,r)(n,t))},!1),n.addEventListener("progress",function(t){var n;t.lengthComputable&&(n=Math.round(1e4*(t.loaded/t.total))/100+"%",e.proxy(a.progress,r)(n,t))},!1),n}})),i.verbose("Creating AJAX request with settings: ",w),v=e.ajax(w).always(function(){f=a.loadingLength-((new Date).getTime()-y),a.loadingDelay=0>f?0:f}).done(function(e){var t=this;setTimeout(function(){p.resolveWith(t,[e])},a.loadingDelay)}).fail(function(e,t,n){var o=this;"abort"!=t?setTimeout(function(){p.rejectWith(o,[e,t,n])},a.loadingDelay):r.removeClass(u.error).removeClass(u.loading)}),a.stateContext&&l.data(d.promise,p).data(d.xhr,v),o)):(i.error(C.beforeSend),i.reset(),o)},reset:function(){l.data(d.promise,!1).data(d.xhr,!1),r.removeClass(u.error).removeClass(u.loading),i.error(f.exitConditions)},setting:function(e,t){return t===o?a[e]:(a[e]=t,o)},verbose:function(){a.verbose&&i.debug.apply(this,arguments)},debug:function(){var e=[],t=a.moduleName+": "+arguments[0],n=[].slice.call(arguments,1),o=console.info||console.log||function(){};o=Function.prototype.bind.call(o,console),a.debug&&(e.push(t),o.apply(console,e.concat(n)))},error:function(){var e=[],t=a.moduleName+": "+arguments[0],n=[].slice.call(arguments,1),o=console.warn||console.log||function(){};o=Function.prototype.bind.call(o,console),a.debug&&(e.push(t),e.concat(n),o.apply(console,e.concat(n)))}},i.initialize(),this},e.fn.apiButton=function(t){return e(this).each(function(){var n,o=e(this),i=e(this).selector||"",a=e.isFunction(t)?e.extend(!0,{},e.api.settings,e.fn.apiButton.settings,{stateContext:this,success:t}):e.extend(!0,{},e.api.settings,e.fn.apiButton.settings,{stateContext:this},t);n={initialize:function(){a.context&&""!==i?e(a.context).on(i,"click."+a.namespace,n.click):o.on("click."+a.namespace,n.click)},click:function(){a.filter&&0!==e(this).filter(a.filter).size()||e.proxy(e.api,this)(a)}},n.initialize()}),this},e.api.settings={moduleName:"API Module",namespace:"api",verbose:!0,debug:!0,api:{},beforeSend:function(e){return e},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},e.fn.apiButton.settings={filter:".disabled, .loading",context:!1,stateContext:!1}}(jQuery,window,document),function(e,t,n,o){e.fn.colorize=function(t){var n=e.extend(!0,{},e.fn.colorize.settings,t),i=arguments||!1;return e(this).each(function(t){var a,s,r,l,c,u,d,f,p=e(this),m=e("")[0],g=e("")[0],h=e("")[0],v=new Image,b=n.colors,y=(n.paths,n.namespace),x=n.errors,w=p.data("module-"+y);return f={checkPreconditions:function(){return f.debug("Checking pre-conditions"),!e.isPlainObject(b)||e.isEmptyObject(b)?(f.error(x.undefinedColors),!1):!0},async:function(e){n.async?setTimeout(e,0):e()},getMetadata:function(){f.debug("Grabbing metadata"),l=p.data("image")||n.image||o,c=p.data("name")||n.name||t,u=n.width||p.width(),d=n.height||p.height(),(0===u||0===d)&&f.error(x.undefinedSize)},initialize:function(){f.debug("Initializing with colors",b),f.checkPreconditions()&&f.async(function(){f.getMetadata(),f.canvas.create(),f.draw.image(function(){f.draw.colors(),f.canvas.merge()}),p.data("module-"+y,f)})},redraw:function(){f.debug("Redrawing image"),f.async(function(){f.canvas.clear(),f.draw.colors(),f.canvas.merge()})},change:{color:function(e,t){return f.debug("Changing color",e),b[e]===o?(f.error(x.missingColor),!1):(b[e]=t,f.redraw(),o)}},canvas:{create:function(){f.debug("Creating canvases"),m.width=u,m.height=d,g.width=u,g.height=d,h.width=u,h.height=d,a=m.getContext("2d"),s=g.getContext("2d"),r=h.getContext("2d"),p.append(m),a=p.children("canvas")[0].getContext("2d")},clear:function(){f.debug("Clearing canvas"),r.fillStyle="#FFFFFF",r.fillRect(0,0,u,d)},merge:function(){return e.isFunction(a.blendOnto)?(a.putImageData(s.getImageData(0,0,u,d),0,0),r.blendOnto(a,"multiply"),o):(f.error(x.missingPlugin),o)}},draw:{image:function(e){f.debug("Drawing image"),e=e||function(){},l?(v.src=l,v.onload=function(){s.drawImage(v,0,0),e()}):(f.error(x.noImage),e())},colors:function(){f.debug("Drawing color overlays",b),e.each(b,function(e,t){n.onDraw(r,c,e,t)})}},debug:function(e,t){n.debug&&(t!==o?console.info(n.moduleName+": "+e,t):console.info(n.moduleName+": "+e))},error:function(e){console.warn(n.moduleName+": "+e)},invoke:function(t,i,a){var s;return a=a||Array.prototype.slice.call(arguments,2),"string"==typeof t&&w!==o&&(t=t.split("."),e.each(t,function(t,o){return e.isPlainObject(w[o])?(w=w[o],!0):e.isFunction(w[o])?(s=w[o],!0):(f.error(n.errors.method),!1)})),e.isFunction(s)?s.apply(i,a):!1}},w!==o&&i?("invoke"==i[0]&&(i=Array.prototype.slice.call(i,1)),f.invoke(i[0],this,Array.prototype.slice.call(i,1))):(f.initialize(),o)}),this},e.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(e){e.fn.defaultText=function(t){var n="string"==typeof t?e.extend({},e.fn.defaultText.settings,{defaultValue:t}):e.extend(!0,{},e.fn.defaultText.settings,t);return"string"==typeof t&&(t={defaultValue:t}),e.extend(n,t),e(this).each(function(){var t=e(this),o={checkDefault:function(){t.val().toLowerCase()!=n.defaultValue.toLowerCase()&&t.addClass(n.filledClass)},placeholder:{add:function(){0===t.filter(n.disabledClassList).size()&&(t.val()==n.replaceValue?n.alwaysReplace?t.removeClass(n.filledClass).val(t.attr("last")).removeAttr("last"):t.removeClass(n.filledClass).val(n.defaultValue):t.addClass(n.filledClass))},remove:function(){0===t.filter(n.disabledClassList).size()&&(n.alwaysReplace?t.attr("last",t.val()).val(n.replaceValue):t.val().toLowerCase()==n.defaultValue.toLowerCase()&&t.val(n.replaceValue))}}};"auto"==n.defaultValue&&(n.defaultValue=e(this).val()),t.on("focus",o.placeholder.remove).on("blur",o.placeholder.add),o.checkDefault()}),this},e.fn.defaultText.settings={defaultValue:"auto",replaceValue:"",alwaysReplace:!1,disabledClassList:".readonly, .disabled",filledClass:"filled"}}(jQuery,window,document),function(e,t,n,o){e.fn.validateForm=function(t,n){var i,a=e(this),s=e.extend(!0,{},e.fn.validateForm.settings,n),r=arguments[0],l=[].slice.call(arguments,1);return a.each(function(){var n,a=e(this),c=e(this).find(s.selector.group),u=(e(this).find(s.selector.field),e(this).find(s.selector.prompt),[]),d=(a.selector||"",a.data("module-"+s.namespace)),f="string"==typeof r,p=s.namespace,m=s.metadata,g=s.className,h=s.errors;n={initialize:function(){n.verbose("Initializing form validation"),t===o&&e.isEmptyObject(t)?n.error(h.noFields,a):(e.fn.defaultText!==o&&e.each(t,function(e,t){n.field.add.defaultText(t)}),a.on("submit."+p,n.validate.form))},destroy:function(){a.off(p)},field:{find:function(t){var n=a.find(s.selector.field);return n.filter("#"+t).size()>0?n.filter("#"+t):n.filter('[name="'+t+'"]').size()>0?n.filter('[name="'+t+'"]'):n.filter("[data-"+m.validate+'="'+t+'"]').size()>0?n.filter("[data-"+m.validate+'="'+t+'"]'):e("")},add:{defaultText:function(e){var t=n.field.find(e.identifier);e.defaultText!==o&&t.defaultText(e.defaultText)},error:function(t,o){var i=n.field.find(t.identifier),a=i.closest(c),r=c.find(r),l=0!==r.size();a.addClass(g.error),s.inlineError&&(l||(r=e("").addClass(g.prompt).insertBefore(i)),r.html(o[0]).fadeIn(s.animateSpeed))}},remove:{error:function(e){var t=n.field.find(e.identifier),o=t.closest(c),i=c.find(i);o.removeClass(g.error),s.inlineError&&i.hide()}}},validate:{form:function(o){var i=!0;return u=[],e.each(t,function(e,t){n.validate.field(t)||(i=!1)}),i?e.proxy(s.onSuccess,this)(o):e.proxy(s.onFailure,this)(u)},field:function(t){var i=n.field.find(t.identifier),a=!0,r=[];return t.rules!==o&&e.each(t.rules,function(e,o){n.validate.rule(t,o)||(n.debug("Field is invalid",t.identifier,o.type),r.push(o.prompt),a=!1)}),a?(n.field.remove.error(t,r),s.onValid(i),!0):(u=u.concat(r),n.field.add.error(t,r),e.proxy(s.onInvalid,i)(r),!1)},rule:function(t,i){var r,l,c=n.field.find(t.identifier),u=i.type,d=t.defaultText!==o?t.defaultText:!1,f=c.val()==d?"":c.val(),p=/\[(.*?)\]/i,m=p.exec(u),g=!0;return m!==o&&null!=m?(r=m[1],l=u.replace(m[0],""),g=e.proxy(s.rules[l],a)(f,r)):g="checked"==u?c.filter(":checked").size()>0:s.rules[u](f),g}},setting:function(e,t){return t===o?s[e]:(s[e]=t,o)},verbose:function(){s.verbose&&n.debug.apply(this,arguments)},debug:function(){var e=[],t=s.moduleName+": "+arguments[0],n=[].slice.call(arguments,1),o=console.info||console.log||function(){};o=Function.prototype.bind.call(o,console),s.debug&&(e.push(t),o.apply(console,e.concat(n)))},error:function(){var e=[],t=s.moduleName+": "+arguments[0],n=[].slice.call(arguments,1),o=console.warn||console.log||function(){};o=Function.prototype.bind.call(o,console),s.debug&&(e.push(t),e.concat(n),o.apply(console,e.concat(n)))},invoke:function(t,i,a){var s,r;return a=a||[].slice.call(arguments,2),"string"==typeof t&&d!==o&&(t=t.split("."),s=t.length-1,e.each(t,function(t,i){return e.isPlainObject(d[i])&&t!=s?(d=d[i],!0):d[i]!==o?(r=d[i],!0):(n.error(h.method),!1)})),e.isFunction(r)?r.apply(i,a):r}},f?i=n.invoke(r,this,l):n.initialize()}),i!==o?i:this},e.fn.validateForm.settings={moduleName:"Validate Form Module",debug:!0,verbose:!1,namespace:"validate",animateSpeed:150,inlineError:!1,onValid:function(){},onInvalid:function(){},onSuccess:function(){return!0},onFailure:function(){return!1},metadata:{validate:"validate"},errors:{method:"The method you called is not defined.",noFields:"No validation object specified."},selector:{group:".field",prompt:".prompt",field:"input, textarea, select"},className:{error:"error",prompt:"prompt"},rules:{empty:function(e){return!(e===o||""===e)},email:function(e){var t=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 t.test(e)},length:function(e,t){return e!==o?e.length>=t:!1},not:function(e,t){return e!=t},maxLength:function(e,t){return e!==o?t>=e.length:!1},match:function(t,n){var i,a=e(this);return a.find("#"+n).size()>0?i=a.find("#"+n).val():a.find("[name="+n+"]").size()>0?i=a.find("[name="+n+"]").val():a.find('[data-validate="'+n+'"]').size()>0&&(i=a.find('[data-validate="'+n+'"]').val()),i!==o?""+t==""+i:!1},url:function(e){var t=/(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/;return t.test(e)}}}}(jQuery,window,document),function(e,t,n,o){e.fn.state=function(t){var n,i=e(this),a=i.selector||"",s=arguments[0],r=[].slice.call(arguments,1),l=(new Date).getTime(),c=[];return i.each(function(){var u,d=e(this),f=e.extend(!0,{},e.fn.state.settings,t),p=this,m=d.data("module-"+f.namespace),g="string"==typeof s,h=f.namespace,v=f.metadata,b=f.className,y=f.states,x=f.text;u={initialize:function(){u.verbose("Initializing module",p),f.automatic&&u.add.defaults(),f.context&&""!==a?(u.allows("hover")&&e(p,f.context).on(a,"mouseenter."+h,u.hover.enable).on(a,"mouseleave."+h,u.hover.disable),u.allows("pressed")&&e(p,f.context).on(a,"mousedown."+h,u.pressed.enable).on(a,"mouseup."+h,u.pressed.disable),u.allows("focus")&&e(p,f.context).on(a,"focus."+h,u.focus.enable).on(a,"blur."+h,u.focus.disable),e(f.context).on(a,"mouseenter."+h,u.text.change).on(a,"mouseleave."+h,u.text.reset).on(a,"click."+h,u.toggle)):(u.allows("hover")&&d.on("mouseenter."+h,u.hover.enable).on("mouseleave."+h,u.hover.disable),u.allows("pressed")&&d.on("mousedown."+h,u.pressed.enable).on("mouseup."+h,u.pressed.disable),u.allows("focus")&&d.on("focus."+h,u.focus.enable).on("blur."+h,u.focus.disable),d.on("mouseenter."+h,u.text.change).on("mouseleave."+h,u.text.reset).on("click."+h,u.toggle)),d.data("module-"+h,u)},destroy:function(){u.verbose("Destroying previous module",p),d.off("."+h)},refresh:function(){u.verbose("Refreshing selector cache",p),d=e(p)},add:{defaults:function(){var n=t&&e.isPlainObject(t.states)?t.states:{};e.each(f.defaults,function(t,i){u.is[t]!==o&&u.is[t]()&&(u.verbose("Adding default states",t,p),e.extend(f.states,i,n))})}},is:{active:function(){return d.hasClass(b.active)},loading:function(){return d.hasClass(b.loading)},inactive:function(){return!d.hasClass(b.active)},enabled:function(){return!d.is(f.filter.active)},disabled:function(){return d.is(f.filter.active)},textEnabled:function(){return!d.is(f.filter.text)},button:function(){return d.is(".button:not(a, .submit)")},input:function(){return d.is("input")}},allows:function(e){return y[e]||!1},enable:function(e){u.allows(e)&&d.addClass(b[e])},disable:function(e){u.allows(e)&&d.removeClass(b[e])},textFor:function(e){return x[e]||!1},focus:{enable:function(){d.addClass(b.focus)},disable:function(){d.removeClass(b.focus)}},hover:{enable:function(){d.addClass(b.hover)},disable:function(){d.removeClass(b.hover)}},pressed:{enable:function(){d.addClass(b.pressed).one("mouseleave",u.pressed.disable)},disable:function(){d.removeClass(b.pressed)}},toggle:function(){var e=d.data(v.promise);u.allows("active")&&u.is.enabled()&&(u.refresh(),e!==o?u.listenTo(e):u.change())},listenTo:function(t){u.debug("API request detected, waiting for state signal",t),t?(x.loading&&u.text.update(x.loading),e.when(t).then(function(){"resolved"==t.state()?(u.debug("API request succeeded"),f.activateTest=function(){return!0},f.deactivateTest=function(){return!0}):(u.debug("API request failed"),f.activateTest=function(){return!1},f.deactivateTest=function(){return!1}),u.change()})):(f.activateTest=function(){return!1},f.deactivateTest=function(){return!1})},change:function(){u.debug("Determining state change direction"),u.is.inactive()?u.activate():u.deactivate(),f.sync&&u.sync(),f.onChange()},activate:function(){e.proxy(f.activateTest,p)()&&(u.debug("Setting state to active"),d.addClass(b.active),u.text.update(x.active))},deactivate:function(){e.proxy(f.deactivateTest,p)()&&(u.debug("Setting state to inactive"),d.removeClass(b.active),u.text.update(x.inactive))},sync:function(){u.verbose("Syncing other buttons to current state"),u.is.active()?i.not(d).state("activate"):i.not(d).state("deactivate")},text:{get:function(){return f.selector.text?d.find(f.selector.text).text():d.html()},flash:function(e,t){var n=u.text.get();e=e||f.text.flash,t=t||f.flashDuration,u.text.update(e),setTimeout(function(){u.text.update(n)},t)},change:function(){u.verbose("Checking if text should be changed"),u.is.textEnabled()&&(u.is.active()?x.hover?(u.verbose("Changing text to hover text",x.hover),u.text.update(x.hover)):x.disable&&(u.verbose("Changing text to disable text",x.disable),u.text.update(x.disable)):x.hover?(u.verbose("Changing text to hover text",x.disable),u.text.update(x.hover)):x.enable&&(u.verbose("Changing text to enable text",x.disable),u.text.update(x.enable)))},reset:function(){var e=x.active||d.data(v.storedText),t=x.inactive||d.data(v.storedText);u.is.textEnabled()&&(u.is.active()&&e?(u.verbose("Resetting active text",e),u.text.update(e)):t&&(u.verbose("Resetting inactive text",e),u.text.update(t)))},update:function(e){var t=u.text.get();e&&e!==t&&(u.debug("Updating text",e),f.selector.text?d.data(v.storedText,e).find(f.selector.text).text(e):d.data(v.storedText,e).html(e))}},setting:function(e,t){return t===o?f[e]:(f[e]=t,o)},performance:{log:function(e){var t,n;f.performance&&(t=(new Date).getTime(),n=t-l,l=t,c.push({Name:e,"Execution Time":n}),clearTimeout(u.performance.timer),u.performance.timer=setTimeout(u.performance.display,100))},display:function(){var t=f.moduleName+" Performance ("+a+")";f.moduleName+": "+a+"("+i.size()+" elements)",console.group!==o&&c.length>0&&(console.groupCollapsed(t),console.table?console.table(c):e.each(c,function(e,t){console.log(t.Name+":"+t["Execution Time"])}),console.groupEnd(),c=[])}},verbose:function(){f.verbose&&f.debug&&(u.performance.log(arguments[0]),u.verbose=Function.prototype.bind.call(console.info,console,f.moduleName+":"))},debug:function(){f.debug&&(u.performance.log(arguments[0]),u.debug=Function.prototype.bind.call(console.info,console,f.moduleName+":"))},error:function(){console.log!==o&&(u.error=Function.prototype.bind.call(console.log,console,f.moduleName+":"))},invoke:function(t,n,i){var a,s;return i=i||[].slice.call(arguments,2),"string"==typeof t&&m!==o&&(t=t.split("."),a=t.length-1,e.each(t,function(t,n){return e.isPlainObject(m[n])&&t!=a?(m=m[n],!0):m[n]!==o?(s=m[n],!0):(u.error(f.errors.method),!1)})),e.isFunction(s)?s.apply(n,i):s}},g?n=u.invoke(s,this,r):(m!==o&&u.destroy(),u.initialize())}),n!==o?n:this},e.fn.state.settings={moduleName:"State Module",debug:!0,verbose:!1,namespace:"state",performance:!0,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",pressed:"down",active:"active",loading:"loading"},selector:{text:!1},defaults:{input:{hover:!0,focus:!0,pressed:!0,loading:!1,active:!1},button:{hover:!0,focus:!1,pressed:!0,active:!1,loading:!0}},states:{hover:!0,focus:!0,pressed:!0,loading:!1,active:!1},text:{flash:!1,hover:!1,active:!1,inactive:!1,enable:!1,disable:!1}}}(jQuery,window,document),function(e,t,n,o){e.fn.chat=function(t,n,i){var a=e.extend(!0,{},e.fn.chat.settings,i),s=arguments||!1;return e(this).each(function(){var i,r,l,c,u,d,f=e(this),p=f.find(a.selector.expandButton),m=f.find(a.selector.userListButton),g=f.find(a.selector.userList),h=(f.find(a.selector.room),f.find(a.selector.userCount)),v=f.find(a.selector.log),b=(f.find(a.selector.message),f.find(a.selector.messageInput)),y=f.find(a.selector.messageButton),x=f.data("module"),w=a.className,C=a.namespace,k="",T={};return d={channel:!1,width:{log:v.width(),userList:g.outerWidth()},initialize:function(){return Pusher===o&&d.error(a.errors.pusher),t===o||n===o?(d.error(a.errors.key),!1):a.endpoint.message||a.endpoint.authentication?(u=new Pusher(t),Pusher.channel_auth_endpoint=a.endpoint.authentication,d.channel=u.subscribe(n),d.channel.bind("pusher:subscription_succeeded",d.user.list.create),d.channel.bind("pusher:subscription_error",d.error),d.channel.bind("pusher:member_added",d.user.joined),d.channel.bind("pusher:member_removed",d.user.left),d.channel.bind("update_messages",d.message.receive),e.each(a.customEvents,function(e,t){d.channel.bind(e,t)}),e.fn.hoverClass!==o&&e.fn.downClass!==o&&(p.hoverClass().downClass(),m.hoverClass().downClass(),y.hoverClass().downClass()),m.on("click."+C,d.event.toggleUserList),p.on("click."+C,d.event.toggleExpand),b.on("keydown."+C,d.event.input.keydown).on("keyup."+C,d.event.input.keyup),y.on("mouseenter."+C,d.event.hover).on("mouseleave."+C,d.event.hover).on("click."+C,d.event.submit),v.animate({scrollTop:v.prop("scrollHeight")},400),f.data("module",d).addClass(w.loading),o):(d.error(a.errors.endpoint),!1)},refresh:function(){m.removeClass(w.active),d.width={log:v.width(),userList:g.outerWidth()},m.hasClass(w.active)&&d.user.list.hide(),f.data("module",d)},user:{updateCount:function(){a.userCount&&(T=f.data("users"),l=0,e.each(T,function(){l++}),h.html(a.templates.userCount(l)))},joined:function(t){T=f.data("users"),"anonymous"!=t.id&&T[t.id]===o&&(T[t.id]=t.info,a.randomColor&&t.info.color===o&&(t.info.color=a.templates.color(t.id)),k=a.templates.userList(t.info),t.info.isAdmin?e(k).prependTo(g).preview({type:"user",placement:"left"}):e(k).appendTo(g).preview({type:"user",placement:"left"}),e.fn.preview!==o&&g.children().last().preview({type:"user",placement:"left"}),a.partingMessages&&(v.append(a.templates.joined(t.info)),d.message.scroll.test()),d.user.updateCount())},left:function(e){T=f.data("users"),e!==o&&"anonymous"!==e.id&&(delete T[e.id],f.data("users",T),g.find("[data-id="+e.id+"]").remove(),a.partingMessages&&(v.append(a.templates.left(e.info)),d.message.scroll.test()),d.user.updateCount())},list:{create:function(t){T={},t.each(function(e){"anonymous"!==e.id&&"undefined"!==e.id&&(a.randomColor&&e.info.color===o&&(e.info.color=a.templates.color(e.id)),k=e.info.isAdmin?a.templates.userList(e.info)+k:k+a.templates.userList(e.info),T[e.id]=e.info)}),f.data("users",T).data("user",T[t.me.id]).removeClass(w.loading),g.html(k),e.fn.preview!==o&&g.children().preview({type:"user",placement:"left"}),d.user.updateCount(),e.proxy(a.onJoin,g.children())()},show:function(){v.animate({width:d.width.log-d.width.userList},{duration:a.speed,easing:a.easing,complete:d.message.scroll.move})},hide:function(){v.stop().animate({width:d.width.log},{duration:a.speed,easing:a.easing,complete:d.message.scroll.move})}}},message:{scroll:{test:function(){c=v.prop("scrollHeight")-v.height(),Math.abs(v.scrollTop()-c)