tidying up

This commit is contained in:
huangjx
2022-07-24 10:54:02 +08:00
parent 96c7128ef7
commit 3a00325042
32 changed files with 146 additions and 144 deletions

View File

@@ -43,7 +43,7 @@ export default {
return {
display: { download: true, search: false },
uris: {
ytd_url: helper.generateUrl("/apps/ncdownloader/youtube/new"),
ytd_url: helper.generateUrl("/apps/ncdownloader/ytdl/new"),
aria2_url: helper.generateUrl("/apps/ncdownloader/new"),
search_url: helper.generateUrl("/apps/ncdownloader/search"),
upload_url: helper.generateUrl("/apps/ncdownloader/upload"),
@@ -62,15 +62,15 @@ export default {
helper.error(t("ncdownloader", inputValue + " is Invalid"));
return;
}
if (formData.type === "youtube-dl") {
if (formData.type === "ytdl") {
formData["extension"] = "";
if (formData["select-value-extension"] !== "defaultext") {
formData["extension"] = formData["select-value-extension"];
}
message = helper.t("Download task started!");
helper.pollingYoutube();
helper.setContentTableType("youtube-dl-downloads");
helper.pollingYtdl();
helper.setContentTableType("ytdl-downloads");
} else {
helper.polling();
helper.setContentTableType("active-downloads");

View File

@@ -17,11 +17,11 @@ export default {
}
helper.setContentTableType(name);
let delay;
if (!['active-downloads', 'youtube-dl-downloads'].includes(name)) {
if (!['active-downloads', 'ytdl-downloads'].includes(name)) {
delay = 15000;
}
if (name === "youtube-dl-downloads") {
helper.pollingYoutube();
if (name === "ytdl-downloads") {
helper.pollingYtdl();
} else {
helper.polling(delay, path);
}

View File

@@ -8,8 +8,8 @@
HTTP/MAGNET
</div>
<div
class="youtube-dl-link option-buttons"
@click.prevent="whichType('youtube-dl', $event)"
class="ytdl-link option-buttons"
@click.prevent="whichType('ytdl', $event)"
>
Youtube-dl
</div>
@@ -100,13 +100,13 @@ export default {
this.downloadType = type;
if (type === "aria2") {
this.path = this.uris.aria2_url;
} else if (type === "youtube-dl") {
} else if (type === "ytdl") {
this.placeholder = t("ncdownloader", "Paste your video link here");
this.path = this.uris.ytd_url;
} else {
this.path = this.uris.search_url;
}
this.checkboxes = type === "youtube-dl" ? true : false;
this.checkboxes = type === "ytdl" ? true : false;
this.inputType = type === "search" ? "search" : "download";
},
download(event) {
@@ -219,7 +219,7 @@ export default {
border-radius: 15px 0px 0px 15px;
}
.youtube-dl-link {
.ytdl-link {
background-color: #b8b8ca;
}
.search-torrents {
@@ -227,7 +227,7 @@ export default {
}
.search-torrents,
.youtube-dl-link,
.ytdl-link,
.magnet-link,
.choose-file {
color: #181616;

View File

@@ -88,7 +88,7 @@
flex: 1 1 0;
}
}
#ncdownloader-table-wrapper.youtube-dl-downloads {
#ncdownloader-table-wrapper.ytdl-downloads {
#table-cell-speed,
.table-heading-speed {

View File

@@ -7,7 +7,7 @@ import settingsForm from './lib/settingsForm'
import autoComplete from './lib/autoComplete';
import eventHandler from './lib/eventHandler';
import aria2Options from './utils/aria2Options';
import { options as ytdFullOptions, names as ytdOptions } from './utils/youtubedlOptions';
import { options as ytdlFullOptions, names as ytdlOptions } from './utils/ytdlOptions';
import helper from './utils/helper';
import './css/autoComplete.css'
import './css/settings.scss'
@@ -26,9 +26,9 @@ window.addEventListener('DOMContentLoaded', function () {
OC_msg.startSaving('#ncdownloader-message-banner');
helper.makePair(data, name);
let badOptions = [];
if (name === 'youtube-dl-settings') {
if (name === 'ytdl-settings') {
for (let key in data) {
if (!ytdOptions.includes(key) && !customOptions.includes(key)) {
if (!ytdlOptions.includes(key) && !customOptions.includes(key)) {
delete data[key];
badOptions.push(key)
}
@@ -105,10 +105,10 @@ window.addEventListener('DOMContentLoaded', function () {
eventHandler.add('click', '.ncdownloader-admin-settings', 'input[type="button"]', (e) => saveHandler(e));
eventHandler.add('click', '.ncdownloader-personal-settings', 'input[type="button"]', (e) => saveHandler(e));
eventHandler.add("click", "#custom-aria2-settings-container", "button.save-custom-aria2-settings", (e) => saveHandler(e))
eventHandler.add("click", "#custom-youtube-dl-settings-container", "button.save-custom-youtube-dl-settings", (e) => saveHandler(e, 'youtube-dl-settings'))
eventHandler.add("click", "#custom-ytdl-settings-container", "button.save-custom-ytdl-settings", (e) => saveHandler(e, 'ytdl-settings'))
eventHandler.add('click', '#custom-aria2-settings-container', "button.add-custom-aria2-settings", (e) => addOption(e, 'aria2', aria2Options))
eventHandler.add('click', '#custom-youtube-dl-settings-container', "button.add-custom-youtube-dl-settings", (e) => addOption(e, 'youtube-dl', ytdFullOptions))
eventHandler.add('click', '#custom-ytdl-settings-container', "button.add-custom-ytdl-settings", (e) => addOption(e, 'ytdl', ytdlFullOptions))
eventHandler.add('click', '.ncdownloader-personal-settings', 'button.icon-close', function (e) {
@@ -128,7 +128,7 @@ window.addEventListener('DOMContentLoaded', function () {
settingsForm.getInstance().render(input);
}).send();
helper.httpClient(generateUrl("/apps/ncdownloader/personal/youtube-dl/get")).setHandler(function (data) {
helper.httpClient(generateUrl("/apps/ncdownloader/personal/ytdl/get")).setHandler(function (data) {
if (!data) {
return;
}
@@ -136,7 +136,7 @@ window.addEventListener('DOMContentLoaded', function () {
for (let key in data) {
input.push({ name: key, value: data[key], id: key });
}
settingsForm.getInstance().setParent("custom-youtube-dl-settings-container").render(input);
settingsForm.getInstance().setParent("custom-ytdl-settings-container").render(input);
}).send();
const filepicker = function (event) {

View File

@@ -42,8 +42,8 @@ const helper = {
pollingFolder(delay = 1500) {
Polling.create().setDelay(delay).run(helper.scanFolder);
},
pollingYoutube(delay = 1500) {
Polling.create().setDelay(delay).run(helper.refresh, "/apps/ncdownloader/youtube/get");
pollingYtdl(delay = 1500) {
Polling.create().setDelay(delay).run(helper.refresh, "/apps/ncdownloader/ytdl/get");
},
refresh(path) {
path = path || "/apps/ncdownloader/status/active";

File diff suppressed because one or more lines are too long

3
src/utils/ytdlOptions.js Normal file

File diff suppressed because one or more lines are too long