frontend/js/main.js
2023-09-16 22:12:34 -04:00

59 lines
1.9 KiB
JavaScript

var interval;
function check() {
if ($("#panicmode").length > 0) {
$("#panicmode").prop({ href: panicurl });
}
if ($(".seleniteminified").length > 0) {
$.get(
"https://raw.githubusercontent.com/skysthelimitt/selenite-optimized/main/build/bookmark.txt",
function (data) {
$(".seleniteminified").prop({ href: data });
}
);
}
}
window.onload = function () {
if (localStorage.getItem("theme")) {
document.body.setAttribute("theme", localStorage.getItem("theme"))
} else {
document.body.setAttribute("theme", "main")
}
loadCloaks();
checkAlert();
check();
};
function checkAlert() {
if (!Cookies.get("betaalert")) {
alert(
"PLEASE READ.\nYour data from the main page will NOT transfer unless you use the Download and Upload Save feature.\nWanna add a quote? Go to the feedback form.\nThank you for beta testing the new ui! Send feedback at the feedback link in the header. Don't use the suggestions form. DM '@skysthelimit.dev' on discord if you need to say something immediately. Also DM me on discord if you beta tested, might give something a little special to y'all.\nThank you for supporting Selenite. Any and all feedback is greatly appreciated."
);
Cookies.set("betaalert", true, { expires: 1 });
}
}
function setPanicMode() {
if (!$("#panic").val().startsWith("https")) {
document.cookie = "panicurl=https://" + $("#panic").val();
return;
}
document.cookie = "panicurl=" + $("#panic").val();
}
function copyToClipboard(text) {
navigator.clipboard.writeText(text);
alert("Copied text!");
}
function setTheme(theme) {
localStorage.setItem('theme', theme);
document.body.setAttribute("theme", theme);
}
function setPanicMode() {
if (!$("#panic").val().startsWith("https")) {
document.cookie = "panicurl=https://" + $("#panic").val();
return;
}
document.cookie = "panicurl=" + $("#panic").val();
}