ichord / at.js Goto Github PK
View Code? Open in Web Editor NEWAdd Github like mentions autocomplete to your application.
Home Page: http://ichord.github.com/At.js
License: MIT License
Add Github like mentions autocomplete to your application.
Home Page: http://ichord.github.com/At.js
License: MIT License
在 admin 里勾上 wiki 吧。
ext生成的textarea绑定了。但是输入@没触发
I fix it add this line into the first line of Controller.prototype.replace_str function
:
str = ""+str;//make sure str is string not int;
if data-value
is an "integer string "such as "1234", str
parameter will automatically turn into an integer, then str.length
will become undefined.
so I add that line to make sure str
is a string.
不知道是不是bug?
我用$替换@重复触发了
避免跟正则的符号或者其它符号冲突.
I love it! I've been looking for something like this for awhile.
Only thing, is there a way to make this work for things like <div contenteditable></div>
, because that would be awesome.
If I find a way to make it work I'll let you know, and push the change.
当搜索结果太多的时候,默认显示6个。并且可以配置.
Unicode characters isn't supported (e.g: éàèâüöäüкийلعرب日本語...)
I've come with a quick-fix with XRegexp lib + the unicode addon http://xregexp.com/plugins/#unicode
regexp = XRegExp ? new XRegExp('(\\s+|^)' + flag + '(\\p{L}+)$', 'gi') : (the_non_unicode_regexp);
What would you think of this solution?
试一下 -1 和 +1
之前是这样:$('textarea').atwho("@",{'data':data});
不知道At.js是不是用了 live 方法。
改成这样就好了:$("textarea").on("atWho","@",{'data': data});
你好,请问你demo中的图标,在哪可以下载一套下来?谢谢。
http://a248.e.akamai.net/assets.github.com/images/icons/emoji/${name}.png
可以在富文本编辑器上使用么?是否能实现?
Amazing job @ichord!
If you need help with wiki pages in English I may help you out.
I've a question though: how would you pass resulting values to backend to store mentions? I guess something like https://github.com/podio/jquery-mentions-input, passing @entity_name as a callback. What do you think?
I think the data_refactor
should be used for ajax data like the raw data or it will be confusing.
Hi,
just found out that when I using font Lucida Grand, the upper side of the selection view will block a little bit of the bottom of the text. It causes that it's not so perfect like you showed in your demo.
Is there a way to fix that?
You could see my screenshot: http://minus.com/m97KHnYP0
不仅仅能扑捉@ 还可以注册多个特殊字符.
参照 jquery.mentionInput 改进功能
重写README. 列出改进后的功能,以及用法
Is it possible to implement this? I'm using this for a chat where the chatbox is at the bottom of your screen. I need the popup to come above the text instead of underneath. If this could be added I would be very grateful. Other than that it's amazing!
在 ie 瀏覽器下, 自行設置了字體大小後, 補全列表顯示錯位.
This is a really cool plugin but it lacks good documentation. I would like to use it in some of my sites but I'm having some troubles figuring out how to use it. How did you get it to look like it does on the website?
pull core function out from At.js:
其实这个插件的核心功能就是准确定位列表框的位置.
可以将它做成一个独立的插件. 让其他开发者也可以使用.
ie8下,当@后面输入中文时,无法正确获取候选列表。
TypeError: t.sort is not a function
...turn t=this.$inputor,r=t.val(),n=this.get_opt("display_flag")?0:this.current_fla...
jquery.atwho.min.js (第 4 行)
TypeError: t.sort is not a function
...turn t=this.$inputor,r=t.val(),n=this.get_opt("display_flag")?0:this.current_fla...
----------------------下面是我调用时的代码:
$("textarea").atwho("@", {
data:"/at/ajax.php"
});
引用的2个js库是以下2个:
http://code.jquery.com/jquery-1.9.1.min.js
http://ichord.github.io/At.js/assets/js/jquery.atwho.min.js
为了能描述清楚功能, 目前用中文写文档.
需要写另一份英文文档.
support it!
使用 codo 生成类似 yardoc
的文档.
将整个 At.js
分成小功能模块, 方便写单元测试.
例如现在默认的回调函数列表, 都是独立出来的小逻辑. 可分别写测试
I just upgraded from 0.2b to 0.2.0 and noticed something different.
In 0.2b, I can preload some data as well as set up a callbck (which loads data from remote). Upon user input, the plugin would first search in the reload data, if it cannot find locally, it will then turn to the callbck.
I got 0.2.0 to work by setting the remote url as data
parameter, which is passed to remote_filter
as the url
parameter (if I did not get it wrong). As a result of this, I can find nowhere to set the preload data. Is there a way to do this in 0.2.0?
BTW, would you write an upgrade guide for 0.2.0, as the API seems undergoing big change. AFAIK, sites like python-china.org are still using 0.2b.
Hi, I'm using v 0.2.
I couldn't find a good example on how to use the script along with an ajax call so I made my own call, I got my server to sent a basic json string with the follow sintax:
{"1":"username","2":"username"}
where 1 and 2 are users IDs taken from the DB and the names are usernames.
problem is, the json string isn't been properly converted to a javascript object and when I pass my var to atwho it gives me this error: name.toLowerCase
on line: if (name.toLowerCase().indexOf(query) >= 0) {
This is my full code:
jQuery(function(){
var breezeUsers = jQuery.ajax({
type: 'GET',
url: smf_scripturl + '?action=breezeajax;sa=usersmention',
data: '',
cache: false,
dataType: 'json',
success: function(html)
{
return jQuery.parseJSON(html);
}
});
data = jQuery.map(breezeUsers, function(value, i) {
return {'id':i, 'name':value,};
});
jQuery('#content').atwho("@",{
tpl: "<li data-value='(${name}, ${id})'>${name} <small>${name}</small></li>",
'data': data,
'choose': "data-value",
'callbacks': false,
});
});
And yes, my server is sending a valid json string but somehow the atwho script isn't getting a valid object thus it fails on the callback checks.
Is there a way to disable all the callbacks? I do not need them at all.
Can you please post an example on how to use the ajax callback?
Thanks.
text is undefined
[在此错误处中断]
if (text.toLowerCase().indexOf(query) === -1) continue;
我用coffeescript写的,加了一个大括号,这样参数应该没错把了
$('textarea').atWho(
'@'
{
tpl : ''
callback : (query, callback) ->
$.ajax(
url : ''
type : 'GET'
success : (datas) ->
callback(datas)
)
}
)
解析后的JS
$('textarea').atWho('@', {
tpl: '',
callback: function(query, callback) {
return $.ajax({
url: '',
type: 'GET',
success: function(datas) {
return callback(datas);
}
});
}
});
为 At.js 相关动作设置发布事件. 比如在弹出下拉列表时, 发布一个 showing
事件
only support for textarea and input?
when the textarea changed, the position of show box is wrong.
example tells everything.
输入@或者 :后,只能下上键然后回车选择项,使用鼠标选弹出的某个项,会跳到选第一个项。
我用$代替@触发,因为要在注释里面写${name}这种 $是正则表达式元字符。我加了转义。问题解决了
Hey,
I'm looking for the english documentation ...
The JS code in the master branch is leaking a __bind
global variable, which was not the case in the 0.1.x-stable branch: https://github.com/ichord/At.js/blob/master/dist/js/jquery.atwho.js#L9
Just read the documentation and it's of quite good quality.
However, AFAIK, "customer" cannot be used as verb. So, maybe "Custom Template" and "You can customize..." are more appropriate.
Also, applying text-shadow
on <strong>
tags seems a little overkill. Bold font is already emphatic.
issues如题,具体代码:
$('textarea').atWho({
config
});
$('body').delegate('textarea', 'keyup', function () {
alert('不会执行');
});
看了下代码,有可能是,jquery.atwho.js 第304行的 return false; 的问题。麻烦有空的时候看看。
以@为例子, 在输入asdf@topic
,补全完成后在@前面增加一个空格来区分,这样用正则处理的时候比较方便。
some functions upgraded. details in CHANGELOG.md
因为有可能在输入中有的时候并不希望被提示,比如我就是想输入一个冒号,这时菜单弹出了,希望能简单地就关闭它,请问有没有可能提供一个方式来手动关闭提示菜单,比如Esc键?
Is there a way to trigger the .show()
method manually? That is to say could I call something like $('#inputor').atWho.show("@")
and get the drop down list? I can't figure out how to do something like this.
In other words, it'd be nice if there were a way to show the menu even if a user hasn't typed the appropriate flag. I have a situation where the @
is added to the beginning automatically so that means the user never presses the trigger button - so I need a way to force the menu to open.
Hi there,
I like your plug-in very much, actually I think this is the best one so far. However I got some problems when trying to get data from the server by using remote_filter as you mentioned, can you give an example with ASP or PHP whatever?
It will be perfect if the documentation can be enhanced!
With best regards,
windfly
我在 forrst 上得到的反馈: http://forrst.com/posts/At_js-VrN
目前只做了过滤,没做排序算法。下面提供一个方案(我一个小玩具的算法)
https://gist.github.com/2225611
基本的思路是做 indexOf 匹配,记录下 index 的值,再以这个 index 值来做 sort。
现在的问题是,比如有两个名字: lepture, reorx ,当我输入 re 时,排在第1的是 lepture, 但是这个时候很明显应该排第1的是 reorx。
(代码没能看懂,没法发 pull request,只能你来处理了)
it get confuse with remote_filter
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.