Move WebUI views into separate folder
[qBittorrent.git] / src / webui / www / private / views / installsearchplugin.html
blob4dc6c631dfc819b02d23ca7d97812a185ad664cd
1 <style type="text/css">
2 #installSearchPluginContainer {
3 margin: 10px;
6 #installSearchPluginContainer button {
7 padding: 3px 20px;
10 #newPluginPath {
11 width: 100%;
12 line-height: 2em;
15 </style>
17 <div id="installSearchPluginContainer">
18 <h2>QBT_TR(Plugin path:)QBT_TR[CONTEXT=PluginSourceDlg]</h2>
20 <div>
21 <input type="text" id="newPluginPath" placeholder="QBT_TR(URL or local directory)QBT_TR[CONTEXT=PluginSourceDlg]" autocorrect="off" autocapitalize="none" />
22 <div style="margin-top: 10px; text-align: center;">
23 <button id="newPluginCancel" onclick="closeSearchWindow('installSearchPlugin');">QBT_TR(Cancel)QBT_TR[CONTEXT=PluginSourceDlg]</button>
24 <button id="newPluginOk" onclick="newPluginOk();">QBT_TR(Ok)QBT_TR[CONTEXT=PluginSourceDlg]</button>
25 </div>
26 </div>
27 </div>
29 <script>
30 'use strict';
32 this.initInstallSearchPlugin = function() {
33 new Keyboard({
34 defaultEventType: 'keydown',
35 events: {
36 'Enter': function(e) {
37 // accept enter key as a click
38 new Event(e).stop();
40 const elem = e.event.srcElement;
41 if ((elem.id === "newPluginPath") || (elem.id === "newPluginOk"))
42 newPluginOk();
43 else if (elem.id === "newPluginCancel")
44 closeSearchWindow('installSearchPlugin');
47 }).activate();
49 $('newPluginPath').select();
52 this.newPluginOk = function() {
53 const path = $("newPluginPath").get("value").trim();
54 if (path)
55 new Request({
56 url: 'api/v2/search/installPlugin',
57 noCache: true,
58 method: 'post',
59 data: {
60 sources: path,
62 onRequest: function() {
63 closeSearchWindow('installSearchPlugin');
65 }).send();
68 initInstallSearchPlugin();
69 </script>