Error handling and bug fixes

pull/112/head
Andrew 3 years ago
parent 0f72dd3d71
commit 178125475e

@ -445,7 +445,7 @@ body::-webkit-scrollbar-thumb {
position: fixed;
bottom: 10px;
right: 10px;
z-index: 99;
z-index: 2;
border: none;
outline: none;
background-image: url(../images/up-arrow.png);
@ -459,8 +459,8 @@ body::-webkit-scrollbar-thumb {
#popupText{
display: none;
position:absolute;
right:30px;
position:fixed;
left:25px;
bottom: 20px;
padding:10px;
border-radius: 2px;
@ -468,4 +468,5 @@ body::-webkit-scrollbar-thumb {
background-color: rgb(80, 80, 224);
cursor: pointer;
transition: .5s all;
z-index: 2;
}

@ -33,6 +33,7 @@
<content_rating type="oars-1.1"/>
<releases>
<release version="3.11.0" date="2023-1-30"/>
<release version="3.10.6" date="2023-1-24"/>
<release version="3.10.5" date="2023-1-22"/>
<release version="3.10.4" date="2023-1-19"/>

@ -35,11 +35,9 @@
</svg>
</div>
</div>
<!-- Popup message -->
<span id="popupText">Text copied</span>
<body>
<!-- Popup message -->
<span id="popupText">Text copied</span>
<!-- Theme toggle -->
<div id="themeToggle" onclick="toggle()">
<div id="themeToggleInside"></div>

@ -26,16 +26,21 @@
position: relative;
bottom: 8px;
}
#audioBox{
display:none;
#audioBox {
display: none;
}
#advancedMenu{
display:none;
#advancedMenu {
display: none;
}
</style>
</head>
<body>
<!-- Popup message -->
<span id="popupText">Text copied</span>
<!-- Theme toggle -->
<div id="themeToggle" onclick="toggle()">
<div id="themeToggleInside"></div>
@ -113,6 +118,9 @@
</div>
<p id="incorrectMsg"></p>
<!-- Error button -->
<button class="advancedToggle" id="errorBtn" onclick="toggleErrorDetails()">Error Details ▼</button>
<div id="errorDetails" onclick="copyErrorToClipboard()"></div>
</div>
@ -124,4 +132,4 @@
<div id="goToTop"></div>
</body>
</html>
</html>

@ -1,3 +1,5 @@
const electron = require("electron")
function getId(id) {
return document.getElementById(id);
}
@ -120,3 +122,33 @@ function scrollFunction() {
getId("goToTop").addEventListener("click", () => {
window.scrollTo({ top: 0, behavior: "smooth" });
});
// Showing and hiding error details
function toggleErrorDetails() {
const status = getId("errorDetails").style.display;
if (status === "none") {
getId("errorDetails").style.display = "block";
getId("errorBtn").textContent = i18n.__("Error Details") + " ▲";
} else {
getId("errorDetails").style.display = "none";
getId("errorBtn").textContent = i18n.__("Error Details") + " ▼";
}
}
// Copying error txt
function copyErrorToClipboard() {
const error = getId("errorDetails").textContent;
electron.clipboard.writeText(error);
showPopup(i18n.__("Copied text"));
}
// Popup message
function showPopup(text) {
console.log("Triggered showpopup")
getId("popupText").textContent = text
getId("popupText").style.display = "inline-block";
setTimeout(() => {
getId("popupText").style.display = "none"
}, 2200);
}

@ -56,6 +56,7 @@ function pasteLink() {
getId("link").textContent = " " + url;
getId("options").style.display = "block";
getId("incorrectMsg").textContent = "";
getId("errorBtn").style.display = "none";
}
getId("pasteLink").addEventListener("click", () => {
@ -102,7 +103,7 @@ function download(type) {
let quality, format, downloadProcess;
if (type === "video") {
quality = Number(getId("select").value);
quality = getId("select").value;
const formatId = formats[quality]
if (quality === "best") {
format = "-f bv*+ba/best";
@ -255,6 +256,13 @@ function showErrorTxt(error) {
"Some error has occurred. Check your network and use correct URL"
);
getId("incorrectMsg").title = error;
getId("errorBtn").style.display = "inline-block";
getId("errorDetails").innerHTML = `
<strong>URL: ${url}</strong>
<br><br>
${error}
`;
getId("errorDetails").title = i18n.__("Click to copy");
}
// File and folder name patterns
@ -274,6 +282,9 @@ function hideOptions() {
getId("pasteLink").style.display = "none";
getId("playlistName").textContent = i18n.__("Processing") + "...";
getId("list").innerHTML = "";
getId("errorBtn").style.display = "none";
getId("errorDetails").style.display = "none";
getId("errorDetails").textContent = "";
}
function downloadThumbnails() {
@ -520,3 +531,4 @@ getId("playlistEnd").placeholder = i18n.__("End");
getId("downloadThumbnails").textContent = i18n.__("Download thumbnails");
getId("saveLinks").textContent = i18n.__("Save video links to a file");
getId("useConfigTxt").textContent = i18n.__("Use config file");
getId("errorBtn").textContent = i18n.__("Error Details")+" ▼"

@ -1044,26 +1044,6 @@ function fadeItem(id) {
}, 50);
}
// Showing and hiding error details
function toggleErrorDetails() {
const status = getId("errorDetails").style.display;
if (status === "none") {
getId("errorDetails").style.display = "block";
getId("errorBtn").textContent = i18n.__("Error Details") + " ▲";
} else {
getId("errorDetails").style.display = "none";
getId("errorBtn").textContent = i18n.__("Error Details") + " ▼";
}
}
// Copying error txt
function copyErrorToClipboard() {
const error = getId("errorDetails").textContent;
clipboard.writeText(error);
showPopup(i18n.__("Copied text"))
}
// After saving video
function afterSave(location, filename, progressId) {
@ -1113,15 +1093,6 @@ function closeMenu() {
}, 50);
}
// Popup message
function showPopup(text) {
getId("popupText").textContent = text
getId("popupText").style.display = "inline-block";
setTimeout(() => {
getId("popupText").style.display = "none"
}, 2000);
}
// Menu
getId("preferenceWin").addEventListener("click", () => {

Loading…
Cancel
Save