librairies to bower

This commit is contained in:
sarah garcin
2015-05-06 15:05:01 +02:00
parent 1313e1f0e2
commit da4d135279
135 changed files with 247157 additions and 4 deletions

View File

@@ -0,0 +1,44 @@
{
"name": "jquery.hotkeys",
"description": "jQuery Hotkeys lets you watch for keyboard events anywhere in your code supporting almost any key combination.",
"homepage": "http://github.com/jeresig/jquery.hotkeys",
"repository": "git://github.com/jeresig/jquery.hotkeys.git",
"keywords": [
"jquery",
"hotkeys",
"keyboard",
"events",
"key",
"bindings"
],
"authors": [
"John Resig <jeresig@gmail.com> (http://ejohn.org)"
],
"main": "jquery.hotkeys.js",
"ignore": [
"jquery-*",
"test*",
"*.yml",
".gitignore",
"Gruntfile.js",
"*.json"
],
"dependencies": {
"jquery": ">= 1.4.2"
},
"license": [
"MIT",
"GPL-2.0"
],
"version": "0.2.0",
"_release": "0.2.0",
"_resolution": {
"type": "version",
"tag": "0.2.0",
"commit": "05a1370a55fac597ffe538c38e5f67bcb010450d"
},
"_source": "git://github.com/jeresig/jquery.hotkeys.git",
"_target": "~0.2.0",
"_originalSource": "jeresig/jquery.hotkeys",
"_direct": true
}

View File

