From 9fcc098f82339b648b7f00a4b26c5c7fff1ed3a6 Mon Sep 17 00:00:00 2001 From: jlukic Date: Sat, 18 Apr 2015 12:48:39 -0400 Subject: [PATCH] Rebuild dist --- dist/components/dropdown.js | 51 +++++++++++++++--------------- dist/components/dropdown.min.js | 2 +- dist/components/search.js | 4 +-- dist/components/search.min.js | 2 +- dist/semantic.js | 55 +++++++++++++++++---------------- dist/semantic.min.js | 6 ++-- 6 files changed, 61 insertions(+), 59 deletions(-) diff --git a/dist/components/dropdown.js b/dist/components/dropdown.js index 9e8eaa649..b629d0ac6 100644 --- a/dist/components/dropdown.js +++ b/dist/components/dropdown.js @@ -544,7 +544,7 @@ $.fn.dropdown = function(parameters) { }, filterActive: function() { - if(settings.filterActive) { + if(settings.hideSelections) { $item.filter('.' + className.active) .addClass(className.filtered) ; @@ -997,7 +997,6 @@ $.fn.dropdown = function(parameters) { ? $nextItem = $selectedItem.nextAll(selector.item + ':not(.' + className.filtered + ')').eq(0) : $item.eq(0) ; - console.log(hasSelectedItem, inVisibleMenu, $nextItem); if($nextItem.length === 0) { module.verbose('Down key pressed but reached bottom of current menu'); event.preventDefault(); @@ -1311,7 +1310,7 @@ $.fn.dropdown = function(parameters) { optionValue = module.get.choiceValue($choice, optionText) ; if(isMultiple) { - if($.inArray(optionValue, value) !== -1 || $.inArray(optionText, value) !== -1) { + if($.inArray(optionValue.toString(), value) !== -1 || $.inArray(optionText, value) !== -1) { $selectedItem = ($selectedItem) ? $selectedItem.add($choice) : $choice @@ -1589,7 +1588,7 @@ $.fn.dropdown = function(parameters) { module.remove.activeItem(); module.remove.selectedItem(); } - else if(settings.filterActive) { + else if(settings.hideSelections) { module.remove.selectedItem(); } $selectedItem @@ -1674,7 +1673,7 @@ $.fn.dropdown = function(parameters) { $item.removeClass(className.active); }, filteredItem: function() { - if(settings.filterActive) { + if(settings.hideSelections) { $item.not('.' + className.active).removeClass(className.filtered); } else { @@ -1694,12 +1693,14 @@ $.fn.dropdown = function(parameters) { ; if($selectedItem) { if( $input.is('select') ) { + module.verbose('Input is values to placeholder text - placeholder: 'auto', + preserveHTML : true, // preserve html when selecting value - preserveHTML : true, + sortSelect : false, // sort selection on init - sortSelect : false, + match : 'both', // what to match against with search selection (both, text, or label) - match: 'both', - // allow elements with sub-menus to be selected allowCategorySelection : false, + // allow elements with sub-menus to be selected - // delay before event delay : { hide : 300, show : 200, search : 50, touch : 50 }, + // delay before event - // force a value selection on search selection forceSelection : true, + // force a value selection on search selection - // menu transiton transition : 'auto', + // menu transiton duration : 250, - // widest glyph width in em (W is 1.0714 em) used to calculate multiselect input width glyphWidth : 1.0714, + // widest glyph width in em (W is 1.0714 em) used to calculate multiselect input width - // whether multiple select should allow user added values allowAdditions : true, + // whether multiple select should allow user added values - // multi select delimiting key delimiter : ',', + // multi select delimiting key - // label settings on multi-select label: { + // label settings on multi-select transition : 'horizontal flip', duration : 150, variation : false }, + hideSelections : true, // whether multiple selects should filter active selections from menu - filterActive : true, + /* Callbacks */ onLabelSelect : function($selectedLabels){}, diff --git a/dist/components/dropdown.min.js b/dist/components/dropdown.min.js index 1f29954cf..d06aa5ddf 100644 --- a/dist/components/dropdown.min.js +++ b/dist/components/dropdown.min.js @@ -8,4 +8,4 @@ * http://opensource.org/licenses/MIT * */ -!function(e,t,n,i){"use strict";e.fn.dropdown=function(o){var a,l=e(this),r=e(n),s=l.selector||"",c="ontouchstart"in n.documentElement,u=(new Date).getTime(),d=[],v=arguments[0],f="string"==typeof v,h=[].slice.call(arguments,1);return l.each(function(){var m,g,p,b,w,x=e.isPlainObject(o)?e.extend(!0,{},e.fn.dropdown.settings,o):e.extend({},e.fn.dropdown.settings),C=x.className,y=x.metadata,S=x.namespace,T=x.selector,k=x.error,A=x.templates,D="."+S,E="module-"+S,O=e(this),I=O.find(T.text),F=O.find(T.search),q=O.find(T.input),V=O.find(T.icon),L=O.prev().find(T.text).length>0?O.prev().find(T.text):O.prev(),M=O.children(T.menu),R=M.find(T.item),P=!1,z=!1,j=this,H=O.data(E);w={initialize:function(){w.debug("Initializing dropdown",x),w.is.alreadySetup()?w.setup.reference():(w.setup.layout(),w.save.defaults(),w.set.selected(),w.create.id(),c&&w.bind.touchEvents(),w.bind.mouseEvents(),w.bind.keyboardEvents(),w.observeChanges(),w.instantiate())},instantiate:function(){w.verbose("Storing instance of dropdown",w),H=w,O.data(E,w)},destroy:function(){w.verbose("Destroying previous dropdown for",O),w.remove.tabbable(),O.off(D).removeData(E),M.off(D),r.off(m),p&&p.disconnect(),b&&b.disconnect()},observeChanges:function(){"MutationObserver"in t&&(p=new MutationObserver(function(){w.debug("").addClass(C.search).insertBefore(I)),x.allowTab&&w.set.tabbable()},select:function(){var t=w.get.selectValues();w.debug("Dropdown initialized on a select",t),O.is("select")&&(q=O),q.parent(T.dropdown).length>0?(w.debug("UI dropdown already exists. Creating dropdown menu only"),O=q.closest(T.dropdown),M=O.children(T.menu),0===M.length&&(M=e("
").addClass(C.menu).appendTo(O)),M.html(A.menu(t))):(w.debug("Creating entire dropdown from select"),O=e("
").attr("class",q.attr("class")).addClass(C.selection).addClass(C.dropdown).html(A.dropdown(t)).insertBefore(q),q.removeAttr("class").detach().prependTo(O)),q.is("[multiple]")&&w.set.multiple(),w.refresh()},reference:function(){var e,t,n=l.index(O);w.debug("Dropdown behavior was called on select, replacing with closest dropdown"),O=O.parent(T.dropdown),w.refresh(),e=l.slice(0,n),t=l.slice(n+1),l=e.add(O).add(t),f&&(H=w,w.invoke(v))}},refresh:function(){w.verbose("Refreshing selector cache"),I=O.find(T.text),F=O.find(T.search),q=O.find(T.input),V=O.find(T.icon),L=O.prev().find(T.text).length>0?O.prev().find(T.text):O.prev(),M=O.children(T.menu),R=M.find(T.item)},toggle:function(){w.verbose("Toggling menu visibility"),w.is.active()?w.hide():w.show()},show:function(t){t=e.isFunction(t)?t:function(){},w.is.searchSelection()&&w.is.allFiltered()||w.can.show()&&!w.is.active()&&(w.debug("Showing dropdown"),w.is.multiple()&&w.is.searchSelection()&&w.filterActive(),w.animate.show(function(){w.can.click()&&w.bind.intent(),w.set.visible(),t.call(j)}),x.onShow.call(j))},hide:function(t){t=e.isFunction(t)?t:function(){},w.is.active()&&(w.debug("Hiding dropdown"),w.animate.hide(function(){w.remove.visible(),t.call(j)}),x.onHide.call(j))},hideOthers:function(){w.verbose("Finding other dropdowns to hide"),l.not(O).has(T.menu+":visible:not(."+C.animating+")").dropdown("hide")},hideMenu:function(){w.verbose("Hiding menu instantaneously"),w.remove.active(),w.remove.visible(),M.transition("hide")},hideSubMenus:function(){var e=M.children(T.item).find(T.menu);w.verbose("Hiding sub menus",e),e.transition("hide")},bind:{keyboardEvents:function(){w.debug("Binding keyboard events"),O.on("keydown"+D,w.event.keydown),w.has.search()&&O.on(w.get.inputEvent()+D,T.search,w.event.input),w.is.multiple()&&r.on("keydown"+m,w.event.document.keydown)},touchEvents:function(){w.debug("Touch device detected binding additional touch events"),w.is.searchSelection()||O.on("touchstart"+D,w.event.test.toggle),M.on("touchstart"+D,T.item,w.event.item.mouseenter)},mouseEvents:function(){w.verbose("Mouse detected binding mouse events"),w.is.multiple()&&O.on("click"+D,T.label,w.event.label.click).on("click"+D,T.remove,w.event.remove.click),w.is.searchSelection()?(O.on("mousedown"+D,T.menu,w.event.menu.mousedown).on("mouseup"+D,T.menu,w.event.menu.mouseup).on("click"+D,T.search,w.show).on("focus"+D,T.search,w.event.search.focus).on("blur"+D,T.search,w.event.search.blur).on("click"+D,T.text,w.event.text.focus),w.is.multiple()&&O.on("click"+D,w.event.click)):("click"==x.on?O.on("click"+D,w.event.test.toggle):"hover"==x.on?O.on("mouseenter"+D,w.delay.show).on("mouseleave"+D,w.delay.hide):O.on(x.on+D,w.toggle),O.on("mousedown"+D,w.event.mousedown).on("mouseup"+D,w.event.mouseup).on("focus"+D,w.event.focus).on("blur"+D,w.event.blur)),M.on("mouseenter"+D,T.item,w.event.item.mouseenter).on("mouseleave"+D,T.item,w.event.item.mouseleave).on("click"+D,T.item,w.event.item.click)},intent:function(){w.verbose("Binding hide intent event to document"),c&&r.on("touchstart"+m,w.event.test.touch).on("touchmove"+m,w.event.test.touch),r.on("click"+m,w.event.test.hide)}},unbind:{intent:function(){w.verbose("Removing hide intent event from document"),c&&r.off("touchstart"+m).off("touchmove"+m),r.off("click"+m)}},filter:function(t){var n=e(),i=w.escape.regExp(t),o=new RegExp("^"+i,"igm"),a=new RegExp(i,"ig");w.verbose("Searching for matching values"),R.each(function(){var t,i,l=e(this);if("both"==x.match||"text"==x.match){if(t=String(w.get.choiceText(l,!1)),t.match(o))return n=n.add(l),!0;if(x.fullTextSearch&&t.match(a))return n=n.add(l),!0}if("both"==x.match||"value"==x.match){if(i=String(w.get.choiceValue(l,t)),i.match(o))return n=n.add(l),!0;if(x.fullTextSearch&&i.match(a))return n=n.add(l),!0}}),w.debug("Setting filter",t),w.remove.filteredItem(),R.not(n).addClass(C.filtered),w.is.multiple()&&w.filterActive(),w.verbose("Selecting first non-filtered element"),w.select.firstUnfiltered(),w.is.allFiltered()&&(w.debug("All items filtered, hiding dropdown",t),w.is.searchSelection()&&w.hideMenu(),x.onNoResults.call(j,t))},filterActive:function(){x.filterActive&&R.filter("."+C.active).addClass(C.filtered)},focusSearch:function(){w.is.search()&&!w.is.focusedOnSearch()&&F[0].focus()},forceSelection:function(){var e=R.not(C.filtered).filter("."+C.selected).eq(0),t=R.not(C.filtered).filter("."+C.active).eq(0),n=e.length>0?e:t,i=n.size()>0;i?(w.debug("Forcing partial selection to selected item",n),w.event.item.click.call(n),w.remove.filteredItem()):w.hide()},event:{focus:function(){x.showOnFocus&&!P&&w.is.hidden()&&w.show()},click:function(t){var n=e(t.target);!n.is(O)&&!n.is(V)||w.is.focusedOnSearch()||F.focus()},blur:function(){var e=n.activeElement===this;P||e||(w.remove.activeLabel(),w.hide())},mousedown:function(){P=!0},mouseup:function(){P=!1},search:{focus:function(){P=!0,w.is.multiple()&&w.remove.activeLabel(),x.showOnFocus&&w.show()},blur:function(){var e=n.activeElement===this;z||e||(w.is.multiple()?w.remove.activeLabel():x.forceSelection?w.forceSelection():w.hide())}},text:{focus:function(){P=!0,F.focus()}},input:function(){(w.is.multiple()||w.is.searchSelection())&&w.set.filtered(),clearTimeout(w.timer),w.timer=setTimeout(w.search,x.delay.search)},label:{click:function(t){var n=e(this),i=O.find(T.label),o=i.filter("."+C.active),a=n.nextAll("."+C.active),l=n.prevAll("."+C.active),r=a.length>0?n.nextUntil(a).add(o).add(n):n.prevUntil(l).add(o).add(n);t.shiftKey?(o.removeClass(C.active),r.addClass(C.active)):t.ctrlKey?n.toggleClass(C.active):(o.removeClass(C.active),n.addClass(C.active)),x.onLabelSelect.apply(this,i.filter("."+C.active))}},remove:{click:function(){var t=e(this).parent();t.hasClass(C.active)?w.remove.labels():w.remove.labels(t)}},test:{toggle:function(e){var t=w.is.multiple()?w.show:w.toggle;w.determine.eventOnElement(e,t)&&e.preventDefault()},touch:function(e){w.determine.eventOnElement(e,function(){"touchstart"==e.type?w.timer=setTimeout(w.hide,x.delay.touch):"touchmove"==e.type&&clearTimeout(w.timer)}),e.stopPropagation()},hide:function(e){w.determine.eventInModule(e,w.hide)}},menu:{mousedown:function(){z=!0},mouseup:function(){z=!1}},item:{mouseenter:function(t){var n=e(this).children(T.menu),i=e(this).siblings(T.item).children(T.menu);n.length>0&&(clearTimeout(w.itemTimer),w.itemTimer=setTimeout(function(){w.verbose("Showing sub-menu",n),e.each(i,function(){w.animate.hide(!1,e(this))}),w.animate.show(!1,n)},x.delay.show),t.preventDefault())},mouseleave:function(){var t=e(this).children(T.menu);t.length>0&&(clearTimeout(w.itemTimer),w.itemTimer=setTimeout(function(){w.verbose("Hiding sub-menu",t),w.animate.hide(!1,t)},x.delay.hide))},click:function(t){var n=e(this),i=e(t?t.target:""),o=n.find(T.menu),a=w.get.choiceText(n),l=w.get.choiceValue(n,a),r=o.length>0,s=o.find(i).length>0;s||r&&!x.allowCategorySelection||w.determine.selectAction.call(this,a,l)}},document:{keydown:function(e){var t=e.which,n=w.get.shortcutKeys(),i=w.is.inObject(t,n);if(i){var o=O.find(T.label),a=o.filter("."+C.active),l=a.data("value"),r=o.index(a),s=o.length,c=a.length>0,u=a.length>1,d=0==r,v=r+1==s,f=w.is.searchSelection(),h=w.is.focusedOnSearch(),m=w.is.focused(),g=h&&0==w.get.caretPosition();h&&t==n.delimiter?w.is.visible()&&(w.verbose("Delimiter key pressed. Tokenizing"),e.preventDefault()):t==n.leftArrow?!m&&!g||c?c&&(e.shiftKey?w.verbose("Adding previous label to selection"):(w.verbose("Selecting previous label"),o.removeClass(C.active)),d&&!u?a.addClass(C.active):a.prev(T.siblingLabel).addClass(C.active).end(),e.preventDefault()):(w.verbose("Selecting previous label"),o.last().addClass(C.active)):t==n.rightArrow?(m&&!c&&o.first().addClass(C.active),c&&(e.shiftKey?w.verbose("Adding next label to selection"):(w.verbose("Selecting next label"),o.removeClass(C.active)),v?f&&!h?w.focusSearch():u?a.next(T.siblingLabel).addClass(C.active):a.addClass(C.active):a.next(T.siblingLabel).addClass(C.active),e.preventDefault())):t==n.deleteKey||t==n.backspace?c?(w.verbose("Removing active labels"),v&&f&&!h&&w.focusSearch(),a.last().next(T.siblingLabel).addClass(C.active),w.remove.labels(a),e.preventDefault()):g&&!c&&t==n.backspace&&(w.verbose("Removing last label on input backspace"),a=o.last().addClass(C.active),l=a.data("value"),w.remove.selected(l),e.preventDefault()):a.removeClass(C.active)}}},keydown:function(e){var t=e.which,n=w.get.shortcutKeys(),i=w.is.inObject(t,n);if(i){var o,a,l=R.not("."+C.filtered).filter("."+C.selected).eq(0),r=M.children("."+C.active).eq(0),s=l.length>0?l:r,c=s.length>0?s.siblings(":not(."+C.filtered+")").andSelf():M.children(":not(."+C.filtered+")"),u=s.children(T.menu),d=s.closest(T.menu),v=d.hasClass(C.visible)||d.hasClass(C.animating),f=u.length>0,h=s.length>0,m=s.not("."+T.filtered).length>0;if(w.is.visible()){if(t==n.enter&&h&&(f&&!x.allowCategorySelection?(w.verbose("Pressed enter on unselectable category, opening sub menu"),t=n.rightArrow):m&&(w.verbose("Enter key pressed, choosing selected item"),w.event.item.click.call(s,e),e.stopImmediatePropagation()),e.preventDefault()),t==n.leftArrow&&(a=d[0]!==M[0],a&&(w.verbose("Left key pressed, closing sub-menu"),w.animate.hide(!1,d),s.removeClass(C.selected),d.closest(T.item).addClass(C.selected),e.preventDefault())),t==n.rightArrow&&f&&(w.verbose("Right key pressed, opening sub-menu"),w.animate.show(!1,u),s.removeClass(C.selected),u.find(T.item).eq(0).addClass(C.selected),e.preventDefault()),t==n.upArrow){if(o=h&&v?s.prevAll(T.item+":not(."+C.filtered+")").eq(0):R.eq(0),c.index(o)<0)return w.verbose("Up key pressed but reached top of current menu"),void e.preventDefault();w.verbose("Up key pressed, changing active item"),s.removeClass(C.selected),o.addClass(C.selected),w.set.scrollPosition(o),e.preventDefault()}if(t==n.downArrow){if(o=h&&v?o=s.nextAll(T.item+":not(."+C.filtered+")").eq(0):R.eq(0),console.log(h,v,o),0===o.length)return w.verbose("Down key pressed but reached bottom of current menu"),void e.preventDefault();w.verbose("Down key pressed, changing active item"),R.removeClass(C.selected),o.addClass(C.selected),w.set.scrollPosition(o),e.preventDefault()}t==n.escape&&(w.verbose("Escape key pressed, closing dropdown"),w.hide())}else t==n.enter&&(w.verbose("Enter key pressed, showing dropdown"),w.show(),e.preventDefault()),t==n.downArrow&&(w.verbose("Down key pressed, showing dropdown"),w.show(),e.preventDefault())}}},determine:{selectAction:function(t,n){w.verbose("Determining action",x.action),e.isFunction(w.action[x.action])?(w.verbose("Triggering preset action",x.action,t,n),w.action[x.action].call(this,t,n)):e.isFunction(x.action)?(w.verbose("Triggering user action",x.action,t,n),x.action.call(this,t,n)):w.error(k.action,x.action)},eventInModule:function(t,n){return n=e.isFunction(n)?n:function(){},0===e(t.target).closest(O).length?(w.verbose("Triggering event",n),n(),!0):(w.verbose("Event occurred in dropdown, canceling callback"),!1)},eventOnElement:function(t,n){var i=e(t.target);return n=e.isFunction(n)?n:function(){},0==i.closest(M).length?(w.verbose("Triggering event",n),n(),!0):(w.verbose("Event occurred in dropdown menu, canceling callback"),!1)}},action:{nothing:function(){},activate:function(t,n){n=n!==i?n:t,w.set.selected(n,e(this)),(!w.is.multiple()||w.is.allFiltered())&&w.hideAndClear()},select:function(){w.action.activate.call(this)},combo:function(t,n){n=n!==i?n:t,w.set.selected(n,e(this)),w.hideAndClear()},hide:function(){w.hideAndClear()}},get:{id:function(){return g},text:function(){return I.text()},uniqueArray:function(t){return e.grep(t,function(n,i){return e.inArray(n,t)===i})},caretPosition:function(){var e,t,i=F.get(0);return"selectionStart"in i?i.selectionStart:n.selection?(i.focus(),e=n.selection.createRange(),t=e.text.length,e.moveStart("character",-i.value.length),e.text.length-t):void 0},shortcutKeys:function(){return{backspace:8,delimiter:188,deleteKey:46,enter:13,escape:27,leftArrow:37,upArrow:38,rightArrow:39,downArrow:40}},value:function(){return q.length>0?q.val():O.data(y.value)},values:function(){var e=w.get.value();return""==e?"":!q.is("select")&&w.is.multiple()?e.split(x.delimiter):e},choiceText:function(e,t){return t=t!==i?t:x.preserveHTML,e?(e.find(T.menu).length>0&&(w.verbose("Retreiving text of element with sub-menu"),e=e.clone(),e.find(T.menu).remove(),e.find(T.menuIcon).remove()),e.data(y.text)!==i?e.data(y.text):t?e.html().trim():e.text().trim()):void 0},choiceValue:function(e,t){return t=t||w.get.choiceText(e),e?e.data(y.value)!==i?e.data(y.value):"string"==typeof t?t.toLowerCase().trim():t:!1},inputEvent:function(){var e=F[0];return e?e.oninput!==i?"input":e.onpropertychange!==i?"propertychange":"keyup":!1},selectValues:function(){var t={};return t.values=x.sortSelect?{}:[],O.find("option").each(function(){var n=e(this).html(),o=e(this).attr("value")!==i?e(this).attr("value"):n;"auto"===x.placeholder&&""===o?t.placeholder=n:x.sortSelect?t.values[o]={name:n,value:o}:t.values.push({name:n,value:o})}),x.placeholder&&"auto"!==x.placeholder&&(w.debug("Setting placeholder value to",x.placeholder),t.placeholder=x.placeholder),x.sortSelect?w.debug("Retrieved and sorted values from select",t):w.debug("Retreived values from select",t),t},activeItem:function(){return R.filter("."+C.active)},item:function(t,n){var o,a=!1;return t=t!==i?t:w.get.values()!==i?w.get.values():w.get.text(),o=w.is.multiple()&&e.isArray(t),n=""===t||0===t?!0:n||!1,t!==i&&R.each(function(){var i=e(this),l=w.get.choiceText(i),r=w.get.choiceValue(i,l);if(o)(-1!==e.inArray(r,t)||-1!==e.inArray(l,t))&&(a=a?a.add(i):i);else if(n){if(w.verbose("Ambiguous dropdown value using strict type check",i,t),r===t||l===t)return a=i,!0}else if(r==t||l==t)return w.verbose("Found select item by value",r,t),a=i,!0}),a}},restore:{defaults:function(){w.restore.defaultText(),w.restore.defaultValue()},defaultText:function(){var e=O.data(y.defaultText);w.debug("Restoring default text",e),w.set.text(e),I.addClass(C.placeholder)},defaultValue:function(){var e=O.data(y.defaultValue);e!==i&&(w.debug("Restoring default value",e),e.length?w.set.selected(e):(w.remove.activeItem(),w.remove.selectedItem()))}},save:{defaults:function(){w.save.defaultText(),w.save.placeholderText(),w.save.defaultValue()},defaultValue:function(){O.data(y.defaultValue,w.get.value())},defaultText:function(){O.data(y.defaultText,I.text())},placeholderText:function(){I.hasClass(C.placeholder)&&O.data(y.placeholderText,I.text())}},clear:function(){w.set.placeholderText(),w.clearValue(),w.remove.activeItem(),w.remove.selectedItem()},clearValue:function(){w.set.value("")},set:{filtered:function(){var e=w.is.multiple(),t=w.is.searchSelection(),n=e&&t,i=t?F.val():"",o="string"==typeof i&&i.length>0,a=i.length*x.glyphWidth+"em",l=""!=q.val();e&&o&&(w.verbose("Adjusting input width",a,x.glyphWidth),F.css("width",a)),o||n&&l?(w.verbose("Hiding placeholder text"),I.addClass(C.filtered)):(!e||n&&!l)&&(w.verbose("Showing placeholder text"),I.removeClass(C.filtered))},placeholderText:function(e){w.debug("Restoring placeholder text"),e=e||O.data(y.placeholderText),w.set.text(placeholderText),I.addClass(C.placeholder)},tabbable:function(){w.has.search()?(w.debug("Searchable dropdown initialized"),F.val("").attr("tabindex",0),M.attr("tabindex","-1")):(w.debug("Simple selection dropdown initialized"),O.attr("tabindex")||(O.attr("tabindex",0),M.attr("tabindex","-1")))},scrollPosition:function(e,t){var n,o,a,l,r,s,c,u,d,v=5;e=e||w.get.activeItem(),n=e&&e.length>0,t=t!==i?t:!1,e&&n&&(M.hasClass(C.visible)||M.addClass(C.loading),c=M.height(),a=e.height(),s=M.scrollTop(),r=M.offset().top,l=e.offset().top,o=s-r+l,d=o+v>s+c,u=s>o-v,w.debug("Scrolling to active item",o),(u||d||t)&&M.scrollTop(o).removeClass(C.loading))},text:function(e){"select"!==x.action?(w.debug("Changing text",e,I),I.removeClass(C.filtered).removeClass(C.placeholder),x.preserveHTML?I.html(e):I.text(e)):"combo"==x.action&&(w.debug("Changing combo button text",e,L),x.preserveHTML?L.html(e):L.text(e))},value:function(t,n,i){var o=(q.length>0,w.get.values());if(q.length>0){if(w.is.multiple()&&(t=[t],e.isArray(o)&&(t=o.concat(t),t=w.get.uniqueArray(t)),q.is("select")?w.debug("Setting multiple modified, recreating menu"),w.setup.select()}),b=new MutationObserver(function(){w.debug("Menu modified, updating selector cache"),w.refresh()}),w.has.input()&&p.observe(q[0],{childList:!0,subtree:!0}),w.has.menu()&&b.observe(M[0],{childList:!0,subtree:!0}),w.debug("Setting up mutation observer",p,b))},create:{id:function(){g=(Math.random().toString(16)+"000000000").substr(2,8),m="."+g,w.verbose("Creating unique id for element",g)}},search:function(){var e;e=F.val(),w.verbose("Searching for query",e),w.filter(e),w.is.searchSelection()&&w.can.show()&&w.show()},select:{firstUnfiltered:function(){w.remove.selectedItem(),R.not("."+C.filtered).eq(0).addClass(C.selected)},nextAvailable:function(e){e=e.eq(0);var t=e.nextAll(T.item).not("."+C.filtered).eq(0),n=e.prevAll(T.item).not("."+C.filtered).eq(0),i=t.length>0;i?(w.verbose("Moving selection to",t),t.addClass(C.selected)):(w.verbose("Moving selection to",n),n.addClass(C.selected))}},setup:{layout:function(){I.is("select")&&w.setup.select(),w.is.search()&&!w.has.search()&&(F=e("").addClass(C.search).insertBefore(O)),x.allowTab&&w.set.tabbable()},select:function(){var t=w.get.selectValues();w.debug("Dropdown initialized on a select",t),I.is("select")&&(q=I),q.parent(T.dropdown).length>0?(w.debug("UI dropdown already exists. Creating dropdown menu only"),I=q.closest(T.dropdown),M=I.children(T.menu),0===M.length&&(M=e("
").addClass(C.menu).appendTo(I)),M.html(A.menu(t))):(w.debug("Creating entire dropdown from select"),I=e("
").attr("class",q.attr("class")).addClass(C.selection).addClass(C.dropdown).html(A.dropdown(t)).insertBefore(q),q.removeAttr("class").detach().prependTo(I)),q.is("[multiple]")&&w.set.multiple(),w.refresh()},reference:function(){var e,t,n=l.index(I);w.debug("Dropdown behavior was called on select, replacing with closest dropdown"),I=I.parent(T.dropdown),w.refresh(),e=l.slice(0,n),t=l.slice(n+1),l=e.add(I).add(t),f&&(H=w,w.invoke(v))}},refresh:function(){w.verbose("Refreshing selector cache"),O=I.find(T.text),F=I.find(T.search),q=I.find(T.input),V=I.find(T.icon),L=I.prev().find(T.text).length>0?I.prev().find(T.text):I.prev(),M=I.children(T.menu),R=M.find(T.item)},toggle:function(){w.verbose("Toggling menu visibility"),w.is.active()?w.hide():w.show()},show:function(t){t=e.isFunction(t)?t:function(){},w.is.searchSelection()&&w.is.allFiltered()||w.can.show()&&!w.is.active()&&(w.debug("Showing dropdown"),w.is.multiple()&&w.is.searchSelection()&&w.filterActive(),w.animate.show(function(){w.can.click()&&w.bind.intent(),w.set.visible(),t.call(j)}),x.onShow.call(j))},hide:function(t){t=e.isFunction(t)?t:function(){},w.is.active()&&(w.debug("Hiding dropdown"),w.animate.hide(function(){w.remove.visible(),t.call(j)}),x.onHide.call(j))},hideOthers:function(){w.verbose("Finding other dropdowns to hide"),l.not(I).has(T.menu+":visible:not(."+C.animating+")").dropdown("hide")},hideMenu:function(){w.verbose("Hiding menu instantaneously"),w.remove.active(),w.remove.visible(),M.transition("hide")},hideSubMenus:function(){var e=M.children(T.item).find(T.menu);w.verbose("Hiding sub menus",e),e.transition("hide")},bind:{keyboardEvents:function(){w.debug("Binding keyboard events"),I.on("keydown"+D,w.event.keydown),w.has.search()&&I.on(w.get.inputEvent()+D,T.search,w.event.input),w.is.multiple()&&r.on("keydown"+m,w.event.document.keydown)},touchEvents:function(){w.debug("Touch device detected binding additional touch events"),w.is.searchSelection()||I.on("touchstart"+D,w.event.test.toggle),M.on("touchstart"+D,T.item,w.event.item.mouseenter)},mouseEvents:function(){w.verbose("Mouse detected binding mouse events"),w.is.multiple()&&I.on("click"+D,T.label,w.event.label.click).on("click"+D,T.remove,w.event.remove.click),w.is.searchSelection()?(I.on("mousedown"+D,T.menu,w.event.menu.mousedown).on("mouseup"+D,T.menu,w.event.menu.mouseup).on("click"+D,T.search,w.show).on("focus"+D,T.search,w.event.search.focus).on("blur"+D,T.search,w.event.search.blur).on("click"+D,T.text,w.event.text.focus),w.is.multiple()&&I.on("click"+D,w.event.click)):("click"==x.on?I.on("click"+D,w.event.test.toggle):"hover"==x.on?I.on("mouseenter"+D,w.delay.show).on("mouseleave"+D,w.delay.hide):I.on(x.on+D,w.toggle),I.on("mousedown"+D,w.event.mousedown).on("mouseup"+D,w.event.mouseup).on("focus"+D,w.event.focus).on("blur"+D,w.event.blur)),M.on("mouseenter"+D,T.item,w.event.item.mouseenter).on("mouseleave"+D,T.item,w.event.item.mouseleave).on("click"+D,T.item,w.event.item.click)},intent:function(){w.verbose("Binding hide intent event to document"),c&&r.on("touchstart"+m,w.event.test.touch).on("touchmove"+m,w.event.test.touch),r.on("click"+m,w.event.test.hide)}},unbind:{intent:function(){w.verbose("Removing hide intent event from document"),c&&r.off("touchstart"+m).off("touchmove"+m),r.off("click"+m)}},filter:function(t){var n=e(),i=w.escape.regExp(t),o=new RegExp("^"+i,"igm"),a=new RegExp(i,"ig");w.verbose("Searching for matching values"),R.each(function(){var t,i,l=e(this);if("both"==x.match||"text"==x.match){if(t=String(w.get.choiceText(l,!1)),t.match(o))return n=n.add(l),!0;if(x.fullTextSearch&&t.match(a))return n=n.add(l),!0}if("both"==x.match||"value"==x.match){if(i=String(w.get.choiceValue(l,t)),i.match(o))return n=n.add(l),!0;if(x.fullTextSearch&&i.match(a))return n=n.add(l),!0}}),w.debug("Setting filter",t),w.remove.filteredItem(),R.not(n).addClass(C.filtered),w.is.multiple()&&w.filterActive(),w.verbose("Selecting first non-filtered element"),w.select.firstUnfiltered(),w.is.allFiltered()&&(w.debug("All items filtered, hiding dropdown",t),w.is.searchSelection()&&w.hideMenu(),x.onNoResults.call(j,t))},filterActive:function(){x.hideSelections&&R.filter("."+C.active).addClass(C.filtered)},focusSearch:function(){w.is.search()&&!w.is.focusedOnSearch()&&F[0].focus()},forceSelection:function(){var e=R.not(C.filtered).filter("."+C.selected).eq(0),t=R.not(C.filtered).filter("."+C.active).eq(0),n=e.length>0?e:t,i=n.size()>0;i?(w.debug("Forcing partial selection to selected item",n),w.event.item.click.call(n),w.remove.filteredItem()):w.hide()},event:{focus:function(){x.showOnFocus&&!P&&w.is.hidden()&&w.show()},click:function(t){var n=e(t.target);!n.is(I)&&!n.is(V)||w.is.focusedOnSearch()||F.focus()},blur:function(){var e=n.activeElement===this;P||e||(w.remove.activeLabel(),w.hide())},mousedown:function(){P=!0},mouseup:function(){P=!1},search:{focus:function(){P=!0,w.is.multiple()&&w.remove.activeLabel(),x.showOnFocus&&w.show()},blur:function(){var e=n.activeElement===this;z||e||(w.is.multiple()?w.remove.activeLabel():x.forceSelection?w.forceSelection():w.hide())}},text:{focus:function(){P=!0,F.focus()}},input:function(){(w.is.multiple()||w.is.searchSelection())&&w.set.filtered(),clearTimeout(w.timer),w.timer=setTimeout(w.search,x.delay.search)},label:{click:function(t){var n=e(this),i=I.find(T.label),o=i.filter("."+C.active),a=n.nextAll("."+C.active),l=n.prevAll("."+C.active),r=a.length>0?n.nextUntil(a).add(o).add(n):n.prevUntil(l).add(o).add(n);t.shiftKey?(o.removeClass(C.active),r.addClass(C.active)):t.ctrlKey?n.toggleClass(C.active):(o.removeClass(C.active),n.addClass(C.active)),x.onLabelSelect.apply(this,i.filter("."+C.active))}},remove:{click:function(){var t=e(this).parent();t.hasClass(C.active)?w.remove.labels():w.remove.labels(t)}},test:{toggle:function(e){var t=w.is.multiple()?w.show:w.toggle;w.determine.eventOnElement(e,t)&&e.preventDefault()},touch:function(e){w.determine.eventOnElement(e,function(){"touchstart"==e.type?w.timer=setTimeout(w.hide,x.delay.touch):"touchmove"==e.type&&clearTimeout(w.timer)}),e.stopPropagation()},hide:function(e){w.determine.eventInModule(e,w.hide)}},menu:{mousedown:function(){z=!0},mouseup:function(){z=!1}},item:{mouseenter:function(t){var n=e(this).children(T.menu),i=e(this).siblings(T.item).children(T.menu);n.length>0&&(clearTimeout(w.itemTimer),w.itemTimer=setTimeout(function(){w.verbose("Showing sub-menu",n),e.each(i,function(){w.animate.hide(!1,e(this))}),w.animate.show(!1,n)},x.delay.show),t.preventDefault())},mouseleave:function(){var t=e(this).children(T.menu);t.length>0&&(clearTimeout(w.itemTimer),w.itemTimer=setTimeout(function(){w.verbose("Hiding sub-menu",t),w.animate.hide(!1,t)},x.delay.hide))},click:function(t){var n=e(this),i=e(t?t.target:""),o=n.find(T.menu),a=w.get.choiceText(n),l=w.get.choiceValue(n,a),r=o.length>0,s=o.find(i).length>0;s||r&&!x.allowCategorySelection||w.determine.selectAction.call(this,a,l)}},document:{keydown:function(e){var t=e.which,n=w.get.shortcutKeys(),i=w.is.inObject(t,n);if(i){var o=I.find(T.label),a=o.filter("."+C.active),l=a.data("value"),r=o.index(a),s=o.length,c=a.length>0,d=a.length>1,u=0==r,v=r+1==s,f=w.is.searchSelection(),h=w.is.focusedOnSearch(),m=w.is.focused(),g=h&&0==w.get.caretPosition();h&&t==n.delimiter?w.is.visible()&&(w.verbose("Delimiter key pressed. Tokenizing"),e.preventDefault()):t==n.leftArrow?!m&&!g||c?c&&(e.shiftKey?w.verbose("Adding previous label to selection"):(w.verbose("Selecting previous label"),o.removeClass(C.active)),u&&!d?a.addClass(C.active):a.prev(T.siblingLabel).addClass(C.active).end(),e.preventDefault()):(w.verbose("Selecting previous label"),o.last().addClass(C.active)):t==n.rightArrow?(m&&!c&&o.first().addClass(C.active),c&&(e.shiftKey?w.verbose("Adding next label to selection"):(w.verbose("Selecting next label"),o.removeClass(C.active)),v?f&&!h?w.focusSearch():d?a.next(T.siblingLabel).addClass(C.active):a.addClass(C.active):a.next(T.siblingLabel).addClass(C.active),e.preventDefault())):t==n.deleteKey||t==n.backspace?c?(w.verbose("Removing active labels"),v&&f&&!h&&w.focusSearch(),a.last().next(T.siblingLabel).addClass(C.active),w.remove.labels(a),e.preventDefault()):g&&!c&&t==n.backspace&&(w.verbose("Removing last label on input backspace"),a=o.last().addClass(C.active),l=a.data("value"),w.remove.selected(l),e.preventDefault()):a.removeClass(C.active)}}},keydown:function(e){var t=e.which,n=w.get.shortcutKeys(),i=w.is.inObject(t,n);if(i){var o,a,l=R.not("."+C.filtered).filter("."+C.selected).eq(0),r=M.children("."+C.active).eq(0),s=l.length>0?l:r,c=s.length>0?s.siblings(":not(."+C.filtered+")").andSelf():M.children(":not(."+C.filtered+")"),d=s.children(T.menu),u=s.closest(T.menu),v=u.hasClass(C.visible)||u.hasClass(C.animating),f=d.length>0,h=s.length>0,m=s.not("."+T.filtered).length>0;if(w.is.visible()){if(t==n.enter&&h&&(f&&!x.allowCategorySelection?(w.verbose("Pressed enter on unselectable category, opening sub menu"),t=n.rightArrow):m&&(w.verbose("Enter key pressed, choosing selected item"),w.event.item.click.call(s,e),e.stopImmediatePropagation()),e.preventDefault()),t==n.leftArrow&&(a=u[0]!==M[0],a&&(w.verbose("Left key pressed, closing sub-menu"),w.animate.hide(!1,u),s.removeClass(C.selected),u.closest(T.item).addClass(C.selected),e.preventDefault())),t==n.rightArrow&&f&&(w.verbose("Right key pressed, opening sub-menu"),w.animate.show(!1,d),s.removeClass(C.selected),d.find(T.item).eq(0).addClass(C.selected),e.preventDefault()),t==n.upArrow){if(o=h&&v?s.prevAll(T.item+":not(."+C.filtered+")").eq(0):R.eq(0),c.index(o)<0)return w.verbose("Up key pressed but reached top of current menu"),void e.preventDefault();w.verbose("Up key pressed, changing active item"),s.removeClass(C.selected),o.addClass(C.selected),w.set.scrollPosition(o),e.preventDefault()}if(t==n.downArrow){if(o=h&&v?o=s.nextAll(T.item+":not(."+C.filtered+")").eq(0):R.eq(0),0===o.length)return w.verbose("Down key pressed but reached bottom of current menu"),void e.preventDefault();w.verbose("Down key pressed, changing active item"),R.removeClass(C.selected),o.addClass(C.selected),w.set.scrollPosition(o),e.preventDefault()}t==n.escape&&(w.verbose("Escape key pressed, closing dropdown"),w.hide())}else t==n.enter&&(w.verbose("Enter key pressed, showing dropdown"),w.show(),e.preventDefault()),t==n.downArrow&&(w.verbose("Down key pressed, showing dropdown"),w.show(),e.preventDefault())}}},determine:{selectAction:function(t,n){w.verbose("Determining action",x.action),e.isFunction(w.action[x.action])?(w.verbose("Triggering preset action",x.action,t,n),w.action[x.action].call(this,t,n)):e.isFunction(x.action)?(w.verbose("Triggering user action",x.action,t,n),x.action.call(this,t,n)):w.error(k.action,x.action)},eventInModule:function(t,n){return n=e.isFunction(n)?n:function(){},0===e(t.target).closest(I).length?(w.verbose("Triggering event",n),n(),!0):(w.verbose("Event occurred in dropdown, canceling callback"),!1)},eventOnElement:function(t,n){var i=e(t.target);return n=e.isFunction(n)?n:function(){},0==i.closest(M).length?(w.verbose("Triggering event",n),n(),!0):(w.verbose("Event occurred in dropdown menu, canceling callback"),!1)}},action:{nothing:function(){},activate:function(t,n){n=n!==i?n:t,w.set.selected(n,e(this)),(!w.is.multiple()||w.is.allFiltered())&&w.hideAndClear()},select:function(){w.action.activate.call(this)},combo:function(t,n){n=n!==i?n:t,w.set.selected(n,e(this)),w.hideAndClear()},hide:function(){w.hideAndClear()}},get:{id:function(){return g},text:function(){return O.text()},uniqueArray:function(t){return e.grep(t,function(n,i){return e.inArray(n,t)===i})},caretPosition:function(){var e,t,i=F.get(0);return"selectionStart"in i?i.selectionStart:n.selection?(i.focus(),e=n.selection.createRange(),t=e.text.length,e.moveStart("character",-i.value.length),e.text.length-t):void 0},shortcutKeys:function(){return{backspace:8,delimiter:188,deleteKey:46,enter:13,escape:27,leftArrow:37,upArrow:38,rightArrow:39,downArrow:40}},value:function(){return q.length>0?q.val():I.data(y.value)},values:function(){var e=w.get.value();return""==e?"":!q.is("select")&&w.is.multiple()?e.split(x.delimiter):e},choiceText:function(e,t){return t=t!==i?t:x.preserveHTML,e?(e.find(T.menu).length>0&&(w.verbose("Retreiving text of element with sub-menu"),e=e.clone(),e.find(T.menu).remove(),e.find(T.menuIcon).remove()),e.data(y.text)!==i?e.data(y.text):t?e.html().trim():e.text().trim()):void 0},choiceValue:function(e,t){return t=t||w.get.choiceText(e),e?e.data(y.value)!==i?e.data(y.value):"string"==typeof t?t.toLowerCase().trim():t:!1},inputEvent:function(){var e=F[0];return e?e.oninput!==i?"input":e.onpropertychange!==i?"propertychange":"keyup":!1},selectValues:function(){var t={};return t.values=x.sortSelect?{}:[],I.find("option").each(function(){var n=e(this).html(),o=e(this).attr("value")!==i?e(this).attr("value"):n;"auto"===x.placeholder&&""===o?t.placeholder=n:x.sortSelect?t.values[o]={name:n,value:o}:t.values.push({name:n,value:o})}),x.placeholder&&"auto"!==x.placeholder&&(w.debug("Setting placeholder value to",x.placeholder),t.placeholder=x.placeholder),x.sortSelect?w.debug("Retrieved and sorted values from select",t):w.debug("Retreived values from select",t),t},activeItem:function(){return R.filter("."+C.active)},item:function(t,n){var o,a=!1;return t=t!==i?t:w.get.values()!==i?w.get.values():w.get.text(),o=w.is.multiple()&&e.isArray(t),n=""===t||0===t?!0:n||!1,t!==i&&R.each(function(){var i=e(this),l=w.get.choiceText(i),r=w.get.choiceValue(i,l);if(o)(-1!==e.inArray(r.toString(),t)||-1!==e.inArray(l,t))&&(a=a?a.add(i):i);else if(n){if(w.verbose("Ambiguous dropdown value using strict type check",i,t),r===t||l===t)return a=i,!0}else if(r==t||l==t)return w.verbose("Found select item by value",r,t),a=i,!0}),a}},restore:{defaults:function(){w.restore.defaultText(),w.restore.defaultValue()},defaultText:function(){var e=I.data(y.defaultText);w.debug("Restoring default text",e),w.set.text(e),O.addClass(C.placeholder)},defaultValue:function(){var e=I.data(y.defaultValue);e!==i&&(w.debug("Restoring default value",e),e.length?w.set.selected(e):(w.remove.activeItem(),w.remove.selectedItem()))}},save:{defaults:function(){w.save.defaultText(),w.save.placeholderText(),w.save.defaultValue()},defaultValue:function(){I.data(y.defaultValue,w.get.value())},defaultText:function(){I.data(y.defaultText,O.text())},placeholderText:function(){O.hasClass(C.placeholder)&&I.data(y.placeholderText,O.text())}},clear:function(){w.set.placeholderText(),w.clearValue(),w.remove.activeItem(),w.remove.selectedItem()},clearValue:function(){w.set.value("")},set:{filtered:function(){var e=w.is.multiple(),t=w.is.searchSelection(),n=e&&t,i=t?F.val():"",o="string"==typeof i&&i.length>0,a=i.length*x.glyphWidth+"em",l=""!=q.val();e&&o&&(w.verbose("Adjusting input width",a,x.glyphWidth),F.css("width",a)),o||n&&l?(w.verbose("Hiding placeholder text"),O.addClass(C.filtered)):(!e||n&&!l)&&(w.verbose("Showing placeholder text"),O.removeClass(C.filtered))},placeholderText:function(e){w.debug("Restoring placeholder text"),e=e||I.data(y.placeholderText),w.set.text(placeholderText),O.addClass(C.placeholder)},tabbable:function(){w.has.search()?(w.debug("Searchable dropdown initialized"),F.val("").attr("tabindex",0),M.attr("tabindex","-1")):(w.debug("Simple selection dropdown initialized"),I.attr("tabindex")||(I.attr("tabindex",0),M.attr("tabindex","-1")))},scrollPosition:function(e,t){var n,o,a,l,r,s,c,d,u,v=5;e=e||w.get.activeItem(),n=e&&e.length>0,t=t!==i?t:!1,e&&n&&(M.hasClass(C.visible)||M.addClass(C.loading),c=M.height(),a=e.height(),s=M.scrollTop(),r=M.offset().top,l=e.offset().top,o=s-r+l,u=o+v>s+c,d=s>o-v,w.debug("Scrolling to active item",o),(d||u||t)&&M.scrollTop(o).removeClass(C.loading))},text:function(e){"select"!==x.action?(w.debug("Changing text",e,O),O.removeClass(C.filtered).removeClass(C.placeholder),x.preserveHTML?O.html(e):O.text(e)):"combo"==x.action&&(w.debug("Changing combo button text",e,L),x.preserveHTML?L.html(e):L.text(e))},value:function(t,n,i){var o=(q.length>0,w.get.values());if(q.length>0){if(w.is.multiple()&&(t=[t],e.isArray(o)&&(t=o.concat(t),t=w.get.uniqueArray(t)),q.is("select")?w.debug("Setting multiple removing selected"),q.find('option[value="'+i+'"]').prop("selected",!1)):(w.verbose("Input is csv removing value"),n=w.remove.delimitedValue(i,n),q.val(n).trigger("change")),w.is.multiple()&&w.remove.label(i),t.removeClass(C.filtered).removeClass(C.active),x.hideSelections||t.removeClass(C.selected))},selectedItem:function(){R.removeClass(C.selected)},delimitedValue:function(t,n){return"string"!=typeof n?!1:(n=n.split(x.delimiter),n=e.grep(n,function(e){return t!=e}),n=n.join(x.delimiter),w.verbose("Removed value from delimited string",t,n),n)},label:function(e){var t=I.find(T.label),n=t.filter('[data-value="'+e+'"]'),i=t.length,o=t.index(n)+1==i,a=1==i,l=a||o;l?(w.verbose("Animating and removing label",n),n.transition(x.label.transition,x.label.duration,function(){n.remove()})):(w.verbose("Removing label",n),n.remove())},labels:function(t){t=t||I.find(T.label).filter("."+C.active),w.verbose("Removing active labels",t),t.each(function(){w.remove.selected(e(this).data("value"))})},tabbable:function(){w.has.search()?(w.debug("Searchable dropdown initialized"),F.attr("tabindex","-1"),M.attr("tabindex","-1")):(w.debug("Simple selection dropdown initialized"),I.attr("tabindex","-1"),M.attr("tabindex","-1"))}},has:{search:function(){return F.length>0},input:function(){return q.length>0},menu:function(){return M.length>0}},is:{active:function(){return I.hasClass(C.active)},alreadySetup:function(){return I.is("select")&&I.parent(T.dropdown).length>0},animating:function(e){return e?e.transition&&e.transition("is animating"):M.transition&&M.transition("is animating")},focused:function(){return n.activeElement===I[0]},focusedOnSearch:function(){return n.activeElement===F[0]},allFiltered:function(){return R.filter("."+C.filtered).length===R.length},hidden:function(e){return e?e.is(":hidden"):M.is(":hidden")},inObject:function(t,n){var i=!1;return e.each(n,function(e,n){return n==t?(i=!0,!0):void 0}),i},multiple:function(){return I.hasClass(C.multiple)},single:function(){return!w.is.multiple()},selectMutation:function(t){var n=!1;return e.each(t,function(t,i){return i.target&&e(i.target).is("select")?(n=!0,!0):void 0}),n},search:function(){return I.hasClass(C.search)},searchSelection:function(){return w.has.search()&&0==F.closest(T.menu).length},selection:function(){return I.hasClass(C.selection)},upward:function(){return I.hasClass(C.upward)},visible:function(e){return e?e.is(":visible"):M.is(":visible")}},can:{click:function(){return c||"click"==x.on},show:function(){return!I.hasClass(C.disabled)}},animate:{show:function(t,n){var o=n||M,a=n?function(){}:function(){w.hideSubMenus(),w.hideOthers(),w.set.active()};t=e.isFunction(t)?t:function(){},w.is.single()&&w.set.scrollPosition(w.get.activeItem(),!0),w.verbose("Doing menu show animation",o),(w.is.hidden(o)||w.is.animating(o))&&("auto"==x.transition&&(x.transition=w.is.upward()?"slide up":"slide down",w.verbose("Automatically determining animation based on animation direction",x.transition)),"none"==x.transition?(a(),o.transition("show"),t.call(j)):e.fn.transition!==i&&I.transition("is supported")?o.transition({animation:x.transition+" in",debug:x.debug,verbose:x.verbose,duration:x.duration,queue:!0,onStart:a,onComplete:function(){t.call(j)}}):w.error(k.noTransition,x.transition))},hide:function(t,n){var o=n||M,a=(n?.9*x.duration:x.duration,n?function(){}:function(){w.can.click()&&w.unbind.intent(),w.focusSearch(),w.remove.active()});t=e.isFunction(t)?t:function(){},(w.is.visible(o)||w.is.animating(o))&&(w.verbose("Doing menu hide animation",o),"auto"==x.transition&&(x.transition=w.is.upward()?"slide up":"slide down"),"none"==x.transition?(a(),o.transition("hide"),t.call(j)):e.fn.transition!==i&&I.transition("is supported")?o.transition({animation:x.transition+" out",duration:x.duration,debug:x.debug,verbose:x.verbose,queue:!0,onStart:a,onComplete:function(){t.call(j)}}):w.error(k.transition))}},hideAndClear:function(){w.is.searchSelection()?(w.remove.searchTerm(),w.hide(function(){w.remove.filteredItem()})):w.hide()},delay:{show:function(){w.verbose("Delaying show event to ensure user intent"),clearTimeout(w.timer),w.timer=setTimeout(w.show,x.delay.show)},hide:function(){w.verbose("Delaying hide event to ensure user intent"),clearTimeout(w.timer),w.timer=setTimeout(w.hide,x.delay.hide)}},escape:{regExp:function(e){return e=String(e),e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&")}},setting:function(t,n){if(w.debug("Changing setting",t,n),e.isPlainObject(t))e.extend(!0,x,t);else{if(n===i)return x[t];x[t]=n}},internal:function(t,n){if(e.isPlainObject(t))e.extend(!0,w,t);else{if(n===i)return w[t];w[t]=n}},debug:function(){x.debug&&(x.performance?w.performance.log(arguments):(w.debug=Function.prototype.bind.call(console.info,console,x.name+":"),w.debug.apply(console,arguments)))},verbose:function(){x.verbose&&x.debug&&(x.performance?w.performance.log(arguments):(w.verbose=Function.prototype.bind.call(console.info,console,x.name+":"),w.verbose.apply(console,arguments)))},error:function(){w.error=Function.prototype.bind.call(console.error,console,x.name+":"),w.error.apply(console,arguments)},performance:{log:function(e){var t,n,i;x.performance&&(t=(new Date).getTime(),i=d||t,n=t-i,d=t,u.push({Name:e[0],Arguments:[].slice.call(e,1)||"",Element:j,"Execution Time":n})),clearTimeout(w.performance.timer),w.performance.timer=setTimeout(w.performance.display,500)},display:function(){var t=x.name+":",n=0;d=!1,clearTimeout(w.performance.timer),e.each(u,function(e,t){n+=t["Execution Time"]}),t+=" "+n+"ms",s&&(t+=" '"+s+"'"),(console.group!==i||console.table!==i)&&u.length>0&&(console.groupCollapsed(t),console.table?console.table(u):e.each(u,function(e,t){console.log(t.Name+": "+t["Execution Time"]+"ms")}),console.groupEnd()),u=[]}},invoke:function(t,n,o){var l,r,s,c=H;return n=n||h,o=j||o,"string"==typeof t&&c!==i&&(t=t.split(/[\. ]/),l=t.length-1,e.each(t,function(n,o){var a=n!=l?o+t[n+1].charAt(0).toUpperCase()+t[n+1].slice(1):t;if(e.isPlainObject(c[a])&&n!=l)c=c[a];else{if(c[a]!==i)return r=c[a],!1;if(!e.isPlainObject(c[o])||n==l)return c[o]!==i?(r=c[o],!1):(w.error(k.method,t),!1);c=c[o]}})),e.isFunction(r)?s=r.apply(o,n):r!==i&&(s=r),e.isArray(a)?a.push(s):a!==i?a=[a,s]:s!==i&&(a=s),r}},f?(H===i&&w.initialize(),w.invoke(v)):(H!==i&&H.invoke("destroy"),w.initialize())}),a!==i?a:l},e.fn.dropdown.settings={debug:!1,verbose:!1,performance:!0,on:"click",action:"activate",allowTab:!0,showOnFocus:!0,fullTextSearch:!1,placeholder:"auto",preserveHTML:!0,sortSelect:!1,match:"both",allowCategorySelection:!1,delay:{hide:300,show:200,search:50,touch:50},forceSelection:!0,transition:"auto",duration:250,glyphWidth:1.0714,allowAdditions:!0,delimiter:",",label:{transition:"horizontal flip",duration:150,variation:!1},hideSelections:!0,onLabelSelect:function(){},onNoResults:function(){},onChange:function(){},onShow:function(){},onHide:function(){},name:"Dropdown",namespace:"dropdown",error:{action:"You called a dropdown action that was not defined",alreadySetup:"Once a select has been initialized behaviors must be called on the created ui dropdown",method:"The method you called is not defined.",noTransition:"This module requires ui transitions "},metadata:{defaultText:"defaultText",defaultValue:"defaultValue",placeholderText:"placeholderText",text:"text",value:"value"},selector:{dropdown:".ui.dropdown",icon:"> .dropdown.icon",input:'> input[type="hidden"], > select',item:".item",label:"> .label",remove:"> .label > .delete.icon",siblingLabel:".label",menu:".menu",menuIcon:".dropdown.icon",search:"input.search, .menu > .search > input",text:"> .text:not(.icon)"},className:{active:"active",animating:"animating",disabled:"disabled",dropdown:"ui dropdown",filtered:"filtered",hidden:"hidden transition",label:"ui label",loading:"loading",menu:"menu",multiple:"multiple",placeholder:"default",search:"search",selected:"selected",selection:"selection",upward:"upward",visible:"visible"}},e.fn.dropdown.settings.templates={menu:function(t){var n=(t.placeholder||!1,t.values||{},"");return e.each(t.values,function(e,t){n+='
'+t.name+"
"}),n},label:function(e,t){return t+''},dropdown:function(t){var n=t.placeholder||!1,i=(t.values||{},"");return i+='',i+=t.placeholder?'
'+n+"
":'
',i+='"}},e.extend(e.easing,{easeOutQuad:function(e,t,n,i,o){return-i*(t/=o)*(t-2)+n}})}(jQuery,window,document); \ No newline at end of file diff --git a/dist/components/search.js b/dist/components/search.js index 1fb8c7737..74a617253 100644 --- a/dist/components/search.js +++ b/dist/components/search.js @@ -425,13 +425,13 @@ $.fn.search = function(parameters) { : [settings.searchFields], // avoid duplicates when pushing results - addResult = function(array, value) { + addResult = function(array, content) { var notResult = ($.inArray(content, results) == -1), notFuzzyResult = ($.inArray(content, fuzzyResults) == -1) ; if(notResult && notFuzzyResult) { - array.push(value); + array.push(content); } } ; diff --git a/dist/components/search.min.js b/dist/components/search.min.js index e81326c57..245f70a28 100644 --- a/dist/components/search.min.js +++ b/dist/components/search.min.js @@ -8,4 +8,4 @@ * http://opensource.org/licenses/MIT * */ -!function(e,t,s,n){"use strict";e.fn.search=function(r){var a,i=e(this),o=i.selector||"",c=(new Date).getTime(),u=[],l=arguments[0],d="string"==typeof l,f=[].slice.call(arguments,1);return e(this).each(function(){var g,p=e.extend(!0,{},e.fn.search.settings,r),m=p.className,h=p.metadata,v=p.regExp,b=p.selector,y=p.error,R=p.namespace,w="."+R,C=R+"-module",x=e(this),k=x.find(b.prompt),A=x.find(b.searchButton),q=x.find(b.results),S=(x.find(b.result),x.find(b.category),this),E=x.data(C);g={initialize:function(){g.verbose("Initializing module");var e=k[0],t=e!==n&&e.oninput!==n?"input":e!==n&&e.onpropertychange!==n?"propertychange":"keyup";p.automatic&&(x.on(t+w,b.prompt,g.throttle),k.attr("autocomplete","off")),x.on("focus"+w,b.prompt,g.event.focus).on("blur"+w,b.prompt,g.event.blur).on("keydown"+w,b.prompt,g.handleKeyboard).on("click"+w,b.searchButton,g.query).on("mousedown"+w,b.results,g.event.result.mousedown).on("mouseup"+w,b.results,g.event.result.mouseup).on("click"+w,b.result,g.event.result.click),g.instantiate()},instantiate:function(){g.verbose("Storing instance of module",g),E=g,x.data(C,g)},destroy:function(){g.verbose("Destroying instance"),x.off(w).removeData(C)},event:{focus:function(){g.set.focus(),g.has.minimumCharacters()&&g.showResults()},blur:function(){var e=s.activeElement===this;e||g.resultsClicked||(g.cancel.query(),g.remove.focus(),g.timer=setTimeout(g.hideResults,p.hideDelay))},result:{mousedown:function(){g.resultsClicked=!0},mouseup:function(){g.resultsClicked=!1},click:function(s){g.debug("Search result selected");var n=e(this),r=n.find(b.title).eq(0),a=n.find("a[href]").eq(0),i=a.attr("href")||!1,o=a.attr("target")||!1,c=(r.html(),r.length>0?r.text():!1),u=g.get.results(),l=g.get.result(c,u);return e.isFunction(p.onSelect)&&p.onSelect.call(S,l,u)===!1?void g.debug("Custom onSelect callback cancelled default select action"):(g.hideResults(),c&&g.set.value(c),void(i&&(g.verbose("Opening search link found in result",a),"_blank"==o||s.ctrlKey?t.open(i):t.location.href=i)))}}},handleKeyboard:function(e){var t,s=x.find(b.result),n=x.find(b.category),r=s.index(s.filter("."+m.active)),a=s.length,i=e.which,o={backspace:8,enter:13,escape:27,upArrow:38,downArrow:40};if(i==o.escape&&(g.verbose("Escape key pressed, blurring search field"),k.trigger("blur")),g.is.visible())if(i==o.enter){if(g.verbose("Enter key pressed, selecting active result"),s.filter("."+m.active).length>0)return g.event.result.click.call(s.filter("."+m.active),e),e.preventDefault(),!1}else i==o.upArrow?(g.verbose("Up key pressed, changing active result"),t=0>r-1?r:r-1,n.removeClass(m.active),s.removeClass(m.active).eq(t).addClass(m.active).closest(n).addClass(m.active),e.preventDefault()):i==o.downArrow&&(g.verbose("Down key pressed, changing active result"),t=r+1>=a?r:r+1,n.removeClass(m.active),s.removeClass(m.active).eq(t).addClass(m.active).closest(n).addClass(m.active),e.preventDefault());else i==o.enter&&(g.verbose("Enter key pressed, executing query"),g.query(),g.set.buttonPressed(),k.one("keyup",g.remove.buttonFocus))},setup:{api:function(){var e={debug:p.debug,on:!1,action:"search",onFailure:g.error};g.verbose("First request, initializing API"),x.api(e)}},can:{useAPI:function(){return e.fn.api!==n},transition:function(){return p.transition&&e.fn.transition!==n&&x.transition("is supported")}},is:{empty:function(){return""===q.html()},visible:function(){return q.filter(":visible").length>0},focused:function(){return k.filter(":focus").length>0}},get:{value:function(){return k.val()},results:function(){var e=x.data(h.results);return e},result:function(t,s){var n=!1;return t=t||g.get.value(),s=s||g.get.results(),"category"===p.type?(g.debug("Finding result that matches",t),e.each(s,function(s,r){return e.isArray(r.results)&&(n=g.search.object(t,r.results,!0)[0])?!1:void 0})):(g.debug("Finding result in results object",t),n=g.search.object(t,s,!0)[0]),n}},set:{focus:function(){x.addClass(m.focus)},loading:function(){x.addClass(m.loading)},value:function(e){g.verbose("Setting search input value",e),k.val(e),g.query()},buttonPressed:function(){A.addClass(m.pressed)}},remove:{loading:function(){x.removeClass(m.loading)},focus:function(){x.removeClass(m.focus)},buttonPressed:function(){A.removeClass(m.pressed)}},query:function(){var t=g.get.value(),s=g.read.cache(t);s?(g.debug("Reading result for "+t+" from cache"),g.save.results(s.results),g.addResults(s.html)):(g.debug("Querying for "+t),e.isPlainObject(p.source)||e.isArray(p.source)?g.search.local(t):g.can.useAPI()?g.search.remote(t):g.error(y.source),p.onSearchQuery.call(S,t))},search:{local:function(e){var t,s=g.search.object(e,p.content);g.set.loading(),g.save.results(s),g.debug("Returned local search results",s),t=g.generateResults({results:s}),g.remove.loading(),g.write.cache(e,{html:t,results:s}),g.addResults(t)},remote:function(t){var s={onSuccess:function(e){g.parse.response.call(S,e,t)},urlData:{query:t}};x.api("get request")||g.setup.api(),e.extend(!0,s,p.apiSettings),g.debug("Executing search",s),g.cancel.query(),x.api("setting",s).api("query")},object:function(t,s,r){var a=[],i=[],o=t.replace(v.escape,"\\$&"),c=new RegExp(v.beginsWith+o,"i"),u=e.isArray(p.searchFields)?p.searchFields:[p.searchFields],l=function(t,s){var n=-1==e.inArray(content,a),r=-1==e.inArray(content,i);n&&r&&t.push(s)};return s=s||p.source,s===n?(g.error(y.source),[]):(e.each(u,function(n,o){e.each(s,function(e,s){var n="string"==typeof s[o];n&&(r?s[o]==t&&l(a,s):s[o].match(c)?l(a,s):p.searchFullText&&g.fuzzySearch(t,s[o])&&l(i,s))})}),e.merge(a,i))}},fuzzySearch:function(e,t){var s=t.length,n=e.length;if(e=e.toLowerCase(),t=t.toLowerCase(),n>s)return!1;if(n===s)return e===t;e:for(var r=0,a=0;n>r;r++){for(var i=e.charCodeAt(r);s>a;)if(t.charCodeAt(a++)===i)continue e;return!1}return!0},parse:{response:function(e,t){var s=g.generateResults(e);g.verbose("Parsing server response",e),e!==n&&t!==n&&e.results!==n&&(g.write.cache(t,{html:s,results:e.results}),g.save.results(e.results),g.addResults(s))}},throttle:function(){clearTimeout(g.timer),g.has.minimumCharacters()?g.timer=setTimeout(g.query,p.searchDelay):g.hideResults()},cancel:{query:function(){g.can.useAPI()&&x.api("abort")}},has:{minimumCharacters:function(){var e=g.get.value(),t=e.length;return t>=p.minCharacters}},clear:{cache:function(e){e?e&&cache&&cache[e]&&(g.debug("Removing value from cache",e),delete cache[e],x.data(h.cache,cache)):(g.debug("Clearing cache",e),x.removeData(h.cache))}},read:{cache:function(e){var t=x.data(h.cache);return p.cache?(g.verbose("Checking cache for generated html for query",e),"object"==typeof t&&t[e]!==n?t[e]:!1):!1}},save:{results:function(e){g.verbose("Saving current search results to metadata",e),x.data(h.results,e)}},write:{cache:function(e,t){var s=x.data(h.cache)!==n?x.data(h.cache):{};p.cache&&(g.verbose("Writing generated html to cache",e,t),s[e]=t,x.data(h.cache,s))}},addResults:function(t){return e.isFunction(p.onResultsAdd)&&p.onResultsAdd.call(q,t)===!1?(g.debug("onResultsAdd callback cancelled default action"),!1):(q.html(t),void g.showResults())},showResults:function(){g.is.visible()||!g.is.focused()||g.is.empty()||(g.can.transition()?(g.debug("Showing results with css animations"),q.transition({animation:p.transition+" in",debug:p.debug,verbose:p.verbose,duration:p.duration,queue:!0})):(g.debug("Showing results with javascript"),q.stop().fadeIn(p.duration,p.easing)),p.onResultsOpen.call(q))},hideResults:function(){g.is.visible()&&(g.can.transition()?(g.debug("Hiding results with css animations"),q.transition({animation:p.transition+" out",debug:p.debug,verbose:p.verbose,duration:p.duration,queue:!0})):(g.debug("Hiding results with javascript"),q.stop().fadeOut(p.duration,p.easing)),p.onResultsClose.call(q))},generateResults:function(t){g.debug("Generating html from response",t);var s=p.templates[p.type],n=e.isPlainObject(t.results)&&!e.isEmptyObject(t.results),r=e.isArray(t.results)&&t.results.length>0,a="";return n||r?(p.maxResults>0&&(n?"standard"==p.type&&g.error(y.maxResults):t.results=t.results.slice(0,p.maxResults)),e.isFunction(s)?a=s(t):g.error(y.noTemplate,!1)):a=g.displayMessage(y.noResults,"empty"),p.onResults.call(S,t),a},displayMessage:function(e,t){return t=t||"standard",g.debug("Displaying message",e,t),g.addResults(p.templates.message(e,t)),p.templates.message(e,t)},setting:function(t,s){if(e.isPlainObject(t))e.extend(!0,p,t);else{if(s===n)return p[t];p[t]=s}},internal:function(t,s){if(e.isPlainObject(t))e.extend(!0,g,t);else{if(s===n)return g[t];g[t]=s}},debug:function(){p.debug&&(p.performance?g.performance.log(arguments):(g.debug=Function.prototype.bind.call(console.info,console,p.name+":"),g.debug.apply(console,arguments)))},verbose:function(){p.verbose&&p.debug&&(p.performance?g.performance.log(arguments):(g.verbose=Function.prototype.bind.call(console.info,console,p.name+":"),g.verbose.apply(console,arguments)))},error:function(){g.error=Function.prototype.bind.call(console.error,console,p.name+":"),g.error.apply(console,arguments)},performance:{log:function(e){var t,s,n;p.performance&&(t=(new Date).getTime(),n=c||t,s=t-n,c=t,u.push({Name:e[0],Arguments:[].slice.call(e,1)||"",Element:S,"Execution Time":s})),clearTimeout(g.performance.timer),g.performance.timer=setTimeout(g.performance.display,500)},display:function(){var t=p.name+":",s=0;c=!1,clearTimeout(g.performance.timer),e.each(u,function(e,t){s+=t["Execution Time"]}),t+=" "+s+"ms",o&&(t+=" '"+o+"'"),i.length>1&&(t+=" ("+i.length+")"),(console.group!==n||console.table!==n)&&u.length>0&&(console.groupCollapsed(t),console.table?console.table(u):e.each(u,function(e,t){console.log(t.Name+": "+t["Execution Time"]+"ms")}),console.groupEnd()),u=[]}},invoke:function(t,s,r){var i,o,c,u=E;return s=s||f,r=S||r,"string"==typeof t&&u!==n&&(t=t.split(/[\. ]/),i=t.length-1,e.each(t,function(s,r){var a=s!=i?r+t[s+1].charAt(0).toUpperCase()+t[s+1].slice(1):t;if(e.isPlainObject(u[a])&&s!=i)u=u[a];else{if(u[a]!==n)return o=u[a],!1;if(!e.isPlainObject(u[r])||s==i)return u[r]!==n?(o=u[r],!1):!1;u=u[r]}})),e.isFunction(o)?c=o.apply(r,s):o!==n&&(c=o),e.isArray(a)?a.push(c):a!==n?a=[a,c]:c!==n&&(a=c),o}},d?(E===n&&g.initialize(),g.invoke(l)):(E!==n&&E.invoke("destroy"),g.initialize())}),a!==n?a:this},e.fn.search.settings={name:"Search Module",namespace:"search",debug:!1,verbose:!1,performance:!0,type:"standard",minCharacters:1,apiSettings:!1,source:!1,searchFields:["title","description"],searchFullText:!0,automatic:!0,hideDelay:0,searchDelay:200,maxResults:7,cache:!0,transition:"scale",duration:300,easing:"easeOutExpo",onSelect:!1,onResultsAdd:!1,onSearchQuery:function(){},onResults:function(){},onResultsOpen:function(){},onResultsClose:function(){},className:{active:"active",empty:"empty",focus:"focus",loading:"loading",pressed:"down"},error:{source:"Cannot search. No source used, and Semantic API module was not included",noResults:"Your search returned no results",logging:"Error in debug logging, exiting.",noEndpoint:"No search endpoint was specified",noTemplate:"A valid template name was not specified.",serverError:"There was an issue with querying the server.",maxResults:"Results must be an array to use maxResults setting",method:"The method you called is not defined."},metadata:{cache:"cache",results:"results"},regExp:{escape:/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,beginsWith:"(?:s|^)"},selector:{prompt:".prompt",searchButton:".search.button",results:".results",category:".category",result:".result",title:".title, .name"},templates:{escape:function(e){var t=/[&<>"'`]/g,s=/[&<>"'`]/,n={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`"},r=function(e){return n[e]};return s.test(e)?e.replace(t,r):e},message:function(e,t){var s="";return e!==n&&t!==n&&(s+='
',s+="empty"==t?'
No Results
'+e+'
':'
'+e+"
",s+="
"),s},category:function(t){var s="",r=e.fn.search.settings.templates.escape;return t.results!==n?(e.each(t.results,function(t,a){a.results!==n&&a.results.length>0&&(s+='
'+a.name+"
",e.each(a.results,function(e,t){s+='
',t.url&&(s+=''),t.image!==n&&(t.image=r(t.image),s+='
'),s+='
',t.price!==n&&(t.price=r(t.price),s+='
'+t.price+"
"),t.title!==n&&(t.title=r(t.title),s+='
'+t.title+"
"),t.description!==n&&(s+='
'+t.description+"
"),s+="
"}),s+="
")}),t.action&&(s+=''+t.action.text+""),s):!1},standard:function(t){var s="";return t.results!==n?(e.each(t.results,function(e,t){s+=t.url?'':'',t.image!==n&&(s+='
'),s+='
',t.price!==n&&(s+='
'+t.price+"
"),t.title!==n&&(s+='
'+t.title+"
"),t.description!==n&&(s+='
'+t.description+"
"),s+="
",s+="
"}),t.action&&(s+=''+t.action.text+""),s):!1}}}}(jQuery,window,document); \ No newline at end of file +!function(e,t,s,r){"use strict";e.fn.search=function(n){var a,i=e(this),o=i.selector||"",c=(new Date).getTime(),u=[],l=arguments[0],d="string"==typeof l,f=[].slice.call(arguments,1);return e(this).each(function(){var g,p=e.extend(!0,{},e.fn.search.settings,n),m=p.className,h=p.metadata,v=p.regExp,b=p.selector,y=p.error,R=p.namespace,w="."+R,C=R+"-module",x=e(this),k=x.find(b.prompt),A=x.find(b.searchButton),q=x.find(b.results),S=(x.find(b.result),x.find(b.category),this),E=x.data(C);g={initialize:function(){g.verbose("Initializing module");var e=k[0],t=e!==r&&e.oninput!==r?"input":e!==r&&e.onpropertychange!==r?"propertychange":"keyup";p.automatic&&(x.on(t+w,b.prompt,g.throttle),k.attr("autocomplete","off")),x.on("focus"+w,b.prompt,g.event.focus).on("blur"+w,b.prompt,g.event.blur).on("keydown"+w,b.prompt,g.handleKeyboard).on("click"+w,b.searchButton,g.query).on("mousedown"+w,b.results,g.event.result.mousedown).on("mouseup"+w,b.results,g.event.result.mouseup).on("click"+w,b.result,g.event.result.click),g.instantiate()},instantiate:function(){g.verbose("Storing instance of module",g),E=g,x.data(C,g)},destroy:function(){g.verbose("Destroying instance"),x.off(w).removeData(C)},event:{focus:function(){g.set.focus(),g.has.minimumCharacters()&&g.showResults()},blur:function(){var e=s.activeElement===this;e||g.resultsClicked||(g.cancel.query(),g.remove.focus(),g.timer=setTimeout(g.hideResults,p.hideDelay))},result:{mousedown:function(){g.resultsClicked=!0},mouseup:function(){g.resultsClicked=!1},click:function(s){g.debug("Search result selected");var r=e(this),n=r.find(b.title).eq(0),a=r.find("a[href]").eq(0),i=a.attr("href")||!1,o=a.attr("target")||!1,c=(n.html(),n.length>0?n.text():!1),u=g.get.results(),l=g.get.result(c,u);return e.isFunction(p.onSelect)&&p.onSelect.call(S,l,u)===!1?void g.debug("Custom onSelect callback cancelled default select action"):(g.hideResults(),c&&g.set.value(c),void(i&&(g.verbose("Opening search link found in result",a),"_blank"==o||s.ctrlKey?t.open(i):t.location.href=i)))}}},handleKeyboard:function(e){var t,s=x.find(b.result),r=x.find(b.category),n=s.index(s.filter("."+m.active)),a=s.length,i=e.which,o={backspace:8,enter:13,escape:27,upArrow:38,downArrow:40};if(i==o.escape&&(g.verbose("Escape key pressed, blurring search field"),k.trigger("blur")),g.is.visible())if(i==o.enter){if(g.verbose("Enter key pressed, selecting active result"),s.filter("."+m.active).length>0)return g.event.result.click.call(s.filter("."+m.active),e),e.preventDefault(),!1}else i==o.upArrow?(g.verbose("Up key pressed, changing active result"),t=0>n-1?n:n-1,r.removeClass(m.active),s.removeClass(m.active).eq(t).addClass(m.active).closest(r).addClass(m.active),e.preventDefault()):i==o.downArrow&&(g.verbose("Down key pressed, changing active result"),t=n+1>=a?n:n+1,r.removeClass(m.active),s.removeClass(m.active).eq(t).addClass(m.active).closest(r).addClass(m.active),e.preventDefault());else i==o.enter&&(g.verbose("Enter key pressed, executing query"),g.query(),g.set.buttonPressed(),k.one("keyup",g.remove.buttonFocus))},setup:{api:function(){var e={debug:p.debug,on:!1,action:"search",onFailure:g.error};g.verbose("First request, initializing API"),x.api(e)}},can:{useAPI:function(){return e.fn.api!==r},transition:function(){return p.transition&&e.fn.transition!==r&&x.transition("is supported")}},is:{empty:function(){return""===q.html()},visible:function(){return q.filter(":visible").length>0},focused:function(){return k.filter(":focus").length>0}},get:{value:function(){return k.val()},results:function(){var e=x.data(h.results);return e},result:function(t,s){var r=!1;return t=t||g.get.value(),s=s||g.get.results(),"category"===p.type?(g.debug("Finding result that matches",t),e.each(s,function(s,n){return e.isArray(n.results)&&(r=g.search.object(t,n.results,!0)[0])?!1:void 0})):(g.debug("Finding result in results object",t),r=g.search.object(t,s,!0)[0]),r}},set:{focus:function(){x.addClass(m.focus)},loading:function(){x.addClass(m.loading)},value:function(e){g.verbose("Setting search input value",e),k.val(e),g.query()},buttonPressed:function(){A.addClass(m.pressed)}},remove:{loading:function(){x.removeClass(m.loading)},focus:function(){x.removeClass(m.focus)},buttonPressed:function(){A.removeClass(m.pressed)}},query:function(){var t=g.get.value(),s=g.read.cache(t);s?(g.debug("Reading result for "+t+" from cache"),g.save.results(s.results),g.addResults(s.html)):(g.debug("Querying for "+t),e.isPlainObject(p.source)||e.isArray(p.source)?g.search.local(t):g.can.useAPI()?g.search.remote(t):g.error(y.source),p.onSearchQuery.call(S,t))},search:{local:function(e){var t,s=g.search.object(e,p.content);g.set.loading(),g.save.results(s),g.debug("Returned local search results",s),t=g.generateResults({results:s}),g.remove.loading(),g.write.cache(e,{html:t,results:s}),g.addResults(t)},remote:function(t){var s={onSuccess:function(e){g.parse.response.call(S,e,t)},urlData:{query:t}};x.api("get request")||g.setup.api(),e.extend(!0,s,p.apiSettings),g.debug("Executing search",s),g.cancel.query(),x.api("setting",s).api("query")},object:function(t,s,n){var a=[],i=[],o=t.replace(v.escape,"\\$&"),c=new RegExp(v.beginsWith+o,"i"),u=e.isArray(p.searchFields)?p.searchFields:[p.searchFields],l=function(t,s){var r=-1==e.inArray(s,a),n=-1==e.inArray(s,i);r&&n&&t.push(s)};return s=s||p.source,s===r?(g.error(y.source),[]):(e.each(u,function(r,o){e.each(s,function(e,s){var r="string"==typeof s[o];r&&(n?s[o]==t&&l(a,s):s[o].match(c)?l(a,s):p.searchFullText&&g.fuzzySearch(t,s[o])&&l(i,s))})}),e.merge(a,i))}},fuzzySearch:function(e,t){var s=t.length,r=e.length;if(e=e.toLowerCase(),t=t.toLowerCase(),r>s)return!1;if(r===s)return e===t;e:for(var n=0,a=0;r>n;n++){for(var i=e.charCodeAt(n);s>a;)if(t.charCodeAt(a++)===i)continue e;return!1}return!0},parse:{response:function(e,t){var s=g.generateResults(e);g.verbose("Parsing server response",e),e!==r&&t!==r&&e.results!==r&&(g.write.cache(t,{html:s,results:e.results}),g.save.results(e.results),g.addResults(s))}},throttle:function(){clearTimeout(g.timer),g.has.minimumCharacters()?g.timer=setTimeout(g.query,p.searchDelay):g.hideResults()},cancel:{query:function(){g.can.useAPI()&&x.api("abort")}},has:{minimumCharacters:function(){var e=g.get.value(),t=e.length;return t>=p.minCharacters}},clear:{cache:function(e){e?e&&cache&&cache[e]&&(g.debug("Removing value from cache",e),delete cache[e],x.data(h.cache,cache)):(g.debug("Clearing cache",e),x.removeData(h.cache))}},read:{cache:function(e){var t=x.data(h.cache);return p.cache?(g.verbose("Checking cache for generated html for query",e),"object"==typeof t&&t[e]!==r?t[e]:!1):!1}},save:{results:function(e){g.verbose("Saving current search results to metadata",e),x.data(h.results,e)}},write:{cache:function(e,t){var s=x.data(h.cache)!==r?x.data(h.cache):{};p.cache&&(g.verbose("Writing generated html to cache",e,t),s[e]=t,x.data(h.cache,s))}},addResults:function(t){return e.isFunction(p.onResultsAdd)&&p.onResultsAdd.call(q,t)===!1?(g.debug("onResultsAdd callback cancelled default action"),!1):(q.html(t),void g.showResults())},showResults:function(){g.is.visible()||!g.is.focused()||g.is.empty()||(g.can.transition()?(g.debug("Showing results with css animations"),q.transition({animation:p.transition+" in",debug:p.debug,verbose:p.verbose,duration:p.duration,queue:!0})):(g.debug("Showing results with javascript"),q.stop().fadeIn(p.duration,p.easing)),p.onResultsOpen.call(q))},hideResults:function(){g.is.visible()&&(g.can.transition()?(g.debug("Hiding results with css animations"),q.transition({animation:p.transition+" out",debug:p.debug,verbose:p.verbose,duration:p.duration,queue:!0})):(g.debug("Hiding results with javascript"),q.stop().fadeOut(p.duration,p.easing)),p.onResultsClose.call(q))},generateResults:function(t){g.debug("Generating html from response",t);var s=p.templates[p.type],r=e.isPlainObject(t.results)&&!e.isEmptyObject(t.results),n=e.isArray(t.results)&&t.results.length>0,a="";return r||n?(p.maxResults>0&&(r?"standard"==p.type&&g.error(y.maxResults):t.results=t.results.slice(0,p.maxResults)),e.isFunction(s)?a=s(t):g.error(y.noTemplate,!1)):a=g.displayMessage(y.noResults,"empty"),p.onResults.call(S,t),a},displayMessage:function(e,t){return t=t||"standard",g.debug("Displaying message",e,t),g.addResults(p.templates.message(e,t)),p.templates.message(e,t)},setting:function(t,s){if(e.isPlainObject(t))e.extend(!0,p,t);else{if(s===r)return p[t];p[t]=s}},internal:function(t,s){if(e.isPlainObject(t))e.extend(!0,g,t);else{if(s===r)return g[t];g[t]=s}},debug:function(){p.debug&&(p.performance?g.performance.log(arguments):(g.debug=Function.prototype.bind.call(console.info,console,p.name+":"),g.debug.apply(console,arguments)))},verbose:function(){p.verbose&&p.debug&&(p.performance?g.performance.log(arguments):(g.verbose=Function.prototype.bind.call(console.info,console,p.name+":"),g.verbose.apply(console,arguments)))},error:function(){g.error=Function.prototype.bind.call(console.error,console,p.name+":"),g.error.apply(console,arguments)},performance:{log:function(e){var t,s,r;p.performance&&(t=(new Date).getTime(),r=c||t,s=t-r,c=t,u.push({Name:e[0],Arguments:[].slice.call(e,1)||"",Element:S,"Execution Time":s})),clearTimeout(g.performance.timer),g.performance.timer=setTimeout(g.performance.display,500)},display:function(){var t=p.name+":",s=0;c=!1,clearTimeout(g.performance.timer),e.each(u,function(e,t){s+=t["Execution Time"]}),t+=" "+s+"ms",o&&(t+=" '"+o+"'"),i.length>1&&(t+=" ("+i.length+")"),(console.group!==r||console.table!==r)&&u.length>0&&(console.groupCollapsed(t),console.table?console.table(u):e.each(u,function(e,t){console.log(t.Name+": "+t["Execution Time"]+"ms")}),console.groupEnd()),u=[]}},invoke:function(t,s,n){var i,o,c,u=E;return s=s||f,n=S||n,"string"==typeof t&&u!==r&&(t=t.split(/[\. ]/),i=t.length-1,e.each(t,function(s,n){var a=s!=i?n+t[s+1].charAt(0).toUpperCase()+t[s+1].slice(1):t;if(e.isPlainObject(u[a])&&s!=i)u=u[a];else{if(u[a]!==r)return o=u[a],!1;if(!e.isPlainObject(u[n])||s==i)return u[n]!==r?(o=u[n],!1):!1;u=u[n]}})),e.isFunction(o)?c=o.apply(n,s):o!==r&&(c=o),e.isArray(a)?a.push(c):a!==r?a=[a,c]:c!==r&&(a=c),o}},d?(E===r&&g.initialize(),g.invoke(l)):(E!==r&&E.invoke("destroy"),g.initialize())}),a!==r?a:this},e.fn.search.settings={name:"Search Module",namespace:"search",debug:!1,verbose:!1,performance:!0,type:"standard",minCharacters:1,apiSettings:!1,source:!1,searchFields:["title","description"],searchFullText:!0,automatic:!0,hideDelay:0,searchDelay:200,maxResults:7,cache:!0,transition:"scale",duration:300,easing:"easeOutExpo",onSelect:!1,onResultsAdd:!1,onSearchQuery:function(){},onResults:function(){},onResultsOpen:function(){},onResultsClose:function(){},className:{active:"active",empty:"empty",focus:"focus",loading:"loading",pressed:"down"},error:{source:"Cannot search. No source used, and Semantic API module was not included",noResults:"Your search returned no results",logging:"Error in debug logging, exiting.",noEndpoint:"No search endpoint was specified",noTemplate:"A valid template name was not specified.",serverError:"There was an issue with querying the server.",maxResults:"Results must be an array to use maxResults setting",method:"The method you called is not defined."},metadata:{cache:"cache",results:"results"},regExp:{escape:/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,beginsWith:"(?:s|^)"},selector:{prompt:".prompt",searchButton:".search.button",results:".results",category:".category",result:".result",title:".title, .name"},templates:{escape:function(e){var t=/[&<>"'`]/g,s=/[&<>"'`]/,r={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`"},n=function(e){return r[e]};return s.test(e)?e.replace(t,n):e},message:function(e,t){var s="";return e!==r&&t!==r&&(s+='
',s+="empty"==t?'
No Results
'+e+'
':'
'+e+"
",s+="
"),s},category:function(t){var s="",n=e.fn.search.settings.templates.escape;return t.results!==r?(e.each(t.results,function(t,a){a.results!==r&&a.results.length>0&&(s+='
'+a.name+"
",e.each(a.results,function(e,t){s+='
',t.url&&(s+=''),t.image!==r&&(t.image=n(t.image),s+='
'),s+='
',t.price!==r&&(t.price=n(t.price),s+='
'+t.price+"
"),t.title!==r&&(t.title=n(t.title),s+='
'+t.title+"
"),t.description!==r&&(s+='
'+t.description+"
"),s+="
"}),s+="
")}),t.action&&(s+=''+t.action.text+""),s):!1},standard:function(t){var s="";return t.results!==r?(e.each(t.results,function(e,t){s+=t.url?'':'',t.image!==r&&(s+='
'),s+='
',t.price!==r&&(s+='
'+t.price+"
"),t.title!==r&&(s+='
'+t.title+"
"),t.description!==r&&(s+='
'+t.description+"
"),s+="
",s+="
"}),t.action&&(s+=''+t.action.text+""),s):!1}}}}(jQuery,window,document); \ No newline at end of file diff --git a/dist/semantic.js b/dist/semantic.js index 15c64c510..978946414 100644 --- a/dist/semantic.js +++ b/dist/semantic.js @@ -4050,7 +4050,7 @@ $.fn.dropdown = function(parameters) { }, filterActive: function() { - if(settings.filterActive) { + if(settings.hideSelections) { $item.filter('.' + className.active) .addClass(className.filtered) ; @@ -4503,7 +4503,6 @@ $.fn.dropdown = function(parameters) { ? $nextItem = $selectedItem.nextAll(selector.item + ':not(.' + className.filtered + ')').eq(0) : $item.eq(0) ; - console.log(hasSelectedItem, inVisibleMenu, $nextItem); if($nextItem.length === 0) { module.verbose('Down key pressed but reached bottom of current menu'); event.preventDefault(); @@ -4817,7 +4816,7 @@ $.fn.dropdown = function(parameters) { optionValue = module.get.choiceValue($choice, optionText) ; if(isMultiple) { - if($.inArray(optionValue, value) !== -1 || $.inArray(optionText, value) !== -1) { + if($.inArray(optionValue.toString(), value) !== -1 || $.inArray(optionText, value) !== -1) { $selectedItem = ($selectedItem) ? $selectedItem.add($choice) : $choice @@ -5095,7 +5094,7 @@ $.fn.dropdown = function(parameters) { module.remove.activeItem(); module.remove.selectedItem(); } - else if(settings.filterActive) { + else if(settings.hideSelections) { module.remove.selectedItem(); } $selectedItem @@ -5180,7 +5179,7 @@ $.fn.dropdown = function(parameters) { $item.removeClass(className.active); }, filteredItem: function() { - if(settings.filterActive) { + if(settings.hideSelections) { $item.not('.' + className.active).removeClass(className.filtered); } else { @@ -5200,12 +5199,14 @@ $.fn.dropdown = function(parameters) { ; if($selectedItem) { if( $input.is('select') ) { + module.verbose('Input is values to placeholder text - placeholder: 'auto', + preserveHTML : true, // preserve html when selecting value - preserveHTML : true, + sortSelect : false, // sort selection on init - sortSelect : false, + match : 'both', // what to match against with search selection (both, text, or label) - match: 'both', - // allow elements with sub-menus to be selected allowCategorySelection : false, + // allow elements with sub-menus to be selected - // delay before event delay : { hide : 300, show : 200, search : 50, touch : 50 }, + // delay before event - // force a value selection on search selection forceSelection : true, + // force a value selection on search selection - // menu transiton transition : 'auto', + // menu transiton duration : 250, - // widest glyph width in em (W is 1.0714 em) used to calculate multiselect input width glyphWidth : 1.0714, + // widest glyph width in em (W is 1.0714 em) used to calculate multiselect input width - // whether multiple select should allow user added values allowAdditions : true, + // whether multiple select should allow user added values - // multi select delimiting key delimiter : ',', + // multi select delimiting key - // label settings on multi-select label: { + // label settings on multi-select transition : 'horizontal flip', duration : 150, variation : false }, + hideSelections : true, // whether multiple selects should filter active selections from menu - filterActive : true, + /* Callbacks */ onLabelSelect : function($selectedLabels){}, @@ -10217,13 +10218,13 @@ $.fn.search = function(parameters) { : [settings.searchFields], // avoid duplicates when pushing results - addResult = function(array, value) { + addResult = function(array, content) { var notResult = ($.inArray(content, results) == -1), notFuzzyResult = ($.inArray(content, fuzzyResults) == -1) ; if(notResult && notFuzzyResult) { - array.push(value); + array.push(content); } } ; diff --git a/dist/semantic.min.js b/dist/semantic.min.js index 4dae3a970..784f424a7 100644 --- a/dist/semantic.min.js +++ b/dist/semantic.min.js @@ -9,9 +9,9 @@ * */ !function(e,t,n,i){e.site=e.fn.site=function(o){var a,r,s=(new Date).getTime(),c=[],l=arguments[0],u="string"==typeof l,d=[].slice.call(arguments,1),m=e.isPlainObject(o)?e.extend(!0,{},e.site.settings,o):e.extend({},e.site.settings),f=m.namespace,g=m.error,p="module-"+f,v=e(n),h=v,b=this,y=h.data(p);return a={initialize:function(){a.instantiate()},instantiate:function(){a.verbose("Storing instance of site",a),y=a,h.data(p,a)},normalize:function(){a.fix.console(),a.fix.requestAnimationFrame()},fix:{console:function(){a.debug("Normalizing window.console"),(console===i||console.log===i)&&(a.verbose("Console not available, normalizing events"),a.disable.console()),("undefined"==typeof console.group||"undefined"==typeof console.groupEnd||"undefined"==typeof console.groupCollapsed)&&(a.verbose("Console group not available, normalizing events"),t.console.group=function(){},t.console.groupEnd=function(){},t.console.groupCollapsed=function(){}),"undefined"==typeof console.markTimeline&&(a.verbose("Mark timeline not available, normalizing events"),t.console.markTimeline=function(){})},consoleClear:function(){a.debug("Disabling programmatic console clearing"),t.console.clear=function(){}},requestAnimationFrame:function(){a.debug("Normalizing requestAnimationFrame"),t.requestAnimationFrame===i&&(a.debug("RequestAnimationFrame not available, normailizing event"),t.requestAnimationFrame=t.requestAnimationFrame||t.mozRequestAnimationFrame||t.webkitRequestAnimationFrame||t.msRequestAnimationFrame||function(e){setTimeout(e,0)})}},moduleExists:function(t){return e.fn[t]!==i&&e.fn[t].settings!==i},enabled:{modules:function(t){var n=[];return t=t||m.modules,e.each(t,function(e,t){a.moduleExists(t)&&n.push(t)}),n}},disabled:{modules:function(t){var n=[];return t=t||m.modules,e.each(t,function(e,t){a.moduleExists(t)||n.push(t)}),n}},change:{setting:function(t,n,o,r){o="string"==typeof o?"all"===o?m.modules:[o]:o||m.modules,r=r!==i?r:!0,e.each(o,function(i,o){var s,c=a.moduleExists(o)?e.fn[o].settings.namespace||!1:!0;a.moduleExists(o)&&(a.verbose("Changing default setting",t,n,o),e.fn[o].settings[t]=n,r&&c&&(s=e(":data(module-"+c+")"),s.length>0&&(a.verbose("Modifying existing settings",s),s[o]("setting",t,n))))})},settings:function(t,n,o){n="string"==typeof n?[n]:n||m.modules,o=o!==i?o:!0,e.each(n,function(n,i){var r;a.moduleExists(i)&&(a.verbose("Changing default setting",t,i),e.extend(!0,e.fn[i].settings,t),o&&f&&(r=e(":data(module-"+f+")"),r.length>0&&(a.verbose("Modifying existing settings",r),r[i]("setting",t))))})}},enable:{console:function(){a.console(!0)},debug:function(e,t){e=e||m.modules,a.debug("Enabling debug for modules",e),a.change.setting("debug",!0,e,t)},verbose:function(e,t){e=e||m.modules,a.debug("Enabling verbose debug for modules",e),a.change.setting("verbose",!0,e,t)}},disable:{console:function(){a.console(!1)},debug:function(e,t){e=e||m.modules,a.debug("Disabling debug for modules",e),a.change.setting("debug",!1,e,t)},verbose:function(e,t){e=e||m.modules,a.debug("Disabling verbose debug for modules",e),a.change.setting("verbose",!1,e,t)}},console:function(e){if(e){if(y.cache.console===i)return void a.error(g.console);a.debug("Restoring console function"),t.console=y.cache.console}else a.debug("Disabling console function"),y.cache.console=t.console,t.console={clear:function(){},error:function(){},group:function(){},groupCollapsed:function(){},groupEnd:function(){},info:function(){},log:function(){},markTimeline:function(){},warn:function(){}}},destroy:function(){a.verbose("Destroying previous site for",h),h.removeData(p)},cache:{},setting:function(t,n){if(e.isPlainObject(t))e.extend(!0,m,t);else{if(n===i)return m[t];m[t]=n}},internal:function(t,n){if(e.isPlainObject(t))e.extend(!0,a,t);else{if(n===i)return a[t];a[t]=n}},debug:function(){m.debug&&(m.performance?a.performance.log(arguments):(a.debug=Function.prototype.bind.call(console.info,console,m.name+":"),a.debug.apply(console,arguments)))},verbose:function(){m.verbose&&m.debug&&(m.performance?a.performance.log(arguments):(a.verbose=Function.prototype.bind.call(console.info,console,m.name+":"),a.verbose.apply(console,arguments)))},error:function(){a.error=Function.prototype.bind.call(console.error,console,m.name+":"),a.error.apply(console,arguments)},performance:{log:function(e){var t,n,i;m.performance&&(t=(new Date).getTime(),i=s||t,n=t-i,s=t,c.push({Element:b,Name:e[0],Arguments:[].slice.call(e,1)||"","Execution Time":n})),clearTimeout(a.performance.timer),a.performance.timer=setTimeout(a.performance.display,500)},display:function(){var t=m.name+":",n=0;s=!1,clearTimeout(a.performance.timer),e.each(c,function(e,t){n+=t["Execution Time"]}),t+=" "+n+"ms",(console.group!==i||console.table!==i)&&c.length>0&&(console.groupCollapsed(t),console.table?console.table(c):e.each(c,function(e,t){console.log(t.Name+": "+t["Execution Time"]+"ms")}),console.groupEnd()),c=[]}},invoke:function(t,n,o){var s,c,l,u=y;return n=n||d,o=b||o,"string"==typeof t&&u!==i&&(t=t.split(/[\. ]/),s=t.length-1,e.each(t,function(n,o){var r=n!=s?o+t[n+1].charAt(0).toUpperCase()+t[n+1].slice(1):t;if(e.isPlainObject(u[r])&&n!=s)u=u[r];else{if(u[r]!==i)return c=u[r],!1;if(!e.isPlainObject(u[o])||n==s)return u[o]!==i?(c=u[o],!1):(a.error(g.method,t),!1);u=u[o]}})),e.isFunction(c)?l=c.apply(o,n):c!==i&&(l=c),e.isArray(r)?r.push(l):r!==i?r=[r,l]:l!==i&&(r=l),c}},u?(y===i&&a.initialize(),a.invoke(l)):(y!==i&&a.destroy(),a.initialize()),r!==i?r:this},e.site.settings={name:"Site",namespace:"site",error:{console:"Console cannot be restored, most likely it was overwritten outside of module",method:"The method you called is not defined."},debug:!1,verbose:!1,performance:!0,modules:["accordion","api","checkbox","dimmer","dropdown","form","modal","nag","popup","rating","shape","sidebar","state","sticky","tab","transition","video","visit","visibility"],siteNamespace:"site",namespaceStub:{cache:{},config:{},sections:{},section:{},utilities:{}}},e.extend(e.expr[":"],{data:e.expr.createPseudo?e.expr.createPseudo(function(t){return function(n){return!!e.data(n,t)}}):function(t,n,i){return!!e.data(t,i[3])}})}(jQuery,window,document),function(e,t,n,i){"use strict";e.fn.form=function(t){var o,a=e(this),r=a.selector||"",s=(new Date).getTime(),c=[],l=arguments[0],u=arguments[1],d="string"==typeof l,m=[].slice.call(arguments,1);return a.each(function(){var f,g,p,v,h,b,y,x,w,C,k,T,S,A,C,P,E,R,F,O=e(this),D=this,z=[],q=!1;F={initialize:function(){F.get.settings(),d?F.invoke(l):(F.verbose("Initializing form validation",O,x),F.bindEvents(),F.set.defaults(),F.instantiate())},instantiate:function(){F.verbose("Storing instance of module",F),R=F,O.data(P,F)},destroy:function(){F.verbose("Destroying previous module",R),F.removeEvents(),O.removeData(P)},refresh:function(){F.verbose("Refreshing selector cache"),f=O.find(T.field),g=O.find(T.group),p=O.find(T.message),v=O.find(T.prompt),h=O.find(T.submit),b=O.find(T.clear),y=O.find(T.reset)},submit:function(){F.verbose("Submitting form",O),O.submit()},attachEvents:function(t,n){n=n||"submit",e(t).on("click"+E,function(e){F[n](),e.preventDefault()})},bindEvents:function(){F.verbose("Attaching form events"),O.on("submit"+E,F.validate.form).on("blur"+E,T.field,F.event.field.blur).on("click"+E,T.submit,F.submit).on("click"+E,T.reset,F.reset).on("click"+E,T.clear,F.clear),x.keyboardShortcuts&&O.on("keydown"+E,T.field,F.event.field.keydown),f.each(function(){var t=e(this),n=t.prop("type"),i=F.get.changeEvent(n,t);e(this).on(i+E,F.event.field.change)})},clear:function(){f.each(function(){var t=e(this),n=t.parent(),i=t.closest(g),o=i.find(T.prompt),a=t.data(k.defaultValue)||"",r=n.is(T.uiCheckbox),s=n.is(T.uiDropdown),c=i.hasClass(S.error);c&&(F.verbose("Resetting error on field",i),i.removeClass(S.error),o.remove()),s?(F.verbose("Resetting dropdown value",n,a),n.dropdown("clear")):r?n.checkbox("uncheck"):(F.verbose("Resetting field value",t,a),t.val(""))})},reset:function(){f.each(function(){var t=e(this),n=t.parent(),i=t.closest(g),o=i.find(T.prompt),a=t.data(k.defaultValue)||"",r=n.is(T.uiCheckbox),s=n.is(T.uiDropdown),c=i.hasClass(S.error);c&&(F.verbose("Resetting error on field",i),i.removeClass(S.error),o.remove()),s?(F.verbose("Resetting dropdown value",n,a),n.dropdown("restore defaults")):r?(F.verbose("Resetting checkbox value",n,a),n.checkbox(a===!0?"check":"uncheck")):(F.verbose("Resetting field value",t,a),t.val(a))})},removeEvents:function(){O.off(E),f.off(E),h.off(E),f.off(E)},event:{field:{keydown:function(t){var n=e(this),i=t.which,o={enter:13,escape:27};i==o.escape&&(F.verbose("Escape key pressed blurring field"),n.blur()),!t.ctrlKey&&i==o.enter&&n.is(T.input)&&n.not(T.checkbox).length>0&&(h.addClass(S.pressed),q||(n.one("keyup"+E,F.event.field.keyup),F.submit(),F.debug("Enter pressed on input submitting form")),q=!0)},keyup:function(){q=!1,h.removeClass(S.pressed)},blur:function(){var t=e(this),n=t.closest(g);n.hasClass(S.error)?(F.debug("Revalidating field",t,F.get.validation(t)),F.validate.field(F.get.validation(t))):("blur"==x.on||"change"==x.on)&&F.validate.field(F.get.validation(t))},change:function(){var t=e(this),n=t.closest(g);("change"==x.on||n.hasClass(S.error)&&x.revalidate)&&(clearTimeout(F.timer),F.timer=setTimeout(function(){F.debug("Revalidating field",t,F.get.validation(t)),F.validate.field(F.get.validation(t))},x.delay))}}},get:{changeEvent:function(e,t){return"checkbox"==e||"radio"==e||"hidden"==e||t.is("select")?"change":F.get.inputEvent()},inputEvent:function(){return n.createElement("input").oninput!==i?"input":n.createElement("input").onpropertychange!==i?"propertychange":"keyup"},settings:function(){if(e.isPlainObject(t)){var n=Object.keys(t),o=n.length>0?t[n[0]].identifier!==i:!1;o?(x=e.extend(!0,{},e.fn.form.settings,u),w=e.extend({},e.fn.form.settings.defaults,t),F.error(x.error.oldSyntax,D),F.verbose("Extending settings from legacy parameters",w,x)):(x=e.extend(!0,{},e.fn.form.settings,t),w=e.extend({},e.fn.form.settings.defaults,x.fields),F.verbose("Extending settings",w,x))}else x=e.fn.form.settings,w=e.fn.form.settings.defaults,F.verbose("Using default form validation",w,x);C=x.namespace,k=x.metadata,T=x.selector,S=x.className,A=x.error,P="module-"+C,E="."+C,R=O.data(P),F.refresh()},field:function(t){return F.verbose("Finding field with identifier",t),f.filter("#"+t).length>0?f.filter("#"+t):f.filter('[name="'+t+'"]').length>0?f.filter('[name="'+t+'"]'):f.filter('[name="'+t+'[]"]').length>0?f.filter('[name="'+t+'[]"]'):f.filter("[data-"+k.validate+'="'+t+'"]').length>0?f.filter("[data-"+k.validate+'="'+t+'"]'):e("")},fields:function(t){var n=e();return e.each(t,function(e,t){n=n.add(F.get.field(t))}),n},validation:function(t){var n;return e.each(w,function(e,i){F.get.field(i.identifier).get(0)==t.get(0)&&(n=i)}),n||!1},value:function(e){var t,n=[];return n.push(e),t=F.get.values.call(D,n),t[e]},values:function(t){var n=e.isArray(t)?F.get.fields(t):f,i={};return n.each(function(t,n){var o=e(n),a=(o.prop("type"),o.prop("name")),r=o.val(),s=o.is(T.checkbox),c=o.is(T.radio),l=-1!==a.indexOf("[]"),u=s?o.is(":checked"):!1;if(a)if(l)if(a=a.replace("[]",""),i[a]||(i[a]=[]),s){if(!u)return F.debug("Omitted unchecked checkbox",o),!0;i[a].push(r)}else i[a].push(r);else if(c)u&&(i[a]=r);else if(s){if(!u)return F.debug("Omitted unchecked checkbox",o),!0;i[a]=!0}else i[a]=r}),i}},has:{field:function(e){return F.verbose("Checking for existence of a field with identifier",e),f.filter("#"+e).length>0?!0:f.filter('[name="'+e+'"]').length>0?!0:f.filter("[data-"+k.validate+'="'+e+'"]').length>0?!0:!1}},add:{prompt:function(t,n){var o=F.get.field(t),a=o.closest(g),r=a.children(T.prompt),s=0!==r.length;n="string"==typeof n?[n]:n,F.verbose("Adding field error state",t),a.addClass(S.error),x.inline&&(s||(r=x.templates.prompt(n),r.appendTo(a)),r.html(n[0]),s?F.verbose("Inline errors are disabled, no inline error added",t):x.transition&&e.fn.transition!==i&&O.transition("is supported")?(F.verbose("Displaying error with css transition",x.transition),r.transition(x.transition+" in",x.duration)):(F.verbose("Displaying error with fallback javascript animation"),r.fadeIn(x.duration)))},errors:function(e){F.debug("Adding form error messages",e),p.html(x.templates.error(e))}},remove:{prompt:function(t){var n=F.get.field(t.identifier),o=n.closest(g),a=o.children(T.prompt);o.removeClass(S.error),x.inline&&a.is(":visible")&&(F.verbose("Removing prompt for field",t),x.transition&&e.fn.transition!==i&&O.transition("is supported")?a.transition(x.transition+" out",x.duration,function(){a.remove()}):a.fadeOut(x.duration,function(){a.remove()}))}},set:{success:function(){O.removeClass(S.error).addClass(S.success)},defaults:function(){f.each(function(){var t=e(this),n=t.filter(T.checkbox).length>0,i=n?t.is(":checked"):t.val();t.data(k.defaultValue,i)})},error:function(){O.removeClass(S.success).addClass(S.error)},value:function(e,t){var n={};return n[e]=t,F.set.values.call(D,n)},values:function(t){e.isEmptyObject(t)||(e.each(t,function(t,n){var i,o=F.get.field(t),a=o.parent(),r=e.isArray(n),s=a.is(T.uiCheckbox),c=a.is(T.uiDropdown),l=o.is(T.radio)&&s,u=o.length>0;u&&(r&&s?(F.verbose("Selecting multiple",n,o),a.checkbox("uncheck"),e.each(n,function(e,t){i=o.filter('[value="'+t+'"]'),a=i.parent(),i.length>0&&a.checkbox("check")})):l?(F.verbose("Selecting radio value",n,o),o.filter('[value="'+n+'"]').parent(T.uiCheckbox).checkbox("check")):s?(F.verbose("Setting checkbox value",n,a),a.checkbox(n===!0?"check":"uncheck")):c?(F.verbose("Setting dropdown value",n,a),a.dropdown("set selected",n)):(F.verbose("Setting field value",n,o),o.val(n)))}),F.validate.form())}},validate:{form:function(t){var n=!0;return q?!1:(z=[],e.each(w,function(e,t){F.validate.field(t)||(n=!1)}),n?(F.debug("Form has no validation errors, submitting"),F.set.success(),x.onSuccess.call(D,t)):(F.debug("Form has errors"),F.set.error(),x.inline||F.add.errors(z),O.data("moduleApi")!==i&&t.stopImmediatePropagation(),x.onFailure.call(D,z)))},field:function(t){var n=F.get.field(t.identifier),o=!0,a=[];return n.prop("disabled")?(F.debug("Field is disabled. Skipping",t.identifier),o=!0):t.optional&&""===e.trim(n.val())?(F.debug("Field is optional and empty. Skipping",t.identifier),o=!0):t.rules!==i&&e.each(t.rules,function(e,n){F.has.field(t.identifier)&&!F.validate.rule(t,n)&&(F.debug("Field is invalid",t.identifier,n.type),a.push(n.prompt),o=!1)}),o?(F.remove.prompt(t,a),x.onValid.call(n),!0):(z=z.concat(a),F.add.prompt(t.identifier,a),x.onInvalid.call(n,a),!1)},rule:function(t,n){var i,o,a,r=F.get.field(t.identifier),s=n.type,c=r.val(),l=s.match(x.regExp.bracket),u=!0;if(c=e.trim(r.val()+""),l){if(o=""+l[1],a=s.replace(l[0],""),i=x.rules[a],!e.isFunction(i))return void F.error(A.noRule,a);u=i.call(r,c,o)}else{if(i=x.rules[s],!e.isFunction(i))return void F.error(A.noRule,s);u=i.call(r,c)}return u}},setting:function(t,n){if(e.isPlainObject(t))e.extend(!0,x,t);else{if(n===i)return x[t];x[t]=n}},internal:function(t,n){if(e.isPlainObject(t))e.extend(!0,F,t);else{if(n===i)return F[t];F[t]=n}},debug:function(){x.debug&&(x.performance?F.performance.log(arguments):(F.debug=Function.prototype.bind.call(console.info,console,x.name+":"),F.debug.apply(console,arguments)))},verbose:function(){x.verbose&&x.debug&&(x.performance?F.performance.log(arguments):(F.verbose=Function.prototype.bind.call(console.info,console,x.name+":"),F.verbose.apply(console,arguments)))},error:function(){F.error=Function.prototype.bind.call(console.error,console,x.name+":"),F.error.apply(console,arguments)},performance:{log:function(e){var t,n,i;x.performance&&(t=(new Date).getTime(),i=s||t,n=t-i,s=t,c.push({Name:e[0],Arguments:[].slice.call(e,1)||"",Element:D,"Execution Time":n})),clearTimeout(F.performance.timer),F.performance.timer=setTimeout(F.performance.display,500)},display:function(){var t=x.name+":",n=0;s=!1,clearTimeout(F.performance.timer),e.each(c,function(e,t){n+=t["Execution Time"]}),t+=" "+n+"ms",r&&(t+=" '"+r+"'"),a.length>1&&(t+=" ("+a.length+")"),(console.group!==i||console.table!==i)&&c.length>0&&(console.groupCollapsed(t),console.table?console.table(c):e.each(c,function(e,t){console.log(t.Name+": "+t["Execution Time"]+"ms")}),console.groupEnd()),c=[]}},invoke:function(t,n,a){var r,s,c,l=R;return n=n||m,a=D||a,"string"==typeof t&&l!==i&&(t=t.split(/[\. ]/),r=t.length-1,e.each(t,function(n,o){var a=n!=r?o+t[n+1].charAt(0).toUpperCase()+t[n+1].slice(1):t;if(e.isPlainObject(l[a])&&n!=r)l=l[a];else{if(l[a]!==i)return s=l[a],!1;if(!e.isPlainObject(l[o])||n==r)return l[o]!==i?(s=l[o],!1):!1;l=l[o]}})),e.isFunction(s)?c=s.apply(a,n):s!==i&&(c=s),e.isArray(o)?o.push(c):o!==i?o=[o,c]:c!==i&&(o=c),s}},F.initialize()}),o!==i?o:this},e.fn.form.settings={name:"Form",namespace:"form",debug:!1,verbose:!1,performance:!0,fields:!1,keyboardShortcuts:!0,on:"submit",inline:!1,delay:200,revalidate:!0,transition:"scale",duration:200,onValid:function(){},onInvalid:function(){},onSuccess:function(){return!0},onFailure:function(){return!1},metadata:{defaultValue:"default",validate:"validate"},regExp:{bracket:/\[(.*)\]/i,escape:/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,email:"[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?",integer:/^\-?\d+$/,flags:/^\/(.*)\/(.*)?/,url:/(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/i},selector:{checkbox:'input[type="checkbox"], input[type="radio"]',clear:".clear",field:"input, textarea, select",group:".field",input:"input",message:".error.message",prompt:".prompt.label",radio:'input[type="radio"]',reset:'.reset:not([type="reset"])',submit:'.submit:not([type="submit"])',uiCheckbox:".ui.checkbox",uiDropdown:".ui.dropdown"},className:{error:"error",label:"ui prompt label",pressed:"down",success:"success"},error:{oldSyntax:"Starting in 2.0 forms now only take a single settings object. Validation settings converted to new syntax automatically.",noRule:"There is no rule matching the one you specified",method:"The method you called is not defined."},templates:{error:function(t){var n='
    ';return e.each(t,function(e,t){n+="
  • "+t+"
  • "}),n+="
",e(n)},prompt:function(t){return e("
").addClass("ui red pointing prompt label").html(t[0])}},rules:{checked:function(){return e(this).filter(":checked").length>0},contains:function(t,n){return n=n.replace(e.fn.form.settings.regExp.escape,"\\$&"),-1!==t.search(new RegExp(n,"i"))},containsExactly:function(t,n){return n=n.replace(e.fn.form.settings.regExp.escape,"\\$&"),-1!==t.search(new RegExp(n))},email:function(t){var n=new RegExp(e.fn.form.settings.regExp.email,"i");return n.test(t)},empty:function(t){return!(t===i||""===t||e.isArray(t)&&0==t.length)},integer:function(t,n){var o,a,r,s=e.fn.form.settings.regExp.integer;return n===i||""===n||".."===n||(-1==n.indexOf("..")?s.test(n)&&(o=a=n-0):(r=n.split("..",2),s.test(r[0])&&(o=r[0]-0),s.test(r[1])&&(a=r[1]-0))),s.test(t)&&(o===i||t>=o)&&(a===i||a>=t)},is:function(e,t){return t="string"==typeof t?t.toLowerCase():t,e="string"==typeof e?e.toLowerCase():e,e==t},isExactly:function(e,t){return e==t},length:function(e,t){return e!==i?e.length>=t:!1},match:function(t,n){var o,a=e(this);return a.find('[data-validate="'+n+'"]').length>0?o=a.find('[data-validate="'+n+'"]').val():a.find("#"+n).length>0?o=a.find("#"+n).val():a.find('[name="'+n+'"]').length>0&&(o=a.find('[name="'+n+'"]').val()),o!==i?t.toString()==o.toString():!1},maxCount:function(t,n){return t=t.split(","),e.isArray(t)&&t.length<=n},exactCount:function(t,n){return t=t.split(","),e.isArray(t)&&t.length==n},minCount:function(t,n){return t=t.split(","),e.isArray(t)&&t.length>=n},regExp:function(t,n){var i,o=n.match(e.fn.form.settings.regExp.flags);return o&&(n=o.length>=2?o[1]:n,i=o.length>=3?o[2]:""),t.match(new RegExp(n,i))},maxLength:function(e,t){return e!==i?e.length<=t:!1},not:function(e,t){return e="string"==typeof e?e.toLowerCase():e,t="string"==typeof t?t.toLowerCase():t,e!=t},notExactly:function(e,t){return e!=t},url:function(t){return e.fn.form.settings.regExp.url.match(t)}}}}(jQuery,window,document),function(e,t,n,i){"use strict";e.fn.accordion=function(n){{var o,a=e(this),r=(new Date).getTime(),s=[],c=arguments[0],l="string"==typeof c,u=[].slice.call(arguments,1);t.requestAnimationFrame||t.mozRequestAnimationFrame||t.webkitRequestAnimationFrame||t.msRequestAnimationFrame||function(e){setTimeout(e,0)}}return a.each(function(){var d,m,f=e.isPlainObject(n)?e.extend(!0,{},e.fn.accordion.settings,n):e.extend({},e.fn.accordion.settings),g=f.className,p=f.namespace,v=f.selector,h=f.error,b="."+p,y="module-"+p,x=a.selector||"",w=e(this),C=w.find(v.title),k=w.find(v.content),T=this,S=w.data(y);m={initialize:function(){m.debug("Initializing",w),m.bind.events(),m.observeChanges(),m.instantiate()},instantiate:function(){S=m,w.data(y,m)},destroy:function(){m.debug("Destroying previous instance",w),w.off(b).removeData(y)},refresh:function(){C=w.find(v.title),k=w.find(v.content)},observeChanges:function(){"MutationObserver"in t&&(d=new MutationObserver(function(){m.debug("DOM tree modified, updating selector cache"),m.refresh()}),d.observe(T,{childList:!0,subtree:!0}),m.debug("Setting up mutation observer",d))},bind:{events:function(){m.debug("Binding delegated events"),w.on(f.on+b,v.trigger,m.event.click)}},event:{click:function(){m.toggle.call(this)}},toggle:function(t){var n=t!==i?"number"==typeof t?C.eq(t):e(t).closest(v.title):e(this).closest(v.title),o=n.next(k),a=o.hasClass(g.animating),r=o.hasClass(g.active),s=r&&!a,c=!r&&a;m.debug("Toggling visibility of content",n),s||c?f.collapsible?m.close.call(n):m.debug("Cannot close accordion content collapsing is disabled"):m.open.call(n)},open:function(t){var n=t!==i?"number"==typeof t?C.eq(t):e(t).closest(v.title):e(this).closest(v.title),o=n.next(k),a=o.hasClass(g.animating),r=o.hasClass(g.active),s=!r&&!a;s&&(m.debug("Opening accordion content",n),f.onOpening.call(o),f.exclusive&&m.closeOthers.call(n),n.addClass(g.active),o.addClass(g.animating),f.animateChildren&&(e.fn.transition!==i&&w.transition("is supported")?o.children().transition({animation:"fade in",queue:!1,useFailSafe:!0,debug:f.debug,verbose:f.verbose,duration:f.duration}):o.children().stop(!0).animate({opacity:1},f.duration,m.resetOpacity)),o.stop(!0).slideDown(f.duration,f.easing,function(){o.removeClass(g.animating).addClass(g.active),m.reset.display.call(this),f.onOpen.call(this),f.onChange.call(this)}))},close:function(t){var n=t!==i?"number"==typeof t?C.eq(t):e(t).closest(v.title):e(this).closest(v.title),o=n.next(k),a=o.hasClass(g.animating),r=o.hasClass(g.active),s=!r&&a,c=r&&a;!r&&!s||c||(m.debug("Closing accordion content",o),f.onClosing.call(o),n.removeClass(g.active),o.addClass(g.animating),f.animateChildren&&(e.fn.transition!==i&&w.transition("is supported")?o.children().transition({animation:"fade out",queue:!1,useFailSafe:!0,debug:f.debug,verbose:f.verbose,duration:f.duration}):o.children().stop(!0).animate({opacity:0},f.duration,m.resetOpacity)),o.stop(!0).slideUp(f.duration,f.easing,function(){o.removeClass(g.animating).removeClass(g.active),m.reset.display.call(this),f.onClose.call(this),f.onChange.call(this)}))},closeOthers:function(t){var n,o,a,r=t!==i?C.eq(t):e(this).closest(v.title),s=r.parents(v.content).prev(v.title),c=r.closest(v.accordion),l=v.title+"."+g.active+":visible",u=v.content+"."+g.active+":visible";f.closeNested?(n=c.find(l).not(s),a=n.next(k)):(n=c.find(l).not(s),o=c.find(u).find(l).not(s),n=n.not(o),a=n.next(k)),n.length>0&&(m.debug("Exclusive enabled, closing other content",n),n.removeClass(g.active),f.animateChildren&&(e.fn.transition!==i&&w.transition("is supported")?a.children().transition({animation:"fade out",useFailSafe:!0,debug:f.debug,verbose:f.verbose,duration:f.duration}):a.children().stop().animate({opacity:0},f.duration,m.resetOpacity)),a.stop().slideUp(f.duration,f.easing,function(){e(this).removeClass(g.active),m.reset.display.call(this)}))},reset:{display:function(){m.verbose("Removing inline display from element",this),e(this).css("display",""),""===e(this).attr("style")&&e(this).attr("style","").removeAttr("style")},opacity:function(){m.verbose("Removing inline opacity from element",this),e(this).css("opacity",""),""===e(this).attr("style")&&e(this).attr("style","").removeAttr("style")}},setting:function(t,n){if(m.debug("Changing setting",t,n),e.isPlainObject(t))e.extend(!0,f,t);else{if(n===i)return f[t];f[t]=n}},internal:function(t,n){return m.debug("Changing internal",t,n),n===i?m[t]:void(e.isPlainObject(t)?e.extend(!0,m,t):m[t]=n)},debug:function(){f.debug&&(f.performance?m.performance.log(arguments):(m.debug=Function.prototype.bind.call(console.info,console,f.name+":"),m.debug.apply(console,arguments)))},verbose:function(){f.verbose&&f.debug&&(f.performance?m.performance.log(arguments):(m.verbose=Function.prototype.bind.call(console.info,console,f.name+":"),m.verbose.apply(console,arguments)))},error:function(){m.error=Function.prototype.bind.call(console.error,console,f.name+":"),m.error.apply(console,arguments)},performance:{log:function(e){var t,n,i;f.performance&&(t=(new Date).getTime(),i=r||t,n=t-i,r=t,s.push({Name:e[0],Arguments:[].slice.call(e,1)||"",Element:T,"Execution Time":n})),clearTimeout(m.performance.timer),m.performance.timer=setTimeout(m.performance.display,500)},display:function(){var t=f.name+":",n=0;r=!1,clearTimeout(m.performance.timer),e.each(s,function(e,t){n+=t["Execution Time"]}),t+=" "+n+"ms",x&&(t+=" '"+x+"'"),(console.group!==i||console.table!==i)&&s.length>0&&(console.groupCollapsed(t),console.table?console.table(s):e.each(s,function(e,t){console.log(t.Name+": "+t["Execution Time"]+"ms")}),console.groupEnd()),s=[]}},invoke:function(t,n,a){var r,s,c,l=S;return n=n||u,a=T||a,"string"==typeof t&&l!==i&&(t=t.split(/[\. ]/),r=t.length-1,e.each(t,function(n,o){var a=n!=r?o+t[n+1].charAt(0).toUpperCase()+t[n+1].slice(1):t;if(e.isPlainObject(l[a])&&n!=r)l=l[a];else{if(l[a]!==i)return s=l[a],!1;if(!e.isPlainObject(l[o])||n==r)return l[o]!==i?(s=l[o],!1):(m.error(h.method,t),!1);l=l[o]}})),e.isFunction(s)?c=s.apply(a,n):s!==i&&(c=s),e.isArray(o)?o.push(c):o!==i?o=[o,c]:c!==i&&(o=c),s}},l?(S===i&&m.initialize(),m.invoke(c)):(S!==i&&S.invoke("destroy"),m.initialize())}),o!==i?o:this},e.fn.accordion.settings={name:"Accordion",namespace:"accordion",debug:!1,verbose:!1,performance:!0,exclusive:!0,collapsible:!0,closeNested:!1,animateChildren:!0,duration:350,easing:"easeOutQuad",on:"click",onOpening:function(){},onOpen:function(){},onClosing:function(){},onClose:function(){},onChange:function(){},error:{method:"The method you called is not defined"},className:{active:"active",animating:"animating"},selector:{accordion:".accordion",title:".title",trigger:".title",content:".content"}},e.extend(e.easing,{easeOutQuad:function(e,t,n,i,o){return-i*(t/=o)*(t-2)+n}})}(jQuery,window,document),function(e,t,n,i){"use strict";e.fn.checkbox=function(n){var o,a=e(this),r=a.selector||"",s=(new Date).getTime(),c=[],l=arguments[0],u="string"==typeof l,d=[].slice.call(arguments,1);return a.each(function(){var a,m,f=e.extend(!0,{},e.fn.checkbox.settings,n),g=f.className,p=f.namespace,v=f.selector,h=f.error,b="."+p,y="module-"+p,x=e(this),w=e(this).find(v.label),C=e(this).find(v.input),k=x.data(y),T=this;m={initialize:function(){m.verbose("Initializing checkbox",f),m.create.label(),m.add.events(),m.setup(),m.observeChanges(),m.instantiate()},instantiate:function(){m.verbose("Storing instance of module",m),k=m,x.data(y,m)},destroy:function(){m.verbose("Destroying module"),m.remove.events(),x.removeData(y)},setup:function(){m.is.checked()?(m.debug("Setting initial value to checked"),m.set.checked(),f.fireOnInit&&f.onChecked.call(C.get())):(m.debug("Setting initial value to unchecked"),m.remove.checked(),f.fireOnInit&&f.onUnchecked.call(C.get()))},refresh:function(){w=x.find(v.label),C=x.find(v.input)},observeChanges:function(){"MutationObserver"in t&&(a=new MutationObserver(function(){m.debug("DOM tree modified, updating selector cache"),m.refresh()}),a.observe(T,{childList:!0,subtree:!0}),m.debug("Setting up mutation observer",a))},attachEvents:function(t,n){var i=e(t);n=e.isFunction(m[n])?m[n]:m.toggle,i.length>0?(m.debug("Attaching checkbox events to element",t,n),i.on("click"+b,n)):m.error(h.notFound)},event:{keydown:function(e){var t=e.which,n={enter:13,space:32,escape:27};t==n.escape&&(m.verbose("Escape key pressed blurring field"),x.blur()),e.ctrlKey||t!=n.enter&&t!=n.space||(m.verbose("Enter key pressed, toggling checkbox"),m.toggle.call(this),e.preventDefault())}},get:{radios:function(){return e('input[name="'+m.get.name()+'"]').closest(v.checkbox)},name:function(){return C.attr("name")}},is:{radio:function(){return C.hasClass(g.radio)||"radio"==C.attr("type")},checked:function(){return C.prop("checked")!==i&&C.prop("checked")},unchecked:function(){return!m.is.checked()}},can:{change:function(){return!(x.hasClass(g.disabled)||x.hasClass(g.readOnly)||C.prop("disabled"))},uncheck:function(){return"boolean"==typeof f.uncheckable?f.uncheckable:!m.is.radio()}},set:{checked:function(){var e;m.is.radio()&&(e=m.get.radios(),m.debug("Unchecking other radios",e),e.removeClass(g.checked)),x.addClass(g.checked)},tab:function(){C.attr("tabindex")===i&&C.attr("tabindex",0)}},create:{label:function(){C.prevAll(v.label).length>0?(C.prev(v.label).detach().insertAfter(C),m.debug("Moving existing label",w)):m.has.label()||(w=e("