Skip to content

Commit

Permalink
Hand merged commit 86ae6e3 from upstream master with some
Browse files Browse the repository at this point in the history
interpretation of what the intent should be in the context
of the vdepizzol branch.
  • Loading branch information
arrbee committed Jul 28, 2011
1 parent 515d0a5 commit b70002b
Showing 1 changed file with 16 additions and 17 deletions.
33 changes: 16 additions & 17 deletions src/jquery.tokeninput.js
Expand Up @@ -480,11 +480,8 @@ $.TokenList = function (input, url_or_data_or_function, settings) {
return false; return false;
} }
}); });


if(li_data.length >= settings.tokenLimit && settings.tokenLimit != null) { checkTokenLimit();
input_box.hide();
hide_dropdown();
}
} }




Expand Down Expand Up @@ -525,7 +522,16 @@ $.TokenList = function (input, url_or_data_or_function, settings) {
// //
// Private functions // Private functions
// //


function checkTokenLimit(){
if(settings.tokenLimit !== null && token_count >= settings.tokenLimit) {
input_box.hide();
hide_dropdown();
return;
} else {
input_box.focus();
}
}


function resize_input() { function resize_input() {
if(input_val === (input_val = input_box.val())) {return;} if(input_val === (input_val = input_box.val())) {return;}
Expand Down Expand Up @@ -642,20 +648,13 @@ $.TokenList = function (input, url_or_data_or_function, settings) {


// Insert the new tokens // Insert the new tokens
insert_token(li_data); insert_token(li_data);

checkTokenLimit();

// Clear input box // Clear input box
input_box.val(""); input_box.val("");


// Check the token limit // Don't show the help dropdown, they've got the idea
if(settings.tokenLimit !== null && token_count >= settings.tokenLimit) { hide_dropdown();
input_box.hide();
hide_dropdown();
} else {
input_box.focus();

// Don't show the help dropdown, they've got the idea
hide_dropdown();
}


// Execute the onAdd callback if defined // Execute the onAdd callback if defined
if($.isFunction(callback)) { if($.isFunction(callback)) {
Expand Down

0 comments on commit b70002b

Please sign in to comment.