mirror of
https://github.com/lrsjng/h5ai.git
synced 2025-03-20 04:20:00 +01:00
Another take on command button that doesn't work.
This commit is contained in:
parent
52ffd8720a
commit
018a574d5e
@ -13,33 +13,6 @@ modulejs.define('ext/select', ['jQuery', 'core/settings', 'core/event'], functio
|
||||
$document = $(document),
|
||||
$selectionRect = $('<div id="selection-rect"></div>'),
|
||||
|
||||
ctrlKeyPressed = false,
|
||||
|
||||
isCtrlKey = function (code) {
|
||||
|
||||
// http://github.com/madrobby/keymaster/blob/master/keymaster.js
|
||||
return code === 17 || code === 91 || code === 92 || code === 93 || code === 224;
|
||||
},
|
||||
|
||||
onFocus = function () {
|
||||
|
||||
ctrlKeyPressed = false;
|
||||
},
|
||||
|
||||
onKeydown = function (event) {
|
||||
|
||||
if (isCtrlKey(event.keyCode)) {
|
||||
ctrlKeyPressed = true;
|
||||
}
|
||||
},
|
||||
|
||||
onKeyup = function (event) {
|
||||
|
||||
if (isCtrlKey(event.keyCode)) {
|
||||
ctrlKeyPressed = false;
|
||||
}
|
||||
},
|
||||
|
||||
publish = function () {
|
||||
|
||||
var entries = _.map($('#extended .entry.selected'), function (entryElement) {
|
||||
@ -117,7 +90,7 @@ modulejs.define('ext/select', ['jQuery', 'core/settings', 'core/event'], functio
|
||||
|
||||
event.preventDefault();
|
||||
$(':focus').blur();
|
||||
if (!ctrlKeyPressed) {
|
||||
if (!event.ctrlKey && !event.metaKey) {
|
||||
$('#extended .entry').removeClass('selected');
|
||||
publish();
|
||||
}
|
||||
@ -139,7 +112,7 @@ modulejs.define('ext/select', ['jQuery', 'core/settings', 'core/event'], functio
|
||||
|
||||
noSelectionUnlessCtrl = function (event) {
|
||||
|
||||
if (!ctrlKeyPressed) {
|
||||
if (!event.ctrlKey && !event.metaKey) {
|
||||
noSelection(event);
|
||||
}
|
||||
},
|
||||
@ -152,11 +125,7 @@ modulejs.define('ext/select', ['jQuery', 'core/settings', 'core/event'], functio
|
||||
|
||||
$selectionRect.hide().appendTo('body');
|
||||
|
||||
$(window).on('focus', onFocus);
|
||||
|
||||
$document
|
||||
.on('keydown', onKeydown)
|
||||
.on('keyup', onKeyup)
|
||||
.on('mousedown', '.noSelection', noSelection)
|
||||
.on('mousedown', '.noSelectionUnlessCtrl,input,a', noSelectionUnlessCtrl)
|
||||
.on('mousedown', selectionStart);
|
||||
|
Loading…
x
Reference in New Issue
Block a user