tiktok images and crowdin

This commit is contained in:
wukko
2022-09-03 21:32:39 +06:00
parent 297c1ed116
commit 9ea832caf5
24 changed files with 313 additions and 269 deletions

View File

@@ -67,7 +67,6 @@ export function multiPagePopup(obj) {
tabs += `<button id="close-bottom" class="switch tab-${obj.name}" onclick="popup('${obj.name}', 0)" ${obj.closeAria ? `aria-label="${obj.closeAria}"` : ''}>x</button>`
return `
<div id="popup-${obj.name}" class="popup center box scrollable" style="visibility: hidden;">
<div id="popup-content">${obj.header ? `<div id="popup-header" class="popup-header">
${obj.header.aboveTitle ? `<a id="popup-above-title" target="_blank" href="${obj.header.aboveTitle.url}">${obj.header.aboveTitle.text}</a>` : ''}
${obj.header.title ? `<div id="popup-title">${obj.header.title}</div>` : ''}
@@ -76,6 +75,22 @@ export function multiPagePopup(obj) {
</div>`
}
export function popupWithBottomButtons(obj) {
let tabs = ``
for (let i = 0; i < obj.buttons.length; i++) {
tabs += obj.buttons[i]
}
tabs += `<button id="close-bottom" class="switch tab-${obj.name}" onclick="popup('${obj.name}', 0)" ${obj.closeAria ? `aria-label="${obj.closeAria}"` : ''}>x</button>`
return `
<div id="popup-${obj.name}" class="popup center box scrollable" style="visibility: hidden;">
<div id="popup-content">${obj.header ? `<div id="popup-header" class="popup-header">
${obj.header.aboveTitle ? `<a id="popup-above-title" target="_blank" href="${obj.header.aboveTitle.url}">${obj.header.aboveTitle.text}</a>` : ''}
${obj.header.title ? `<div id="popup-title">${obj.header.title}</div>` : ''}
${obj.header.subtitle ? `<div id="popup-subtitle">${obj.header.subtitle}</div>` : ''}
${obj.header.explanation ? `<div class="explanation">${obj.header.explanation}</div>` : ''}</div>` : ''}${obj.content}</div>
<div id="popup-buttons" class="switches popup-tabs">${tabs}</div>
</div>`
}
export function backdropLink(link, text) {
return `<a class="text-backdrop" href="${link}" target="_blank">${text}</a>`
}

View File

@@ -1,4 +1,4 @@
import { backdropLink, checkbox, footerButtons, multiPagePopup, popup, settingsCategory, switcher } from "./elements.js";
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";
@@ -29,7 +29,9 @@ for (let i in donations["crypto"]) {
}
export default function(obj) {
audioFormats[0]["text"] = loc(obj.lang, 'SettingsAudioFormatBest')
let isIOS = obj.useragent.toLowerCase().match("iphone os")
let ua = obj.useragent.toLowerCase()
let isIOS = ua.match("iphone os")
let isMobile = ua.match("android") || ua.match("iphone os")
try {
return `<!DOCTYPE html>
<html lang="en">
@@ -98,13 +100,13 @@ export default function(obj) {
text: `<div class="category-title">${loc(obj.lang, 'ChangelogLastMajor')}</div>`,
raw: true
}, {
text: loc('en', 'ChangelogContentTitle'),
text: loc('changelog', 'ContentTitle'),
classes: ["changelog-subtitle"],
nopadding: true
}, {
text: loc('en', 'FollowTwitter')
text: loc('changelog', 'FollowTwitter')
}, {
text: loc('en', 'ChangelogContent')
text: loc('changelog', 'Content')
}, {
text: `<div class="category-title">${loc(obj.lang, 'ChangelogLastCommit')}</div>`,
raw: true
@@ -255,6 +257,17 @@ export default function(obj) {
<div id="pd-copy" class="switch full">${loc(obj.lang, 'CopyURL')}</div>`
})
})}
${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: [`<a id="imagepicker-download" class="switch" target="_blank" href="/">${loc(obj.lang, 'ImagePickerDownloadAudio')}</a>`],
content: '<div id="imagepicker-holder"></div>'
})}
${popup({
name: "error",
standalone: true,
@@ -297,11 +310,12 @@ export default function(obj) {
</footer>
</body>
<script type="text/javascript">const loc = {
noInternet: "${loc(obj.lang, 'ErrorNoInternet')}",
noURLReturned: "${loc(obj.lang, 'ErrorBadFetch')}",
noInternet: ` + "`" + loc(obj.lang, 'ErrorNoInternet') + "`" + `,
noURLReturned: ` + "`" + loc(obj.lang, 'ErrorNoUrlReturned') + "`" + `,
unknownStatus: ` + "`" + loc(obj.lang, 'ErrorUnknownStatus') + "`" + `,
toggleDefault: '${emoji("✨")} ${loc(obj.lang, "ModeToggleSmart")} ${loc(obj.lang, "ModeToggle")}',
toggleAudio: '${emoji("🎶")} ${loc(obj.lang, "SettingsAudioTab")} ${loc(obj.lang, "ModeToggle")}',
pressToChange: '<div class="tooltip">▼ ${loc(obj.lang, 'PressToChange')}</div>'
pressToChange: '<div class="tooltip">▼ ${loc(obj.lang, 'AccessibilityModeToggle')}</div>'
};</script>
<script type="text/javascript" src="cobalt.js"></script>
</html>`;