removed hammer, updated semver, added mousetrap

v1.18.x
Julian Lam 9 years ago
parent 3871f6f191
commit 44aae7daa5

@ -43,6 +43,7 @@
"mkdirp": "~0.5.0",
"mongodb": "~2.1.3",
"morgan": "^1.3.2",
"mousetrap": "^1.5.3",
"nconf": "~0.8.2",
"nodebb-plugin-composer-default": "3.0.6",
"nodebb-plugin-dbsearch": "0.3.1",
@ -67,7 +68,7 @@
"request": "^2.44.0",
"rimraf": "~2.5.0",
"rss": "^1.0.0",
"semver": "^5.0.1",
"semver": "^5.1.0",
"serve-favicon": "^2.1.5",
"sitemap": "^1.4.0",
"socket.io": "^1.4.0",

@ -1,5 +1,5 @@
"use strict";
/*global config, translator, componentHandler, define, socket, app, ajaxify, utils, bootbox, Mousetrap, Hammer, Slideout, RELATIVE_PATH*/
/*global config, translator, componentHandler, define, socket, app, ajaxify, utils, bootbox, Slideout, RELATIVE_PATH*/
(function() {
$(document).ready(function() {
@ -32,20 +32,22 @@
});
function setupKeybindings() {
Mousetrap.bind('ctrl+shift+a r', function() {
require(['admin/modules/instance'], function(instance) {
instance.reload();
require(['mousetrap'], function(mousetrap) {
mousetrap.bind('ctrl+shift+a r', function() {
require(['admin/modules/instance'], function(instance) {
instance.reload();
});
});
});
Mousetrap.bind('ctrl+shift+a R', function() {
socket.emit('admin.restart');
});
mousetrap.bind('ctrl+shift+a R', function() {
socket.emit('admin.restart');
});
Mousetrap.bind('/', function(e) {
$('#acp-search input').focus();
mousetrap.bind('/', function(e) {
$('#acp-search input').focus();
return false;
return false;
});
});
}

@ -1,8 +1,8 @@
'use strict';
/* globals define, config, app, ajaxify, utils, socket, templates, Mousetrap, bootbox */
/* globals define, config, app, ajaxify, utils, socket, templates, bootbox */
define('forum/chats', ['components', 'string', 'sounds', 'forum/infinitescroll', 'translator'], function(components, S, sounds, infinitescroll, translator) {
define('forum/chats', ['components', 'string', 'sounds', 'forum/infinitescroll', 'translator', 'mousetrap'], function(components, S, sounds, infinitescroll, translator, mousetrap) {
var Chats = {
initialised: false
};
@ -92,7 +92,7 @@ define('forum/chats', ['components', 'string', 'sounds', 'forum/infinitescroll',
};
Chats.addHotkeys = function() {
Mousetrap.bind('ctrl+up', function() {
mousetrap.bind('ctrl+up', function() {
var activeContact = $('.chats-list .bg-primary'),
prev = activeContact.prev();
@ -100,7 +100,7 @@ define('forum/chats', ['components', 'string', 'sounds', 'forum/infinitescroll',
Chats.switchChat(prev.attr('data-roomid'));
}
});
Mousetrap.bind('ctrl+down', function() {
mousetrap.bind('ctrl+down', function() {
var activeContact = $('.chats-list .bg-primary'),
next = activeContact.next();
@ -108,7 +108,7 @@ define('forum/chats', ['components', 'string', 'sounds', 'forum/infinitescroll',
Chats.switchChat(next.attr('data-roomid'));
}
});
Mousetrap.bind('up', function(e) {
mousetrap.bind('up', function(e) {
if (e.target === components.get('chat/input').get(0)) {
// Retrieve message id from messages list
var message = components.get('chat/messages').find('.chat-message[data-self="1"]').last();

@ -93,7 +93,7 @@ define('forum/topic', [
}
function handleTopicSearch() {
require(['search', 'mousetrap'], function(search, Mousetrap) {
require(['search', 'mousetrap'], function(search, mousetrap) {
$('.topic-search')
.on('click', '.prev', function() {
search.topicDOM.prev();
@ -102,7 +102,7 @@ define('forum/topic', [
search.topicDOM.next();
});
Mousetrap.bind('ctrl+f', function(e) {
mousetrap.bind('ctrl+f', function(e) {
if (config.topicSearchEnabled) {
// If in topic, open search window and populate, otherwise regular behaviour
var match = ajaxify.currentPage.match(/^topic\/([\d]+)/),

@ -150,8 +150,8 @@ define('search', ['navigator', 'translator'], function(nav, translator) {
Search.topicDOM.active = true;
// Bind to esc
require(['mousetrap'], function(Mousetrap) {
Mousetrap.bind('esc', Search.topicDOM.end);
require(['mousetrap'], function(mousetrap) {
mousetrap.bind('esc', Search.topicDOM.end);
});
}
};
@ -161,8 +161,8 @@ define('search', ['navigator', 'translator'], function(nav, translator) {
Search.topicDOM.active = false;
// Unbind esc
require(['mousetrap'], function(Mousetrap) {
Mousetrap.unbind('esc', Search.topicDOM.end);
require(['mousetrap'], function(mousetrap) {
mousetrap.unbind('esc', Search.topicDOM.end);
});
};

File diff suppressed because one or more lines are too long

@ -1,9 +0,0 @@
/* 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('mousetrap', m)})(window,document);

@ -33,7 +33,6 @@ module.exports = function(Meta) {
'public/vendor/xregexp/xregexp.js',
'public/vendor/xregexp/unicode/unicode-base.js',
'public/vendor/buzz/buzz.min.js',
'public/vendor/mousetrap/mousetrap.js',
'public/vendor/autosize.js',
'./node_modules/templates.js/lib/templates.js',
'public/src/utils.js',
@ -84,7 +83,8 @@ module.exports = function(Meta) {
// modules listed below are symlinked to public/src/modules so they can be defined anonymously
modules: [
'./node_modules/chart.js/Chart.js'
'./node_modules/chart.js/Chart.js',
'./node_modules/mousetrap/mousetrap.js'
]
}
};

@ -27,7 +27,6 @@
<![endif]-->
<script src="https://storage.googleapis.com/code.getmdl.io/1.0.3/material.min.js"></script>
<script type="text/javascript" src="{relative_path}/vendor/hammer/hammer.min.js?{cache-buster}"></script>
<script type="text/javascript" src="{relative_path}/vendor/jquery/sortable/Sortable.js?{cache-buster}"></script>
<script type="text/javascript" src="{relative_path}/acp.min.js?{cache-buster}"></script>
<script>
@ -53,7 +52,6 @@
<script type="text/javascript" src="{relative_path}/vendor/semver/semver.browser.js?{cache-buster}"></script>
<script type="text/javascript" src="{relative_path}/vendor/jquery/serializeObject/jquery.ba-serializeobject.min.js?{cache-buster}"></script>
<script type="text/javascript" src="{relative_path}/vendor/jquery/deserialize/jquery.deserialize.min.js?{cache-buster}"></script>
<script type="text/javascript" src="{relative_path}/vendor/mousetrap/mousetrap.js?{cache-buster}"></script>
<script type="text/javascript" src="{relative_path}/vendor/jquery/js/jquery-ui-1.10.4.custom.js?{cache-buster}"></script>
<script type="text/javascript" src="{relative_path}/vendor/snackbar/snackbar.min.js?{cache-buster}"></script>
<script type="text/javascript" src="{relative_path}/vendor/slideout/slideout.min.js?{cache-buster}"></script>

Loading…
Cancel
Save