Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
445 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
module.exports = function(grunt) { | ||
var pkg = grunt.file.readJSON('package.json'); | ||
|
||
grunt.initConfig({ | ||
pkg: pkg, | ||
|
||
download: { | ||
options: { | ||
dest: 'src' | ||
}, | ||
js: { | ||
options: { | ||
transform: function(code) { | ||
return [ | ||
'define(function(require, exports, module) {', | ||
"require('caret');", | ||
"var jQuery = require('$');", | ||
code.replace('window.jQuery', 'jQuery'), | ||
"});" | ||
].join('\n'); | ||
} | ||
}, | ||
url: 'https://raw.github.com/ichord/At.js/v<%= pkg.version%>/dist/js/jquery.atwho.js', | ||
name: 'atwho.js' | ||
}, | ||
css: { | ||
options: { | ||
transform: function(code) { | ||
return [ | ||
code | ||
].join('\n'); | ||
} | ||
}, | ||
url: 'https://raw.github.com/ichord/At.js/v<%= pkg.version%>/dist/css/jquery.atwho.css', | ||
name: 'atwho.css' | ||
} | ||
} | ||
}); | ||
|
||
grunt.loadGlobalTasks('spm-build'); | ||
grunt.util._.merge(grunt.config.data, require('spm-build').config); | ||
|
||
grunt.loadTasks('../_tasks/download/tasks'); | ||
grunt.registerTask('build', ['download', 'spm-build']); | ||
|
||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
**An autocompletion library to autocomplete mentions, smileys etc. just like on Github or Twitter!** [![Build Status](https://travis-ci.org/ichord/At.js.png)](https://travis-ci.org/ichord/At.js) | ||
|
||
#### Notice | ||
|
||
At.js now **depends on** [Caret.js](https://github.com/ichord/Caret.js). | ||
|
||
This branch has been updated to `v0.4.x`. Please read **CHANGELOG.md** for more details. | ||
English Documentation will keep improving. Maybe **you can do me a favor?** | ||
|
||
### Demo | ||
|
||
http://ichord.github.com/At.js | ||
|
||
|
||
### Features Preview | ||
|
||
* Supports HTML5 [**contentEditable**](https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/Content_Editable) elements (NOT include IE 8) | ||
* Can listen to any character and not just '@'. Can set up multiple listeners for different characters with different behavior and data | ||
* Listener events can be bound to multiple inputors. | ||
* Format returned data using templates | ||
* Keyboard controls in addition to mouse | ||
- `Tab` or `Enter` keys select the value | ||
- `Up` and `Down` navigate between values (and `Ctrl-P` and `Ctrl-N` also) | ||
- `Right` and `left` will re-search the keyword. | ||
* Custom data handlers and template renderers using a group of configurable callbacks | ||
* Supports AMD | ||
|
||
### Requirements | ||
|
||
* jQuery >= 1.7.0. | ||
* [Caret.js](https://github.com/ichord/Caret.js) | ||
(You can use `Component` or `Bower` to install it.) | ||
|
||
### Documentation | ||
https://github.com/ichord/At.js/wiki | ||
|
||
### Integrating with your Application | ||
|
||
Simply include the following files in your HTML and you are good to go. | ||
|
||
```html | ||
<link href="css/jquery.atwho.css" rel="stylesheet"> | ||
<script src="http://code.jquery.com/jquery.js"></script> | ||
<script src="js/jquery.caret.js"></script> | ||
<script src="js/jquery.atwho.js"></script> | ||
``` | ||
|
||
```javascript | ||
$('#inputor').atwho({ | ||
at: "@", | ||
data:['Peter', 'Tom', 'Anne'] | ||
}) | ||
``` | ||
|
||
#### Bower & Component | ||
For installing using Bower you can use `jquery.atwho` and for Component please use `ichord/At.js`. | ||
|
||
#### Rails | ||
You can include At.js in your `Rails` application using the gem [`jquery-atwho-rails`](https://github.com/ichord/jquery-atwho-rails). | ||
|
||
|
||
### Version History | ||
|
||
* branch `stable-v0.3` with tag `v0.3.3` | ||
* branch `stable-v0.2` with tag `v0.2.x` | ||
* branch `stable-v0.1.x` and tag `v0.1.7` | ||
|
||
### Core Team Members | ||
|
||
* [@ichord](https://twitter.com/_ichord) | ||
|
||
#### PS | ||
Let me know if you are using **At.js**. It will motivate me to work harder. | ||
And if you like **At.js**, just email me and add your website [here](https://github.com/ichord/At.js/wiki/Sites) | ||
Hope you like it, Thanks! :) | ||
|
||
--- | ||
|
||
Project is a member of the [OSS Manifesto](http://ossmanifesto.org/). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
{ | ||
"family": "jquery", | ||
"name": "at", | ||
"version": "0.4.9", | ||
"package": "https://github.com/ichord/At.js/blob/master/package.json", | ||
"description": "Add Github like mentions autocomplete to your application.", | ||
"homepage": "https://github.com/ichord/At.js", | ||
"author": "Harold.luo <chord.luo@gmail.com>", | ||
"maintainers": [{ | ||
"name": "Harold.luo", | ||
"url": "https://github.com/ichord", | ||
"email": "chord.luo@gmail.com" | ||
}], | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/ichord/at.js" | ||
}, | ||
"bugs": "https://github.com/ichord/at.js/issues", | ||
"licenses": [{ | ||
"type": "MIT", | ||
"url": "http://www.opensource.org/licenses/mit-license.php" | ||
}], | ||
"keywords": [], | ||
"spm": { | ||
"alias": { | ||
"$": "$", | ||
"caret": "jquery/caret/0.0.8/caret" | ||
}, | ||
"output": ["atwho.js", "atwho.css"] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
define(function(require) { | ||
|
||
describe('at.js', function() { | ||
|
||
it('should has atwho method', function() { | ||
require('./dist/atwho'); | ||
var $ = require('$'); | ||
expect($.fn.atwho).to.be.a('function'); | ||
}); | ||
}); | ||
|
||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
module.exports = function(grunt) { | ||
var pkg = grunt.file.readJSON('package.json'); | ||
|
||
grunt.initConfig({ | ||
pkg: pkg, | ||
|
||
download: { | ||
options: { | ||
dest: 'src' | ||
}, | ||
js: { | ||
options: { | ||
transform: function(code) { | ||
return [ | ||
'define(function(require, exports, module) {', | ||
"var jQuery = require('$');", | ||
code.replace('window.jQuery', 'jQuery'), | ||
"});" | ||
].join('\n'); | ||
} | ||
}, | ||
url: 'https://raw.github.com/ichord/Caret.js/v<%= pkg.version%>/src/jquery.caret.js', | ||
name: 'caret.js' | ||
} | ||
} | ||
}); | ||
|
||
var config = require('spm-build').config; | ||
grunt.loadGlobalTasks('spm-build'); | ||
grunt.util._.merge(grunt.config.data, config); | ||
|
||
grunt.loadTasks('../_tasks/download/tasks'); | ||
grunt.registerTask('build', ['download', 'spm-build']); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
Caret.js | ||
======== | ||
|
||
Get caret postion or offset from inputor | ||
|
||
This is the core function that working in [At.js](http://ichord.github.com/At.js). | ||
Now, It just become an simple jquery plugin so that everybody can use it. | ||
And, of course, **At.js** is using this plugin too. | ||
|
||
* support iframe context | ||
|
||
Live Demo | ||
========= | ||
|
||
http://ichord.github.com/Caret.js/ | ||
|
||
|
||
Usage | ||
===== | ||
|
||
```javascript | ||
|
||
// Get caret position | ||
// not working in `contentEditable` mode | ||
$('#inputor').caret('position'); // => {left: 15, top: 30, height: 20} | ||
$('#inputor').caret('iframe', iframe1).caret('position') | ||
|
||
// Get caret offset | ||
$('#inputor').caret('offset'); // => {left: 300, top: 400, height: 20} | ||
|
||
var fixPos = 20 | ||
// Get position of the 20th char in the inputor. | ||
// not working in `contentEditable` mode | ||
$('#inputor').caret('position', fixPos); | ||
|
||
// Get offset of the 20th char. | ||
// not working in `contentEditable` mode | ||
$('#inputor').caret('offset', fixPos); | ||
|
||
// more | ||
|
||
// Get caret position from first char in inputor. | ||
$('#inputor').caret('pos'); // => 15 | ||
|
||
// Set caret position in the inputor | ||
// not working in contentEditable mode | ||
$('#inputor').caret('pos', 15); | ||
|
||
// set iframe context | ||
// oftenly you don't need to set iframe context because caret.js will find the iframe object automatically | ||
// but some iframe editor will prevent caret.js to finding for security reasons, | ||
// so you may have to set the iframe manually | ||
$('#inputor').caret({iframe: theIframe}); | ||
$('#inputor').caret('offset'); | ||
$('#inputor').caret('pos', 15); | ||
|
||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
{ | ||
"family": "jquery", | ||
"name": "caret", | ||
"version": "0.0.8", | ||
"package": "https://github.com/ichord/Caret.js/blob/master/package.json", | ||
"description": "Get caret position and offset from inputor", | ||
"homepage": "https://github.com/ichord/Caret.js", | ||
"author": "Harold.luo <chord.luo@gmail.com>", | ||
"maintainers": [{ | ||
"name": "Harold.luo", | ||
"url": "https://github.com/ichord", | ||
"email": "chord.luo@gmail.com" | ||
}], | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/ichord/Caret.js" | ||
}, | ||
"bugs": "https://github.com/ichord/Caret.js/issues", | ||
"licenses": [{ | ||
"type": "MIT", | ||
"url": "http://www.opensource.org/licenses/mit-license.php" | ||
}], | ||
"keywords": [ | ||
"jquery", | ||
"caret", | ||
"offset", | ||
"position" | ||
], | ||
"spm": { | ||
"alias": { | ||
"$": "$" | ||
}, | ||
"output": { | ||
"caret.js": "." | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
define(function(require) { | ||
|
||
describe('caret.js', function() { | ||
|
||
it('should has caret method', function() { | ||
require('./dist/caret'); | ||
var $ = require('$'); | ||
expect($.fn.caret).to.be.a('function'); | ||
}); | ||
}); | ||
|
||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
module.exports = function(grunt) { | ||
var pkg = grunt.file.readJSON('package.json'); | ||
|
||
grunt.initConfig({ | ||
pkg: pkg, | ||
|
||
download: { | ||
options: { | ||
dest: 'src' | ||
}, | ||
tablesorter: { | ||
options: { | ||
transform: function(code) { | ||
return [ | ||
'define(function(require, exports, module) {', | ||
"var jQuery = require('$');", | ||
code, | ||
"});" | ||
].join('\n'); | ||
} | ||
}, | ||
url: 'https://raw.github.com/Mottie/tablesorter/v<%= pkg.version%>/js/jquery.tablesorter.js', | ||
name: 'tablesorter.js' | ||
}, | ||
widgets: { | ||
options: { | ||
transform: function(code) { | ||
return [ | ||
'define(function(require, exports, module) {', | ||
"var jQuery = require('$');", | ||
code, | ||
"});" | ||
].join('\n'); | ||
} | ||
}, | ||
url: 'https://raw.github.com/Mottie/tablesorter/v<%= pkg.version%>/js/jquery.tablesorter.widgets.js', | ||
name: 'widgets.js' | ||
}, | ||
metadata: { | ||
options: { | ||
transform: function(code) { | ||
return [ | ||
'define(function(require, exports, module) {', | ||
"var jQuery = require('$');", | ||
code, | ||
"});" | ||
].join('\n'); | ||
} | ||
}, | ||
url: 'https://raw.github.com/Mottie/tablesorter/v<%= pkg.version%>/js/jquery.metadata.js', | ||
name: 'metadata.js' | ||
}, | ||
formatter: { | ||
options: { | ||
transform: function(code) { | ||
return [ | ||
'define(function(require, exports, module) {', | ||
"var jQuery = require('$');", | ||
code, | ||
"});" | ||
].join('\n'); | ||
} | ||
}, | ||
url: 'https://raw.github.com/Mottie/tablesorter/v<%= pkg.version%>/js/jquery.tablesorter.widgets-filter-formatter.js', | ||
name: 'widgets-filter-formatter.js' | ||
} | ||
} | ||
}); | ||
|
||
grunt.loadTasks('../_tasks/download/tasks'); | ||
grunt.registerTask('default', ['download']); | ||
}; |
Oops, something went wrong.