Current File : /pages/54/47/d0016649/home/htdocs/ipc1/wp-content/themes/lhst/cloudfw/js/jquery-asmselect.min.js |
/*!
* Envision
*
* @version 3.2.0
*
* @author Wptation
* @link http://envision.wptation.com/
* @license ThemeForest Split Licence
* @copyright 2019
*/
!function(I){I.fn.asmSelect=function(e){var w={listType:"ol",sortable:!1,highlight:!1,animate:!1,addItemTarget:"bottom",hideWhenAdded:!1,debugMode:!1,removeLabel:"remove",highlightAddedLabel:"Added: ",highlightRemovedLabel:"Removed: ",containerClass:"asmContainer",selectClass:"asmSelect",optionDisabledClass:"asmOptionDisabled",listClass:"asmList",listSortableClass:"asmListSortable",listItemClass:"asmListItem",listItemLabelClass:"asmListItemLabel",removeClass:"asmListItemRemove",highlightClass:"asmHighlight"};return I.extend(w,e),this.each(function(i){var t,n,o,r=I(this),d=!1,s=!1,a=!1;function l(){var e=r.parents("."+w.containerClass).first();r.unbind("change",p),r.show(),r.parent().before(r),r.find("option").removeAttr("id"),e.remove()}function h(e){if(!(I.browser.msie&&I.browser.version<7)||s){var t=I(this).children("option:selected").slice(0,1).attr("rel");g(t),s=!1,C(t,"add")}}function c(){s=!0}function p(e){a?a=!1:(n.empty(),o.empty(),m(),I.browser.opera&&o.hide().fadeIn("fast"))}function m(){d=!0,n.prepend("<option value=''>"+r.attr("title")+"</option>"),r.children("option").each(function(e){var t,s=I(this);s.attr("id")||s.attr("id","asm"+i+"option"+e),t=s.attr("id"),s.is(":selected")?(g(t),f(t,!0)):f(t)}),w.debugMode||r.hide(),u(),d=!1}function f(e,t){if(null==t)t=!1;var s=I("#"+e),i=I("<option>"+s.html()+"</option>").val(s.val()).attr("rel",e);t&&v(i),n.append(i)}function u(){n.children(":eq(0)").prop("selected",!0)}function v(e){e.addClass(w.optionDisabledClass).prop("selected",!1).attr("disabled",!0),w.hideWhenAdded&&e.hide(),I.browser.msie&&n.hide().show()}function g(e){if(void 0!==e){var t=I("#"+e);if(t){var s=t.html();if(""!=s){var i=I("<a></a>").attr("href","#").addClass(w.removeClass).prepend(w.removeLabel).click(function(){return function(e,t){if(null==t)t=!0;I("#"+e).prop("selected",!1),$item=o.children("li[rel="+e+"]"),function(e){w.animate&&!d?($prevItem=e.prev("li"),e.animate({opacity:"hide",height:"hide"},100,"linear",function(){$prevItem.animate({height:"-=2px"},50,"swing",function(){$prevItem.animate({height:"+=2px"},100,"swing")}),e.remove()})):e.remove()}($item),function(e){e.removeClass(w.optionDisabledClass).attr("disabled",!1),w.hideWhenAdded&&e.show(),I.browser.msie&&n.hide().show()}(I("[rel="+e+"]",w.removeWhenAdded?$selectRemoved:n)),t&&b($item,w.highlightRemovedLabel);C(e,"drop")}(I(this).parent("li").attr("rel")),!1}),a=I("<span></span>").addClass(w.listItemLabelClass).html(s),l=I("<li></li>").attr("rel",e).addClass(w.listItemClass).append(a).append(i).hide();if(!d){if(t.is(":selected"))return;t.prop("selected",!0)}"top"!=w.addItemTarget||d?(o.append(l),w.sortable&&r.append(t)):(o.prepend(l),w.sortable&&r.prepend(t)),function(e){w.animate&&!d?e.animate({opacity:"show",height:"show"},100,"swing",function(){e.animate({height:"+=2px"},50,"swing",function(){e.animate({height:"-=2px"},25,"swing")})}):e.show()}(l),v(I("[rel="+e+"]",n)),d||(b(l,w.highlightAddedLabel),u(),w.sortable&&o.sortable("refresh"))}}}}function b(e,t){if(w.highlight){n.next("#"+w.highlightClass+i).remove();var s=I("<span></span>").hide().addClass(w.highlightClass).attr("id",w.highlightClass+i).html(t+e.children("."+w.listItemLabelClass).slice(0,1).text());n.after(s),s.fadeIn("fast",function(){setTimeout(function(){s.fadeOut("slow")},50)})}}function C(e,t){a=!0,$option=I("#"+e),r.trigger("change",[{option:$option,value:$option.val(),id:e,item:o.children("[rel="+e+"]"),type:t}])}!function(){var e=0<r.parents("."+w.containerClass).length;if(e&&void 0===r.data("asmselect.init"))l();else if(e)return;for(;0<I("#"+w.containerClass+i).length;)i++;n=I("<select></select>").addClass(w.selectClass).attr("name","").attr("id",w.selectClass+i).addClass("not").css({width:r.outerWidth()}),$selectRemoved=I("<select></select>"),o=I("<"+w.listType+"></"+w.listType+">").addClass(w.listClass).attr("id",w.listClass+i),t=I("<div></div>").addClass(w.containerClass).attr("id",w.containerClass+i),m(),n.change(h).click(c),r.change(p).wrap(t).before(n).before(o),w.sortable&&o.sortable({items:"li."+w.listItemClass,handle:"."+w.listItemLabelClass,update:function(e,t){var s;I(this).children("li").each(function(e){$option=I("#"+I(this).attr("rel")),I(this).is(".ui-sortable-helper")?s=$option.attr("id"):r.append($option)}),s&&C(s,"sort")}}).addClass(w.listSortableClass),n.wrap('<span class="cloudfw-ui-select" style="float:none !important; display: inline-block;"></span>'),n.after('<span class="the-arrow-wrap"><span class="the-arrow"></span></span><span class="cloudfw-ui-select-title"></span>'),r.removeData("cloudfw-select"),I.browser.msie&&I.browser.version<8&&o.css("display","inline-block"),r.data("asmselect.init",!0),r.off("asmselect.destroy",l),r.on("asmselect.destroy",l)}()})}}(jQuery);