update select2 to 3.4.1
This commit is contained in:
		@@ -1,18 +0,0 @@
 | 
			
		||||
Copyright 2012 Igor Vaynberg
 | 
			
		||||
 | 
			
		||||
Version: @@ver@@ Timestamp: @@timestamp@@
 | 
			
		||||
 | 
			
		||||
This software is licensed under the Apache License, Version 2.0 (the "Apache License") or the GNU
 | 
			
		||||
General Public License version 2 (the "GPL License"). You may choose either license to govern your
 | 
			
		||||
use of this software only upon the condition that you accept all of the terms of either the Apache
 | 
			
		||||
License or the GPL License.
 | 
			
		||||
 | 
			
		||||
You may obtain a copy of the Apache License and the GPL License at:
 | 
			
		||||
 | 
			
		||||
http://www.apache.org/licenses/LICENSE-2.0
 | 
			
		||||
http://www.gnu.org/licenses/gpl-2.0.html
 | 
			
		||||
 | 
			
		||||
Unless required by applicable law or agreed to in writing, software distributed under the Apache License
 | 
			
		||||
or the GPL Licesnse is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
 | 
			
		||||
either express or implied. See the Apache License and the GPL License for the specific language governing
 | 
			
		||||
permissions and limitations under the Apache License and the GPL License.
 | 
			
		||||
@@ -1,83 +0,0 @@
 | 
			
		||||
Select2
 | 
			
		||||
=================
 | 
			
		||||
 | 
			
		||||
Select2 is a jQuery based replacement for select boxes. It supports searching, remote data sets, and infinite scrolling of results.
 | 
			
		||||
 | 
			
		||||
To get started checkout examples and documentation at http://ivaynberg.github.com/select2
 | 
			
		||||
 | 
			
		||||
What Usecases Does Select2 Support
 | 
			
		||||
-------------------------------------------------
 | 
			
		||||
 | 
			
		||||
* Enhances native selects with search
 | 
			
		||||
* Enhances native selects with a better multi-select interface
 | 
			
		||||
* Loading data from javascript: easily load items via ajax and have them searchable
 | 
			
		||||
* Nested optgroups: native selects only support one level of nested, Select2 does not have this restriction
 | 
			
		||||
* Tagging: ability to add new items on the fly
 | 
			
		||||
* Working with large remote datesets: ability to partially load a dataset based on the search term
 | 
			
		||||
* Paging of large datasets: easy support for loading more pages when the results are scrolled to the end
 | 
			
		||||
* Templating: support for custom rendering of results and selections
 | 
			
		||||
 | 
			
		||||
Browser Compatibility
 | 
			
		||||
--------------------
 | 
			
		||||
