Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

improve configuration functional

  • Loading branch information...
commit 38a560f76b567db4c7f9394dcf898ac5b2f6e0be 1 parent 01bc1a1
@ichord authored
Showing with 10 additions and 3 deletions.
  1. +2 −1  coffee/jquery.atwho.coffee
  2. +5 −0 example.html
  3. +3 −2 js/jquery.atwho.js
View
3  coffee/jquery.atwho.coffee
@@ -101,7 +101,8 @@
opt['callback'] = options
else
opt = options
- @.options[flag] = $.extend {}, $.fn.atWho.default, opt
+ _default = @.options[flag] or= $.fn.atWho.default
+ @.options[flag] = $.extend {}, _default, opt
log "At.reg", @.$inputor[0],flag, options
dataValue: ->
View
5 example.html
@@ -35,6 +35,10 @@
})
}
});
+
+ $("button#reflash").click(function(){
+ $("textarea#inputor").atWho("@",{"data":data.splice(0,3)})
+ })
emojis = [
"six_pointed_star", "ski", "skull", "sleepy", "slot_machine", "smile",
@@ -78,6 +82,7 @@
<body>
<div class="box"></div>
<div class="box"></div>
+ <button id="reflash">reflash</button>
<textarea id="inputor" name="at" rows="8" cols="40">
this textarea register "@" with static data
and ":" with ajax.
View
5 js/jquery.atwho.js
@@ -117,14 +117,15 @@
return log("At.init", this.$inputor[0]);
},
reg: function(flag, options) {
- var opt;
+ var opt, _base, _default;
opt = {};
if ($.isFunction(options)) {
opt['callback'] = options;
} else {
opt = options;
}
- this.options[flag] = $.extend({}, $.fn.atWho["default"], opt);
+ _default = (_base = this.options)[flag] || (_base[flag] = $.fn.atWho["default"]);
+ this.options[flag] = $.extend({}, _default, opt);
return log("At.reg", this.$inputor[0], flag, options);
},
dataValue: function() {
Please sign in to comment.
Something went wrong with that request. Please try again.