Merge branch 'main' of https://codeberg.org/MonkeyGG2/pages
This commit is contained in:
+98
@@ -448,6 +448,69 @@ keySlots.forEach((slot) => {
|
||||
});
|
||||
});
|
||||
|
||||
const defaultColorSettings = {
|
||||
'bg': '#202020',
|
||||
'block-color': '#2b2b2b',
|
||||
'button-color': '#373737',
|
||||
'games-color': '#373737a6',
|
||||
'hover-color': '#3c3c3c',
|
||||
'scrollbar-color': '#434343',
|
||||
'scroll-track-color': '#111',
|
||||
'font-color': '#dcddde'
|
||||
};
|
||||
|
||||
const colorSettings = JSON.parse(localStorage.getItem('colorSettings')) || defaultColorSettings;
|
||||
|
||||
|
||||
// Set input values
|
||||
Object.keys(colorSettings).forEach(key => {
|
||||
const inputElement = document.getElementById(key);
|
||||
if (inputElement) {
|
||||
inputElement.value = colorSettings[key];
|
||||
}
|
||||
});
|
||||
|
||||
// Set CSS variables
|
||||
Object.entries(colorSettings).forEach(([key, value]) => {
|
||||
document.documentElement.style.setProperty(`--${key}`, value);
|
||||
});
|
||||
|
||||
// Save changes button event listener
|
||||
function saveColorChanges() {
|
||||
const inputs = document.querySelectorAll('input[type="color"]');
|
||||
const newColorSettings = {};
|
||||
|
||||
inputs.forEach(input => {
|
||||
newColorSettings[input.id] = input.value;
|
||||
});
|
||||
|
||||
// Save to local storage
|
||||
localStorage.setItem('colorSettings', JSON.stringify(newColorSettings));
|
||||
alert("Colors saved! Changes will take place upon reload");
|
||||
}
|
||||
|
||||
// Restore defaults button event listener
|
||||
function restoreColorChanges() {
|
||||
// Reset to default values
|
||||
localStorage.removeItem('colorSettings');
|
||||
alert("Defaults Restored! Changes will take place upon reload");
|
||||
}
|
||||
|
||||
function randomGame() {
|
||||
const gameLinks = document.querySelectorAll('#gamesList li');
|
||||
const randomIndex = Math.floor(Math.random() * gameLinks.length);
|
||||
const randomGameLink = gameLinks[randomIndex];
|
||||
// window.location.href = randomGameLink.getAttribute('url');
|
||||
const url = randomGameLink.getAttribute('url');
|
||||
inGame = true;
|
||||
$("#everything-else").fadeOut();
|
||||
$("#page-loader").fadeIn();
|
||||
$("#page-loader iframe").attr("src", url);
|
||||
$("#page-loader iframe")[0].focus();
|
||||
currentMenu = $("#page-loader");
|
||||
}
|
||||
|
||||
|
||||
const preferencesDefaults = {
|
||||
cloak: true,
|
||||
cloakUrl: "https://classroom.google.com",
|
||||
@@ -472,6 +535,41 @@ maskCheckbox.checked = preferences.mask;
|
||||
maskTitle.value = preferences.maskTitle;
|
||||
maskIcon.value = preferences.maskIconUrl;
|
||||
|
||||
const presets = {
|
||||
classroom: {
|
||||
url: 'https://classroom.google.com/',
|
||||
title: 'Home',
|
||||
icon: 'https://ssl.gstatic.com/classroom/ic_product_classroom_32.png'
|
||||
},
|
||||
drive: {
|
||||
url: 'https://drive.google.com/',
|
||||
title: 'My Drive - Google Drive',
|
||||
icon: 'https://ssl.gstatic.com/images/branding/product/2x/hh_drive_36dp.png'
|
||||
},
|
||||
mail: {
|
||||
url: 'https://mail.google.com/',
|
||||
title: 'Inbox (12) - Google Mail',
|
||||
icon: 'https://www.gstatic.com/images/branding/product/2x/gmail_2020q4_512dp.png'
|
||||
},
|
||||
canvas: {
|
||||
url: 'https://www.instructure.com/',
|
||||
title: 'Dashboard',
|
||||
icon: 'https://du11hjcvx0uqb.cloudfront.net/dist/images/favicon-e10d657a73.ico'
|
||||
}
|
||||
};
|
||||
|
||||
function setPreset(object) {
|
||||
preferences.cloakUrl = object.url;
|
||||
preferences.maskTitle = object.title;
|
||||
preferences.maskIconUrl = object.icon;
|
||||
localStorage.setItem('preferences', JSON.stringify(preferences));
|
||||
alert("Preset will take place upon next opening!");
|
||||
}
|
||||
|
||||
function updatePreset() {
|
||||
setPreset(presets[document.getElementById("presets").value]);
|
||||
}
|
||||
|
||||
if (preferences.cloak && (window.location.href == window.top.location.href)) {
|
||||
if (popupsAllowed()) {
|
||||
makecloak();
|
||||
|
||||
Reference in New Issue
Block a user