Skip to content
This repository has been archived by the owner on Feb 18, 2018. It is now read-only.

Commit

Permalink
Bump to 2.4.1
Browse files Browse the repository at this point in the history
  • Loading branch information
knalli committed Aug 20, 2013
1 parent aa9d10a commit b571fbe
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 12 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -548,6 +548,10 @@ echo json_encode($data);

## Release History

## 2013-08-20 Version 2.4.1

* Fix: Use proper prefixed classes (thanks @scholastica #26).

## 2013-08-18 Version 2.4.0

* Add: New option `creationText` indicating a token will be created when using `canGenerateNewSelections` (643215d0be3f1066b8239dfd072e8485bd648c75).
Expand Down
48 changes: 39 additions & 9 deletions dist/jquery.autoSuggest.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*! jQuery AutoSuggest - v2.4.0 - 2013-08-19
/*! jQuery AutoSuggest - v2.4.1 - 2013-08-20
* URL: http://hlsolutions.github.com/jquery-autosuggest
* Copyright (c) 2013 Jan Philipp
* Licensed MIT, GPL */
Expand All @@ -22,7 +22,8 @@ Based on the 1.6er release dated in July, 2012

$ = jQuery;

/* A collection of utility functions.*/
/* A collection of utility functions.
*/


Utils = (function() {
Expand All @@ -42,6 +43,7 @@ Based on the 1.6er release dated in July, 2012

Utils.setPlaceholderEnabled = function(input, enable) {
var from, targets, to;

targets = ['placeholder', 'disabled-placeholder'];
if (enable) {
from = targets[1];
Expand All @@ -63,7 +65,8 @@ Based on the 1.6er release dated in July, 2012

})();

/* A collection of configuration resolvers.*/
/* A collection of configuration resolvers.
*/


ConfigResolver = (function() {
Expand All @@ -79,6 +82,7 @@ Based on the 1.6er release dated in July, 2012

ConfigResolver.getExtraParams = function(options) {
var obj, pair, parts, result, _i, _len, _ref;

result = options.extraParams;
if ($.isFunction(result)) {
result = result(this);
Expand Down Expand Up @@ -110,7 +114,8 @@ Based on the 1.6er release dated in July, 2012

})();

/* The SelectionControl maintains and manage any selections.*/
/* The SelectionControl maintains and manage any selections.
*/


SelectionHolder = (function() {
Expand All @@ -127,6 +132,7 @@ Based on the 1.6er release dated in July, 2012

SelectionHolder.prototype.syncToHiddenField = function() {
var item, value, _i, _len, _ref;

if (!this.hiddenField) {
return;
}
Expand Down Expand Up @@ -182,6 +188,7 @@ Based on the 1.6er release dated in July, 2012

Events.onSelectionAdd = function(scope, containerElement, detachedElement, options, item, selections) {
var element;

element = options.onSelectionAdd.call(scope, containerElement, detachedElement, options);
Utils.setPlaceholderEnabled(scope, selections.length === 0);
if ($.isFunction(options.afterSelectionAdd)) {
Expand Down Expand Up @@ -446,6 +453,7 @@ Based on the 1.6er release dated in July, 2012

onRenderErrorMessage: function(validationData, element, options) {
var error;

error = $("#" + validationData.id);
if (!error.length) {
element.closest('ul').after("<span id='" + validationData.id + "' class='as-error'></span>");
Expand Down Expand Up @@ -550,6 +558,7 @@ Based on the 1.6er release dated in July, 2012
pluginMethods = {
init: function(dataSource, options) {
var ajaxRequest, fetcher;

options = $.extend({}, defaults, options);
ajaxRequest = null;
if (options.remoteFilter === 'auto') {
Expand All @@ -562,8 +571,10 @@ Based on the 1.6er release dated in July, 2012
case 'string':
return function(query, callback) {
var ajaxRequestConfig, extraParams, onDone, params;

params = {};
/* ensures query is encoded*/
/* ensures query is encoded
*/

params["" + options.queryParam] = encodeURIComponent(decodeURIComponent(query));
if (options.retrieveLimit) {
Expand Down Expand Up @@ -605,6 +616,7 @@ Based on the 1.6er release dated in July, 2012

return this.each(function() {
var abortRequest, addSelection, clonePublicApi, currentSelection, element, elementId, hiddenInputField, hiddenInputFieldId, hiddenInputFieldName, i, input, inputWrapper, input_focus, interval, item, keyChange, lastKeyPressCode, lastKeyWasTab, moveResultSelection, new_value, num_count, prev, processData, processRequest, publicApi, resultsContainer, resultsList, selectionsContainer, timeout, validationErrorId, validations, value, _i, _j, _len, _len1, _ref, _ref1;

options.inputAttrs = $.extend(options.inputAttrs, {});
input_focus = false;
input = $(this);
Expand Down Expand Up @@ -670,6 +682,7 @@ Based on the 1.6er release dated in July, 2012
publicApi = {
add: function(data) {
var counted, item;

counted = $(selectionsContainer).find('li').length;
item = addSelection(data, "u" + counted);
if (item != null) {
Expand Down Expand Up @@ -701,6 +714,7 @@ Based on the 1.6er release dated in July, 2012

addSelection = function(data, num) {
var closeElement, item;

currentSelection.add(data[options.selectedValuesProp]);
item = $("<li class=\"as-selection-item\" id=\"as-selection-" + num + "\" data-value=\"" + (Utils.escapeQuotes(Utils.escapeHtml(data[options.selectedValuesProp]))) + "\"></li>");
item.on({
Expand Down Expand Up @@ -792,6 +806,7 @@ Based on the 1.6er release dated in July, 2012
*/

var string, _k, _results;

if (lastKeyPressCode === 46 || __indexOf.call((function() {
_results = [];
for (_k = 9; _k < 31; _k++){ _results.push(_k); }
Expand Down Expand Up @@ -822,6 +837,7 @@ Based on the 1.6er release dated in July, 2012
};
processData = function(data, query) {
var creation_hint, formatted, forward, matchCount, name, num, original_query, regex, resultsContainerVisible, str, text, workingData, _k, _l, _len2, _len3, _ref2;

creation_hint = false;
original_query = query;
if (!options.matchCase) {
Expand All @@ -838,6 +854,7 @@ Based on the 1.6er release dated in July, 2012
formatted.on({
click: function() {
var n_data;

n_data = {};
n_data["" + options.selectedItemProp] = original_query;
n_data["" + options.selectedValuesProp] = original_query;
Expand Down Expand Up @@ -890,6 +907,7 @@ Based on the 1.6er release dated in July, 2012
formatted.on({
click: function() {
var number, raw_data;

element = $(this);
raw_data = element.data('data');
number = raw_data.num;
Expand Down Expand Up @@ -921,7 +939,8 @@ Based on the 1.6er release dated in July, 2012
workingData = $.extend({}, data[num]);
query = query.replace(/"/g, '\\"');
regex = !options.matchCase ? new RegExp("(?![^&;]+;)(?!<[^<>]*)(" + Utils.escapeHtml(query) + ")(?![^<>]*>)(?![^&;]+;)", "gi") : new RegExp("(?![^&;]+;)(?!<[^<>]*)(" + Utils.escapeHtml(query) + ")(?![^<>]*>)(?![^&;]+;)", "g");
/* When this is a string, escape the value and process a regular replacement for highlighting.*/
/* When this is a string, escape the value and process a regular replacement for highlighting.
*/

if (typeof workingData[options.selectedItemProp] === 'string') {
workingData[options.selectedItemProp] = Utils.escapeHtml(workingData[options.selectedItemProp]);
Expand Down Expand Up @@ -967,6 +986,7 @@ Based on the 1.6er release dated in July, 2012
};
moveResultSelection = function(direction) {
var active, lis, start;

if (resultsContainer.find(':visible').length) {
lis = resultsContainer.find('li');
switch (direction) {
Expand Down Expand Up @@ -1000,6 +1020,7 @@ Based on the 1.6er release dated in July, 2012
validations = {
clear: function() {
var data;

data = {
id: validationErrorId
};
Expand All @@ -1010,6 +1031,7 @@ Based on the 1.6er release dated in July, 2012
},
renderMinChars: function() {
var data;

data = {
id: validationErrorId,
errorMessage: "must be at least " + options.minChars + " characters",
Expand All @@ -1020,6 +1042,7 @@ Based on the 1.6er release dated in July, 2012
},
renderMaxChars: function() {
var data;

data = {
id: validationErrorId,
errorMessage: "must be " + options.maxChars + " characters or fewer",
Expand Down Expand Up @@ -1081,6 +1104,7 @@ Based on the 1.6er release dated in July, 2012
},
keyup: function() {
var charLength;

charLength = (input.val().replace(/(,)/g, '')).length;
if (charLength > options.maxChars) {
validations.renderMaxChars();
Expand All @@ -1090,9 +1114,11 @@ Based on the 1.6er release dated in July, 2012
}
},
keydown: function(event) {
/* track the last key pressed*/
/* track the last key pressed
*/

var active, first_focus, i_input, n_data, _selection, _selections;

lastKeyPressCode = event.keyCode;
first_focus = false;
i_input = input.val().replace(/(,)/g, '');
Expand Down Expand Up @@ -1160,7 +1186,8 @@ Based on the 1.6er release dated in July, 2012
}
active = resultsContainer.find('li.active:first');
} else if (options.canGenerateNewSelections) {
/* Generate a new bubble with text when no suggestion selected*/
/* Generate a new bubble with text when no suggestion selected
*/

if (i_input.length > options.maxChars) {
validations.renderMaxChars();
Expand All @@ -1174,7 +1201,8 @@ Based on the 1.6er release dated in July, 2012
addSelection(n_data, "00" + (selectionsContainer.find('li').length + 1));
input.val('');
validations.clear();
/* Cancel previous ajaxRequest when new tag is added*/
/* Cancel previous ajaxRequest when new tag is added
*/

abortRequest();
}
Expand Down Expand Up @@ -1207,6 +1235,7 @@ Based on the 1.6er release dated in July, 2012
},
add: function() {
var element, item, items, _i, _len;

items = 1 <= arguments.length ? __slice.call(arguments, 0) : [];
element = $(this);
for (_i = 0, _len = items.length; _i < _len; _i++) {
Expand All @@ -1216,6 +1245,7 @@ Based on the 1.6er release dated in July, 2012
},
remove: function() {
var element, value, values, _i, _len;

values = 1 <= arguments.length ? __slice.call(arguments, 0) : [];
element = $(this);
for (_i = 0, _len = values.length; _i < _len; _i++) {
Expand Down
Loading

0 comments on commit b571fbe

Please sign in to comment.