fixed the issue of not being able to hit enter key to submit a form
This commit is contained in:
@@ -5,7 +5,7 @@
|
|||||||
<summary>Aria2 and youtube-dl web gui for nextcloud</summary>
|
<summary>Aria2 and youtube-dl web gui for nextcloud</summary>
|
||||||
<description>built-in torrent search;Start and stop Aria2 process, manage Aria2 from the web;
|
<description>built-in torrent search;Start and stop Aria2 process, manage Aria2 from the web;
|
||||||
Download videos from youtube, twitter and other sites;</description>
|
Download videos from youtube, twitter and other sites;</description>
|
||||||
<version>0.1.1</version>
|
<version>0.1.2</version>
|
||||||
<licence>agpl</licence>
|
<licence>agpl</licence>
|
||||||
<author mail="freefallbenson@gmail.com" homepage="https://github.com/shiningw">jiaxinhuang</author>
|
<author mail="freefallbenson@gmail.com" homepage="https://github.com/shiningw">jiaxinhuang</author>
|
||||||
<namespace>NCDownloader</namespace>
|
<namespace>NCDownloader</namespace>
|
||||||
|
|||||||
@@ -18,13 +18,6 @@ $(document).on('ajaxSend', function (elm, xhr, settings) {
|
|||||||
})
|
})
|
||||||
window.addEventListener('DOMContentLoaded', function () {
|
window.addEventListener('DOMContentLoaded', function () {
|
||||||
|
|
||||||
document.addEventListener("keydown", function (event) {
|
|
||||||
if (event.key === "Enter") {
|
|
||||||
event.preventDefault();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
);
|
|
||||||
inputAction.run();
|
inputAction.run();
|
||||||
updatePage.run();
|
updatePage.run();
|
||||||
buttonActions.run();
|
buttonActions.run();
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
import helper from './helper'
|
import helper from './helper'
|
||||||
import $ from 'jquery'
|
import $ from 'jquery'
|
||||||
import Http from './http'
|
import Http from './http'
|
||||||
import 'tippy.js/dist/tippy.css';
|
|
||||||
import { translate as t, translatePlural as n } from '@nextcloud/l10n'
|
import { translate as t, translatePlural as n } from '@nextcloud/l10n'
|
||||||
import inputBox from './inputBox'
|
import inputBox from './inputBox'
|
||||||
import nctable from './ncTable'
|
import nctable from './ncTable'
|
||||||
@@ -37,8 +36,8 @@ const createInputBox = (event, type) => {
|
|||||||
let container;
|
let container;
|
||||||
if (type === 'search') {
|
if (type === 'search') {
|
||||||
let selectOptions = [];
|
let selectOptions = [];
|
||||||
selectOptions.push({name:'bitSearch',label:'BITSEARCH',default:0});
|
selectOptions.push({ name: 'bitSearch', label: 'BITSEARCH', selected: 0 });
|
||||||
selectOptions.push({name:'TPB',label:'THEPIRATEBAY',selected:1});
|
selectOptions.push({ name: 'TPB', label: 'THEPIRATEBAY', selected: 1 });
|
||||||
container = inputBox.getInstance(name, type, path).createOptions(selectOptions).create().addSpinner();
|
container = inputBox.getInstance(name, type, path).createOptions(selectOptions).create().addSpinner();
|
||||||
//container.appendChild(inputBox.createLoading());
|
//container.appendChild(inputBox.createLoading());
|
||||||
} else {
|
} else {
|
||||||
@@ -75,7 +74,7 @@ const inputHandler = (event) => {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (inputData.type === 'ytdl') {
|
if (inputData.type === 'ytdl') {
|
||||||
helper.message(t("ncdownloader", "Please check your download folder for progress"), 5000);
|
helper.message(t("ncdownloader", "Your download has started!"), 5000);
|
||||||
}
|
}
|
||||||
if (inputData.type === 'search') {
|
if (inputData.type === 'search') {
|
||||||
//a scheduled 60s-interval update is running in the background, this is to prevent it from interfering when searching
|
//a scheduled 60s-interval update is running in the background, this is to prevent it from interfering when searching
|
||||||
@@ -83,12 +82,19 @@ const inputHandler = (event) => {
|
|||||||
nctable.getInstance().loading();
|
nctable.getInstance().loading();
|
||||||
}
|
}
|
||||||
const successCallback = (data, element) => {
|
const successCallback = (data, element) => {
|
||||||
//data = JSON.parse(data.target.response)
|
if (!data) {
|
||||||
if (data !== null && data.hasOwnProperty("file")) {
|
helper.message(t("ncdownloader", "Something must have gone wrong!"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (data.hasOwnProperty("error")) {
|
||||||
|
helper.message(t("ncdownloader", data.error));
|
||||||
|
} else if (data.hasOwnProperty("message")) {
|
||||||
|
helper.message(t("ncdownloader", data.message));
|
||||||
|
} else if (data.hasOwnProperty("file")) {
|
||||||
helper.message(t("ncdownloader", "Downloading" + " " + data.file));
|
helper.message(t("ncdownloader", "Downloading" + " " + data.file));
|
||||||
}
|
}
|
||||||
toggleSpinner(element);
|
|
||||||
if (data && data.title) {
|
if (data && data.title) {
|
||||||
|
toggleSpinner(element);
|
||||||
const tableInst = nctable.getInstance(data.title, data.row);
|
const tableInst = nctable.getInstance(data.title, data.row);
|
||||||
tableInst.actionLink = false;
|
tableInst.actionLink = false;
|
||||||
tableInst.rowClass = "table-row-search";
|
tableInst.rowClass = "table-row-search";
|
||||||
@@ -107,7 +113,6 @@ export default {
|
|||||||
$("#app-navigation").on("click", "#new-download-ytdl", (event) => createInputBox(event, 'ytdl'));
|
$("#app-navigation").on("click", "#new-download-ytdl", (event) => createInputBox(event, 'ytdl'));
|
||||||
$("#app-navigation").on("click", "#new-download", (event) => createInputBox(event, ''));
|
$("#app-navigation").on("click", "#new-download", (event) => createInputBox(event, ''));
|
||||||
$("#app-navigation").on("click", "#torrent-search-button", (event) => createInputBox(event, 'search'));
|
$("#app-navigation").on("click", "#torrent-search-button", (event) => createInputBox(event, 'search'));
|
||||||
|
$("#ncdownloader-form-wrapper").on("click", "#form-input-button", (event) => inputHandler(event));
|
||||||
$("#ncdownloader-form-wrapper").on("click", "#form-input-button", (event) => inputHandler(event))
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -88,7 +88,7 @@ class inputBox {
|
|||||||
}
|
}
|
||||||
_createButton() {
|
_createButton() {
|
||||||
let button = document.createElement('button');
|
let button = document.createElement('button');
|
||||||
button.setAttribute('type', this.btnName);
|
button.setAttribute('type', 'submit');
|
||||||
button.setAttribute('id', 'form-input-button');
|
button.setAttribute('id', 'form-input-button');
|
||||||
//buttonInput.setAttribute('value', t('ncdownloader', helper.ucfirst(btnName)));
|
//buttonInput.setAttribute('value', t('ncdownloader', helper.ucfirst(btnName)));
|
||||||
let text = document.createTextNode(t('ncdownloader', helper.ucfirst(this.btnName)));
|
let text = document.createTextNode(t('ncdownloader', helper.ucfirst(this.btnName)));
|
||||||
|
|||||||
@@ -8,8 +8,10 @@ import autoComplete from './autoComplete';
|
|||||||
import eventHandler from './eventHandler';
|
import eventHandler from './eventHandler';
|
||||||
import aria2Options from './aria2Options';
|
import aria2Options from './aria2Options';
|
||||||
import helper from './helper';
|
import helper from './helper';
|
||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
window.addEventListener('DOMContentLoaded', function () {
|
window.addEventListener('DOMContentLoaded', function () {
|
||||||
|
|
||||||
eventHandler.add('click', '.ncdownloader-admin-settings', 'input[type="button"]', function (event) {
|
eventHandler.add('click', '.ncdownloader-admin-settings', 'input[type="button"]', function (event) {
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
OC_msg.startSaving('#ncdownloader-message-banner');
|
OC_msg.startSaving('#ncdownloader-message-banner');
|
||||||
@@ -98,6 +100,7 @@ window.addEventListener('DOMContentLoaded', function () {
|
|||||||
}
|
}
|
||||||
let input = [];
|
let input = [];
|
||||||
for (let key in data) {
|
for (let key in data) {
|
||||||
|
if (aria2Options.includes(key))
|
||||||
input.push({ name: key, value: data[key], id: key });
|
input.push({ name: key, value: data[key], id: key });
|
||||||
}
|
}
|
||||||
settingsForm.getInstance().render(input);
|
settingsForm.getInstance().render(input);
|
||||||
|
|||||||
Reference in New Issue
Block a user