/* jquery nice select - v1.0 https://github.com/hernansartorio/jquery-nice-select made by hernãƒâ¡n sartorio */ !function(e){e.fn.niceselect=function(t){function s(t){t.after(e("
").addclass("nice-select").addclass(t.attr("class")||"").addclass(t.attr("disabled")?"disabled":"").attr("tabindex",t.attr("disabled")?null:"0").html(''));var s=t.next(),n=t.find("option"),i=t.find("option:selected");s.find(".current").html(i.data("display")||i.text()),n.each(function(t){var n=e(this),i=n.data("display");s.find("ul").append(e("
  • ").attr("data-value",n.val()).attr("data-display",i||null).addclass("option"+(n.is(":selected")?" selected":"")+(n.is(":disabled")?" disabled":"")).html(n.text()))})}if("string"==typeof t)return"update"==t?this.each(function(){var t=e(this),n=e(this).next(".nice-select"),i=n.hasclass("open");n.length&&(n.remove(),s(t),i&&t.next().trigger("click"))}):"destroy"==t?(this.each(function(){var t=e(this),s=e(this).next(".nice-select");s.length&&(s.remove(),t.css("display",""))}),0==e(".nice-select").length&&e(document).off(".nice_select")):console.log('method "'+t+'" does not exist.'),this;this.hide(),this.each(function(){var t=e(this);t.next().hasclass("nice-select")||s(t)}),e(document).off(".nice_select"),e(document).on("click.nice_select",".nice-select",function(t){var s=e(this);e(".nice-select").not(s).removeclass("open"),s.toggleclass("open"),s.hasclass("open")?(s.find(".option"),s.find(".focus").removeclass("focus"),s.find(".selected").addclass("focus")):s.focus()}),e(document).on("click.nice_select",function(t){0===e(t.target).closest(".nice-select").length&&e(".nice-select").removeclass("open").find(".option")}),e(document).on("click.nice_select",".nice-select .option:not(.disabled)",function(t){var s=e(this),n=s.closest(".nice-select");n.find(".selected").removeclass("selected"),s.addclass("selected");var i=s.data("display")||s.text();n.find(".current").text(i),n.prev("select").val(s.data("value")).trigger("change")}),e(document).on("keydown.nice_select",".nice-select",function(t){var s=e(this),n=e(s.find(".focus")||s.find(".list .option.selected"));if(32==t.keycode||13==t.keycode)return s.hasclass("open")?n.trigger("click"):s.trigger("click"),!1;if(40==t.keycode){if(s.hasclass("open")){var i=n.nextall(".option:not(.disabled)").first();i.length>0&&(s.find(".focus").removeclass("focus"),i.addclass("focus"))}else s.trigger("click");return!1}if(38==t.keycode){if(s.hasclass("open")){var l=n.prevall(".option:not(.disabled)").first();l.length>0&&(s.find(".focus").removeclass("focus"),l.addclass("focus"))}else s.trigger("click");return!1}if(27==t.keycode)s.hasclass("open")&&s.trigger("click");else if(9==t.keycode&&s.hasclass("open"))return!1});var n=document.createelement("a").style;return n.csstext="pointer-events:auto","auto"!==n.pointerevents&&e("html").addclass("no-csspointerevents"),this}}(jquery);