mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-11 15:27:54 +00:00
Merge pull request #10146 from Piccirello/webui-escape-key
Add Web UI support for escape key
This commit is contained in:
commit
b8def07cd8
@ -11,16 +11,23 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
window.addEvent('domready', function() {
|
window.addEvent('domready', function() {
|
||||||
var setLocationKeyboardEvents = new Keyboard({
|
new Keyboard({
|
||||||
defaultEventType: 'keydown',
|
defaultEventType: 'keydown',
|
||||||
events: {
|
events: {
|
||||||
'enter': function(event) {
|
'Enter': function(event) {
|
||||||
$('addTrackersButton').click();
|
$('addTrackersButton').click();
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
},
|
||||||
|
'Escape': function(event) {
|
||||||
|
window.parent.closeWindows();
|
||||||
|
event.preventDefault();
|
||||||
|
},
|
||||||
|
'Esc': function(event) {
|
||||||
|
window.parent.closeWindows();
|
||||||
|
event.preventDefault();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
}).activate();
|
||||||
setLocationKeyboardEvents.activate();
|
|
||||||
|
|
||||||
$('trackersUrls').focus();
|
$('trackersUrls').focus();
|
||||||
$('addTrackersButton').addEvent('click', function(e) {
|
$('addTrackersButton').addEvent('click', function(e) {
|
||||||
|
@ -55,10 +55,30 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
<input type="button" value="QBT_TR(Apply)QBT_TR[CONTEXT=HttpServer]" onclick="setDlLimit()" />
|
<input type="button" id="applyButton" value="QBT_TR(Apply)QBT_TR[CONTEXT=HttpServer]" onclick="setDlLimit()" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
new Keyboard({
|
||||||
|
defaultEventType: 'keydown',
|
||||||
|
events: {
|
||||||
|
'Enter': function(event) {
|
||||||
|
$('applyButton').click();
|
||||||
|
event.preventDefault();
|
||||||
|
},
|
||||||
|
'Escape': function(event) {
|
||||||
|
window.parent.closeWindows();
|
||||||
|
event.preventDefault();
|
||||||
|
},
|
||||||
|
'Esc': function(event) {
|
||||||
|
window.parent.closeWindows();
|
||||||
|
event.preventDefault();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}).activate();
|
||||||
|
|
||||||
|
$('dllimitUpdatevalue').focus();
|
||||||
|
|
||||||
MochaUI.addDlLimitSlider(hashes);
|
MochaUI.addDlLimitSlider(hashes);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
@ -11,16 +11,23 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
window.addEvent('domready', function() {
|
window.addEvent('domready', function() {
|
||||||
var setLocationKeyboardEvents = new Keyboard({
|
new Keyboard({
|
||||||
defaultEventType: 'keydown',
|
defaultEventType: 'keydown',
|
||||||
events: {
|
events: {
|
||||||
'enter': function(event) {
|
'Enter': function(event) {
|
||||||
$('editTrackerButton').click();
|
$('editTrackerButton').click();
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
},
|
||||||
|
'Escape': function(event) {
|
||||||
|
window.parent.closeWindows();
|
||||||
|
event.preventDefault();
|
||||||
|
},
|
||||||
|
'Esc': function(event) {
|
||||||
|
window.parent.closeWindows();
|
||||||
|
event.preventDefault();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
}).activate();
|
||||||
setLocationKeyboardEvents.activate();
|
|
||||||
|
|
||||||
var currentUrl = new URI().getData('url');
|
var currentUrl = new URI().getData('url');
|
||||||
if (!currentUrl)
|
if (!currentUrl)
|
||||||
|
@ -30,10 +30,10 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var initInstallSearchPlugin = function() {
|
var initInstallSearchPlugin = function() {
|
||||||
var installSearchPluginKeyboardEvents = new Keyboard({
|
new Keyboard({
|
||||||
defaultEventType: 'keydown',
|
defaultEventType: 'keydown',
|
||||||
events: {
|
events: {
|
||||||
'enter': function(e) {
|
'Enter': function(e) {
|
||||||
// accept enter key as a click
|
// accept enter key as a click
|
||||||
new Event(e).stop();
|
new Event(e).stop();
|
||||||
|
|
||||||
@ -44,8 +44,7 @@
|
|||||||
closeSearchWindow('installSearchPlugin');
|
closeSearchWindow('installSearchPlugin');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
}).activate();
|
||||||
installSearchPluginKeyboardEvents.activate();
|
|
||||||
|
|
||||||
$('newPluginPath').select();
|
$('newPluginPath').select();
|
||||||
};
|
};
|
||||||
|
@ -11,16 +11,23 @@
|
|||||||
<script>
|
<script>
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var newCategoryKeyboardEvents = new Keyboard({
|
new Keyboard({
|
||||||
defaultEventType: 'keydown',
|
defaultEventType: 'keydown',
|
||||||
events: {
|
events: {
|
||||||
'enter': function(event) {
|
'Enter': function(event) {
|
||||||
$('categoryNameButton').click();
|
$('categoryNameButton').click();
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
},
|
||||||
|
'Escape': function(event) {
|
||||||
|
window.parent.closeWindows();
|
||||||
|
event.preventDefault();
|
||||||
|
},
|
||||||
|
'Esc': function(event) {
|
||||||
|
window.parent.closeWindows();
|
||||||
|
event.preventDefault();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
}).activate();
|
||||||
newCategoryKeyboardEvents.activate();
|
|
||||||
|
|
||||||
window.addEvent('domready', function() {
|
window.addEvent('domready', function() {
|
||||||
var uriAction = safeTrim(new URI().getData('action'));
|
var uriAction = safeTrim(new URI().getData('action'));
|
||||||
@ -28,10 +35,7 @@
|
|||||||
var uriCategoryName = safeTrim(new URI().getData('categoryName'));
|
var uriCategoryName = safeTrim(new URI().getData('categoryName'));
|
||||||
var uriSavePath = safeTrim(new URI().getData('savePath'));
|
var uriSavePath = safeTrim(new URI().getData('savePath'));
|
||||||
|
|
||||||
if (uriAction === "create") {
|
if (uriAction === "edit") {
|
||||||
$('categoryName').focus();
|
|
||||||
}
|
|
||||||
else if (uriAction === "edit") {
|
|
||||||
if (!uriCategoryName)
|
if (!uriCategoryName)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@ -40,6 +44,9 @@
|
|||||||
$('savePath').set('value', escapeHtml(uriSavePath));
|
$('savePath').set('value', escapeHtml(uriSavePath));
|
||||||
$('savePath').focus();
|
$('savePath').focus();
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
$('categoryName').focus();
|
||||||
|
}
|
||||||
|
|
||||||
$('categoryNameButton').addEvent('click', function(e) {
|
$('categoryNameButton').addEvent('click', function(e) {
|
||||||
new Event(e).stop();
|
new Event(e).stop();
|
||||||
|
@ -11,16 +11,23 @@
|
|||||||
<script>
|
<script>
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var renameKeyboardEvents = new Keyboard({
|
new Keyboard({
|
||||||
defaultEventType: 'keydown',
|
defaultEventType: 'keydown',
|
||||||
events: {
|
events: {
|
||||||
'enter': function(event) {
|
'Enter': function(event) {
|
||||||
$('renameButton').click();
|
$('renameButton').click();
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
},
|
||||||
|
'Escape': function(event) {
|
||||||
|
window.parent.closeWindows();
|
||||||
|
event.preventDefault();
|
||||||
|
},
|
||||||
|
'Esc': function(event) {
|
||||||
|
window.parent.closeWindows();
|
||||||
|
event.preventDefault();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
}).activate();
|
||||||
renameKeyboardEvents.activate();
|
|
||||||
|
|
||||||
window.addEvent('domready', function() {
|
window.addEvent('domready', function() {
|
||||||
var name = new URI().getData('name');
|
var name = new URI().getData('name');
|
||||||
|
@ -824,7 +824,7 @@ function setupCopyEventHandler() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
var keyboardEvents = new Keyboard({
|
new Keyboard({
|
||||||
defaultEventType: 'keydown',
|
defaultEventType: 'keydown',
|
||||||
events: {
|
events: {
|
||||||
'ctrl+a': function(event) {
|
'ctrl+a': function(event) {
|
||||||
@ -836,6 +836,4 @@ var keyboardEvents = new Keyboard({
|
|||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
}).activate();
|
||||||
|
|
||||||
keyboardEvents.activate();
|
|
||||||
|
@ -199,10 +199,10 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
var searchKeyboardEvents = new Keyboard({
|
new Keyboard({
|
||||||
defaultEventType: 'keydown',
|
defaultEventType: 'keydown',
|
||||||
events: {
|
events: {
|
||||||
'enter': function(e) {
|
'Enter': function(e) {
|
||||||
// accept enter key as a click
|
// accept enter key as a click
|
||||||
new Event(e).stop();
|
new Event(e).stop();
|
||||||
|
|
||||||
@ -228,8 +228,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
}).activate();
|
||||||
searchKeyboardEvents.activate();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
var startSearch = function(pattern, category, plugins) {
|
var startSearch = function(pattern, category, plugins) {
|
||||||
|
@ -11,16 +11,23 @@
|
|||||||
<script>
|
<script>
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var setLocationKeyboardEvents = new Keyboard({
|
new Keyboard({
|
||||||
defaultEventType: 'keydown',
|
defaultEventType: 'keydown',
|
||||||
events: {
|
events: {
|
||||||
'enter': function(event) {
|
'Enter': function(event) {
|
||||||
$('setLocationButton').click();
|
$('setLocationButton').click();
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
},
|
||||||
|
'Escape': function(event) {
|
||||||
|
window.parent.closeWindows();
|
||||||
|
event.preventDefault();
|
||||||
|
},
|
||||||
|
'Esc': function(event) {
|
||||||
|
window.parent.closeWindows();
|
||||||
|
event.preventDefault();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
}).activate();
|
||||||
setLocationKeyboardEvents.activate();
|
|
||||||
|
|
||||||
window.addEvent('domready', function() {
|
window.addEvent('domready', function() {
|
||||||
var path = new URI().getData('path');
|
var path = new URI().getData('path');
|
||||||
|
@ -14,16 +14,23 @@
|
|||||||
var UseGlobalLimit = -2;
|
var UseGlobalLimit = -2;
|
||||||
var NoLimit = -1;
|
var NoLimit = -1;
|
||||||
|
|
||||||
var keyboardEvents = new Keyboard({
|
new Keyboard({
|
||||||
defaultEventType: 'keydown',
|
defaultEventType: 'keydown',
|
||||||
events: {
|
events: {
|
||||||
'enter': function(event) {
|
'Enter': function(event) {
|
||||||
$('save').click();
|
$('save').click();
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
},
|
||||||
|
'Escape': function(event) {
|
||||||
|
window.parent.closeWindows();
|
||||||
|
event.preventDefault();
|
||||||
|
},
|
||||||
|
'Esc': function(event) {
|
||||||
|
window.parent.closeWindows();
|
||||||
|
event.preventDefault();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
}).activate();
|
||||||
keyboardEvents.activate();
|
|
||||||
|
|
||||||
window.addEvent('domready', function() {
|
window.addEvent('domready', function() {
|
||||||
var hashesList = new URI().getData('hashes').split('|');
|
var hashesList = new URI().getData('hashes').split('|');
|
||||||
|
@ -55,10 +55,30 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
<input type="button" value="QBT_TR(Apply)QBT_TR[CONTEXT=HttpServer]" onclick="setUpLimit()" />
|
<input type="button" id="applyButton" value="QBT_TR(Apply)QBT_TR[CONTEXT=HttpServer]" onclick="setUpLimit()" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
new Keyboard({
|
||||||
|
defaultEventType: 'keydown',
|
||||||
|
events: {
|
||||||
|
'Enter': function(event) {
|
||||||
|
$('applyButton').click();
|
||||||
|
event.preventDefault();
|
||||||
|
},
|
||||||
|
'Escape': function(event) {
|
||||||
|
window.parent.closeWindows();
|
||||||
|
event.preventDefault();
|
||||||
|
},
|
||||||
|
'Esc': function(event) {
|
||||||
|
window.parent.closeWindows();
|
||||||
|
event.preventDefault();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}).activate();
|
||||||
|
|
||||||
|
$('uplimitUpdatevalue').focus();
|
||||||
|
|
||||||
MochaUI.addUpLimitSlider(hashes);
|
MochaUI.addUpLimitSlider(hashes);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user