Git Product home page Git Product logo

at.js's People

Contributors

4ver avatar adam-lynch avatar beaulebens avatar elkuku avatar houd1ni avatar ichord avatar jdecool avatar junosuarez avatar larryzhao avatar lepture avatar lumeet avatar lvegerano avatar markdon avatar millerdev avatar mjtko avatar mleone avatar mottie avatar narkoz avatar orangejenny avatar pborreli avatar reneklacan avatar runephilosof avatar srokap avatar steverob avatar tomanthony avatar torifat avatar ttakuru88 avatar vcekov avatar vulgarcoder avatar wtkb avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

at.js's Issues

fix caret position incorrectly when data-value is an integer

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.

IE 7 -10 Compatiable

  • At.js: IE scale_bottom = -2 if IE Version <= 7
  • Caret.js: Using createTextRange instead of createRange in getting positin.

related to #68 #67

Work for contenteditable

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个。并且可以配置.

Supports unicode characters

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?

Backend

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?

通用

不仅仅能扑捉@ 还可以注册多个特殊字符.

Above instead of below

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!

Good plugin but poor documentation

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?

separare core functions of At.js

pull core function out from At.js:

  • get caret position
  • get caret offset

其实这个插件的核心功能就是准确定位列表框的位置.
可以将它做成一个独立的插件. 让其他开发者也可以使用.

使用ajax获取json数据的时候,报错

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

英文文档

为了能描述清楚功能, 目前用中文写文档.
需要写另一份英文文档.

单元测试

将整个 At.js 分成小功能模块, 方便写单元测试.
例如现在默认的回调函数列表, 都是独立出来的小逻辑. 可分别写测试

Preload data together with remote search?

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.

Problems handling ajax calls.

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

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);
      }
    });
  }
});

设置发布 jquery 事件

为 At.js 相关动作设置发布事件. 比如在弹出下拉列表时, 发布一个 showing 事件

Documentation improvements

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.

atwho,导致当前元素delegate的其他事件失效。

issues如题,具体代码:

$('textarea').atWho({
  config
});
$('body').delegate('textarea', 'keyup', function () {
  alert('不会执行');
});

看了下代码,有可能是,jquery.atwho.js 第304行的 return false; 的问题。麻烦有空的时候看看。

插入时前后都加空格

以@为例子, 在输入asdf@topic,补全完成后在@前面增加一个空格来区分,这样用正则处理的时候比较方便。

好像没有手动关闭提示菜单的方法

因为有可能在输入中有的时候并不希望被提示,比如我就是想输入一个冒号,这时菜单弹出了,希望能简单地就关闭它,请问有没有可能提供一个方式来手动关闭提示菜单,比如Esc键?

A way to trigger .show()

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.

排序算法

目前只做了过滤,没做排序算法。下面提供一个方案(我一个小玩具的算法)

https://gist.github.com/2225611

基本的思路是做 indexOf 匹配,记录下 index 的值,再以这个 index 值来做 sort。

现在的问题是,比如有两个名字: lepture, reorx ,当我输入 re 时,排在第1的是 lepture, 但是这个时候很明显应该排第1的是 reorx。

(代码没能看懂,没法发 pull request,只能你来处理了)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.