pretty much mothin

This commit is contained in:
BluePotato102
2023-09-21 20:14:46 -05:00
parent 0a293cf050
commit 87e94fc006
3 changed files with 114 additions and 32 deletions
+1
View File
@@ -219,6 +219,7 @@ logo img {
logo img:hover {
filter: brightness(80%);
transform: scale(0.95);
cursor: pointer;
}
img[alt="MonkeyGG2 Icon"] {
+20 -4
View File
@@ -254,14 +254,30 @@
<div class="setting">
<h5>Cloak URL</h5>
<p>This site will appear in your history everytime you open MonkeyGG2.</p>
<p>This site will appear in your history instead of MonkeyGG2.</p>
<input class="text-field" type="text" placeholder="https://classroom.google.com">
<button class="submit-button">Submit</button>
</div>
<div class="setting">
<h5>Mask URL</h5>
<p>This site's title and icon will replace MonkeyGG2's title and icon in your browser tab.</p>
<input class="text-field" type="text" placeholder="https://classroom.google.com">
<h5>Mask</h5>
<p>Toggles if mask is applied on loading of a page automatically</p>
<label class="switch">
<input type="checkbox" id="maskCheckbox" hidden>
<div class="switch__wrapper">
<div class="switch__toggle"></div>
</div>
</label>
</div>
<div class="setting">
<h5>Mask Title</h5>
<p>This site's title will replace MonkeyGG2's title in your browser tab.</p>
<input class="text-field" type="text" placeholder="Home">
<button class=submit-button>Submit</button>
</div>
<div class="setting">
<h5>Mask Icon URL</h5>
<p>This site's icon will replace MonkeyGG2's icon in your browser tab.</p>
<input class="text-field" type="text" placeholder="https://ssl.gstatic.com/classroom/ic_product_classroom_32.png">
<button class=submit-button>Submit</button>
</div>
<div class="setting">
+93 -28
View File
@@ -208,34 +208,6 @@ function updateList() {
$("#search").on("input", updateList);
$("#sort").on("change", updateList);
/**
* Generates a clone of the current window in an about:blank.
*
* @return {void}
*/
function makeclone() {
if ((window.top.location.href != "about:blank")) {
var url = window.location.href;
win = window.open();
if (!win || win.closed || typeof win.closed == 'undefined') {
alert('Please allow Pop-Ups - By disabling popups, you allow this website to show up in your history.');
} else {
win.document.body.style.margin = "0";
win.document.body.style.height = "100vh";
var iframe = win.document.createElement("iframe");
iframe.style.border = "none";
iframe.style.width = "100%";
iframe.style.height = "100%";
iframe.style.margin = "0";
iframe.referrerpolicy = "no-referrer";
iframe.allow = "fullscreen";
iframe.src = url.toString();
win.document.body.appendChild(iframe);
window.location.replace("https://classroom.google.com");
}
}
}
dragElement(document.getElementById("gameButton"));
dragElement(document.getElementById("refresh"));
@@ -318,4 +290,97 @@ function refreshPage() {
setTimeout(() => {
$("#page-loader iframe").attr("src", oldUrl);
}, 10);
}
/**
* Generates a clone of the current window in an about:blank.
*
* @return {void}
*/
function makeclone(url) {
if ((window.top.location.href !== "about:blank")) {
var url = window.location.href;
const win = window.open();
if (!win || win.closed || typeof win.closed == 'undefined') {
alert('Please allow Pop-Ups - By disabling popups, you allow this website to show up in your history.');
} else {
win.document.body.style.margin = "0";
win.document.body.style.height = "100vh";
var iframe = win.document.createElement("iframe");
iframe.style.border = "none";
iframe.style.width = "100%";
iframe.style.height = "100%";
iframe.style.margin = "0";
iframe.referrerpolicy = "no-referrer";
iframe.allow = "fullscreen";
iframe.src = url.toString();
win.document.body.appendChild(iframe);
window.location.replace(url);
}
}
}
/**
* Changes the browser tab's title and favicon
*
* @return {void}
*/
function mask(title, iconUrl) {
const e = window.top.document;
e.title = title;
var link = e.querySelector("link[rel*='icon']") || document.createElement('link');
link.type = 'image/x-icon';
link.rel = 'shortcut icon';
link.href = iconUrl;
e.getElementsByTagName('head')[0].appendChild(link);
}
function popupsAllowed(){
var windowName = 'userConsole';
var popUp = window.open('/popup-page.php', windowName, 'width=1000, height=700, left=24, top=24, scrollbars, resizable');
if (popUp == null || typeof(popUp)=='undefined') {
return false;
}
else {
popUp.close();
return true;
}
}
const prefrenceDefaults = {
cloak: true,
cloakUrl: "https://classroom.google.com",
mask: true,
maskTitle: "Home",
maskIconUrl: "https://ssl.gstatic.com/classroom/ic_product_classroom_32.png"
};
if (localStorage.getItem("prefrences") == null) {
localStorage.setItem("prefrences", JSON.stringify(prefrenceDefaults));
}
const prefrences = JSON.parse(localStorage.getItem("prefrences"));
const maskCheckbox = document.getElementById('maskCheckbox');
maskCheckbox.checked = prefrences.mask;
maskCheckbox.addEventListener('change', function () {
preferences.mask = maskCheckbox.checked;
localStorage.setItem('preferences', JSON.stringify(preferences));
});
/* if (prefrences.cloak && !localStorage.getItem("cloakTabOpened")){
if (window.top.location.href !== "about:blank"){
localStorage.setItem("cloakTabOpened", "true");
document.addEventListener("click", (event) => {event.preventDefault(); makeclone(prefrences.cloakUrl)});
}
makeclone(prefrences.cloakUrl);
window.addEventListener("beforeunload", () => {
localStorage.removeItem("cloakTabOpened");
});
} */
if (prefrences.mask){
mask(prefrences.maskTitle, prefrences.maskIconUrl)
}