From 3585ffb50defb3282a922ca5382c3adbaff6b5cb Mon Sep 17 00:00:00 2001
From: Stanislav Mikhailov <52722847+xavetar@users.noreply.github.com>
Date: Mon, 19 Sep 2022 10:55:55 +0300
Subject: [PATCH] Delete page.js
---
src/modules/pageRender/page.js | 354 ---------------------------------
1 file changed, 354 deletions(-)
delete mode 100644 src/modules/pageRender/page.js
diff --git a/src/modules/pageRender/page.js b/src/modules/pageRender/page.js
deleted file mode 100644
index 56e7eeee..00000000
--- a/src/modules/pageRender/page.js
+++ /dev/null
@@ -1,354 +0,0 @@
-import { backdropLink, checkbox, footerButtons, multiPagePopup, popup, popupWithBottomButtons, settingsCategory, switcher } from "./elements.js";
-import { services, appName, authorInfo, version, quality, repo, donations, supportedAudio } from "../config.js";
-import { getCommitInfo } from "../sub/currentCommit.js";
-import loc from "../../localization/manager.js";
-import emoji from "../emoji.js";
-import changelogManager from "../changelog/changelogManager.js";
-
-let s = services;
-let com = getCommitInfo();
-
-let enabledServices = Object.keys(s).filter((p) => {
- if (s[p].enabled) return true;
-}).sort().map((p) => {
- return s[p].alias ? s[p].alias : p
-}).join(', ')
-
-let donate = ``
-let donateLinks = ``
-let audioFormats = supportedAudio.map((p) => {
- return { "action": p }
-})
-audioFormats.unshift({ "action": "best" })
-for (let i in donations["other"]) {
- donateLinks += `${i}`
-}
-let extr = ''
-for (let i in donations["crypto"]) {
- donate += `
${i} (REPLACEME)
${donations["crypto"][i]}
`
- extr = ' extra'
-}
-export default function(obj) {
- audioFormats[0]["text"] = loc(obj.lang, 'SettingsAudioFormatBest');
- let ua = obj.useragent.toLowerCase();
- let isIOS = ua.match("iphone os");
- let isMobile = ua.match("android") || ua.match("iphone os");
- let isFirefox = ua.match("firefox/");
- try {
- return `
-
-
-
-
-
- ${appName}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- ${multiPagePopup({
- name: "about",
- closeAria: loc(obj.lang, 'AccessibilityClosePopup'),
- tabs: [{
- name: "about",
- title: `${emoji("đ˛")} ${loc(obj.lang, 'AboutTab')}`,
- content: popup({
- name: "about",
- header: {
- aboveTitle: {
- text: loc(obj.lang, 'MadeWithLove'),
- url: authorInfo.link
- },
- closeAria: loc(obj.lang, 'AccessibilityClosePopup'),
- title: loc(obj.lang, 'TitlePopupAbout')
- },
- body: [{
- text: loc(obj.lang, 'AboutSummary')
- }, {
- text: `${loc(obj.lang, 'AboutSupportedServices')} ${enabledServices}.`
- }, {
- text: `${loc(obj.lang, 'FollowTwitter')}`
- }, {
- text: backdropLink(repo, loc(obj.lang, 'LinkGitHubIssues')),
- classes: ["bottom-link"]
- }]
- })
- }, {
- name: "changelog",
- title: `${emoji("đ")} ${loc(obj.lang, 'ChangelogTab')}`,
- content: popup({
- name: "changelog",
- header: {
- closeAria: loc(obj.lang, 'AccessibilityClosePopup'),
- title: `${emoji("đĒ", 30)} ${loc(obj.lang, 'TitlePopupChangelog')}`
- },
- body: [{
- text: `${loc(obj.lang, 'ChangelogLastMajor')}
`,
- raw: true
- }, {
- text: changelogManager("title"),
- classes: ["changelog-subtitle"],
- nopadding: true
- }, {
- text: changelogManager("content")
- }, {
- text: `${loc(obj.lang, 'ChangelogLastCommit')}
`,
- raw: true
- }, {
- text: `${com[0]} (${obj.hash})`,
- classes: ["changelog-subtitle"],
- nopadding: true
- }, {
- text: com[1]
- }, {
- text: backdropLink(`${repo}/commits`, loc(obj.lang, 'LinkGitHubChanges')),
- classes: ["bottom-link"]
- }, {
- text: `${loc(obj.lang, 'ChangelogOlder')}
`,
- raw: true
- }, {
- text: ``,
- raw: true
- }]
- })
- }, {
- name: "donate",
- title: `${emoji("đ°")} ${loc(obj.lang, 'DonationsTab')}`,
- content: popup({
- name: "donate",
- header: {
- closeAria: loc(obj.lang, 'AccessibilityClosePopup'),
- title: emoji("đ¸", 30) + loc(obj.lang, 'TitlePopupDonate'),
- subtitle: loc(obj.lang, 'DonateSubtitle')
- },
- body: [{
- text: donateLinks,
- raw: true
- }, {
- text: loc(obj.lang, 'DonateLinksDescription'),
- classes: ["explanation"]
- }, {
- text: donate.replace(/REPLACEME/g, loc(obj.lang, 'ClickToCopy'))
- }, {
- text: loc(obj.lang, 'DonateDescription'),
- classes: ["explanation", "no-top-padding"]
- }, {
- text: backdropLink(authorInfo.contact, loc(obj.lang, 'LinkDonateContact')),
- classes: ["bottom-link"]
- }]
- })
- }],
- })}
- ${multiPagePopup({
- name: "settings",
- closeAria: loc(obj.lang, 'AccessibilityClosePopup'),
- header: {
- aboveTitle: {
- text: `v.${version} ~ ${obj.hash}`,
- url: `${repo}/commit/${obj.hash}`
- },
- title: `${emoji("âī¸", 30)} ${loc(obj.lang, 'TitlePopupSettings')}`
- },
- tabs: [{
- name: "video",
- title: `${emoji("đŦ")} ${loc(obj.lang, 'SettingsVideoTab')}`,
- content: settingsCategory({
- name: "downloads",
- title: loc(obj.lang, 'SettingsDownloadsSubtitle'),
- body: switcher({
- name: "quality",
- subtitle: loc(obj.lang, 'SettingsQualitySubtitle'),
- explanation: loc(obj.lang, 'SettingsQualityDescription'),
- items: [{
- "action": "max",
- "text": loc(obj.lang, 'SettingsQualitySwitchMax')
- }, {
- "action": "hig",
- "text": `${loc(obj.lang, 'SettingsQualitySwitchHigh')}(${quality.hig}p)`
- }, {
- "action": "mid",
- "text": `${loc(obj.lang, 'SettingsQualitySwitchMedium')}(${quality.mid}p)`
- }, {
- "action": "low",
- "text": `${loc(obj.lang, 'SettingsQualitySwitchLow')}(${quality.low}p)`
- }]
- })
- }) + `${!isIOS ? checkbox("downloadPopup", loc(obj.lang, 'SettingsEnableDownloadPopup'), loc(obj.lang, 'AccessibilityEnableDownloadPopup')) : ''}`
- + settingsCategory({
- name: "youtube",
- body: switcher({
- name: "ytFormat",
- subtitle: loc(obj.lang, 'SettingsFormatSubtitle'),
- explanation: loc(obj.lang, 'SettingsFormatDescription'),
- items: [{
- "action": "mp4"
- }, {
- "action": "webm"
- }]
- })
- })
- + settingsCategory({
- name: "tiktok",
- title: "tiktok & douyin",
- body: checkbox("disableTikTokWatermark", loc(obj.lang, 'SettingsRemoveWatermark'), loc(obj.lang, 'SettingsRemoveWatermark'))
- })
- }, {
- name: "audio",
- title: `${emoji("đļ")} ${loc(obj.lang, 'SettingsAudioTab')}`,
- content: settingsCategory({
- name: "general",
- title: loc(obj.lang, 'SettingsAudioTab'),
- body: switcher({
- name: "audioFormat",
- subtitle: loc(obj.lang, 'SettingsFormatSubtitle'),
- explanation: loc(obj.lang, 'SettingsAudioFormatDescription'),
- items: audioFormats
- })
- }) + settingsCategory({
- name: "tiktok",
- title: "tiktok & douyin",
- body: checkbox("fullTikTokAudio", loc(obj.lang, 'SettingsAudioFullTikTok'), loc(obj.lang, 'SettingsAudioFullTikTok')) + `${loc(obj.lang, 'SettingsAudioFullTikTokDescription')}
`
- })
- }, {
- name: "other",
- title: `${emoji("đĒ
")} ${loc(obj.lang, 'SettingsOtherTab')}`,
- content: settingsCategory({
- name: "appearance",
- title: loc(obj.lang, 'SettingsAppearanceSubtitle'),
- body: switcher({
- name: "theme",
- subtitle: loc(obj.lang, 'SettingsThemeSubtitle'),
- items: [{
- "action": "auto",
- "text": loc(obj.lang, 'SettingsThemeAuto')
- }, {
- "action": "dark",
- "text": loc(obj.lang, 'SettingsThemeDark')
- }, {
- "action": "light",
- "text": loc(obj.lang, 'SettingsThemeLight')
- }]
- })
- })
- + checkbox("alwaysVisibleButton", loc(obj.lang, 'SettingsKeepDownloadButton'), loc(obj.lang, 'AccessibilityKeepDownloadButton'))
- + checkbox("disableChangelog", loc(obj.lang, 'SettingsDisableChangelogOnUpdate'), loc(obj.lang, 'SettingsDisableChangelogOnUpdate'))
- + (!isFirefox ? checkbox("disableClipboardButton", loc(obj.lang, 'SettingsDisableClipboard'), loc(obj.lang, 'SettingsDisableClipboard')) : ``)
- }],
- })}
- ${popup({
- name: "download",
- standalone: true,
- header: {
- closeAria: loc(obj.lang, 'AccessibilityClosePopup'),
- subtitle: loc(obj.lang, 'TitlePopupDownload')
- },
- body: switcher({
- name: "download",
- subtitle: loc(obj.lang, 'DownloadPopupWayToSave'),
- explanation: `${!isIOS ? loc(obj.lang, 'DownloadPopupDescription') : loc(obj.lang, 'DownloadPopupDescriptionIOS')}`,
- items: `${loc(obj.lang, 'Download')}
- ${loc(obj.lang, 'CopyURL')}
`
- })
- })}
- ${popupWithBottomButtons({
- name: "imagePicker",
- closeAria: loc(obj.lang, 'AccessibilityClosePopup'),
- header: {
- title: loc(obj.lang, 'ImagePickerTitle'),
- explanation: isMobile ? loc(obj.lang, 'ImagePickerExplanationPhone') : loc(obj.lang, 'ImagePickerExplanationPC')
- },
- buttons: [`${loc(obj.lang, 'ImagePickerDownloadAudio')}`],
- content: ''
- })}
- ${popup({
- name: "error",
- standalone: true,
- buttonOnly: true,
- emoji: emoji("âšī¸", 48, 1),
- classes: ["small"],
- buttonText: loc(obj.lang, 'ErrorPopupCloseButton'),
- header: {
- closeAria: loc(obj.lang, 'AccessibilityClosePopup'),
- title: loc(obj.lang, 'TitlePopupError')
- },
- body: ``
- })}
- ${popup({
- name: "info",
- standalone: true,
- buttonOnly: true,
- emoji: emoji("â¨", 48, 1),
- classes: ["small"],
- buttonText: loc(obj.lang, 'ErrorPopupCloseButton'),
- header: {
- closeAria: loc(obj.lang, 'AccessibilityClosePopup'),
- title: "popup title"
- },
- body: ``
- })}
-
-
-
-
-
-
-`;
- } catch (err) {
- return `${loc(obj.lang, 'ErrorPageRenderFail', obj.hash)}`;
- }
-}