* IE 8+ (7 mostly works except for [issue with z-index](https://github.com/ivaynberg/select2/issues/37))
 | 
			
		||||
* Chrome 8+
 | 
			
		||||
* Firefox 3.5+
 | 
			
		||||
* Safari 3+
 | 
			
		||||
* Opera 10.6+
 | 
			
		||||
 | 
			
		||||
Integrations
 | 
			
		||||
------------
 | 
			
		||||
 | 
			
		||||
* [Wicket-Select2](https://github.com/ivaynberg/wicket-select2) (Java / [Apache Wicket](http://wicket.apache.org))
 | 
			
		||||
* [select2-rails](https://github.com/argerim/select2-rails) (Ruby on Rails)
 | 
			
		||||
* [AngularUI](http://angular-ui.github.com/#directives-select2) ([AngularJS](angularjs.org))
 | 
			
		||||
* [Django](https://github.com/applegrew/django-select2)
 | 
			
		||||
* [Symfony](https://github.com/19Gerhard85/sfSelect2WidgetsPlugin)
 | 
			
		||||
* [Bootstrap](https://github.com/t0m/select2-bootstrap-css) (CSS skin)
 | 
			
		||||
* [Yii](https://github.com/tonybolzan/yii-select2)
 | 
			
		||||
 | 
			
		||||
Internationalization (i18n)
 | 
			
		||||
---------------------------
 | 
			
		||||
 | 
			
		||||
Select2 supports multiple languages by simply including the right
 | 
			
		||||
language JS file (`select2_locale_it.js`, `select2_locale_nl.js` etc.).
 | 
			
		||||
 | 
			
		||||
Missing a language? Just copy `select2_locale_en.js.template`, translate
 | 
			
		||||
it and make a pull request back to Select2 here on Github.
 | 
			
		||||
 | 
			
		||||
Bug tracker
 | 
			
		||||
-----------
 | 
			
		||||
 | 
			
		||||
Have a bug? Please create an issue here on GitHub!
 | 
			
		||||
 | 
			
		||||
https://github.com/ivaynberg/select2/issues
 | 
			
		||||
 | 
			
		||||
Mailing list
 | 
			
		||||
------------
 | 
			
		||||
 | 
			
		||||
Have a question? Ask on our mailing list!
 | 
			
		||||
 | 
			
		||||
select2@googlegroups.com
 | 
			
		||||
 | 
			
		||||
https://groups.google.com/d/forum/select2
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
Copyright and License
 | 
			
		||||
---------------------
 | 
			
		||||
 | 
			
		||||
Copyright 2012 Igor Vaynberg
 | 
			
		||||
 | 
			
		||||
This software is licensed under the Apache License, Version 2.0 (the "Apache License") or the GNU 
 | 
			
		||||
General Public License version 2 (the "GPL License"). You may choose either license to govern your 
 | 
			
		||||
use of this software only upon the condition that you accept all of the terms of either the Apache 
 | 
			
		||||
License or the GPL License. 
 | 
			
		||||
 | 
			
		||||
You may obtain a copy of the Apache License and the GPL License in the LICENSE file, or at:
 | 
			
		||||
 | 
			
		||||
http://www.apache.org/licenses/LICENSE-2.0
 | 
			
		||||
http://www.gnu.org/licenses/gpl-2.0.html
 | 
			
		||||
 | 
			
		||||
Unless required by applicable law or agreed to in writing, software distributed under the Apache License 
 | 
			
		||||
or the GPL Licesnse is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 
 | 
			
		||||
either express or implied. See the Apache License and the GPL License for the specific language governing 
 | 
			
		||||
permissions and limitations under the Apache License and the GPL License.
 | 
			
		||||
@@ -1,8 +0,0 @@
 | 
			
		||||
{
 | 
			
		||||
    "name": "select2",
 | 
			
		||||
    "version": "3.4.0",
 | 
			
		||||
    "main": ["select2.js", "select2.css", "select2.png", "select2x2.png", "select2-spinner.gif"],
 | 
			
		||||
    "dependencies": {
 | 
			
		||||
        "jquery": ">= 1.7.1"
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -1,69 +0,0 @@
 | 
			
		||||
#!/bin/bash
 | 
			
		||||
set -e
 | 
			
		||||
 | 
			
		||||
echo -n "Enter the version for this release: "
 | 
			
		||||
 | 
			
		||||
read ver
 | 
			
		||||
 | 
			
		||||
if [ ! $ver ]; then 
 | 
			
		||||
	echo "Invalid version."
 | 
			
		||||
	exit
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
name="select2"
 | 
			
		||||
js="$name.js"
 | 
			
		||||
mini="$name.min.js"
 | 
			
		||||
css="$name.css"
 | 
			
		||||
release="$name-$ver"
 | 
			
		||||
tag="$ver"
 | 
			
		||||
branch="build-$ver"
 | 
			
		||||
curbranch=`git branch | grep "*" | sed "s/* //"`
 | 
			
		||||
timestamp=$(date)
 | 
			
		||||
tokens="s/@@ver@@/$ver/g;s/\@@timestamp@@/$timestamp/g"
 | 
			
		||||
remote="github"
 | 
			
		||||
 | 
			
		||||
echo "Updating Version Identifiers"
 | 
			
		||||
 | 
			
		||||
sed -E -e "s/\"version\": \"([0-9\.]+)\",/\"version\": \"$ver\",/g" -i "" component.json select2.jquery.json
 | 
			
		||||
git add component.json
 | 
			
		||||
git add select2.jquery.json
 | 
			
		||||
git commit -m "modified version identifiers in descriptors for release $ver"
 | 
			
		||||
git push
 | 
			
		||||
 
 | 
			
		||||
git branch "$branch"
 | 
			
		||||
git checkout "$branch"
 | 
			
		||||
 | 
			
		||||
echo "Tokenizing..."
 | 
			
		||||
 | 
			
		||||
find . -name "$js" | xargs -I{} sed -e "$tokens" -i "" {} 
 | 
			
		||||
find . -name "$css" | xargs -I{} sed -e "$tokens" -i "" {}
 | 
			
		||||
sed -e "s/latest/$ver/g" -i "" component.json
 | 
			
		||||
 | 
			
		||||
git add "$js"
 | 
			
		||||
git add "$css"
 | 
			
		||||
 | 
			
		||||
echo "Minifying..."
 | 
			
		||||
 | 
			
		||||
echo "/*" > "$mini"
 | 
			
		||||
cat LICENSE | sed "$tokens" >> "$mini"
 | 
			
		||||
echo "*/" >> "$mini"
 | 
			
		||||
 | 
			
		||||
curl -s \
 | 
			
		||||
	--data-urlencode "js_code@$js" \
 | 
			
		||||
	http://marijnhaverbeke.nl/uglifyjs \
 | 
			
		||||
	>> "$mini"
 | 
			
		||||
 | 
			
		||||
git add "$mini"
 | 
			
		||||
	
 | 
			
		||||
git commit -m "release $ver"
 | 
			
		||||
 | 
			
		||||
echo "Tagging..."
 | 
			
		||||
git tag -a "$tag" -m "tagged version $ver"
 | 
			
		||||
git push "$remote" --tags
 | 
			
		||||
 | 
			
		||||
echo "Cleaning Up..."
 | 
			
		||||
 | 
			
		||||
git checkout "$curbranch"
 | 
			
		||||
git branch -D "$branch"
 | 
			
		||||
 | 
			
		||||
echo "Done"
 | 
			
		||||
							
								
								
									
										52
									
								
								src/inputs/select2/lib/select2.css
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										52
									
								
								src/inputs/select2/lib/select2.css
									
									
									
									
										vendored
									
									
								
							@@ -1,5 +1,5 @@
 | 
			
		||||
/*
 | 
			
		||||
Version: 3.4.0 Timestamp: Tue May 14 08:27:33 PDT 2013
 | 
			
		||||
Version: 3.4.1 Timestamp: Thu Jun 27 18:02:10 PDT 2013
 | 
			
		||||
*/
 | 
			
		||||
.select2-container {
 | 
			
		||||
    margin: 0;
 | 
			
		||||
@@ -82,11 +82,11 @@ Version: 3.4.0 Timestamp: Tue May 14 08:27:33 PDT 2013
 | 
			
		||||
    background-image: linear-gradient(top, #eeeeee 0%,#ffffff 90%);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.select2-container.select2-allowclear .select2-choice span {
 | 
			
		||||
.select2-container.select2-allowclear .select2-choice .select2-chosen {
 | 
			
		||||
    margin-right: 42px;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.select2-container .select2-choice span {
 | 
			
		||||
.select2-container .select2-choice > .select2-chosen {
 | 
			
		||||
    margin-right: 26px;
 | 
			
		||||
    display: block;
 | 
			
		||||
    overflow: hidden;
 | 
			
		||||
@@ -124,16 +124,35 @@ Version: 3.4.0 Timestamp: Tue May 14 08:27:33 PDT 2013
 | 
			
		||||
    cursor: pointer;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.select2-drop-mask {
 | 
			
		||||
.select2-drop-undermask {
 | 
			
		||||
    border: 0;
 | 
			
		||||
    margin: 0;
 | 
			
		||||
    padding: 0;
 | 
			
		||||
    position: absolute;
 | 
			
		||||
    left: 0;
 | 
			
		||||
    top: 0;
 | 
			
		||||
    z-index: 9998;
 | 
			
		||||
    background-color: transparent;
 | 
			
		||||
    filter: alpha(opacity=0);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.select2-drop-mask {
 | 
			
		||||
    border: 0;
 | 
			
		||||
    margin: 0;
 | 
			
		||||
    padding: 0;
 | 
			
		||||
    position: absolute;
 | 
			
		||||
    left: 0;
 | 
			
		||||
    top: 0;
 | 
			
		||||
    z-index: 9998;
 | 
			
		||||
    /* styles required for IE to work */
 | 
			
		||||
    background-color: #fff;
 | 
			
		||||
    opacity: 0;
 | 
			
		||||
    filter: alpha(opacity=0);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.select2-drop {
 | 
			
		||||
    width: 100%;
 | 
			
		||||
    margin-top:-1px;
 | 
			
		||||
    margin-top: -1px;
 | 
			
		||||
    position: absolute;
 | 
			
		||||
    z-index: 9999;
 | 
			
		||||
    top: 100%;
 | 
			
		||||
@@ -175,7 +194,16 @@ Version: 3.4.0 Timestamp: Tue May 14 08:27:33 PDT 2013
 | 
			
		||||
            box-shadow: 0 -4px 5px rgba(0, 0, 0, .15);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.select2-container .select2-choice div {
 | 
			
		||||
.select2-drop-active {
 | 
			
		||||
    border: 1px solid #5897fb;
 | 
			
		||||
    border-top: none;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.select2-drop.select2-drop-above.select2-drop-active {
 | 
			
		||||
    border-top: 1px solid #5897fb;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.select2-container .select2-choice .select2-arrow {
 | 
			
		||||
    display: inline-block;
 | 
			
		||||
    width: 18px;
 | 
			
		||||
    height: 100%;
 | 
			
		||||
@@ -202,7 +230,7 @@ Version: 3.4.0 Timestamp: Tue May 14 08:27:33 PDT 2013
 | 
			
		||||
    background-image: linear-gradient(top, #cccccc 0%, #eeeeee 60%);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.select2-container .select2-choice div b {
 | 
			
		||||
.select2-container .select2-choice .select2-arrow b {
 | 
			
		||||
    display: block;
 | 
			
		||||
    width: 100%;
 | 
			
		||||
    height: 100%;
 | 
			
		||||
@@ -314,12 +342,12 @@ Version: 3.4.0 Timestamp: Tue May 14 08:27:33 PDT 2013
 | 
			
		||||
    background-image: linear-gradient(bottom, #ffffff 0%,#eeeeee 50%);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.select2-dropdown-open .select2-choice div {
 | 
			
		||||
.select2-dropdown-open .select2-choice .select2-arrow {
 | 
			
		||||
    background: transparent;
 | 
			
		||||
    border-left: none;
 | 
			
		||||
    filter: none;
 | 
			
		||||
}
 | 
			
		||||
.select2-dropdown-open .select2-choice div b {
 | 
			
		||||
.select2-dropdown-open .select2-choice .select2-arrow b {
 | 
			
		||||
    background-position: -18px 1px;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -436,7 +464,7 @@ disabled look for disabled choices in the results dropdown
 | 
			
		||||
    cursor: default;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.select2-container.select2-container-disabled .select2-choice div {
 | 
			
		||||
.select2-container.select2-container-disabled .select2-choice .select2-arrow {
 | 
			
		||||
    background-color: #f4f4f4;
 | 
			
		||||
    background-image: none;
 | 
			
		||||
    border-left: 0;
 | 
			
		||||
@@ -556,7 +584,7 @@ disabled look for disabled choices in the results dropdown
 | 
			
		||||
    background-image: -ms-linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
 | 
			
		||||
    background-image: linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
 | 
			
		||||
}
 | 
			
		||||
.select2-container-multi .select2-choices .select2-search-choice span {
 | 
			
		||||
.select2-container-multi .select2-choices .select2-search-choice .select2-chosen {
 | 
			
		||||
    cursor: default;
 | 
			
		||||
}
 | 
			
		||||
.select2-container-multi .select2-choices .select2-search-choice-focus {
 | 
			
		||||
@@ -641,7 +669,7 @@ disabled look for disabled choices in the results dropdown
 | 
			
		||||
/* Retina-ize icons */
 | 
			
		||||
 | 
			
		||||
@media only screen and (-webkit-min-device-pixel-ratio: 1.5), only screen and (min-resolution: 144dpi)  {
 | 
			
		||||
  .select2-search input, .select2-search-choice-close, .select2-container .select2-choice abbr, .select2-container .select2-choice div b {
 | 
			
		||||
  .select2-search input, .select2-search-choice-close, .select2-container .select2-choice abbr, .select2-container .select2-choice .select2-arrow b {
 | 
			
		||||
      background-image: url('select2x2.png') !important;
 | 
			
		||||
      background-repeat: no-repeat !important;
 | 
			
		||||
      background-size: 60px 40px !important;
 | 
			
		||||
 
 | 
			
		||||
@@ -1,36 +0,0 @@
 | 
			
		||||
{
 | 
			
		||||
    "name": "select2",
 | 
			
		||||
    "title": "Select2",
 | 
			
		||||
    "description": "Select2 is a jQuery based replacement for select boxes. It supports searching, remote data sets, and infinite scrolling of results.",
 | 
			
		||||
    "keywords": [
 | 
			
		||||
        "select",
 | 
			
		||||
        "autocomplete",
 | 
			
		||||
        "typeahead",
 | 
			
		||||
        "dropdown",
 | 
			
		||||
        "multiselect",
 | 
			
		||||
        "tag",
 | 
			
		||||
        "tagging"
 | 
			
		||||
    ],
 | 
			
		||||
    "version": "3.4.0",
 | 
			
		||||
    "author": {
 | 
			
		||||
        "name": "Igor Vaynberg",
 | 
			
		||||
        "url": "https://github.com/ivaynberg"
 | 
			
		||||
    },
 | 
			
		||||
    "licenses": [
 | 
			
		||||
        {
 | 
			
		||||
            "type": "Apache",
 | 
			
		||||
            "url": "http://www.apache.org/licenses/LICENSE-2.0"
 | 
			
		||||
        },
 | 
			
		||||
        {
 | 
			
		||||
            "type": "GPL v2",
 | 
			
		||||
            "url": "http://www.gnu.org/licenses/gpl-2.0.html"
 | 
			
		||||
        }
 | 
			
		||||
    ],
 | 
			
		||||
    "bugs": "https://github.com/ivaynberg/select2/issues",
 | 
			
		||||
    "homepage": "http://ivaynberg.github.com/select2",
 | 
			
		||||
    "docs": "http://ivaynberg.github.com/select2/",
 | 
			
		||||
    "download": "https://github.com/ivaynberg/select2/tags",
 | 
			
		||||
    "dependencies": {
 | 
			
		||||
        "jquery": ">=1.7.1"
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										179
									
								
								src/inputs/select2/lib/select2.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										179
									
								
								src/inputs/select2/lib/select2.js
									
									
									
									
										vendored
									
									
								
							@@ -1,7 +1,7 @@
 | 
			
		||||
/*
 | 
			
		||||
Copyright 2012 Igor Vaynberg
 | 
			
		||||
 | 
			
		||||
Version: @@ver@@ Timestamp: @@timestamp@@
 | 
			
		||||
Version: 3.4.1 Timestamp: Thu Jun 27 18:02:10 PDT 2013
 | 
			
		||||
 | 
			
		||||
This software is licensed under the Apache License, Version 2.0 (the "Apache License") or the GNU
 | 
			
		||||
General Public License version 2 (the "GPL License"). You may choose either license to govern your
 | 
			
		||||
@@ -18,24 +18,24 @@ Apache License or the GPL Licesnse is distributed on an "AS IS" BASIS, WITHOUT W
 | 
			
		||||
CONDITIONS OF ANY KIND, either express or implied. See the Apache License and the GPL License for
 | 
			
		||||
the specific language governing permissions and limitations under the Apache License and the GPL License.
 | 
			
		||||
*/
 | 
			
		||||
 (function ($) {
 | 
			
		||||
 	if(typeof $.fn.each2 == "undefined"){
 | 
			
		||||
 		$.fn.extend({
 | 
			
		||||
 			/*
 | 
			
		||||
			* 4-10 times faster .each replacement
 | 
			
		||||
			* use it carefully, as it overrides jQuery context of element on each iteration
 | 
			
		||||
			*/
 | 
			
		||||
			each2 : function (c) {
 | 
			
		||||
				var j = $([0]), i = -1, l = this.length;
 | 
			
		||||
				while (
 | 
			
		||||
					++i < l
 | 
			
		||||
					&& (j.context = j[0] = this[i])
 | 
			
		||||
					&& c.call(j[0], i, j) !== false //"this"=DOM, i=index, j=jQuery object
 | 
			
		||||
				);
 | 
			
		||||
				return this;
 | 
			
		||||
			}
 | 
			
		||||
 		});
 | 
			
		||||
 	}
 | 
			
		||||
(function ($) {
 | 
			
		||||
    if(typeof $.fn.each2 == "undefined") {
 | 
			
		||||
        $.fn.extend({
 | 
			
		||||
            /*
 | 
			
		||||
            * 4-10 times faster .each replacement
 | 
			
		||||
            * use it carefully, as it overrides jQuery context of element on each iteration
 | 
			
		||||
            */
 | 
			
		||||
            each2 : function (c) {
 | 
			
		||||
                var j = $([0]), i = -1, l = this.length;
 | 
			
		||||
                while (
 | 
			
		||||
                    ++i < l
 | 
			
		||||
                    && (j.context = j[0] = this[i])
 | 
			
		||||
                    && c.call(j[0], i, j) !== false //"this"=DOM, i=index, j=jQuery object
 | 
			
		||||
                );
 | 
			
		||||
                return this;
 | 
			
		||||
            }
 | 
			
		||||
        });
 | 
			
		||||
    }
 | 
			
		||||
})(jQuery);
 | 
			
		||||
 | 
			
		||||
(function ($, undefined) {
 | 
			
		||||
@@ -132,8 +132,10 @@ the specific language governing permissions and limitations under the Apache Lic
 | 
			
		||||
        if (a === b) return true;
 | 
			
		||||
        if (a === undefined || b === undefined) return false;
 | 
			
		||||
        if (a === null || b === null) return false;
 | 
			
		||||
        if (a.constructor === String) return a+'' === b+''; // IE requires a+'' instead of just a
 | 
			
		||||
        if (b.constructor === String) return b+'' === a+''; // IE requires b+'' instead of just b
 | 
			
		||||
        // Check whether 'a' or 'b' is a string (primitive or object).
 | 
			
		||||
        // The concatenation of an empty string (+'') converts its argument to a string's primitive.
 | 
			
		||||
        if (a.constructor === String) return a+'' === b+''; // a+'' - in case 'a' is a String object
 | 
			
		||||
        if (b.constructor === String) return b+'' === a+''; // b+'' - in case 'b' is a String object
 | 
			
		||||
        return false;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -183,7 +185,7 @@ the specific language governing permissions and limitations under the Apache Lic
 | 
			
		||||
     * the elements under the pointer are scrolled.
 | 
			
		||||
     */
 | 
			
		||||
    function installFilteredMouseMove(element) {
 | 
			
		||||
	    element.on("mousemove", function (e) {
 | 
			
		||||
        element.on("mousemove", function (e) {
 | 
			
		||||
            var lastpos = lastMousePosition;
 | 
			
		||||
            if (lastpos === undefined || lastpos.x !== e.pageX || lastpos.y !== e.pageY) {
 | 
			
		||||
                $(e.target).trigger("mousemove-filtered", e);
 | 
			
		||||
@@ -291,22 +293,22 @@ the specific language governing permissions and limitations under the Apache Lic
 | 
			
		||||
 | 
			
		||||
    function measureTextWidth(e) {
 | 
			
		||||
        if (!sizer){
 | 
			
		||||
        	var style = e[0].currentStyle || window.getComputedStyle(e[0], null);
 | 
			
		||||
        	sizer = $(document.createElement("div")).css({
 | 
			
		||||
	            position: "absolute",
 | 
			
		||||
	            left: "-10000px",
 | 
			
		||||
	            top: "-10000px",
 | 
			
		||||
	            display: "none",
 | 
			
		||||
	            fontSize: style.fontSize,
 | 
			
		||||
	            fontFamily: style.fontFamily,
 | 
			
		||||
	            fontStyle: style.fontStyle,
 | 
			
		||||
	            fontWeight: style.fontWeight,
 | 
			
		||||
	            letterSpacing: style.letterSpacing,
 | 
			
		||||
	            textTransform: style.textTransform,
 | 
			
		||||
	            whiteSpace: "nowrap"
 | 
			
		||||
	        });
 | 
			
		||||
            var style = e[0].currentStyle || window.getComputedStyle(e[0], null);
 | 
			
		||||
            sizer = $(document.createElement("div")).css({
 | 
			
		||||
                position: "absolute",
 | 
			
		||||
                left: "-10000px",
 | 
			
		||||
                top: "-10000px",
 | 
			
		||||
                display: "none",
 | 
			
		||||
                fontSize: style.fontSize,
 | 
			
		||||
                fontFamily: style.fontFamily,
 | 
			
		||||
                fontStyle: style.fontStyle,
 | 
			
		||||
                fontWeight: style.fontWeight,
 | 
			
		||||
                letterSpacing: style.letterSpacing,
 | 
			
		||||
                textTransform: style.textTransform,
 | 
			
		||||
                whiteSpace: "nowrap"
 | 
			
		||||
            });
 | 
			
		||||
            sizer.attr("class","select2-sizer");
 | 
			
		||||
        	$("body").append(sizer);
 | 
			
		||||
            $("body").append(sizer);
 | 
			
		||||
        }
 | 
			
		||||
        sizer.text(e.val());
 | 
			
		||||
        return sizer.width();
 | 
			
		||||
@@ -464,12 +466,12 @@ the specific language governing permissions and limitations under the Apache Lic
 | 
			
		||||
            tmp,
 | 
			
		||||
            text = function (item) { return ""+item.text; }; // function used to retrieve the text portion of a data item that is matched against the search
 | 
			
		||||
 | 
			
		||||
		 if ($.isArray(data)) {
 | 
			
		||||
         if ($.isArray(data)) {
 | 
			
		||||
            tmp = data;
 | 
			
		||||
            data = { results: tmp };
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
		 if ($.isFunction(data) === false) {
 | 
			
		||||
         if ($.isFunction(data) === false) {
 | 
			
		||||
            tmp = data;
 | 
			
		||||
            data = function() { return tmp; };
 | 
			
		||||
        }
 | 
			
		||||
@@ -598,7 +600,7 @@ the specific language governing permissions and limitations under the Apache Lic
 | 
			
		||||
            input = input.substring(index + separator.length);
 | 
			
		||||
 | 
			
		||||
            if (token.length > 0) {
 | 
			
		||||
                token = opts.createSearchChoice(token, selection);
 | 
			
		||||
                token = opts.createSearchChoice.call(this, token, selection);
 | 
			
		||||
                if (token !== undefined && token !== null && opts.id(token) !== undefined && opts.id(token) !== null) {
 | 
			
		||||
                    dupe = false;
 | 
			
		||||
                    for (i = 0, l = selection.length; i < l; i++) {
 | 
			
		||||
@@ -652,7 +654,7 @@ the specific language governing permissions and limitations under the Apache Lic
 | 
			
		||||
            // destroy if called on an existing component
 | 
			
		||||
            if (opts.element.data("select2") !== undefined &&
 | 
			
		||||
                opts.element.data("select2") !== null) {
 | 
			
		||||
                this.destroy();
 | 
			
		||||
                opts.element.data("select2").destroy();
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            this.container = this.createContainer();
 | 
			
		||||
@@ -793,7 +795,7 @@ the specific language governing permissions and limitations under the Apache Lic
 | 
			
		||||
                    element: element.get(),
 | 
			
		||||
                    css: element.attr("class"),
 | 
			
		||||
                    disabled: element.prop("disabled"),
 | 
			
		||||
                    locked: equal(element.attr("locked"), "locked")
 | 
			
		||||
                    locked: equal(element.attr("locked"), "locked") || equal(element.data("locked"), true)
 | 
			
		||||
                };
 | 
			
		||||
            } else if (element.is("optgroup")) {
 | 
			
		||||
                return {
 | 
			
		||||
@@ -985,7 +987,6 @@ the specific language governing permissions and limitations under the Apache Lic
 | 
			
		||||
                var enabled, readonly, self = this;
 | 
			
		||||
 | 
			
		||||
                // sync enabled state
 | 
			
		||||
 | 
			
		||||
                var disabled = el.prop("disabled");
 | 
			
		||||
                if (disabled === undefined) disabled = false;
 | 
			
		||||
                this.enable(!disabled);
 | 
			
		||||
@@ -1105,14 +1106,14 @@ the specific language governing permissions and limitations under the Apache Lic
 | 
			
		||||
                height = this.container.outerHeight(false),
 | 
			
		||||
                width = this.container.outerWidth(false),
 | 
			
		||||
                dropHeight = $dropdown.outerHeight(false),
 | 
			
		||||
	            viewPortRight = $(window).scrollLeft() + $(window).width(),
 | 
			
		||||
                viewPortRight = $(window).scrollLeft() + $(window).width(),
 | 
			
		||||
                viewportBottom = $(window).scrollTop() + $(window).height(),
 | 
			
		||||
                dropTop = offset.top + height,
 | 
			
		||||
                dropLeft = offset.left,
 | 
			
		||||
                enoughRoomBelow = dropTop + dropHeight <= viewportBottom,
 | 
			
		||||
                enoughRoomAbove = (offset.top - dropHeight) >= this.body().scrollTop(),
 | 
			
		||||
	            dropWidth = $dropdown.outerWidth(false),
 | 
			
		||||
	            enoughRoomOnRight = dropLeft + dropWidth <= viewPortRight,
 | 
			
		||||
                dropWidth = $dropdown.outerWidth(false),
 | 
			
		||||
                enoughRoomOnRight = dropLeft + dropWidth <= viewPortRight,
 | 
			
		||||
                aboveNow = $dropdown.hasClass("select2-drop-above"),
 | 
			
		||||
                bodyOffset,
 | 
			
		||||
                above,
 | 
			
		||||
@@ -1136,7 +1137,6 @@ the specific language governing permissions and limitations under the Apache Lic
 | 
			
		||||
            //console.log("above/ offset.top", offset.top, "dropHeight", dropHeight, "top", (offset.top-dropHeight), "scrollTop", this.body().scrollTop(), "enough?", enoughRoomAbove);
 | 
			
		||||
 | 
			
		||||
            // fix positioning when body has an offset and is not position: static
 | 
			
		||||
 | 
			
		||||
            if (this.body().css('position') !== 'static') {
 | 
			
		||||
                bodyOffset = this.body().offset();
 | 
			
		||||
                dropTop -= bodyOffset.top;
 | 
			
		||||
@@ -1144,7 +1144,6 @@ the specific language governing permissions and limitations under the Apache Lic
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            // always prefer the current above/below alignment, unless there is not enough room
 | 
			
		||||
 | 
			
		||||
            if (aboveNow) {
 | 
			
		||||
                above = true;
 | 
			
		||||
                if (!enoughRoomAbove && enoughRoomBelow) above = false;
 | 
			
		||||
@@ -1435,7 +1434,7 @@ the specific language governing permissions and limitations under the Apache Lic
 | 
			
		||||
        highlightUnderEvent: function (event) {
 | 
			
		||||
            var el = $(event.target).closest(".select2-result-selectable");
 | 
			
		||||
            if (el.length > 0 && !el.is(".select2-highlighted")) {
 | 
			
		||||
        		var choices = this.findHighlightableChoices();
 | 
			
		||||
                var choices = this.findHighlightableChoices();
 | 
			
		||||
                this.highlight(choices.index(el));
 | 
			
		||||
            } else if (el.length == 0) {
 | 
			
		||||
                // if we are over an unselectable item remove al highlights
 | 
			
		||||
@@ -1532,8 +1531,8 @@ the specific language governing permissions and limitations under the Apache Lic
 | 
			
		||||
            if (maxSelSize >=1) {
 | 
			
		||||
                data = this.data();
 | 
			
		||||
                if ($.isArray(data) && data.length >= maxSelSize && checkFormatter(opts.formatSelectionTooBig, "formatSelectionTooBig")) {
 | 
			
		||||
            	    render("<li class='select2-selection-limit'>" + opts.formatSelectionTooBig(maxSelSize) + "</li>");
 | 
			
		||||
            	    return;
 | 
			
		||||
                    render("<li class='select2-selection-limit'>" + opts.formatSelectionTooBig(maxSelSize) + "</li>");
 | 
			
		||||
                    return;
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
@@ -1589,7 +1588,7 @@ the specific language governing permissions and limitations under the Apache Lic
 | 
			
		||||
                this.context = (data.context===undefined) ? null : data.context;
 | 
			
		||||
                // create a default choice and prepend it to the list
 | 
			
		||||
                if (this.opts.createSearchChoice && search.val() !== "") {
 | 
			
		||||
                    def = this.opts.createSearchChoice.call(null, search.val(), data.results);
 | 
			
		||||
                    def = this.opts.createSearchChoice.call(self, search.val(), data.results);
 | 
			
		||||
                    if (def !== undefined && def !== null && self.id(def) !== undefined && self.id(def) !== null) {
 | 
			
		||||
                        if ($(data.results).filter(
 | 
			
		||||
                            function () {
 | 
			
		||||
@@ -1654,7 +1653,7 @@ the specific language governing permissions and limitations under the Apache Lic
 | 
			
		||||
            if (data) {
 | 
			
		||||
                this.highlight(index);
 | 
			
		||||
                this.onSelect(data, options);
 | 
			
		||||
            } else if (options.noFocus) {
 | 
			
		||||
            } else if (options && options.noFocus) {
 | 
			
		||||
                this.close();
 | 
			
		||||
            }
 | 
			
		||||
        },
 | 
			
		||||
@@ -1741,21 +1740,21 @@ the specific language governing permissions and limitations under the Apache Lic
 | 
			
		||||
 | 
			
		||||
        // single
 | 
			
		||||
 | 
			
		||||
		createContainer: function () {
 | 
			
		||||
        createContainer: function () {
 | 
			
		||||
            var container = $(document.createElement("div")).attr({
 | 
			
		||||
                "class": "select2-container"
 | 
			
		||||
            }).html([
 | 
			
		||||
                "<a href='javascript:void(0)' onclick='return false;' class='select2-choice' tabindex='-1'>",
 | 
			
		||||
                "   <span> </span><abbr class='select2-search-choice-close'></abbr>",
 | 
			
		||||
                "   <div><b></b></div>" ,
 | 
			
		||||
                "   <span class='select2-chosen'> </span><abbr class='select2-search-choice-close'></abbr>",
 | 
			
		||||
                "   <span class='select2-arrow'><b></b></span>",
 | 
			
		||||
                "</a>",
 | 
			
		||||
                "<input class='select2-focusser select2-offscreen' type='text'/>",
 | 
			
		||||
                "<div class='select2-drop select2-display-none'>" ,
 | 
			
		||||
                "   <div class='select2-search'>" ,
 | 
			
		||||
                "       <input type='text' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' class='select2-input'/>" ,
 | 
			
		||||
                "   </div>" ,
 | 
			
		||||
                "   <ul class='select2-results'>" ,
 | 
			
		||||
                "   </ul>" ,
 | 
			
		||||
                "<div class='select2-drop select2-display-none'>",
 | 
			
		||||
                "   <div class='select2-search'>",
 | 
			
		||||
                "       <input type='text' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' class='select2-input'/>",
 | 
			
		||||
                "   </div>",
 | 
			
		||||
                "   <ul class='select2-results'>",
 | 
			
		||||
                "   </ul>",
 | 
			
		||||
                "</div>"].join(""));
 | 
			
		||||
            return container;
 | 
			
		||||
        },
 | 
			
		||||
@@ -1911,7 +1910,7 @@ the specific language governing permissions and limitations under the Apache Lic
 | 
			
		||||
                    || (e.which == KEY.ENTER && this.opts.openOnEnter)) {
 | 
			
		||||
 | 
			
		||||
                    if (e.altKey || e.ctrlKey || e.shiftKey || e.metaKey) return;
 | 
			
		||||
                    
 | 
			
		||||
 | 
			
		||||
                    this.open();
 | 
			
		||||
                    killEvent(e);
 | 
			
		||||
                    return;
 | 
			
		||||
@@ -1995,7 +1994,7 @@ the specific language governing permissions and limitations under the Apache Lic
 | 
			
		||||
            if (data) { // guard against queued quick consecutive clicks
 | 
			
		||||
                var placeholderOption = this.getPlaceholderOption();
 | 
			
		||||
                this.opts.element.val(placeholderOption ? placeholderOption.val() : "");
 | 
			
		||||
                this.selection.find("span").empty();
 | 
			
		||||
                this.selection.find(".select2-chosen").empty();
 | 
			
		||||
                this.selection.removeData("select2-data");
 | 
			
		||||
                this.setPlaceholder();
 | 
			
		||||
 | 
			
		||||
@@ -2093,7 +2092,7 @@ the specific language governing permissions and limitations under the Apache Lic
 | 
			
		||||
                // check for a placeholder option if attached to a select
 | 
			
		||||
                if (this.select && this.getPlaceholderOption() === undefined) return;
 | 
			
		||||
 | 
			
		||||
                this.selection.find("span").html(this.opts.escapeMarkup(placeholder));
 | 
			
		||||
                this.selection.find(".select2-chosen").html(this.opts.escapeMarkup(placeholder));
 | 
			
		||||
 | 
			
		||||
                this.selection.addClass("select2-default");
 | 
			
		||||
 | 
			
		||||
@@ -2169,14 +2168,14 @@ the specific language governing permissions and limitations under the Apache Lic
 | 
			
		||||
        // single
 | 
			
		||||
        updateSelection: function (data) {
 | 
			
		||||
 | 
			
		||||
            var container=this.selection.find("span"), formatted, cssClass;
 | 
			
		||||
            var container=this.selection.find(".select2-chosen"), formatted, cssClass;
 | 
			
		||||
 | 
			
		||||
            this.selection.data("select2-data", data);
 | 
			
		||||
 | 
			
		||||
            container.empty();
 | 
			
		||||
            formatted=this.opts.formatSelection(data, container);
 | 
			
		||||
            formatted=this.opts.formatSelection(data, container, this.opts.escapeMarkup);
 | 
			
		||||
            if (formatted !== undefined) {
 | 
			
		||||
                container.append(this.opts.escapeMarkup(formatted));
 | 
			
		||||
                container.append(formatted);
 | 
			
		||||
            }
 | 
			
		||||
            cssClass=this.opts.formatSelectionCssClass(data, container);
 | 
			
		||||
            if (cssClass !== undefined) {
 | 
			
		||||
@@ -2277,17 +2276,16 @@ the specific language governing permissions and limitations under the Apache Lic
 | 
			
		||||
            var container = $(document.createElement("div")).attr({
 | 
			
		||||
                "class": "select2-container select2-container-multi"
 | 
			
		||||
            }).html([
 | 
			
		||||
                "    <ul class='select2-choices'>",
 | 
			
		||||
                //"<li class='select2-search-choice'><span>California</span><a href="javascript:void(0)" class="select2-search-choice-close"></a></li>" ,
 | 
			
		||||
                "  <li class='select2-search-field'>" ,
 | 
			
		||||
                "    <input type='text' autocomplete='off' autocorrect='off' autocapitilize='off' spellcheck='false' class='select2-input'>" ,
 | 
			
		||||
                "  </li>" ,
 | 
			
		||||
                "</ul>" ,
 | 
			
		||||
                "<div class='select2-drop select2-drop-multi select2-display-none'>" ,
 | 
			
		||||
                "   <ul class='select2-results'>" ,
 | 
			
		||||
                "   </ul>" ,
 | 
			
		||||
                "<ul class='select2-choices'>",
 | 
			
		||||
                "  <li class='select2-search-field'>",
 | 
			
		||||
                "    <input type='text' autocomplete='off' autocorrect='off' autocapitilize='off' spellcheck='false' class='select2-input'>",
 | 
			
		||||
                "  </li>",
 | 
			
		||||
                "</ul>",
 | 
			
		||||
                "<div class='select2-drop select2-drop-multi select2-display-none'>",
 | 
			
		||||
                "   <ul class='select2-results'>",
 | 
			
		||||
                "   </ul>",
 | 
			
		||||
                "</div>"].join(""));
 | 
			
		||||
			return container;
 | 
			
		||||
            return container;
 | 
			
		||||
        },
 | 
			
		||||
 | 
			
		||||
        // multi
 | 
			
		||||
@@ -2380,11 +2378,6 @@ the specific language governing permissions and limitations under the Apache Lic
 | 
			
		||||
                _this.search[0].focus();
 | 
			
		||||
                _this.selectChoice($(this));
 | 
			
		||||
            })
 | 
			
		||||
            //.sortable({
 | 
			
		||||
            //    items: " > li",
 | 
			
		||||
            //    tolerance: "pointer",
 | 
			
		||||
            //    revert: 100
 | 
			
		||||
            //});
 | 
			
		||||
 | 
			
		||||
            // rewrite labels from original element to focusser
 | 
			
		||||
            this.search.attr("id", "s2id_autogen"+nextUid());
 | 
			
		||||
@@ -2619,7 +2612,6 @@ the specific language governing permissions and limitations under the Apache Lic
 | 
			
		||||
        focus: function () {
 | 
			
		||||
            this.close();
 | 
			
		||||
            this.search.focus();
 | 
			
		||||
            //this.opts.element.triggerHandler("focus");
 | 
			
		||||
        },
 | 
			
		||||
 | 
			
		||||
        // multi
 | 
			
		||||
@@ -2650,7 +2642,7 @@ the specific language governing permissions and limitations under the Apache Lic
 | 
			
		||||
        // multi
 | 
			
		||||
        tokenize: function() {
 | 
			
		||||
            var input = this.search.val();
 | 
			
		||||
            input = this.opts.tokenizer(input, this.data(), this.bind(this.onSelect), this.opts);
 | 
			
		||||
            input = this.opts.tokenizer.call(this, input, this.data(), this.bind(this.onSelect), this.opts);
 | 
			
		||||
            if (input != null && input != undefined) {
 | 
			
		||||
                this.search.val(input);
 | 
			
		||||
                if (input.length > 0) {
 | 
			
		||||
@@ -2722,9 +2714,9 @@ the specific language governing permissions and limitations under the Apache Lic
 | 
			
		||||
                formatted,
 | 
			
		||||
                cssClass;
 | 
			
		||||
 | 
			
		||||
            formatted=this.opts.formatSelection(data, choice.find("div"));
 | 
			
		||||
            formatted=this.opts.formatSelection(data, choice.find("div"), this.opts.escapeMarkup);
 | 
			
		||||
            if (formatted != undefined) {
 | 
			
		||||
                choice.find("div").replaceWith("<div>"+this.opts.escapeMarkup(formatted)+"</div>");
 | 
			
		||||
                choice.find("div").replaceWith("<div>"+formatted+"</div>");
 | 
			
		||||
            }
 | 
			
		||||
            cssClass=this.opts.formatSelectionCssClass(data, choice.find("div"));
 | 
			
		||||
            if (cssClass != undefined) {
 | 
			
		||||
@@ -2821,11 +2813,11 @@ the specific language governing permissions and limitations under the Apache Lic
 | 
			
		||||
 | 
			
		||||
            //If all results are chosen render formatNoMAtches
 | 
			
		||||
            if(!this.opts.createSearchChoice && !choices.filter('.select2-result:not(.select2-selected)').length > 0){
 | 
			
		||||
            	if(!data || data && !data.more && this.results.find(".select2-no-results").length === 0) {
 | 
			
		||||
            	    if (checkFormatter(self.opts.formatNoMatches, "formatNoMatches")) {
 | 
			
		||||
                if(!data || data && !data.more && this.results.find(".select2-no-results").length === 0) {
 | 
			
		||||
                    if (checkFormatter(self.opts.formatNoMatches, "formatNoMatches")) {
 | 
			
		||||
                        this.results.append("<li class='select2-no-results'>" + self.opts.formatNoMatches(self.search.val()) + "</li>");
 | 
			
		||||
                    }
 | 
			
		||||
            	}
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
        },
 | 
			
		||||
@@ -2838,7 +2830,7 @@ the specific language governing permissions and limitations under the Apache Lic
 | 
			
		||||
        // multi
 | 
			
		||||
        resizeSearch: function () {
 | 
			
		||||
            var minimumWidth, left, maxWidth, containerLeft, searchWidth,
 | 
			
		||||
            	sideBorderPadding = getSideBorderPadding(this.search);
 | 
			
		||||
                sideBorderPadding = getSideBorderPadding(this.search);
 | 
			
		||||
 | 
			
		||||
            minimumWidth = measureTextWidth(this.search) + 10;
 | 
			
		||||
 | 
			
		||||
@@ -2985,7 +2977,6 @@ the specific language governing permissions and limitations under the Apache Lic
 | 
			
		||||
            this.resizeSearch();
 | 
			
		||||
 | 
			
		||||
            // update selection
 | 
			
		||||
 | 
			
		||||
            this.selection.find(".select2-search-choice").each(function() {
 | 
			
		||||
                val.push(self.opts.id($(this).data("select2-data")));
 | 
			
		||||
            });
 | 
			
		||||
@@ -3085,8 +3076,8 @@ the specific language governing permissions and limitations under the Apache Lic
 | 
			
		||||
            markMatch(result.text, query.term, markup, escapeMarkup);
 | 
			
		||||
            return markup.join("");
 | 
			
		||||
        },
 | 
			
		||||
        formatSelection: function (data, container) {
 | 
			
		||||
            return data ? data.text : undefined;
 | 
			
		||||
        formatSelection: function (data, container, escapeMarkup) {
 | 
			
		||||
            return data ? escapeMarkup(data.text) : undefined;
 | 
			
		||||
        },
 | 
			
		||||
        sortResults: function (results, container, query) {
 | 
			
		||||
            return results;
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										1
									
								
								src/inputs/select2/select2.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								src/inputs/select2/select2.js
									
									
									
									
										vendored
									
									
								
							@@ -168,6 +168,7 @@ $(function(){
 | 
			
		||||
           
 | 
			
		||||
           if(this.options.select2.tags) { //in tags mode just assign value
 | 
			
		||||
              data = value; 
 | 
			
		||||
              //data = $.fn.editableutils.itemsByValue(value, this.options.select2.tags, this.idFunc); 
 | 
			
		||||
           } else if(this.sourceData) {
 | 
			
		||||
              data = $.fn.editableutils.itemsByValue(value, this.sourceData, this.idFunc); 
 | 
			
		||||
           } else {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user