mirror of
https://gitlab.com/lolmam/Phigros-Android-History.git
synced 2026-04-05 16:41:10 +00:00
Fix popup
This commit is contained in:
@@ -2337,27 +2337,35 @@
|
|||||||
</html>
|
</html>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
function setCookie(name, value, days) {
|
document.addEventListener("DOMContentLoaded", () => {
|
||||||
const expires = new Date(Date.now() + days * 864e5).toUTCString();
|
|
||||||
document.cookie = `${name}=${value}; expires=${expires}; path=/`;
|
|
||||||
}
|
|
||||||
|
|
||||||
function getCookie(name) {
|
|
||||||
return document.cookie.split("; ").find(c => c.startsWith(name + "="))?.split("=")[1];
|
|
||||||
}
|
|
||||||
|
|
||||||
let pendingURL = null;
|
|
||||||
|
|
||||||
window.addEventListener("DOMContentLoaded", () => {
|
|
||||||
const popup = document.getElementById("license-popup");
|
const popup = document.getElementById("license-popup");
|
||||||
const agree = document.getElementById("agree");
|
const agree = document.getElementById("agree");
|
||||||
const closeBtn = document.getElementById("close-popup");
|
const closeBtn = document.getElementById("close-popup");
|
||||||
|
|
||||||
document.querySelectorAll(".btn, .btn.alt").forEach(el => {
|
function setCookie(name, value, days) {
|
||||||
|
const expires = new Date(Date.now() + days * 864e5).toUTCString();
|
||||||
|
document.cookie = `${name}=${value}; expires=${expires}; path=/; SameSite=Lax`;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getCookie(name) {
|
||||||
|
return document.cookie
|
||||||
|
.split("; ")
|
||||||
|
.find(c => c.startsWith(name + "="))
|
||||||
|
?.split("=")[1];
|
||||||
|
}
|
||||||
|
|
||||||
|
let pendingURL = null;
|
||||||
|
|
||||||
|
const buttons = document.querySelectorAll(".btn, .btn.alt");
|
||||||
|
|
||||||
|
buttons.forEach(el => {
|
||||||
el.addEventListener("click", e => {
|
el.addEventListener("click", e => {
|
||||||
if (el.classList.contains("btn-unavailable")) return;
|
if (el.classList.contains("btn-unavailable")) return;
|
||||||
|
|
||||||
if (getCookie("licenseAccepted")) return;
|
if (getCookie("licenseAccepted")) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
pendingURL = el.href;
|
pendingURL = el.href;
|
||||||
@@ -2368,20 +2376,18 @@ window.addEventListener("DOMContentLoaded", () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
agree.addEventListener("click", () => {
|
agree.addEventListener("click", () => {
|
||||||
setCookie("licenseAccepted", "true", 30);
|
setCookie("licenseAccepted", "true", 365);
|
||||||
|
|
||||||
popup.classList.add("hidden");
|
popup.classList.add("hidden");
|
||||||
document.body.classList.remove("body-locked");
|
document.body.classList.remove("body-locked");
|
||||||
|
|
||||||
if (pendingURL) {
|
if (pendingURL) {
|
||||||
// Auto-trigger download immediately
|
const a = document.createElement("a");
|
||||||
const directDownload = document.createElement("a");
|
a.href = pendingURL;
|
||||||
directDownload.href = pendingURL;
|
a.download = "";
|
||||||
directDownload.download = "";
|
document.body.appendChild(a);
|
||||||
document.body.appendChild(directDownload);
|
a.click();
|
||||||
directDownload.click();
|
a.remove();
|
||||||
directDownload.remove();
|
|
||||||
|
|
||||||
pendingURL = null;
|
pendingURL = null;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -2391,6 +2397,7 @@ window.addEventListener("DOMContentLoaded", () => {
|
|||||||
document.body.classList.remove("body-locked");
|
document.body.classList.remove("body-locked");
|
||||||
pendingURL = null;
|
pendingURL = null;
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
@@ -1215,27 +1215,35 @@
|
|||||||
</html>
|
</html>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
function setCookie(name, value, days) {
|
document.addEventListener("DOMContentLoaded", () => {
|
||||||
const expires = new Date(Date.now() + days * 864e5).toUTCString();
|
|
||||||
document.cookie = `${name}=${value}; expires=${expires}; path=/`;
|
|
||||||
}
|
|
||||||
|
|
||||||
function getCookie(name) {
|
|
||||||
return document.cookie.split("; ").find(c => c.startsWith(name + "="))?.split("=")[1];
|
|
||||||
}
|
|
||||||
|
|
||||||
let pendingURL = null;
|
|
||||||
|
|
||||||
window.addEventListener("DOMContentLoaded", () => {
|
|
||||||
const popup = document.getElementById("license-popup");
|
const popup = document.getElementById("license-popup");
|
||||||
const agree = document.getElementById("agree");
|
const agree = document.getElementById("agree");
|
||||||
const closeBtn = document.getElementById("close-popup");
|
const closeBtn = document.getElementById("close-popup");
|
||||||
|
|
||||||
document.querySelectorAll(".btn, .btn.alt").forEach(el => {
|
function setCookie(name, value, days) {
|
||||||
|
const expires = new Date(Date.now() + days * 864e5).toUTCString();
|
||||||
|
document.cookie = `${name}=${value}; expires=${expires}; path=/; SameSite=Lax`;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getCookie(name) {
|
||||||
|
return document.cookie
|
||||||
|
.split("; ")
|
||||||
|
.find(c => c.startsWith(name + "="))
|
||||||
|
?.split("=")[1];
|
||||||
|
}
|
||||||
|
|
||||||
|
let pendingURL = null;
|
||||||
|
|
||||||
|
const buttons = document.querySelectorAll(".btn, .btn.alt");
|
||||||
|
|
||||||
|
buttons.forEach(el => {
|
||||||
el.addEventListener("click", e => {
|
el.addEventListener("click", e => {
|
||||||
if (el.classList.contains("btn-unavailable")) return;
|
if (el.classList.contains("btn-unavailable")) return;
|
||||||
|
|
||||||
if (getCookie("licenseAccepted")) return;
|
if (getCookie("licenseAccepted")) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
pendingURL = el.href;
|
pendingURL = el.href;
|
||||||
@@ -1246,20 +1254,18 @@ window.addEventListener("DOMContentLoaded", () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
agree.addEventListener("click", () => {
|
agree.addEventListener("click", () => {
|
||||||
setCookie("licenseAccepted", "true", 30);
|
setCookie("licenseAccepted", "true", 365);
|
||||||
|
|
||||||
popup.classList.add("hidden");
|
popup.classList.add("hidden");
|
||||||
document.body.classList.remove("body-locked");
|
document.body.classList.remove("body-locked");
|
||||||
|
|
||||||
if (pendingURL) {
|
if (pendingURL) {
|
||||||
// Auto-trigger download immediately
|
const a = document.createElement("a");
|
||||||
const directDownload = document.createElement("a");
|
a.href = pendingURL;
|
||||||
directDownload.href = pendingURL;
|
a.download = "";
|
||||||
directDownload.download = "";
|
document.body.appendChild(a);
|
||||||
document.body.appendChild(directDownload);
|
a.click();
|
||||||
directDownload.click();
|
a.remove();
|
||||||
directDownload.remove();
|
|
||||||
|
|
||||||
pendingURL = null;
|
pendingURL = null;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -1269,6 +1275,7 @@ window.addEventListener("DOMContentLoaded", () => {
|
|||||||
document.body.classList.remove("body-locked");
|
document.body.classList.remove("body-locked");
|
||||||
pendingURL = null;
|
pendingURL = null;
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
@@ -2886,27 +2886,35 @@
|
|||||||
</html>
|
</html>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
function setCookie(name, value, days) {
|
document.addEventListener("DOMContentLoaded", () => {
|
||||||
const expires = new Date(Date.now() + days * 864e5).toUTCString();
|
|
||||||
document.cookie = `${name}=${value}; expires=${expires}; path=/`;
|
|
||||||
}
|
|
||||||
|
|
||||||
function getCookie(name) {
|
|
||||||
return document.cookie.split("; ").find(c => c.startsWith(name + "="))?.split("=")[1];
|
|
||||||
}
|
|
||||||
|
|
||||||
let pendingURL = null;
|
|
||||||
|
|
||||||
window.addEventListener("DOMContentLoaded", () => {
|
|
||||||
const popup = document.getElementById("license-popup");
|
const popup = document.getElementById("license-popup");
|
||||||
const agree = document.getElementById("agree");
|
const agree = document.getElementById("agree");
|
||||||
const closeBtn = document.getElementById("close-popup");
|
const closeBtn = document.getElementById("close-popup");
|
||||||
|
|
||||||
document.querySelectorAll(".btn, .btn.alt").forEach(el => {
|
function setCookie(name, value, days) {
|
||||||
|
const expires = new Date(Date.now() + days * 864e5).toUTCString();
|
||||||
|
document.cookie = `${name}=${value}; expires=${expires}; path=/; SameSite=Lax`;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getCookie(name) {
|
||||||
|
return document.cookie
|
||||||
|
.split("; ")
|
||||||
|
.find(c => c.startsWith(name + "="))
|
||||||
|
?.split("=")[1];
|
||||||
|
}
|
||||||
|
|
||||||
|
let pendingURL = null;
|
||||||
|
|
||||||
|
const buttons = document.querySelectorAll(".btn, .btn.alt");
|
||||||
|
|
||||||
|
buttons.forEach(el => {
|
||||||
el.addEventListener("click", e => {
|
el.addEventListener("click", e => {
|
||||||
if (el.classList.contains("btn-unavailable")) return;
|
if (el.classList.contains("btn-unavailable")) return;
|
||||||
|
|
||||||
if (getCookie("licenseAccepted")) return;
|
if (getCookie("licenseAccepted")) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
pendingURL = el.href;
|
pendingURL = el.href;
|
||||||
@@ -2917,20 +2925,18 @@ window.addEventListener("DOMContentLoaded", () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
agree.addEventListener("click", () => {
|
agree.addEventListener("click", () => {
|
||||||
setCookie("licenseAccepted", "true", 30);
|
setCookie("licenseAccepted", "true", 365);
|
||||||
|
|
||||||
popup.classList.add("hidden");
|
popup.classList.add("hidden");
|
||||||
document.body.classList.remove("body-locked");
|
document.body.classList.remove("body-locked");
|
||||||
|
|
||||||
if (pendingURL) {
|
if (pendingURL) {
|
||||||
// Auto-trigger download immediately
|
const a = document.createElement("a");
|
||||||
const directDownload = document.createElement("a");
|
a.href = pendingURL;
|
||||||
directDownload.href = pendingURL;
|
a.download = "";
|
||||||
directDownload.download = "";
|
document.body.appendChild(a);
|
||||||
document.body.appendChild(directDownload);
|
a.click();
|
||||||
directDownload.click();
|
a.remove();
|
||||||
directDownload.remove();
|
|
||||||
|
|
||||||
pendingURL = null;
|
pendingURL = null;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -2940,6 +2946,7 @@ window.addEventListener("DOMContentLoaded", () => {
|
|||||||
document.body.classList.remove("body-locked");
|
document.body.classList.remove("body-locked");
|
||||||
pendingURL = null;
|
pendingURL = null;
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user