2 #installSearchPluginContainer {
6 #installSearchPluginContainer button {
16 <div id=
"installSearchPluginContainer">
17 <label for=
"newPluginPath">QBT_TR(Plugin path:)QBT_TR[CONTEXT=PluginSourceDlg]
</label>
20 <input type=
"text" id=
"newPluginPath" placeholder=
"QBT_TR(URL or local directory)QBT_TR[CONTEXT=PluginSourceDlg]" autocorrect=
"off" autocapitalize=
"none">
21 <div style=
"margin-top: 10px; text-align: center;">
22 <button type=
"button" id=
"newPluginCancel" onclick=
"qBittorrent.SearchPlugins.closeSearchWindow('installSearchPlugin');">QBT_TR(Cancel)QBT_TR[CONTEXT=PluginSourceDlg]
</button>
23 <button type=
"button" id=
"newPluginOk" onclick=
"qBittorrent.InstallSearchPlugin.newPluginOk();">QBT_TR(Ok)QBT_TR[CONTEXT=PluginSourceDlg]
</button>
31 window
.qBittorrent
??= {};
32 window
.qBittorrent
.InstallSearchPlugin
??= (() => {
33 const exports
= () => {
36 newPluginOk
: newPluginOk
40 const setup = function() {
42 defaultEventType
: "keydown",
44 "Enter": function(e
) {
45 // accept enter key as a click
49 const elem
= e
.event
.srcElement
;
50 if ((elem
.id
=== "newPluginPath") || (elem
.id
=== "newPluginOk"))
52 else if (elem
.id
=== "newPluginCancel")
53 window
.qBittorrent
.SearchPlugins
.closeSearchWindow("installSearchPlugin");
58 $("newPluginPath").select();
61 const newPluginOk = function() {
62 const path
= $("newPluginPath").value
.trim();
65 url
: "api/v2/search/installPlugin",
70 onRequest: function() {
71 window
.qBittorrent
.SearchPlugins
.closeSearchWindow("installSearchPlugin");
79 Object
.freeze(window
.qBittorrent
.InstallSearchPlugin
);
81 window
.qBittorrent
.InstallSearchPlugin
.setup();