|
|
|
@ -135,6 +135,11 @@ define([
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
var $root = $t.parent();
|
|
|
|
|
$t.on('tokenfield:removetoken', function (e) {
|
|
|
|
|
$root.find('.token-input').focus();
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
t.preventDuplicates = function (cb) {
|
|
|
|
|
$t.on('tokenfield:createtoken', function (ev) {
|
|
|
|
|
var val;
|
|
|
|
@ -185,22 +190,29 @@ define([
|
|
|
|
|
var $t = $(tagger).fadeOut(150, function () { $t.remove(); });
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
var listener = listenForKeys(function () {}, function () {
|
|
|
|
|
close();
|
|
|
|
|
var listener;
|
|
|
|
|
var close = Util.once(function (result, ev) {
|
|
|
|
|
var $frame = $(tagger).fadeOut(150, function () {
|
|
|
|
|
stopListening(listener);
|
|
|
|
|
$frame.remove();
|
|
|
|
|
cb(result, ev);
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
var CB = Util.once(cb);
|
|
|
|
|
findOKButton(tagger).click(function () {
|
|
|
|
|
var $ok = findOKButton(tagger).click(function () {
|
|
|
|
|
var tokens = field.getTokens();
|
|
|
|
|
close();
|
|
|
|
|
CB(tokens);
|
|
|
|
|
close(tokens);
|
|
|
|
|
});
|
|
|
|
|
var $cancel = findCancelButton(tagger).click(function () {
|
|
|
|
|
close(null);
|
|
|
|
|
});
|
|
|
|
|
findCancelButton(tagger).click(function () {
|
|
|
|
|
close();
|
|
|
|
|
CB(null);
|
|
|
|
|
listenForKeys(function () {
|
|
|
|
|
$ok.click();
|
|
|
|
|
}, function () {
|
|
|
|
|
$cancel.click();
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
document.body.appendChild(tagger);
|
|
|
|
|
// :(
|
|
|
|
|
setTimeout(function () {
|
|
|
|
|
field.setTokens(tags);
|
|
|
|
|