|
|
<!DOCTYPE html>
|
|
|
<html lang="en">
|
|
|
|
|
|
<head>
|
|
|
<meta charset="UTF-8">
|
|
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
|
<title id="title">Preferences</title>
|
|
|
<link rel="stylesheet" href="../assets/css/extra.css">
|
|
|
<!-- Translating -->
|
|
|
<script>window.i18n = new (require('../translations/i18n'));</script>
|
|
|
</head>
|
|
|
|
|
|
<body>
|
|
|
<div id="top">
|
|
|
<a id="back">Homepage</a>
|
|
|
<!-- <a id="restart" onclick="restartApp()">Restart app</a> -->
|
|
|
</div>
|
|
|
|
|
|
<h1 id="preferences">Preferences</h1>
|
|
|
<br><br>
|
|
|
|
|
|
<div class="prefBox">
|
|
|
<strong id="dlText">Download location</strong>
|
|
|
</div>
|
|
|
<br>
|
|
|
|
|
|
|
|
|
<div class="prefBox">
|
|
|
<span id="clText">Current download location - </span><span id="path"></span>
|
|
|
</div>
|
|
|
|
|
|
<br>
|
|
|
<button id="selectLocation">Select Download Location</button>
|
|
|
|
|
|
<p id="msg">
|
|
|
</p>
|
|
|
|
|
|
<br>
|
|
|
|
|
|
<div class="prefBox">
|
|
|
<span id="transparentText">Enable transparent dark mode(only Linux, needs restart)</span><input type="checkbox"
|
|
|
id="enableTransparent">
|
|
|
</div>
|
|
|
<br>
|
|
|
|
|
|
|
|
|
<div class="prefBox">
|
|
|
<label id="selectLn">Select Language (Requires reload)</label>
|
|
|
<select id="select" onchange="changeLanguage()">
|
|
|
<option value="en">English</option>
|
|
|
|
|
|
<option value="de">Deutsch</option>
|
|
|
<option value="es">Español</option>
|
|
|
<option value="fa">فارسی</option>
|
|
|
<option value="it">Italiano</option>
|
|
|
<option value="pl">Polski</option>
|
|
|
<option value="pt">Português</option>
|
|
|
<option value="ru">Русский</option>
|
|
|
<option value="fi">Finnish</option>
|
|
|
<option value="uk">Українська</option>
|
|
|
<option value="tr">Türkçe</option>
|
|
|
</select>
|
|
|
</div>
|
|
|
<br>
|
|
|
|
|
|
<div class="prefBox">
|
|
|
<span id="browserTxt">Select browser to use cookies from</span>
|
|
|
<span id="browserInfo"> ℹ️</span>
|
|
|
<select id="browser">
|
|
|
<option value="" id="none">None</option>
|
|
|
<option value="chrome">Chrome</option>
|
|
|
<option value="firefox">Firefox</option>
|
|
|
<option value="brave">Brave</option>
|
|
|
<option value="opera">Opera Mini</option>
|
|
|
<option value="edge">Edge</option>
|
|
|
<option value="chromium">Chromium</option>
|
|
|
<option value="safari">Safari</option>
|
|
|
<option value="vivaldi">Vivaldi</option>
|
|
|
</select>
|
|
|
</div>
|
|
|
|
|
|
|
|
|
<script>
|
|
|
let rightToLeft = false;
|
|
|
if (localStorage.getItem("rightToLeft")) {
|
|
|
rightToLeft = localStorage.getItem("rightToLeft")
|
|
|
}
|
|
|
if (rightToLeft == "true") {
|
|
|
document.querySelectorAll(".prefBox").forEach(item => {
|
|
|
item.style.flexDirection = "row-reverse"
|
|
|
})
|
|
|
}
|
|
|
else{
|
|
|
console.log("Change to left to right");
|
|
|
document.querySelectorAll(".prefBox").forEach(item => {
|
|
|
item.style.flexDirection = "row"
|
|
|
})
|
|
|
}
|
|
|
let downloadPath = localStorage.getItem("downloadPath")
|
|
|
getId("path").textContent = downloadPath
|
|
|
|
|
|
const { ipcRenderer, dialog } = require("electron")
|
|
|
function getId(id) {
|
|
|
return document.getElementById(id)
|
|
|
}
|
|
|
|
|
|
function restartApp() {
|
|
|
ipcRenderer.send("restart")
|
|
|
}
|
|
|
|
|
|
getId("back").addEventListener("click", () => {
|
|
|
ipcRenderer.send("close-secondary")
|
|
|
})
|
|
|
|
|
|
getId("selectLocation").addEventListener("click", () => {
|
|
|
ipcRenderer.send("select-location", "")
|
|
|
})
|
|
|
|
|
|
ipcRenderer.on("downloadPath", (event, downloadPath) => {
|
|
|
console.log(downloadPath);
|
|
|
localStorage.setItem("downloadPath", downloadPath)
|
|
|
getId("path").textContent = downloadPath
|
|
|
})
|
|
|
|
|
|
const enabledTransparent = getId("enableTransparent")
|
|
|
enabledTransparent.addEventListener("change", (event) => {
|
|
|
if (enabledTransparent.checked) {
|
|
|
localStorage.setItem("enabledTransparent", "true")
|
|
|
}
|
|
|
else {
|
|
|
localStorage.setItem("enabledTransparent", "false")
|
|
|
}
|
|
|
})
|
|
|
|
|
|
const localEnabledTransparent = localStorage.getItem("enabledTransparent")
|
|
|
if (localEnabledTransparent == "true") {
|
|
|
enabledTransparent.checked = true
|
|
|
}
|
|
|
const language = localStorage.getItem("language")
|
|
|
|
|
|
if (language) {
|
|
|
getId("select").value = language
|
|
|
}
|
|
|
function changeLanguage() {
|
|
|
const language = getId("select").value
|
|
|
localStorage.setItem("language", language)
|
|
|
if (language === "fa") {
|
|
|
rightToLeft = true;
|
|
|
localStorage.setItem("rightToLeft", true)
|
|
|
}
|
|
|
else {
|
|
|
rightToLeft = false;
|
|
|
localStorage.setItem("rightToLeft", false)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
let browser = localStorage.getItem("browser")
|
|
|
if (browser) {
|
|
|
getId("browser").value = browser
|
|
|
}
|
|
|
|
|
|
getId("browser").addEventListener("change", () => {
|
|
|
browser = getId("browser").value
|
|
|
localStorage.setItem("browser", browser)
|
|
|
})
|
|
|
|
|
|
require("../src/translate_preferences")
|
|
|
</script>
|
|
|
</body>
|
|
|
|
|
|
</html> |