mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2026-01-07 16:12:30 -06:00
Move WebUI views into separate folder
This commit is contained in:
69
src/webui/www/private/views/installsearchplugin.html
Normal file
69
src/webui/www/private/views/installsearchplugin.html
Normal file
@@ -0,0 +1,69 @@
|
||||
<style type="text/css">
|
||||
#installSearchPluginContainer {
|
||||
margin: 10px;
|
||||
}
|
||||
|
||||
#installSearchPluginContainer button {
|
||||
padding: 3px 20px;
|
||||
}
|
||||
|
||||
#newPluginPath {
|
||||
width: 100%;
|
||||
line-height: 2em;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
<div id="installSearchPluginContainer">
|
||||
<h2>QBT_TR(Plugin path:)QBT_TR[CONTEXT=PluginSourceDlg]</h2>
|
||||
|
||||
<div>
|
||||
<input type="text" id="newPluginPath" placeholder="QBT_TR(URL or local directory)QBT_TR[CONTEXT=PluginSourceDlg]" autocorrect="off" autocapitalize="none" />
|
||||
<div style="margin-top: 10px; text-align: center;">
|
||||
<button id="newPluginCancel" onclick="closeSearchWindow('installSearchPlugin');">QBT_TR(Cancel)QBT_TR[CONTEXT=PluginSourceDlg]</button>
|
||||
<button id="newPluginOk" onclick="newPluginOk();">QBT_TR(Ok)QBT_TR[CONTEXT=PluginSourceDlg]</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
'use strict';
|
||||
|
||||
this.initInstallSearchPlugin = function() {
|
||||
new Keyboard({
|
||||
defaultEventType: 'keydown',
|
||||
events: {
|
||||
'Enter': function(e) {
|
||||
// accept enter key as a click
|
||||
new Event(e).stop();
|
||||
|
||||
const elem = e.event.srcElement;
|
||||
if ((elem.id === "newPluginPath") || (elem.id === "newPluginOk"))
|
||||
newPluginOk();
|
||||
else if (elem.id === "newPluginCancel")
|
||||
closeSearchWindow('installSearchPlugin');
|
||||
}
|
||||
}
|
||||
}).activate();
|
||||
|
||||
$('newPluginPath').select();
|
||||
};
|
||||
|
||||
this.newPluginOk = function() {
|
||||
const path = $("newPluginPath").get("value").trim();
|
||||
if (path)
|
||||
new Request({
|
||||
url: 'api/v2/search/installPlugin',
|
||||
noCache: true,
|
||||
method: 'post',
|
||||
data: {
|
||||
sources: path,
|
||||
},
|
||||
onRequest: function() {
|
||||
closeSearchWindow('installSearchPlugin');
|
||||
}
|
||||
}).send();
|
||||
};
|
||||
|
||||
initInstallSearchPlugin();
|
||||
</script>
|
||||
Reference in New Issue
Block a user