diff --git a/wire/core/Pagefiles.php b/wire/core/Pagefiles.php index a6589930..dea91bb9 100644 --- a/wire/core/Pagefiles.php +++ b/wire/core/Pagefiles.php @@ -521,6 +521,59 @@ class Pagefiles extends WireArray implements PageFieldValueInterface { } return $item; } + + /** + * Get list of tags for all files in this Pagefiles array, or return files matching given tag(s) + * + * This method can either return a list of all tags available, or return all files + * matching the given tag or tags (an alias of findTag method). + * + * ~~~~~ + * // Get string of all tags + * $tagsString = $page->files->tags(); + * + * // Get array of all tags + * $tagsArray = $page->files->tags(true); + * + * // Find all files matching given tag + * $pagefiles = $page->files->tags('foobar'); + * ~~~~~ + * + * #pw-group-tags + * + * @param bool|string|array $value Specify one of the following: + * - Omit to return all tags as a string. + * - Boolean true if you want to return tags as an array (rather than string). + * - Boolean false to return tags as an array, with lowercase enforced. + * - String if you want to return files matching tags (See `Pagefiles::findTag()` method for usage) + * - Array if you want to return files matching tags (See `Pagefiles::findTag()` method for usage) + * @return string|array|Pagefiles Returns all tags as a string or an array, or Pagefiles matching given tag(s). + * When a tags array is returned, it is an associative array where the key and value are both the tag (keys are always lowercase). + * @see Pagefiles::findTag(), Pagefile::tags() + * + */ + public function tags($value = null) { + + if($value === null) { + $returnString = true; + $value = true; + } else { + $returnString = false; + } + + if(is_bool($value)) { + // return array of tags + $tags = array(); + foreach($this as $pagefile) { + $tags = array_merge($tags, $pagefile->tags($value)); + } + if($returnString) $tags = implode(' ', $tags); + return $tags; + } + + // fallback to behavior of findTag + return $this->findTag($value); + } /** * Track a change diff --git a/wire/modules/Fieldtype/FieldtypeFile.module b/wire/modules/Fieldtype/FieldtypeFile.module index 05168c94..c3b88195 100644 --- a/wire/modules/Fieldtype/FieldtypeFile.module +++ b/wire/modules/Fieldtype/FieldtypeFile.module @@ -9,7 +9,7 @@ * /wire/core/Fieldtype.php * /wire/core/FieldtypeMulti.php * - * ProcessWire 3.x, Copyright 2016 by Ryan Cramer + * ProcessWire 3.x, Copyright 2017 by Ryan Cramer * https://processwire.com * * @method string formatValueString(Page $page, Field $field, $value) @@ -21,15 +21,34 @@ class FieldtypeFile extends FieldtypeMulti { public static function getModuleInfo() { return array( 'title' => __('Files', __FILE__), - 'version' => 104, + 'version' => 105, 'summary' => __('Field that stores one or more files', __FILE__), 'permanent' => true, ); } + /** + * outputFormat: Automatic (single item or null when max files set to 1, array of items otherwise) + * + */ const outputFormatAuto = 0; - const outputFormatArray = 1; - const outputFormatSingle = 2; + + /** + * outputFormat: Array of items + * + */ + const outputFormatArray = 1; + + /** + * outputFormat: Single item or null when empty + * + */ + const outputFormatSingle = 2; + + /** + * outputFormat: String that renders the item + * + */ const outputFormatString = 30; /** @@ -43,9 +62,37 @@ class FieldtypeFile extends FieldtypeMulti { * */ const fileSchemaDate = 2; - + + /** + * Flag for useTags: tags off/disabled + * + */ + const useTagsOff = 0; + + /** + * Flag for useTags: normal text input tags + * + */ + const useTagsNormal = 1; + + /** + * Flag for useTags: predefined tags + * + */ + const useTagsPredefined = 8; + + /** + * Default class for Inputfield object used, auto-generated at construct + * + * @var string + * + */ protected $defaultInputfieldClass = ''; + /** + * Construct + * + */ public function __construct() { $this->defaultInputfieldClass = str_replace('Fieldtype', 'Inputfield', $this->className); } @@ -286,7 +333,7 @@ class FieldtypeFile extends FieldtypeMulti { $textformatters = $field->get('textformatters'); if(!is_array($textformatters)) $textformatters = array(); if($field->get('entityEncode') && !count($textformatters)) $textformatters[] = 'TextformatterEntities'; - $useTags = $field->get('useTags'); + $useTags = (int) $field->get('useTags'); foreach($textformatters as $name) { $textformatter = $this->wire('modules')->get($name); @@ -663,15 +710,29 @@ class FieldtypeFile extends FieldtypeMulti { $field->set('entityEncode', null); // use tags - /** @var InputfieldCheckbox $f */ - $f = $this->modules->get("InputfieldCheckbox"); - $f->attr('name', 'useTags'); - $f->attr('value', 1); - if($field->get('useTags')) $f->attr('checked', 'checked'); - else $f->collapsed = Inputfield::collapsedYes; - $f->label = $this->_('Use Tags?'); - $f->description = $this->_('If checked, the field will also contain an option for tags in addition to the description.'); // Use tags description - + /** @var InputfieldRadios $f */ + $f = $this->modules->get("InputfieldRadios"); + $f->attr('name', 'useTags'); + $f->label = $this->_('Use Tags?'); + $f->description = $this->_('When enabled, the field will also contain an option for tags in addition to the description.'); // Use tags description + $f->icon = 'tags'; + $predefinedLabel = $this->_('User selects from list of predefined tags'); + $f->addOption(self::useTagsOff, $this->_('Tags disabled')); + $f->addOption(self::useTagsNormal, $this->_('User enters tags by text input')); + $f->addOption(self::useTagsPredefined, $predefinedLabel); + $f->addOption(self::useTagsNormal | self::useTagsPredefined, $predefinedLabel . ' + ' . $this->_('can input their own')); + $f->attr('value', (int) $field->get('useTags')); + if(!$f->attr('value')) $f->collapsed = Inputfield::collapsedYes; + $inputfields->append($f); + + /** @var InputfieldTextarea $f */ + $f = $this->modules->get('InputfieldText'); + $f->attr('name', 'tagsList'); + $f->label = $this->_('Predefined tags'); + $f->description = $this->_('Enter tags separated by a space. Tags may contain letters, digits, underscores or hyphens.'); + $f->icon = 'tags'; + $f->attr('value', $field->get('tagsList')); + $f->showIf = 'useTags>1'; $inputfields->append($f); // inputfield class diff --git a/wire/modules/Inputfield/InputfieldFile/InputfieldFile.css b/wire/modules/Inputfield/InputfieldFile/InputfieldFile.css index e08815fd..e0159780 100644 --- a/wire/modules/Inputfield/InputfieldFile/InputfieldFile.css +++ b/wire/modules/Inputfield/InputfieldFile/InputfieldFile.css @@ -83,9 +83,12 @@ ul.InputfieldFileList li .InputfieldFileDescription { font-weight: normal; margin: 0; padding: 0; } - ul.InputfieldFileList li .InputfieldFileTags input, - ul.InputfieldFileList li .InputfieldFileDescription input { + ul.InputfieldFileList li .InputfieldFileTags input[type=text], + ul.InputfieldFileList li .InputfieldFileDescription input[type=text] { width: 100%; } + ul.InputfieldFileList li .InputfieldFileTags label.pw-hidden, + ul.InputfieldFileList li .InputfieldFileDescription label.pw-hidden { + display: none; } ul.InputfieldFileList li .InputfieldFileSort { display: none !important; } @@ -144,6 +147,25 @@ ul.InputfieldFileListBlank + p.description { cursor: inherit; width: 100%; } +.InputfieldFileDescription label.pw-hidden, +.InputfieldFileTags label.pw-hidden { + display: none; } +.InputfieldFileDescription input::placeholder, +.InputfieldFileTags input::placeholder { + font-size: 13px; + color: #999; } + +.AdminThemeDefault .InputfieldFileDescription input::placeholder { + padding-left: 3px; } + +.InputfieldFileTags .selectize-control.multi .selectize-input > div { + background: #eee; + border-radius: 3px; + white-space: nowrap; } + .InputfieldFileTags .selectize-control.multi .selectize-input > div a.remove { + color: #999; + border-color: #ddd; } + .pw-content ul.InputfieldFileList li .langTabs > ul, #content ul.InputfieldFileList li .langTabs > ul { padding-left: 0; } diff --git a/wire/modules/Inputfield/InputfieldFile/InputfieldFile.js b/wire/modules/Inputfield/InputfieldFile/InputfieldFile.js index fcacc4a1..0c81476e 100755 --- a/wire/modules/Inputfield/InputfieldFile/InputfieldFile.js +++ b/wire/modules/Inputfield/InputfieldFile/InputfieldFile.js @@ -430,12 +430,101 @@ $(document).ready(function() { } // initHTML5Item } // initHTML5 + /** + * Initialize selectize tags + * + * @param $inputfields + * + */ + function initTags($inputfields) { + + $inputfields.each(function() { + + var $inputfield = $(this); + var $inputs = $inputfield.find('.InputfieldFileTagsInput:not(.selectized)'); + + if($inputs.length) { + $inputs.selectize({ + plugins: ['remove_button', 'drag_drop'], + delimiter: ' ', + persist: false, + createOnBlur: true, + submitOnReturn: false, + create: function(input) { + return { + value: input, + text: input + } + } + }); + return; + } + + var $selects = $inputfield.find('.InputfieldFileTagsSelect:not(.selectized)'); + if($selects.length) { + if(!$inputfield.hasClass('Inputfield')) $inputfield = $inputfield.closest('.Inputfield'); + var configName = $inputfield.attr('data-configName'); + var settings = ProcessWire.config[configName]; + var options = []; + for(var n = 0; n < settings['tags'].length; n++) { + var tag = settings['tags'][n]; + options[n] = {value: tag}; + } + $selects.selectize({ + plugins: ['remove_button', 'drag_drop'], + delimiter: ' ', + persist: true, + submitOnReturn: false, + closeAfterSelect: true, + createOnBlur: true, + maxItems: null, + valueField: 'value', + labelField: 'value', + searchField: ['value'], + options: options, + create: function(input) { + return { + value: input, + text: input + } + }, + createFilter: function(input) { + if(settings.allowUserTags) return true; + allow = false; + for(var n = 0; n < options.length; n++) { + if(input == options[n]) { + allow = true; + break; + } + } + return allow; + }, + onDropdownOpen: function($dropdown) { + $dropdown.closest('li').css('z-index', 100); + }, + onDropdownClose: function($dropdown) { + $dropdown.closest('li').css('z-index', 'auto'); + }, + render: { + item: function(item, escape) { + return '
' + escape(item.value) + '
'; + }, + option: function(item, escape) { + return '
' + escape(item.value) + '
'; + } + } + }); + } + }); + } + /** * MAIN * */ initSortable($(".InputfieldFileList")); + initTags($(".InputfieldFileHasTags")); /** * Progressive enchanchment for browsers that support html5 File API @@ -474,12 +563,16 @@ $(document).ready(function() { resizeActive = true; setTimeout(windowResize, 1000); }).resize(); + $(document).on('AjaxUploadDone', function(event) { + initTags($(this)); + }); } //$(document).on('reloaded', '.InputfieldFileMultiple, .InputfieldFileSingle', function(event) { $(document).on('reloaded', '.InputfieldHasFileList', function(event) { initSortable($(this).find(".InputfieldFileList")); InitHTML5($(this)); + initTags($(this)); if(allowAjax) windowResize(); }); diff --git a/wire/modules/Inputfield/InputfieldFile/InputfieldFile.min.js b/wire/modules/Inputfield/InputfieldFile/InputfieldFile.min.js index cd1a78a2..8aea6c7a 100644 --- a/wire/modules/Inputfield/InputfieldFile/InputfieldFile.min.js +++ b/wire/modules/Inputfield/InputfieldFile/InputfieldFile.min.js @@ -1 +1 @@ -$(document).ready(function(){$(document).on("change",".InputfieldFileDelete input",function(){a($(this))}).on("dblclick",".InputfieldFileDelete",function(){var j=$(this).find("input");var i=$(this).parents(".InputfieldFileList").find(".InputfieldFileDelete input");if(j.is(":checked")){i.removeAttr("checked").change()}else{i.attr("checked","checked").change()}return false});function a(k){var i=k.parents(".InputfieldFileInfo");var j=k.closest(".InputfieldFile").hasClass("InputfieldItemListCollapse");if(k.is(":checked")){i.addClass("ui-state-error");if(!j){i.siblings(".InputfieldFileData").slideUp("fast")}}else{i.removeClass("ui-state-error");if(!j){i.siblings(".InputfieldFileData").slideDown("fast")}}}function c(i){i.each(function(){var k=$(this);var l=k.children("li").length;if(k.closest(".InputfieldRenderValueMode").length){return}var j=k.closest(".Inputfield");if(l<2){if(l==0){j.addClass("InputfieldFileEmpty").removeClass("InputfieldFileMultiple InputfieldFileSingle")}else{j.addClass("InputfieldFileSingle").removeClass("InputfieldFileEmpty InputfieldFileMultiple")}return}else{k.closest(".Inputfield").removeClass("InputfieldFileSingle InputfieldFileEmpty").addClass("InputfieldFileMultiple")}k.sortable({start:function(n,m){m.item.children(".InputfieldFileInfo").addClass("ui-state-highlight")},stop:function(n,m){$(this).children("li").each(function(o){$(this).find(".InputfieldFileSort").val(o)});m.item.children(".InputfieldFileInfo").removeClass("ui-state-highlight");j.addClass("InputfieldFileJustSorted InputfieldStateChanged");setTimeout(function(){j.removeClass("InputfieldFileJustSorted")},500)}})}).find(".ui-widget-header, .ui-state-default").hover(function(){$(this).addClass("ui-state-hover")},function(){$(this).removeClass("ui-state-hover")})}function d(){$("body").addClass("ie-no-drop");$(document).on("change",".InputfieldFileUpload input[type=file]",function(){var l=$(this);var s=l.closest(".InputMask");if(l.val().length>1){s.addClass("ui-state-disabled")}else{s.removeClass("ui-state-disabled")}if(s.next(".InputMask").length>0){return}var i=l.closest(".InputfieldFile");var n=l.closest(".InputfieldFileUpload");var m=i.find(".InputfieldFileList");var r=parseInt(n.find(".InputfieldFileMaxFiles").val());var k=m.children("li").length+n.find("input[type=file]").length+1;if(r>0&&k>=r){}else{n.find(".InputMask").not(":last").each(function(){var t=$(this);if(t.find("input[type=file]").val()<1){t.remove()}});var q=s.clone().removeClass("ui-state-disabled");var p=q.find("input[type=file]");p.attr("id",p.attr("id")+"-");p.val("");q.insertAfter(s);q.css("margin-left","0.5em").removeClass("ui-state-active")}var j=l.val();var o=j.lastIndexOf("/");if(o===-1){o=j.lastIndexOf("\\")}j=j.substring(o+1);s.find(".ui-button-text").text(j).prepend("");s.removeClass("ui-state-active")})}function f(j){if(j.length>0){var i=j.find(".InputfieldFileUpload")}else{var i=$(".InputfieldFileUpload")}i.closest(".InputfieldContent").each(function(l){if($(this).hasClass("InputfieldFileInit")){return}k($(this),l);$(this).addClass("InputfieldFileInit")});function k(s,A){var r=s.parents("form");var l=s.closest(".InputfieldRepeaterItem");var o=l.length?l.attr("data-editUrl"):r.attr("action");o+=(o.indexOf("?")>-1?"&":"?")+"InputfieldFileAjax=1";var E=r.find("input._post_token");var q=E.attr("name");var v=E.val();var C=s.find(".InputfieldFileUpload");var n=C.data("fieldname");n=n.slice(0,-2);var D=C.data("extensions").toLowerCase();var z=C.data("maxfilesize");var u=s.find("input[type=file]").get(0);var t=s.get(0);var m=s.find(".InputfieldFileList");if(m.size()<1){m=$("");s.prepend(m);s.parent(".Inputfield").addClass("InputfieldFileEmpty")}var B=m.get(0);var w=parseInt(s.find(".InputfieldFileMaxFiles").val());m.children().addClass("InputfieldFileItemExisting");s.find(".AjaxUploadDropHere").show();var x=null;function p(H){var K=$('
  • '),J=$('
    '),I=$('
    '),L,M,O,N;J.append(I);K.append(J);O=new XMLHttpRequest();O.upload.addEventListener("progress",function(P){if(P.lengthComputable){var Q=(P.loaded/P.total)*100;I.width(Q+"%");if(Q>4){I.html(""+parseInt(Q)+"%")}$("body").addClass("pw-uploading")}else{}},false);O.addEventListener("load",function(){O.getAllResponseHeaders();var V=$.parseJSON(O.responseText);if(V.error!==undefined){V=[V]}for(var T=0;T0){S.slideUp("fast",function(){S.remove()})}}var aa=s.find("input[type=file]");if(aa.val()){aa.replaceWith(aa.clone(true))}var X=$(Q.markup);X.hide();if(Q.overwrite){var Z=X.find(".InputfieldFileName").text();var ab=null;m.children(".InputfieldFileItemExisting").each(function(){if(ab===null&&$(this).find(".InputfieldFileName").text()==Z){ab=$(this)}});if(ab!==null){var W=X.find(".InputfieldFileInfo");var P=X.find(".InputfieldFileLink");var R=ab.find(".InputfieldFileInfo");var Y=ab.find(".InputfieldFileLink");R.html(W.html()+"");Y.html(P.html());ab.addClass("InputfieldFileItemExisting");ab.effect("highlight",500)}else{m.append(X);X.slideDown();X.addClass("InputfieldFileItemExisting")}}else{m.append(X);X.slideDown()}}}K.remove();if(x){clearTimeout(x)}x=setTimeout(function(){$("body").removeClass("pw-uploading");if(w!=1&&!m.is(".ui-sortable")){c(m)}m.trigger("AjaxUploadDone")},500)},false);O.open("POST",o,true);O.setRequestHeader("X-FILENAME",encodeURIComponent(H.name));O.setRequestHeader("X-FIELDNAME",n);O.setRequestHeader("Content-Type","application/octet-stream");O.setRequestHeader("X-"+q,v);O.setRequestHeader("X-REQUESTED-WITH","XMLHttpRequest");O.send(H);N=" "+H.name+' • '+parseInt(H.size/1024,10)+" kb";K.find("p.ui-widget-header").html(N);m.append(K);var F=m.closest(".Inputfield");F.addClass("InputfieldStateChanged");var G=F.find(".InputfieldFileItem").length;if(G==1){F.removeClass("InputfieldFileEmpty").removeClass("InputfieldFileMultiple").addClass("InputfieldFileSingle")}else{if(G>1){F.removeClass("InputfieldFileEmpty").removeClass("InputfieldFileSingle").addClass("InputfieldFileMultiple")}}}function y(H){function I(K,L){return'
  •   '+K+' • '+L+"

  • "}if(typeof H!=="undefined"){for(var G=0,F=H.length;Gz&&z>2000000){m.append(I(H[G].name,"Filesize "+parseInt(H[G].size/1024,10)+" kb is too big. Maximum allowed is "+parseInt(z/1024,10)+" kb"))}else{p(H[G])}}if(w==1){break}}}else{B.innerHTML="No support for the File API in this web browser"}}u.addEventListener("change",function(F){y(this.files);F.preventDefault();F.stopPropagation();this.value=""},false);t.addEventListener("dragleave",function(){$(this).removeClass("ui-state-hover");$(this).closest(".Inputfield").removeClass("pw-drag-in-file")},false);t.addEventListener("dragenter",function(){$(this).addClass("ui-state-hover");$(this).closest(".Inputfield").addClass("pw-drag-in-file")},false);t.addEventListener("dragover",function(F){if(!$(this).is("ui-state-hover")){$(this).addClass("ui-state-hover");$(this).closest(".Inputfield").addClass("pw-drag-in-file")}F.preventDefault();F.stopPropagation()},false);t.addEventListener("drop",function(F){y(F.dataTransfer.files);$(this).removeClass("ui-state-hover").closest(".Inputfield").removeClass("pw-drag-in-file");F.preventDefault();F.stopPropagation()},false)}}c($(".InputfieldFileList"));var e=false;if(window.File&&window.FileList&&window.FileReader&&($("#PageIDIndicator").length>0||$(".InputfieldAllowAjaxUpload").length>0)){f("");e=true}else{d()}var h=767;var g=false;var b=function(){if(!e){return}$(".AjaxUploadDropHere").each(function(){var i=$(this);if(i.parent().width()<=h){i.hide()}else{i.show()}});g=false};if(e){$(window).resize(function(){if(g){return}g=true;setTimeout(b,1000)}).resize()}$(document).on("reloaded",".InputfieldHasFileList",function(i){c($(this).find(".InputfieldFileList"));f($(this));if(e){b()}})}); \ No newline at end of file +$(document).ready(function(){$(document).on("change",".InputfieldFileDelete input",function(){d($(this))}).on("dblclick",".InputfieldFileDelete",function(){var k=$(this).find("input");var j=$(this).parents(".InputfieldFileList").find(".InputfieldFileDelete input");if(k.is(":checked")){j.removeAttr("checked").change()}else{j.attr("checked","checked").change()}return false});function d(l){var j=l.parents(".InputfieldFileInfo");var k=l.closest(".InputfieldFile").hasClass("InputfieldItemListCollapse");if(l.is(":checked")){j.addClass("ui-state-error");if(!k){j.siblings(".InputfieldFileData").slideUp("fast")}}else{j.removeClass("ui-state-error");if(!k){j.siblings(".InputfieldFileData").slideDown("fast")}}}function i(j){j.each(function(){var l=$(this);var m=l.children("li").length;if(l.closest(".InputfieldRenderValueMode").length){return}var k=l.closest(".Inputfield");if(m<2){if(m==0){k.addClass("InputfieldFileEmpty").removeClass("InputfieldFileMultiple InputfieldFileSingle")}else{k.addClass("InputfieldFileSingle").removeClass("InputfieldFileEmpty InputfieldFileMultiple")}return}else{l.closest(".Inputfield").removeClass("InputfieldFileSingle InputfieldFileEmpty").addClass("InputfieldFileMultiple")}l.sortable({start:function(o,n){n.item.children(".InputfieldFileInfo").addClass("ui-state-highlight")},stop:function(o,n){$(this).children("li").each(function(p){$(this).find(".InputfieldFileSort").val(p)});n.item.children(".InputfieldFileInfo").removeClass("ui-state-highlight");k.addClass("InputfieldFileJustSorted InputfieldStateChanged");setTimeout(function(){k.removeClass("InputfieldFileJustSorted")},500)}})}).find(".ui-widget-header, .ui-state-default").hover(function(){$(this).addClass("ui-state-hover")},function(){$(this).removeClass("ui-state-hover")})}function f(){$("body").addClass("ie-no-drop");$(document).on("change",".InputfieldFileUpload input[type=file]",function(){var m=$(this);var t=m.closest(".InputMask");if(m.val().length>1){t.addClass("ui-state-disabled")}else{t.removeClass("ui-state-disabled")}if(t.next(".InputMask").length>0){return}var j=m.closest(".InputfieldFile");var o=m.closest(".InputfieldFileUpload");var n=j.find(".InputfieldFileList");var s=parseInt(o.find(".InputfieldFileMaxFiles").val());var l=n.children("li").length+o.find("input[type=file]").length+1;if(s>0&&l>=s){}else{o.find(".InputMask").not(":last").each(function(){var u=$(this);if(u.find("input[type=file]").val()<1){u.remove()}});var r=t.clone().removeClass("ui-state-disabled");var q=r.find("input[type=file]");q.attr("id",q.attr("id")+"-");q.val("");r.insertAfter(t);r.css("margin-left","0.5em").removeClass("ui-state-active")}var k=m.val();var p=k.lastIndexOf("/");if(p===-1){p=k.lastIndexOf("\\")}k=k.substring(p+1);t.find(".ui-button-text").text(k).prepend("");t.removeClass("ui-state-active")})}function b(k){if(k.length>0){var j=k.find(".InputfieldFileUpload")}else{var j=$(".InputfieldFileUpload")}j.closest(".InputfieldContent").each(function(m){if($(this).hasClass("InputfieldFileInit")){return}l($(this),m);$(this).addClass("InputfieldFileInit")});function l(t,B){var s=t.parents("form");var m=t.closest(".InputfieldRepeaterItem");var p=m.length?m.attr("data-editUrl"):s.attr("action");p+=(p.indexOf("?")>-1?"&":"?")+"InputfieldFileAjax=1";var F=s.find("input._post_token");var r=F.attr("name");var w=F.val();var D=t.find(".InputfieldFileUpload");var o=D.data("fieldname");o=o.slice(0,-2);var E=D.data("extensions").toLowerCase();var A=D.data("maxfilesize");var v=t.find("input[type=file]").get(0);var u=t.get(0);var n=t.find(".InputfieldFileList");if(n.size()<1){n=$("");t.prepend(n);t.parent(".Inputfield").addClass("InputfieldFileEmpty")}var C=n.get(0);var x=parseInt(t.find(".InputfieldFileMaxFiles").val());n.children().addClass("InputfieldFileItemExisting");t.find(".AjaxUploadDropHere").show();var y=null;function q(I){var L=$('
  • '),K=$('
    '),J=$('
    '),M,N,P,O;K.append(J);L.append(K);P=new XMLHttpRequest();P.upload.addEventListener("progress",function(Q){if(Q.lengthComputable){var R=(Q.loaded/Q.total)*100;J.width(R+"%");if(R>4){J.html(""+parseInt(R)+"%")}$("body").addClass("pw-uploading")}else{}},false);P.addEventListener("load",function(){P.getAllResponseHeaders();var W=$.parseJSON(P.responseText);if(W.error!==undefined){W=[W]}for(var U=0;U0){T.slideUp("fast",function(){T.remove()})}}var ab=t.find("input[type=file]");if(ab.val()){ab.replaceWith(ab.clone(true))}var Y=$(R.markup);Y.hide();if(R.overwrite){var aa=Y.find(".InputfieldFileName").text();var ac=null;n.children(".InputfieldFileItemExisting").each(function(){if(ac===null&&$(this).find(".InputfieldFileName").text()==aa){ac=$(this)}});if(ac!==null){var X=Y.find(".InputfieldFileInfo");var Q=Y.find(".InputfieldFileLink");var S=ac.find(".InputfieldFileInfo");var Z=ac.find(".InputfieldFileLink");S.html(X.html()+"");Z.html(Q.html());ac.addClass("InputfieldFileItemExisting");ac.effect("highlight",500)}else{n.append(Y);Y.slideDown();Y.addClass("InputfieldFileItemExisting")}}else{n.append(Y);Y.slideDown()}}}L.remove();if(y){clearTimeout(y)}y=setTimeout(function(){$("body").removeClass("pw-uploading");if(x!=1&&!n.is(".ui-sortable")){i(n)}n.trigger("AjaxUploadDone")},500)},false);P.open("POST",p,true);P.setRequestHeader("X-FILENAME",encodeURIComponent(I.name));P.setRequestHeader("X-FIELDNAME",o);P.setRequestHeader("Content-Type","application/octet-stream");P.setRequestHeader("X-"+r,w);P.setRequestHeader("X-REQUESTED-WITH","XMLHttpRequest");P.send(I);O=" "+I.name+' • '+parseInt(I.size/1024,10)+" kb";L.find("p.ui-widget-header").html(O);n.append(L);var G=n.closest(".Inputfield");G.addClass("InputfieldStateChanged");var H=G.find(".InputfieldFileItem").length;if(H==1){G.removeClass("InputfieldFileEmpty").removeClass("InputfieldFileMultiple").addClass("InputfieldFileSingle")}else{if(H>1){G.removeClass("InputfieldFileEmpty").removeClass("InputfieldFileSingle").addClass("InputfieldFileMultiple")}}}function z(I){function J(L,M){return'
  •   '+L+' • '+M+"

  • "}if(typeof I!=="undefined"){for(var H=0,G=I.length;HA&&A>2000000){n.append(J(I[H].name,"Filesize "+parseInt(I[H].size/1024,10)+" kb is too big. Maximum allowed is "+parseInt(A/1024,10)+" kb"))}else{q(I[H])}}if(x==1){break}}}else{C.innerHTML="No support for the File API in this web browser"}}v.addEventListener("change",function(G){z(this.files);G.preventDefault();G.stopPropagation();this.value=""},false);u.addEventListener("dragleave",function(){$(this).removeClass("ui-state-hover");$(this).closest(".Inputfield").removeClass("pw-drag-in-file")},false);u.addEventListener("dragenter",function(){$(this).addClass("ui-state-hover");$(this).closest(".Inputfield").addClass("pw-drag-in-file")},false);u.addEventListener("dragover",function(G){if(!$(this).is("ui-state-hover")){$(this).addClass("ui-state-hover");$(this).closest(".Inputfield").addClass("pw-drag-in-file")}G.preventDefault();G.stopPropagation()},false);u.addEventListener("drop",function(G){z(G.dataTransfer.files);$(this).removeClass("ui-state-hover").closest(".Inputfield").removeClass("pw-drag-in-file");G.preventDefault();G.stopPropagation()},false)}}function g(j){j.each(function(){var q=$(this);var o=q.find(".InputfieldFileTagsInput:not(.selectized)");if(o.length){o.selectize({plugins:["remove_button","drag_drop"],delimiter:" ",persist:false,createOnBlur:true,submitOnReturn:false,create:function(n){return{value:n,text:n}}});return}var m=q.find(".InputfieldFileTagsSelect:not(.selectized)");if(m.length){if(!q.hasClass("Inputfield")){q=q.closest(".Inputfield")}var r=q.attr("data-configName");var p=ProcessWire.config[r];var l=[];for(var s=0;s"+n(t.value)+""},option:function(t,n){return"
    "+n(t.value)+"
    "}}})}})}i($(".InputfieldFileList"));g($(".InputfieldFileHasTags"));var a=false;if(window.File&&window.FileList&&window.FileReader&&($("#PageIDIndicator").length>0||$(".InputfieldAllowAjaxUpload").length>0)){b("");a=true}else{f()}var c=767;var h=false;var e=function(){if(!a){return}$(".AjaxUploadDropHere").each(function(){var j=$(this);if(j.parent().width()<=c){j.hide()}else{j.show()}});h=false};if(a){$(window).resize(function(){if(h){return}h=true;setTimeout(e,1000)}).resize();$(document).on("AjaxUploadDone",function(j){g($(this))})}$(document).on("reloaded",".InputfieldHasFileList",function(j){i($(this).find(".InputfieldFileList"));b($(this));g($(this));if(a){e()}})}); \ No newline at end of file diff --git a/wire/modules/Inputfield/InputfieldFile/InputfieldFile.module b/wire/modules/Inputfield/InputfieldFile/InputfieldFile.module index ae599fa6..28e88868 100644 --- a/wire/modules/Inputfield/InputfieldFile/InputfieldFile.module +++ b/wire/modules/Inputfield/InputfieldFile/InputfieldFile.module @@ -7,6 +7,7 @@ * @property int $maxFiles Maximum number of files allowed * @property int $maxFilesize Maximum file size * @property bool $useTags Whether or not tags are enabled + * @property string $tagsList Predefined tags * @property bool|int $unzip Whether or not unzip is enabled * @property bool|int $overwrite Whether or not overwrite mode is enabled * @property int $descriptionRows Number of rows for description field (default=1, 0=disable) @@ -36,7 +37,7 @@ class InputfieldFile extends Inputfield implements InputfieldItemList, Inputfiel return array( 'title' => __('Files', __FILE__), // Module Title 'summary' => __('One or more file uploads (sortable)', __FILE__), // Module Summary - 'version' => 124, + 'version' => 125, 'permanent' => true, ); } @@ -74,9 +75,21 @@ class InputfieldFile extends Inputfield implements InputfieldItemList, Inputfiel * */ protected $uploadOnlyMode = 0; - + + /** + * This is true when we are only rendering the value rather than the inputs + * + * @var bool + * + */ protected $renderValueMode = false; - + + /** + * True when in ajax mode + * + * @var bool + * + */ protected $isAjax = false; /** @@ -108,6 +121,7 @@ class InputfieldFile extends Inputfield implements InputfieldItemList, Inputfiel $this->set('maxFiles', 0); $this->set('maxFilesize', 0); $this->set('useTags', 0); + $this->set('tagsList', ''); // native to this Inputfield $this->set('unzip', 0); @@ -199,7 +213,15 @@ class InputfieldFile extends Inputfield implements InputfieldItemList, Inputfiel public function isEmpty() { return !count($this->value); } - + + /** + * Set an attribute + * + * @param array|string $key + * @param array|int|string $value + * @return Inputfield|InputfieldFile + * + */ public function setAttribute($key, $value) { if($key == 'value') { if($value instanceof Pagefile) { @@ -238,10 +260,26 @@ class InputfieldFile extends Inputfield implements InputfieldItemList, Inputfiel return $this; } + /** + * Get the unique 'id' attribute for the given Pagefile + * + * @param Pagefile $pagefile + * @return string + * + */ protected function pagefileId(Pagefile $pagefile) { return $this->name . "_" . $pagefile->hash; } + /** + * Render a description input for the given Pagefile + * + * @param Pagefile $pagefile + * @param string $id + * @param int $n + * @return string + * + */ protected function renderItemDescriptionField(Pagefile $pagefile, $id, $n) { if($n) {} @@ -265,6 +303,7 @@ class InputfieldFile extends Inputfield implements InputfieldItemList, Inputfiel $userLanguage = $this->wire('user')->language; $languages = $this->noLang ? null : $this->wire('languages'); + $defaultDescriptionFieldLabel = $this->wire('sanitizer')->entities1($this->labels['description']); if(!$userLanguage || !$languages || $languages->count() < 2) { $numLanguages = 0; @@ -274,7 +313,9 @@ class InputfieldFile extends Inputfield implements InputfieldItemList, Inputfiel if(is_null($hasLangTabs)) { $hasLangTabs = $this->wire('modules')->isInstalled('LanguageTabs'); if($hasLangTabs) { - $langTabSettings = $this->wire('modules')->getModule('LanguageTabs')->getSettings(); + /** @var LanguageTabs $languageTabs */ + $languageTabs = $this->wire('modules')->getModule('LanguageTabs'); + $langTabSettings = $languageTabs->getSettings(); } } } @@ -282,8 +323,9 @@ class InputfieldFile extends Inputfield implements InputfieldItemList, Inputfiel foreach($languages as $language) { $descriptionFieldName = "description_$id"; - $descriptionFieldLabel = $this->labels['description']; + $descriptionFieldLabel = $defaultDescriptionFieldLabel; $labelClass = "detail"; + $attrStr = ''; if($language) { $tabField = empty($langTabSettings['tabField']) ? 'title' : $langTabSettings['tabField']; @@ -303,16 +345,20 @@ class InputfieldFile extends Inputfield implements InputfieldItemList, Inputfiel $out .= "
    "; // open wrapper } else { $out .= "
    "; // open wrapper + $attrStr = "placeholder='$descriptionFieldLabel…'"; + $labelClass = 'detail pw-hidden'; } - + + $attrStr = "name='$descriptionFieldName' id='$descriptionFieldName' $attrStr"; + $out .= ""; $description = $this->wire('sanitizer')->entities($pagefile->description($language)); if($this->descriptionRows > 1) { - $out .= ""; + $out .= ""; } else { - $out .= ""; + $out .= ""; } $out .= "
    "; // close wrapper @@ -326,18 +372,45 @@ class InputfieldFile extends Inputfield implements InputfieldItemList, Inputfiel } } - - if($this->useTags) { - $tags = $this->wire('sanitizer')->entities($pagefile->tags); - $tagsLabel = $this->labels['tags']; - $out .= - "" . - "" . - "" . - ""; + if($this->useTags) $out .= $this->renderItemTagsField($pagefile, $id, $n); + + return $out; + } + + /** + * Render the tags input for the given Pagefile + * + * @param Pagefile $pagefile + * @param string $id + * @param int $n + * @return string + * + */ + protected function renderItemTagsField(Pagefile $pagefile, $id, $n) { + + if($n) {} + $tagsLabel = $this->wire('sanitizer')->entities($this->labels['tags']) . '…'; + $tagsStr = $this->wire('sanitizer')->entities($pagefile->tags); + $tagsAttr = ''; + + if($this->useTags >= FieldtypeFile::useTagsPredefined) { + // select predefined + $tagsClass = 'InputfieldFileTagsSelect'; + $tagsAttr = "data-cfgname='InputfieldFileTags_{$this->hasField->name}' "; + + } else { + // text input + $tagsClass = 'InputfieldFileTagsInput'; } + $out = + "
    " . + "" . + "" . + "
    "; + return $out; } @@ -505,6 +578,42 @@ class InputfieldFile extends Inputfield implements InputfieldItemList, Inputfiel public function renderReady(Inputfield $parent = null, $renderValueMode = false) { $this->addClass('InputfieldNoFocus', 'wrapClass'); + + if($this->useTags) { + $this->wire('modules')->get('JqueryUI')->use('selectize'); + $this->addClass('InputfieldFileHasTags', 'wrapClass'); + if($this->useTags >= FieldtypeFile::useTagsPredefined && $this->hasField) { + // predefined tags + $config = $this->wire('config'); + $fieldName = $this->hasField->name; + $jsName = "InputfieldFileTags_$fieldName"; + $allowUserTags = $this->useTags & FieldtypeFile::useTagsNormal; + $data = $config->js($jsName); + if(!is_array($data)) $data = array(); + if(empty($data['tags'])) { + $tags = array(); + foreach(explode(' ', (string) $this->get('tagsList')) as $tag) { + $tag = trim($tag); + if(!strlen($tag)) continue; + $tags[strtolower($tag)] = $tag; + } + if($allowUserTags) { + $pagefiles = $this->val(); + if($pagefiles instanceof Pagefiles) { + $_tags = $pagefiles->tags(true); + if(count($_tags)) $tags = array_merge($tags, $_tags); + } + } + $data['tags'] = array_values($tags); + $data['allowUserTags'] = $allowUserTags; + $config->js($jsName, $data); + } + $this->wrapAttr('data-configName', $jsName); + } else { + // regular tags text input + } + } + return parent::renderReady($parent, $renderValueMode); } @@ -704,7 +813,9 @@ class InputfieldFile extends Inputfield implements InputfieldItemList, Inputfiel foreach($keys as $key) { if(isset($input[$key . '_' . $id])) { - $value = trim($input[$key . '_' . $id]); + $value = $input[$key . '_' . $id]; + if(is_array($value)) $value = implode(' ', $value); + $value = trim($value); if($value != $pagefile->$key) { $pagefile->$key = $value; $changed = true; diff --git a/wire/modules/Inputfield/InputfieldFile/InputfieldFile.scss b/wire/modules/Inputfield/InputfieldFile/InputfieldFile.scss index e830d2dc..d8793476 100755 --- a/wire/modules/Inputfield/InputfieldFile/InputfieldFile.scss +++ b/wire/modules/Inputfield/InputfieldFile/InputfieldFile.scss @@ -108,9 +108,12 @@ ul.InputfieldFileList li { margin: 0; padding: 0; - input { + input[type=text] { width: 100%; } + label.pw-hidden { + display: none; + } } .InputfieldFileSort { display: none !important; @@ -197,6 +200,34 @@ ul.InputfieldFileListBlank + p.description { } } +.InputfieldFileDescription, +.InputfieldFileTags { + label.pw-hidden { + display: none; + } + input::placeholder { + font-size: 13px; + color: #999; + } +} +.AdminThemeDefault .InputfieldFileDescription { + input::placeholder { + padding-left: 3px; + } +} + +.InputfieldFileTags { + .selectize-control.multi .selectize-input > div { + background: #eee; + border-radius: 3px; + white-space: nowrap; + a.remove { + color: #999; + border-color: #ddd; + } + } +} + // multi-language ----------------------------------------------------------- .pw-content ul.InputfieldFileList li .langTabs > ul, diff --git a/wire/modules/Inputfield/InputfieldImage/InputfieldImage.js b/wire/modules/Inputfield/InputfieldImage/InputfieldImage.js index da09abea..4dff1f22 100755 --- a/wire/modules/Inputfield/InputfieldImage/InputfieldImage.js +++ b/wire/modules/Inputfield/InputfieldImage/InputfieldImage.js @@ -531,6 +531,10 @@ function InputfieldImage($) { } else if($el.is(".mfp-close")) { // magnific popup close button return; + + } else if($el.is("a.remove")) { + // selectize + return; } else { // other diff --git a/wire/modules/Inputfield/InputfieldImage/InputfieldImage.min.js b/wire/modules/Inputfield/InputfieldImage/InputfieldImage.min.js index 10edc97c..75d86d31 100644 --- a/wire/modules/Inputfield/InputfieldImage/InputfieldImage.min.js +++ b/wire/modules/Inputfield/InputfieldImage/InputfieldImage.min.js @@ -1 +1 @@ -function InputfieldImage(v){var k=null;var b={file:"",item:null,edit:null};var F={type:"image",closeOnContentClick:true,closeBtnInside:true};var c=null;var r=[];function s(){var M=window.File&&window.FileList&&window.FileReader;var L=v(".InputfieldAllowAjaxUpload").length>0;var N=v("#PageIDIndicator").length>0;return(M&&(N||L))}function y(N,L,M){L||(L=250);var O,P;return function(){var S=M||this;var R=+new Date(),Q=arguments;if(O&&R .gridImage",start:function(Q,P){var O=E(M.closest(".Inputfield"),"size");P.placeholder.append(v("
    ").css({display:"block",height:O+"px",width:O+"px"}));N=window.setTimeout(function(){G(M,null)},100);M.addClass("InputfieldImageSorting")},stop:function(Q,O){var P=v(this);if(N!==null){O.item.find(".InputfieldImageEdit__edit").click();clearTimeout(N)}P.children("li").each(function(S){var R=v(this).find(".InputfieldFileSort");if(R.val()!=S){R.val(S).change()}});M.removeClass("InputfieldImageSorting")},cancel:".InputfieldImageEdit"};M.sortable(L)}function p(M){var L=v.extend(true,{},F);L.callbacks={elementParse:function(N){var O=v(N.el).attr("data-original");if(typeof O=="undefined"||!O){O=v(N.el).attr("src")}N.src=O}};L.gallery={enabled:true};M.find("img").magnificPopup(L)}function t(M){var L=v.extend(true,{},F);L.callbacks={elementParse:function(N){N.src=v(N.el).attr("src")}};L.gallery={enabled:false};M.find("img").magnificPopup(L)}function C(L){return L.find(".InputfieldImageEdit--active")}function u(L){return v("#"+L.find(".InputfieldImageEdit__edit").attr("data-current"))}function D(N){var L=N.is(":checked");var M=N.parents(".gridImages").find(".gridImage__deletebox");if(L){M.prop("checked","checked").change()}else{M.removeAttr("checked").change()}}function J(M){if(typeof M=="undefined"){var L=v(".gridImages")}else{var L=M.find(".gridImages")}L.each(function(){var N=v(this),O=C(N);if(O.length){i(u(O),O)}})}function w(R){var N=[];var Q=[];var P=0,L=0;var O;if(typeof R=="undefined"){O=v(".InputfieldImage.Inputfield")}else{O=R}O.removeClass("InputfieldImageNarrow");O.each(function(){var T=v(this);var U=T.width();if(U<1){return}if(U<=500){N[P]=T;P++}});for(var S=0;S=Q){O.css("max-height","100%").css("max-width","none");O.attr("height",M).removeAttr("width")}else{if(Q>L){O.css("max-height","none").css("max-width","100%");O.attr("width",M).removeAttr("height")}else{O.css("max-height","100%").css("max-width","none");O.removeAttr("width").attr("height",M)}}}var L=O.width();if(L){N.css({width:(P?L+"px":M+"px"),height:M+"px"})}else{var R=N.attr("data-tries");if(!R){R=0}if(typeof R=="undefined"){R=0}R=parseInt(R);if(R>3){N.css({width:M+"px",height:M+"px"})}else{r.push(N);N.attr("data-tries",R+1)}}}function A(M){if(M.find(".InputfieldImageListToggle").length){return}var P=v("").append("");var R=v("").append("");var L=v("").append("");var Q="InputfieldImageListToggle--active";var O="";var N=function(W){var V=v(this);var U=V.closest(".Inputfield");var S=V.attr("href");var T;V.parent().children("."+Q).removeClass(Q);V.addClass(Q);if(S=="list"){if(!U.hasClass("InputfieldImageEditAll")){U.find(".InputfieldImageEdit--active .InputfieldImageEdit__close").click();U.addClass("InputfieldImageEditAll")}T=E(U,"listSize");l(U,T);e(U,"mode","list")}else{if(S=="left"){U.removeClass("InputfieldImageEditAll");T=E(U,"size");j(U,T,true);e(U,"mode","left");J()}else{if(S=="grid"){U.removeClass("InputfieldImageEditAll");T=E(U,"size");j(U,T,false);e(U,"mode","grid")}}}B(U.find(".gridImages"));V.blur();return false};P.click(N);R.click(N);L.click(N);if(M.hasClass("InputfieldImage")){M.find(".InputfieldHeader").append(P).append(R).append(L);O=E(M,"mode")}else{v(".InputfieldImage .InputfieldHeader",M).append(P).append(R).append(L)}if(O=="list"){P.click()}else{if(O=="left"){R.click()}else{}}}function z(Q){var N=Q.children(".InputfieldHeader");if(N.children(".InputfieldImageSizeSlider").length){return}var P=Q.find(".gridImages");var M=P.attr("data-gridsize");var O=M/2;var L=M*2;var R=v('');N.append(R);R.slider({min:O,max:L,value:E(Q,"size"),range:"min",slide:function(U,W){var V=W.value;var X=15;var Y=Math.floor(M/X);var S=V-O;var T=Math.floor(X+(S/Y));if(Q.hasClass("InputfieldImageEditAll")){e(Q,"size",V);l(Q,T)}else{e(Q,"listSize",T);j(Q,V)}},start:function(S,T){if(Q.find(".InputfieldImageEdit:visible").length){Q.find(".InputfieldImageEdit__close").click()}},stop:function(S,T){J(Q)}})}function e(M,P,O){var N=E(M);var Q=M.attr("id");var L=Q?Q.replace("wrap_Inputfield_",""):"";if(!L.length||typeof O=="undefined"){return}if(N[L][P]==O){return}N[L][P]=O;v.cookie("InputfieldImage",N);c=N}function E(M,P){if(c&&typeof P=="undefined"){return c}var Q=M.attr("id");var L=Q?Q.replace("wrap_Inputfield_",""):"na";var O=c?c:v.cookie("InputfieldImage");var N=null;if(!O){var O={}}if(typeof O[L]=="undefined"){O[L]={}}if(typeof O[L].size=="undefined"){O[L].size=parseInt(M.find(".gridImages").attr("data-size"))}if(typeof O[L].listSize=="undefined"){O[L].listSize=23}if(typeof O[L].mode=="undefined"){O[L].mode=M.find(".gridImages").attr("data-gridMode")}if(c==null){c=O}if(typeof P=="undefined"){N=O}else{if(P===true){N=O[L]}else{if(typeof O[L][P]!="undefined"){N=O[L][P]}}}return N}function a(P){if(P.hasClass("InputfieldStateCollapsed")){return}var Q=parseInt(P.find(".InputfieldImageMaxFiles").val());var O=P.find(".gridImages");var N=E(P,"size");var R=E(P,"mode");var M=R=="left"?true:false;if(!N){N=O.attr("data-gridsize")}N=parseInt(N);j(P,N,M);if(P.hasClass("InputfieldImageEditAll")||R=="list"){var L=E(P,"listSize");l(P,L)}if(!P.hasClass("InputfieldImageInit")){P.addClass("InputfieldImageInit");if(P.hasClass("InputfieldRenderValueMode")){return p(P)}else{if(Q==1){P.addClass("InputfieldImageMax1");t(P)}else{B(O)}}A(P);z(P)}w(P)}function I(){v("body").addClass("ie-no-drop");v(".InputfieldImage.InputfieldFileMultiple").each(function(){var M=v(this),O=parseInt(M.find(".InputfieldFileMaxFiles").val()),L=M.find(".gridImages"),N=M.find(".InputfieldImageUpload");N.on("change","input[type=file]",function(){var S=v(this),Q=S.parent(".InputMask");if(S.val().length>1){Q.addClass("ui-state-disabled")}else{Q.removeClass("ui-state-disabled")}if(S.next("input.InputfieldFile").length>0){return}var P=L.children("li").length+N.find("input[type=file]").length+1;if(O>0&&P>=O){return}N.find(".InputMask").not(":last").each(function(){var T=v(this);if(T.find("input[type=file]").val()<1){T.remove()}});var R=Q.clone().removeClass("ui-state-disabled");R.children("input[type=file]").val("");R.insertAfter(Q)})})}function K(N){var M;if(N.length>0){M=N.find(".InputfieldImageUpload")}else{M=v(".InputfieldImageUpload")}M.each(function(Q){var R=v(this);var P=R.closest(".InputfieldContent");if(R.hasClass("InputfieldImageInitUpload")){return}O(P,Q);R.addClass("InputfieldImageInitUpload")});function O(Y,aj){var X=Y.parents("form");var P=Y.closest(".InputfieldRepeaterItem");var T=P.length?P.attr("data-editUrl"):X.attr("action");T+=(T.indexOf("?")>-1?"&":"?")+"InputfieldFileAjax=1";var ao=X.find("input._post_token");var W=ao.attr("name");var ab=ao.val();var aa=Y.find(".InputfieldImageErrors").first();var S=Y.find(".InputfieldImageUpload").data("fieldname");S=S.slice(0,-2);var ai=Y.closest(".Inputfield.InputfieldImage");var an=Y.find(".InputfieldImageUpload").data("extensions").toLowerCase();var ah=Y.find(".InputfieldImageUpload").data("maxfilesize");var Z=Y.find("input[type=file]").get(0);var R=Y.find(".gridImages");var ak=R.get(0);var ad=R.data("gridsize");var ae=null;var ac=parseInt(Y.find(".InputfieldImageMaxFiles").val());var am=n(ai);al(Y);if(ac!=1){ag(R)}R.children().addClass("InputfieldFileItemExisting");function V(aq,ap){if(typeof ap!=="undefined"){aq=""+ap+": "+aq}return"
  • "+aq+"
  • "}function Q(aq){var ap=new String(aq).substring(aq.lastIndexOf("/")+1);if(ap.lastIndexOf(".")!=-1){ap=ap.substring(0,ap.lastIndexOf("."))}return ap}function al(aq){if(aq.hasClass("InputfieldImageDropzoneInit")){return}var au=aq.get(0);var at=aq.closest(".Inputfield");function ap(){if(at.hasClass("pw-drag-in-file")){return}aq.addClass("ui-state-hover");at.addClass("pw-drag-in-file")}function ar(){if(!at.hasClass("pw-drag-in-file")){return}aq.removeClass("ui-state-hover");at.removeClass("pw-drag-in-file")}au.addEventListener("dragleave",function(){ar()},false);au.addEventListener("dragenter",function(){ap()},false);au.addEventListener("dragover",function(av){if(!aq.is("ui-state-hover")){ap()}av.preventDefault();av.stopPropagation();return false},false);au.addEventListener("drop",function(av){af(av.dataTransfer.files);ar();av.preventDefault();av.stopPropagation();return false},false);aq.addClass("InputfieldImageDropzoneInit")}function ag(ay){var aC=null;var aA=false;var aq=null;var ap=ay.closest(".Inputfield");function av(){ap.addClass("pw-drag-in-file")}function aB(){ap.removeClass("pw-drag-in-file")}function au(aE){var aI=aE.offset();var aF=aE.width();var aD=aE.height();var aH=aI.left+aF/2;var aG=aI.top+aD/2;return{clientX:aH,clientY:aG}}function ax(){return ay.find(".InputfieldImageEdit--active").length>0}function aw(aE){if(ax()){return}aE.preventDefault();aE.stopPropagation();av();aA=false;if(aC==null){var aD=ay.attr("data-size")+"px";var aF=v("
    ").addClass("gridImage__overflow");if(ay.closest(".InputfieldImageEditAll").length){aF.css({width:"100%",height:aD})}else{aF.css({width:aD,height:aD})}aC=v("
  • ").addClass("ImageOuter gridImage gridImagePlaceholder").append(aF);ay.append(aC)}var aG=au(aC);aC.simulate("mousedown",aG)}function az(aD){if(ax()){return}aD.preventDefault();aD.stopPropagation();av();aA=false;if(aC==null){return}var aE={clientX:aD.originalEvent.clientX,clientY:aD.originalEvent.clientY};aC.simulate("mousemove",aE)}function at(aD){if(ax()){return}aD.preventDefault();aD.stopPropagation();if(aC==null){return false}aA=true;if(aq){clearTimeout(aq)}aq=setTimeout(function(){if(!aA||aC==null){return}aC.remove();aC=null;aB()},1000)}function ar(aD){if(ax()){return}aB();aA=false;var aE={clientX:aD.clientX,clientY:aD.clientY};aC.simulate("mouseup",aE);k=aC.next(".gridImage");aC.remove();aC=null}if(ay.length&&!ay.hasClass("gridImagesInitDropInPlace")){ay.on("dragenter",aw);ay.on("dragover",az);ay.on("dragleave",at);ay.on("drop",ar);ay.addClass("gridImagesInitDropInPlace")}}function U(aN,aB){var aK=ProcessWire.config.InputfieldImage.labels;var aw=parseInt(aN.size/1024,10)+" kB";var aM='
    '+aK.dimensions+''+aK.na+"
    "+aK.filesize+""+aw+"
    "+aK.variations+"0
    ";var aP=v('
  • '),aH=v(aM),ax=v('
    '),ap=v('
    '),aE=v("
    "),aG=v(""),aJ=v(' '),aI=v('
    '),aq,az,aO,aC=URL.createObjectURL(aN),ar=ai.find(".gridImages"),au=ac==1,aF=E(ai,"size"),av=E(ai,"listSize"),at=ai.hasClass("InputfieldImageEditAll"),ay=v('');ax.append(ay);aE.find(".gridImage__inner").append(aJ);aE.find(".gridImage__inner").append(aI.css("display","none"));aE.find(".gridImage__inner").append(aG);ap.append(v('

    '+aN.name+'

    '+aw+""));if(at){ax.css("width",av+"%");ap.css("width",(100-av)+"%")}else{ax.css({width:aF+"px",height:aF+"px"})}aP.append(aH).append(ax).append(aE).append(ap);ay.attr({src:aC,"data-original":aC});img=new Image();img.addEventListener("load",function(){aH.find(".dimensions").html(this.width+" × "+this.height);var aQ=Math.min(this.width,this.height)/aF;ay.attr({width:this.width/aQ,height:this.height/aQ})},false);img.src=aC;az=new XMLHttpRequest();function aA(aQ){if(typeof aQ!="undefined"){if(!aQ.lengthComputable){return}aG.attr("value",parseInt((aQ.loaded/aQ.total)*100))}v("body").addClass("pw-uploading");aI.css("display","block")}az.upload.addEventListener("progress",aA,false);az.addEventListener("load",function(){az.getAllResponseHeaders();var aR=v.parseJSON(az.responseText),aU=aR.length>1;if(aR.error!==undefined){aR=[aR]}for(var aW=0;aW1){ai.removeClass("InputfieldFileEmpty").removeClass("InputfieldFileSingle").addClass("InputfieldFileMultiple")}}}aA();if(am.maxWidth>0||am.maxHeight>0||am.maxSize>0){var aD=new PWImageResizer(am);aI.addClass("pw-resizing");aD.resize(aN,function(aQ){aI.removeClass("pw-resizing");aL(aN,aQ)})}else{aL(aN)}}function af(au){var aq=function(ay){return parseInt(ay/1024,10)};if(typeof au==="undefined"){ak.innerHTML="No support for the File API in this web browser";return}for(var ar=0,ap=au.length;arah&&ah>2000000){var aw=aq(au[ar].size),av=aq(ah);at="Filesize "+aw+" kb is too big. Maximum allowed is "+av+" kb";aa.append(V(at,au[ar].name))}else{U(au[ar],ax)}}if(ac==1){break}}}Z.addEventListener("change",function(ap){af(this.files);ap.preventDefault();ap.stopPropagation();this.value=""},false)}function L(){var P=".InputfieldImageEdit__imagewrapper img";v(document).on("dragenter",P,function(){var S=v(this);if(S.closest(".InputfieldImageMax1").length){return}var T=S.attr("src");var Q=S.closest(".InputfieldImageEdit");var R=S.closest(".InputfieldImageEdit__imagewrapper");R.addClass("InputfieldImageEdit__replace");b.file=new String(T).substring(T.lastIndexOf("/")+1);b.item=v("#"+Q.attr("data-for"));b.edit=Q}).on("dragleave",P,function(){var R=v(this);if(R.closest(".InputfieldImageMax1").length){return}var Q=R.closest(".InputfieldImageEdit__imagewrapper");Q.removeClass("InputfieldImageEdit__replace");b.file="";b.item=null;b.edit=null})}L()}function n(M){var L={maxWidth:0,maxHeight:0,maxSize:0,quality:1,autoRotate:true,debug:ProcessWire.config.debug};var N=M.attr("data-resize");if(typeof N!="undefined"&&N.length){N=N.split(";");L.maxWidth=parseInt(N[0]);L.maxHeight=parseInt(N[1]);L.maxSize=parseFloat(N[2]);L.quality=parseFloat(N[3])}return L}function H(){v(".InputfieldImage.Inputfield").each(function(){a(v(this))});x();if(s()){K("")}else{I()}v(document).on("reloaded",".InputfieldImage",function(){var L=v(this);a(L);K(L)}).on("wiretabclick",function(N,M,L){M.find(".InputfieldImage").each(function(){a(v(this))})}).on("opened",".InputfieldImage",function(){a(v(this))})}H()}jQuery(document).ready(function(a){InputfieldImage(a)}); \ No newline at end of file +function InputfieldImage(v){var k=null;var b={file:"",item:null,edit:null};var F={type:"image",closeOnContentClick:true,closeBtnInside:true};var c=null;var r=[];function s(){var M=window.File&&window.FileList&&window.FileReader;var L=v(".InputfieldAllowAjaxUpload").length>0;var N=v("#PageIDIndicator").length>0;return(M&&(N||L))}function y(N,L,M){L||(L=250);var O,P;return function(){var S=M||this;var R=+new Date(),Q=arguments;if(O&&R .gridImage",start:function(Q,P){var O=E(M.closest(".Inputfield"),"size");P.placeholder.append(v("
    ").css({display:"block",height:O+"px",width:O+"px"}));N=window.setTimeout(function(){G(M,null)},100);M.addClass("InputfieldImageSorting")},stop:function(Q,O){var P=v(this);if(N!==null){O.item.find(".InputfieldImageEdit__edit").click();clearTimeout(N)}P.children("li").each(function(S){var R=v(this).find(".InputfieldFileSort");if(R.val()!=S){R.val(S).change()}});M.removeClass("InputfieldImageSorting")},cancel:".InputfieldImageEdit"};M.sortable(L)}function p(M){var L=v.extend(true,{},F);L.callbacks={elementParse:function(N){var O=v(N.el).attr("data-original");if(typeof O=="undefined"||!O){O=v(N.el).attr("src")}N.src=O}};L.gallery={enabled:true};M.find("img").magnificPopup(L)}function t(M){var L=v.extend(true,{},F);L.callbacks={elementParse:function(N){N.src=v(N.el).attr("src")}};L.gallery={enabled:false};M.find("img").magnificPopup(L)}function C(L){return L.find(".InputfieldImageEdit--active")}function u(L){return v("#"+L.find(".InputfieldImageEdit__edit").attr("data-current"))}function D(N){var L=N.is(":checked");var M=N.parents(".gridImages").find(".gridImage__deletebox");if(L){M.prop("checked","checked").change()}else{M.removeAttr("checked").change()}}function J(M){if(typeof M=="undefined"){var L=v(".gridImages")}else{var L=M.find(".gridImages")}L.each(function(){var N=v(this),O=C(N);if(O.length){i(u(O),O)}})}function w(R){var N=[];var Q=[];var P=0,L=0;var O;if(typeof R=="undefined"){O=v(".InputfieldImage.Inputfield")}else{O=R}O.removeClass("InputfieldImageNarrow");O.each(function(){var T=v(this);var U=T.width();if(U<1){return}if(U<=500){N[P]=T;P++}});for(var S=0;S=Q){O.css("max-height","100%").css("max-width","none");O.attr("height",M).removeAttr("width")}else{if(Q>L){O.css("max-height","none").css("max-width","100%");O.attr("width",M).removeAttr("height")}else{O.css("max-height","100%").css("max-width","none");O.removeAttr("width").attr("height",M)}}}var L=O.width();if(L){N.css({width:(P?L+"px":M+"px"),height:M+"px"})}else{var R=N.attr("data-tries");if(!R){R=0}if(typeof R=="undefined"){R=0}R=parseInt(R);if(R>3){N.css({width:M+"px",height:M+"px"})}else{r.push(N);N.attr("data-tries",R+1)}}}function A(M){if(M.find(".InputfieldImageListToggle").length){return}var P=v("").append("");var R=v("").append("");var L=v("").append("");var Q="InputfieldImageListToggle--active";var O="";var N=function(W){var V=v(this);var U=V.closest(".Inputfield");var S=V.attr("href");var T;V.parent().children("."+Q).removeClass(Q);V.addClass(Q);if(S=="list"){if(!U.hasClass("InputfieldImageEditAll")){U.find(".InputfieldImageEdit--active .InputfieldImageEdit__close").click();U.addClass("InputfieldImageEditAll")}T=E(U,"listSize");l(U,T);e(U,"mode","list")}else{if(S=="left"){U.removeClass("InputfieldImageEditAll");T=E(U,"size");j(U,T,true);e(U,"mode","left");J()}else{if(S=="grid"){U.removeClass("InputfieldImageEditAll");T=E(U,"size");j(U,T,false);e(U,"mode","grid")}}}B(U.find(".gridImages"));V.blur();return false};P.click(N);R.click(N);L.click(N);if(M.hasClass("InputfieldImage")){M.find(".InputfieldHeader").append(P).append(R).append(L);O=E(M,"mode")}else{v(".InputfieldImage .InputfieldHeader",M).append(P).append(R).append(L)}if(O=="list"){P.click()}else{if(O=="left"){R.click()}else{}}}function z(Q){var N=Q.children(".InputfieldHeader");if(N.children(".InputfieldImageSizeSlider").length){return}var P=Q.find(".gridImages");var M=P.attr("data-gridsize");var O=M/2;var L=M*2;var R=v('');N.append(R);R.slider({min:O,max:L,value:E(Q,"size"),range:"min",slide:function(U,W){var V=W.value;var X=15;var Y=Math.floor(M/X);var S=V-O;var T=Math.floor(X+(S/Y));if(Q.hasClass("InputfieldImageEditAll")){e(Q,"size",V);l(Q,T)}else{e(Q,"listSize",T);j(Q,V)}},start:function(S,T){if(Q.find(".InputfieldImageEdit:visible").length){Q.find(".InputfieldImageEdit__close").click()}},stop:function(S,T){J(Q)}})}function e(M,P,O){var N=E(M);var Q=M.attr("id");var L=Q?Q.replace("wrap_Inputfield_",""):"";if(!L.length||typeof O=="undefined"){return}if(N[L][P]==O){return}N[L][P]=O;v.cookie("InputfieldImage",N);c=N}function E(M,P){if(c&&typeof P=="undefined"){return c}var Q=M.attr("id");var L=Q?Q.replace("wrap_Inputfield_",""):"na";var O=c?c:v.cookie("InputfieldImage");var N=null;if(!O){var O={}}if(typeof O[L]=="undefined"){O[L]={}}if(typeof O[L].size=="undefined"){O[L].size=parseInt(M.find(".gridImages").attr("data-size"))}if(typeof O[L].listSize=="undefined"){O[L].listSize=23}if(typeof O[L].mode=="undefined"){O[L].mode=M.find(".gridImages").attr("data-gridMode")}if(c==null){c=O}if(typeof P=="undefined"){N=O}else{if(P===true){N=O[L]}else{if(typeof O[L][P]!="undefined"){N=O[L][P]}}}return N}function a(P){if(P.hasClass("InputfieldStateCollapsed")){return}var Q=parseInt(P.find(".InputfieldImageMaxFiles").val());var O=P.find(".gridImages");var N=E(P,"size");var R=E(P,"mode");var M=R=="left"?true:false;if(!N){N=O.attr("data-gridsize")}N=parseInt(N);j(P,N,M);if(P.hasClass("InputfieldImageEditAll")||R=="list"){var L=E(P,"listSize");l(P,L)}if(!P.hasClass("InputfieldImageInit")){P.addClass("InputfieldImageInit");if(P.hasClass("InputfieldRenderValueMode")){return p(P)}else{if(Q==1){P.addClass("InputfieldImageMax1");t(P)}else{B(O)}}A(P);z(P)}w(P)}function I(){v("body").addClass("ie-no-drop");v(".InputfieldImage.InputfieldFileMultiple").each(function(){var M=v(this),O=parseInt(M.find(".InputfieldFileMaxFiles").val()),L=M.find(".gridImages"),N=M.find(".InputfieldImageUpload");N.on("change","input[type=file]",function(){var S=v(this),Q=S.parent(".InputMask");if(S.val().length>1){Q.addClass("ui-state-disabled")}else{Q.removeClass("ui-state-disabled")}if(S.next("input.InputfieldFile").length>0){return}var P=L.children("li").length+N.find("input[type=file]").length+1;if(O>0&&P>=O){return}N.find(".InputMask").not(":last").each(function(){var T=v(this);if(T.find("input[type=file]").val()<1){T.remove()}});var R=Q.clone().removeClass("ui-state-disabled");R.children("input[type=file]").val("");R.insertAfter(Q)})})}function K(N){var M;if(N.length>0){M=N.find(".InputfieldImageUpload")}else{M=v(".InputfieldImageUpload")}M.each(function(Q){var R=v(this);var P=R.closest(".InputfieldContent");if(R.hasClass("InputfieldImageInitUpload")){return}O(P,Q);R.addClass("InputfieldImageInitUpload")});function O(Y,aj){var X=Y.parents("form");var P=Y.closest(".InputfieldRepeaterItem");var T=P.length?P.attr("data-editUrl"):X.attr("action");T+=(T.indexOf("?")>-1?"&":"?")+"InputfieldFileAjax=1";var ao=X.find("input._post_token");var W=ao.attr("name");var ab=ao.val();var aa=Y.find(".InputfieldImageErrors").first();var S=Y.find(".InputfieldImageUpload").data("fieldname");S=S.slice(0,-2);var ai=Y.closest(".Inputfield.InputfieldImage");var an=Y.find(".InputfieldImageUpload").data("extensions").toLowerCase();var ah=Y.find(".InputfieldImageUpload").data("maxfilesize");var Z=Y.find("input[type=file]").get(0);var R=Y.find(".gridImages");var ak=R.get(0);var ad=R.data("gridsize");var ae=null;var ac=parseInt(Y.find(".InputfieldImageMaxFiles").val());var am=n(ai);al(Y);if(ac!=1){ag(R)}R.children().addClass("InputfieldFileItemExisting");function V(aq,ap){if(typeof ap!=="undefined"){aq=""+ap+": "+aq}return"
  • "+aq+"
  • "}function Q(aq){var ap=new String(aq).substring(aq.lastIndexOf("/")+1);if(ap.lastIndexOf(".")!=-1){ap=ap.substring(0,ap.lastIndexOf("."))}return ap}function al(aq){if(aq.hasClass("InputfieldImageDropzoneInit")){return}var au=aq.get(0);var at=aq.closest(".Inputfield");function ap(){if(at.hasClass("pw-drag-in-file")){return}aq.addClass("ui-state-hover");at.addClass("pw-drag-in-file")}function ar(){if(!at.hasClass("pw-drag-in-file")){return}aq.removeClass("ui-state-hover");at.removeClass("pw-drag-in-file")}au.addEventListener("dragleave",function(){ar()},false);au.addEventListener("dragenter",function(){ap()},false);au.addEventListener("dragover",function(av){if(!aq.is("ui-state-hover")){ap()}av.preventDefault();av.stopPropagation();return false},false);au.addEventListener("drop",function(av){af(av.dataTransfer.files);ar();av.preventDefault();av.stopPropagation();return false},false);aq.addClass("InputfieldImageDropzoneInit")}function ag(ay){var aC=null;var aA=false;var aq=null;var ap=ay.closest(".Inputfield");function av(){ap.addClass("pw-drag-in-file")}function aB(){ap.removeClass("pw-drag-in-file")}function au(aE){var aI=aE.offset();var aF=aE.width();var aD=aE.height();var aH=aI.left+aF/2;var aG=aI.top+aD/2;return{clientX:aH,clientY:aG}}function ax(){return ay.find(".InputfieldImageEdit--active").length>0}function aw(aE){if(ax()){return}aE.preventDefault();aE.stopPropagation();av();aA=false;if(aC==null){var aD=ay.attr("data-size")+"px";var aF=v("
    ").addClass("gridImage__overflow");if(ay.closest(".InputfieldImageEditAll").length){aF.css({width:"100%",height:aD})}else{aF.css({width:aD,height:aD})}aC=v("
  • ").addClass("ImageOuter gridImage gridImagePlaceholder").append(aF);ay.append(aC)}var aG=au(aC);aC.simulate("mousedown",aG)}function az(aD){if(ax()){return}aD.preventDefault();aD.stopPropagation();av();aA=false;if(aC==null){return}var aE={clientX:aD.originalEvent.clientX,clientY:aD.originalEvent.clientY};aC.simulate("mousemove",aE)}function at(aD){if(ax()){return}aD.preventDefault();aD.stopPropagation();if(aC==null){return false}aA=true;if(aq){clearTimeout(aq)}aq=setTimeout(function(){if(!aA||aC==null){return}aC.remove();aC=null;aB()},1000)}function ar(aD){if(ax()){return}aB();aA=false;var aE={clientX:aD.clientX,clientY:aD.clientY};aC.simulate("mouseup",aE);k=aC.next(".gridImage");aC.remove();aC=null}if(ay.length&&!ay.hasClass("gridImagesInitDropInPlace")){ay.on("dragenter",aw);ay.on("dragover",az);ay.on("dragleave",at);ay.on("drop",ar);ay.addClass("gridImagesInitDropInPlace")}}function U(aN,aB){var aK=ProcessWire.config.InputfieldImage.labels;var aw=parseInt(aN.size/1024,10)+" kB";var aM='
    '+aK.dimensions+''+aK.na+"
    "+aK.filesize+""+aw+"
    "+aK.variations+"0
    ";var aP=v('
  • '),aH=v(aM),ax=v('
    '),ap=v('
    '),aE=v("
    "),aG=v(""),aJ=v(' '),aI=v('
    '),aq,az,aO,aC=URL.createObjectURL(aN),ar=ai.find(".gridImages"),au=ac==1,aF=E(ai,"size"),av=E(ai,"listSize"),at=ai.hasClass("InputfieldImageEditAll"),ay=v('');ax.append(ay);aE.find(".gridImage__inner").append(aJ);aE.find(".gridImage__inner").append(aI.css("display","none"));aE.find(".gridImage__inner").append(aG);ap.append(v('

    '+aN.name+'

    '+aw+""));if(at){ax.css("width",av+"%");ap.css("width",(100-av)+"%")}else{ax.css({width:aF+"px",height:aF+"px"})}aP.append(aH).append(ax).append(aE).append(ap);ay.attr({src:aC,"data-original":aC});img=new Image();img.addEventListener("load",function(){aH.find(".dimensions").html(this.width+" × "+this.height);var aQ=Math.min(this.width,this.height)/aF;ay.attr({width:this.width/aQ,height:this.height/aQ})},false);img.src=aC;az=new XMLHttpRequest();function aA(aQ){if(typeof aQ!="undefined"){if(!aQ.lengthComputable){return}aG.attr("value",parseInt((aQ.loaded/aQ.total)*100))}v("body").addClass("pw-uploading");aI.css("display","block")}az.upload.addEventListener("progress",aA,false);az.addEventListener("load",function(){az.getAllResponseHeaders();var aR=v.parseJSON(az.responseText),aU=aR.length>1;if(aR.error!==undefined){aR=[aR]}for(var aW=0;aW1){ai.removeClass("InputfieldFileEmpty").removeClass("InputfieldFileSingle").addClass("InputfieldFileMultiple")}}}aA();if(am.maxWidth>0||am.maxHeight>0||am.maxSize>0){var aD=new PWImageResizer(am);aI.addClass("pw-resizing");aD.resize(aN,function(aQ){aI.removeClass("pw-resizing");aL(aN,aQ)})}else{aL(aN)}}function af(au){var aq=function(ay){return parseInt(ay/1024,10)};if(typeof au==="undefined"){ak.innerHTML="No support for the File API in this web browser";return}for(var ar=0,ap=au.length;arah&&ah>2000000){var aw=aq(au[ar].size),av=aq(ah);at="Filesize "+aw+" kb is too big. Maximum allowed is "+av+" kb";aa.append(V(at,au[ar].name))}else{U(au[ar],ax)}}if(ac==1){break}}}Z.addEventListener("change",function(ap){af(this.files);ap.preventDefault();ap.stopPropagation();this.value=""},false)}function L(){var P=".InputfieldImageEdit__imagewrapper img";v(document).on("dragenter",P,function(){var S=v(this);if(S.closest(".InputfieldImageMax1").length){return}var T=S.attr("src");var Q=S.closest(".InputfieldImageEdit");var R=S.closest(".InputfieldImageEdit__imagewrapper");R.addClass("InputfieldImageEdit__replace");b.file=new String(T).substring(T.lastIndexOf("/")+1);b.item=v("#"+Q.attr("data-for"));b.edit=Q}).on("dragleave",P,function(){var R=v(this);if(R.closest(".InputfieldImageMax1").length){return}var Q=R.closest(".InputfieldImageEdit__imagewrapper");Q.removeClass("InputfieldImageEdit__replace");b.file="";b.item=null;b.edit=null})}L()}function n(M){var L={maxWidth:0,maxHeight:0,maxSize:0,quality:1,autoRotate:true,debug:ProcessWire.config.debug};var N=M.attr("data-resize");if(typeof N!="undefined"&&N.length){N=N.split(";");L.maxWidth=parseInt(N[0]);L.maxHeight=parseInt(N[1]);L.maxSize=parseFloat(N[2]);L.quality=parseFloat(N[3])}return L}function H(){v(".InputfieldImage.Inputfield").each(function(){a(v(this))});x();if(s()){K("")}else{I()}v(document).on("reloaded",".InputfieldImage",function(){var L=v(this);a(L);K(L)}).on("wiretabclick",function(N,M,L){M.find(".InputfieldImage").each(function(){a(v(this))})}).on("opened",".InputfieldImage",function(){a(v(this))})}H()}jQuery(document).ready(function(a){InputfieldImage(a)}); \ No newline at end of file diff --git a/wire/modules/Jquery/JqueryUI/JqueryUI.module b/wire/modules/Jquery/JqueryUI/JqueryUI.module index 756f04f2..5fa734c1 100644 --- a/wire/modules/Jquery/JqueryUI/JqueryUI.module +++ b/wire/modules/Jquery/JqueryUI/JqueryUI.module @@ -33,22 +33,31 @@ class JqueryUI extends ModuleJS { } else if($name == 'vex') { // custom loader for vex static $vexLoaded = false; - if(!$vexLoaded) { - $vexLoaded = true; - $url = $this->config->urls('JqueryUI') . 'vex/'; - $this->config->styles->add($url . 'css/vex.css'); - $this->config->styles->add($url . 'styles/vex-theme-default.css'); - $this->config->scripts->add($url . 'scripts/vex.combined.min.js'); - $adminTheme = $this->wire('adminTheme'); - if($adminTheme) $adminTheme->addExtraMarkup('head', - "" - ); - } + if($vexLoaded) return $this; + $vexLoaded = true; + $config = $this->wire('config'); + $url = $config->urls('JqueryUI') . 'vex/'; + $config->styles->add($url . 'css/vex.css'); + $config->styles->add($url . 'styles/vex-theme-default.css'); + $config->scripts->add($url . 'scripts/vex.combined.min.js'); + $adminTheme = $this->wire('adminTheme'); + if($adminTheme) $adminTheme->addExtraMarkup('head', + "" + ); return $this; + } else if($name == 'selectize') { + static $selectizeLoaded = false; + if($selectizeLoaded) return $this; + $selectizeLoaded = true; + $config = $this->wire('config'); + $url = $config->urls('JqueryUI') . 'selectize/'; + $config->styles->add($url . 'css/selectize.css'); + $config->scripts->add($url . 'js/standalone/selectize.' . ($config->debug ? 'js' : 'min.js')); + return $this; } return parent::___use($name); } diff --git a/wire/modules/Jquery/JqueryUI/selectize/LICENSE b/wire/modules/Jquery/JqueryUI/selectize/LICENSE new file mode 100755 index 00000000..ea75a94e --- /dev/null +++ b/wire/modules/Jquery/JqueryUI/selectize/LICENSE @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright 2013–2015 Brian Reavis + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/wire/modules/Jquery/JqueryUI/selectize/css/selectize.bootstrap2.css b/wire/modules/Jquery/JqueryUI/selectize/css/selectize.bootstrap2.css new file mode 100755 index 00000000..95cb1f04 --- /dev/null +++ b/wire/modules/Jquery/JqueryUI/selectize/css/selectize.bootstrap2.css @@ -0,0 +1,494 @@ +/** + * selectize.bootstrap2.css (v0.12.4) - Bootstrap 2 Theme + * Copyright (c) 2013–2015 Brian Reavis & contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this + * file except in compliance with the License. You may obtain a copy of the License at: + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under + * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF + * ANY KIND, either express or implied. See the License for the specific language + * governing permissions and limitations under the License. + * + * @author Brian Reavis + */ +.selectize-control.plugin-drag_drop.multi > .selectize-input > div.ui-sortable-placeholder { + visibility: visible !important; + background: #f2f2f2 !important; + background: rgba(0, 0, 0, 0.06) !important; + border: 0 none !important; + -webkit-box-shadow: inset 0 0 12px 4px #ffffff; + box-shadow: inset 0 0 12px 4px #ffffff; +} +.selectize-control.plugin-drag_drop .ui-sortable-placeholder::after { + content: '!'; + visibility: hidden; +} +.selectize-control.plugin-drag_drop .ui-sortable-helper { + -webkit-box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2); + box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2); +} +.selectize-dropdown-header { + position: relative; + padding: 3px 10px; + border-bottom: 1px solid #d0d0d0; + background: #f8f8f8; + -webkit-border-radius: 4px 4px 0 0; + -moz-border-radius: 4px 4px 0 0; + border-radius: 4px 4px 0 0; +} +.selectize-dropdown-header-close { + position: absolute; + right: 10px; + top: 50%; + color: #333333; + opacity: 0.4; + margin-top: -12px; + line-height: 20px; + font-size: 20px !important; +} +.selectize-dropdown-header-close:hover { + color: #000000; +} +.selectize-dropdown.plugin-optgroup_columns .optgroup { + border-right: 1px solid #f2f2f2; + border-top: 0 none; + float: left; + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; +} +.selectize-dropdown.plugin-optgroup_columns .optgroup:last-child { + border-right: 0 none; +} +.selectize-dropdown.plugin-optgroup_columns .optgroup:before { + display: none; +} +.selectize-dropdown.plugin-optgroup_columns .optgroup-header { + border-top: 0 none; +} +.selectize-control.plugin-remove_button [data-value] { + position: relative; + padding-right: 24px !important; +} +.selectize-control.plugin-remove_button [data-value] .remove { + z-index: 1; + /* fixes ie bug (see #392) */ + position: absolute; + top: 0; + right: 0; + bottom: 0; + width: 17px; + text-align: center; + font-weight: bold; + font-size: 12px; + color: inherit; + text-decoration: none; + vertical-align: middle; + display: inline-block; + padding: 1px 0 0 0; + border-left: 1px solid #cccccc; + -webkit-border-radius: 0 2px 2px 0; + -moz-border-radius: 0 2px 2px 0; + border-radius: 0 2px 2px 0; + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; +} +.selectize-control.plugin-remove_button [data-value] .remove:hover { + background: rgba(0, 0, 0, 0.05); +} +.selectize-control.plugin-remove_button [data-value].active .remove { + border-left-color: #0077b3; +} +.selectize-control.plugin-remove_button .disabled [data-value] .remove:hover { + background: none; +} +.selectize-control.plugin-remove_button .disabled [data-value] .remove { + border-left-color: #e0e0e0; +} +.selectize-control.plugin-remove_button .remove-single { + position: absolute; + right: 28px; + top: 6px; + font-size: 23px; +} +.selectize-control { + position: relative; +} +.selectize-dropdown, +.selectize-input, +.selectize-input input { + color: #333333; + font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; + font-size: 14px; + line-height: 20px; + -webkit-font-smoothing: inherit; +} +.selectize-input, +.selectize-control.single .selectize-input.input-active { + background: #ffffff; + cursor: text; + display: inline-block; +} +.selectize-input { + border: 1px solid #d0d0d0; + padding: 7px 10px; + display: inline-block; + width: 100%; + overflow: hidden; + position: relative; + z-index: 1; + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; + -webkit-box-shadow: none; + box-shadow: none; + -webkit-border-radius: 4px; + -moz-border-radius: 4px; + border-radius: 4px; +} +.selectize-control.multi .selectize-input.has-items { + padding: 5px 10px 2px; +} +.selectize-input.full { + background-color: #ffffff; +} +.selectize-input.disabled, +.selectize-input.disabled * { + cursor: default !important; +} +.selectize-input.focus { + -webkit-box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.15); + box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.15); +} +.selectize-input.dropdown-active { + -webkit-border-radius: 4px 4px 0 0; + -moz-border-radius: 4px 4px 0 0; + border-radius: 4px 4px 0 0; +} +.selectize-input > * { + vertical-align: baseline; + display: -moz-inline-stack; + display: inline-block; + zoom: 1; + *display: inline; +} +.selectize-control.multi .selectize-input > div { + cursor: pointer; + margin: 0 3px 3px 0; + padding: 1px 3px; + background: #e6e6e6; + color: #333333; + border: 1px solid #cccccc; +} +.selectize-control.multi .selectize-input > div.active { + background: #0088cc; + color: #ffffff; + border: 1px solid #0077b3; +} +.selectize-control.multi .selectize-input.disabled > div, +.selectize-control.multi .selectize-input.disabled > div.active { + color: #474747; + background: #fafafa; + border: 1px solid #e0e0e0; +} +.selectize-input > input { + display: inline-block !important; + padding: 0 !important; + min-height: 0 !important; + max-height: none !important; + max-width: 100% !important; + margin: 0 !important; + text-indent: 0 !important; + border: 0 none !important; + background: none !important; + line-height: inherit !important; + -webkit-user-select: auto !important; + -webkit-box-shadow: none !important; + box-shadow: none !important; +} +.selectize-input > input::-ms-clear { + display: none; +} +.selectize-input > input:focus { + outline: none !important; +} +.selectize-input::after { + content: ' '; + display: block; + clear: left; +} +.selectize-input.dropdown-active::before { + content: ' '; + display: block; + position: absolute; + background: #e5e5e5; + height: 1px; + bottom: 0; + left: 0; + right: 0; +} +.selectize-dropdown { + position: absolute; + z-index: 10; + border: 1px solid #cccccc; + background: #ffffff; + margin: -1px 0 0 0; + border-top: 0 none; + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; + -webkit-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1); + box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1); + -webkit-border-radius: 0 0 4px 4px; + -moz-border-radius: 0 0 4px 4px; + border-radius: 0 0 4px 4px; +} +.selectize-dropdown [data-selectable] { + cursor: pointer; + overflow: hidden; +} +.selectize-dropdown [data-selectable] .highlight { + background: rgba(255, 237, 40, 0.4); + -webkit-border-radius: 1px; + -moz-border-radius: 1px; + border-radius: 1px; +} +.selectize-dropdown [data-selectable], +.selectize-dropdown .optgroup-header { + padding: 3px 10px; +} +.selectize-dropdown .optgroup:first-child .optgroup-header { + border-top: 0 none; +} +.selectize-dropdown .optgroup-header { + color: #999999; + background: #ffffff; + cursor: default; +} +.selectize-dropdown .active { + background-color: #0088cc; + color: #ffffff; +} +.selectize-dropdown .active.create { + color: #ffffff; +} +.selectize-dropdown .create { + color: rgba(51, 51, 51, 0.5); +} +.selectize-dropdown-content { + overflow-y: auto; + overflow-x: hidden; + max-height: 200px; + -webkit-overflow-scrolling: touch; +} +.selectize-control.single .selectize-input, +.selectize-control.single .selectize-input input { + cursor: pointer; +} +.selectize-control.single .selectize-input.input-active, +.selectize-control.single .selectize-input.input-active input { + cursor: text; +} +.selectize-control.single .selectize-input:after { + content: ' '; + display: block; + position: absolute; + top: 50%; + right: 15px; + margin-top: -3px; + width: 0; + height: 0; + border-style: solid; + border-width: 5px 5px 0 5px; + border-color: #000000 transparent transparent transparent; +} +.selectize-control.single .selectize-input.dropdown-active:after { + margin-top: -4px; + border-width: 0 5px 5px 5px; + border-color: transparent transparent #000000 transparent; +} +.selectize-control.rtl.single .selectize-input:after { + left: 15px; + right: auto; +} +.selectize-control.rtl .selectize-input > input { + margin: 0 4px 0 -2px !important; +} +.selectize-control .selectize-input.disabled { + opacity: 0.5; + background-color: #ffffff; +} +.selectize-dropdown { + margin: 2px 0 0 0; + z-index: 1000; + border: 1px solid rgba(0, 0, 0, 0.2); + border-radius: 4px; + -webkit-box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2); + -moz-box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2); + box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2); +} +.selectize-dropdown .optgroup-header { + font-size: 11px; + font-weight: bold; + text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5); + text-transform: uppercase; +} +.selectize-dropdown .optgroup:first-child:before { + display: none; +} +.selectize-dropdown .optgroup:before { + content: ' '; + display: block; + *width: 100%; + height: 1px; + margin: 9px 1px; + *margin: -5px 0 5px; + overflow: hidden; + background-color: #e5e5e5; + border-bottom: 1px solid #ffffff; + margin-left: -10px; + margin-right: -10px; +} +.selectize-dropdown [data-selectable].active { + background-color: #0081c2; + background-image: -moz-linear-gradient(top, #0088cc, #0077b3); + background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#0088cc), to(#0077b3)); + background-image: -webkit-linear-gradient(top, #0088cc, #0077b3); + background-image: -o-linear-gradient(top, #0088cc, #0077b3); + background-image: linear-gradient(to bottom, #0088cc, #0077b3); + background-repeat: repeat-x; + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff0088cc', endColorstr='#ff0077b3', GradientType=0); +} +.selectize-dropdown-content { + padding: 5px 0; +} +.selectize-dropdown-header { + padding: 6px 10px; +} +.selectize-input { + -webkit-transition: border linear .2s, box-shadow linear .2s; + -moz-transition: border linear .2s, box-shadow linear .2s; + -o-transition: border linear .2s, box-shadow linear .2s; + transition: border linear .2s, box-shadow linear .2s; +} +.selectize-input.dropdown-active { + -webkit-border-radius: 4px; + -moz-border-radius: 4px; + border-radius: 4px; +} +.selectize-input.dropdown-active::before { + display: none; +} +.selectize-input.input-active, +.selectize-input.input-active:hover, +.selectize-control.multi .selectize-input.focus { + background: #ffffff !important; + border-color: rgba(82, 168, 236, 0.8) !important; + outline: 0 !important; + outline: thin dotted \9 !important; + -webkit-box-shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(82,168,236,.6) !important; + -moz-box-shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(82,168,236,.6) !important; + box-shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(82,168,236,.6) !important; +} +.selectize-control.single .selectize-input { + color: #333333; + text-shadow: 0 1px 1px rgba(255, 255, 255, 0.75); + background-color: #f5f5f5; + background-image: -moz-linear-gradient(top, #ffffff, #e6e6e6); + background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#ffffff), to(#e6e6e6)); + background-image: -webkit-linear-gradient(top, #ffffff, #e6e6e6); + background-image: -o-linear-gradient(top, #ffffff, #e6e6e6); + background-image: linear-gradient(to bottom, #ffffff, #e6e6e6); + background-repeat: repeat-x; + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff', endColorstr='#ffe6e6e6', GradientType=0); + border-color: #e6e6e6 #e6e6e6 #bfbfbf; + border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25); + *background-color: #e6e6e6; + /* Darken IE7 buttons by default so they stand out more given they won't have borders */ + filter: progid:DXImageTransform.Microsoft.gradient(enabled = false); + -webkit-box-shadow: inset 0 1px 0 rgba(255,255,255,.2), 0 1px 2px rgba(0,0,0,.05); + -moz-box-shadow: inset 0 1px 0 rgba(255,255,255,.2), 0 1px 2px rgba(0,0,0,.05); + box-shadow: inset 0 1px 0 rgba(255,255,255,.2), 0 1px 2px rgba(0,0,0,.05); +} +.selectize-control.single .selectize-input:hover, +.selectize-control.single .selectize-input:focus, +.selectize-control.single .selectize-input:active, +.selectize-control.single .selectize-input.active, +.selectize-control.single .selectize-input.disabled, +.selectize-control.single .selectize-input[disabled] { + color: #333333; + background-color: #e6e6e6; + *background-color: #d9d9d9; +} +.selectize-control.single .selectize-input:active, +.selectize-control.single .selectize-input.active { + background-color: #cccccc \9; +} +.selectize-control.single .selectize-input:hover { + color: #333333; + text-decoration: none; + background-position: 0 -15px; + -webkit-transition: background-position 0.1s linear; + -moz-transition: background-position 0.1s linear; + -o-transition: background-position 0.1s linear; + transition: background-position 0.1s linear; +} +.selectize-control.single .selectize-input.disabled { + background: #e6e6e6 !important; + -webkit-box-shadow: none; + -moz-box-shadow: none; + box-shadow: none; +} +.selectize-control.multi .selectize-input { + -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); + -moz-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); + box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); +} +.selectize-control.multi .selectize-input.has-items { + padding-left: 7px; + padding-right: 7px; +} +.selectize-control.multi .selectize-input > div { + color: #333333; + text-shadow: none; + background-color: #f5f5f5; + background-image: -moz-linear-gradient(top, #ffffff, #e6e6e6); + background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#ffffff), to(#e6e6e6)); + background-image: -webkit-linear-gradient(top, #ffffff, #e6e6e6); + background-image: -o-linear-gradient(top, #ffffff, #e6e6e6); + background-image: linear-gradient(to bottom, #ffffff, #e6e6e6); + background-repeat: repeat-x; + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff', endColorstr='#ffe6e6e6', GradientType=0); + border-color: #e6e6e6 #e6e6e6 #bfbfbf; + border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25); + *background-color: #e6e6e6; + border: 1px solid #cccccc; + -webkit-border-radius: 4px; + -moz-border-radius: 4px; + border-radius: 4px; + -webkit-box-shadow: inset 0 1px 0 rgba(255,255,255,.2), 0 1px 2px rgba(0,0,0,.05); + -moz-box-shadow: inset 0 1px 0 rgba(255,255,255,.2), 0 1px 2px rgba(0,0,0,.05); + box-shadow: inset 0 1px 0 rgba(255,255,255,.2), 0 1px 2px rgba(0,0,0,.05); +} +.selectize-control.multi .selectize-input > div.active { + -webkit-box-shadow: 0 1px 2px rgba(0,0,0,.05); + -moz-box-shadow: 0 1px 2px rgba(0,0,0,.05); + box-shadow: 0 1px 2px rgba(0,0,0,.05); + color: #ffffff; + text-shadow: none; + background-color: #0081c2; + background-image: -moz-linear-gradient(top, #0088cc, #0077b3); + background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#0088cc), to(#0077b3)); + background-image: -webkit-linear-gradient(top, #0088cc, #0077b3); + background-image: -o-linear-gradient(top, #0088cc, #0077b3); + background-image: linear-gradient(to bottom, #0088cc, #0077b3); + background-repeat: repeat-x; + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff0088cc', endColorstr='#ff0077b3', GradientType=0); + border-color: #0077b3 #0077b3 #004466; + border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25); + *background-color: #0088cc; + border: 1px solid #0088cc; +} diff --git a/wire/modules/Jquery/JqueryUI/selectize/css/selectize.bootstrap3.css b/wire/modules/Jquery/JqueryUI/selectize/css/selectize.bootstrap3.css new file mode 100755 index 00000000..799a4114 --- /dev/null +++ b/wire/modules/Jquery/JqueryUI/selectize/css/selectize.bootstrap3.css @@ -0,0 +1,408 @@ +/** + * selectize.bootstrap3.css (v0.12.4) - Bootstrap 3 Theme + * Copyright (c) 2013–2015 Brian Reavis & contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this + * file except in compliance with the License. You may obtain a copy of the License at: + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under + * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF + * ANY KIND, either express or implied. See the License for the specific language + * governing permissions and limitations under the License. + * + * @author Brian Reavis + */ +.selectize-control.plugin-drag_drop.multi > .selectize-input > div.ui-sortable-placeholder { + visibility: visible !important; + background: #f2f2f2 !important; + background: rgba(0, 0, 0, 0.06) !important; + border: 0 none !important; + -webkit-box-shadow: inset 0 0 12px 4px #ffffff; + box-shadow: inset 0 0 12px 4px #ffffff; +} +.selectize-control.plugin-drag_drop .ui-sortable-placeholder::after { + content: '!'; + visibility: hidden; +} +.selectize-control.plugin-drag_drop .ui-sortable-helper { + -webkit-box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2); + box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2); +} +.selectize-dropdown-header { + position: relative; + padding: 3px 12px; + border-bottom: 1px solid #d0d0d0; + background: #f8f8f8; + -webkit-border-radius: 4px 4px 0 0; + -moz-border-radius: 4px 4px 0 0; + border-radius: 4px 4px 0 0; +} +.selectize-dropdown-header-close { + position: absolute; + right: 12px; + top: 50%; + color: #333333; + opacity: 0.4; + margin-top: -12px; + line-height: 20px; + font-size: 20px !important; +} +.selectize-dropdown-header-close:hover { + color: #000000; +} +.selectize-dropdown.plugin-optgroup_columns .optgroup { + border-right: 1px solid #f2f2f2; + border-top: 0 none; + float: left; + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; +} +.selectize-dropdown.plugin-optgroup_columns .optgroup:last-child { + border-right: 0 none; +} +.selectize-dropdown.plugin-optgroup_columns .optgroup:before { + display: none; +} +.selectize-dropdown.plugin-optgroup_columns .optgroup-header { + border-top: 0 none; +} +.selectize-control.plugin-remove_button [data-value] { + position: relative; + padding-right: 24px !important; +} +.selectize-control.plugin-remove_button [data-value] .remove { + z-index: 1; + /* fixes ie bug (see #392) */ + position: absolute; + top: 0; + right: 0; + bottom: 0; + width: 17px; + text-align: center; + font-weight: bold; + font-size: 12px; + color: inherit; + text-decoration: none; + vertical-align: middle; + display: inline-block; + padding: 1px 0 0 0; + border-left: 1px solid rgba(0, 0, 0, 0); + -webkit-border-radius: 0 2px 2px 0; + -moz-border-radius: 0 2px 2px 0; + border-radius: 0 2px 2px 0; + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; +} +.selectize-control.plugin-remove_button [data-value] .remove:hover { + background: rgba(0, 0, 0, 0.05); +} +.selectize-control.plugin-remove_button [data-value].active .remove { + border-left-color: rgba(0, 0, 0, 0); +} +.selectize-control.plugin-remove_button .disabled [data-value] .remove:hover { + background: none; +} +.selectize-control.plugin-remove_button .disabled [data-value] .remove { + border-left-color: rgba(77, 77, 77, 0); +} +.selectize-control.plugin-remove_button .remove-single { + position: absolute; + right: 28px; + top: 6px; + font-size: 23px; +} +.selectize-control { + position: relative; +} +.selectize-dropdown, +.selectize-input, +.selectize-input input { + color: #333333; + font-family: inherit; + font-size: inherit; + line-height: 20px; + -webkit-font-smoothing: inherit; +} +.selectize-input, +.selectize-control.single .selectize-input.input-active { + background: #ffffff; + cursor: text; + display: inline-block; +} +.selectize-input { + border: 1px solid #cccccc; + padding: 6px 12px; + display: inline-block; + width: 100%; + overflow: hidden; + position: relative; + z-index: 1; + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; + -webkit-box-shadow: none; + box-shadow: none; + -webkit-border-radius: 4px; + -moz-border-radius: 4px; + border-radius: 4px; +} +.selectize-control.multi .selectize-input.has-items { + padding: 5px 12px 2px; +} +.selectize-input.full { + background-color: #ffffff; +} +.selectize-input.disabled, +.selectize-input.disabled * { + cursor: default !important; +} +.selectize-input.focus { + -webkit-box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.15); + box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.15); +} +.selectize-input.dropdown-active { + -webkit-border-radius: 4px 4px 0 0; + -moz-border-radius: 4px 4px 0 0; + border-radius: 4px 4px 0 0; +} +.selectize-input > * { + vertical-align: baseline; + display: -moz-inline-stack; + display: inline-block; + zoom: 1; + *display: inline; +} +.selectize-control.multi .selectize-input > div { + cursor: pointer; + margin: 0 3px 3px 0; + padding: 1px 3px; + background: #efefef; + color: #333333; + border: 0 solid rgba(0, 0, 0, 0); +} +.selectize-control.multi .selectize-input > div.active { + background: #428bca; + color: #ffffff; + border: 0 solid rgba(0, 0, 0, 0); +} +.selectize-control.multi .selectize-input.disabled > div, +.selectize-control.multi .selectize-input.disabled > div.active { + color: #808080; + background: #ffffff; + border: 0 solid rgba(77, 77, 77, 0); +} +.selectize-input > input { + display: inline-block !important; + padding: 0 !important; + min-height: 0 !important; + max-height: none !important; + max-width: 100% !important; + margin: 0 !important; + text-indent: 0 !important; + border: 0 none !important; + background: none !important; + line-height: inherit !important; + -webkit-user-select: auto !important; + -webkit-box-shadow: none !important; + box-shadow: none !important; +} +.selectize-input > input::-ms-clear { + display: none; +} +.selectize-input > input:focus { + outline: none !important; +} +.selectize-input::after { + content: ' '; + display: block; + clear: left; +} +.selectize-input.dropdown-active::before { + content: ' '; + display: block; + position: absolute; + background: #ffffff; + height: 1px; + bottom: 0; + left: 0; + right: 0; +} +.selectize-dropdown { + position: absolute; + z-index: 10; + border: 1px solid #d0d0d0; + background: #ffffff; + margin: -1px 0 0 0; + border-top: 0 none; + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; + -webkit-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1); + box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1); + -webkit-border-radius: 0 0 4px 4px; + -moz-border-radius: 0 0 4px 4px; + border-radius: 0 0 4px 4px; +} +.selectize-dropdown [data-selectable] { + cursor: pointer; + overflow: hidden; +} +.selectize-dropdown [data-selectable] .highlight { + background: rgba(255, 237, 40, 0.4); + -webkit-border-radius: 1px; + -moz-border-radius: 1px; + border-radius: 1px; +} +.selectize-dropdown [data-selectable], +.selectize-dropdown .optgroup-header { + padding: 3px 12px; +} +.selectize-dropdown .optgroup:first-child .optgroup-header { + border-top: 0 none; +} +.selectize-dropdown .optgroup-header { + color: #777777; + background: #ffffff; + cursor: default; +} +.selectize-dropdown .active { + background-color: #f5f5f5; + color: #262626; +} +.selectize-dropdown .active.create { + color: #262626; +} +.selectize-dropdown .create { + color: rgba(51, 51, 51, 0.5); +} +.selectize-dropdown-content { + overflow-y: auto; + overflow-x: hidden; + max-height: 200px; + -webkit-overflow-scrolling: touch; +} +.selectize-control.single .selectize-input, +.selectize-control.single .selectize-input input { + cursor: pointer; +} +.selectize-control.single .selectize-input.input-active, +.selectize-control.single .selectize-input.input-active input { + cursor: text; +} +.selectize-control.single .selectize-input:after { + content: ' '; + display: block; + position: absolute; + top: 50%; + right: 17px; + margin-top: -3px; + width: 0; + height: 0; + border-style: solid; + border-width: 5px 5px 0 5px; + border-color: #333333 transparent transparent transparent; +} +.selectize-control.single .selectize-input.dropdown-active:after { + margin-top: -4px; + border-width: 0 5px 5px 5px; + border-color: transparent transparent #333333 transparent; +} +.selectize-control.rtl.single .selectize-input:after { + left: 17px; + right: auto; +} +.selectize-control.rtl .selectize-input > input { + margin: 0 4px 0 -2px !important; +} +.selectize-control .selectize-input.disabled { + opacity: 0.5; + background-color: #ffffff; +} +.selectize-dropdown, +.selectize-dropdown.form-control { + height: auto; + padding: 0; + margin: 2px 0 0 0; + z-index: 1000; + background: #ffffff; + border: 1px solid #cccccc; + border: 1px solid rgba(0, 0, 0, 0.15); + -webkit-border-radius: 4px; + -moz-border-radius: 4px; + border-radius: 4px; + -webkit-box-shadow: 0 6px 12px rgba(0, 0, 0, 0.175); + box-shadow: 0 6px 12px rgba(0, 0, 0, 0.175); +} +.selectize-dropdown .optgroup-header { + font-size: 12px; + line-height: 1.42857143; +} +.selectize-dropdown .optgroup:first-child:before { + display: none; +} +.selectize-dropdown .optgroup:before { + content: ' '; + display: block; + height: 1px; + margin: 9px 0; + overflow: hidden; + background-color: #e5e5e5; + margin-left: -12px; + margin-right: -12px; +} +.selectize-dropdown-content { + padding: 5px 0; +} +.selectize-dropdown-header { + padding: 6px 12px; +} +.selectize-input { + min-height: 34px; +} +.selectize-input.dropdown-active { + -webkit-border-radius: 4px; + -moz-border-radius: 4px; + border-radius: 4px; +} +.selectize-input.dropdown-active::before { + display: none; +} +.selectize-input.focus { + border-color: #66afe9; + outline: 0; + -webkit-box-shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(102, 175, 233, 0.6); + box-shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(102, 175, 233, 0.6); +} +.has-error .selectize-input { + border-color: #a94442; + -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); + box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); +} +.has-error .selectize-input:focus { + border-color: #843534; + -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #ce8483; + box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #ce8483; +} +.selectize-control.multi .selectize-input.has-items { + padding-left: 9px; + padding-right: 9px; +} +.selectize-control.multi .selectize-input > div { + -webkit-border-radius: 3px; + -moz-border-radius: 3px; + border-radius: 3px; +} +.form-control.selectize-control { + padding: 0; + height: auto; + border: none; + background: none; + -webkit-box-shadow: none; + box-shadow: none; + -webkit-border-radius: 0; + -moz-border-radius: 0; + border-radius: 0; +} diff --git a/wire/modules/Jquery/JqueryUI/selectize/css/selectize.css b/wire/modules/Jquery/JqueryUI/selectize/css/selectize.css new file mode 100755 index 00000000..6f795eb1 --- /dev/null +++ b/wire/modules/Jquery/JqueryUI/selectize/css/selectize.css @@ -0,0 +1,326 @@ +/** + * selectize.css (v0.12.4) + * Copyright (c) 2013–2015 Brian Reavis & contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this + * file except in compliance with the License. You may obtain a copy of the License at: + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under + * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF + * ANY KIND, either express or implied. See the License for the specific language + * governing permissions and limitations under the License. + * + * @author Brian Reavis + */ + +.selectize-control.plugin-drag_drop.multi > .selectize-input > div.ui-sortable-placeholder { + visibility: visible !important; + background: #f2f2f2 !important; + background: rgba(0, 0, 0, 0.06) !important; + border: 0 none !important; + -webkit-box-shadow: inset 0 0 12px 4px #ffffff; + box-shadow: inset 0 0 12px 4px #ffffff; +} +.selectize-control.plugin-drag_drop .ui-sortable-placeholder::after { + content: '!'; + visibility: hidden; +} +.selectize-control.plugin-drag_drop .ui-sortable-helper { + -webkit-box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2); + box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2); +} +.selectize-dropdown-header { + position: relative; + padding: 5px 8px; + border-bottom: 1px solid #d0d0d0; + background: #f8f8f8; + -webkit-border-radius: 3px 3px 0 0; + -moz-border-radius: 3px 3px 0 0; + border-radius: 3px 3px 0 0; +} +.selectize-dropdown-header-close { + position: absolute; + right: 8px; + top: 50%; + color: #303030; + opacity: 0.4; + margin-top: -12px; + line-height: 20px; + font-size: 20px !important; +} +.selectize-dropdown-header-close:hover { + color: #000000; +} +.selectize-dropdown.plugin-optgroup_columns .optgroup { + border-right: 1px solid #f2f2f2; + border-top: 0 none; + float: left; + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; +} +.selectize-dropdown.plugin-optgroup_columns .optgroup:last-child { + border-right: 0 none; +} +.selectize-dropdown.plugin-optgroup_columns .optgroup:before { + display: none; +} +.selectize-dropdown.plugin-optgroup_columns .optgroup-header { + border-top: 0 none; +} +.selectize-control.plugin-remove_button [data-value] { + position: relative; + padding-right: 24px !important; +} +.selectize-control.plugin-remove_button [data-value] .remove { + z-index: 10; + /* fixes ie bug (see #392) */ + position: absolute; + top: 0; + right: 0; + bottom: 0; + width: 17px; + text-align: center; + font-weight: bold; + font-size: 12px; + color: inherit; + text-decoration: none; + vertical-align: middle; + display: inline-block; + padding: 2px 0 0 0; + border-left: 1px solid #d0d0d0; + -webkit-border-radius: 0 2px 2px 0; + -moz-border-radius: 0 2px 2px 0; + border-radius: 0 2px 2px 0; + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; +} +.selectize-control.plugin-remove_button [data-value] .remove:hover { + background: rgba(0, 0, 0, 0.05); +} +.selectize-control.plugin-remove_button [data-value].active .remove { + border-left-color: #cacaca; +} +.selectize-control.plugin-remove_button .disabled [data-value] .remove:hover { + background: none; +} +.selectize-control.plugin-remove_button .disabled [data-value] .remove { + border-left-color: #ffffff; +} +.selectize-control.plugin-remove_button .remove-single { + position: absolute; + right: 28px; + top: 6px; + font-size: 23px; +} +.selectize-control { + position: relative; +} +.selectize-dropdown, +.selectize-input, +.selectize-input input { + color: #303030; + font-family: inherit; + font-size: 13px; + line-height: 18px; + -webkit-font-smoothing: inherit; +} +.selectize-input, +.selectize-control.single .selectize-input.input-active { + background: #ffffff; + cursor: text; + display: inline-block; +} +.selectize-input { + border: 1px solid #d0d0d0; + padding: 8px 8px; + display: inline-block; + width: 100%; + overflow: hidden; + position: relative; + z-index: 10; + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; + -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.1); + box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.1); + /* + -webkit-border-radius: 3px; + -moz-border-radius: 3px; + border-radius: 3px; + */ +} +.selectize-control.multi .selectize-input.has-items { + padding: 6px 8px 3px; +} +.selectize-input.full { + background-color: #ffffff; +} +.selectize-input.disabled, +.selectize-input.disabled * { + cursor: default !important; +} +.selectize-input.focus { + -webkit-box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.15); + box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.15); +} +.selectize-input.dropdown-active { + -webkit-border-radius: 3px 3px 0 0; + -moz-border-radius: 3px 3px 0 0; + border-radius: 3px 3px 0 0; +} +.selectize-input > * { + vertical-align: baseline; + display: -moz-inline-stack; + display: inline-block; + zoom: 1; + *display: inline; +} +.selectize-control.multi .selectize-input > div { + cursor: pointer; + margin: 0 3px 3px 0; + padding: 2px 6px; + background: #f2f2f2; + color: #303030; + border: 0 solid #d0d0d0; +} +.selectize-control.multi .selectize-input > div.active { + background: #e8e8e8; + color: #303030; + border: 0 solid #cacaca; +} +.selectize-control.multi .selectize-input.disabled > div, +.selectize-control.multi .selectize-input.disabled > div.active { + color: #7d7d7d; + background: #ffffff; + border: 0 solid #ffffff; +} +.selectize-input > input { + display: inline-block !important; + padding: 0 !important; + min-height: 0 !important; + max-height: none !important; + max-width: 100% !important; + margin: 0 2px 0 0 !important; + text-indent: 0 !important; + border: 0 none !important; + background: none !important; + line-height: inherit !important; + -webkit-user-select: auto !important; + -webkit-box-shadow: none !important; + box-shadow: none !important; +} +.selectize-input > input::-ms-clear { + display: none; +} +.selectize-input > input:focus { + outline: none !important; +} +.selectize-input::after { + content: ' '; + display: block; + clear: left; +} +.selectize-input.dropdown-active::before { + content: ' '; + display: block; + position: absolute; + background: #f0f0f0; + height: 1px; + bottom: 0; + left: 0; + right: 0; +} +.selectize-dropdown { + position: absolute; + z-index: 100; + border: 1px solid #d0d0d0; + background: #ffffff; + margin: -1px 0 0 0; + border-top: 0 none; + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; + -webkit-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1); + box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1); + -webkit-border-radius: 0 0 3px 3px; + -moz-border-radius: 0 0 3px 3px; + border-radius: 0 0 3px 3px; +} +.selectize-dropdown [data-selectable] { + cursor: pointer; + overflow: hidden; +} +.selectize-dropdown [data-selectable] .highlight { + background: rgba(125, 168, 208, 0.2); + -webkit-border-radius: 1px; + -moz-border-radius: 1px; + border-radius: 1px; +} +.selectize-dropdown [data-selectable], +.selectize-dropdown .optgroup-header { + padding: 5px 8px; +} +.selectize-dropdown .optgroup:first-child .optgroup-header { + border-top: 0 none; +} +.selectize-dropdown .optgroup-header { + color: #303030; + background: #ffffff; + cursor: default; +} +.selectize-dropdown .active { + background-color: #f5fafd; + color: #495c68; +} +.selectize-dropdown .active.create { + color: #495c68; +} +.selectize-dropdown .create { + color: rgba(48, 48, 48, 0.5); +} +.selectize-dropdown-content { + overflow-y: auto; + overflow-x: hidden; + max-height: 200px; + -webkit-overflow-scrolling: touch; +} +.selectize-control.single .selectize-input, +.selectize-control.single .selectize-input input { + cursor: pointer; +} +.selectize-control.single .selectize-input.input-active, +.selectize-control.single .selectize-input.input-active input { + cursor: text; +} +.selectize-control.single .selectize-input:after { + content: ' '; + display: block; + position: absolute; + top: 50%; + right: 15px; + margin-top: -3px; + width: 0; + height: 0; + border-style: solid; + border-width: 5px 5px 0 5px; + border-color: #808080 transparent transparent transparent; +} +.selectize-control.single .selectize-input.dropdown-active:after { + margin-top: -4px; + border-width: 0 5px 5px 5px; + border-color: transparent transparent #808080 transparent; +} +.selectize-control.rtl.single .selectize-input:after { + left: 15px; + right: auto; +} +.selectize-control.rtl .selectize-input > input { + margin: 0 4px 0 -2px !important; +} +.selectize-control .selectize-input.disabled { + opacity: 0.5; + background-color: #fafafa; +} diff --git a/wire/modules/Jquery/JqueryUI/selectize/css/selectize.default.css b/wire/modules/Jquery/JqueryUI/selectize/css/selectize.default.css new file mode 100755 index 00000000..ab530950 --- /dev/null +++ b/wire/modules/Jquery/JqueryUI/selectize/css/selectize.default.css @@ -0,0 +1,394 @@ +/** + * selectize.default.css (v0.12.4) - Default Theme + * Copyright (c) 2013–2015 Brian Reavis & contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this + * file except in compliance with the License. You may obtain a copy of the License at: + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under + * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF + * ANY KIND, either express or implied. See the License for the specific language + * governing permissions and limitations under the License. + * + * @author Brian Reavis + */ +.selectize-control.plugin-drag_drop.multi > .selectize-input > div.ui-sortable-placeholder { + visibility: visible !important; + background: #f2f2f2 !important; + background: rgba(0, 0, 0, 0.06) !important; + border: 0 none !important; + -webkit-box-shadow: inset 0 0 12px 4px #ffffff; + box-shadow: inset 0 0 12px 4px #ffffff; +} +.selectize-control.plugin-drag_drop .ui-sortable-placeholder::after { + content: '!'; + visibility: hidden; +} +.selectize-control.plugin-drag_drop .ui-sortable-helper { + -webkit-box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2); + box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2); +} +.selectize-dropdown-header { + position: relative; + padding: 5px 8px; + border-bottom: 1px solid #d0d0d0; + background: #f8f8f8; + -webkit-border-radius: 3px 3px 0 0; + -moz-border-radius: 3px 3px 0 0; + border-radius: 3px 3px 0 0; +} +.selectize-dropdown-header-close { + position: absolute; + right: 8px; + top: 50%; + color: #303030; + opacity: 0.4; + margin-top: -12px; + line-height: 20px; + font-size: 20px !important; +} +.selectize-dropdown-header-close:hover { + color: #000000; +} +.selectize-dropdown.plugin-optgroup_columns .optgroup { + border-right: 1px solid #f2f2f2; + border-top: 0 none; + float: left; + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; +} +.selectize-dropdown.plugin-optgroup_columns .optgroup:last-child { + border-right: 0 none; +} +.selectize-dropdown.plugin-optgroup_columns .optgroup:before { + display: none; +} +.selectize-dropdown.plugin-optgroup_columns .optgroup-header { + border-top: 0 none; +} +.selectize-control.plugin-remove_button [data-value] { + position: relative; + padding-right: 24px !important; +} +.selectize-control.plugin-remove_button [data-value] .remove { + z-index: 1; + /* fixes ie bug (see #392) */ + position: absolute; + top: 0; + right: 0; + bottom: 0; + width: 17px; + text-align: center; + font-weight: bold; + font-size: 12px; + color: inherit; + text-decoration: none; + vertical-align: middle; + display: inline-block; + padding: 2px 0 0 0; + border-left: 1px solid #0073bb; + -webkit-border-radius: 0 2px 2px 0; + -moz-border-radius: 0 2px 2px 0; + border-radius: 0 2px 2px 0; + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; +} +.selectize-control.plugin-remove_button [data-value] .remove:hover { + background: rgba(0, 0, 0, 0.05); +} +.selectize-control.plugin-remove_button [data-value].active .remove { + border-left-color: #00578d; +} +.selectize-control.plugin-remove_button .disabled [data-value] .remove:hover { + background: none; +} +.selectize-control.plugin-remove_button .disabled [data-value] .remove { + border-left-color: #aaaaaa; +} +.selectize-control.plugin-remove_button .remove-single { + position: absolute; + right: 28px; + top: 6px; + font-size: 23px; +} +.selectize-control { + position: relative; +} +.selectize-dropdown, +.selectize-input, +.selectize-input input { + color: #303030; + font-family: inherit; + font-size: 13px; + line-height: 18px; + -webkit-font-smoothing: inherit; +} +.selectize-input, +.selectize-control.single .selectize-input.input-active { + background: #ffffff; + cursor: text; + display: inline-block; +} +.selectize-input { + border: 1px solid #d0d0d0; + padding: 8px 8px; + display: inline-block; + width: 100%; + overflow: hidden; + position: relative; + z-index: 1; + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; + -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.1); + box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.1); + -webkit-border-radius: 3px; + -moz-border-radius: 3px; + border-radius: 3px; +} +.selectize-control.multi .selectize-input.has-items { + padding: 5px 8px 2px; +} +.selectize-input.full { + background-color: #ffffff; +} +.selectize-input.disabled, +.selectize-input.disabled * { + cursor: default !important; +} +.selectize-input.focus { + -webkit-box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.15); + box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.15); +} +.selectize-input.dropdown-active { + -webkit-border-radius: 3px 3px 0 0; + -moz-border-radius: 3px 3px 0 0; + border-radius: 3px 3px 0 0; +} +.selectize-input > * { + vertical-align: baseline; + display: -moz-inline-stack; + display: inline-block; + zoom: 1; + *display: inline; +} +.selectize-control.multi .selectize-input > div { + cursor: pointer; + margin: 0 3px 3px 0; + padding: 2px 6px; + background: #1da7ee; + color: #ffffff; + border: 1px solid #0073bb; +} +.selectize-control.multi .selectize-input > div.active { + background: #92c836; + color: #ffffff; + border: 1px solid #00578d; +} +.selectize-control.multi .selectize-input.disabled > div, +.selectize-control.multi .selectize-input.disabled > div.active { + color: #ffffff; + background: #d2d2d2; + border: 1px solid #aaaaaa; +} +.selectize-input > input { + display: inline-block !important; + padding: 0 !important; + min-height: 0 !important; + max-height: none !important; + max-width: 100% !important; + margin: 0 1px !important; + text-indent: 0 !important; + border: 0 none !important; + background: none !important; + line-height: inherit !important; + -webkit-user-select: auto !important; + -webkit-box-shadow: none !important; + box-shadow: none !important; +} +.selectize-input > input::-ms-clear { + display: none; +} +.selectize-input > input:focus { + outline: none !important; +} +.selectize-input::after { + content: ' '; + display: block; + clear: left; +} +.selectize-input.dropdown-active::before { + content: ' '; + display: block; + position: absolute; + background: #f0f0f0; + height: 1px; + bottom: 0; + left: 0; + right: 0; +} +.selectize-dropdown { + position: absolute; + z-index: 10; + border: 1px solid #d0d0d0; + background: #ffffff; + margin: -1px 0 0 0; + border-top: 0 none; + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; + -webkit-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1); + box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1); + -webkit-border-radius: 0 0 3px 3px; + -moz-border-radius: 0 0 3px 3px; + border-radius: 0 0 3px 3px; +} +.selectize-dropdown [data-selectable] { + cursor: pointer; + overflow: hidden; +} +.selectize-dropdown [data-selectable] .highlight { + background: rgba(125, 168, 208, 0.2); + -webkit-border-radius: 1px; + -moz-border-radius: 1px; + border-radius: 1px; +} +.selectize-dropdown [data-selectable], +.selectize-dropdown .optgroup-header { + padding: 5px 8px; +} +.selectize-dropdown .optgroup:first-child .optgroup-header { + border-top: 0 none; +} +.selectize-dropdown .optgroup-header { + color: #303030; + background: #ffffff; + cursor: default; +} +.selectize-dropdown .active { + background-color: #f5fafd; + color: #495c68; +} +.selectize-dropdown .active.create { + color: #495c68; +} +.selectize-dropdown .create { + color: rgba(48, 48, 48, 0.5); +} +.selectize-dropdown-content { + overflow-y: auto; + overflow-x: hidden; + max-height: 200px; + -webkit-overflow-scrolling: touch; +} +.selectize-control.single .selectize-input, +.selectize-control.single .selectize-input input { + cursor: pointer; +} +.selectize-control.single .selectize-input.input-active, +.selectize-control.single .selectize-input.input-active input { + cursor: text; +} +.selectize-control.single .selectize-input:after { + content: ' '; + display: block; + position: absolute; + top: 50%; + right: 15px; + margin-top: -3px; + width: 0; + height: 0; + border-style: solid; + border-width: 5px 5px 0 5px; + border-color: #808080 transparent transparent transparent; +} +.selectize-control.single .selectize-input.dropdown-active:after { + margin-top: -4px; + border-width: 0 5px 5px 5px; + border-color: transparent transparent #808080 transparent; +} +.selectize-control.rtl.single .selectize-input:after { + left: 15px; + right: auto; +} +.selectize-control.rtl .selectize-input > input { + margin: 0 4px 0 -2px !important; +} +.selectize-control .selectize-input.disabled { + opacity: 0.5; + background-color: #fafafa; +} +.selectize-control.multi .selectize-input.has-items { + padding-left: 5px; + padding-right: 5px; +} +.selectize-control.multi .selectize-input.disabled [data-value] { + color: #999; + text-shadow: none; + background: none; + -webkit-box-shadow: none; + box-shadow: none; +} +.selectize-control.multi .selectize-input.disabled [data-value], +.selectize-control.multi .selectize-input.disabled [data-value] .remove { + border-color: #e6e6e6; +} +.selectize-control.multi .selectize-input.disabled [data-value] .remove { + background: none; +} +.selectize-control.multi .selectize-input [data-value] { + text-shadow: 0 1px 0 rgba(0, 51, 83, 0.3); + -webkit-border-radius: 3px; + -moz-border-radius: 3px; + border-radius: 3px; + background-color: #1b9dec; + background-image: -moz-linear-gradient(top, #1da7ee, #178ee9); + background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#1da7ee), to(#178ee9)); + background-image: -webkit-linear-gradient(top, #1da7ee, #178ee9); + background-image: -o-linear-gradient(top, #1da7ee, #178ee9); + background-image: linear-gradient(to bottom, #1da7ee, #178ee9); + background-repeat: repeat-x; + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff1da7ee', endColorstr='#ff178ee9', GradientType=0); + -webkit-box-shadow: 0 1px 0 rgba(0,0,0,0.2),inset 0 1px rgba(255,255,255,0.03); + box-shadow: 0 1px 0 rgba(0,0,0,0.2),inset 0 1px rgba(255,255,255,0.03); +} +.selectize-control.multi .selectize-input [data-value].active { + background-color: #0085d4; + background-image: -moz-linear-gradient(top, #008fd8, #0075cf); + background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#008fd8), to(#0075cf)); + background-image: -webkit-linear-gradient(top, #008fd8, #0075cf); + background-image: -o-linear-gradient(top, #008fd8, #0075cf); + background-image: linear-gradient(to bottom, #008fd8, #0075cf); + background-repeat: repeat-x; + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff008fd8', endColorstr='#ff0075cf', GradientType=0); +} +.selectize-control.single .selectize-input { + -webkit-box-shadow: 0 1px 0 rgba(0,0,0,0.05), inset 0 1px 0 rgba(255,255,255,0.8); + box-shadow: 0 1px 0 rgba(0,0,0,0.05), inset 0 1px 0 rgba(255,255,255,0.8); + background-color: #f9f9f9; + background-image: -moz-linear-gradient(top, #fefefe, #f2f2f2); + background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#fefefe), to(#f2f2f2)); + background-image: -webkit-linear-gradient(top, #fefefe, #f2f2f2); + background-image: -o-linear-gradient(top, #fefefe, #f2f2f2); + background-image: linear-gradient(to bottom, #fefefe, #f2f2f2); + background-repeat: repeat-x; + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fffefefe', endColorstr='#fff2f2f2', GradientType=0); +} +.selectize-control.single .selectize-input, +.selectize-dropdown.single { + border-color: #b8b8b8; +} +.selectize-dropdown .optgroup-header { + padding-top: 7px; + font-weight: bold; + font-size: 0.85em; +} +.selectize-dropdown .optgroup { + border-top: 1px solid #f0f0f0; +} +.selectize-dropdown .optgroup:first-child { + border-top: 0 none; +} diff --git a/wire/modules/Jquery/JqueryUI/selectize/css/selectize.legacy.css b/wire/modules/Jquery/JqueryUI/selectize/css/selectize.legacy.css new file mode 100755 index 00000000..9a191e1f --- /dev/null +++ b/wire/modules/Jquery/JqueryUI/selectize/css/selectize.legacy.css @@ -0,0 +1,371 @@ +/** + * selectize.legacy.css (v0.12.4) - Default Theme + * Copyright (c) 2013–2015 Brian Reavis & contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this + * file except in compliance with the License. You may obtain a copy of the License at: + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under + * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF + * ANY KIND, either express or implied. See the License for the specific language + * governing permissions and limitations under the License. + * + * @author Brian Reavis + */ +.selectize-control.plugin-drag_drop.multi > .selectize-input > div.ui-sortable-placeholder { + visibility: visible !important; + background: #f2f2f2 !important; + background: rgba(0, 0, 0, 0.06) !important; + border: 0 none !important; + -webkit-box-shadow: inset 0 0 12px 4px #ffffff; + box-shadow: inset 0 0 12px 4px #ffffff; +} +.selectize-control.plugin-drag_drop .ui-sortable-placeholder::after { + content: '!'; + visibility: hidden; +} +.selectize-control.plugin-drag_drop .ui-sortable-helper { + -webkit-box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2); + box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2); +} +.selectize-dropdown-header { + position: relative; + padding: 7px 10px; + border-bottom: 1px solid #d0d0d0; + background: #f8f8f8; + -webkit-border-radius: 3px 3px 0 0; + -moz-border-radius: 3px 3px 0 0; + border-radius: 3px 3px 0 0; +} +.selectize-dropdown-header-close { + position: absolute; + right: 10px; + top: 50%; + color: #303030; + opacity: 0.4; + margin-top: -12px; + line-height: 20px; + font-size: 20px !important; +} +.selectize-dropdown-header-close:hover { + color: #000000; +} +.selectize-dropdown.plugin-optgroup_columns .optgroup { + border-right: 1px solid #f2f2f2; + border-top: 0 none; + float: left; + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; +} +.selectize-dropdown.plugin-optgroup_columns .optgroup:last-child { + border-right: 0 none; +} +.selectize-dropdown.plugin-optgroup_columns .optgroup:before { + display: none; +} +.selectize-dropdown.plugin-optgroup_columns .optgroup-header { + border-top: 0 none; +} +.selectize-control.plugin-remove_button [data-value] { + position: relative; + padding-right: 24px !important; +} +.selectize-control.plugin-remove_button [data-value] .remove { + z-index: 1; + /* fixes ie bug (see #392) */ + position: absolute; + top: 0; + right: 0; + bottom: 0; + width: 17px; + text-align: center; + font-weight: bold; + font-size: 12px; + color: inherit; + text-decoration: none; + vertical-align: middle; + display: inline-block; + padding: 1px 0 0 0; + border-left: 1px solid #74b21e; + -webkit-border-radius: 0 2px 2px 0; + -moz-border-radius: 0 2px 2px 0; + border-radius: 0 2px 2px 0; + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; +} +.selectize-control.plugin-remove_button [data-value] .remove:hover { + background: rgba(0, 0, 0, 0.05); +} +.selectize-control.plugin-remove_button [data-value].active .remove { + border-left-color: #6f9839; +} +.selectize-control.plugin-remove_button .disabled [data-value] .remove:hover { + background: none; +} +.selectize-control.plugin-remove_button .disabled [data-value] .remove { + border-left-color: #b4b4b4; +} +.selectize-control.plugin-remove_button .remove-single { + position: absolute; + right: 28px; + top: 6px; + font-size: 23px; +} +.selectize-control { + position: relative; +} +.selectize-dropdown, +.selectize-input, +.selectize-input input { + color: #303030; + font-family: inherit; + font-size: 13px; + line-height: 20px; + -webkit-font-smoothing: inherit; +} +.selectize-input, +.selectize-control.single .selectize-input.input-active { + background: #ffffff; + cursor: text; + display: inline-block; +} +.selectize-input { + border: 1px solid #d0d0d0; + padding: 10px 10px; + display: inline-block; + width: 100%; + overflow: hidden; + position: relative; + z-index: 1; + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; + -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.1); + box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.1); + -webkit-border-radius: 3px; + -moz-border-radius: 3px; + border-radius: 3px; +} +.selectize-control.multi .selectize-input.has-items { + padding: 8px 10px 4px; +} +.selectize-input.full { + background-color: #f2f2f2; +} +.selectize-input.disabled, +.selectize-input.disabled * { + cursor: default !important; +} +.selectize-input.focus { + -webkit-box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.15); + box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.15); +} +.selectize-input.dropdown-active { + -webkit-border-radius: 3px 3px 0 0; + -moz-border-radius: 3px 3px 0 0; + border-radius: 3px 3px 0 0; +} +.selectize-input > * { + vertical-align: baseline; + display: -moz-inline-stack; + display: inline-block; + zoom: 1; + *display: inline; +} +.selectize-control.multi .selectize-input > div { + cursor: pointer; + margin: 0 4px 4px 0; + padding: 1px 5px; + background: #b8e76f; + color: #3d5d18; + border: 1px solid #74b21e; +} +.selectize-control.multi .selectize-input > div.active { + background: #92c836; + color: #303030; + border: 1px solid #6f9839; +} +.selectize-control.multi .selectize-input.disabled > div, +.selectize-control.multi .selectize-input.disabled > div.active { + color: #878787; + background: #f8f8f8; + border: 1px solid #b4b4b4; +} +.selectize-input > input { + display: inline-block !important; + padding: 0 !important; + min-height: 0 !important; + max-height: none !important; + max-width: 100% !important; + margin: 0 2px 0 0 !important; + text-indent: 0 !important; + border: 0 none !important; + background: none !important; + line-height: inherit !important; + -webkit-user-select: auto !important; + -webkit-box-shadow: none !important; + box-shadow: none !important; +} +.selectize-input > input::-ms-clear { + display: none; +} +.selectize-input > input:focus { + outline: none !important; +} +.selectize-input::after { + content: ' '; + display: block; + clear: left; +} +.selectize-input.dropdown-active::before { + content: ' '; + display: block; + position: absolute; + background: #f0f0f0; + height: 1px; + bottom: 0; + left: 0; + right: 0; +} +.selectize-dropdown { + position: absolute; + z-index: 10; + border: 1px solid #d0d0d0; + background: #ffffff; + margin: -1px 0 0 0; + border-top: 0 none; + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; + -webkit-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1); + box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1); + -webkit-border-radius: 0 0 3px 3px; + -moz-border-radius: 0 0 3px 3px; + border-radius: 0 0 3px 3px; +} +.selectize-dropdown [data-selectable] { + cursor: pointer; + overflow: hidden; +} +.selectize-dropdown [data-selectable] .highlight { + background: rgba(255, 237, 40, 0.4); + -webkit-border-radius: 1px; + -moz-border-radius: 1px; + border-radius: 1px; +} +.selectize-dropdown [data-selectable], +.selectize-dropdown .optgroup-header { + padding: 7px 10px; +} +.selectize-dropdown .optgroup:first-child .optgroup-header { + border-top: 0 none; +} +.selectize-dropdown .optgroup-header { + color: #303030; + background: #f8f8f8; + cursor: default; +} +.selectize-dropdown .active { + background-color: #fffceb; + color: #303030; +} +.selectize-dropdown .active.create { + color: #303030; +} +.selectize-dropdown .create { + color: rgba(48, 48, 48, 0.5); +} +.selectize-dropdown-content { + overflow-y: auto; + overflow-x: hidden; + max-height: 200px; + -webkit-overflow-scrolling: touch; +} +.selectize-control.single .selectize-input, +.selectize-control.single .selectize-input input { + cursor: pointer; +} +.selectize-control.single .selectize-input.input-active, +.selectize-control.single .selectize-input.input-active input { + cursor: text; +} +.selectize-control.single .selectize-input:after { + content: ' '; + display: block; + position: absolute; + top: 50%; + right: 15px; + margin-top: -3px; + width: 0; + height: 0; + border-style: solid; + border-width: 5px 5px 0 5px; + border-color: #808080 transparent transparent transparent; +} +.selectize-control.single .selectize-input.dropdown-active:after { + margin-top: -4px; + border-width: 0 5px 5px 5px; + border-color: transparent transparent #808080 transparent; +} +.selectize-control.rtl.single .selectize-input:after { + left: 15px; + right: auto; +} +.selectize-control.rtl .selectize-input > input { + margin: 0 4px 0 -2px !important; +} +.selectize-control .selectize-input.disabled { + opacity: 0.5; + background-color: #fafafa; +} +.selectize-control.multi .selectize-input [data-value] { + text-shadow: 0 1px 0 rgba(255, 255, 255, 0.1); + -webkit-border-radius: 3px; + -moz-border-radius: 3px; + border-radius: 3px; + background-color: #b2e567; + background-image: -moz-linear-gradient(top, #b8e76f, #a9e25c); + background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#b8e76f), to(#a9e25c)); + background-image: -webkit-linear-gradient(top, #b8e76f, #a9e25c); + background-image: -o-linear-gradient(top, #b8e76f, #a9e25c); + background-image: linear-gradient(to bottom, #b8e76f, #a9e25c); + background-repeat: repeat-x; + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffb8e76f', endColorstr='#ffa9e25c', GradientType=0); + -webkit-box-shadow: 0 1px 1px rgba(0, 0, 0, 0.1); + box-shadow: 0 1px 1px rgba(0, 0, 0, 0.1); +} +.selectize-control.multi .selectize-input [data-value].active { + background-color: #88c332; + background-image: -moz-linear-gradient(top, #92c836, #7abc2c); + background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#92c836), to(#7abc2c)); + background-image: -webkit-linear-gradient(top, #92c836, #7abc2c); + background-image: -o-linear-gradient(top, #92c836, #7abc2c); + background-image: linear-gradient(to bottom, #92c836, #7abc2c); + background-repeat: repeat-x; + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff92c836', endColorstr='#ff7abc2c', GradientType=0); +} +.selectize-control.single .selectize-input { + -webkit-box-shadow: inset 0 1px 0 rgba(255,255,255,0.8), 0 2px 0 #e0e0e0, 0 3px 0 #c8c8c8, 0 4px 1px rgba(0,0,0,0.1); + box-shadow: inset 0 1px 0 rgba(255,255,255,0.8), 0 2px 0 #e0e0e0, 0 3px 0 #c8c8c8, 0 4px 1px rgba(0,0,0,0.1); + background-color: #f3f3f3; + background-image: -moz-linear-gradient(top, #f5f5f5, #efefef); + background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#f5f5f5), to(#efefef)); + background-image: -webkit-linear-gradient(top, #f5f5f5, #efefef); + background-image: -o-linear-gradient(top, #f5f5f5, #efefef); + background-image: linear-gradient(to bottom, #f5f5f5, #efefef); + background-repeat: repeat-x; + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff5f5f5', endColorstr='#ffefefef', GradientType=0); +} +.selectize-control.single .selectize-input, +.selectize-dropdown.single { + border-color: #b8b8b8; +} +.selectize-dropdown .optgroup-header { + font-weight: bold; + font-size: 0.8em; + border-bottom: 1px solid #f0f0f0; + border-top: 1px solid #f0f0f0; +} diff --git a/wire/modules/Jquery/JqueryUI/selectize/js/selectize.js b/wire/modules/Jquery/JqueryUI/selectize/js/selectize.js new file mode 100755 index 00000000..afe09e47 --- /dev/null +++ b/wire/modules/Jquery/JqueryUI/selectize/js/selectize.js @@ -0,0 +1,3193 @@ +/** + * selectize.js (v0.12.4) + * Copyright (c) 2013–2015 Brian Reavis & contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this + * file except in compliance with the License. You may obtain a copy of the License at: + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under + * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF + * ANY KIND, either express or implied. See the License for the specific language + * governing permissions and limitations under the License. + * + * @author Brian Reavis + */ + +/*jshint curly:false */ +/*jshint browser:true */ + +(function(root, factory) { + if (typeof define === 'function' && define.amd) { + define(['jquery','sifter','microplugin'], factory); + } else if (typeof exports === 'object') { + module.exports = factory(require('jquery'), require('sifter'), require('microplugin')); + } else { + root.Selectize = factory(root.jQuery, root.Sifter, root.MicroPlugin); + } +}(this, function($, Sifter, MicroPlugin) { + 'use strict'; + + var highlight = function($element, pattern) { + if (typeof pattern === 'string' && !pattern.length) return; + var regex = (typeof pattern === 'string') ? new RegExp(pattern, 'i') : pattern; + + var highlight = function(node) { + var skip = 0; + if (node.nodeType === 3) { + var pos = node.data.search(regex); + if (pos >= 0 && node.data.length > 0) { + var match = node.data.match(regex); + var spannode = document.createElement('span'); + spannode.className = 'highlight'; + var middlebit = node.splitText(pos); + var endbit = middlebit.splitText(match[0].length); + var middleclone = middlebit.cloneNode(true); + spannode.appendChild(middleclone); + middlebit.parentNode.replaceChild(spannode, middlebit); + skip = 1; + } + } else if (node.nodeType === 1 && node.childNodes && !/(script|style)/i.test(node.tagName)) { + for (var i = 0; i < node.childNodes.length; ++i) { + i += highlight(node.childNodes[i]); + } + } + return skip; + }; + + return $element.each(function() { + highlight(this); + }); + }; + + /** + * removeHighlight fn copied from highlight v5 and + * edited to remove with() and pass js strict mode + */ + $.fn.removeHighlight = function() { + return this.find("span.highlight").each(function() { + this.parentNode.firstChild.nodeName; + var parent = this.parentNode; + parent.replaceChild(this.firstChild, this); + parent.normalize(); + }).end(); + }; + + + var MicroEvent = function() {}; + MicroEvent.prototype = { + on: function(event, fct){ + this._events = this._events || {}; + this._events[event] = this._events[event] || []; + this._events[event].push(fct); + }, + off: function(event, fct){ + var n = arguments.length; + if (n === 0) return delete this._events; + if (n === 1) return delete this._events[event]; + + this._events = this._events || {}; + if (event in this._events === false) return; + this._events[event].splice(this._events[event].indexOf(fct), 1); + }, + trigger: function(event /* , args... */){ + this._events = this._events || {}; + if (event in this._events === false) return; + for (var i = 0; i < this._events[event].length; i++){ + this._events[event][i].apply(this, Array.prototype.slice.call(arguments, 1)); + } + } + }; + + /** + * Mixin will delegate all MicroEvent.js function in the destination object. + * + * - MicroEvent.mixin(Foobar) will make Foobar able to use MicroEvent + * + * @param {object} the object which will support MicroEvent + */ + MicroEvent.mixin = function(destObject){ + var props = ['on', 'off', 'trigger']; + for (var i = 0; i < props.length; i++){ + destObject.prototype[props[i]] = MicroEvent.prototype[props[i]]; + } + }; + + var IS_MAC = /Mac/.test(navigator.userAgent); + + var KEY_A = 65; + var KEY_COMMA = 188; + var KEY_RETURN = 13; + var KEY_ESC = 27; + var KEY_LEFT = 37; + var KEY_UP = 38; + var KEY_P = 80; + var KEY_RIGHT = 39; + var KEY_DOWN = 40; + var KEY_N = 78; + var KEY_BACKSPACE = 8; + var KEY_DELETE = 46; + var KEY_SHIFT = 16; + var KEY_CMD = IS_MAC ? 91 : 17; + var KEY_CTRL = IS_MAC ? 18 : 17; + var KEY_TAB = 9; + + var TAG_SELECT = 1; + var TAG_INPUT = 2; + + // for now, android support in general is too spotty to support validity + var SUPPORTS_VALIDITY_API = !/android/i.test(window.navigator.userAgent) && !!document.createElement('input').validity; + + + var isset = function(object) { + return typeof object !== 'undefined'; + }; + + /** + * Converts a scalar to its best string representation + * for hash keys and HTML attribute values. + * + * Transformations: + * 'str' -> 'str' + * null -> '' + * undefined -> '' + * true -> '1' + * false -> '0' + * 0 -> '0' + * 1 -> '1' + * + * @param {string} value + * @returns {string|null} + */ + var hash_key = function(value) { + if (typeof value === 'undefined' || value === null) return null; + if (typeof value === 'boolean') return value ? '1' : '0'; + return value + ''; + }; + + /** + * Escapes a string for use within HTML. + * + * @param {string} str + * @returns {string} + */ + var escape_html = function(str) { + return (str + '') + .replace(/&/g, '&') + .replace(//g, '>') + .replace(/"/g, '"'); + }; + + /** + * Escapes "$" characters in replacement strings. + * + * @param {string} str + * @returns {string} + */ + var escape_replace = function(str) { + return (str + '').replace(/\$/g, '$$$$'); + }; + + var hook = {}; + + /** + * Wraps `method` on `self` so that `fn` + * is invoked before the original method. + * + * @param {object} self + * @param {string} method + * @param {function} fn + */ + hook.before = function(self, method, fn) { + var original = self[method]; + self[method] = function() { + fn.apply(self, arguments); + return original.apply(self, arguments); + }; + }; + + /** + * Wraps `method` on `self` so that `fn` + * is invoked after the original method. + * + * @param {object} self + * @param {string} method + * @param {function} fn + */ + hook.after = function(self, method, fn) { + var original = self[method]; + self[method] = function() { + var result = original.apply(self, arguments); + fn.apply(self, arguments); + return result; + }; + }; + + /** + * Wraps `fn` so that it can only be invoked once. + * + * @param {function} fn + * @returns {function} + */ + var once = function(fn) { + var called = false; + return function() { + if (called) return; + called = true; + fn.apply(this, arguments); + }; + }; + + /** + * Wraps `fn` so that it can only be called once + * every `delay` milliseconds (invoked on the falling edge). + * + * @param {function} fn + * @param {int} delay + * @returns {function} + */ + var debounce = function(fn, delay) { + var timeout; + return function() { + var self = this; + var args = arguments; + window.clearTimeout(timeout); + timeout = window.setTimeout(function() { + fn.apply(self, args); + }, delay); + }; + }; + + /** + * Debounce all fired events types listed in `types` + * while executing the provided `fn`. + * + * @param {object} self + * @param {array} types + * @param {function} fn + */ + var debounce_events = function(self, types, fn) { + var type; + var trigger = self.trigger; + var event_args = {}; + + // override trigger method + self.trigger = function() { + var type = arguments[0]; + if (types.indexOf(type) !== -1) { + event_args[type] = arguments; + } else { + return trigger.apply(self, arguments); + } + }; + + // invoke provided function + fn.apply(self, []); + self.trigger = trigger; + + // trigger queued events + for (type in event_args) { + if (event_args.hasOwnProperty(type)) { + trigger.apply(self, event_args[type]); + } + } + }; + + /** + * A workaround for http://bugs.jquery.com/ticket/6696 + * + * @param {object} $parent - Parent element to listen on. + * @param {string} event - Event name. + * @param {string} selector - Descendant selector to filter by. + * @param {function} fn - Event handler. + */ + var watchChildEvent = function($parent, event, selector, fn) { + $parent.on(event, selector, function(e) { + var child = e.target; + while (child && child.parentNode !== $parent[0]) { + child = child.parentNode; + } + e.currentTarget = child; + return fn.apply(this, [e]); + }); + }; + + /** + * Determines the current selection within a text input control. + * Returns an object containing: + * - start + * - length + * + * @param {object} input + * @returns {object} + */ + var getSelection = function(input) { + var result = {}; + if ('selectionStart' in input) { + result.start = input.selectionStart; + result.length = input.selectionEnd - result.start; + } else if (document.selection) { + input.focus(); + var sel = document.selection.createRange(); + var selLen = document.selection.createRange().text.length; + sel.moveStart('character', -input.value.length); + result.start = sel.text.length - selLen; + result.length = selLen; + } + return result; + }; + + /** + * Copies CSS properties from one element to another. + * + * @param {object} $from + * @param {object} $to + * @param {array} properties + */ + var transferStyles = function($from, $to, properties) { + var i, n, styles = {}; + if (properties) { + for (i = 0, n = properties.length; i < n; i++) { + styles[properties[i]] = $from.css(properties[i]); + } + } else { + styles = $from.css(); + } + $to.css(styles); + }; + + /** + * Measures the width of a string within a + * parent element (in pixels). + * + * @param {string} str + * @param {object} $parent + * @returns {int} + */ + var measureString = function(str, $parent) { + if (!str) { + return 0; + } + + var $test = $('').css({ + position: 'absolute', + top: -99999, + left: -99999, + width: 'auto', + padding: 0, + whiteSpace: 'pre' + }).text(str).appendTo('body'); + + transferStyles($parent, $test, [ + 'letterSpacing', + 'fontSize', + 'fontFamily', + 'fontWeight', + 'textTransform' + ]); + + var width = $test.width(); + $test.remove(); + + return width; + }; + + /** + * Sets up an input to grow horizontally as the user + * types. If the value is changed manually, you can + * trigger the "update" handler to resize: + * + * $input.trigger('update'); + * + * @param {object} $input + */ + var autoGrow = function($input) { + var currentWidth = null; + + var update = function(e, options) { + var value, keyCode, printable, placeholder, width; + var shift, character, selection; + e = e || window.event || {}; + options = options || {}; + + if (e.metaKey || e.altKey) return; + if (!options.force && $input.data('grow') === false) return; + + value = $input.val(); + if (e.type && e.type.toLowerCase() === 'keydown') { + keyCode = e.keyCode; + printable = ( + (keyCode >= 97 && keyCode <= 122) || // a-z + (keyCode >= 65 && keyCode <= 90) || // A-Z + (keyCode >= 48 && keyCode <= 57) || // 0-9 + keyCode === 32 // space + ); + + if (keyCode === KEY_DELETE || keyCode === KEY_BACKSPACE) { + selection = getSelection($input[0]); + if (selection.length) { + value = value.substring(0, selection.start) + value.substring(selection.start + selection.length); + } else if (keyCode === KEY_BACKSPACE && selection.start) { + value = value.substring(0, selection.start - 1) + value.substring(selection.start + 1); + } else if (keyCode === KEY_DELETE && typeof selection.start !== 'undefined') { + value = value.substring(0, selection.start) + value.substring(selection.start + 1); + } + } else if (printable) { + shift = e.shiftKey; + character = String.fromCharCode(e.keyCode); + if (shift) character = character.toUpperCase(); + else character = character.toLowerCase(); + value += character; + } + } + + placeholder = $input.attr('placeholder'); + if (!value && placeholder) { + value = placeholder; + } + + width = measureString(value, $input) + 4; + if (width !== currentWidth) { + currentWidth = width; + $input.width(width); + $input.triggerHandler('resize'); + } + }; + + $input.on('keydown keyup update blur', update); + update(); + }; + + var domToString = function(d) { + var tmp = document.createElement('div'); + + tmp.appendChild(d.cloneNode(true)); + + return tmp.innerHTML; + }; + + var logError = function(message, options){ + if(!options) options = {}; + var component = "Selectize"; + + console.error(component + ": " + message) + + if(options.explanation){ + // console.group is undefined in ').addClass(settings.wrapperClass).addClass(classes).addClass(inputMode); + $control = $('
    ').addClass(settings.inputClass).addClass('items').appendTo($wrapper); + $control_input = $('').appendTo($control).attr('tabindex', $input.is(':disabled') ? '-1' : self.tabIndex); + $dropdown_parent = $(settings.dropdownParent || $wrapper); + $dropdown = $('
    ').addClass(settings.dropdownClass).addClass(inputMode).hide().appendTo($dropdown_parent); + $dropdown_content = $('
    ').addClass(settings.dropdownContentClass).appendTo($dropdown); + + if(inputId = $input.attr('id')) { + $control_input.attr('id', inputId + '-selectized'); + $("label[for='"+inputId+"']").attr('for', inputId + '-selectized'); + } + + if(self.settings.copyClassesToDropdown) { + $dropdown.addClass(classes); + } + + $wrapper.css({ + width: $input[0].style.width + }); + + if (self.plugins.names.length) { + classes_plugins = 'plugin-' + self.plugins.names.join(' plugin-'); + $wrapper.addClass(classes_plugins); + $dropdown.addClass(classes_plugins); + } + + if ((settings.maxItems === null || settings.maxItems > 1) && self.tagType === TAG_SELECT) { + $input.attr('multiple', 'multiple'); + } + + if (self.settings.placeholder) { + $control_input.attr('placeholder', settings.placeholder); + } + + // if splitOn was not passed in, construct it from the delimiter to allow pasting universally + if (!self.settings.splitOn && self.settings.delimiter) { + var delimiterEscaped = self.settings.delimiter.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&'); + self.settings.splitOn = new RegExp('\\s*' + delimiterEscaped + '+\\s*'); + } + + if ($input.attr('autocorrect')) { + $control_input.attr('autocorrect', $input.attr('autocorrect')); + } + + if ($input.attr('autocapitalize')) { + $control_input.attr('autocapitalize', $input.attr('autocapitalize')); + } + + self.$wrapper = $wrapper; + self.$control = $control; + self.$control_input = $control_input; + self.$dropdown = $dropdown; + self.$dropdown_content = $dropdown_content; + + $dropdown.on('mouseenter', '[data-selectable]', function() { return self.onOptionHover.apply(self, arguments); }); + $dropdown.on('mousedown click', '[data-selectable]', function() { return self.onOptionSelect.apply(self, arguments); }); + watchChildEvent($control, 'mousedown', '*:not(input)', function() { return self.onItemSelect.apply(self, arguments); }); + autoGrow($control_input); + + $control.on({ + mousedown : function() { return self.onMouseDown.apply(self, arguments); }, + click : function() { return self.onClick.apply(self, arguments); } + }); + + $control_input.on({ + mousedown : function(e) { e.stopPropagation(); }, + keydown : function() { return self.onKeyDown.apply(self, arguments); }, + keyup : function() { return self.onKeyUp.apply(self, arguments); }, + keypress : function() { return self.onKeyPress.apply(self, arguments); }, + resize : function() { self.positionDropdown.apply(self, []); }, + blur : function() { return self.onBlur.apply(self, arguments); }, + focus : function() { self.ignoreBlur = false; return self.onFocus.apply(self, arguments); }, + paste : function() { return self.onPaste.apply(self, arguments); } + }); + + $document.on('keydown' + eventNS, function(e) { + self.isCmdDown = e[IS_MAC ? 'metaKey' : 'ctrlKey']; + self.isCtrlDown = e[IS_MAC ? 'altKey' : 'ctrlKey']; + self.isShiftDown = e.shiftKey; + }); + + $document.on('keyup' + eventNS, function(e) { + if (e.keyCode === KEY_CTRL) self.isCtrlDown = false; + if (e.keyCode === KEY_SHIFT) self.isShiftDown = false; + if (e.keyCode === KEY_CMD) self.isCmdDown = false; + }); + + $document.on('mousedown' + eventNS, function(e) { + if (self.isFocused) { + // prevent events on the dropdown scrollbar from causing the control to blur + if (e.target === self.$dropdown[0] || e.target.parentNode === self.$dropdown[0]) { + return false; + } + // blur on click outside + if (!self.$control.has(e.target).length && e.target !== self.$control[0]) { + self.blur(e.target); + } + } + }); + + $window.on(['scroll' + eventNS, 'resize' + eventNS].join(' '), function() { + if (self.isOpen) { + self.positionDropdown.apply(self, arguments); + } + }); + $window.on('mousemove' + eventNS, function() { + self.ignoreHover = false; + }); + + // store original children and tab index so that they can be + // restored when the destroy() method is called. + this.revertSettings = { + $children : $input.children().detach(), + tabindex : $input.attr('tabindex') + }; + + $input.attr('tabindex', -1).hide().after(self.$wrapper); + + if ($.isArray(settings.items)) { + self.setValue(settings.items); + delete settings.items; + } + + // feature detect for the validation API + if (SUPPORTS_VALIDITY_API) { + $input.on('invalid' + eventNS, function(e) { + e.preventDefault(); + self.isInvalid = true; + self.refreshState(); + }); + } + + self.updateOriginalInput(); + self.refreshItems(); + self.refreshState(); + self.updatePlaceholder(); + self.isSetup = true; + + if ($input.is(':disabled')) { + self.disable(); + } + + self.on('change', this.onChange); + + $input.data('selectize', self); + $input.addClass('selectized'); + self.trigger('initialize'); + + // preload options + if (settings.preload === true) { + self.onSearchChange(''); + } + + }, + + /** + * Sets up default rendering functions. + */ + setupTemplates: function() { + var self = this; + var field_label = self.settings.labelField; + var field_optgroup = self.settings.optgroupLabelField; + + var templates = { + 'optgroup': function(data) { + return '
    ' + data.html + '
    '; + }, + 'optgroup_header': function(data, escape) { + return '
    ' + escape(data[field_optgroup]) + '
    '; + }, + 'option': function(data, escape) { + return '
    ' + escape(data[field_label]) + '
    '; + }, + 'item': function(data, escape) { + return '
    ' + escape(data[field_label]) + '
    '; + }, + 'option_create': function(data, escape) { + return '
    Add ' + escape(data.input) + '
    '; + } + }; + + self.settings.render = $.extend({}, templates, self.settings.render); + }, + + /** + * Maps fired events to callbacks provided + * in the settings used when creating the control. + */ + setupCallbacks: function() { + var key, fn, callbacks = { + 'initialize' : 'onInitialize', + 'change' : 'onChange', + 'item_add' : 'onItemAdd', + 'item_remove' : 'onItemRemove', + 'clear' : 'onClear', + 'option_add' : 'onOptionAdd', + 'option_remove' : 'onOptionRemove', + 'option_clear' : 'onOptionClear', + 'optgroup_add' : 'onOptionGroupAdd', + 'optgroup_remove' : 'onOptionGroupRemove', + 'optgroup_clear' : 'onOptionGroupClear', + 'dropdown_open' : 'onDropdownOpen', + 'dropdown_close' : 'onDropdownClose', + 'type' : 'onType', + 'load' : 'onLoad', + 'focus' : 'onFocus', + 'blur' : 'onBlur' + }; + + for (key in callbacks) { + if (callbacks.hasOwnProperty(key)) { + fn = this.settings[callbacks[key]]; + if (fn) this.on(key, fn); + } + } + }, + + /** + * Triggered when the main control element + * has a click event. + * + * @param {object} e + * @return {boolean} + */ + onClick: function(e) { + var self = this; + + // necessary for mobile webkit devices (manual focus triggering + // is ignored unless invoked within a click event) + if (!self.isFocused) { + self.focus(); + e.preventDefault(); + } + }, + + /** + * Triggered when the main control element + * has a mouse down event. + * + * @param {object} e + * @return {boolean} + */ + onMouseDown: function(e) { + var self = this; + var defaultPrevented = e.isDefaultPrevented(); + var $target = $(e.target); + + if (self.isFocused) { + // retain focus by preventing native handling. if the + // event target is the input it should not be modified. + // otherwise, text selection within the input won't work. + if (e.target !== self.$control_input[0]) { + if (self.settings.mode === 'single') { + // toggle dropdown + self.isOpen ? self.close() : self.open(); + } else if (!defaultPrevented) { + self.setActiveItem(null); + } + return false; + } + } else { + // give control focus + if (!defaultPrevented) { + window.setTimeout(function() { + self.focus(); + }, 0); + } + } + }, + + /** + * Triggered when the value of the control has been changed. + * This should propagate the event to the original DOM + * input / select element. + */ + onChange: function() { + this.$input.trigger('change'); + }, + + /** + * Triggered on paste. + * + * @param {object} e + * @returns {boolean} + */ + onPaste: function(e) { + var self = this; + + if (self.isFull() || self.isInputHidden || self.isLocked) { + e.preventDefault(); + return; + } + + // If a regex or string is included, this will split the pasted + // input and create Items for each separate value + if (self.settings.splitOn) { + + // Wait for pasted text to be recognized in value + setTimeout(function() { + var pastedText = self.$control_input.val(); + if(!pastedText.match(self.settings.splitOn)){ return } + + var splitInput = $.trim(pastedText).split(self.settings.splitOn); + for (var i = 0, n = splitInput.length; i < n; i++) { + self.createItem(splitInput[i]); + } + }, 0); + } + }, + + /** + * Triggered on keypress. + * + * @param {object} e + * @returns {boolean} + */ + onKeyPress: function(e) { + if (this.isLocked) return e && e.preventDefault(); + var character = String.fromCharCode(e.keyCode || e.which); + if (this.settings.create && this.settings.mode === 'multi' && character === this.settings.delimiter) { + this.createItem(); + e.preventDefault(); + return false; + } + }, + + /** + * Triggered on keydown. + * + * @param {object} e + * @returns {boolean} + */ + onKeyDown: function(e) { + var isInput = e.target === this.$control_input[0]; + var self = this; + + if (self.isLocked) { + if (e.keyCode !== KEY_TAB) { + e.preventDefault(); + } + return; + } + + switch (e.keyCode) { + case KEY_A: + if (self.isCmdDown) { + self.selectAll(); + return; + } + break; + case KEY_ESC: + if (self.isOpen) { + e.preventDefault(); + e.stopPropagation(); + self.close(); + } + return; + case KEY_N: + if (!e.ctrlKey || e.altKey) break; + case KEY_DOWN: + if (!self.isOpen && self.hasOptions) { + self.open(); + } else if (self.$activeOption) { + self.ignoreHover = true; + var $next = self.getAdjacentOption(self.$activeOption, 1); + if ($next.length) self.setActiveOption($next, true, true); + } + e.preventDefault(); + return; + case KEY_P: + if (!e.ctrlKey || e.altKey) break; + case KEY_UP: + if (self.$activeOption) { + self.ignoreHover = true; + var $prev = self.getAdjacentOption(self.$activeOption, -1); + if ($prev.length) self.setActiveOption($prev, true, true); + } + e.preventDefault(); + return; + case KEY_RETURN: + if (self.isOpen && self.$activeOption) { + self.onOptionSelect({currentTarget: self.$activeOption}); + e.preventDefault(); + } + return; + case KEY_LEFT: + self.advanceSelection(-1, e); + return; + case KEY_RIGHT: + self.advanceSelection(1, e); + return; + case KEY_TAB: + if (self.settings.selectOnTab && self.isOpen && self.$activeOption) { + self.onOptionSelect({currentTarget: self.$activeOption}); + + // Default behaviour is to jump to the next field, we only want this + // if the current field doesn't accept any more entries + if (!self.isFull()) { + e.preventDefault(); + } + } + if (self.settings.create && self.createItem()) { + e.preventDefault(); + } + return; + case KEY_BACKSPACE: + case KEY_DELETE: + self.deleteSelection(e); + return; + } + + if ((self.isFull() || self.isInputHidden) && !(IS_MAC ? e.metaKey : e.ctrlKey)) { + e.preventDefault(); + return; + } + }, + + /** + * Triggered on keyup. + * + * @param {object} e + * @returns {boolean} + */ + onKeyUp: function(e) { + var self = this; + + if (self.isLocked) return e && e.preventDefault(); + var value = self.$control_input.val() || ''; + if (self.lastValue !== value) { + self.lastValue = value; + self.onSearchChange(value); + self.refreshOptions(); + self.trigger('type', value); + } + }, + + /** + * Invokes the user-provide option provider / loader. + * + * Note: this function is debounced in the Selectize + * constructor (by `settings.loadThrottle` milliseconds) + * + * @param {string} value + */ + onSearchChange: function(value) { + var self = this; + var fn = self.settings.load; + if (!fn) return; + if (self.loadedSearches.hasOwnProperty(value)) return; + self.loadedSearches[value] = true; + self.load(function(callback) { + fn.apply(self, [value, callback]); + }); + }, + + /** + * Triggered on focus. + * + * @param {object} e (optional) + * @returns {boolean} + */ + onFocus: function(e) { + var self = this; + var wasFocused = self.isFocused; + + if (self.isDisabled) { + self.blur(); + e && e.preventDefault(); + return false; + } + + if (self.ignoreFocus) return; + self.isFocused = true; + if (self.settings.preload === 'focus') self.onSearchChange(''); + + if (!wasFocused) self.trigger('focus'); + + if (!self.$activeItems.length) { + self.showInput(); + self.setActiveItem(null); + self.refreshOptions(!!self.settings.openOnFocus); + } + + self.refreshState(); + }, + + /** + * Triggered on blur. + * + * @param {object} e + * @param {Element} dest + */ + onBlur: function(e, dest) { + var self = this; + if (!self.isFocused) return; + self.isFocused = false; + + if (self.ignoreFocus) { + return; + } else if (!self.ignoreBlur && document.activeElement === self.$dropdown_content[0]) { + // necessary to prevent IE closing the dropdown when the scrollbar is clicked + self.ignoreBlur = true; + self.onFocus(e); + return; + } + + var deactivate = function() { + self.close(); + self.setTextboxValue(''); + self.setActiveItem(null); + self.setActiveOption(null); + self.setCaret(self.items.length); + self.refreshState(); + + // IE11 bug: element still marked as active + dest && dest.focus && dest.focus(); + + self.ignoreFocus = false; + self.trigger('blur'); + }; + + self.ignoreFocus = true; + if (self.settings.create && self.settings.createOnBlur) { + self.createItem(null, false, deactivate); + } else { + deactivate(); + } + }, + + /** + * Triggered when the user rolls over + * an option in the autocomplete dropdown menu. + * + * @param {object} e + * @returns {boolean} + */ + onOptionHover: function(e) { + if (this.ignoreHover) return; + this.setActiveOption(e.currentTarget, false); + }, + + /** + * Triggered when the user clicks on an option + * in the autocomplete dropdown menu. + * + * @param {object} e + * @returns {boolean} + */ + onOptionSelect: function(e) { + var value, $target, $option, self = this; + + if (e.preventDefault) { + e.preventDefault(); + e.stopPropagation(); + } + + $target = $(e.currentTarget); + if ($target.hasClass('create')) { + self.createItem(null, function() { + if (self.settings.closeAfterSelect) { + self.close(); + } + }); + } else { + value = $target.attr('data-value'); + if (typeof value !== 'undefined') { + self.lastQuery = null; + self.setTextboxValue(''); + self.addItem(value); + if (self.settings.closeAfterSelect) { + self.close(); + } else if (!self.settings.hideSelected && e.type && /mouse/.test(e.type)) { + self.setActiveOption(self.getOption(value)); + } + } + } + }, + + /** + * Triggered when the user clicks on an item + * that has been selected. + * + * @param {object} e + * @returns {boolean} + */ + onItemSelect: function(e) { + var self = this; + + if (self.isLocked) return; + if (self.settings.mode === 'multi') { + e.preventDefault(); + self.setActiveItem(e.currentTarget, e); + } + }, + + /** + * Invokes the provided method that provides + * results to a callback---which are then added + * as options to the control. + * + * @param {function} fn + */ + load: function(fn) { + var self = this; + var $wrapper = self.$wrapper.addClass(self.settings.loadingClass); + + self.loading++; + fn.apply(self, [function(results) { + self.loading = Math.max(self.loading - 1, 0); + if (results && results.length) { + self.addOption(results); + self.refreshOptions(self.isFocused && !self.isInputHidden); + } + if (!self.loading) { + $wrapper.removeClass(self.settings.loadingClass); + } + self.trigger('load', results); + }]); + }, + + /** + * Sets the input field of the control to the specified value. + * + * @param {string} value + */ + setTextboxValue: function(value) { + var $input = this.$control_input; + var changed = $input.val() !== value; + if (changed) { + $input.val(value).triggerHandler('update'); + this.lastValue = value; + } + }, + + /** + * Returns the value of the control. If multiple items + * can be selected (e.g. or + * element to reflect the current state. + */ + updateOriginalInput: function(opts) { + var i, n, options, label, self = this; + opts = opts || {}; + + if (self.tagType === TAG_SELECT) { + options = []; + for (i = 0, n = self.items.length; i < n; i++) { + label = self.options[self.items[i]][self.settings.labelField] || ''; + options.push(''); + } + if (!options.length && !this.$input.attr('multiple')) { + options.push(''); + } + self.$input.html(options.join('')); + } else { + self.$input.val(self.getValue()); + self.$input.attr('value',self.$input.val()); + } + + if (self.isSetup) { + if (!opts.silent) { + self.trigger('change', self.$input.val()); + } + } + }, + + /** + * Shows/hide the input placeholder depending + * on if there items in the list already. + */ + updatePlaceholder: function() { + if (!this.settings.placeholder) return; + var $input = this.$control_input; + + if (this.items.length) { + $input.removeAttr('placeholder'); + } else { + $input.attr('placeholder', this.settings.placeholder); + } + $input.triggerHandler('update', {force: true}); + }, + + /** + * Shows the autocomplete dropdown containing + * the available options. + */ + open: function() { + var self = this; + + if (self.isLocked || self.isOpen || (self.settings.mode === 'multi' && self.isFull())) return; + self.focus(); + self.isOpen = true; + self.refreshState(); + self.$dropdown.css({visibility: 'hidden', display: 'block'}); + self.positionDropdown(); + self.$dropdown.css({visibility: 'visible'}); + self.trigger('dropdown_open', self.$dropdown); + }, + + /** + * Closes the autocomplete dropdown menu. + */ + close: function() { + var self = this; + var trigger = self.isOpen; + + if (self.settings.mode === 'single' && self.items.length) { + self.hideInput(); + self.$control_input.blur(); // close keyboard on iOS + } + + self.isOpen = false; + self.$dropdown.hide(); + self.setActiveOption(null); + self.refreshState(); + + if (trigger) self.trigger('dropdown_close', self.$dropdown); + }, + + /** + * Calculates and applies the appropriate + * position of the dropdown. + */ + positionDropdown: function() { + var $control = this.$control; + var offset = this.settings.dropdownParent === 'body' ? $control.offset() : $control.position(); + offset.top += $control.outerHeight(true); + + this.$dropdown.css({ + width : $control.outerWidth(), + top : offset.top, + left : offset.left + }); + }, + + /** + * Resets / clears all selected items + * from the control. + * + * @param {boolean} silent + */ + clear: function(silent) { + var self = this; + + if (!self.items.length) return; + self.$control.children(':not(input)').remove(); + self.items = []; + self.lastQuery = null; + self.setCaret(0); + self.setActiveItem(null); + self.updatePlaceholder(); + self.updateOriginalInput({silent: silent}); + self.refreshState(); + self.showInput(); + self.trigger('clear'); + }, + + /** + * A helper method for inserting an element + * at the current caret position. + * + * @param {object} $el + */ + insertAtCaret: function($el) { + var caret = Math.min(this.caretPos, this.items.length); + if (caret === 0) { + this.$control.prepend($el); + } else { + $(this.$control[0].childNodes[caret]).before($el); + } + this.setCaret(caret + 1); + }, + + /** + * Removes the current selected item(s). + * + * @param {object} e (optional) + * @returns {boolean} + */ + deleteSelection: function(e) { + var i, n, direction, selection, values, caret, option_select, $option_select, $tail; + var self = this; + + direction = (e && e.keyCode === KEY_BACKSPACE) ? -1 : 1; + selection = getSelection(self.$control_input[0]); + + if (self.$activeOption && !self.settings.hideSelected) { + option_select = self.getAdjacentOption(self.$activeOption, -1).attr('data-value'); + } + + // determine items that will be removed + values = []; + + if (self.$activeItems.length) { + $tail = self.$control.children('.active:' + (direction > 0 ? 'last' : 'first')); + caret = self.$control.children(':not(input)').index($tail); + if (direction > 0) { caret++; } + + for (i = 0, n = self.$activeItems.length; i < n; i++) { + values.push($(self.$activeItems[i]).attr('data-value')); + } + if (e) { + e.preventDefault(); + e.stopPropagation(); + } + } else if ((self.isFocused || self.settings.mode === 'single') && self.items.length) { + if (direction < 0 && selection.start === 0 && selection.length === 0) { + values.push(self.items[self.caretPos - 1]); + } else if (direction > 0 && selection.start === self.$control_input.val().length) { + values.push(self.items[self.caretPos]); + } + } + + // allow the callback to abort + if (!values.length || (typeof self.settings.onDelete === 'function' && self.settings.onDelete.apply(self, [values]) === false)) { + return false; + } + + // perform removal + if (typeof caret !== 'undefined') { + self.setCaret(caret); + } + while (values.length) { + self.removeItem(values.pop()); + } + + self.showInput(); + self.positionDropdown(); + self.refreshOptions(true); + + // select previous option + if (option_select) { + $option_select = self.getOption(option_select); + if ($option_select.length) { + self.setActiveOption($option_select); + } + } + + return true; + }, + + /** + * Selects the previous / next item (depending + * on the `direction` argument). + * + * > 0 - right + * < 0 - left + * + * @param {int} direction + * @param {object} e (optional) + */ + advanceSelection: function(direction, e) { + var tail, selection, idx, valueLength, cursorAtEdge, $tail; + var self = this; + + if (direction === 0) return; + if (self.rtl) direction *= -1; + + tail = direction > 0 ? 'last' : 'first'; + selection = getSelection(self.$control_input[0]); + + if (self.isFocused && !self.isInputHidden) { + valueLength = self.$control_input.val().length; + cursorAtEdge = direction < 0 + ? selection.start === 0 && selection.length === 0 + : selection.start === valueLength; + + if (cursorAtEdge && !valueLength) { + self.advanceCaret(direction, e); + } + } else { + $tail = self.$control.children('.active:' + tail); + if ($tail.length) { + idx = self.$control.children(':not(input)').index($tail); + self.setActiveItem(null); + self.setCaret(direction > 0 ? idx + 1 : idx); + } + } + }, + + /** + * Moves the caret left / right. + * + * @param {int} direction + * @param {object} e (optional) + */ + advanceCaret: function(direction, e) { + var self = this, fn, $adj; + + if (direction === 0) return; + + fn = direction > 0 ? 'next' : 'prev'; + if (self.isShiftDown) { + $adj = self.$control_input[fn](); + if ($adj.length) { + self.hideInput(); + self.setActiveItem($adj); + e && e.preventDefault(); + } + } else { + self.setCaret(self.caretPos + direction); + } + }, + + /** + * Moves the caret to the specified index. + * + * @param {int} i + */ + setCaret: function(i) { + var self = this; + + if (self.settings.mode === 'single') { + i = self.items.length; + } else { + i = Math.max(0, Math.min(self.items.length, i)); + } + + if(!self.isPending) { + // the input must be moved by leaving it in place and moving the + // siblings, due to the fact that focus cannot be restored once lost + // on mobile webkit devices + var j, n, fn, $children, $child; + $children = self.$control.children(':not(input)'); + for (j = 0, n = $children.length; j < n; j++) { + $child = $($children[j]).detach(); + if (j < i) { + self.$control_input.before($child); + } else { + self.$control.append($child); + } + } + } + + self.caretPos = i; + }, + + /** + * Disables user input on the control. Used while + * items are being asynchronously created. + */ + lock: function() { + this.close(); + this.isLocked = true; + this.refreshState(); + }, + + /** + * Re-enables user input on the control. + */ + unlock: function() { + this.isLocked = false; + this.refreshState(); + }, + + /** + * Disables user input on the control completely. + * While disabled, it cannot receive focus. + */ + disable: function() { + var self = this; + self.$input.prop('disabled', true); + self.$control_input.prop('disabled', true).prop('tabindex', -1); + self.isDisabled = true; + self.lock(); + }, + + /** + * Enables the control so that it can respond + * to focus and user input. + */ + enable: function() { + var self = this; + self.$input.prop('disabled', false); + self.$control_input.prop('disabled', false).prop('tabindex', self.tabIndex); + self.isDisabled = false; + self.unlock(); + }, + + /** + * Completely destroys the control and + * unbinds all event listeners so that it can + * be garbage collected. + */ + destroy: function() { + var self = this; + var eventNS = self.eventNS; + var revertSettings = self.revertSettings; + + self.trigger('destroy'); + self.off(); + self.$wrapper.remove(); + self.$dropdown.remove(); + + self.$input + .html('') + .append(revertSettings.$children) + .removeAttr('tabindex') + .removeClass('selectized') + .attr({tabindex: revertSettings.tabindex}) + .show(); + + self.$control_input.removeData('grow'); + self.$input.removeData('selectize'); + + $(window).off(eventNS); + $(document).off(eventNS); + $(document.body).off(eventNS); + + delete self.$input[0].selectize; + }, + + /** + * A helper method for rendering "item" and + * "option" templates, given the data. + * + * @param {string} templateName + * @param {object} data + * @returns {string} + */ + render: function(templateName, data) { + var value, id, label; + var html = ''; + var cache = false; + var self = this; + var regex_tag = /^[\t \r\n]*<([a-z][a-z0-9\-_]*(?:\:[a-z][a-z0-9\-_]*)?)/i; + + if (templateName === 'option' || templateName === 'item') { + value = hash_key(data[self.settings.valueField]); + cache = !!value; + } + + // pull markup from cache if it exists + if (cache) { + if (!isset(self.renderCache[templateName])) { + self.renderCache[templateName] = {}; + } + if (self.renderCache[templateName].hasOwnProperty(value)) { + return self.renderCache[templateName][value]; + } + } + + // render markup + html = $(self.settings.render[templateName].apply(this, [data, escape_html])); + + // add mandatory attributes + if (templateName === 'option' || templateName === 'option_create') { + html.attr('data-selectable', ''); + } + else if (templateName === 'optgroup') { + id = data[self.settings.optgroupValueField] || ''; + html.attr('data-group', id); + } + if (templateName === 'option' || templateName === 'item') { + html.attr('data-value', value || ''); + } + + // update cache + if (cache) { + self.renderCache[templateName][value] = html[0]; + } + + return html[0]; + }, + + /** + * Clears the render cache for a template. If + * no template is given, clears all render + * caches. + * + * @param {string} templateName + */ + clearCache: function(templateName) { + var self = this; + if (typeof templateName === 'undefined') { + self.renderCache = {}; + } else { + delete self.renderCache[templateName]; + } + }, + + /** + * Determines whether or not to display the + * create item prompt, given a user input. + * + * @param {string} input + * @return {boolean} + */ + canCreate: function(input) { + var self = this; + if (!self.settings.create) return false; + var filter = self.settings.createFilter; + return input.length + && (typeof filter !== 'function' || filter.apply(self, [input])) + && (typeof filter !== 'string' || new RegExp(filter).test(input)) + && (!(filter instanceof RegExp) || filter.test(input)); + } + + }); + + + Selectize.count = 0; + Selectize.defaults = { + options: [], + optgroups: [], + + plugins: [], + delimiter: ',', + splitOn: null, // regexp or string for splitting up values from a paste command + persist: true, + diacritics: true, + create: false, + createOnBlur: false, + createFilter: null, + highlight: true, + openOnFocus: true, + maxOptions: 1000, + maxItems: null, + hideSelected: null, + addPrecedence: false, + selectOnTab: false, + preload: false, + allowEmptyOption: false, + closeAfterSelect: false, + + scrollDuration: 60, + loadThrottle: 300, + loadingClass: 'loading', + + dataAttr: 'data-data', + optgroupField: 'optgroup', + valueField: 'value', + labelField: 'text', + optgroupLabelField: 'label', + optgroupValueField: 'value', + lockOptgroupOrder: false, + + sortField: '$order', + searchField: ['text'], + searchConjunction: 'and', + + mode: null, + wrapperClass: 'selectize-control', + inputClass: 'selectize-input', + dropdownClass: 'selectize-dropdown', + dropdownContentClass: 'selectize-dropdown-content', + + dropdownParent: null, + + copyClassesToDropdown: true, + + /* + load : null, // function(query, callback) { ... } + score : null, // function(search) { ... } + onInitialize : null, // function() { ... } + onChange : null, // function(value) { ... } + onItemAdd : null, // function(value, $item) { ... } + onItemRemove : null, // function(value) { ... } + onClear : null, // function() { ... } + onOptionAdd : null, // function(value, data) { ... } + onOptionRemove : null, // function(value) { ... } + onOptionClear : null, // function() { ... } + onOptionGroupAdd : null, // function(id, data) { ... } + onOptionGroupRemove : null, // function(id) { ... } + onOptionGroupClear : null, // function() { ... } + onDropdownOpen : null, // function($dropdown) { ... } + onDropdownClose : null, // function($dropdown) { ... } + onType : null, // function(str) { ... } + onDelete : null, // function(values) { ... } + */ + + render: { + /* + item: null, + optgroup: null, + optgroup_header: null, + option: null, + option_create: null + */ + } + }; + + + $.fn.selectize = function(settings_user) { + var defaults = $.fn.selectize.defaults; + var settings = $.extend({}, defaults, settings_user); + var attr_data = settings.dataAttr; + var field_label = settings.labelField; + var field_value = settings.valueField; + var field_optgroup = settings.optgroupField; + var field_optgroup_label = settings.optgroupLabelField; + var field_optgroup_value = settings.optgroupValueField; + + /** + * Initializes selectize from a element. + * + * @param {object} $input + * @param {object} settings_element + */ + var init_textbox = function($input, settings_element) { + var i, n, values, option; + + var data_raw = $input.attr(attr_data); + + if (!data_raw) { + var value = $.trim($input.val() || ''); + if (!settings.allowEmptyOption && !value.length) return; + values = value.split(settings.delimiter); + for (i = 0, n = values.length; i < n; i++) { + option = {}; + option[field_label] = values[i]; + option[field_value] = values[i]; + settings_element.options.push(option); + } + settings_element.items = values; + } else { + settings_element.options = JSON.parse(data_raw); + for (i = 0, n = settings_element.options.length; i < n; i++) { + settings_element.items.push(settings_element.options[i][field_value]); + } + } + }; + + /** + * Initializes selectize from a ').appendTo(ae).attr("tabindex",R.is(":disabled")?"-1":V.tabIndex);ab=v(ac.dropdownParent||aa);S=v("
    ").addClass(ac.dropdownClass).addClass(ah).hide().appendTo(ab);W=v("
    ").addClass(ac.dropdownContentClass).appendTo(S);if(Z=R.attr("id")){Q.attr("id",Z+"-selectized");v("label[for='"+Z+"']").attr("for",Z+"-selectized")}if(V.settings.copyClassesToDropdown){S.addClass(ad)}aa.css({width:R[0].style.width});if(V.plugins.names.length){X="plugin-"+V.plugins.names.join(" plugin-");aa.addClass(X);S.addClass(X)}if((ac.maxItems===null||ac.maxItems>1)&&V.tagType===k){R.attr("multiple","multiple")}if(V.settings.placeholder){Q.attr("placeholder",ac.placeholder)}if(!V.settings.splitOn&&V.settings.delimiter){var P=V.settings.delimiter.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&");V.settings.splitOn=new RegExp("\\s*"+P+"+\\s*")}if(R.attr("autocorrect")){Q.attr("autocorrect",R.attr("autocorrect"))}if(R.attr("autocapitalize")){Q.attr("autocapitalize",R.attr("autocapitalize"))}V.$wrapper=aa;V.$control=ae;V.$control_input=Q;V.$dropdown=S;V.$dropdown_content=W;S.on("mouseenter","[data-selectable]",function(){return V.onOptionHover.apply(V,arguments)});S.on("mousedown click","[data-selectable]",function(){return V.onOptionSelect.apply(V,arguments)});A(ae,"mousedown","*:not(input)",function(){return V.onItemSelect.apply(V,arguments)});L(Q);ae.on({mousedown:function(){return V.onMouseDown.apply(V,arguments)},click:function(){return V.onClick.apply(V,arguments)}});Q.on({mousedown:function(ai){ai.stopPropagation()},keydown:function(){return V.onKeyDown.apply(V,arguments)},keyup:function(){return V.onKeyUp.apply(V,arguments)},keypress:function(){return V.onKeyPress.apply(V,arguments)},resize:function(){V.positionDropdown.apply(V,[])},blur:function(){return V.onBlur.apply(V,arguments)},focus:function(){V.ignoreBlur=false;return V.onFocus.apply(V,arguments)},paste:function(){return V.onPaste.apply(V,arguments)}});ag.on("keydown"+Y,function(ai){V.isCmdDown=ai[b?"metaKey":"ctrlKey"];V.isCtrlDown=ai[b?"altKey":"ctrlKey"];V.isShiftDown=ai.shiftKey});ag.on("keyup"+Y,function(ai){if(ai.keyCode===e){V.isCtrlDown=false}if(ai.keyCode===j){V.isShiftDown=false}if(ai.keyCode===J){V.isCmdDown=false}});ag.on("mousedown"+Y,function(ai){if(V.isFocused){if(ai.target===V.$dropdown[0]||ai.target.parentNode===V.$dropdown[0]){return false}if(!V.$control.has(ai.target).length&&ai.target!==V.$control[0]){V.blur(ai.target)}}});U.on(["scroll"+Y,"resize"+Y].join(" "),function(){if(V.isOpen){V.positionDropdown.apply(V,arguments)}});U.on("mousemove"+Y,function(){V.ignoreHover=false});this.revertSettings={$children:R.children().detach(),tabindex:R.attr("tabindex")};R.attr("tabindex",-1).hide().after(V.$wrapper);if(v.isArray(ac.items)){V.setValue(ac.items);delete ac.items}if(C){R.on("invalid"+Y,function(ai){ai.preventDefault();V.isInvalid=true;V.refreshState()})}V.updateOriginalInput();V.refreshItems();V.refreshState();V.updatePlaceholder();V.isSetup=true;if(R.is(":disabled")){V.disable()}V.on("change",this.onChange);R.data("selectize",V);R.addClass("selectized");V.trigger("initialize");if(ac.preload===true){V.onSearchChange("")}},setupTemplates:function(){var Q=this;var P=Q.settings.labelField;var R=Q.settings.optgroupLabelField;var S={optgroup:function(T){return'
    '+T.html+"
    "},optgroup_header:function(U,T){return'
    '+T(U[R])+"
    "},option:function(U,T){return'
    '+T(U[P])+"
    "},item:function(U,T){return'
    '+T(U[P])+"
    "},option_create:function(U,T){return'
    Add '+T(U.input)+"
    "}};Q.settings.render=v.extend({},S,Q.settings.render)},setupCallbacks:function(){var P,Q,R={initialize:"onInitialize",change:"onChange",item_add:"onItemAdd",item_remove:"onItemRemove",clear:"onClear",option_add:"onOptionAdd",option_remove:"onOptionRemove",option_clear:"onOptionClear",optgroup_add:"onOptionGroupAdd",optgroup_remove:"onOptionGroupRemove",optgroup_clear:"onOptionGroupClear",dropdown_open:"onDropdownOpen",dropdown_close:"onDropdownClose",type:"onType",load:"onLoad",focus:"onFocus",blur:"onBlur"};for(P in R){if(R.hasOwnProperty(P)){Q=this.settings[R[P]];if(Q){this.on(P,Q)}}}},onClick:function(Q){var P=this;if(!P.isFocused){P.focus();Q.preventDefault()}},onMouseDown:function(S){var Q=this;var R=S.isDefaultPrevented();var P=v(S.target);if(Q.isFocused){if(S.target!==Q.$control_input[0]){if(Q.settings.mode==="single"){Q.isOpen?Q.close():Q.open()}else{if(!R){Q.setActiveItem(null)}}return false}}else{if(!R){window.setTimeout(function(){Q.focus()},0)}}},onChange:function(){this.$input.trigger("change")},onPaste:function(Q){var P=this;if(P.isFull()||P.isInputHidden||P.isLocked){Q.preventDefault();return}if(P.settings.splitOn){setTimeout(function(){var S=P.$control_input.val();if(!S.match(P.settings.splitOn)){return}var R=v.trim(S).split(P.settings.splitOn);for(var T=0,U=R.length;TR){Q=P;P=R;R=Q}for(S=P;S<=R;S++){Y=Z.$control[0].childNodes[S];if(Z.$activeItems.indexOf(Y)===-1){v(Y).addClass("active");Z.$activeItems.push(Y)}}U.preventDefault()}else{if((T==="mousedown"&&Z.isCtrlDown)||(T==="keydown"&&this.isShiftDown)){if(W.hasClass("active")){X=Z.$activeItems.indexOf(W[0]);Z.$activeItems.splice(X,1);W.removeClass("active")}else{Z.$activeItems.push(W.addClass("active")[0])}}else{v(Z.$activeItems).removeClass("active");Z.$activeItems=[W.addClass("active")[0]]}}Z.hideInput();if(!this.isFocused){Z.focus()}},setActiveOption:function(P,V,R){var Q,W,U;var T,S;var X=this;if(X.$activeOption){X.$activeOption.removeClass("active")}X.$activeOption=null;P=v(P);if(!P.length){return}X.$activeOption=P.addClass("active");if(V||!O(V)){Q=X.$dropdown_content.height();W=X.$activeOption.outerHeight(true);V=X.$dropdown_content.scrollTop()||0;U=X.$activeOption.offset().top-X.$dropdown_content.offset().top+V;T=U;S=U-Q+W;if(U+W>Q+V){X.$dropdown_content.stop().animate({scrollTop:S},R?X.settings.scrollDuration:0)}else{if(U=0;S--){if(V.items.indexOf(y(X.items[S].id))!==-1){X.items.splice(S,1)}}}return X},refreshOptions:function(Z){var ag,af,ae,ac,aj,P,V,ah,R,ad,T,ai,U;var S,Y,aa;if(typeof Z==="undefined"){Z=true}var X=this;var Q=v.trim(X.$control_input.val());var ab=X.search(Q);var W=X.$dropdown_content;var ak=X.$activeOption&&y(X.$activeOption.attr("data-value"));ac=ab.items.length;if(typeof X.settings.maxOptions==="number"){ac=Math.min(ac,X.settings.maxOptions)}aj={};P=[];for(ag=0;ag0||U;if(X.hasOptions){if(ab.items.length>0){Y=ak&&X.getOption(ak);if(Y&&Y.length){S=Y}else{if(X.settings.mode==="single"&&X.items.length){S=X.getOption(X.items[0])}}if(!S||!S.length){if(aa&&!X.settings.addPrecedence){S=X.getAdjacentOption(aa,1)}else{S=W.find("[data-selectable]:first")}}}else{S=aa}X.setActiveOption(S);if(Z&&!X.isOpen){X.open()}}else{X.setActiveOption(null);if(Z&&X.isOpen){X.close()}}},addOption:function(S){var Q,T,R,P=this;if(v.isArray(S)){for(Q=0,T=S.length;Q=0&&Q0);P.$control_input.data("grow",!Q&&!R)},isFull:function(){return this.settings.maxItems!==null&&this.items.length>=this.settings.maxItems},updateOriginalInput:function(T){var S,U,R,Q,P=this;T=T||{};if(P.tagType===k){R=[];for(S=0,U=P.items.length;S'+D(Q)+"")}if(!R.length&&!this.$input.attr("multiple")){R.push('')}P.$input.html(R.join(""))}else{P.$input.val(P.getValue());P.$input.attr("value",P.$input.val())}if(P.isSetup){if(!T.silent){P.trigger("change",P.$input.val())}}},updatePlaceholder:function(){if(!this.settings.placeholder){return}var P=this.$control_input;if(this.items.length){P.removeAttr("placeholder")}else{P.attr("placeholder",this.settings.placeholder)}P.triggerHandler("update",{force:true})},open:function(){var P=this;if(P.isLocked||P.isOpen||(P.settings.mode==="multi"&&P.isFull())){return}P.focus();P.isOpen=true;P.refreshState();P.$dropdown.css({visibility:"hidden",display:"block"});P.positionDropdown();P.$dropdown.css({visibility:"visible"});P.trigger("dropdown_open",P.$dropdown)},close:function(){var P=this;var Q=P.isOpen;if(P.settings.mode==="single"&&P.items.length){P.hideInput();P.$control_input.blur()}P.isOpen=false;P.$dropdown.hide();P.setActiveOption(null);P.refreshState();if(Q){P.trigger("dropdown_close",P.$dropdown)}},positionDropdown:function(){var P=this.$control;var Q=this.settings.dropdownParent==="body"?P.offset():P.position();Q.top+=P.outerHeight(true);this.$dropdown.css({width:P.outerWidth(),top:Q.top,left:Q.left})},clear:function(Q){var P=this;if(!P.items.length){return}P.$control.children(":not(input)").remove();P.items=[];P.lastQuery=null;P.setCaret(0);P.setActiveItem(null);P.updatePlaceholder();P.updateOriginalInput({silent:Q});P.refreshState();P.showInput();P.trigger("clear")},insertAtCaret:function(P){var Q=Math.min(this.caretPos,this.items.length);if(Q===0){this.$control.prepend(P)}else{v(this.$control[0].childNodes[Q]).before(P)}this.setCaret(Q+1)},deleteSelection:function(S){var Q,P,W,X,Y,U,T,V,R;var Z=this;W=(S&&S.keyCode===o)?-1:1;X=l(Z.$control_input[0]);if(Z.$activeOption&&!Z.settings.hideSelected){T=Z.getAdjacentOption(Z.$activeOption,-1).attr("data-value")}Y=[];if(Z.$activeItems.length){R=Z.$control.children(".active:"+(W>0?"last":"first"));U=Z.$control.children(":not(input)").index(R);if(W>0){U++}for(Q=0,P=Z.$activeItems.length;Q0&&X.start===Z.$control_input.val().length){Y.push(Z.items[Z.caretPos])}}}}if(!Y.length||(typeof Z.settings.onDelete==="function"&&Z.settings.onDelete.apply(Z,[Y])===false)){return false}if(typeof U!=="undefined"){Z.setCaret(U)}while(Y.length){Z.removeItem(Y.pop())}Z.showInput();Z.positionDropdown();Z.refreshOptions(true);if(T){V=Z.getOption(T);if(V.length){Z.setActiveOption(V)}}return true},advanceSelection:function(T,Q){var R,U,V,W,S,P;var X=this;if(T===0){return}if(X.rtl){T*=-1}R=T>0?"last":"first";U=l(X.$control_input[0]);if(X.isFocused&&!X.isInputHidden){W=X.$control_input.val().length;S=T<0?U.start===0&&U.length===0:U.start===W;if(S&&!W){X.advanceCaret(T,Q)}}else{P=X.$control.children(".active:"+R);if(P.length){V=X.$control.children(":not(input)").index(P);X.setActiveItem(null);X.setCaret(T>0?V+1:V)}}},advanceCaret:function(T,S){var P=this,R,Q;if(T===0){return}R=T>0?"next":"prev";if(P.isShiftDown){Q=P.$control_input[R]();if(Q.length){P.hideInput();P.setActiveItem(Q);S&&S.preventDefault()}}else{P.setCaret(P.caretPos+T)}},setCaret:function(S){var Q=this;if(Q.settings.mode==="single"){S=Q.items.length}else{S=Math.max(0,Math.min(Q.items.length,S))}if(!Q.isPending){var R,V,T,P,U;P=Q.$control.children(":not(input)");for(R=0,V=P.length;R
    '+R.title+'×
    ')}},Q);P.setup=(function(){var R=P.setup;return function(){R.apply(P,arguments);P.$dropdown_header=v(Q.html(Q));P.$dropdown.prepend(P.$dropdown_header)}})()});c.define("optgroup_columns",function(R){var Q=this;R=v.extend({equalizeWidth:true,equalizeHeight:true},R);this.getAdjacentOption=function(W,V){var T=W.closest("[data-group]").find("[data-selectable]");var U=T.index(W)+V;return U>=0&&U
    ';V=V.firstChild;U.body.appendChild(V);T=P.width=V.offsetWidth-V.clientWidth;U.body.removeChild(V)}return T};var S=function(){var U,Z,T,V,Y,X,W;W=v("[data-group]",Q.$dropdown_content);Z=W.length;if(!Z||!Q.$dropdown_content.width()){return}if(R.equalizeHeight){T=0;for(U=0;U1){Y=X-V*(Z-1);W.eq(Z-1).css({width:Y})}}};if(R.equalizeHeight||R.equalizeWidth){s.after(this,"positionDropdown",S);s.after(this,"refreshOptions",S)}});c.define("remove_button",function(P){P=v.extend({label:"×",title:"Remove",className:"remove",append:true},P);var Q=function(W,U){U.className="remove-single";var T=W;var V=''+U.label+"";var S=function(X,Y){return X+Y};W.setup=(function(){var X=T.setup;return function(){if(U.append){var aa=v(T.$input.context).attr("id");var Z=v("#"+aa);var Y=T.settings.render.item;T.settings.render.item=function(ab){return S(Y.apply(W,arguments),V)}}X.apply(W,arguments);W.$control.on("click","."+U.className,function(ab){ab.preventDefault();if(T.isLocked){return}T.clear()})}})()};var R=function(W,U){var T=W;var V=''+U.label+"";var S=function(X,Y){var Z=X.search(/(<\/[^>]+>\s*)$/);return X.substring(0,Z)+Y+X.substring(Z)};W.setup=(function(){var X=T.setup;return function(){if(U.append){var Y=T.settings.render.item;T.settings.render.item=function(Z){return S(Y.apply(W,arguments),V)}}X.apply(W,arguments);W.$control.on("click","."+U.className,function(aa){aa.preventDefault();if(T.isLocked){return}var Z=v(aa.currentTarget).parent();T.setActiveItem(Z);if(T.deleteSelection()){T.setCaret(T.items.length)}})}})()};if(this.settings.mode==="single"){Q(this,P);return}else{R(this,P)}});c.define("restore_on_backspace",function(Q){var P=this;Q.text=Q.text||function(R){return R[this.settings.labelField]};this.onKeyDown=(function(){var R=P.onKeyDown;return function(U){var S,T;if(U.keyCode===o&&this.$control_input.val()===""&&!this.$activeItems.length){S=this.caretPos-1;if(S>=0&&S + * + */ + +(function(root, factory) { + if (typeof define === 'function' && define.amd) { + define('sifter', factory); + } else if (typeof exports === 'object') { + module.exports = factory(); + } else { + root.Sifter = factory(); + } +}(this, function() { + + /** + * Textually searches arrays and hashes of objects + * by property (or multiple properties). Designed + * specifically for autocomplete. + * + * @constructor + * @param {array|object} items + * @param {object} items + */ + var Sifter = function(items, settings) { + this.items = items; + this.settings = settings || {diacritics: true}; + }; + + /** + * Splits a search string into an array of individual + * regexps to be used to match results. + * + * @param {string} query + * @returns {array} + */ + Sifter.prototype.tokenize = function(query) { + query = trim(String(query || '').toLowerCase()); + if (!query || !query.length) return []; + + var i, n, regex, letter; + var tokens = []; + var words = query.split(/ +/); + + for (i = 0, n = words.length; i < n; i++) { + regex = escape_regex(words[i]); + if (this.settings.diacritics) { + for (letter in DIACRITICS) { + if (DIACRITICS.hasOwnProperty(letter)) { + regex = regex.replace(new RegExp(letter, 'g'), DIACRITICS[letter]); + } + } + } + tokens.push({ + string : words[i], + regex : new RegExp(regex, 'i') + }); + } + + return tokens; + }; + + /** + * Iterates over arrays and hashes. + * + * ``` + * this.iterator(this.items, function(item, id) { + * // invoked for each item + * }); + * ``` + * + * @param {array|object} object + */ + Sifter.prototype.iterator = function(object, callback) { + var iterator; + if (is_array(object)) { + iterator = Array.prototype.forEach || function(callback) { + for (var i = 0, n = this.length; i < n; i++) { + callback(this[i], i, this); + } + }; + } else { + iterator = function(callback) { + for (var key in this) { + if (this.hasOwnProperty(key)) { + callback(this[key], key, this); + } + } + }; + } + + iterator.apply(object, [callback]); + }; + + /** + * Returns a function to be used to score individual results. + * + * Good matches will have a higher score than poor matches. + * If an item is not a match, 0 will be returned by the function. + * + * @param {object|string} search + * @param {object} options (optional) + * @returns {function} + */ + Sifter.prototype.getScoreFunction = function(search, options) { + var self, fields, tokens, token_count, nesting; + + self = this; + search = self.prepareSearch(search, options); + tokens = search.tokens; + fields = search.options.fields; + token_count = tokens.length; + nesting = search.options.nesting; + + /** + * Calculates how close of a match the + * given value is against a search token. + * + * @param {mixed} value + * @param {object} token + * @return {number} + */ + var scoreValue = function(value, token) { + var score, pos; + + if (!value) return 0; + value = String(value || ''); + pos = value.search(token.regex); + if (pos === -1) return 0; + score = token.string.length / value.length; + if (pos === 0) score += 0.5; + return score; + }; + + /** + * Calculates the score of an object + * against the search query. + * + * @param {object} token + * @param {object} data + * @return {number} + */ + var scoreObject = (function() { + var field_count = fields.length; + if (!field_count) { + return function() { return 0; }; + } + if (field_count === 1) { + return function(token, data) { + return scoreValue(getattr(data, fields[0], nesting), token); + }; + } + return function(token, data) { + for (var i = 0, sum = 0; i < field_count; i++) { + sum += scoreValue(getattr(data, fields[i], nesting), token); + } + return sum / field_count; + }; + })(); + + if (!token_count) { + return function() { return 0; }; + } + if (token_count === 1) { + return function(data) { + return scoreObject(tokens[0], data); + }; + } + + if (search.options.conjunction === 'and') { + return function(data) { + var score; + for (var i = 0, sum = 0; i < token_count; i++) { + score = scoreObject(tokens[i], data); + if (score <= 0) return 0; + sum += score; + } + return sum / token_count; + }; + } else { + return function(data) { + for (var i = 0, sum = 0; i < token_count; i++) { + sum += scoreObject(tokens[i], data); + } + return sum / token_count; + }; + } + }; + + /** + * Returns a function that can be used to compare two + * results, for sorting purposes. If no sorting should + * be performed, `null` will be returned. + * + * @param {string|object} search + * @param {object} options + * @return function(a,b) + */ + Sifter.prototype.getSortFunction = function(search, options) { + var i, n, self, field, fields, fields_count, multiplier, multipliers, get_field, implicit_score, sort; + + self = this; + search = self.prepareSearch(search, options); + sort = (!search.query && options.sort_empty) || options.sort; + + /** + * Fetches the specified sort field value + * from a search result item. + * + * @param {string} name + * @param {object} result + * @return {mixed} + */ + get_field = function(name, result) { + if (name === '$score') return result.score; + return getattr(self.items[result.id], name, options.nesting); + }; + + // parse options + fields = []; + if (sort) { + for (i = 0, n = sort.length; i < n; i++) { + if (search.query || sort[i].field !== '$score') { + fields.push(sort[i]); + } + } + } + + // the "$score" field is implied to be the primary + // sort field, unless it's manually specified + if (search.query) { + implicit_score = true; + for (i = 0, n = fields.length; i < n; i++) { + if (fields[i].field === '$score') { + implicit_score = false; + break; + } + } + if (implicit_score) { + fields.unshift({field: '$score', direction: 'desc'}); + } + } else { + for (i = 0, n = fields.length; i < n; i++) { + if (fields[i].field === '$score') { + fields.splice(i, 1); + break; + } + } + } + + multipliers = []; + for (i = 0, n = fields.length; i < n; i++) { + multipliers.push(fields[i].direction === 'desc' ? -1 : 1); + } + + // build function + fields_count = fields.length; + if (!fields_count) { + return null; + } else if (fields_count === 1) { + field = fields[0].field; + multiplier = multipliers[0]; + return function(a, b) { + return multiplier * cmp( + get_field(field, a), + get_field(field, b) + ); + }; + } else { + return function(a, b) { + var i, result, a_value, b_value, field; + for (i = 0; i < fields_count; i++) { + field = fields[i].field; + result = multipliers[i] * cmp( + get_field(field, a), + get_field(field, b) + ); + if (result) return result; + } + return 0; + }; + } + }; + + /** + * Parses a search query and returns an object + * with tokens and fields ready to be populated + * with results. + * + * @param {string} query + * @param {object} options + * @returns {object} + */ + Sifter.prototype.prepareSearch = function(query, options) { + if (typeof query === 'object') return query; + + options = extend({}, options); + + var option_fields = options.fields; + var option_sort = options.sort; + var option_sort_empty = options.sort_empty; + + if (option_fields && !is_array(option_fields)) options.fields = [option_fields]; + if (option_sort && !is_array(option_sort)) options.sort = [option_sort]; + if (option_sort_empty && !is_array(option_sort_empty)) options.sort_empty = [option_sort_empty]; + + return { + options : options, + query : String(query || '').toLowerCase(), + tokens : this.tokenize(query), + total : 0, + items : [] + }; + }; + + /** + * Searches through all items and returns a sorted array of matches. + * + * The `options` parameter can contain: + * + * - fields {string|array} + * - sort {array} + * - score {function} + * - filter {bool} + * - limit {integer} + * + * Returns an object containing: + * + * - options {object} + * - query {string} + * - tokens {array} + * - total {int} + * - items {array} + * + * @param {string} query + * @param {object} options + * @returns {object} + */ + Sifter.prototype.search = function(query, options) { + var self = this, value, score, search, calculateScore; + var fn_sort; + var fn_score; + + search = this.prepareSearch(query, options); + options = search.options; + query = search.query; + + // generate result scoring function + fn_score = options.score || self.getScoreFunction(search); + + // perform search and sort + if (query.length) { + self.iterator(self.items, function(item, id) { + score = fn_score(item); + if (options.filter === false || score > 0) { + search.items.push({'score': score, 'id': id}); + } + }); + } else { + self.iterator(self.items, function(item, id) { + search.items.push({'score': 1, 'id': id}); + }); + } + + fn_sort = self.getSortFunction(search, options); + if (fn_sort) search.items.sort(fn_sort); + + // apply limits + search.total = search.items.length; + if (typeof options.limit === 'number') { + search.items = search.items.slice(0, options.limit); + } + + return search; + }; + + // utilities + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + var cmp = function(a, b) { + if (typeof a === 'number' && typeof b === 'number') { + return a > b ? 1 : (a < b ? -1 : 0); + } + a = asciifold(String(a || '')); + b = asciifold(String(b || '')); + if (a > b) return 1; + if (b > a) return -1; + return 0; + }; + + var extend = function(a, b) { + var i, n, k, object; + for (i = 1, n = arguments.length; i < n; i++) { + object = arguments[i]; + if (!object) continue; + for (k in object) { + if (object.hasOwnProperty(k)) { + a[k] = object[k]; + } + } + } + return a; + }; + + /** + * A property getter resolving dot-notation + * @param {Object} obj The root object to fetch property on + * @param {String} name The optionally dotted property name to fetch + * @param {Boolean} nesting Handle nesting or not + * @return {Object} The resolved property value + */ + var getattr = function(obj, name, nesting) { + if (!obj || !name) return; + if (!nesting) return obj[name]; + var names = name.split("."); + while(names.length && (obj = obj[names.shift()])); + return obj; + }; + + var trim = function(str) { + return (str + '').replace(/^\s+|\s+$|/g, ''); + }; + + var escape_regex = function(str) { + return (str + '').replace(/([.?*+^$[\]\\(){}|-])/g, '\\$1'); + }; + + var is_array = Array.isArray || (typeof $ !== 'undefined' && $.isArray) || function(object) { + return Object.prototype.toString.call(object) === '[object Array]'; + }; + + var DIACRITICS = { + 'a': '[aḀḁĂăÂâǍǎȺⱥȦȧẠạÄäÀàÁáĀāÃãÅåąĄÃąĄ]', + 'b': '[b␢βΒB฿𐌁ᛒ]', + 'c': '[cĆćĈĉČčĊċC̄c̄ÇçḈḉȻȼƇƈɕᴄCc]', + 'd': '[dĎďḊḋḐḑḌḍḒḓḎḏĐđD̦d̦ƉɖƊɗƋƌᵭᶁᶑȡᴅDdð]', + 'e': '[eÉéÈèÊêḘḙĚěĔĕẼẽḚḛẺẻĖėËëĒēȨȩĘęᶒɆɇȄȅẾếỀềỄễỂểḜḝḖḗḔḕȆȇẸẹỆệⱸᴇEeɘǝƏƐε]', + 'f': '[fƑƒḞḟ]', + 'g': '[gɢ₲ǤǥĜĝĞğĢģƓɠĠġ]', + 'h': '[hĤĥĦħḨḩẖẖḤḥḢḣɦʰǶƕ]', + 'i': '[iÍíÌìĬĭÎîǏǐÏïḮḯĨĩĮįĪīỈỉȈȉȊȋỊịḬḭƗɨɨ̆ᵻᶖİiIıɪIi]', + 'j': '[jȷĴĵɈɉʝɟʲ]', + 'k': '[kƘƙꝀꝁḰḱǨǩḲḳḴḵκϰ₭]', + 'l': '[lŁłĽľĻļĹĺḶḷḸḹḼḽḺḻĿŀȽƚⱠⱡⱢɫɬᶅɭȴʟLl]', + 'n': '[nŃńǸǹŇňÑñṄṅŅņṆṇṊṋṈṉN̈n̈ƝɲȠƞᵰᶇɳȵɴNnŊŋ]', + 'o': '[oØøÖöÓóÒòÔôǑǒŐőŎŏȮȯỌọƟɵƠơỎỏŌōÕõǪǫȌȍՕօ]', + 'p': '[pṔṕṖṗⱣᵽƤƥᵱ]', + 'q': '[qꝖꝗʠɊɋꝘꝙq̃]', + 'r': '[rŔŕɌɍŘřŖŗṘṙȐȑȒȓṚṛⱤɽ]', + 's': '[sŚśṠṡṢṣꞨꞩŜŝŠšŞşȘșS̈s̈]', + 't': '[tŤťṪṫŢţṬṭƮʈȚțṰṱṮṯƬƭ]', + 'u': '[uŬŭɄʉỤụÜüÚúÙùÛûǓǔŰűŬŭƯưỦủŪūŨũŲųȔȕ∪]', + 'v': '[vṼṽṾṿƲʋꝞꝟⱱʋ]', + 'w': '[wẂẃẀẁŴŵẄẅẆẇẈẉ]', + 'x': '[xẌẍẊẋχ]', + 'y': '[yÝýỲỳŶŷŸÿỸỹẎẏỴỵɎɏƳƴ]', + 'z': '[zŹźẐẑŽžŻżẒẓẔẕƵƶ]' + }; + + var asciifold = (function() { + var i, n, k, chunk; + var foreignletters = ''; + var lookup = {}; + for (k in DIACRITICS) { + if (DIACRITICS.hasOwnProperty(k)) { + chunk = DIACRITICS[k].substring(2, DIACRITICS[k].length - 1); + foreignletters += chunk; + for (i = 0, n = chunk.length; i < n; i++) { + lookup[chunk.charAt(i)] = k; + } + } + } + var regexp = new RegExp('[' + foreignletters + ']', 'g'); + return function(str) { + return str.replace(regexp, function(foreignletter) { + return lookup[foreignletter]; + }).toLowerCase(); + }; + })(); + + + // export + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + return Sifter; +})); + + + +/** + * microplugin.js + * Copyright (c) 2013 Brian Reavis & contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this + * file except in compliance with the License. You may obtain a copy of the License at: + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under + * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF + * ANY KIND, either express or implied. See the License for the specific language + * governing permissions and limitations under the License. + * + * @author Brian Reavis + */ + +(function(root, factory) { + if (typeof define === 'function' && define.amd) { + define('microplugin', factory); + } else if (typeof exports === 'object') { + module.exports = factory(); + } else { + root.MicroPlugin = factory(); + } +}(this, function() { + var MicroPlugin = {}; + + MicroPlugin.mixin = function(Interface) { + Interface.plugins = {}; + + /** + * Initializes the listed plugins (with options). + * Acceptable formats: + * + * List (without options): + * ['a', 'b', 'c'] + * + * List (with options): + * [{'name': 'a', options: {}}, {'name': 'b', options: {}}] + * + * Hash (with options): + * {'a': { ... }, 'b': { ... }, 'c': { ... }} + * + * @param {mixed} plugins + */ + Interface.prototype.initializePlugins = function(plugins) { + var i, n, key; + var self = this; + var queue = []; + + self.plugins = { + names : [], + settings : {}, + requested : {}, + loaded : {} + }; + + if (utils.isArray(plugins)) { + for (i = 0, n = plugins.length; i < n; i++) { + if (typeof plugins[i] === 'string') { + queue.push(plugins[i]); + } else { + self.plugins.settings[plugins[i].name] = plugins[i].options; + queue.push(plugins[i].name); + } + } + } else if (plugins) { + for (key in plugins) { + if (plugins.hasOwnProperty(key)) { + self.plugins.settings[key] = plugins[key]; + queue.push(key); + } + } + } + + while (queue.length) { + self.require(queue.shift()); + } + }; + + Interface.prototype.loadPlugin = function(name) { + var self = this; + var plugins = self.plugins; + var plugin = Interface.plugins[name]; + + if (!Interface.plugins.hasOwnProperty(name)) { + throw new Error('Unable to find "' + name + '" plugin'); + } + + plugins.requested[name] = true; + plugins.loaded[name] = plugin.fn.apply(self, [self.plugins.settings[name] || {}]); + plugins.names.push(name); + }; + + /** + * Initializes a plugin. + * + * @param {string} name + */ + Interface.prototype.require = function(name) { + var self = this; + var plugins = self.plugins; + + if (!self.plugins.loaded.hasOwnProperty(name)) { + if (plugins.requested[name]) { + throw new Error('Plugin has circular dependency ("' + name + '")'); + } + self.loadPlugin(name); + } + + return plugins.loaded[name]; + }; + + /** + * Registers a plugin. + * + * @param {string} name + * @param {function} fn + */ + Interface.define = function(name, fn) { + Interface.plugins[name] = { + 'name' : name, + 'fn' : fn + }; + }; + }; + + var utils = { + isArray: Array.isArray || function(vArg) { + return Object.prototype.toString.call(vArg) === '[object Array]'; + } + }; + + return MicroPlugin; +})); + +/** + * selectize.js (v0.12.4) + * Copyright (c) 2013–2015 Brian Reavis & contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this + * file except in compliance with the License. You may obtain a copy of the License at: + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under + * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF + * ANY KIND, either express or implied. See the License for the specific language + * governing permissions and limitations under the License. + * + * @author Brian Reavis + */ + +/*jshint curly:false */ +/*jshint browser:true */ + +(function(root, factory) { + if (typeof define === 'function' && define.amd) { + define('selectize', ['jquery','sifter','microplugin'], factory); + } else if (typeof exports === 'object') { + module.exports = factory(require('jquery'), require('sifter'), require('microplugin')); + } else { + root.Selectize = factory(root.jQuery, root.Sifter, root.MicroPlugin); + } +}(this, function($, Sifter, MicroPlugin) { + 'use strict'; + + var highlight = function($element, pattern) { + if (typeof pattern === 'string' && !pattern.length) return; + var regex = (typeof pattern === 'string') ? new RegExp(pattern, 'i') : pattern; + + var highlight = function(node) { + var skip = 0; + if (node.nodeType === 3) { + var pos = node.data.search(regex); + if (pos >= 0 && node.data.length > 0) { + var match = node.data.match(regex); + var spannode = document.createElement('span'); + spannode.className = 'highlight'; + var middlebit = node.splitText(pos); + var endbit = middlebit.splitText(match[0].length); + var middleclone = middlebit.cloneNode(true); + spannode.appendChild(middleclone); + middlebit.parentNode.replaceChild(spannode, middlebit); + skip = 1; + } + } else if (node.nodeType === 1 && node.childNodes && !/(script|style)/i.test(node.tagName)) { + for (var i = 0; i < node.childNodes.length; ++i) { + i += highlight(node.childNodes[i]); + } + } + return skip; + }; + + return $element.each(function() { + highlight(this); + }); + }; + + /** + * removeHighlight fn copied from highlight v5 and + * edited to remove with() and pass js strict mode + */ + $.fn.removeHighlight = function() { + return this.find("span.highlight").each(function() { + this.parentNode.firstChild.nodeName; + var parent = this.parentNode; + parent.replaceChild(this.firstChild, this); + parent.normalize(); + }).end(); + }; + + + var MicroEvent = function() {}; + MicroEvent.prototype = { + on: function(event, fct){ + this._events = this._events || {}; + this._events[event] = this._events[event] || []; + this._events[event].push(fct); + }, + off: function(event, fct){ + var n = arguments.length; + if (n === 0) return delete this._events; + if (n === 1) return delete this._events[event]; + + this._events = this._events || {}; + if (event in this._events === false) return; + this._events[event].splice(this._events[event].indexOf(fct), 1); + }, + trigger: function(event /* , args... */){ + this._events = this._events || {}; + if (event in this._events === false) return; + for (var i = 0; i < this._events[event].length; i++){ + this._events[event][i].apply(this, Array.prototype.slice.call(arguments, 1)); + } + } + }; + + /** + * Mixin will delegate all MicroEvent.js function in the destination object. + * + * - MicroEvent.mixin(Foobar) will make Foobar able to use MicroEvent + * + * @param {object} the object which will support MicroEvent + */ + MicroEvent.mixin = function(destObject){ + var props = ['on', 'off', 'trigger']; + for (var i = 0; i < props.length; i++){ + destObject.prototype[props[i]] = MicroEvent.prototype[props[i]]; + } + }; + + var IS_MAC = /Mac/.test(navigator.userAgent); + + var KEY_A = 65; + var KEY_COMMA = 188; + var KEY_RETURN = 13; + var KEY_ESC = 27; + var KEY_LEFT = 37; + var KEY_UP = 38; + var KEY_P = 80; + var KEY_RIGHT = 39; + var KEY_DOWN = 40; + var KEY_N = 78; + var KEY_BACKSPACE = 8; + var KEY_DELETE = 46; + var KEY_SHIFT = 16; + var KEY_CMD = IS_MAC ? 91 : 17; + var KEY_CTRL = IS_MAC ? 18 : 17; + var KEY_TAB = 9; + + var TAG_SELECT = 1; + var TAG_INPUT = 2; + + // for now, android support in general is too spotty to support validity + var SUPPORTS_VALIDITY_API = !/android/i.test(window.navigator.userAgent) && !!document.createElement('input').validity; + + + var isset = function(object) { + return typeof object !== 'undefined'; + }; + + /** + * Converts a scalar to its best string representation + * for hash keys and HTML attribute values. + * + * Transformations: + * 'str' -> 'str' + * null -> '' + * undefined -> '' + * true -> '1' + * false -> '0' + * 0 -> '0' + * 1 -> '1' + * + * @param {string} value + * @returns {string|null} + */ + var hash_key = function(value) { + if (typeof value === 'undefined' || value === null) return null; + if (typeof value === 'boolean') return value ? '1' : '0'; + return value + ''; + }; + + /** + * Escapes a string for use within HTML. + * + * @param {string} str + * @returns {string} + */ + var escape_html = function(str) { + return (str + '') + .replace(/&/g, '&') + .replace(//g, '>') + .replace(/"/g, '"'); + }; + + /** + * Escapes "$" characters in replacement strings. + * + * @param {string} str + * @returns {string} + */ + var escape_replace = function(str) { + return (str + '').replace(/\$/g, '$$$$'); + }; + + var hook = {}; + + /** + * Wraps `method` on `self` so that `fn` + * is invoked before the original method. + * + * @param {object} self + * @param {string} method + * @param {function} fn + */ + hook.before = function(self, method, fn) { + var original = self[method]; + self[method] = function() { + fn.apply(self, arguments); + return original.apply(self, arguments); + }; + }; + + /** + * Wraps `method` on `self` so that `fn` + * is invoked after the original method. + * + * @param {object} self + * @param {string} method + * @param {function} fn + */ + hook.after = function(self, method, fn) { + var original = self[method]; + self[method] = function() { + var result = original.apply(self, arguments); + fn.apply(self, arguments); + return result; + }; + }; + + /** + * Wraps `fn` so that it can only be invoked once. + * + * @param {function} fn + * @returns {function} + */ + var once = function(fn) { + var called = false; + return function() { + if (called) return; + called = true; + fn.apply(this, arguments); + }; + }; + + /** + * Wraps `fn` so that it can only be called once + * every `delay` milliseconds (invoked on the falling edge). + * + * @param {function} fn + * @param {int} delay + * @returns {function} + */ + var debounce = function(fn, delay) { + var timeout; + return function() { + var self = this; + var args = arguments; + window.clearTimeout(timeout); + timeout = window.setTimeout(function() { + fn.apply(self, args); + }, delay); + }; + }; + + /** + * Debounce all fired events types listed in `types` + * while executing the provided `fn`. + * + * @param {object} self + * @param {array} types + * @param {function} fn + */ + var debounce_events = function(self, types, fn) { + var type; + var trigger = self.trigger; + var event_args = {}; + + // override trigger method + self.trigger = function() { + var type = arguments[0]; + if (types.indexOf(type) !== -1) { + event_args[type] = arguments; + } else { + return trigger.apply(self, arguments); + } + }; + + // invoke provided function + fn.apply(self, []); + self.trigger = trigger; + + // trigger queued events + for (type in event_args) { + if (event_args.hasOwnProperty(type)) { + trigger.apply(self, event_args[type]); + } + } + }; + + /** + * A workaround for http://bugs.jquery.com/ticket/6696 + * + * @param {object} $parent - Parent element to listen on. + * @param {string} event - Event name. + * @param {string} selector - Descendant selector to filter by. + * @param {function} fn - Event handler. + */ + var watchChildEvent = function($parent, event, selector, fn) { + $parent.on(event, selector, function(e) { + var child = e.target; + while (child && child.parentNode !== $parent[0]) { + child = child.parentNode; + } + e.currentTarget = child; + return fn.apply(this, [e]); + }); + }; + + /** + * Determines the current selection within a text input control. + * Returns an object containing: + * - start + * - length + * + * @param {object} input + * @returns {object} + */ + var getSelection = function(input) { + var result = {}; + if ('selectionStart' in input) { + result.start = input.selectionStart; + result.length = input.selectionEnd - result.start; + } else if (document.selection) { + input.focus(); + var sel = document.selection.createRange(); + var selLen = document.selection.createRange().text.length; + sel.moveStart('character', -input.value.length); + result.start = sel.text.length - selLen; + result.length = selLen; + } + return result; + }; + + /** + * Copies CSS properties from one element to another. + * + * @param {object} $from + * @param {object} $to + * @param {array} properties + */ + var transferStyles = function($from, $to, properties) { + var i, n, styles = {}; + if (properties) { + for (i = 0, n = properties.length; i < n; i++) { + styles[properties[i]] = $from.css(properties[i]); + } + } else { + styles = $from.css(); + } + $to.css(styles); + }; + + /** + * Measures the width of a string within a + * parent element (in pixels). + * + * @param {string} str + * @param {object} $parent + * @returns {int} + */ + var measureString = function(str, $parent) { + if (!str) { + return 0; + } + + var $test = $('').css({ + position: 'absolute', + top: -99999, + left: -99999, + width: 'auto', + padding: 0, + whiteSpace: 'pre' + }).text(str).appendTo('body'); + + transferStyles($parent, $test, [ + 'letterSpacing', + 'fontSize', + 'fontFamily', + 'fontWeight', + 'textTransform' + ]); + + var width = $test.width(); + $test.remove(); + + return width; + }; + + /** + * Sets up an input to grow horizontally as the user + * types. If the value is changed manually, you can + * trigger the "update" handler to resize: + * + * $input.trigger('update'); + * + * @param {object} $input + */ + var autoGrow = function($input) { + var currentWidth = null; + + var update = function(e, options) { + var value, keyCode, printable, placeholder, width; + var shift, character, selection; + e = e || window.event || {}; + options = options || {}; + + if (e.metaKey || e.altKey) return; + if (!options.force && $input.data('grow') === false) return; + + value = $input.val(); + if (e.type && e.type.toLowerCase() === 'keydown') { + keyCode = e.keyCode; + printable = ( + (keyCode >= 97 && keyCode <= 122) || // a-z + (keyCode >= 65 && keyCode <= 90) || // A-Z + (keyCode >= 48 && keyCode <= 57) || // 0-9 + keyCode === 32 // space + ); + + if (keyCode === KEY_DELETE || keyCode === KEY_BACKSPACE) { + selection = getSelection($input[0]); + if (selection.length) { + value = value.substring(0, selection.start) + value.substring(selection.start + selection.length); + } else if (keyCode === KEY_BACKSPACE && selection.start) { + value = value.substring(0, selection.start - 1) + value.substring(selection.start + 1); + } else if (keyCode === KEY_DELETE && typeof selection.start !== 'undefined') { + value = value.substring(0, selection.start) + value.substring(selection.start + 1); + } + } else if (printable) { + shift = e.shiftKey; + character = String.fromCharCode(e.keyCode); + if (shift) character = character.toUpperCase(); + else character = character.toLowerCase(); + value += character; + } + } + + placeholder = $input.attr('placeholder'); + if (!value && placeholder) { + value = placeholder; + } + + width = measureString(value, $input) + 4; + if (width !== currentWidth) { + currentWidth = width; + $input.width(width); + $input.triggerHandler('resize'); + } + }; + + $input.on('keydown keyup update blur', update); + update(); + }; + + var domToString = function(d) { + var tmp = document.createElement('div'); + + tmp.appendChild(d.cloneNode(true)); + + return tmp.innerHTML; + }; + + var logError = function(message, options){ + if(!options) options = {}; + var component = "Selectize"; + + console.error(component + ": " + message) + + if(options.explanation){ + // console.group is undefined in ').addClass(settings.wrapperClass).addClass(classes).addClass(inputMode); + $control = $('
    ').addClass(settings.inputClass).addClass('items').appendTo($wrapper); + $control_input = $('').appendTo($control).attr('tabindex', $input.is(':disabled') ? '-1' : self.tabIndex); + $dropdown_parent = $(settings.dropdownParent || $wrapper); + $dropdown = $('
    ').addClass(settings.dropdownClass).addClass(inputMode).hide().appendTo($dropdown_parent); + $dropdown_content = $('
    ').addClass(settings.dropdownContentClass).appendTo($dropdown); + + if(inputId = $input.attr('id')) { + $control_input.attr('id', inputId + '-selectized'); + $("label[for='"+inputId+"']").attr('for', inputId + '-selectized'); + } + + if(self.settings.copyClassesToDropdown) { + $dropdown.addClass(classes); + } + + $wrapper.css({ + width: $input[0].style.width + }); + + if (self.plugins.names.length) { + classes_plugins = 'plugin-' + self.plugins.names.join(' plugin-'); + $wrapper.addClass(classes_plugins); + $dropdown.addClass(classes_plugins); + } + + if ((settings.maxItems === null || settings.maxItems > 1) && self.tagType === TAG_SELECT) { + $input.attr('multiple', 'multiple'); + } + + if (self.settings.placeholder) { + $control_input.attr('placeholder', settings.placeholder); + } + + // if splitOn was not passed in, construct it from the delimiter to allow pasting universally + if (!self.settings.splitOn && self.settings.delimiter) { + var delimiterEscaped = self.settings.delimiter.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&'); + self.settings.splitOn = new RegExp('\\s*' + delimiterEscaped + '+\\s*'); + } + + if ($input.attr('autocorrect')) { + $control_input.attr('autocorrect', $input.attr('autocorrect')); + } + + if ($input.attr('autocapitalize')) { + $control_input.attr('autocapitalize', $input.attr('autocapitalize')); + } + + self.$wrapper = $wrapper; + self.$control = $control; + self.$control_input = $control_input; + self.$dropdown = $dropdown; + self.$dropdown_content = $dropdown_content; + + $dropdown.on('mouseenter', '[data-selectable]', function() { return self.onOptionHover.apply(self, arguments); }); + $dropdown.on('mousedown click', '[data-selectable]', function() { return self.onOptionSelect.apply(self, arguments); }); + watchChildEvent($control, 'mousedown', '*:not(input)', function() { return self.onItemSelect.apply(self, arguments); }); + autoGrow($control_input); + + $control.on({ + mousedown : function() { return self.onMouseDown.apply(self, arguments); }, + click : function() { return self.onClick.apply(self, arguments); } + }); + + $control_input.on({ + mousedown : function(e) { e.stopPropagation(); }, + keydown : function() { return self.onKeyDown.apply(self, arguments); }, + keyup : function() { return self.onKeyUp.apply(self, arguments); }, + keypress : function() { return self.onKeyPress.apply(self, arguments); }, + resize : function() { self.positionDropdown.apply(self, []); }, + blur : function() { return self.onBlur.apply(self, arguments); }, + focus : function() { self.ignoreBlur = false; return self.onFocus.apply(self, arguments); }, + paste : function() { return self.onPaste.apply(self, arguments); } + }); + + $document.on('keydown' + eventNS, function(e) { + self.isCmdDown = e[IS_MAC ? 'metaKey' : 'ctrlKey']; + self.isCtrlDown = e[IS_MAC ? 'altKey' : 'ctrlKey']; + self.isShiftDown = e.shiftKey; + }); + + $document.on('keyup' + eventNS, function(e) { + if (e.keyCode === KEY_CTRL) self.isCtrlDown = false; + if (e.keyCode === KEY_SHIFT) self.isShiftDown = false; + if (e.keyCode === KEY_CMD) self.isCmdDown = false; + }); + + $document.on('mousedown' + eventNS, function(e) { + if (self.isFocused) { + // prevent events on the dropdown scrollbar from causing the control to blur + if (e.target === self.$dropdown[0] || e.target.parentNode === self.$dropdown[0]) { + return false; + } + // blur on click outside + if (!self.$control.has(e.target).length && e.target !== self.$control[0]) { + self.blur(e.target); + } + } + }); + + $window.on(['scroll' + eventNS, 'resize' + eventNS].join(' '), function() { + if (self.isOpen) { + self.positionDropdown.apply(self, arguments); + } + }); + $window.on('mousemove' + eventNS, function() { + self.ignoreHover = false; + }); + + // store original children and tab index so that they can be + // restored when the destroy() method is called. + this.revertSettings = { + $children : $input.children().detach(), + tabindex : $input.attr('tabindex') + }; + + $input.attr('tabindex', -1).hide().after(self.$wrapper); + + if ($.isArray(settings.items)) { + self.setValue(settings.items); + delete settings.items; + } + + // feature detect for the validation API + if (SUPPORTS_VALIDITY_API) { + $input.on('invalid' + eventNS, function(e) { + e.preventDefault(); + self.isInvalid = true; + self.refreshState(); + }); + } + + self.updateOriginalInput(); + self.refreshItems(); + self.refreshState(); + self.updatePlaceholder(); + self.isSetup = true; + + if ($input.is(':disabled')) { + self.disable(); + } + + self.on('change', this.onChange); + + $input.data('selectize', self); + $input.addClass('selectized'); + self.trigger('initialize'); + + // preload options + if (settings.preload === true) { + self.onSearchChange(''); + } + + }, + + /** + * Sets up default rendering functions. + */ + setupTemplates: function() { + var self = this; + var field_label = self.settings.labelField; + var field_optgroup = self.settings.optgroupLabelField; + + var templates = { + 'optgroup': function(data) { + return '
    ' + data.html + '
    '; + }, + 'optgroup_header': function(data, escape) { + return '
    ' + escape(data[field_optgroup]) + '
    '; + }, + 'option': function(data, escape) { + return '
    ' + escape(data[field_label]) + '
    '; + }, + 'item': function(data, escape) { + return '
    ' + escape(data[field_label]) + '
    '; + }, + 'option_create': function(data, escape) { + return '
    Add ' + escape(data.input) + '
    '; + } + }; + + self.settings.render = $.extend({}, templates, self.settings.render); + }, + + /** + * Maps fired events to callbacks provided + * in the settings used when creating the control. + */ + setupCallbacks: function() { + var key, fn, callbacks = { + 'initialize' : 'onInitialize', + 'change' : 'onChange', + 'item_add' : 'onItemAdd', + 'item_remove' : 'onItemRemove', + 'clear' : 'onClear', + 'option_add' : 'onOptionAdd', + 'option_remove' : 'onOptionRemove', + 'option_clear' : 'onOptionClear', + 'optgroup_add' : 'onOptionGroupAdd', + 'optgroup_remove' : 'onOptionGroupRemove', + 'optgroup_clear' : 'onOptionGroupClear', + 'dropdown_open' : 'onDropdownOpen', + 'dropdown_close' : 'onDropdownClose', + 'type' : 'onType', + 'load' : 'onLoad', + 'focus' : 'onFocus', + 'blur' : 'onBlur' + }; + + for (key in callbacks) { + if (callbacks.hasOwnProperty(key)) { + fn = this.settings[callbacks[key]]; + if (fn) this.on(key, fn); + } + } + }, + + /** + * Triggered when the main control element + * has a click event. + * + * @param {object} e + * @return {boolean} + */ + onClick: function(e) { + var self = this; + + // necessary for mobile webkit devices (manual focus triggering + // is ignored unless invoked within a click event) + if (!self.isFocused) { + self.focus(); + e.preventDefault(); + } + }, + + /** + * Triggered when the main control element + * has a mouse down event. + * + * @param {object} e + * @return {boolean} + */ + onMouseDown: function(e) { + var self = this; + var defaultPrevented = e.isDefaultPrevented(); + var $target = $(e.target); + + if (self.isFocused) { + // retain focus by preventing native handling. if the + // event target is the input it should not be modified. + // otherwise, text selection within the input won't work. + if (e.target !== self.$control_input[0]) { + if (self.settings.mode === 'single') { + // toggle dropdown + self.isOpen ? self.close() : self.open(); + } else if (!defaultPrevented) { + self.setActiveItem(null); + } + return false; + } + } else { + // give control focus + if (!defaultPrevented) { + window.setTimeout(function() { + self.focus(); + }, 0); + } + } + }, + + /** + * Triggered when the value of the control has been changed. + * This should propagate the event to the original DOM + * input / select element. + */ + onChange: function() { + this.$input.trigger('change'); + }, + + /** + * Triggered on paste. + * + * @param {object} e + * @returns {boolean} + */ + onPaste: function(e) { + var self = this; + + if (self.isFull() || self.isInputHidden || self.isLocked) { + e.preventDefault(); + return; + } + + // If a regex or string is included, this will split the pasted + // input and create Items for each separate value + if (self.settings.splitOn) { + + // Wait for pasted text to be recognized in value + setTimeout(function() { + var pastedText = self.$control_input.val(); + if(!pastedText.match(self.settings.splitOn)){ return } + + var splitInput = $.trim(pastedText).split(self.settings.splitOn); + for (var i = 0, n = splitInput.length; i < n; i++) { + self.createItem(splitInput[i]); + } + }, 0); + } + }, + + /** + * Triggered on keypress. + * + * @param {object} e + * @returns {boolean} + */ + onKeyPress: function(e) { + if (this.isLocked) return e && e.preventDefault(); + var character = String.fromCharCode(e.keyCode || e.which); + if (this.settings.create && this.settings.mode === 'multi' && character === this.settings.delimiter) { + this.createItem(); + e.preventDefault(); + return false; + } + }, + + lastKeyDown: null, // RJC + + /** + * Triggered on keydown. + * + * @param {object} e + * @returns {boolean} + */ + onKeyDown: function(e) { + var isInput = e.target === this.$control_input[0]; + var self = this; + + if (self.isLocked) { + if (e.keyCode !== KEY_TAB) { + e.preventDefault(); + } + return; + } + + switch (e.keyCode) { + case KEY_A: + if (self.isCmdDown) { + self.selectAll(); + return; + } + break; + case KEY_ESC: + if (self.isOpen) { + e.preventDefault(); + e.stopPropagation(); + self.close(); + } + return; + case KEY_N: + if (!e.ctrlKey || e.altKey) break; + case KEY_DOWN: + if (!self.isOpen && self.hasOptions) { + self.open(); + } else if (self.$activeOption) { + self.ignoreHover = true; + var $next = self.getAdjacentOption(self.$activeOption, 1); + if ($next.length) self.setActiveOption($next, true, true); + } + e.preventDefault(); + return; + case KEY_P: + if (!e.ctrlKey || e.altKey) break; + case KEY_UP: + if (self.$activeOption) { + self.ignoreHover = true; + var $prev = self.getAdjacentOption(self.$activeOption, -1); + if ($prev.length) self.setActiveOption($prev, true, true); + } + e.preventDefault(); + return; + case KEY_RETURN: + if (self.isOpen && self.$activeOption) { + self.onOptionSelect({currentTarget: self.$activeOption}); + e.preventDefault(); + } + if(!self.settings.submitOnReturn) return false; // RJC + return; + case KEY_LEFT: + self.advanceSelection(-1, e); + return; + case KEY_RIGHT: + self.advanceSelection(1, e); + return; + case KEY_TAB: + if (self.settings.selectOnTab && self.isOpen && self.$activeOption) { + self.onOptionSelect({currentTarget: self.$activeOption}); + + // Default behaviour is to jump to the next field, we only want this + // if the current field doesn't accept any more entries + if (!self.isFull()) { + e.preventDefault(); + } + } + if (self.settings.create && self.createItem()) { + e.preventDefault(); + } + return; + case KEY_BACKSPACE: + case KEY_DELETE: + self.deleteSelection(e); + return; + } + + if ((self.isFull() || self.isInputHidden) && !(IS_MAC ? e.metaKey : e.ctrlKey)) { + e.preventDefault(); + return; + } + }, + + /** + * Triggered on keyup. + * + * @param {object} e + * @returns {boolean} + */ + onKeyUp: function(e) { + var self = this; + + if (self.isLocked) return e && e.preventDefault(); + var value = self.$control_input.val() || ''; + if (self.lastValue !== value) { + self.lastValue = value; + self.onSearchChange(value); + self.refreshOptions(); + self.trigger('type', value); + } + }, + + /** + * Invokes the user-provide option provider / loader. + * + * Note: this function is debounced in the Selectize + * constructor (by `settings.loadThrottle` milliseconds) + * + * @param {string} value + */ + onSearchChange: function(value) { + var self = this; + var fn = self.settings.load; + if (!fn) return; + if (self.loadedSearches.hasOwnProperty(value)) return; + self.loadedSearches[value] = true; + self.load(function(callback) { + fn.apply(self, [value, callback]); + }); + }, + + /** + * Triggered on focus. + * + * @param {object} e (optional) + * @returns {boolean} + */ + onFocus: function(e) { + var self = this; + var wasFocused = self.isFocused; + + if (self.isDisabled) { + self.blur(); + e && e.preventDefault(); + return false; + } + + if (self.ignoreFocus) return; + self.isFocused = true; + if (self.settings.preload === 'focus') self.onSearchChange(''); + + if (!wasFocused) self.trigger('focus'); + + if (!self.$activeItems.length) { + self.showInput(); + self.setActiveItem(null); + self.refreshOptions(!!self.settings.openOnFocus); + } + + self.refreshState(); + }, + + /** + * Triggered on blur. + * + * @param {object} e + * @param {Element} dest + */ + onBlur: function(e, dest) { + var self = this; + if (!self.isFocused) return; + self.isFocused = false; + + if (self.ignoreFocus) { + return; + } else if (!self.ignoreBlur && document.activeElement === self.$dropdown_content[0]) { + // necessary to prevent IE closing the dropdown when the scrollbar is clicked + self.ignoreBlur = true; + self.onFocus(e); + return; + } + + var deactivate = function() { + self.close(); + self.setTextboxValue(''); + self.setActiveItem(null); + self.setActiveOption(null); + self.setCaret(self.items.length); + self.refreshState(); + + // IE11 bug: element still marked as active + dest && dest.focus && dest.focus(); + + self.ignoreFocus = false; + self.trigger('blur'); + }; + + self.ignoreFocus = true; + if (self.settings.create && self.settings.createOnBlur) { + self.createItem(null, false, deactivate); + } else { + deactivate(); + } + }, + + /** + * Triggered when the user rolls over + * an option in the autocomplete dropdown menu. + * + * @param {object} e + * @returns {boolean} + */ + onOptionHover: function(e) { + if (this.ignoreHover) return; + this.setActiveOption(e.currentTarget, false); + }, + + /** + * Triggered when the user clicks on an option + * in the autocomplete dropdown menu. + * + * @param {object} e + * @returns {boolean} + */ + onOptionSelect: function(e) { + var value, $target, $option, self = this; + + if (e.preventDefault) { + e.preventDefault(); + e.stopPropagation(); + } + + $target = $(e.currentTarget); + if ($target.hasClass('create')) { + self.createItem(null, function() { + if (self.settings.closeAfterSelect) { + self.close(); + console.log('1'); + } + }); + } else { + value = $target.attr('data-value'); + if (typeof value !== 'undefined') { + self.lastQuery = null; + self.setTextboxValue(''); + self.addItem(value); + if (self.settings.closeAfterSelect) { + self.close(); + self.blur(); // RJC otherwise you have to manually blur and re-focus to see dropdown + } else if (!self.settings.hideSelected && e.type && /mouse/.test(e.type)) { + self.setActiveOption(self.getOption(value)); + } + } + } + }, + + /** + * Triggered when the user clicks on an item + * that has been selected. + * + * @param {object} e + * @returns {boolean} + */ + onItemSelect: function(e) { + var self = this; + + if (self.isLocked) return; + if (self.settings.mode === 'multi') { + e.preventDefault(); + self.setActiveItem(e.currentTarget, e); + } + }, + + /** + * Invokes the provided method that provides + * results to a callback---which are then added + * as options to the control. + * + * @param {function} fn + */ + load: function(fn) { + var self = this; + var $wrapper = self.$wrapper.addClass(self.settings.loadingClass); + + self.loading++; + fn.apply(self, [function(results) { + self.loading = Math.max(self.loading - 1, 0); + if (results && results.length) { + self.addOption(results); + self.refreshOptions(self.isFocused && !self.isInputHidden); + } + if (!self.loading) { + $wrapper.removeClass(self.settings.loadingClass); + } + self.trigger('load', results); + }]); + }, + + /** + * Sets the input field of the control to the specified value. + * + * @param {string} value + */ + setTextboxValue: function(value) { + var $input = this.$control_input; + var changed = $input.val() !== value; + if (changed) { + $input.val(value).triggerHandler('update'); + this.lastValue = value; + } + }, + + /** + * Returns the value of the control. If multiple items + * can be selected (e.g. or + * element to reflect the current state. + */ + updateOriginalInput: function(opts) { + var i, n, options, label, self = this; + opts = opts || {}; + + if (self.tagType === TAG_SELECT) { + options = []; + for (i = 0, n = self.items.length; i < n; i++) { + label = self.options[self.items[i]][self.settings.labelField] || ''; + options.push(''); + } + if (!options.length && !this.$input.attr('multiple')) { + options.push(''); + } + self.$input.html(options.join('')); + } else { + self.$input.val(self.getValue()); + self.$input.attr('value',self.$input.val()); + } + + if (self.isSetup) { + if (!opts.silent) { + self.trigger('change', self.$input.val()); + } + } + }, + + /** + * Shows/hide the input placeholder depending + * on if there items in the list already. + */ + updatePlaceholder: function() { + if (!this.settings.placeholder) return; + var $input = this.$control_input; + + if (this.items.length) { + $input.removeAttr('placeholder'); + } else { + $input.attr('placeholder', this.settings.placeholder); + } + $input.triggerHandler('update', {force: true}); + }, + + /** + * Shows the autocomplete dropdown containing + * the available options. + */ + open: function() { + var self = this; + + if (self.isLocked || self.isOpen || (self.settings.mode === 'multi' && self.isFull())) return; + self.focus(); + self.isOpen = true; + self.refreshState(); + self.$dropdown.css({visibility: 'hidden', display: 'block'}); + self.positionDropdown(); + self.$dropdown.css({visibility: 'visible'}); + self.trigger('dropdown_open', self.$dropdown); + }, + + /** + * Closes the autocomplete dropdown menu. + */ + close: function() { + var self = this; + var trigger = self.isOpen; + + if (self.settings.mode === 'single' && self.items.length) { + self.hideInput(); + self.$control_input.blur(); // close keyboard on iOS + } + + self.isOpen = false; + self.$dropdown.hide(); + self.setActiveOption(null); + self.refreshState(); + + if (trigger) self.trigger('dropdown_close', self.$dropdown); + }, + + /** + * Calculates and applies the appropriate + * position of the dropdown. + */ + positionDropdown: function() { + var $control = this.$control; + var offset = this.settings.dropdownParent === 'body' ? $control.offset() : $control.position(); + offset.top += $control.outerHeight(true); + + this.$dropdown.css({ + width : $control.outerWidth(), + top : offset.top, + left : offset.left + }); + }, + + /** + * Resets / clears all selected items + * from the control. + * + * @param {boolean} silent + */ + clear: function(silent) { + var self = this; + + if (!self.items.length) return; + self.$control.children(':not(input)').remove(); + self.items = []; + self.lastQuery = null; + self.setCaret(0); + self.setActiveItem(null); + self.updatePlaceholder(); + self.updateOriginalInput({silent: silent}); + self.refreshState(); + self.showInput(); + self.trigger('clear'); + }, + + /** + * A helper method for inserting an element + * at the current caret position. + * + * @param {object} $el + */ + insertAtCaret: function($el) { + var caret = Math.min(this.caretPos, this.items.length); + if (caret === 0) { + this.$control.prepend($el); + } else { + $(this.$control[0].childNodes[caret]).before($el); + } + this.setCaret(caret + 1); + }, + + /** + * Removes the current selected item(s). + * + * @param {object} e (optional) + * @returns {boolean} + */ + deleteSelection: function(e) { + var i, n, direction, selection, values, caret, option_select, $option_select, $tail; + var self = this; + + direction = (e && e.keyCode === KEY_BACKSPACE) ? -1 : 1; + selection = getSelection(self.$control_input[0]); + + if (self.$activeOption && !self.settings.hideSelected) { + option_select = self.getAdjacentOption(self.$activeOption, -1).attr('data-value'); + } + + // determine items that will be removed + values = []; + + if (self.$activeItems.length) { + $tail = self.$control.children('.active:' + (direction > 0 ? 'last' : 'first')); + caret = self.$control.children(':not(input)').index($tail); + if (direction > 0) { caret++; } + + for (i = 0, n = self.$activeItems.length; i < n; i++) { + values.push($(self.$activeItems[i]).attr('data-value')); + } + if (e) { + e.preventDefault(); + e.stopPropagation(); + } + } else if ((self.isFocused || self.settings.mode === 'single') && self.items.length) { + if (direction < 0 && selection.start === 0 && selection.length === 0) { + values.push(self.items[self.caretPos - 1]); + } else if (direction > 0 && selection.start === self.$control_input.val().length) { + values.push(self.items[self.caretPos]); + } + } + + // allow the callback to abort + if (!values.length || (typeof self.settings.onDelete === 'function' && self.settings.onDelete.apply(self, [values]) === false)) { + return false; + } + + // perform removal + if (typeof caret !== 'undefined') { + self.setCaret(caret); + } + while (values.length) { + self.removeItem(values.pop()); + } + + self.showInput(); + self.positionDropdown(); + self.refreshOptions(true); + + // select previous option + if (option_select) { + $option_select = self.getOption(option_select); + if ($option_select.length) { + self.setActiveOption($option_select); + } + } + + return true; + }, + + /** + * Selects the previous / next item (depending + * on the `direction` argument). + * + * > 0 - right + * < 0 - left + * + * @param {int} direction + * @param {object} e (optional) + */ + advanceSelection: function(direction, e) { + var tail, selection, idx, valueLength, cursorAtEdge, $tail; + var self = this; + + if (direction === 0) return; + if (self.rtl) direction *= -1; + + tail = direction > 0 ? 'last' : 'first'; + selection = getSelection(self.$control_input[0]); + + if (self.isFocused && !self.isInputHidden) { + valueLength = self.$control_input.val().length; + cursorAtEdge = direction < 0 + ? selection.start === 0 && selection.length === 0 + : selection.start === valueLength; + + if (cursorAtEdge && !valueLength) { + self.advanceCaret(direction, e); + } + } else { + $tail = self.$control.children('.active:' + tail); + if ($tail.length) { + idx = self.$control.children(':not(input)').index($tail); + self.setActiveItem(null); + self.setCaret(direction > 0 ? idx + 1 : idx); + } + } + }, + + /** + * Moves the caret left / right. + * + * @param {int} direction + * @param {object} e (optional) + */ + advanceCaret: function(direction, e) { + var self = this, fn, $adj; + + if (direction === 0) return; + + fn = direction > 0 ? 'next' : 'prev'; + if (self.isShiftDown) { + $adj = self.$control_input[fn](); + if ($adj.length) { + self.hideInput(); + self.setActiveItem($adj); + e && e.preventDefault(); + } + } else { + self.setCaret(self.caretPos + direction); + } + }, + + /** + * Moves the caret to the specified index. + * + * @param {int} i + */ + setCaret: function(i) { + var self = this; + + if (self.settings.mode === 'single') { + i = self.items.length; + } else { + i = Math.max(0, Math.min(self.items.length, i)); + } + + if(!self.isPending) { + // the input must be moved by leaving it in place and moving the + // siblings, due to the fact that focus cannot be restored once lost + // on mobile webkit devices + var j, n, fn, $children, $child; + $children = self.$control.children(':not(input)'); + for (j = 0, n = $children.length; j < n; j++) { + $child = $($children[j]).detach(); + if (j < i) { + self.$control_input.before($child); + } else { + self.$control.append($child); + } + } + } + + self.caretPos = i; + }, + + /** + * Disables user input on the control. Used while + * items are being asynchronously created. + */ + lock: function() { + this.close(); + this.isLocked = true; + this.refreshState(); + }, + + /** + * Re-enables user input on the control. + */ + unlock: function() { + this.isLocked = false; + this.refreshState(); + }, + + /** + * Disables user input on the control completely. + * While disabled, it cannot receive focus. + */ + disable: function() { + var self = this; + self.$input.prop('disabled', true); + self.$control_input.prop('disabled', true).prop('tabindex', -1); + self.isDisabled = true; + self.lock(); + }, + + /** + * Enables the control so that it can respond + * to focus and user input. + */ + enable: function() { + var self = this; + self.$input.prop('disabled', false); + self.$control_input.prop('disabled', false).prop('tabindex', self.tabIndex); + self.isDisabled = false; + self.unlock(); + }, + + /** + * Completely destroys the control and + * unbinds all event listeners so that it can + * be garbage collected. + */ + destroy: function() { + var self = this; + var eventNS = self.eventNS; + var revertSettings = self.revertSettings; + + self.trigger('destroy'); + self.off(); + self.$wrapper.remove(); + self.$dropdown.remove(); + + self.$input + .html('') + .append(revertSettings.$children) + .removeAttr('tabindex') + .removeClass('selectized') + .attr({tabindex: revertSettings.tabindex}) + .show(); + + self.$control_input.removeData('grow'); + self.$input.removeData('selectize'); + + $(window).off(eventNS); + $(document).off(eventNS); + $(document.body).off(eventNS); + + delete self.$input[0].selectize; + }, + + /** + * A helper method for rendering "item" and + * "option" templates, given the data. + * + * @param {string} templateName + * @param {object} data + * @returns {string} + */ + render: function(templateName, data) { + var value, id, label; + var html = ''; + var cache = false; + var self = this; + var regex_tag = /^[\t \r\n]*<([a-z][a-z0-9\-_]*(?:\:[a-z][a-z0-9\-_]*)?)/i; + + if (templateName === 'option' || templateName === 'item') { + value = hash_key(data[self.settings.valueField]); + cache = !!value; + } + + // pull markup from cache if it exists + if (cache) { + if (!isset(self.renderCache[templateName])) { + self.renderCache[templateName] = {}; + } + if (self.renderCache[templateName].hasOwnProperty(value)) { + return self.renderCache[templateName][value]; + } + } + + // render markup + html = $(self.settings.render[templateName].apply(this, [data, escape_html])); + + // add mandatory attributes + if (templateName === 'option' || templateName === 'option_create') { + html.attr('data-selectable', ''); + } + else if (templateName === 'optgroup') { + id = data[self.settings.optgroupValueField] || ''; + html.attr('data-group', id); + } + if (templateName === 'option' || templateName === 'item') { + html.attr('data-value', value || ''); + } + + // update cache + if (cache) { + self.renderCache[templateName][value] = html[0]; + } + + return html[0]; + }, + + /** + * Clears the render cache for a template. If + * no template is given, clears all render + * caches. + * + * @param {string} templateName + */ + clearCache: function(templateName) { + var self = this; + if (typeof templateName === 'undefined') { + self.renderCache = {}; + } else { + delete self.renderCache[templateName]; + } + }, + + /** + * Determines whether or not to display the + * create item prompt, given a user input. + * + * @param {string} input + * @return {boolean} + */ + canCreate: function(input) { + var self = this; + if (!self.settings.create) return false; + var filter = self.settings.createFilter; + return input.length + && (typeof filter !== 'function' || filter.apply(self, [input])) + && (typeof filter !== 'string' || new RegExp(filter).test(input)) + && (!(filter instanceof RegExp) || filter.test(input)); + } + + }); + + + Selectize.count = 0; + Selectize.defaults = { + options: [], + optgroups: [], + + plugins: [], + delimiter: ',', + splitOn: null, // regexp or string for splitting up values from a paste command + persist: true, + diacritics: true, + create: false, + createOnBlur: false, + createFilter: null, + highlight: true, + openOnFocus: true, + maxOptions: 1000, + maxItems: null, + hideSelected: null, + addPrecedence: false, + selectOnTab: false, + preload: false, + allowEmptyOption: false, + closeAfterSelect: false, + submitOnReturn: true, // RJC + + scrollDuration: 60, + loadThrottle: 300, + loadingClass: 'loading', + + dataAttr: 'data-data', + optgroupField: 'optgroup', + valueField: 'value', + labelField: 'text', + optgroupLabelField: 'label', + optgroupValueField: 'value', + lockOptgroupOrder: false, + + sortField: '$order', + searchField: ['text'], + searchConjunction: 'and', + + mode: null, + wrapperClass: 'selectize-control', + inputClass: 'selectize-input', + dropdownClass: 'selectize-dropdown', + dropdownContentClass: 'selectize-dropdown-content', + + dropdownParent: null, + + copyClassesToDropdown: true, + + /* + load : null, // function(query, callback) { ... } + score : null, // function(search) { ... } + onInitialize : null, // function() { ... } + onChange : null, // function(value) { ... } + onItemAdd : null, // function(value, $item) { ... } + onItemRemove : null, // function(value) { ... } + onClear : null, // function() { ... } + onOptionAdd : null, // function(value, data) { ... } + onOptionRemove : null, // function(value) { ... } + onOptionClear : null, // function() { ... } + onOptionGroupAdd : null, // function(id, data) { ... } + onOptionGroupRemove : null, // function(id) { ... } + onOptionGroupClear : null, // function() { ... } + onDropdownOpen : null, // function($dropdown) { ... } + onDropdownClose : null, // function($dropdown) { ... } + onType : null, // function(str) { ... } + onDelete : null, // function(values) { ... } + */ + + render: { + /* + item: null, + optgroup: null, + optgroup_header: null, + option: null, + option_create: null + */ + } + }; + + + $.fn.selectize = function(settings_user) { + var defaults = $.fn.selectize.defaults; + var settings = $.extend({}, defaults, settings_user); + var attr_data = settings.dataAttr; + var field_label = settings.labelField; + var field_value = settings.valueField; + var field_optgroup = settings.optgroupField; + var field_optgroup_label = settings.optgroupLabelField; + var field_optgroup_value = settings.optgroupValueField; + + /** + * Initializes selectize from a element. + * + * @param {object} $input + * @param {object} settings_element + */ + var init_textbox = function($input, settings_element) { + var i, n, values, option; + + var data_raw = $input.attr(attr_data); + + if (!data_raw) { + var value = $.trim($input.val() || ''); + if (!settings.allowEmptyOption && !value.length) return; + values = value.split(settings.delimiter); + for (i = 0, n = values.length; i < n; i++) { + option = {}; + option[field_label] = values[i]; + option[field_value] = values[i]; + settings_element.options.push(option); + } + settings_element.items = values; + } else { + settings_element.options = JSON.parse(data_raw); + for (i = 0, n = settings_element.options.length; i < n; i++) { + settings_element.items.push(settings_element.options[i][field_value]); + } + } + }; + + /** + * Initializes selectize from a ').appendTo(ae).attr("tabindex",R.is(":disabled")?"-1":V.tabIndex);ab=v(ac.dropdownParent||aa);S=v("
    ").addClass(ac.dropdownClass).addClass(ah).hide().appendTo(ab);W=v("
    ").addClass(ac.dropdownContentClass).appendTo(S);if(Z=R.attr("id")){Q.attr("id",Z+"-selectized");v("label[for='"+Z+"']").attr("for",Z+"-selectized")}if(V.settings.copyClassesToDropdown){S.addClass(ad)}aa.css({width:R[0].style.width});if(V.plugins.names.length){X="plugin-"+V.plugins.names.join(" plugin-");aa.addClass(X);S.addClass(X)}if((ac.maxItems===null||ac.maxItems>1)&&V.tagType===k){R.attr("multiple","multiple")}if(V.settings.placeholder){Q.attr("placeholder",ac.placeholder)}if(!V.settings.splitOn&&V.settings.delimiter){var P=V.settings.delimiter.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&");V.settings.splitOn=new RegExp("\\s*"+P+"+\\s*")}if(R.attr("autocorrect")){Q.attr("autocorrect",R.attr("autocorrect"))}if(R.attr("autocapitalize")){Q.attr("autocapitalize",R.attr("autocapitalize"))}V.$wrapper=aa;V.$control=ae;V.$control_input=Q;V.$dropdown=S;V.$dropdown_content=W;S.on("mouseenter","[data-selectable]",function(){return V.onOptionHover.apply(V,arguments)});S.on("mousedown click","[data-selectable]",function(){return V.onOptionSelect.apply(V,arguments)});A(ae,"mousedown","*:not(input)",function(){return V.onItemSelect.apply(V,arguments)});L(Q);ae.on({mousedown:function(){return V.onMouseDown.apply(V,arguments)},click:function(){return V.onClick.apply(V,arguments)}});Q.on({mousedown:function(ai){ai.stopPropagation()},keydown:function(){return V.onKeyDown.apply(V,arguments)},keyup:function(){return V.onKeyUp.apply(V,arguments)},keypress:function(){return V.onKeyPress.apply(V,arguments)},resize:function(){V.positionDropdown.apply(V,[])},blur:function(){return V.onBlur.apply(V,arguments)},focus:function(){V.ignoreBlur=false;return V.onFocus.apply(V,arguments)},paste:function(){return V.onPaste.apply(V,arguments)}});ag.on("keydown"+Y,function(ai){V.isCmdDown=ai[b?"metaKey":"ctrlKey"];V.isCtrlDown=ai[b?"altKey":"ctrlKey"];V.isShiftDown=ai.shiftKey});ag.on("keyup"+Y,function(ai){if(ai.keyCode===e){V.isCtrlDown=false}if(ai.keyCode===j){V.isShiftDown=false}if(ai.keyCode===J){V.isCmdDown=false}});ag.on("mousedown"+Y,function(ai){if(V.isFocused){if(ai.target===V.$dropdown[0]||ai.target.parentNode===V.$dropdown[0]){return false}if(!V.$control.has(ai.target).length&&ai.target!==V.$control[0]){V.blur(ai.target)}}});U.on(["scroll"+Y,"resize"+Y].join(" "),function(){if(V.isOpen){V.positionDropdown.apply(V,arguments)}});U.on("mousemove"+Y,function(){V.ignoreHover=false});this.revertSettings={$children:R.children().detach(),tabindex:R.attr("tabindex")};R.attr("tabindex",-1).hide().after(V.$wrapper);if(v.isArray(ac.items)){V.setValue(ac.items);delete ac.items}if(C){R.on("invalid"+Y,function(ai){ai.preventDefault();V.isInvalid=true;V.refreshState()})}V.updateOriginalInput();V.refreshItems();V.refreshState();V.updatePlaceholder();V.isSetup=true;if(R.is(":disabled")){V.disable()}V.on("change",this.onChange);R.data("selectize",V);R.addClass("selectized");V.trigger("initialize");if(ac.preload===true){V.onSearchChange("")}},setupTemplates:function(){var Q=this;var P=Q.settings.labelField;var R=Q.settings.optgroupLabelField;var S={optgroup:function(T){return'
    '+T.html+"
    "},optgroup_header:function(U,T){return'
    '+T(U[R])+"
    "},option:function(U,T){return'
    '+T(U[P])+"
    "},item:function(U,T){return'
    '+T(U[P])+"
    "},option_create:function(U,T){return'
    Add '+T(U.input)+"
    "}};Q.settings.render=v.extend({},S,Q.settings.render)},setupCallbacks:function(){var P,Q,R={initialize:"onInitialize",change:"onChange",item_add:"onItemAdd",item_remove:"onItemRemove",clear:"onClear",option_add:"onOptionAdd",option_remove:"onOptionRemove",option_clear:"onOptionClear",optgroup_add:"onOptionGroupAdd",optgroup_remove:"onOptionGroupRemove",optgroup_clear:"onOptionGroupClear",dropdown_open:"onDropdownOpen",dropdown_close:"onDropdownClose",type:"onType",load:"onLoad",focus:"onFocus",blur:"onBlur"};for(P in R){if(R.hasOwnProperty(P)){Q=this.settings[R[P]];if(Q){this.on(P,Q)}}}},onClick:function(Q){var P=this;if(!P.isFocused){P.focus();Q.preventDefault()}},onMouseDown:function(S){var Q=this;var R=S.isDefaultPrevented();var P=v(S.target);if(Q.isFocused){if(S.target!==Q.$control_input[0]){if(Q.settings.mode==="single"){Q.isOpen?Q.close():Q.open()}else{if(!R){Q.setActiveItem(null)}}return false}}else{if(!R){window.setTimeout(function(){Q.focus()},0)}}},onChange:function(){this.$input.trigger("change")},onPaste:function(Q){var P=this;if(P.isFull()||P.isInputHidden||P.isLocked){Q.preventDefault();return}if(P.settings.splitOn){setTimeout(function(){var S=P.$control_input.val();if(!S.match(P.settings.splitOn)){return}var R=v.trim(S).split(P.settings.splitOn);for(var T=0,U=R.length;TR){Q=P;P=R;R=Q}for(S=P;S<=R;S++){Y=Z.$control[0].childNodes[S];if(Z.$activeItems.indexOf(Y)===-1){v(Y).addClass("active");Z.$activeItems.push(Y)}}U.preventDefault()}else{if((T==="mousedown"&&Z.isCtrlDown)||(T==="keydown"&&this.isShiftDown)){if(W.hasClass("active")){X=Z.$activeItems.indexOf(W[0]);Z.$activeItems.splice(X,1);W.removeClass("active")}else{Z.$activeItems.push(W.addClass("active")[0])}}else{v(Z.$activeItems).removeClass("active");Z.$activeItems=[W.addClass("active")[0]]}}Z.hideInput();if(!this.isFocused){Z.focus()}},setActiveOption:function(P,V,R){var Q,W,U;var T,S;var X=this;if(X.$activeOption){X.$activeOption.removeClass("active")}X.$activeOption=null;P=v(P);if(!P.length){return}X.$activeOption=P.addClass("active");if(V||!O(V)){Q=X.$dropdown_content.height();W=X.$activeOption.outerHeight(true);V=X.$dropdown_content.scrollTop()||0;U=X.$activeOption.offset().top-X.$dropdown_content.offset().top+V;T=U;S=U-Q+W;if(U+W>Q+V){X.$dropdown_content.stop().animate({scrollTop:S},R?X.settings.scrollDuration:0)}else{if(U=0;S--){if(V.items.indexOf(y(X.items[S].id))!==-1){X.items.splice(S,1)}}}return X},refreshOptions:function(Z){var ag,af,ae,ac,aj,P,V,ah,R,ad,T,ai,U;var S,Y,aa;if(typeof Z==="undefined"){Z=true}var X=this;var Q=v.trim(X.$control_input.val());var ab=X.search(Q);var W=X.$dropdown_content;var ak=X.$activeOption&&y(X.$activeOption.attr("data-value"));ac=ab.items.length;if(typeof X.settings.maxOptions==="number"){ac=Math.min(ac,X.settings.maxOptions)}aj={};P=[];for(ag=0;ag0||U;if(X.hasOptions){if(ab.items.length>0){Y=ak&&X.getOption(ak);if(Y&&Y.length){S=Y}else{if(X.settings.mode==="single"&&X.items.length){S=X.getOption(X.items[0])}}if(!S||!S.length){if(aa&&!X.settings.addPrecedence){S=X.getAdjacentOption(aa,1)}else{S=W.find("[data-selectable]:first")}}}else{S=aa}X.setActiveOption(S);if(Z&&!X.isOpen){X.open()}}else{X.setActiveOption(null);if(Z&&X.isOpen){X.close()}}},addOption:function(S){var Q,T,R,P=this;if(v.isArray(S)){for(Q=0,T=S.length;Q=0&&Q0);P.$control_input.data("grow",!Q&&!R)},isFull:function(){return this.settings.maxItems!==null&&this.items.length>=this.settings.maxItems},updateOriginalInput:function(T){var S,U,R,Q,P=this;T=T||{};if(P.tagType===k){R=[];for(S=0,U=P.items.length;S'+D(Q)+"")}if(!R.length&&!this.$input.attr("multiple")){R.push('')}P.$input.html(R.join(""))}else{P.$input.val(P.getValue());P.$input.attr("value",P.$input.val())}if(P.isSetup){if(!T.silent){P.trigger("change",P.$input.val())}}},updatePlaceholder:function(){if(!this.settings.placeholder){return}var P=this.$control_input;if(this.items.length){P.removeAttr("placeholder")}else{P.attr("placeholder",this.settings.placeholder)}P.triggerHandler("update",{force:true})},open:function(){var P=this;if(P.isLocked||P.isOpen||(P.settings.mode==="multi"&&P.isFull())){return}P.focus();P.isOpen=true;P.refreshState();P.$dropdown.css({visibility:"hidden",display:"block"});P.positionDropdown();P.$dropdown.css({visibility:"visible"});P.trigger("dropdown_open",P.$dropdown)},close:function(){var P=this;var Q=P.isOpen;if(P.settings.mode==="single"&&P.items.length){P.hideInput();P.$control_input.blur()}P.isOpen=false;P.$dropdown.hide();P.setActiveOption(null);P.refreshState();if(Q){P.trigger("dropdown_close",P.$dropdown)}},positionDropdown:function(){var P=this.$control;var Q=this.settings.dropdownParent==="body"?P.offset():P.position();Q.top+=P.outerHeight(true);this.$dropdown.css({width:P.outerWidth(),top:Q.top,left:Q.left})},clear:function(Q){var P=this;if(!P.items.length){return}P.$control.children(":not(input)").remove();P.items=[];P.lastQuery=null;P.setCaret(0);P.setActiveItem(null);P.updatePlaceholder();P.updateOriginalInput({silent:Q});P.refreshState();P.showInput();P.trigger("clear")},insertAtCaret:function(P){var Q=Math.min(this.caretPos,this.items.length);if(Q===0){this.$control.prepend(P)}else{v(this.$control[0].childNodes[Q]).before(P)}this.setCaret(Q+1)},deleteSelection:function(S){var Q,P,W,X,Y,U,T,V,R;var Z=this;W=(S&&S.keyCode===o)?-1:1;X=l(Z.$control_input[0]);if(Z.$activeOption&&!Z.settings.hideSelected){T=Z.getAdjacentOption(Z.$activeOption,-1).attr("data-value")}Y=[];if(Z.$activeItems.length){R=Z.$control.children(".active:"+(W>0?"last":"first"));U=Z.$control.children(":not(input)").index(R);if(W>0){U++}for(Q=0,P=Z.$activeItems.length;Q0&&X.start===Z.$control_input.val().length){Y.push(Z.items[Z.caretPos])}}}}if(!Y.length||(typeof Z.settings.onDelete==="function"&&Z.settings.onDelete.apply(Z,[Y])===false)){return false}if(typeof U!=="undefined"){Z.setCaret(U)}while(Y.length){Z.removeItem(Y.pop())}Z.showInput();Z.positionDropdown();Z.refreshOptions(true);if(T){V=Z.getOption(T);if(V.length){Z.setActiveOption(V)}}return true},advanceSelection:function(T,Q){var R,U,V,W,S,P;var X=this;if(T===0){return}if(X.rtl){T*=-1}R=T>0?"last":"first";U=l(X.$control_input[0]);if(X.isFocused&&!X.isInputHidden){W=X.$control_input.val().length;S=T<0?U.start===0&&U.length===0:U.start===W;if(S&&!W){X.advanceCaret(T,Q)}}else{P=X.$control.children(".active:"+R);if(P.length){V=X.$control.children(":not(input)").index(P);X.setActiveItem(null);X.setCaret(T>0?V+1:V)}}},advanceCaret:function(T,S){var P=this,R,Q;if(T===0){return}R=T>0?"next":"prev";if(P.isShiftDown){Q=P.$control_input[R]();if(Q.length){P.hideInput();P.setActiveItem(Q);S&&S.preventDefault()}}else{P.setCaret(P.caretPos+T)}},setCaret:function(S){var Q=this;if(Q.settings.mode==="single"){S=Q.items.length}else{S=Math.max(0,Math.min(Q.items.length,S))}if(!Q.isPending){var R,V,T,P,U;P=Q.$control.children(":not(input)");for(R=0,V=P.length;R
    '+R.title+'×
    ')}},Q);P.setup=(function(){var R=P.setup;return function(){R.apply(P,arguments);P.$dropdown_header=v(Q.html(Q));P.$dropdown.prepend(P.$dropdown_header)}})()});c.define("optgroup_columns",function(R){var Q=this;R=v.extend({equalizeWidth:true,equalizeHeight:true},R);this.getAdjacentOption=function(W,V){var T=W.closest("[data-group]").find("[data-selectable]");var U=T.index(W)+V;return U>=0&&U
    ';V=V.firstChild;U.body.appendChild(V);T=P.width=V.offsetWidth-V.clientWidth;U.body.removeChild(V)}return T};var S=function(){var U,Z,T,V,Y,X,W;W=v("[data-group]",Q.$dropdown_content);Z=W.length;if(!Z||!Q.$dropdown_content.width()){return}if(R.equalizeHeight){T=0;for(U=0;U1){Y=X-V*(Z-1);W.eq(Z-1).css({width:Y})}}};if(R.equalizeHeight||R.equalizeWidth){s.after(this,"positionDropdown",S);s.after(this,"refreshOptions",S)}});c.define("remove_button",function(P){P=v.extend({label:"×",title:"Remove",className:"remove",append:true},P);var Q=function(W,U){U.className="remove-single";var T=W;var V=''+U.label+"";var S=function(X,Y){return X+Y};W.setup=(function(){var X=T.setup;return function(){if(U.append){var aa=v(T.$input.context).attr("id");var Z=v("#"+aa);var Y=T.settings.render.item;T.settings.render.item=function(ab){return S(Y.apply(W,arguments),V)}}X.apply(W,arguments);W.$control.on("click","."+U.className,function(ab){ab.preventDefault();if(T.isLocked){return}T.clear()})}})()};var R=function(W,U){var T=W;var V=''+U.label+"";var S=function(X,Y){var Z=X.search(/(<\/[^>]+>\s*)$/);return X.substring(0,Z)+Y+X.substring(Z)};W.setup=(function(){var X=T.setup;return function(){if(U.append){var Y=T.settings.render.item;T.settings.render.item=function(Z){return S(Y.apply(W,arguments),V)}}X.apply(W,arguments);W.$control.on("click","."+U.className,function(aa){aa.preventDefault();if(T.isLocked){return}var Z=v(aa.currentTarget).parent();T.setActiveItem(Z);if(T.deleteSelection()){T.setCaret(T.items.length)}})}})()};if(this.settings.mode==="single"){Q(this,P);return}else{R(this,P)}});c.define("restore_on_backspace",function(Q){var P=this;Q.text=Q.text||function(R){return R[this.settings.labelField]};this.onKeyDown=(function(){var R=P.onKeyDown;return function(U){var S,T;if(U.keyCode===o&&this.$control_input.val()===""&&!this.$activeItems.length){S=this.caretPos-1;if(S>=0&&S .selectize-input > div.ui-sortable-placeholder { + visibility: visible !important; + background: #f2f2f2 !important; + background: rgba(0,0,0,0.06) !important; + border: 0 none !important; + .selectize-box-shadow(inset 0 0 12px 4px #fff); + } + .ui-sortable-placeholder::after { + content: '!'; + visibility: hidden; + } + .ui-sortable-helper { + .selectize-box-shadow(0 2px 5px rgba(0,0,0,0.2)); + } +} \ No newline at end of file diff --git a/wire/modules/Jquery/JqueryUI/selectize/less/plugins/dropdown_header.less b/wire/modules/Jquery/JqueryUI/selectize/less/plugins/dropdown_header.less new file mode 100755 index 00000000..c3e777e1 --- /dev/null +++ b/wire/modules/Jquery/JqueryUI/selectize/less/plugins/dropdown_header.less @@ -0,0 +1,20 @@ +.selectize-dropdown-header { + position: relative; + padding: @selectize-padding-dropdown-item-y @selectize-padding-dropdown-item-x; + border-bottom: 1px solid @selectize-color-border; + background: mix(@selectize-color-dropdown, @selectize-color-border, 85%); + .selectize-border-radius(@selectize-border-radius @selectize-border-radius 0 0); +} +.selectize-dropdown-header-close { + position: absolute; + right: @selectize-padding-dropdown-item-x; + top: 50%; + color: @selectize-color-text; + opacity: 0.4; + margin-top: -12px; + line-height: 20px; + font-size: 20px !important; +} +.selectize-dropdown-header-close:hover { + color: darken(@selectize-color-text, 25%); +} \ No newline at end of file diff --git a/wire/modules/Jquery/JqueryUI/selectize/less/plugins/optgroup_columns.less b/wire/modules/Jquery/JqueryUI/selectize/less/plugins/optgroup_columns.less new file mode 100755 index 00000000..5c72d7a0 --- /dev/null +++ b/wire/modules/Jquery/JqueryUI/selectize/less/plugins/optgroup_columns.less @@ -0,0 +1,17 @@ +.selectize-dropdown.plugin-optgroup_columns { + .optgroup { + border-right: 1px solid #f2f2f2; + border-top: 0 none; + float: left; + .selectize-box-sizing(border-box); + } + .optgroup:last-child { + border-right: 0 none; + } + .optgroup:before { + display: none; + } + .optgroup-header { + border-top: 0 none; + } +} \ No newline at end of file diff --git a/wire/modules/Jquery/JqueryUI/selectize/less/plugins/remove_button.less b/wire/modules/Jquery/JqueryUI/selectize/less/plugins/remove_button.less new file mode 100755 index 00000000..b5303c55 --- /dev/null +++ b/wire/modules/Jquery/JqueryUI/selectize/less/plugins/remove_button.less @@ -0,0 +1,43 @@ +.selectize-control.plugin-remove_button { + [data-value] { + position: relative; + padding-right: 24px !important; + } + [data-value] .remove { + z-index: 1; /* fixes ie bug (see #392) */ + position: absolute; + top: 0; + right: 0; + bottom: 0; + width: 17px; + text-align: center; + font-weight: bold; + font-size: 12px; + color: inherit; + text-decoration: none; + vertical-align: middle; + display: inline-block; + padding: @selectize-padding-item-y 0 0 0; + border-left: 1px solid @selectize-color-item-border; + .selectize-border-radius(0 2px 2px 0); + .selectize-box-sizing(border-box); + } + [data-value] .remove:hover { + background: rgba(0,0,0,0.05); + } + [data-value].active .remove { + border-left-color: @selectize-color-item-active-border; + } + .disabled [data-value] .remove:hover { + background: none; + } + .disabled [data-value] .remove { + border-left-color: lighten(desaturate(@selectize-color-item-border, 100%), @selectize-lighten-disabled-item-border); + } + .remove-single { + position: absolute; + right: 28px; + top: 6px; + font-size: 23px; + } +} diff --git a/wire/modules/Jquery/JqueryUI/selectize/less/selectize.bootstrap2.less b/wire/modules/Jquery/JqueryUI/selectize/less/selectize.bootstrap2.less new file mode 100755 index 00000000..d4dce713 --- /dev/null +++ b/wire/modules/Jquery/JqueryUI/selectize/less/selectize.bootstrap2.less @@ -0,0 +1,161 @@ +/** + * selectize.bootstrap2.css (v0.12.4) - Bootstrap 2 Theme + * Copyright (c) 2013–2015 Brian Reavis & contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this + * file except in compliance with the License. You may obtain a copy of the License at: + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under + * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF + * ANY KIND, either express or implied. See the License for the specific language + * governing permissions and limitations under the License. + * + * @author Brian Reavis + */ + +@import "selectize"; + +@selectize-font-family: @baseFontFamily; +@selectize-font-size: @baseFontSize; +@selectize-line-height: @baseLineHeight; + +@selectize-color-text: @textColor; +@selectize-color-highlight: rgba(255,237,40,0.4); +@selectize-color-input: @inputBackground; +@selectize-color-input-full: @inputBackground; +@selectize-color-disabled: @inputBackground; +@selectize-color-item: @btnBackgroundHighlight; +@selectize-color-item-border: @btnBorder; +@selectize-color-item-active: @dropdownLinkBackgroundHover; +@selectize-color-item-active-text: @dropdownLinkColorHover; +@selectize-color-item-active-border: darken(@selectize-color-item-active, 5%); +@selectize-color-optgroup: @dropdownBackground; +@selectize-color-optgroup-text: @grayLight; +@selectize-color-optgroup-border: @dropdownDividerTop; +@selectize-color-dropdown: @dropdownBackground; +@selectize-color-dropdown-border: @inputBorder; +@selectize-color-dropdown-border-top: @dropdownDividerTop; +@selectize-color-dropdown-item-active: @dropdownLinkBackgroundHover; +@selectize-color-dropdown-item-active-text: @dropdownLinkColorHover; +@selectize-color-dropdown-item-create-active-text: @dropdownLinkColorHover; +@selectize-lighten-disabled-item: 8%; +@selectize-lighten-disabled-item-text: 8%; +@selectize-lighten-disabled-item-border: 8%; +@selectize-opacity-disabled: 0.5; +@selectize-shadow-input: none; +@selectize-shadow-input-focus: inset 0 1px 2px rgba(0,0,0,0.15); +@selectize-border-radius: @inputBorderRadius; + +@selectize-padding-x: 10px; +@selectize-padding-y: 7px; +@selectize-padding-dropdown-item-x: @selectize-padding-x; +@selectize-padding-dropdown-item-y: 3px; +@selectize-padding-item-x: 3px; +@selectize-padding-item-y: 1px; +@selectize-margin-item-x: 3px; +@selectize-margin-item-y: 3px; +@selectize-caret-margin: 0; + +@selectize-arrow-size: 5px; +@selectize-arrow-color: @black; +@selectize-arrow-offset: @selectize-padding-x + 5px; + +@selectize-width-item-border: 1px; + +.selectize-dropdown { + margin: 2px 0 0 0; + z-index: @zindexDropdown; + border: 1px solid @dropdownBorder; + border-radius: @baseBorderRadius; + .box-shadow(0 5px 10px rgba(0,0,0,.2)); + + .optgroup-header { + font-size: 11px; + font-weight: bold; + text-shadow: 0 1px 0 rgba(255,255,255,.5); + text-transform: uppercase; + } + .optgroup:first-child:before { + display: none; + } + .optgroup:before { + content: ' '; + display: block; + .nav-divider(); + margin-left: @selectize-padding-dropdown-item-x * -1; + margin-right: @selectize-padding-dropdown-item-x * -1; + } + + [data-selectable].active { + #gradient > .vertical(@dropdownLinkBackgroundHover, darken(@dropdownLinkBackgroundHover, 5%)); + } +} + +.selectize-dropdown-content { + padding: 5px 0; +} + +.selectize-dropdown-header { + padding: @selectize-padding-dropdown-item-y * 2 @selectize-padding-dropdown-item-x; +} + +.selectize-input { + .transition(~"border linear .2s, box-shadow linear .2s"); + + &.dropdown-active { + .selectize-border-radius(@selectize-border-radius); + } + &.dropdown-active::before { + display: none; + } + &.input-active, &.input-active:hover, .selectize-control.multi &.focus { + background: @selectize-color-input !important; + border-color: rgba(82,168,236,.8) !important; + outline: 0 !important; + outline: thin dotted \9 !important; + .box-shadow(~"inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(82,168,236,.6)") !important; + } +} + +.selectize-control { + &.single { + .selectize-input { + .buttonBackground(@btnBackground, @btnBackgroundHighlight, @grayDark, 0 1px 1px rgba(255,255,255,.75)); + .box-shadow(~"inset 0 1px 0 rgba(255,255,255,.2), 0 1px 2px rgba(0,0,0,.05)"); + &:hover { + color: @grayDark; + text-decoration: none; + background-position: 0 -15px; + .transition(background-position .1s linear); + } + &.disabled { + background: @btnBackgroundHighlight !important; + .box-shadow(none); + } + } + } + &.multi { + .selectize-input { + .box-shadow(inset 0 1px 1px rgba(0,0,0,.075)); + &.has-items { + @padding-x: @selectize-padding-x - @selectize-padding-item-x; + padding-left: @padding-x; + padding-right: @padding-x; + } + } + .selectize-input > div { + .gradientBar(@btnBackground, @btnBackgroundHighlight, @selectize-color-item-text, none); + *background-color: @selectize-color-item; + border: @selectize-width-item-border solid @selectize-color-item-border; + .border-radius(@baseBorderRadius); + .box-shadow(~"inset 0 1px 0 rgba(255,255,255,.2), 0 1px 2px rgba(0,0,0,.05)"); + &.active { + .box-shadow(~"0 1px 2px rgba(0,0,0,.05)"); + .gradientBar(@selectize-color-item-active, @selectize-color-item-active-border, @selectize-color-item-active-text, none); + *background-color: @selectize-color-item-active; + border: @selectize-width-item-border solid @dropdownLinkBackgroundHover; + } + } + } +} \ No newline at end of file diff --git a/wire/modules/Jquery/JqueryUI/selectize/less/selectize.bootstrap3.less b/wire/modules/Jquery/JqueryUI/selectize/less/selectize.bootstrap3.less new file mode 100755 index 00000000..19b3ccd1 --- /dev/null +++ b/wire/modules/Jquery/JqueryUI/selectize/less/selectize.bootstrap3.less @@ -0,0 +1,150 @@ +/** + * selectize.bootstrap3.css (v0.12.4) - Bootstrap 3 Theme + * Copyright (c) 2013–2015 Brian Reavis & contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this + * file except in compliance with the License. You may obtain a copy of the License at: + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under + * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF + * ANY KIND, either express or implied. See the License for the specific language + * governing permissions and limitations under the License. + * + * @author Brian Reavis + */ + +@import "selectize"; + +@selectize-font-family: inherit; +@selectize-font-size: inherit; +@selectize-line-height: @line-height-computed; + +@selectize-color-text: @text-color; +@selectize-color-highlight: rgba(255,237,40,0.4); +@selectize-color-input: @input-bg; +@selectize-color-input-full: @input-bg; +@selectize-color-input-error: @state-danger-text; +@selectize-color-input-error-focus: darken(@selectize-color-input-error, 10%); +@selectize-color-disabled: @input-bg; +@selectize-color-item: #efefef; +@selectize-color-item-border: rgba(0,0,0,0); +@selectize-color-item-active: @component-active-bg; +@selectize-color-item-active-text: #fff; +@selectize-color-item-active-border: rgba(0,0,0,0); +@selectize-color-optgroup: @dropdown-bg; +@selectize-color-optgroup-text: @dropdown-header-color; +@selectize-color-optgroup-border: @dropdown-divider-bg; +@selectize-color-dropdown: @dropdown-bg; +@selectize-color-dropdown-border-top: mix(@input-border, @input-bg, 0.8); +@selectize-color-dropdown-item-active: @dropdown-link-hover-bg; +@selectize-color-dropdown-item-active-text: @dropdown-link-hover-color; +@selectize-color-dropdown-item-create-active-text: @dropdown-link-hover-color; +@selectize-opacity-disabled: 0.5; +@selectize-shadow-input: none; +@selectize-shadow-input-focus: inset 0 1px 2px rgba(0,0,0,0.15); +@selectize-shadow-input-error: inset 0 1px 1px rgba(0, 0, 0, .075); +@selectize-shadow-input-error-focus: inset 0 1px 1px rgba(0, 0, 0, .075), 0 0 6px lighten(@selectize-color-input-error, 20%); +@selectize-border: 1px solid @input-border; +@selectize-border-radius: @input-border-radius; + +@selectize-width-item-border: 0; +@selectize-padding-x: @padding-base-horizontal; +@selectize-padding-y: @padding-base-vertical; +@selectize-padding-dropdown-item-x: @padding-base-horizontal; +@selectize-padding-dropdown-item-y: 3px; +@selectize-padding-item-x: 3px; +@selectize-padding-item-y: 1px; +@selectize-margin-item-x: 3px; +@selectize-margin-item-y: 3px; +@selectize-caret-margin: 0; + +@selectize-arrow-size: 5px; +@selectize-arrow-color: @selectize-color-text; +@selectize-arrow-offset: @selectize-padding-x + 5px; + +.selectize-dropdown, .selectize-dropdown.form-control { + height: auto; + padding: 0; + margin: 2px 0 0 0; + z-index: @zindex-dropdown; + background: @selectize-color-dropdown; + border: 1px solid @dropdown-fallback-border; + border: 1px solid @dropdown-border; + .selectize-border-radius(@border-radius-base); + .selectize-box-shadow(0 6px 12px rgba(0,0,0,.175)); +} + +.selectize-dropdown { + .optgroup-header { + font-size: @font-size-small; + line-height: @line-height-base; + } + .optgroup:first-child:before { + display: none; + } + .optgroup:before { + content: ' '; + display: block; + .nav-divider(); + margin-left: @selectize-padding-dropdown-item-x * -1; + margin-right: @selectize-padding-dropdown-item-x * -1; + } +} + +.selectize-dropdown-content { + padding: 5px 0; +} + +.selectize-dropdown-header { + padding: @selectize-padding-dropdown-item-y * 2 @selectize-padding-dropdown-item-x; +} + +.selectize-input { + min-height: @input-height-base; + + &.dropdown-active { + .selectize-border-radius(@selectize-border-radius); + } + &.dropdown-active::before { + display: none; + } + &.focus { + @color: @input-border-focus; + @color-rgba: rgba(red(@color), green(@color), blue(@color), .6); + border-color: @color; + outline: 0; + .selectize-box-shadow(~"inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px @{color-rgba}"); + } +} + +.has-error .selectize-input { + border-color: @selectize-color-input-error; + .selectize-box-shadow(@selectize-shadow-input-error); + + &:focus { + border-color: @selectize-color-input-error-focus; + .selectize-box-shadow(@selectize-shadow-input-error-focus); + } +} + +.selectize-control { + &.multi { + .selectize-input.has-items { + padding-left: @selectize-padding-x - @selectize-padding-item-x; + padding-right: @selectize-padding-x - @selectize-padding-item-x; + } + .selectize-input > div { + .selectize-border-radius(@selectize-border-radius - 1px); + } + } +} + +.form-control.selectize-control { + padding: 0; + height: auto; + border: none; + background: none; + .selectize-box-shadow(none); + .selectize-border-radius(0); +} diff --git a/wire/modules/Jquery/JqueryUI/selectize/less/selectize.default.less b/wire/modules/Jquery/JqueryUI/selectize/less/selectize.default.less new file mode 100755 index 00000000..812c4eba --- /dev/null +++ b/wire/modules/Jquery/JqueryUI/selectize/less/selectize.default.less @@ -0,0 +1,84 @@ +/** + * selectize.default.css (v0.12.4) - Default Theme + * Copyright (c) 2013–2015 Brian Reavis & contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this + * file except in compliance with the License. You may obtain a copy of the License at: + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under + * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF + * ANY KIND, either express or implied. See the License for the specific language + * governing permissions and limitations under the License. + * + * @author Brian Reavis + */ + +@import "selectize"; + +@selectize-color-item: #1da7ee; +@selectize-color-item-text: #fff; +@selectize-color-item-active-text: #fff; +@selectize-color-item-border: #0073bb; +@selectize-color-item-active: #92c836; +@selectize-color-item-active-border: #00578d; +@selectize-width-item-border: 1px; +@selectize-caret-margin: 0 1px; + +.selectize-control { + &.multi { + .selectize-input { + &.has-items { + @padding-x: @selectize-padding-x - 3px; + padding-left: @padding-x; + padding-right: @padding-x; + } + &.disabled [data-value] { + color: #999; + text-shadow: none; + background: none; + .selectize-box-shadow(none); + + &, .remove { + border-color: #e6e6e6; + } + .remove { + background: none; + } + } + [data-value] { + text-shadow: 0 1px 0 rgba(0,51,83,0.3); + .selectize-border-radius(3px); + .selectize-vertical-gradient(#1da7ee, #178ee9); + .selectize-box-shadow(~"0 1px 0 rgba(0,0,0,0.2),inset 0 1px rgba(255,255,255,0.03)"); + &.active { + .selectize-vertical-gradient(#008fd8, #0075cf); + } + } + } + } + &.single { + .selectize-input { + .selectize-box-shadow(~"0 1px 0 rgba(0,0,0,0.05), inset 0 1px 0 rgba(255,255,255,0.8)"); + .selectize-vertical-gradient(#fefefe, #f2f2f2); + } + } +} + +.selectize-control.single .selectize-input, .selectize-dropdown.single { + border-color: #b8b8b8; +} + +.selectize-dropdown { + .optgroup-header { + padding-top: @selectize-padding-dropdown-item-y + 2px; + font-weight: bold; + font-size: 0.85em; + } + .optgroup { + border-top: 1px solid @selectize-color-dropdown-border-top; + &:first-child { + border-top: 0 none; + } + } +} \ No newline at end of file diff --git a/wire/modules/Jquery/JqueryUI/selectize/less/selectize.legacy.less b/wire/modules/Jquery/JqueryUI/selectize/less/selectize.legacy.less new file mode 100755 index 00000000..2b7c7cbb --- /dev/null +++ b/wire/modules/Jquery/JqueryUI/selectize/less/selectize.legacy.less @@ -0,0 +1,75 @@ +/** + * selectize.legacy.css (v0.12.4) - Default Theme + * Copyright (c) 2013–2015 Brian Reavis & contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this + * file except in compliance with the License. You may obtain a copy of the License at: + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under + * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF + * ANY KIND, either express or implied. See the License for the specific language + * governing permissions and limitations under the License. + * + * @author Brian Reavis + */ + +@import "selectize"; + +@selectize-font-size: 13px; +@selectize-line-height: 20px; + +@selectize-color-input-full: #f2f2f2; +@selectize-color-item: #b8e76f; +@selectize-color-item-text: #3d5d18; +@selectize-color-item-border: #74b21e; +@selectize-color-item-active: #92c836; +@selectize-color-item-active-border: #6f9839; +@selectize-color-highlight: rgba(255,237,40,0.4); +@selectize-color-dropdown-item-active: #fffceb; +@selectize-color-dropdown-item-active-text: @selectize-color-text; +@selectize-color-optgroup: #f8f8f8; +@selectize-color-optgroup-text: @selectize-color-text; +@selectize-width-item-border: 1px; + +@selectize-padding-x: 10px; +@selectize-padding-y: 10px; +@selectize-padding-item-x: 5px; +@selectize-padding-item-y: 1px; +@selectize-padding-dropdown-item-x: 10px; +@selectize-padding-dropdown-item-y: 7px; +@selectize-margin-item-x: 4px; +@selectize-margin-item-y: 4px; + +.selectize-control { + &.multi { + .selectize-input [data-value] { + text-shadow: 0 1px 0 rgba(255,255,255,0.1); + .selectize-border-radius(3px); + .selectize-vertical-gradient(#b8e76f, #a9e25c); + .selectize-box-shadow(0 1px 1px rgba(0,0,0,0.1)); + &.active { + .selectize-vertical-gradient(#92c836, #7abc2c); + } + } + } + &.single { + .selectize-input { + .selectize-box-shadow(~"inset 0 1px 0 rgba(255,255,255,0.8), 0 2px 0 #e0e0e0, 0 3px 0 #c8c8c8, 0 4px 1px rgba(0,0,0,0.1)"); + .selectize-vertical-gradient(#f5f5f5, #efefef); + } + } +} + +.selectize-control.single .selectize-input, .selectize-dropdown.single { + border-color: #b8b8b8; +} + +.selectize-dropdown { + .optgroup-header { + font-weight: bold; + font-size: 0.8em; + border-bottom: 1px solid @selectize-color-dropdown-border-top; + border-top: 1px solid @selectize-color-dropdown-border-top; + } +} \ No newline at end of file diff --git a/wire/modules/Jquery/JqueryUI/selectize/less/selectize.less b/wire/modules/Jquery/JqueryUI/selectize/less/selectize.less new file mode 100755 index 00000000..df1c41bc --- /dev/null +++ b/wire/modules/Jquery/JqueryUI/selectize/less/selectize.less @@ -0,0 +1,296 @@ +@import "plugins/drag_drop"; +@import "plugins/dropdown_header"; +@import "plugins/optgroup_columns"; +@import "plugins/remove_button"; + +// base styles + +@selectize-font-family: inherit; +@selectize-font-smoothing: inherit; +@selectize-font-size: 13px; +@selectize-line-height: 18px; + +@selectize-color-text: #303030; +@selectize-color-border: #d0d0d0; +@selectize-color-highlight: rgba(125,168,208,0.2); +@selectize-color-input: #fff; +@selectize-color-input-full: @selectize-color-input; +@selectize-color-disabled: #fafafa; +@selectize-color-item: #f2f2f2; +@selectize-color-item-text: @selectize-color-text; +@selectize-color-item-border: #d0d0d0; +@selectize-color-item-active: #e8e8e8; +@selectize-color-item-active-text: @selectize-color-text; +@selectize-color-item-active-border: #cacaca; +@selectize-color-dropdown: #fff; +@selectize-color-dropdown-border: @selectize-color-border; +@selectize-color-dropdown-border-top: #f0f0f0; +@selectize-color-dropdown-item-active: #f5fafd; +@selectize-color-dropdown-item-active-text: #495c68; +@selectize-color-dropdown-item-create-text: rgba(red(@selectize-color-text), green(@selectize-color-text), blue(@selectize-color-text), 0.5); +@selectize-color-dropdown-item-create-active-text: @selectize-color-dropdown-item-active-text; +@selectize-color-optgroup: @selectize-color-dropdown; +@selectize-color-optgroup-text: @selectize-color-text; +@selectize-lighten-disabled-item: 30%; +@selectize-lighten-disabled-item-text: 30%; +@selectize-lighten-disabled-item-border: 30%; +@selectize-opacity-disabled: 0.5; + +@selectize-shadow-input: inset 0 1px 1px rgba(0,0,0,0.1); +@selectize-shadow-input-focus: inset 0 1px 2px rgba(0,0,0,0.15); +@selectize-border: 1px solid @selectize-color-border; +@selectize-dropdown-border: 1px solid @selectize-color-dropdown-border; +@selectize-border-radius: 3px; + +@selectize-width-item-border: 0; +@selectize-max-height-dropdown: 200px; + +@selectize-padding-x: 8px; +@selectize-padding-y: 8px; +@selectize-padding-item-x: 6px; +@selectize-padding-item-y: 2px; +@selectize-padding-dropdown-item-x: @selectize-padding-x; +@selectize-padding-dropdown-item-y: 5px; +@selectize-margin-item-x: 3px; +@selectize-margin-item-y: 3px; + +@selectize-arrow-size: 5px; +@selectize-arrow-color: #808080; +@selectize-arrow-offset: 15px; + +@selectize-caret-margin: 0 2px 0 0; +@selectize-caret-margin-rtl: 0 4px 0 -2px; + +.selectize-border-radius (@radii) { + -webkit-border-radius: @radii; + -moz-border-radius: @radii; + border-radius: @radii; +} +.selectize-unselectable () { + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; +} +.selectize-box-shadow (@shadow) { + -webkit-box-shadow: @shadow; + box-shadow: @shadow; +} +.selectize-box-sizing (@type: border-box) { + -webkit-box-sizing: @type; + -moz-box-sizing: @type; + box-sizing: @type; +} +.selectize-vertical-gradient (@color-top, @color-bottom) { + background-color: mix(@color-top, @color-bottom, 60%); + background-image: -moz-linear-gradient(top, @color-top, @color-bottom); // FF 3.6+ + background-image: -webkit-gradient(linear, 0 0, 0 100%, from(@color-top), to(@color-bottom)); // Safari 4+, Chrome 2+ + background-image: -webkit-linear-gradient(top, @color-top, @color-bottom); // Safari 5.1+, Chrome 10+ + background-image: -o-linear-gradient(top, @color-top, @color-bottom); // Opera 11.10 + background-image: linear-gradient(to bottom, @color-top, @color-bottom); // Standard, IE10 + background-repeat: repeat-x; + filter: e(%("progid:DXImageTransform.Microsoft.gradient(startColorstr='%d', endColorstr='%d', GradientType=0)",argb(@color-top),argb(@color-bottom))); // IE9 and down +} + +.selectize-control { + position: relative; +} + +.selectize-dropdown, .selectize-input, .selectize-input input { + color: @selectize-color-text; + font-family: @selectize-font-family; + font-size: @selectize-font-size; + line-height: @selectize-line-height; + -webkit-font-smoothing: @selectize-font-smoothing; +} + +.selectize-input, .selectize-control.single .selectize-input.input-active { + background: @selectize-color-input; + cursor: text; + display: inline-block; +} + +.selectize-input { + border: @selectize-border; + padding: @selectize-padding-y @selectize-padding-x; + display: inline-block; + width: 100%; + overflow: hidden; + position: relative; + z-index: 1; + .selectize-box-sizing(border-box); + .selectize-box-shadow(@selectize-shadow-input); + .selectize-border-radius(@selectize-border-radius); + + .selectize-control.multi &.has-items { + @padding-x: @selectize-padding-x; + @padding-top: @selectize-padding-y - @selectize-padding-item-y - @selectize-width-item-border; + @padding-bottom: @selectize-padding-y - @selectize-padding-item-y - @selectize-margin-item-y - @selectize-width-item-border; + padding: @padding-top @padding-x @padding-bottom; + } + + &.full { + background-color: @selectize-color-input-full; + } + &.disabled, &.disabled * { + cursor: default !important; + } + &.focus { + .selectize-box-shadow(@selectize-shadow-input-focus); + } + &.dropdown-active { + .selectize-border-radius(@selectize-border-radius @selectize-border-radius 0 0); + } + + > * { + vertical-align: baseline; + display: -moz-inline-stack; + display: inline-block; + zoom: 1; + *display: inline; + } + .selectize-control.multi & > div { + cursor: pointer; + margin: 0 @selectize-margin-item-x @selectize-margin-item-y 0; + padding: @selectize-padding-item-y @selectize-padding-item-x; + background: @selectize-color-item; + color: @selectize-color-item-text; + border: @selectize-width-item-border solid @selectize-color-item-border; + + &.active { + background: @selectize-color-item-active; + color: @selectize-color-item-active-text; + border: @selectize-width-item-border solid @selectize-color-item-active-border; + } + } + .selectize-control.multi &.disabled > div { + &, &.active { + color: lighten(desaturate(@selectize-color-item-text, 100%), @selectize-lighten-disabled-item-text); + background: lighten(desaturate(@selectize-color-item, 100%), @selectize-lighten-disabled-item); + border: @selectize-width-item-border solid lighten(desaturate(@selectize-color-item-border, 100%), @selectize-lighten-disabled-item-border); + } + } + > input { + &::-ms-clear { + display: none; + } + display: inline-block !important; + padding: 0 !important; + min-height: 0 !important; + max-height: none !important; + max-width: 100% !important; + margin: @selectize-caret-margin !important; + text-indent: 0 !important; + border: 0 none !important; + background: none !important; + line-height: inherit !important; + -webkit-user-select: auto !important; + .selectize-box-shadow(none) !important; + &:focus { outline: none !important; } + } +} + +.selectize-input::after { + content: ' '; + display: block; + clear: left; +} + +.selectize-input.dropdown-active::before { + content: ' '; + display: block; + position: absolute; + background: @selectize-color-dropdown-border-top; + height: 1px; + bottom: 0; + left: 0; + right: 0; +} + +.selectize-dropdown { + position: absolute; + z-index: 10; + border: @selectize-dropdown-border; + background: @selectize-color-dropdown; + margin: -1px 0 0 0; + border-top: 0 none; + .selectize-box-sizing(border-box); + .selectize-box-shadow(0 1px 3px rgba(0,0,0,0.1)); + .selectize-border-radius(0 0 @selectize-border-radius @selectize-border-radius); + + [data-selectable] { + cursor: pointer; + overflow: hidden; + .highlight { + background: @selectize-color-highlight; + .selectize-border-radius(1px); + } + } + [data-selectable], .optgroup-header { + padding: @selectize-padding-dropdown-item-y @selectize-padding-dropdown-item-x; + } + .optgroup:first-child .optgroup-header { + border-top: 0 none; + } + .optgroup-header { + color: @selectize-color-optgroup-text; + background: @selectize-color-optgroup; + cursor: default; + } + .active { + background-color: @selectize-color-dropdown-item-active; + color: @selectize-color-dropdown-item-active-text; + &.create { + color: @selectize-color-dropdown-item-create-active-text; + } + } + .create { + color: @selectize-color-dropdown-item-create-text; + } +} + +.selectize-dropdown-content { + overflow-y: auto; + overflow-x: hidden; + max-height: @selectize-max-height-dropdown; + -webkit-overflow-scrolling: touch; +} + +.selectize-control.single .selectize-input { + &, input { cursor: pointer; } + &.input-active, &.input-active input { cursor: text; } + + &:after { + content: ' '; + display: block; + position: absolute; + top: 50%; + right: @selectize-arrow-offset; + margin-top: round((-1 * @selectize-arrow-size / 2)); + width: 0; + height: 0; + border-style: solid; + border-width: @selectize-arrow-size @selectize-arrow-size 0 @selectize-arrow-size; + border-color: @selectize-arrow-color transparent transparent transparent; + } + &.dropdown-active:after { + margin-top: @selectize-arrow-size * -0.8; + border-width: 0 @selectize-arrow-size @selectize-arrow-size @selectize-arrow-size; + border-color: transparent transparent @selectize-arrow-color transparent; + } +} + +.selectize-control.rtl { + &.single .selectize-input:after { + left: @selectize-arrow-offset; + right: auto; + } + .selectize-input > input { + margin: @selectize-caret-margin-rtl !important; + } +} + +.selectize-control .selectize-input.disabled { + opacity: @selectize-opacity-disabled; + background-color: @selectize-color-disabled; +}