TagSpaces is an offline, open source, document manager with tagging support
jqueryhotkeys lib exchanged with mousetrap
Ilian9547e7ebcaa6
diff --git a/data/about.html b/data/about.htmlindex bebc0e507..88fd688a4 100644--- a/data/about.html+++ b/data/about.html@@ -39,7 +39,7 @@ TagSpaces thankfully relays on the followings projects:<li>Handlebars - <a href="http://handlebarsjs.com/" target="_system">Homepage</a> <a href="libs/handlebars.js/LICENSE.txt">License[MIT]</a></li><li>DataTables - <a href="http://datatables.net/" target="_system">Homepage</a> <a href="libs/datatables/license-bsd.txt">License[BSD]</a></li><li>UnderscoreJS - <a href="http://underscorejs.org" target="_system">Homepage</a> <a href="libs/underscore/LICENSE[MIT].txt">License[MIT]</a></li>- <li>jQuery Hotkeys - <a href="https://github.com/jeresig/jquery.hotkeys" target="_system">Homepage</a> <a href="http://opensource.org/licenses/MIT">License[MIT]</a></li>+ <li>Mousetrap - <a href="http://craig.is/killing/mice" target="_system">Homepage</a> <a href="http://www.apache.org/licenses/LICENSE-2.0" target="_system">License[Apache2]</a></li><li>i18next - <a href="http://i18next.com/" target="_system">Homepage</a> <a href="libs/i18next/license.txt">License</a></li><li>hammerjs - <a href="http://eightmedia.github.io/hammer.js/" target="_system">Homepage</a> <a href="libs/hammerjs/LICENSE.txt">License[MIT]</a></li><li>Select2 - <a href="http://ivaynberg.github.io/select2/" target="_system">Homepage</a> <a href="libs/select2/LICENSE[apache].txt">License[Apache]</a></li>diff --git a/data/libs/jqueryhotkeys/jquery.hotkeys.js b/data/libs/jqueryhotkeys/jquery.hotkeys.jsdeleted file mode 100644index c240a7fd7..000000000--- a/data/libs/jqueryhotkeys/jquery.hotkeys.js+++ /dev/null@@ -1,111 +0,0 @@-/*- * 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",- 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", 186: ";", 191: "/",- 220: "\\", 222: "'", 224: "meta"- },-- shiftNums: {- "`": "~", "1": "!", "2": "@", "3": "#", "4": "$", "5": "%", "6": "^", "7": "&",- "8": "*", "9": "(", "0": ")", "-": "_", "=": "+", ";": ": ", "'": "\"", ",": "<",- ".": ">", "/": "?", "\\": "|"- }- };-- 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(" "),- textAcceptingInputTypes = ["text", "password", "number", "email", "url", "range", "date", "month", "week", "time", "datetime", "datetime-local", "search", "color", "tel"];-- 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.inArray(event.target.type, textAcceptingInputTypes) > -1 ) ) {- return;- }-- var special = jQuery.hotkeys.specialKeys[ event.keyCode ],- // character codes are available only in keypress- character = event.type === "keypress" && String.fromCharCode( event.which ).toLowerCase(),- modif = "", possible = {};-- // check combinations (alt|ctrl|shift+anything)- if ( event.altKey && special !== "alt" ) {- modif += "alt+";- }-- if ( event.ctrlKey && special !== "ctrl" ) {- modif += "ctrl+";- }-- // TODO: Need to make sure this works consistently across platforms- if ( event.metaKey && !event.ctrlKey && special !== "meta" ) {- modif += "meta+";- }-- if ( event.shiftKey && special !== "shift" ) {- modif += "shift+";- }-- if ( special ) {- possible[ modif + special ] = true;- }-- if ( character ) {- 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 };- });--})( this.jQuery );diff --git a/data/libs/mousetrap/mousetrap.min.js b/data/libs/mousetrap/mousetrap.min.jsnew file mode 100644index 000000000..114a22235--- /dev/null+++ b/data/libs/mousetrap/mousetrap.min.js@@ -0,0 +1,9 @@+/* mousetrap v1.4.6 craig.is/killing/mice */+(function(J,r,f){function s(a,b,d){a.addEventListener?a.addEventListener(b,d,!1):a.attachEvent("on"+b,d)}function A(a){if("keypress"==a.type){var b=String.fromCharCode(a.which);a.shiftKey||(b=b.toLowerCase());return b}return h[a.which]?h[a.which]:B[a.which]?B[a.which]:String.fromCharCode(a.which).toLowerCase()}function t(a){a=a||{};var b=!1,d;for(d in n)a[d]?b=!0:n[d]=0;b||(u=!1)}function C(a,b,d,c,e,v){var g,k,f=[],h=d.type;if(!l[a])return[];"keyup"==h&&w(a)&&(b=[a]);for(g=0;g<l[a].length;++g)if(k=+l[a][g],!(!c&&k.seq&&n[k.seq]!=k.level||h!=k.action||("keypress"!=h||d.metaKey||d.ctrlKey)&&b.sort().join(",")!==k.modifiers.sort().join(","))){var m=c&&k.seq==c&&k.level==v;(!c&&k.combo==e||m)&&l[a].splice(g,1);f.push(k)}return f}function K(a){var b=[];a.shiftKey&&b.push("shift");a.altKey&&b.push("alt");a.ctrlKey&&b.push("ctrl");a.metaKey&&b.push("meta");return b}function x(a,b,d,c){m.stopCallback(b,b.target||b.srcElement,d,c)||!1!==a(b,d)||(b.preventDefault?b.preventDefault():b.returnValue=!1,b.stopPropagation?+b.stopPropagation():b.cancelBubble=!0)}function y(a){"number"!==typeof a.which&&(a.which=a.keyCode);var b=A(a);b&&("keyup"==a.type&&z===b?z=!1:m.handleKey(b,K(a),a))}function w(a){return"shift"==a||"ctrl"==a||"alt"==a||"meta"==a}function L(a,b,d,c){function e(b){return function(){u=b;++n[a];clearTimeout(D);D=setTimeout(t,1E3)}}function v(b){x(d,b,a);"keyup"!==c&&(z=A(b));setTimeout(t,10)}for(var g=n[a]=0;g<b.length;++g){var f=g+1===b.length?v:e(c||E(b[g+1]).action);F(b[g],f,c,a,g)}}function E(a,b){var d,+c,e,f=[];d="+"===a?["+"]:a.split("+");for(e=0;e<d.length;++e)c=d[e],G[c]&&(c=G[c]),b&&"keypress"!=b&&H[c]&&(c=H[c],f.push("shift")),w(c)&&f.push(c);d=c;e=b;if(!e){if(!p){p={};for(var g in h)95<g&&112>g||h.hasOwnProperty(g)&&(p[h[g]]=g)}e=p[d]?"keydown":"keypress"}"keypress"==e&&f.length&&(e="keydown");return{key:c,modifiers:f,action:e}}function F(a,b,d,c,e){q[a+":"+d]=b;a=a.replace(/\s+/g," ");var f=a.split(" ");1<f.length?L(a,f,b,d):(d=E(a,d),l[d.key]=l[d.key]||[],C(d.key,d.modifiers,{type:d.action},+c,a,e),l[d.key][c?"unshift":"push"]({callback:b,modifiers:d.modifiers,action:d.action,seq:c,level:e,combo:a}))}var h={8:"backspace",9:"tab",13:"enter",16:"shift",17:"ctrl",18:"alt",20:"capslock",27:"esc",32:"space",33:"pageup",34:"pagedown",35:"end",36:"home",37:"left",38:"up",39:"right",40:"down",45:"ins",46:"del",91:"meta",93:"meta",224:"meta"},B={106:"*",107:"+",109:"-",110:".",111:"/",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},H={"~":"`","!":"1",+"@":"2","#":"3",$:"4","%":"5","^":"6","&":"7","*":"8","(":"9",")":"0",_:"-","+":"=",":":";",'"':"'","<":",",">":".","?":"/","|":"\\"},G={option:"alt",command:"meta","return":"enter",escape:"esc",mod:/Mac|iPod|iPhone|iPad/.test(navigator.platform)?"meta":"ctrl"},p,l={},q={},n={},D,z=!1,I=!1,u=!1;for(f=1;20>f;++f)h[111+f]="f"+f;for(f=0;9>=f;++f)h[f+96]=f;s(r,"keypress",y);s(r,"keydown",y);s(r,"keyup",y);var m={bind:function(a,b,d){a=a instanceof Array?a:[a];for(var c=0;c<a.length;++c)F(a[c],b,d);return this},+unbind:function(a,b){return m.bind(a,function(){},b)},trigger:function(a,b){if(q[a+":"+b])q[a+":"+b]({},a);return this},reset:function(){l={};q={};return this},stopCallback:function(a,b){return-1<(" "+b.className+" ").indexOf(" mousetrap ")?!1:"INPUT"==b.tagName||"SELECT"==b.tagName||"TEXTAREA"==b.tagName||b.isContentEditable},handleKey:function(a,b,d){var c=C(a,b,d),e;b={};var f=0,g=!1;for(e=0;e<c.length;++e)c[e].seq&&(f=Math.max(f,c[e].level));for(e=0;e<c.length;++e)c[e].seq?c[e].level==f&&(g=!0,+b[c[e].seq]=1,x(c[e].callback,d,c[e].combo,c[e].seq)):g||x(c[e].callback,d,c[e].combo);c="keypress"==d.type&&I;d.type!=u||w(a)||c||t(b);I=g&&"keydown"==d.type}};J.Mousetrap=m;"function"===typeof define&&define.amd&&define(m)})(window,document);diff --git a/data/loader.js b/data/loader.jsindex 6c5a7d640..a14f770ff 100644--- a/data/loader.js+++ b/data/loader.js@@ -85,7 +85,7 @@ requirejs.config({d3: 'libs/d3/d3.v3',dropbox: 'libs/dropbox/dropbox.0.10.2',i18next: 'libs/i18next/i18next.amd.withJQuery-1.7.1',- jqueryhotkeys: 'libs/jqueryhotkeys/jquery.hotkeys',+ mousetrap: 'libs/mousetrap/mousetrap.min',select2: 'libs/select2/select2.min',hammerjs: 'libs/hammerjs/jquery.hammer.min',handlebarsjs: 'libs/handlebars.js/handlebars-v1.1.2',@@ -127,7 +127,6 @@ requirejs.config({'jquerynanoscroller': { deps: ['jquery'] },'select2': { deps: ['jquery'] },'hammerjs': { deps: ['jquery'] },- 'jqueryhotkeys': { deps: ['jquery'] },'tscore': { deps: ['jquery','jqueryui',@@ -143,7 +142,7 @@ requirejs.config({'jquerysimplecolorpicker','jquerylayout','i18next',- 'jqueryhotkeys',+ 'mousetrap','select2','handlebarsjs','tssettingsdefault',