From 927251fe01f408e6e41f524c0eeba3edba1bde9e Mon Sep 17 00:00:00 2001 From: jlukic Date: Tue, 30 Dec 2014 13:04:36 -0500 Subject: [PATCH] rebuild dist for jsfiddle --- RELEASE-NOTES.md | 1 + dist/components/dropdown.js | 49 +++++++++++++++++++++------------ dist/components/dropdown.min.js | 12 +------- dist/semantic.js | 49 +++++++++++++++++++++------------ dist/semantic.min.js | 6 ++-- 5 files changed, 69 insertions(+), 48 deletions(-) diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md index bcc4d0f38..4a960f951 100644 --- a/RELEASE-NOTES.md +++ b/RELEASE-NOTES.md @@ -7,6 +7,7 @@ - Concatenated ``dist/`` release included duplicate components when no component array specified. Added default components to ``tasks/default.js`` to allay issues **Enhancements* +- **Dropdown** - New setting ``allowCategorySelection`` lets menu items with sub menus be selected. Added example in docs. - **Label** - ``ui ribbon label`` can now appear on the right side of content when specifying ``ui right ribbon label`` - **Progress** - Progress bars now display all intermediary percentage values when animating. Improved performance when progress bar is rapidly updated. - **Popup** - Popup now uses the new property ``min-width: max-content`` to allow for better display with ``inline`` in some circumstances where it escapes parent element. diff --git a/dist/components/dropdown.js b/dist/components/dropdown.js index 43ec09ebf..f72c7ae54 100644 --- a/dist/components/dropdown.js +++ b/dist/components/dropdown.js @@ -605,16 +605,22 @@ $.fn.dropdown = function(parameters) { click: function (event) { var - $choice = $(this), - text = module.get.choiceText($choice), - value = module.get.choiceValue($choice, text), + $choice = $(this), + $target = $(event.target), + $subMenu = $choice.find(selector.menu), + text = module.get.choiceText($choice), + value = module.get.choiceValue($choice, text), callback = function() { module.remove.searchTerm(); module.determine.selectAction(text, value); }, - openingSubMenu = ($choice.find(selector.menu).size() > 0) + openingSubMenu = ($subMenu.size() > 0), + isSubItem = ($subMenu.find($target).size() > 0) ; - if( !openingSubMenu ) { + if(isSubItem) { + return false; + } + if(!openingSubMenu || settings.allowCategorySelection) { callback(); } } @@ -738,6 +744,12 @@ $.fn.dropdown = function(parameters) { : settings.preserveHTML ; if($choice !== undefined) { + if($choice.find(selector.menu).size() > 0) { + module.verbose('Retreiving text of element with sub-menu'); + $choice = $choice.clone(); + $choice.find(selector.menu).remove(); + $choice.find(selector.menuIcon).remove(); + } return ($choice.data(metadata.text) !== undefined) ? $choice.data(metadata.text) : (preserveHTML) @@ -1484,17 +1496,19 @@ $.fn.dropdown = function(parameters) { $.fn.dropdown.settings = { - debug : false, - verbose : true, - performance : true, + debug : false, + verbose : true, + performance : true, - on : 'click', - action : 'activate', + on : 'click', + action : 'activate', - allowTab : true, - fullTextSearch : false, - preserveHTML : true, - sortSelect : false, + allowTab : true, + fullTextSearch : false, + preserveHTML : true, + sortSelect : false, + + allowCategorySelection : false, delay : { hide : 300, @@ -1532,11 +1546,12 @@ $.fn.dropdown.settings = { selector : { dropdown : '.ui.dropdown', - text : '> .text:not(.icon)', input : '> input[type="hidden"], > select', - search : '> input.search, .menu > .search > input, .menu > input.search', + item : '.item', menu : '.menu', - item : '.item' + menuIcon : '.dropdown.icon', + search : '> input.search, .menu > .search > input, .menu > input.search', + text : '> .text:not(.icon)' }, className : { diff --git a/dist/components/dropdown.min.js b/dist/components/dropdown.min.js index 1b1fca6bf..f7e3505c6 100644 --- a/dist/components/dropdown.min.js +++ b/dist/components/dropdown.min.js @@ -1,11 +1 @@ - /* - * # Semantic UI - * https://github.com/Semantic-Org/Semantic-UI - * http://www.semantic-ui.com/ - * - * Copyright 2014 Contributors - * Released under the MIT license - * http://opensource.org/licenses/MIT - * - */ -!function(e,t,n,i){"use strict";e.fn.dropdown=function(o){var a,s=e(this),r=e(n),c=s.selector||"",u="ontouchstart"in n.documentElement,d=(new Date).getTime(),l=[],f=arguments[0],v="string"==typeof f,m=[].slice.call(arguments,1);return s.each(function(){var h,p,g,b,w=e.isPlainObject(o)?e.extend(!0,{},e.fn.dropdown.settings,o):e.extend({},e.fn.dropdown.settings),y=w.className,x=w.metadata,T=w.namespace,C=w.selector,S=w.error,k="."+T,z="module-"+T,I=e(this),D=I.find(C.text),E=I.find(C.search),F=I.find(C.input),A=I.prev().find(C.text).size()>0?I.prev().find(C.text):I.prev(),M=I.children(C.menu),O=M.find(C.item),q=!1,V=!1,Q=this,P=I.data(z);b={initialize:function(){b.debug("Initializing dropdown",w),b.setup.layout(),b.save.defaults(),b.set.selected(),b.create.id(),u&&b.bind.touchEvents(),b.bind.mouseEvents(),b.bind.keyboardEvents(),b.observeChanges(),b.instantiate()},instantiate:function(){b.verbose("Storing instance of dropdown",b),P=b,I.data(z,b)},destroy:function(){b.verbose("Destroying previous dropdown for",I),b.remove.tabbable(),I.off(k).removeData(z),r.off(h)},observeChanges:function(){"MutationObserver"in t&&(g=new MutationObserver(function(){b.debug("DOM tree modified, updating selector cache"),b.refresh()}),g.observe(Q,{childList:!0,subtree:!0}),b.debug("Setting up mutation observer",g))},create:{id:function(){b.verbose("Creating unique id for element"),p=b.get.uniqueID(),h="."+p}},search:function(){var e;e=E.val(),b.verbose("Searching for query",e),b.is.searchSelection()&&(b.filter(e),b.can.show()&&b.show())},setup:{layout:function(){I.is("select")&&b.setup.select(),b.is.search()&&!b.is.searchable()&&(E=e("").addClass(y.search).insertBefore(D)),w.allowTab&&b.set.tabbable()},select:function(){var t=b.get.selectValues();b.debug("Dropdown initialized on a select",t),F=I,F.parents(C.dropdown).size()>0?(b.debug("Creating dropdown menu only from template"),I=F.closest(C.dropdown),0===I.find("."+y.dropdown).size()&&e("
").addClass(y.menu).html(w.templates.menu(t)).appendTo(I)):(b.debug("Creating entire dropdown from template"),I=e("
").attr("class",F.attr("class")).addClass(y.selection).addClass(y.dropdown).html(w.templates.dropdown(t)).insertBefore(F),F.removeAttr("class").prependTo(I)),b.refresh()}},refresh:function(){D=I.find(C.text),E=I.find(C.search),F=I.find(C.input),M=I.children(C.menu),O=M.find(C.item)},toggle:function(){b.verbose("Toggling menu visibility"),b.is.active()?b.hide():b.show()},show:function(t){t=e.isFunction(t)?t:function(){},b.is.active()||b.is.allFiltered()||(b.debug("Showing dropdown"),b.animate.show(function(){b.can.click()&&b.bind.intent(),b.set.visible(),e.proxy(t,Q)()}),e.proxy(w.onShow,Q)())},hide:function(t){t=e.isFunction(t)?t:function(){},b.is.active()&&(b.debug("Hiding dropdown"),b.animate.hide(function(){b.remove.visible(),e.proxy(t,Q)()}),e.proxy(w.onHide,Q)())},hideOthers:function(){b.verbose("Finding other dropdowns to hide"),s.not(I).has(C.menu+":visible:not(."+y.animating+")").dropdown("hide")},hideSubMenus:function(){var e=M.find(C.menu);e.transition("hide")},bind:{keyboardEvents:function(){b.debug("Binding keyboard events"),I.on("keydown"+k,b.event.keydown),b.is.searchable()&&I.on(b.get.inputEvent(),C.search,b.event.input)},touchEvents:function(){b.debug("Touch device detected binding additional touch events"),b.is.searchSelection()||I.on("touchstart"+k,b.event.test.toggle),M.on("touchstart"+k,C.item,b.event.item.mouseenter)},mouseEvents:function(){b.verbose("Mouse detected binding mouse events"),b.is.searchSelection()?I.on("mousedown"+k,C.menu,b.event.menu.activate).on("mouseup"+k,C.menu,b.event.menu.deactivate).on("click"+k,C.search,b.show).on("focus"+k,C.search,b.event.searchFocus).on("blur"+k,C.search,b.event.searchBlur):("click"==w.on?I.on("click"+k,b.event.test.toggle):"hover"==w.on?I.on("mouseenter"+k,b.delay.show).on("mouseleave"+k,b.delay.hide):I.on(w.on+k,b.toggle),I.on("mousedown"+k,b.event.mousedown).on("mouseup"+k,b.event.mouseup).on("focus"+k,b.event.focus).on("blur"+k,b.event.blur)),M.on("mouseenter"+k,C.item,b.event.item.mouseenter).on("mouseleave"+k,C.item,b.event.item.mouseleave).on("click"+k,C.item,b.event.item.click)},intent:function(){b.verbose("Binding hide intent event to document"),u&&r.on("touchstart"+h,b.event.test.touch).on("touchmove"+h,b.event.test.touch),r.on("click"+h,b.event.test.hide)}},unbind:{intent:function(){b.verbose("Removing hide intent event from document"),u&&r.off("touchstart"+h).off("touchmove"+h),r.off("click"+h)}},filter:function(t){var n=e(),i=new RegExp("^"+t,"igm"),o=new RegExp(t,"ig");b.verbose("Searching for matching values"),O.each(function(){var t=e(this),a=b.get.choiceText(t,!1),s=b.get.choiceValue(t,a);a.match(i)||s.match(i)?n=n.add(t):w.fullTextSearch&&(a.match(o)||s.match(o))&&(n=n.add(t))}),b.debug("Setting filter",t),b.remove.filteredItem(),O.not(n).addClass(y.filtered),b.verbose("Selecting first non-filtered element"),b.remove.selectedItem(),O.not("."+y.filtered).eq(0).addClass(y.selected),b.is.allFiltered()&&(b.debug("All items filtered, hiding dropdown",t),b.hide(),e.proxy(w.onNoResults,Q)(t))},focusSearch:function(){b.is.search()&&E.focus()},event:{mousedown:function(){q=!0},mouseup:function(){q=!1},focus:function(){!q&&b.is.hidden()&&b.show()},blur:function(){var e=n.activeElement===this;q||e||b.hide()},searchFocus:function(){q=!0,b.show()},searchBlur:function(){var e=n.activeElement===this;V||e||b.hide()},input:function(){b.set.filtered(),clearTimeout(b.timer),b.timer=setTimeout(b.search,w.delay.search)},keydown:function(t){var n,i=O.not(y.filtered).filter("."+y.selected).eq(0),o=O.not("."+y.filtered),a=t.which,s={enter:13,escape:27,upArrow:38,downArrow:40},r=y.selected,c=o.index(i),u=i.size()>0;if(u||(i=O.filter("."+y.active).eq(0),u=i.size()>0),a==s.escape&&(b.verbose("Escape key pressed, closing dropdown"),b.hide()),a==s.downArrow&&(b.verbose("Down key pressed, showing dropdown"),b.show()),b.is.visible()){if(a==s.enter&&u)return b.verbose("Enter key pressed, choosing selected item"),e.proxy(b.event.item.click,i)(t),t.preventDefault(),!1;a==s.upArrow?(n=u?i.prevAll(C.item+":not(."+y.filtered+")").eq(0):o.eq(0),0!==c&&(b.verbose("Up key pressed, changing active item"),O.removeClass(r),n.addClass(r),b.set.scrollPosition(n)),t.preventDefault()):a==s.downArrow&&(n=u?i.nextAll(C.item+":not(."+y.filtered+")").eq(0):o.eq(0),c+10&&(clearTimeout(b.itemTimer),b.itemTimer=setTimeout(function(){e.each(i,function(){b.animate.hide(!1,e(this))}),b.verbose("Showing sub-menu",n),b.animate.show(!1,n)},w.delay.show),t.preventDefault())},mouseleave:function(){var t=e(this).children(C.menu);t.size()>0&&(clearTimeout(b.itemTimer),b.itemTimer=setTimeout(function(){b.verbose("Hiding sub-menu",t),b.animate.hide(!1,t)},w.delay.hide))},click:function(){var t=e(this),n=b.get.choiceText(t),i=b.get.choiceValue(t,n),o=function(){b.remove.searchTerm(),b.determine.selectAction(n,i)},a=t.find(C.menu).size()>0;a||o()}},resetStyle:function(){e(this).removeAttr("style")}},determine:{selectAction:function(t,n){b.verbose("Determining action",w.action),e.isFunction(b.action[w.action])?(b.verbose("Triggering preset action",w.action,t,n),b.action[w.action](t,n)):e.isFunction(w.action)?(b.verbose("Triggering user action",w.action,t,n),w.action(t,n)):b.error(S.action,w.action)},eventInModule:function(t,n){return n=e.isFunction(n)?n:function(){},0===e(t.target).closest(I).size()?(b.verbose("Triggering event",n),n(),!0):(b.verbose("Event occurred in dropdown, canceling callback"),!1)},eventInMenu:function(t,n){return n=e.isFunction(n)?n:function(){},0===e(t.target).closest(M).size()?(b.verbose("Triggering event",n),n(),!0):(b.verbose("Event occurred in dropdown menu, canceling callback"),!1)}},action:{nothing:function(){},hide:function(){b.hide(function(){b.remove.filteredItem()})},select:function(e,t){t=t!==i?t:e,b.set.selected(t),b.set.value(t),b.hide(function(){b.remove.filteredItem()})},activate:function(e,t){t=t!==i?t:e,b.set.selected(t),b.set.value(t),b.hide(function(){b.remove.filteredItem()})},combo:function(e,t){t=t!==i?t:e,b.set.selected(t),b.set.value(t),b.hide(function(){b.remove.filteredItem()})}},get:{text:function(){return D.text()},value:function(){return F.size()>0?F.val():I.data(x.value)},choiceText:function(e,t){return t=t!==i?t:w.preserveHTML,e!==i?e.data(x.text)!==i?e.data(x.text):t?e.html():e.text():void 0},choiceValue:function(e,t){return t=t||b.get.choiceText(D),e.data(x.value)!==i?e.data(x.value):"string"==typeof t?t.toLowerCase():t},inputEvent:function(){var e=E[0];return e?e.oninput!==i?"input":e.onpropertychange!==i?"propertychange":"keyup":!1},selectValues:function(){var t={};return t.values=w.sortSelect?{}:[],I.find("option").each(function(){var n=e(this).html(),o=e(this).attr("value")!==i?e(this).attr("value"):n;""===o?t.placeholder=n:w.sortSelect?t.values[o]={name:n,value:o}:t.values.push({name:n,value:o})}),w.sortSelect?b.debug("Retrieved and sorted values from select",t):b.debug("Retreived values from select",t),t},activeItem:function(){return O.filter("."+y.active)},item:function(t,n){var o=!1;return t=t!==i?t:b.get.value()!==i?b.get.value():b.get.text(),n=""===t||0===t?!0:n||!1,t!==i?O.each(function(){var i=e(this),a=b.get.choiceText(i),s=b.get.choiceValue(i,a);n?(b.verbose("Ambiguous dropdown value using strict type check",i,t),s===t?o=e(this):o||a!==t||(o=e(this))):s==t?(b.verbose("Found select item by value",s,t),o=e(this)):o||a!=t||(b.verbose("Found select item by text",a,t),o=e(this))}):t=b.get.text(),o||!1},uniqueID:function(){return(Math.random().toString(16)+"000000000").substr(2,8)}},restore:{defaults:function(){b.restore.defaultText(),b.restore.defaultValue()},defaultText:function(){var e=I.data(x.defaultText);b.debug("Restoring default text",e),b.set.text(e)},defaultValue:function(){var e=I.data(x.defaultValue);e!==i&&(b.debug("Restoring default value",e),b.set.selected(e),b.set.value(e))}},save:{defaults:function(){b.save.defaultText(),b.save.defaultValue()},defaultValue:function(){I.data(x.defaultValue,b.get.value())},defaultText:function(){I.data(x.defaultText,D.text())}},set:{filtered:function(){var e=E.val(),t="string"==typeof e&&e.length>0;t?D.addClass(y.filtered):D.removeClass(y.filtered)},tabbable:function(){b.is.searchable()?(b.debug("Searchable dropdown initialized"),E.val("").attr("tabindex",0),M.attr("tabindex","-1")):(b.debug("Simple selection dropdown initialized"),I.attr("tabindex")||(I.attr("tabindex",0),M.attr("tabindex","-1")))},scrollPosition:function(e,t){var n,o,a,s,r,c,u,d,l,f=5;e=e||b.get.activeItem(),n=e&&e.size()>0,t=t!==i?t:!1,e&&n&&(M.hasClass(y.visible)||M.addClass(y.loading),u=M.height(),a=e.height(),c=M.scrollTop(),r=M.offset().top,s=e.offset().top,o=c-r+s,l=o+f>c+u,d=c>o-f,b.debug("Scrolling to active item",o),(d||l||t)&&M.scrollTop(o).removeClass(y.loading))},text:function(e){"combo"==w.action?(b.debug("Changing combo button text",e,A),w.preserveHTML?A.html(e):A.text(e)):"select"!==w.action&&(b.debug("Changing text",e,D),D.removeClass(y.filtered).removeClass(y.placeholder),w.preserveHTML?D.html(e):D.text(e))},value:function(e){b.debug("Adding selected value to hidden input",e,F),F.size()>0?F.val(e).trigger("change"):I.data(x.value,e)},active:function(){I.addClass(y.active)},visible:function(){I.addClass(y.visible)},selected:function(t){var n,i=b.get.item(t);i&&(b.debug("Setting selected menu item to",i),b.remove.activeItem(),b.remove.selectedItem(),i.addClass(y.active).addClass(y.selected),n=b.get.choiceText(i),b.set.text(n),e.proxy(w.onChange,Q)(t,n,i))}},remove:{active:function(){I.removeClass(y.active)},visible:function(){I.removeClass(y.visible)},activeItem:function(){O.removeClass(y.active)},filteredItem:function(){O.removeClass(y.filtered)},searchTerm:function(){E.val("")},selectedItem:function(){O.removeClass(y.selected)},tabbable:function(){b.is.searchable()?(b.debug("Searchable dropdown initialized"),E.attr("tabindex","-1"),M.attr("tabindex","-1")):(b.debug("Simple selection dropdown initialized"),I.attr("tabindex","-1"),M.attr("tabindex","-1"))}},is:{active:function(){return I.hasClass(y.active)},animating:function(e){return e?e.is(":animated")||e.transition&&e.transition("is animating"):M.is(":animated")||M.transition&&M.transition("is animating")},allFiltered:function(){return O.filter("."+y.filtered).size()===O.size()},hidden:function(e){return e?e.is(":hidden"):M.is(":hidden")},search:function(){return I.hasClass(y.search)},searchable:function(){return E.size()>0},searchSelection:function(){return b.is.searchable()&&E.parent().is(I)},selection:function(){return I.hasClass(y.selection)},visible:function(e){return e?e.is(":visible"):M.is(":visible")}},can:{click:function(){return u||"click"==w.on},show:function(){return!I.hasClass(y.disabled)}},animate:{show:function(t,n){var o=n||M,a=n?function(){}:function(){b.hideSubMenus(),b.hideOthers(),b.set.active()};t=e.isFunction(t)?t:function(){},b.set.scrollPosition(b.get.activeItem(),!0),b.verbose("Doing menu show animation",o),(b.is.hidden(o)||b.is.animating(o))&&("none"==w.transition?e.proxy(t,Q)():e.fn.transition!==i&&I.transition("is supported")?o.transition({animation:w.transition+" in",debug:w.debug,verbose:w.verbose,duration:w.duration,queue:!0,onStart:a,onComplete:function(){e.proxy(t,Q)()}}):"slide down"==w.transition?(a(),o.hide().clearQueue().children().clearQueue().css("opacity",0).delay(50).animate({opacity:1},w.duration,"easeOutQuad",b.event.resetStyle).end().slideDown(100,"easeOutQuad",function(){e.proxy(b.event.resetStyle,this)(),e.proxy(t,Q)()})):"fade"==w.transition?(a(),o.hide().clearQueue().fadeIn(w.duration,function(){e.proxy(b.event.resetStyle,this)(),e.proxy(t,Q)()})):b.error(S.transition,w.transition))},hide:function(t,n){var o=n||M,a=(n?.9*w.duration:w.duration,n?function(){}:function(){b.can.click()&&b.unbind.intent(),b.focusSearch(),b.remove.active()});t=e.isFunction(t)?t:function(){},(b.is.visible(o)||b.is.animating(o))&&(b.verbose("Doing menu hide animation",o),"none"==w.transition?e.proxy(t,Q)():e.fn.transition!==i&&I.transition("is supported")?o.transition({animation:w.transition+" out",duration:w.duration,debug:w.debug,verbose:w.verbose,queue:!0,onStart:a,onComplete:function(){e.proxy(t,Q)()}}):"slide down"==w.transition?(a(),o.show().clearQueue().children().clearQueue().css("opacity",1).animate({opacity:0},100,"easeOutQuad",b.event.resetStyle).end().delay(50).slideUp(100,"easeOutQuad",function(){e.proxy(b.event.resetStyle,this)(),e.proxy(t,Q)()})):"fade"==w.transition?(a(),o.show().clearQueue().fadeOut(150,function(){e.proxy(b.event.resetStyle,this)(),e.proxy(t,Q)()})):b.error(S.transition))}},delay:{show:function(){b.verbose("Delaying show event to ensure user intent"),clearTimeout(b.timer),b.timer=setTimeout(b.show,w.delay.show)},hide:function(){b.verbose("Delaying hide event to ensure user intent"),clearTimeout(b.timer),b.timer=setTimeout(b.hide,w.delay.hide)}},setting:function(t,n){if(b.debug("Changing setting",t,n),e.isPlainObject(t))e.extend(!0,w,t);else{if(n===i)return w[t];w[t]=n}},internal:function(t,n){if(e.isPlainObject(t))e.extend(!0,b,t);else{if(n===i)return b[t];b[t]=n}},debug:function(){w.debug&&(w.performance?b.performance.log(arguments):(b.debug=Function.prototype.bind.call(console.info,console,w.name+":"),b.debug.apply(console,arguments)))},verbose:function(){w.verbose&&w.debug&&(w.performance?b.performance.log(arguments):(b.verbose=Function.prototype.bind.call(console.info,console,w.name+":"),b.verbose.apply(console,arguments)))},error:function(){b.error=Function.prototype.bind.call(console.error,console,w.name+":"),b.error.apply(console,arguments)},performance:{log:function(e){var t,n,i;w.performance&&(t=(new Date).getTime(),i=d||t,n=t-i,d=t,l.push({Name:e[0],Arguments:[].slice.call(e,1)||"",Element:Q,"Execution Time":n})),clearTimeout(b.performance.timer),b.performance.timer=setTimeout(b.performance.display,100)},display:function(){var t=w.name+":",n=0;d=!1,clearTimeout(b.performance.timer),e.each(l,function(e,t){n+=t["Execution Time"]}),t+=" "+n+"ms",c&&(t+=" '"+c+"'"),(console.group!==i||console.table!==i)&&l.length>0&&(console.groupCollapsed(t),console.table?console.table(l):e.each(l,function(e,t){console.log(t.Name+": "+t["Execution Time"]+"ms")}),console.groupEnd()),l=[]}},invoke:function(t,n,o){var s,r,c,u=P;return n=n||m,o=Q||o,"string"==typeof t&&u!==i&&(t=t.split(/[\. ]/),s=t.length-1,e.each(t,function(n,o){var a=n!=s?o+t[n+1].charAt(0).toUpperCase()+t[n+1].slice(1):t;if(e.isPlainObject(u[a])&&n!=s)u=u[a];else{if(u[a]!==i)return r=u[a],!1;if(!e.isPlainObject(u[o])||n==s)return u[o]!==i?(r=u[o],!1):(b.error(S.method,t),!1);u=u[o]}})),e.isFunction(r)?c=r.apply(o,n):r!==i&&(c=r),e.isArray(a)?a.push(c):a!==i?a=[a,c]:c!==i&&(a=c),r}},v?(P===i&&b.initialize(),b.invoke(f)):(P!==i&&b.destroy(),b.initialize())}),a!==i?a:this},e.fn.dropdown.settings={debug:!1,verbose:!0,performance:!0,on:"click",action:"activate",allowTab:!0,fullTextSearch:!1,preserveHTML:!0,sortSelect:!1,delay:{hide:300,show:200,search:50,touch:50},transition:"slide down",duration:250,onNoResults:function(){},onChange:function(){},onShow:function(){},onHide:function(){},name:"Dropdown",namespace:"dropdown",error:{action:"You called a dropdown action that was not defined",method:"The method you called is not defined.",transition:"The requested transition was not found"},metadata:{defaultText:"defaultText",defaultValue:"defaultValue",text:"text",value:"value"},selector:{dropdown:".ui.dropdown",text:"> .text:not(.icon)",input:'> input[type="hidden"], > select',search:"> input.search, .menu > .search > input, .menu > input.search",menu:".menu",item:".item"},className:{active:"active",animating:"animating",disabled:"disabled",dropdown:"ui dropdown",filtered:"filtered",loading:"loading",menu:"menu",placeholder:"default",search:"search",selected:"selected",selection:"selection",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},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 +!function(e,t,n,i){"use strict";e.fn.dropdown=function(o){var a,s=e(this),r=e(n),c=s.selector||"",u="ontouchstart"in n.documentElement,d=(new Date).getTime(),l=[],f=arguments[0],v="string"==typeof f,m=[].slice.call(arguments,1);return s.each(function(){var h,g,p,b,w=e.isPlainObject(o)?e.extend(!0,{},e.fn.dropdown.settings,o):e.extend({},e.fn.dropdown.settings),y=w.className,x=w.metadata,T=w.namespace,C=w.selector,S=w.error,k="."+T,z="module-"+T,I=e(this),D=I.find(C.text),E=I.find(C.search),F=I.find(C.input),A=I.prev().find(C.text).size()>0?I.prev().find(C.text):I.prev(),M=I.children(C.menu),O=M.find(C.item),q=!1,V=!1,Q=this,P=I.data(z);b={initialize:function(){b.debug("Initializing dropdown",w),b.setup.layout(),b.save.defaults(),b.set.selected(),b.create.id(),u&&b.bind.touchEvents(),b.bind.mouseEvents(),b.bind.keyboardEvents(),b.observeChanges(),b.instantiate()},instantiate:function(){b.verbose("Storing instance of dropdown",b),P=b,I.data(z,b)},destroy:function(){b.verbose("Destroying previous dropdown for",I),b.remove.tabbable(),I.off(k).removeData(z),r.off(h)},observeChanges:function(){"MutationObserver"in t&&(p=new MutationObserver(function(){b.debug("DOM tree modified, updating selector cache"),b.refresh()}),p.observe(Q,{childList:!0,subtree:!0}),b.debug("Setting up mutation observer",p))},create:{id:function(){b.verbose("Creating unique id for element"),g=b.get.uniqueID(),h="."+g}},search:function(){var e;e=E.val(),b.verbose("Searching for query",e),b.is.searchSelection()&&(b.filter(e),b.can.show()&&b.show())},setup:{layout:function(){I.is("select")&&b.setup.select(),b.is.search()&&!b.is.searchable()&&(E=e("").addClass(y.search).insertBefore(D)),w.allowTab&&b.set.tabbable()},select:function(){var t=b.get.selectValues();b.debug("Dropdown initialized on a select",t),F=I,F.parents(C.dropdown).size()>0?(b.debug("Creating dropdown menu only from template"),I=F.closest(C.dropdown),0===I.find("."+y.dropdown).size()&&e("
").addClass(y.menu).html(w.templates.menu(t)).appendTo(I)):(b.debug("Creating entire dropdown from template"),I=e("
").attr("class",F.attr("class")).addClass(y.selection).addClass(y.dropdown).html(w.templates.dropdown(t)).insertBefore(F),F.removeAttr("class").prependTo(I)),b.refresh()}},refresh:function(){D=I.find(C.text),E=I.find(C.search),F=I.find(C.input),M=I.children(C.menu),O=M.find(C.item)},toggle:function(){b.verbose("Toggling menu visibility"),b.is.active()?b.hide():b.show()},show:function(t){t=e.isFunction(t)?t:function(){},b.is.active()||b.is.allFiltered()||(b.debug("Showing dropdown"),b.animate.show(function(){b.can.click()&&b.bind.intent(),b.set.visible(),e.proxy(t,Q)()}),e.proxy(w.onShow,Q)())},hide:function(t){t=e.isFunction(t)?t:function(){},b.is.active()&&(b.debug("Hiding dropdown"),b.animate.hide(function(){b.remove.visible(),e.proxy(t,Q)()}),e.proxy(w.onHide,Q)())},hideOthers:function(){b.verbose("Finding other dropdowns to hide"),s.not(I).has(C.menu+":visible:not(."+y.animating+")").dropdown("hide")},hideSubMenus:function(){var e=M.find(C.menu);e.transition("hide")},bind:{keyboardEvents:function(){b.debug("Binding keyboard events"),I.on("keydown"+k,b.event.keydown),b.is.searchable()&&I.on(b.get.inputEvent(),C.search,b.event.input)},touchEvents:function(){b.debug("Touch device detected binding additional touch events"),b.is.searchSelection()||I.on("touchstart"+k,b.event.test.toggle),M.on("touchstart"+k,C.item,b.event.item.mouseenter)},mouseEvents:function(){b.verbose("Mouse detected binding mouse events"),b.is.searchSelection()?I.on("mousedown"+k,C.menu,b.event.menu.activate).on("mouseup"+k,C.menu,b.event.menu.deactivate).on("click"+k,C.search,b.show).on("focus"+k,C.search,b.event.searchFocus).on("blur"+k,C.search,b.event.searchBlur):("click"==w.on?I.on("click"+k,b.event.test.toggle):"hover"==w.on?I.on("mouseenter"+k,b.delay.show).on("mouseleave"+k,b.delay.hide):I.on(w.on+k,b.toggle),I.on("mousedown"+k,b.event.mousedown).on("mouseup"+k,b.event.mouseup).on("focus"+k,b.event.focus).on("blur"+k,b.event.blur)),M.on("mouseenter"+k,C.item,b.event.item.mouseenter).on("mouseleave"+k,C.item,b.event.item.mouseleave).on("click"+k,C.item,b.event.item.click)},intent:function(){b.verbose("Binding hide intent event to document"),u&&r.on("touchstart"+h,b.event.test.touch).on("touchmove"+h,b.event.test.touch),r.on("click"+h,b.event.test.hide)}},unbind:{intent:function(){b.verbose("Removing hide intent event from document"),u&&r.off("touchstart"+h).off("touchmove"+h),r.off("click"+h)}},filter:function(t){var n=e(),i=new RegExp("^"+t,"igm"),o=new RegExp(t,"ig");b.verbose("Searching for matching values"),O.each(function(){var t=e(this),a=b.get.choiceText(t,!1),s=b.get.choiceValue(t,a);a.match(i)||s.match(i)?n=n.add(t):w.fullTextSearch&&(a.match(o)||s.match(o))&&(n=n.add(t))}),b.debug("Setting filter",t),b.remove.filteredItem(),O.not(n).addClass(y.filtered),b.verbose("Selecting first non-filtered element"),b.remove.selectedItem(),O.not("."+y.filtered).eq(0).addClass(y.selected),b.is.allFiltered()&&(b.debug("All items filtered, hiding dropdown",t),b.hide(),e.proxy(w.onNoResults,Q)(t))},focusSearch:function(){b.is.search()&&E.focus()},event:{mousedown:function(){q=!0},mouseup:function(){q=!1},focus:function(){!q&&b.is.hidden()&&b.show()},blur:function(){var e=n.activeElement===this;q||e||b.hide()},searchFocus:function(){q=!0,b.show()},searchBlur:function(){var e=n.activeElement===this;V||e||b.hide()},input:function(){b.set.filtered(),clearTimeout(b.timer),b.timer=setTimeout(b.search,w.delay.search)},keydown:function(t){var n,i=O.not(y.filtered).filter("."+y.selected).eq(0),o=O.not("."+y.filtered),a=t.which,s={enter:13,escape:27,upArrow:38,downArrow:40},r=y.selected,c=o.index(i),u=i.size()>0;if(u||(i=O.filter("."+y.active).eq(0),u=i.size()>0),a==s.escape&&(b.verbose("Escape key pressed, closing dropdown"),b.hide()),a==s.downArrow&&(b.verbose("Down key pressed, showing dropdown"),b.show()),b.is.visible()){if(a==s.enter&&u)return b.verbose("Enter key pressed, choosing selected item"),e.proxy(b.event.item.click,i)(t),t.preventDefault(),!1;a==s.upArrow?(n=u?i.prevAll(C.item+":not(."+y.filtered+")").eq(0):o.eq(0),0!==c&&(b.verbose("Up key pressed, changing active item"),O.removeClass(r),n.addClass(r),b.set.scrollPosition(n)),t.preventDefault()):a==s.downArrow&&(n=u?i.nextAll(C.item+":not(."+y.filtered+")").eq(0):o.eq(0),c+10&&(clearTimeout(b.itemTimer),b.itemTimer=setTimeout(function(){e.each(i,function(){b.animate.hide(!1,e(this))}),b.verbose("Showing sub-menu",n),b.animate.show(!1,n)},w.delay.show),t.preventDefault())},mouseleave:function(){var t=e(this).children(C.menu);t.size()>0&&(clearTimeout(b.itemTimer),b.itemTimer=setTimeout(function(){b.verbose("Hiding sub-menu",t),b.animate.hide(!1,t)},w.delay.hide))},click:function(t){var n=e(this),i=e(t.target),o=n.find(C.menu),a=b.get.choiceText(n),s=b.get.choiceValue(n,a),r=function(){b.remove.searchTerm(),b.determine.selectAction(a,s)},c=o.size()>0,u=o.find(i).size()>0;return u?!1:void((!c||w.allowCategorySelection)&&r())}},resetStyle:function(){e(this).removeAttr("style")}},determine:{selectAction:function(t,n){b.verbose("Determining action",w.action),e.isFunction(b.action[w.action])?(b.verbose("Triggering preset action",w.action,t,n),b.action[w.action](t,n)):e.isFunction(w.action)?(b.verbose("Triggering user action",w.action,t,n),w.action(t,n)):b.error(S.action,w.action)},eventInModule:function(t,n){return n=e.isFunction(n)?n:function(){},0===e(t.target).closest(I).size()?(b.verbose("Triggering event",n),n(),!0):(b.verbose("Event occurred in dropdown, canceling callback"),!1)},eventInMenu:function(t,n){return n=e.isFunction(n)?n:function(){},0===e(t.target).closest(M).size()?(b.verbose("Triggering event",n),n(),!0):(b.verbose("Event occurred in dropdown menu, canceling callback"),!1)}},action:{nothing:function(){},hide:function(){b.hide(function(){b.remove.filteredItem()})},select:function(e,t){t=t!==i?t:e,b.set.selected(t),b.set.value(t),b.hide(function(){b.remove.filteredItem()})},activate:function(e,t){t=t!==i?t:e,b.set.selected(t),b.set.value(t),b.hide(function(){b.remove.filteredItem()})},combo:function(e,t){t=t!==i?t:e,b.set.selected(t),b.set.value(t),b.hide(function(){b.remove.filteredItem()})}},get:{text:function(){return D.text()},value:function(){return F.size()>0?F.val():I.data(x.value)},choiceText:function(e,t){return t=t!==i?t:w.preserveHTML,e!==i?(e.find(C.menu).size()>0&&(b.verbose("Retreiving text of element with sub-menu"),e=e.clone(),e.find(C.menu).remove(),e.find(C.menuIcon).remove()),e.data(x.text)!==i?e.data(x.text):t?e.html():e.text()):void 0},choiceValue:function(e,t){return t=t||b.get.choiceText(D),e.data(x.value)!==i?e.data(x.value):"string"==typeof t?t.toLowerCase():t},inputEvent:function(){var e=E[0];return e?e.oninput!==i?"input":e.onpropertychange!==i?"propertychange":"keyup":!1},selectValues:function(){var t={};return t.values=w.sortSelect?{}:[],I.find("option").each(function(){var n=e(this).html(),o=e(this).attr("value")!==i?e(this).attr("value"):n;""===o?t.placeholder=n:w.sortSelect?t.values[o]={name:n,value:o}:t.values.push({name:n,value:o})}),w.sortSelect?b.debug("Retrieved and sorted values from select",t):b.debug("Retreived values from select",t),t},activeItem:function(){return O.filter("."+y.active)},item:function(t,n){var o=!1;return t=t!==i?t:b.get.value()!==i?b.get.value():b.get.text(),n=""===t||0===t?!0:n||!1,t!==i?O.each(function(){var i=e(this),a=b.get.choiceText(i),s=b.get.choiceValue(i,a);n?(b.verbose("Ambiguous dropdown value using strict type check",i,t),s===t?o=e(this):o||a!==t||(o=e(this))):s==t?(b.verbose("Found select item by value",s,t),o=e(this)):o||a!=t||(b.verbose("Found select item by text",a,t),o=e(this))}):t=b.get.text(),o||!1},uniqueID:function(){return(Math.random().toString(16)+"000000000").substr(2,8)}},restore:{defaults:function(){b.restore.defaultText(),b.restore.defaultValue()},defaultText:function(){var e=I.data(x.defaultText);b.debug("Restoring default text",e),b.set.text(e)},defaultValue:function(){var e=I.data(x.defaultValue);e!==i&&(b.debug("Restoring default value",e),b.set.selected(e),b.set.value(e))}},save:{defaults:function(){b.save.defaultText(),b.save.defaultValue()},defaultValue:function(){I.data(x.defaultValue,b.get.value())},defaultText:function(){I.data(x.defaultText,D.text())}},set:{filtered:function(){var e=E.val(),t="string"==typeof e&&e.length>0;t?D.addClass(y.filtered):D.removeClass(y.filtered)},tabbable:function(){b.is.searchable()?(b.debug("Searchable dropdown initialized"),E.val("").attr("tabindex",0),M.attr("tabindex","-1")):(b.debug("Simple selection dropdown initialized"),I.attr("tabindex")||(I.attr("tabindex",0),M.attr("tabindex","-1")))},scrollPosition:function(e,t){var n,o,a,s,r,c,u,d,l,f=5;e=e||b.get.activeItem(),n=e&&e.size()>0,t=t!==i?t:!1,e&&n&&(M.hasClass(y.visible)||M.addClass(y.loading),u=M.height(),a=e.height(),c=M.scrollTop(),r=M.offset().top,s=e.offset().top,o=c-r+s,l=o+f>c+u,d=c>o-f,b.debug("Scrolling to active item",o),(d||l||t)&&M.scrollTop(o).removeClass(y.loading))},text:function(e){"combo"==w.action?(b.debug("Changing combo button text",e,A),w.preserveHTML?A.html(e):A.text(e)):"select"!==w.action&&(b.debug("Changing text",e,D),D.removeClass(y.filtered).removeClass(y.placeholder),w.preserveHTML?D.html(e):D.text(e))},value:function(e){b.debug("Adding selected value to hidden input",e,F),F.size()>0?F.val(e).trigger("change"):I.data(x.value,e)},active:function(){I.addClass(y.active)},visible:function(){I.addClass(y.visible)},selected:function(t){var n,i=b.get.item(t);i&&(b.debug("Setting selected menu item to",i),b.remove.activeItem(),b.remove.selectedItem(),i.addClass(y.active).addClass(y.selected),n=b.get.choiceText(i),b.set.text(n),e.proxy(w.onChange,Q)(t,n,i))}},remove:{active:function(){I.removeClass(y.active)},visible:function(){I.removeClass(y.visible)},activeItem:function(){O.removeClass(y.active)},filteredItem:function(){O.removeClass(y.filtered)},searchTerm:function(){E.val("")},selectedItem:function(){O.removeClass(y.selected)},tabbable:function(){b.is.searchable()?(b.debug("Searchable dropdown initialized"),E.attr("tabindex","-1"),M.attr("tabindex","-1")):(b.debug("Simple selection dropdown initialized"),I.attr("tabindex","-1"),M.attr("tabindex","-1"))}},is:{active:function(){return I.hasClass(y.active)},animating:function(e){return e?e.is(":animated")||e.transition&&e.transition("is animating"):M.is(":animated")||M.transition&&M.transition("is animating")},allFiltered:function(){return O.filter("."+y.filtered).size()===O.size()},hidden:function(e){return e?e.is(":hidden"):M.is(":hidden")},search:function(){return I.hasClass(y.search)},searchable:function(){return E.size()>0},searchSelection:function(){return b.is.searchable()&&E.parent().is(I)},selection:function(){return I.hasClass(y.selection)},visible:function(e){return e?e.is(":visible"):M.is(":visible")}},can:{click:function(){return u||"click"==w.on},show:function(){return!I.hasClass(y.disabled)}},animate:{show:function(t,n){var o=n||M,a=n?function(){}:function(){b.hideSubMenus(),b.hideOthers(),b.set.active()};t=e.isFunction(t)?t:function(){},b.set.scrollPosition(b.get.activeItem(),!0),b.verbose("Doing menu show animation",o),(b.is.hidden(o)||b.is.animating(o))&&("none"==w.transition?e.proxy(t,Q)():e.fn.transition!==i&&I.transition("is supported")?o.transition({animation:w.transition+" in",debug:w.debug,verbose:w.verbose,duration:w.duration,queue:!0,onStart:a,onComplete:function(){e.proxy(t,Q)()}}):"slide down"==w.transition?(a(),o.hide().clearQueue().children().clearQueue().css("opacity",0).delay(50).animate({opacity:1},w.duration,"easeOutQuad",b.event.resetStyle).end().slideDown(100,"easeOutQuad",function(){e.proxy(b.event.resetStyle,this)(),e.proxy(t,Q)()})):"fade"==w.transition?(a(),o.hide().clearQueue().fadeIn(w.duration,function(){e.proxy(b.event.resetStyle,this)(),e.proxy(t,Q)()})):b.error(S.transition,w.transition))},hide:function(t,n){var o=n||M,a=(n?.9*w.duration:w.duration,n?function(){}:function(){b.can.click()&&b.unbind.intent(),b.focusSearch(),b.remove.active()});t=e.isFunction(t)?t:function(){},(b.is.visible(o)||b.is.animating(o))&&(b.verbose("Doing menu hide animation",o),"none"==w.transition?e.proxy(t,Q)():e.fn.transition!==i&&I.transition("is supported")?o.transition({animation:w.transition+" out",duration:w.duration,debug:w.debug,verbose:w.verbose,queue:!0,onStart:a,onComplete:function(){e.proxy(t,Q)()}}):"slide down"==w.transition?(a(),o.show().clearQueue().children().clearQueue().css("opacity",1).animate({opacity:0},100,"easeOutQuad",b.event.resetStyle).end().delay(50).slideUp(100,"easeOutQuad",function(){e.proxy(b.event.resetStyle,this)(),e.proxy(t,Q)()})):"fade"==w.transition?(a(),o.show().clearQueue().fadeOut(150,function(){e.proxy(b.event.resetStyle,this)(),e.proxy(t,Q)()})):b.error(S.transition))}},delay:{show:function(){b.verbose("Delaying show event to ensure user intent"),clearTimeout(b.timer),b.timer=setTimeout(b.show,w.delay.show)},hide:function(){b.verbose("Delaying hide event to ensure user intent"),clearTimeout(b.timer),b.timer=setTimeout(b.hide,w.delay.hide)}},setting:function(t,n){if(b.debug("Changing setting",t,n),e.isPlainObject(t))e.extend(!0,w,t);else{if(n===i)return w[t];w[t]=n}},internal:function(t,n){if(e.isPlainObject(t))e.extend(!0,b,t);else{if(n===i)return b[t];b[t]=n}},debug:function(){w.debug&&(w.performance?b.performance.log(arguments):(b.debug=Function.prototype.bind.call(console.info,console,w.name+":"),b.debug.apply(console,arguments)))},verbose:function(){w.verbose&&w.debug&&(w.performance?b.performance.log(arguments):(b.verbose=Function.prototype.bind.call(console.info,console,w.name+":"),b.verbose.apply(console,arguments)))},error:function(){b.error=Function.prototype.bind.call(console.error,console,w.name+":"),b.error.apply(console,arguments)},performance:{log:function(e){var t,n,i;w.performance&&(t=(new Date).getTime(),i=d||t,n=t-i,d=t,l.push({Name:e[0],Arguments:[].slice.call(e,1)||"",Element:Q,"Execution Time":n})),clearTimeout(b.performance.timer),b.performance.timer=setTimeout(b.performance.display,100)},display:function(){var t=w.name+":",n=0;d=!1,clearTimeout(b.performance.timer),e.each(l,function(e,t){n+=t["Execution Time"]}),t+=" "+n+"ms",c&&(t+=" '"+c+"'"),(console.group!==i||console.table!==i)&&l.length>0&&(console.groupCollapsed(t),console.table?console.table(l):e.each(l,function(e,t){console.log(t.Name+": "+t["Execution Time"]+"ms")}),console.groupEnd()),l=[]}},invoke:function(t,n,o){var s,r,c,u=P;return n=n||m,o=Q||o,"string"==typeof t&&u!==i&&(t=t.split(/[\. ]/),s=t.length-1,e.each(t,function(n,o){var a=n!=s?o+t[n+1].charAt(0).toUpperCase()+t[n+1].slice(1):t;if(e.isPlainObject(u[a])&&n!=s)u=u[a];else{if(u[a]!==i)return r=u[a],!1;if(!e.isPlainObject(u[o])||n==s)return u[o]!==i?(r=u[o],!1):(b.error(S.method,t),!1);u=u[o]}})),e.isFunction(r)?c=r.apply(o,n):r!==i&&(c=r),e.isArray(a)?a.push(c):a!==i?a=[a,c]:c!==i&&(a=c),r}},v?(P===i&&b.initialize(),b.invoke(f)):(P!==i&&b.destroy(),b.initialize())}),a!==i?a:this},e.fn.dropdown.settings={debug:!1,verbose:!0,performance:!0,on:"click",action:"activate",allowTab:!0,fullTextSearch:!1,preserveHTML:!0,sortSelect:!1,allowCategorySelection:!1,delay:{hide:300,show:200,search:50,touch:50},transition:"slide down",duration:250,onNoResults:function(){},onChange:function(){},onShow:function(){},onHide:function(){},name:"Dropdown",namespace:"dropdown",error:{action:"You called a dropdown action that was not defined",method:"The method you called is not defined.",transition:"The requested transition was not found"},metadata:{defaultText:"defaultText",defaultValue:"defaultValue",text:"text",value:"value"},selector:{dropdown:".ui.dropdown",input:'> input[type="hidden"], > select',item:".item",menu:".menu",menuIcon:".dropdown.icon",search:"> input.search, .menu > .search > input, .menu > input.search",text:"> .text:not(.icon)"},className:{active:"active",animating:"animating",disabled:"disabled",dropdown:"ui dropdown",filtered:"filtered",loading:"loading",menu:"menu",placeholder:"default",search:"search",selected:"selected",selection:"selection",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},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/semantic.js b/dist/semantic.js index b986e37d3..80ce3192a 100644 --- a/dist/semantic.js +++ b/dist/semantic.js @@ -3566,16 +3566,22 @@ $.fn.dropdown = function(parameters) { click: function (event) { var - $choice = $(this), - text = module.get.choiceText($choice), - value = module.get.choiceValue($choice, text), + $choice = $(this), + $target = $(event.target), + $subMenu = $choice.find(selector.menu), + text = module.get.choiceText($choice), + value = module.get.choiceValue($choice, text), callback = function() { module.remove.searchTerm(); module.determine.selectAction(text, value); }, - openingSubMenu = ($choice.find(selector.menu).size() > 0) + openingSubMenu = ($subMenu.size() > 0), + isSubItem = ($subMenu.find($target).size() > 0) ; - if( !openingSubMenu ) { + if(isSubItem) { + return false; + } + if(!openingSubMenu || settings.allowCategorySelection) { callback(); } } @@ -3699,6 +3705,12 @@ $.fn.dropdown = function(parameters) { : settings.preserveHTML ; if($choice !== undefined) { + if($choice.find(selector.menu).size() > 0) { + module.verbose('Retreiving text of element with sub-menu'); + $choice = $choice.clone(); + $choice.find(selector.menu).remove(); + $choice.find(selector.menuIcon).remove(); + } return ($choice.data(metadata.text) !== undefined) ? $choice.data(metadata.text) : (preserveHTML) @@ -4445,17 +4457,19 @@ $.fn.dropdown = function(parameters) { $.fn.dropdown.settings = { - debug : false, - verbose : true, - performance : true, + debug : false, + verbose : true, + performance : true, + + on : 'click', + action : 'activate', - on : 'click', - action : 'activate', + allowTab : true, + fullTextSearch : false, + preserveHTML : true, + sortSelect : false, - allowTab : true, - fullTextSearch : false, - preserveHTML : true, - sortSelect : false, + allowCategorySelection : false, delay : { hide : 300, @@ -4493,11 +4507,12 @@ $.fn.dropdown.settings = { selector : { dropdown : '.ui.dropdown', - text : '> .text:not(.icon)', input : '> input[type="hidden"], > select', - search : '> input.search, .menu > .search > input, .menu > input.search', + item : '.item', menu : '.menu', - item : '.item' + menuIcon : '.dropdown.icon', + search : '> input.search, .menu > .search > input, .menu > input.search', + text : '> .text:not(.icon)' }, className : { diff --git a/dist/semantic.min.js b/dist/semantic.min.js index 84f56f2b8..90d2d7ec1 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,b=e(n),v=b,h=this,y=v.data(p);return a={initialize:function(){a.instantiate()},instantiate:function(){a.verbose("Storing instance of site",a),y=a,v.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.size()>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.size()>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",v),v.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:h,Name:e[0],Arguments:[].slice.call(e,1)||"","Execution Time":n})),clearTimeout(a.performance.timer),a.performance.timer=setTimeout(a.performance.display,100)},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=h||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:!0,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){e.fn.form=function(t,o){var a,r=e(this),s=e.extend(!0,{},e.fn.form.settings,o),c=e.extend({},e.fn.form.settings.defaults,t),l=s.namespace,u=s.metadata,d=s.selector,m=s.className,f=(s.error,"."+l),g="module-"+l,p=r.selector||"",b=(new Date).getTime(),v=[],h=arguments[0],y="string"==typeof h,x=[].slice.call(arguments,1);return r.each(function(){var t,o=e(this),l=e(this).find(d.field),w=e(this).find(d.group),C=e(this).find(d.message),T=(e(this).find(d.prompt),e(this).find(d.submit)),k=[],S=this,z=o.data(g);t={initialize:function(){t.verbose("Initializing form validation",o,c,s),t.bindEvents(),t.instantiate()},instantiate:function(){t.verbose("Storing instance of module",t),z=t,o.data(g,t)},destroy:function(){t.verbose("Destroying previous module",z),t.removeEvents(),o.removeData(g)},refresh:function(){t.verbose("Refreshing selector cache"),l=o.find(d.field)},submit:function(){t.verbose("Submitting form",o),o.submit()},attachEvents:function(n,i){i=i||"submit",e(n).on("click",function(e){t[i](),e.preventDefault()})},bindEvents:function(){s.keyboardShortcuts&&l.on("keydown"+f,t.event.field.keydown),o.on("submit"+f,t.validate.form),l.on("blur"+f,t.event.field.blur),t.attachEvents(T,"submit"),l.each(function(){var n=e(this).prop("type"),i=t.get.changeEvent(n);e(this).on(i+f,t.event.field.change)})},removeEvents:function(){o.off(f),l.off(f),T.off(f),l.off(f)},event:{field:{keydown:function(n){var i=e(this),o=n.which,a={enter:13,escape:27};o==a.escape&&(t.verbose("Escape key pressed blurring field"),i.blur()),!n.ctrlKey&&o==a.enter&&i.is(d.input)&&i.not(d.checkbox).size()>0&&(t.debug("Enter key pressed, submitting form"),T.addClass(m.down),i.one("keyup"+f,t.event.field.keyup))},keyup:function(){t.verbose("Doing keyboard shortcut form submit"),T.removeClass(m.down),t.submit()},blur:function(){var n=e(this),i=n.closest(w);i.hasClass(m.error)?(t.debug("Revalidating field",n,t.get.validation(n)),t.validate.field(t.get.validation(n))):("blur"==s.on||"change"==s.on)&&t.validate.field(t.get.validation(n))},change:function(){var n=e(this),i=n.closest(w);("change"==s.on||i.hasClass(m.error)&&s.revalidate)&&(clearTimeout(t.timer),t.timer=setTimeout(function(){t.debug("Revalidating field",n,t.get.validation(n)),t.validate.field(t.get.validation(n))},s.delay))}}},get:{changeEvent:function(e){return"checkbox"==e||"radio"==e||"hidden"==e?"change":n.createElement("input").oninput!==i?"input":n.createElement("input").onpropertychange!==i?"propertychange":"keyup"},field:function(n){return t.verbose("Finding field with identifier",n),l.filter("#"+n).size()>0?l.filter("#"+n):l.filter('[name="'+n+'"]').size()>0?l.filter('[name="'+n+'"]'):l.filter("[data-"+u.validate+'="'+n+'"]').size()>0?l.filter("[data-"+u.validate+'="'+n+'"]'):e("")},validation:function(n){var i;return e.each(c,function(e,o){t.get.field(o.identifier).get(0)==n.get(0)&&(i=o)}),i||!1}},has:{field:function(e){return t.verbose("Checking for existence of a field with identifier",e),l.filter("#"+e).size()>0?!0:l.filter('[name="'+e+'"]').size()>0?!0:l.filter("[data-"+u.validate+'="'+e+'"]').size()>0?!0:!1}},add:{prompt:function(n,a){var r=t.get.field(n),c=r.closest(w),l=c.find(d.prompt),u=0!==l.size();a="string"==typeof a?[a]:a,t.verbose("Adding field error state",n),c.addClass(m.error),s.inline&&(u||(l=s.templates.prompt(a),l.appendTo(c)),l.html(a[0]),u?t.verbose("Inline errors are disabled, no inline error added",n):s.transition&&e.fn.transition!==i&&o.transition("is supported")?(t.verbose("Displaying error with css transition",s.transition),l.transition(s.transition+" in",s.duration)):(t.verbose("Displaying error with fallback javascript animation"),l.fadeIn(s.duration)))},errors:function(e){t.debug("Adding form error messages",e),C.html(s.templates.error(e))}},remove:{prompt:function(n){var a=t.get.field(n.identifier),r=a.closest(w),c=r.find(d.prompt);r.removeClass(m.error),s.inline&&c.is(":visible")&&(t.verbose("Removing prompt for field",n),s.transition&&e.fn.transition!==i&&o.transition("is supported")?c.transition(s.transition+" out",s.duration,function(){c.remove()}):c.fadeOut(s.duration,function(){c.remove()}))}},set:{success:function(){o.removeClass(m.error).addClass(m.success)},error:function(){o.removeClass(m.success).addClass(m.error)}},validate:{form:function(n){var a=!0;return k=[],e.each(c,function(e,n){t.validate.field(n)||(a=!1)}),a?(t.debug("Form has no validation errors, submitting"),t.set.success(),e.proxy(s.onSuccess,S)(n)):(t.debug("Form has errors"),t.set.error(),s.inline||t.add.errors(k),o.data("moduleApi")!==i&&n.stopImmediatePropagation(),e.proxy(s.onFailure,S)(k))},field:function(n){var o=t.get.field(n.identifier),a=!0,r=[];return o.prop("disabled")?(t.debug("Field is disabled. Skipping",n.identifier),a=!0):n.optional&&""===e.trim(o.val())?(t.debug("Field is optional and empty. Skipping",n.identifier),a=!0):n.rules!==i&&e.each(n.rules,function(e,i){t.has.field(n.identifier)&&!t.validate.rule(n,i)&&(t.debug("Field is invalid",n.identifier,i.type),r.push(i.prompt),a=!1)}),a?(t.remove.prompt(n,r),e.proxy(s.onValid,o)(),!0):(k=k.concat(r),t.add.prompt(n.identifier,r),e.proxy(s.onInvalid,o)(r),!1)},rule:function(n,o){var a,r,c=t.get.field(n.identifier),l=o.type,u=e.trim(c.val()+""),d=/\[(.*)\]/i,m=d.exec(l),f=!0;return m!==i&&null!==m?(a=""+m[1],r=l.replace(m[0],""),f=e.proxy(s.rules[r],S)(u,a)):f=e.proxy(s.rules[l],c)(u),f}},setting:function(t,n){if(e.isPlainObject(t))e.extend(!0,s,t);else{if(n===i)return s[t];s[t]=n}},internal:function(n,o){if(e.isPlainObject(n))e.extend(!0,t,n);else{if(o===i)return t[n];t[n]=o}},debug:function(){s.debug&&(s.performance?t.performance.log(arguments):(t.debug=Function.prototype.bind.call(console.info,console,s.name+":"),t.debug.apply(console,arguments)))},verbose:function(){s.verbose&&s.debug&&(s.performance?t.performance.log(arguments):(t.verbose=Function.prototype.bind.call(console.info,console,s.name+":"),t.verbose.apply(console,arguments)))},error:function(){t.error=Function.prototype.bind.call(console.error,console,s.name+":"),t.error.apply(console,arguments)},performance:{log:function(e){var n,i,o;s.performance&&(n=(new Date).getTime(),o=b||n,i=n-o,b=n,v.push({Name:e[0],Arguments:[].slice.call(e,1)||"",Element:S,"Execution Time":i})),clearTimeout(t.performance.timer),t.performance.timer=setTimeout(t.performance.display,100)},display:function(){var n=s.name+":",o=0;b=!1,clearTimeout(t.performance.timer),e.each(v,function(e,t){o+=t["Execution Time"]}),n+=" "+o+"ms",p&&(n+=" '"+p+"'"),r.size()>1&&(n+=" ("+r.size()+")"),(console.group!==i||console.table!==i)&&v.length>0&&(console.groupCollapsed(n),console.table?console.table(v):e.each(v,function(e,t){console.log(t.Name+": "+t["Execution Time"]+"ms")}),console.groupEnd()),v=[]}},invoke:function(t,n,o){var r,s,c,l=z;return n=n||x,o=S||o,"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(o,n):s!==i&&(c=s),e.isArray(a)?a.push(c):a!==i?a=[a,c]:c!==i&&(a=c),s}},y?(z===i&&t.initialize(),t.invoke(h)):(z!==i&&t.destroy(),t.initialize())}),a!==i?a:this},e.fn.form.settings={name:"Form",namespace:"form",debug:!1,verbose:!0,performance:!0,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:{validate:"validate"},selector:{message:".error.message",field:"input, textarea, select",group:".field",checkbox:'input[type="checkbox"], input[type="radio"]',input:"input",prompt:".prompt",submit:".submit"},className:{error:"error",success:"success",down:"down",label:"ui prompt label"},error:{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").size()>0},contains:function(e,t){return t=t.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&"),-1!==e.search(t)},email:function(e){var t=new RegExp("[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?","i");return t.test(e)},empty:function(e){return!(e===i||""===e)},integer:function(e,t){var n,o,a,r=/^\-?\d+$/;return t===i||""===t||".."===t||(-1==t.indexOf("..")?r.test(t)&&(n=o=t-0):(a=t.split("..",2),r.test(a[0])&&(n=a[0]-0),r.test(a[1])&&(o=a[1]-0))),r.test(e)&&(n===i||e>=n)&&(o===i||o>=e)},is: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("#"+n).size()>0?o=a.find("#"+n).val():a.find('[name="'+n+'"]').size()>0?o=a.find('[name="'+n+'"]').val():a.find('[data-validate="'+n+'"]').size()>0&&(o=a.find('[data-validate="'+n+'"]').val()),o!==i?t.toString()==o.toString():!1},maxLength:function(e,t){return e!==i?e.length<=t:!1},not:function(e,t){return e!=t},url:function(e){var t=/(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/;return t.test(e)}}}}(jQuery,window,document),function(e,t,n,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,b=f.selector,v=f.error,h="."+p,y="module-"+p,x=a.selector||"",w=e(this),C=w.find(b.title),T=w.find(b.content),k=this,S=w.data(y);m={initialize:function(){m.debug("Initializing accordion with bound events",w),w.on("click"+h,b.title,m.event.click),m.observeChanges(),m.instantiate()},instantiate:function(){S=m,w.data(y,m)},destroy:function(){m.debug("Destroying previous accordion for",w),w.removeData(y),C.off(h)},refresh:function(){C=w.find(b.title),T=w.find(b.content)},observeChanges:function(){"MutationObserver"in t&&(d=new MutationObserver(function(){m.debug("DOM tree modified, updating selector cache"),m.refresh()}),d.observe(k,{childList:!0,subtree:!0}),m.debug("Setting up mutation observer",d))},event:{click:function(){e.proxy(m.toggle,this)()}},toggle:function(t){var n=t!==i?"number"==typeof t?C.eq(t):e(t):e(this),o=n.next(T),a=o.is(":visible");m.debug("Toggling visibility of content",n),a?f.collapsible?e.proxy(m.close,n)():m.debug("Cannot close accordion content collapsing is disabled"):e.proxy(m.open,n)()},open:function(t){var n=t!==i?"number"==typeof t?C.eq(t):e(t):e(this),o=n.next(T),a=o.is(":animated"),r=o.hasClass(g.active);a||r||(m.debug("Opening accordion content",n),f.exclusive&&e.proxy(m.closeOthers,n)(),n.addClass(g.active),o.stop().children().stop().animate({opacity:1},f.duration,m.reset.display).end().slideDown(f.duration,f.easing,function(){o.addClass(g.active),e.proxy(m.reset.display,this)(),e.proxy(f.onOpen,this)(),e.proxy(f.onChange,this)()}))},close:function(t){var n=t!==i?"number"==typeof t?C.eq(t):e(t):e(this),o=n.next(T),a=o.hasClass(g.active);a&&(m.debug("Closing accordion content",o),n.removeClass(g.active),o.removeClass(g.active).show().stop().children().stop().animate({opacity:0},f.duration,m.reset.opacity).end().slideUp(f.duration,f.easing,function(){e.proxy(m.reset.display,this)(),e.proxy(f.onClose,this)(),e.proxy(f.onChange,this)()}))},closeOthers:function(t){var n,o,a,r=t!==i?C.eq(t):e(this),s=r.parents(b.content).prev(b.title),c=r.closest(b.accordion),l=b.title+"."+g.active+":visible",u=b.content+"."+g.active+":visible";f.closeNested?(n=c.find(l).not(s),a=n.next(T)):(n=c.find(l).not(s),o=c.find(u).find(l).not(s),n=n.not(o),a=n.next(T)),n.size()>0&&(m.debug("Exclusive enabled, closing other content",n),n.removeClass(g.active),a.stop().children().stop().animate({opacity:0},f.duration,m.resetOpacity).end().slideUp(f.duration,f.easing,function(){e(this).removeClass(g.active),e.proxy(m.reset.display,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:k,"Execution Time":n})),clearTimeout(m.performance.timer),m.performance.timer=setTimeout(m.performance.display,100)},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=k||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(v.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&&m.destroy(),m.initialize())}),o!==i?o:this},e.fn.accordion.settings={name:"Accordion",namespace:"accordion",debug:!1,verbose:!0,performance:!0,exclusive:!0,collapsible:!0,closeNested:!1,duration:500,easing:"easeInOutQuint",onOpen:function(){},onClose:function(){},onChange:function(){},error:{method:"The method you called is not defined"},className:{active:"active"},selector:{accordion:".accordion",title:".title",content:".content"}},e.extend(e.easing,{easeInOutQuint:function(e,t,n,i,o){return(t/=o/2)<1?i/2*t*t*t*t*t+n:i/2*((t-=2)*t*t*t*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,b=f.selector,v=f.error,h="."+p,y="module-"+p,x=e(this),w=e(this).find(b.label).first(),C=e(this).find(b.input),T=x.data(y),k=this;m={initialize:function(){m.verbose("Initializing checkbox",f),m.create.label(),m.add.events(),m.is.checked()?(m.set.checked(),f.fireOnInit&&e.proxy(f.onChecked,C.get())()):(m.remove.checked(),f.fireOnInit&&e.proxy(f.onUnchecked,C.get())()),m.observeChanges(),m.instantiate()},instantiate:function(){m.verbose("Storing instance of module",m),T=m,x.data(y,m)},destroy:function(){m.verbose("Destroying module"),m.remove.events(),x.removeData(y)},refresh:function(){x=e(this),w=e(this).find(b.label).first(),C=e(this).find(b.input)},observeChanges:function(){"MutationObserver"in t&&(a=new MutationObserver(function(){m.debug("DOM tree modified, updating selector cache"),m.refresh()}),a.observe(k,{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.size()>0?(m.debug("Attaching checkbox events to element",t,n),i.on("click"+h,n)):m.error(v.notFound)},event:{keydown:function(t){var n=t.which,i={enter:13,escape:27};n==i.escape&&(m.verbose("Escape key pressed blurring field"),x.blur()),t.ctrlKey||n!=i.enter||(m.verbose("Enter key pressed, toggling checkbox"),e.proxy(m.toggle,this)(),t.preventDefault())}},is:{radio:function(){return x.hasClass(g.radio)},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(){x.addClass(g.checked)},tab:function(){C.attr("tabindex")===i&&C.attr("tabindex",0)}},create:{label:function(){C.prevAll(b.label).size()>0?(C.prev(b.label).detach().insertAfter(C),m.debug("Moving existing label",w)):m.has.label()||(w=e("