Browse Source

Merge pull request #10146 from Piccirello/webui-escape-key

Add Web UI support for escape key
adaptive-webui-19844
Mike Tzou 6 years ago committed by GitHub
parent
commit
b8def07cd8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 15
      src/webui/www/private/addtrackers.html
  2. 22
      src/webui/www/private/downloadlimit.html
  3. 15
      src/webui/www/private/edittracker.html
  4. 7
      src/webui/www/private/installsearchplugin.html
  5. 23
      src/webui/www/private/newcategory.html
  6. 15
      src/webui/www/private/rename.html
  7. 6
      src/webui/www/private/scripts/client.js
  8. 7
      src/webui/www/private/search.html
  9. 15
      src/webui/www/private/setlocation.html
  10. 15
      src/webui/www/private/shareratio.html
  11. 22
      src/webui/www/private/uploadlimit.html

15
src/webui/www/private/addtrackers.html

@ -11,16 +11,23 @@ @@ -11,16 +11,23 @@
'use strict';
window.addEvent('domready', function() {
var setLocationKeyboardEvents = new Keyboard({
new Keyboard({
defaultEventType: 'keydown',
events: {
'enter': function(event) {
'Enter': function(event) {
$('addTrackersButton').click();
event.preventDefault();
},
'Escape': function(event) {
window.parent.closeWindows();
event.preventDefault();
},
'Esc': function(event) {
window.parent.closeWindows();
event.preventDefault();
}
}
});
setLocationKeyboardEvents.activate();
}).activate();
$('trackersUrls').focus();
$('addTrackersButton').addEvent('click', function(e) {

22
src/webui/www/private/downloadlimit.html

@ -55,10 +55,30 @@ @@ -55,10 +55,30 @@
}
}
</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>
<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);
</script>

15
src/webui/www/private/edittracker.html

@ -11,16 +11,23 @@ @@ -11,16 +11,23 @@
'use strict';
window.addEvent('domready', function() {
var setLocationKeyboardEvents = new Keyboard({
new Keyboard({
defaultEventType: 'keydown',
events: {
'enter': function(event) {
'Enter': function(event) {
$('editTrackerButton').click();
event.preventDefault();
},
'Escape': function(event) {
window.parent.closeWindows();
event.preventDefault();
},
'Esc': function(event) {
window.parent.closeWindows();
event.preventDefault();
}
}
});
setLocationKeyboardEvents.activate();
}).activate();
var currentUrl = new URI().getData('url');
if (!currentUrl)

7
src/webui/www/private/installsearchplugin.html

@ -30,10 +30,10 @@ @@ -30,10 +30,10 @@
'use strict';
var initInstallSearchPlugin = function() {
var installSearchPluginKeyboardEvents = new Keyboard({
new Keyboard({
defaultEventType: 'keydown',
events: {
'enter': function(e) {
'Enter': function(e) {
// accept enter key as a click
new Event(e).stop();
@ -44,8 +44,7 @@ @@ -44,8 +44,7 @@
closeSearchWindow('installSearchPlugin');
}
}
});
installSearchPluginKeyboardEvents.activate();
}).activate();
$('newPluginPath').select();
};

23
src/webui/www/private/newcategory.html

@ -11,16 +11,23 @@ @@ -11,16 +11,23 @@
<script>
'use strict';
var newCategoryKeyboardEvents = new Keyboard({
new Keyboard({
defaultEventType: 'keydown',
events: {
'enter': function(event) {
'Enter': function(event) {
$('categoryNameButton').click();
event.preventDefault();
},
'Escape': function(event) {
window.parent.closeWindows();
event.preventDefault();
},
'Esc': function(event) {
window.parent.closeWindows();
event.preventDefault();
}
}
});
newCategoryKeyboardEvents.activate();
}).activate();
window.addEvent('domready', function() {
var uriAction = safeTrim(new URI().getData('action'));
@ -28,10 +35,7 @@ @@ -28,10 +35,7 @@
var uriCategoryName = safeTrim(new URI().getData('categoryName'));
var uriSavePath = safeTrim(new URI().getData('savePath'));
if (uriAction === "create") {
$('categoryName').focus();
}
else if (uriAction === "edit") {
if (uriAction === "edit") {
if (!uriCategoryName)
return false;
@ -40,6 +44,9 @@ @@ -40,6 +44,9 @@
$('savePath').set('value', escapeHtml(uriSavePath));
$('savePath').focus();
}
else {
$('categoryName').focus();
}
$('categoryNameButton').addEvent('click', function(e) {
new Event(e).stop();

15
src/webui/www/private/rename.html

@ -11,16 +11,23 @@ @@ -11,16 +11,23 @@
<script>
'use strict';
var renameKeyboardEvents = new Keyboard({
new Keyboard({
defaultEventType: 'keydown',
events: {
'enter': function(event) {
'Enter': function(event) {
$('renameButton').click();
event.preventDefault();
},
'Escape': function(event) {
window.parent.closeWindows();
event.preventDefault();
},
'Esc': function(event) {
window.parent.closeWindows();
event.preventDefault();
}
}
});
renameKeyboardEvents.activate();
}).activate();
window.addEvent('domready', function() {
var name = new URI().getData('name');

6
src/webui/www/private/scripts/client.js

@ -824,7 +824,7 @@ function setupCopyEventHandler() { @@ -824,7 +824,7 @@ function setupCopyEventHandler() {
});
}
var keyboardEvents = new Keyboard({
new Keyboard({
defaultEventType: 'keydown',
events: {
'ctrl+a': function(event) {
@ -836,6 +836,4 @@ var keyboardEvents = new Keyboard({ @@ -836,6 +836,4 @@ var keyboardEvents = new Keyboard({
event.preventDefault();
}
}
});
keyboardEvents.activate();
}).activate();

7
src/webui/www/private/search.html

@ -199,10 +199,10 @@ @@ -199,10 +199,10 @@
}
});
var searchKeyboardEvents = new Keyboard({
new Keyboard({
defaultEventType: 'keydown',
events: {
'enter': function(e) {
'Enter': function(e) {
// accept enter key as a click
new Event(e).stop();
@ -228,8 +228,7 @@ @@ -228,8 +228,7 @@
}
}
}
});
searchKeyboardEvents.activate();
}).activate();
};
var startSearch = function(pattern, category, plugins) {

15
src/webui/www/private/setlocation.html

@ -11,16 +11,23 @@ @@ -11,16 +11,23 @@
<script>
'use strict';
var setLocationKeyboardEvents = new Keyboard({
new Keyboard({
defaultEventType: 'keydown',
events: {
'enter': function(event) {
'Enter': function(event) {
$('setLocationButton').click();
event.preventDefault();
},
'Escape': function(event) {
window.parent.closeWindows();
event.preventDefault();
},
'Esc': function(event) {
window.parent.closeWindows();
event.preventDefault();
}
}
});
setLocationKeyboardEvents.activate();
}).activate();
window.addEvent('domready', function() {
var path = new URI().getData('path');

15
src/webui/www/private/shareratio.html

@ -14,16 +14,23 @@ @@ -14,16 +14,23 @@
var UseGlobalLimit = -2;
var NoLimit = -1;
var keyboardEvents = new Keyboard({
new Keyboard({
defaultEventType: 'keydown',
events: {
'enter': function(event) {
'Enter': function(event) {
$('save').click();
event.preventDefault();
},
'Escape': function(event) {
window.parent.closeWindows();
event.preventDefault();
},
'Esc': function(event) {
window.parent.closeWindows();
event.preventDefault();
}
}
});
keyboardEvents.activate();
}).activate();
window.addEvent('domready', function() {
var hashesList = new URI().getData('hashes').split('|');

22
src/webui/www/private/uploadlimit.html

@ -55,10 +55,30 @@ @@ -55,10 +55,30 @@
}
}
</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>
<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);
</script>

Loading…
Cancel
Save