@@ -0,0 +1,106 @@
# jQuery.Hotkeys [![Build Status](https://secure.travis-ci.org/jeresig/jquery.hotkeys.png)](http://travis-ci.org/jeresig/jquery.hotkeys)
#About
**jQuery Hotkeys** is a plug-in that lets you easily add and remove handlers for keyboard events anywhere in your code supporting almost any key combination.
This plugin is based off of the plugin by Tzury Bar Yochay: [jQuery.hotkeys](https://github.com/tzuryby/jquery.hotkeys)
The syntax is as follows:
```javascript
$(expression).bind(types, keys, handler);
$(expression).unbind(types, handler);
$(document).bind('keydown', 'ctrl+a', fn);
// e.g. replace '$' sign with 'EUR'
$('input.foo').bind('keyup', '$', function(){
this.value = this.value.replace('$', 'EUR');
});
```
Syntax when wanting to use jQuery's `on()`/`off` methods:
```javascript
$(expression).on(types, null, keys, handler);
$(expression).off(types, handler);
$(document).on('keydown', null, 'ctrl+a', fn);
// e.g. replace '$' sign with 'EUR'
$('input.foo').on('keyup', null, '$', function(){
this.value = this.value.replace('$', 'EUR');
});
```
## Example
[Example](https://rawgit.com/jeresig/jquery.hotkeys/master/test-static-01.html)
## Event Types
Supported types are `'keydown'`, `'keyup'` and `'keypress'`
## jQuery Compatibility
Works with jQuery 1.4.2 and newer.
It is known to be working with all the major browsers on all available platforms (Win/Mac/Linux)
* IE 6/7/8+
* FF 1.5/2/3+
* Opera-9+
* Safari-3+
* Chrome-0.2+
## Browserify Compatibility
If you want to include this module in a Browserified project, just add it to node_modules and require it.
```javascript
require('jquery.javascript');
```
This will work if jQuery is global (ex. served from a CDN). If it's not, you need to (shim it)[https://github.com/thlorenz/browserify-shim#a-expose-global-variables-via-global]:
```javascript
{
"browserify-shim": {
"jquery": "global:jQuery"
}
}
```
## Notes
Modifiers are not case sensitive (`Ctrl` == `ctrl` == `cTRL`)
If you want to use more than one modifier (e.g. `alt+ctrl+z`) you should define them by an alphabetical order e.g. alt+ctrl+shift
Hotkeys aren't tracked if you're inside of an input element (unless you explicitly bind the hotkey directly to the input). This helps to avoid conflict with normal user typing.
You can use namespacing by adding a suffix to the event type (e.g. `keyup.toggle`)
### Meta and Hyper Keys
Meta and hyper keys don't register on `keyup` in any browser tested.
#### Chrome 33.0.1750.117
Meta key registers on `keydown` event.
Hyper key registers on `keydown` event.
#### Firefox 27.0.1 and Safari 7.0.1
Meta key registers on `keydown` and `keypress` events.
Hyper key registers on `keydown` and `keypress` events.
#### Opera 19.0
Meta key doesn't register at all :(
Hyper key registers on `keydown` and `keypress` events.
#### TL;DR
Bind to `keydown` event for meta and hyper keys, but meta key does not work in Opera ;)
### Addendum
Firefox is the most liberal one in the manner of letting you capture all short-cuts even those that are built-in in the browser such as `Ctrl-t` for new tab, or `Ctrl-a` for selecting all text. You can always bubble them up to the browser by returning `true` in your handler.
Others, (IE) either let you handle built-in short-cuts, but will add their functionality after your code has executed. Or (Opera/Safari) will *not* pass those events to the DOM at all.
*So, if you bind `Ctrl-Q` or `Alt-F4` and your Safari/Opera window is closed don't be surprised.*

View File

@@ -0,0 +1,21 @@
{
"name": "jquery.hotkeys",
"description": "jQuery Hotkeys lets you watch for keyboard events anywhere in your code supporting almost any key combination.",
"homepage": "http://github.com/jeresig/jquery.hotkeys",
"repository": "git://github.com/jeresig/jquery.hotkeys.git",
"keywords": ["jquery", "hotkeys", "keyboard", "events", "key", "bindings"],
"authors": ["John Resig <jeresig@gmail.com> (http://ejohn.org)"],
"main": "jquery.hotkeys.js",
"ignore": [
"jquery-*",
"test*",
"*.yml",
".gitignore",
"Gruntfile.js",
"*.json"
],
"dependencies": {
"jquery": ">= 1.4.2"
},
"license": ["MIT", "GPL-2.0"]
}

View File

@@ -0,0 +1,196 @@
/*jslint browser: true*/
/*jslint jquery: true*/
/*
* jQuery Hotkeys Plugin
* Copyright 2010, John Resig
* Dual licensed under the MIT or GPL Version 2 licenses.
*
* Based upon the plugin by Tzury Bar Yochay:
* http://github.com/tzuryby/hotkeys
*
* Original idea by:
* Binny V A, http://www.openjs.com/scripts/events/keyboard_shortcuts/
*/
/*
* One small change is: now keys are passed by object { keys: '...' }
* Might be useful, when you want to pass some other data to your handler
*/
(function(jQuery) {
jQuery.hotkeys = {
version: "0.8",
specialKeys: {
8: "backspace",
9: "tab",
10: "return",
13: "return",
16: "shift",
17: "ctrl",
18: "alt",
19: "pause",
20: "capslock",
27: "esc",
32: "space",
33: "pageup",
34: "pagedown",
35: "end",
36: "home",
37: "left",
38: "up",
39: "right",
40: "down",
45: "insert",
46: "del",
59: ";",
61: "=",
96: "0",
97: "1",
98: "2",
99: "3",
100: "4",
101: "5",
102: "6",
103: "7",
104: "8",
105: "9",
106: "*",
107: "+",
109: "-",
110: ".",
111: "/",
112: "f1",
113: "f2",
114: "f3",
115: "f4",
116: "f5",
117: "f6",
118: "f7",
119: "f8",
120: "f9",
121: "f10",
122: "f11",
123: "f12",
144: "numlock",
145: "scroll",
173: "-",
186: ";",
187: "=",
188: ",",
189: "-",
190: ".",
191: "/",
192: "`",
219: "[",
220: "\\",
221: "]",
222: "'"
},
shiftNums: {
"`": "~",
"1": "!",
"2": "@",
"3": "#",
"4": "$",
"5": "%",
"6": "^",
"7": "&",
"8": "*",
"9": "(",
"0": ")",
"-": "_",
"=": "+",
";": ": ",
"'": "\"",
",": "<",
".": ">",
"/": "?",
"\\": "|"
},
// excludes: button, checkbox, file, hidden, image, password, radio, reset, search, submit, url
textAcceptingInputTypes: [
"text", "password", "number", "email", "url", "range", "date", "month", "week", "time", "datetime",
"datetime-local", "search", "color", "tel"],
options: {
filterTextInputs: true
}
};
function keyHandler(handleObj) {
if (typeof handleObj.data === "string") {
handleObj.data = {
keys: handleObj.data
};
}
// Only care when a possible input has been specified
if (!handleObj.data || !handleObj.data.keys || typeof handleObj.data.keys !== "string") {
return;
}
var origHandler = handleObj.handler,
keys = handleObj.data.keys.toLowerCase().split(" ");
handleObj.handler = function(event) {
// Don't fire in text-accepting inputs that we didn't directly bind to
if (this !== event.target && (/textarea|select/i.test(event.target.nodeName) ||
(jQuery.hotkeys.options.filterTextInputs &&
jQuery.inArray(event.target.type, jQuery.hotkeys.textAcceptingInputTypes) > -1))) {
return;
}
var special = event.type !== "keypress" && jQuery.hotkeys.specialKeys[event.which],
character = String.fromCharCode(event.which).toLowerCase(),
modif = "",
possible = {};
jQuery.each(["alt", "ctrl", "shift"], function(index, specialKey) {
if (event[specialKey + 'Key'] && special !== specialKey) {
modif += specialKey + '+';
}
});
// metaKey is triggered off ctrlKey erronously
if (event.metaKey && !event.ctrlKey && special !== "meta") {
modif += "meta+";
}
if (event.metaKey && special !== "meta" && modif.indexOf("alt+ctrl+shift+") > -1) {
modif = modif.replace("alt+ctrl+shift+", "hyper+");
}
if (special) {
possible[modif + special] = true;
}
else {
possible[modif + character] = true;
possible[modif + jQuery.hotkeys.shiftNums[character]] = true;
// "$" can be triggered as "Shift+4" or "Shift+$" or just "$"
if (modif === "shift+") {
possible[jQuery.hotkeys.shiftNums[character]] = true;
}
}
for (var i = 0, l = keys.length; i < l; i++) {
if (possible[keys[i]]) {
return origHandler.apply(this, arguments);
}
}
};
}
jQuery.each(["keydown", "keyup", "keypress"], function() {
jQuery.event.special[this] = {
add: keyHandler
};
});
})(jQuery || this.jQuery || window.jQuery);