Skip to content

Commit

Permalink
Merge pull request #227 from sdelements/master
Browse files Browse the repository at this point in the history
Fix an issue with prefilled tags among other things...
  • Loading branch information
johnnyshields committed Nov 27, 2014
2 parents 3c20152 + 8acecdd commit df9eb99
Showing 1 changed file with 22 additions and 10 deletions.
32 changes: 22 additions & 10 deletions tagmanager.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,10 @@
}

// call the validator (if any) and do not let the tag pass if invalid
if (opts.validator && !opts.validator(tag)) { return; }
if (opts.validator && !opts.validator(tag)) {
$self.trigger('tm:invalid', tag)
return;
}

// dont accept new tags beyond the defined maximum
if (opts.maxTags > 0 && tlis.length >= opts.maxTags) { return; }
Expand All @@ -102,13 +105,22 @@

if (alreadyInList) {
$self.trigger('tm:duplicated', tag);
$("#" + $self.data("tm_rndid") + "_" + tlid[idx]).stop()
.animate({backgroundColor: opts.blinkBGColor_1}, 100)
.animate({backgroundColor: opts.blinkBGColor_2}, 100)
.animate({backgroundColor: opts.blinkBGColor_1}, 100)
.animate({backgroundColor: opts.blinkBGColor_2}, 100)
.animate({backgroundColor: opts.blinkBGColor_1}, 100)
.animate({backgroundColor: opts.blinkBGColor_2}, 100);
if (opts.blinkClass) {
for (var i = 0; i < 6; ++i) {
$("#" + $self.data("tm_rndid") + "_" + tlid[idx]).queue(function(next) {
$(this).toggleClass(opts.blinkClass);
next();
}).delay(100);
}
} else {
$("#" + $self.data("tm_rndid") + "_" + tlid[idx]).stop()
.animate({backgroundColor: opts.blinkBGColor_1}, 100)
.animate({backgroundColor: opts.blinkBGColor_2}, 100)
.animate({backgroundColor: opts.blinkBGColor_1}, 100)
.animate({backgroundColor: opts.blinkBGColor_2}, 100)
.animate({backgroundColor: opts.blinkBGColor_1}, 100)
.animate({backgroundColor: opts.blinkBGColor_2}, 100);
}
} else {
if (opts.externalTagId === true) {
if (externalTagId === undefined) {
Expand Down Expand Up @@ -148,11 +160,11 @@
$(opts.tagsContainer).append($el);
} else {
if (tlid.length > 1) {
lastTagObj = $("#" + $self.data("tm_rndid") + "_" + tlid[tlid.length - 2]);
lastTagObj = $self.siblings("#" + $self.data("tm_rndid") + "_" + tlid[tlid.length - 2]);
lastTagObj.after($el);
} else {
$self.before($el);
}
}
}

$el.find("#" + newTagRemoveId).on("click", $self, function(e) {
Expand Down

0 comments on commit df9eb99

Please sign in to comment.