run 3 now works properly
This commit is contained in:
+377
-345
@@ -199,181 +199,214 @@ const sequences = [
|
||||
{ keys: ['ArrowUp', 'ArrowUp', 'ArrowDown', 'ArrowDown', 'ArrowLeft', 'ArrowRight', 'ArrowLeft', 'ArrowRight', 'KeyB', 'KeyA', 'Enter'], action: () => alert('No easter egg here') },
|
||||
{ keys: ['KeyL', 'KeyE', 'KeyT', 'Space', 'KeyI', 'KeyT', 'Space', 'KeyS', 'KeyN', 'KeyO', 'KeyW'], action: snow },
|
||||
];
|
||||
|
||||
|
||||
let index = 0;
|
||||
|
||||
|
||||
document.addEventListener('keydown', (event) => {
|
||||
var failed = true;
|
||||
for (const sequence of sequences) {
|
||||
if (event.code === sequence.keys[index]) {
|
||||
failed = false;
|
||||
index++;
|
||||
|
||||
if (index === sequence.keys.length) {
|
||||
sequence.action();
|
||||
var failed = true;
|
||||
for (const sequence of sequences) {
|
||||
if (event.code === sequence.keys[index]) {
|
||||
failed = false;
|
||||
index++;
|
||||
|
||||
if (index === sequence.keys.length) {
|
||||
sequence.action();
|
||||
index = 0;
|
||||
}
|
||||
} else if (event.code === sequence.keys[0]) {
|
||||
failed = false;
|
||||
index = 1;
|
||||
}
|
||||
}
|
||||
if (failed) {
|
||||
index = 0;
|
||||
}
|
||||
}
|
||||
else if (event.code === sequence.keys[0]) {
|
||||
failed = false;
|
||||
index = 1;
|
||||
}
|
||||
}
|
||||
if (failed){
|
||||
index = 0;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
function snow() {
|
||||
function i() {
|
||||
this.D = function() {
|
||||
const t = h.atan(this.i / this.d);
|
||||
l.save(), l.translate(this.b, this.a), l.rotate(-t), l.scale(this.e, this.e * h.max(1, h.pow(this.j, .7) / 15)), l.drawImage(m, -v / 2, -v / 2), l.restore()
|
||||
}
|
||||
}
|
||||
window;
|
||||
const h = Math,
|
||||
r = h.random,
|
||||
a = document,
|
||||
o = Date.now;
|
||||
e = (t => {
|
||||
l.clearRect(0, 0, _, f), l.fill(), requestAnimationFrame(e);
|
||||
const i = .001 * y.et;
|
||||
y.r();
|
||||
const s = L.et * g;
|
||||
for (var n = 0; n < C.length; ++n) {
|
||||
const t = C[n];
|
||||
t.i = h.sin(s + t.g) * t.h, t.j = h.sqrt(t.i * t.i + t.f), t.a += t.d * i, t.b += t.i * i, t.a > w && (t.a = -u), t.b > b && (t.b = -u), t.b < -u && (t.b = b), t.D()
|
||||
}
|
||||
}), s = (t => {
|
||||
for (var e = 0; e < p; ++e) C[e].a = r() * (f + u), C[e].b = r() * _
|
||||
}), n = (t => {
|
||||
c.width = _ = innerWidth, c.height = f = innerHeight, w = f + u, b = _ + u, s()
|
||||
});
|
||||
class d {
|
||||
constructor(t, e = !0) {
|
||||
this._ts = o(), this._p = !0, this._pa = o(), this.d = t, e && this.s()
|
||||
}
|
||||
get et() {
|
||||
return this.ip ? this._pa - this._ts : o() - this._ts
|
||||
}
|
||||
get rt() {
|
||||
return h.max(0, this.d - this.et)
|
||||
}
|
||||
get ip() {
|
||||
return this._p
|
||||
}
|
||||
get ic() {
|
||||
return this.et >= this.d
|
||||
}
|
||||
s() {
|
||||
return this._ts = o() - this.et, this._p = !1, this
|
||||
}
|
||||
r() {
|
||||
return this._pa = this._ts = o(), this
|
||||
}
|
||||
p() {
|
||||
return this._p = !0, this._pa = o(), this
|
||||
}
|
||||
st() {
|
||||
return this._p = !0, this
|
||||
}
|
||||
}
|
||||
const c = a.createElement("canvas");
|
||||
H = c.style, H.position = "fixed", H.left = 0, H.top = 0, H.width = "100vw", H.height = "100vh", H.zIndex = "100000", H.pointerEvents = "none", a.body.insertBefore(c, a.body.children[0]);
|
||||
const l = c.getContext("2d"),
|
||||
p = 300,
|
||||
g = 5e-4,
|
||||
u = 20;
|
||||
let _ = c.width = innerWidth,
|
||||
f = c.height = innerHeight,
|
||||
w = f + u,
|
||||
b = _ + u;
|
||||
const v = 15.2,
|
||||
m = a.createElement("canvas"),
|
||||
E = m.getContext("2d"),
|
||||
x = E.createRadialGradient(7.6, 7.6, 0, 7.6, 7.6, 7.6);
|
||||
x.addColorStop(0, "hsla(255,255%,255%,1)"), x.addColorStop(1, "hsla(255,255%,255%,0)"), E.fillStyle = x, E.fillRect(0, 0, v, v);
|
||||
let y = new d(0, !0),
|
||||
C = [],
|
||||
L = new d(0, !0);
|
||||
for (var j = 0; j < p; ++j) {
|
||||
const t = new i;
|
||||
t.a = r() * (f + u), t.b = r() * _, t.c = 1 * (3 * r() + .8), t.d = .1 * h.pow(t.c, 2.5) * 50 * (2 * r() + 1), t.d = t.d < 65 ? 65 : t.d, t.e = t.c / 7.6, t.f = t.d * t.d, t.g = r() * h.PI / 1.3, t.h = 15 * t.c, t.i = 0, t.j = 0, C.push(t)
|
||||
}
|
||||
s(), EL = a.addEventListener, EL("visibilitychange", () => setTimeout(n, 100), !1), EL("resize", n, !1), e()
|
||||
function i() {
|
||||
this.D = function () {
|
||||
const t = h.atan(this.i / this.d);
|
||||
l.save(),
|
||||
l.translate(this.b, this.a),
|
||||
l.rotate(-t),
|
||||
l.scale(this.e, this.e * h.max(1, h.pow(this.j, 0.7) / 15)),
|
||||
l.drawImage(m, -v / 2, -v / 2),
|
||||
l.restore();
|
||||
};
|
||||
}
|
||||
window;
|
||||
const h = Math,
|
||||
r = h.random,
|
||||
a = document,
|
||||
o = Date.now;
|
||||
(e = (t) => {
|
||||
l.clearRect(0, 0, _, f), l.fill(), requestAnimationFrame(e);
|
||||
const i = 0.001 * y.et;
|
||||
y.r();
|
||||
const s = L.et * g;
|
||||
for (var n = 0; n < C.length; ++n) {
|
||||
const t = C[n];
|
||||
(t.i = h.sin(s + t.g) * t.h),
|
||||
(t.j = h.sqrt(t.i * t.i + t.f)),
|
||||
(t.a += t.d * i),
|
||||
(t.b += t.i * i),
|
||||
t.a > w && (t.a = -u),
|
||||
t.b > b && (t.b = -u),
|
||||
t.b < -u && (t.b = b),
|
||||
t.D();
|
||||
}
|
||||
}),
|
||||
(s = (t) => {
|
||||
for (var e = 0; e < p; ++e) (C[e].a = r() * (f + u)), (C[e].b = r() * _);
|
||||
}),
|
||||
(n = (t) => {
|
||||
(c.width = _ = innerWidth), (c.height = f = innerHeight), (w = f + u), (b = _ + u), s();
|
||||
});
|
||||
class d {
|
||||
constructor(t, e = !0) {
|
||||
(this._ts = o()), (this._p = !0), (this._pa = o()), (this.d = t), e && this.s();
|
||||
}
|
||||
get et() {
|
||||
return this.ip ? this._pa - this._ts : o() - this._ts;
|
||||
}
|
||||
get rt() {
|
||||
return h.max(0, this.d - this.et);
|
||||
}
|
||||
get ip() {
|
||||
return this._p;
|
||||
}
|
||||
get ic() {
|
||||
return this.et >= this.d;
|
||||
}
|
||||
s() {
|
||||
return (this._ts = o() - this.et), (this._p = !1), this;
|
||||
}
|
||||
r() {
|
||||
return (this._pa = this._ts = o()), this;
|
||||
}
|
||||
p() {
|
||||
return (this._p = !0), (this._pa = o()), this;
|
||||
}
|
||||
st() {
|
||||
return (this._p = !0), this;
|
||||
}
|
||||
}
|
||||
const c = a.createElement('canvas');
|
||||
(H = c.style),
|
||||
(H.position = 'fixed'),
|
||||
(H.left = 0),
|
||||
(H.top = 0),
|
||||
(H.width = '100vw'),
|
||||
(H.height = '100vh'),
|
||||
(H.zIndex = '100000'),
|
||||
(H.pointerEvents = 'none'),
|
||||
a.body.insertBefore(c, a.body.children[0]);
|
||||
const l = c.getContext('2d'),
|
||||
p = 300,
|
||||
g = 5e-4,
|
||||
u = 20;
|
||||
let _ = (c.width = innerWidth),
|
||||
f = (c.height = innerHeight),
|
||||
w = f + u,
|
||||
b = _ + u;
|
||||
const v = 15.2,
|
||||
m = a.createElement('canvas'),
|
||||
E = m.getContext('2d'),
|
||||
x = E.createRadialGradient(7.6, 7.6, 0, 7.6, 7.6, 7.6);
|
||||
x.addColorStop(0, 'hsla(255,255%,255%,1)'),
|
||||
x.addColorStop(1, 'hsla(255,255%,255%,0)'),
|
||||
(E.fillStyle = x),
|
||||
E.fillRect(0, 0, v, v);
|
||||
let y = new d(0, !0),
|
||||
C = [],
|
||||
L = new d(0, !0);
|
||||
for (var j = 0; j < p; ++j) {
|
||||
const t = new i();
|
||||
(t.a = r() * (f + u)),
|
||||
(t.b = r() * _),
|
||||
(t.c = 1 * (3 * r() + 0.8)),
|
||||
(t.d = 0.1 * h.pow(t.c, 2.5) * 50 * (2 * r() + 1)),
|
||||
(t.d = t.d < 65 ? 65 : t.d),
|
||||
(t.e = t.c / 7.6),
|
||||
(t.f = t.d * t.d),
|
||||
(t.g = (r() * h.PI) / 1.3),
|
||||
(t.h = 15 * t.c),
|
||||
(t.i = 0),
|
||||
(t.j = 0),
|
||||
C.push(t);
|
||||
}
|
||||
s(), (EL = a.addEventListener), EL('visibilitychange', () => setTimeout(n, 100), !1), EL('resize', n, !1), e();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds drag functionality to an HTML element.
|
||||
*
|
||||
* @param {HTMLElement} elmnt - The element to be dragged.
|
||||
* @return {void}
|
||||
*/
|
||||
function dragElement(elmnt) {
|
||||
var pos1 = 0,
|
||||
pos2 = 0,
|
||||
pos3 = 0,
|
||||
pos4 = 0;
|
||||
if (document.getElementById(elmnt.id)) {
|
||||
document.getElementById(elmnt.id).onmousedown = dragMouseDown;
|
||||
} else {
|
||||
elmnt.onmousedown = dragMouseDown;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds drag functionality to an HTML element.
|
||||
*
|
||||
* @param {HTMLElement} elmnt - The element to be dragged.
|
||||
* @return {void}
|
||||
*/
|
||||
function dragElement(elmnt) {
|
||||
var pos1 = 0,
|
||||
pos2 = 0,
|
||||
pos3 = 0,
|
||||
pos4 = 0;
|
||||
if (document.getElementById(elmnt.id)) {
|
||||
document.getElementById(elmnt.id).onmousedown = dragMouseDown;
|
||||
} else {
|
||||
elmnt.onmousedown = dragMouseDown;
|
||||
}
|
||||
function dragMouseDown(e) {
|
||||
e = e || window.event;
|
||||
e.preventDefault();
|
||||
pos3 = e.clientX;
|
||||
pos4 = e.clientY;
|
||||
document.onmouseup = closeDragElement;
|
||||
document.onmousemove = elementDrag;
|
||||
}
|
||||
|
||||
function dragMouseDown(e) {
|
||||
e = e || window.event;
|
||||
e.preventDefault();
|
||||
pos3 = e.clientX;
|
||||
pos4 = e.clientY;
|
||||
document.onmouseup = closeDragElement;
|
||||
document.onmousemove = elementDrag;
|
||||
}
|
||||
function elementDrag(e) {
|
||||
e = e || window.event;
|
||||
e.preventDefault();
|
||||
|
||||
function elementDrag(e) {
|
||||
e = e || window.event;
|
||||
e.preventDefault();
|
||||
pos1 = pos3 - e.clientX;
|
||||
pos2 = pos4 - e.clientY;
|
||||
pos3 = e.clientX;
|
||||
pos4 = e.clientY;
|
||||
window.click = 1;
|
||||
elmnt.style.top = elmnt.offsetTop - pos2 + 'px';
|
||||
}
|
||||
|
||||
pos1 = pos3 - e.clientX;
|
||||
pos2 = pos4 - e.clientY;
|
||||
pos3 = e.clientX;
|
||||
pos4 = e.clientY;
|
||||
window.click = 1;
|
||||
elmnt.style.top = elmnt.offsetTop - pos2 + 'px';
|
||||
}
|
||||
function closeDragElement() {
|
||||
document.onmouseup = null;
|
||||
document.onmousemove = null;
|
||||
|
||||
function closeDragElement() {
|
||||
document.onmouseup = null;
|
||||
document.onmousemove = null;
|
||||
if (window.click == 1) {
|
||||
window.hold = true;
|
||||
window.click = 0;
|
||||
}
|
||||
setTimeout(function () {
|
||||
window.hold = false;
|
||||
}, 100);
|
||||
}
|
||||
}
|
||||
|
||||
if (window.click == 1) {
|
||||
window.hold = true;
|
||||
window.click = 0;
|
||||
}
|
||||
setTimeout(function () {
|
||||
window.hold = false;
|
||||
}, 100);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Returns the user to the home page.
|
||||
*
|
||||
* @return {void}
|
||||
*/
|
||||
function returnHome() {
|
||||
currentMenu.fadeOut(300, () => {
|
||||
$('#everything-else').fadeIn(200);
|
||||
$('.games').hide();
|
||||
$('.homepage').fadeIn(200);
|
||||
});
|
||||
currentMenu = $('.homepage');
|
||||
inGame = !preferences.background; // if background is disabled (false) then inGame is set to to true turning off the background
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the user to the home page.
|
||||
*
|
||||
* @return {void}
|
||||
*/
|
||||
function returnHome() {
|
||||
currentMenu.fadeOut(300, () => {
|
||||
$('#everything-else').fadeIn(200);
|
||||
$('.games').hide();
|
||||
$('.homepage').fadeIn(200);
|
||||
});
|
||||
currentMenu = $('.homepage');
|
||||
inGame = !preferences.background; // if background is disabled (false) then inGame is set to to true turning off the background
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
function toggleStar(event, star) {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
@@ -383,192 +416,192 @@ function toggleStar(event, star) {
|
||||
*
|
||||
* @return {void}
|
||||
*/
|
||||
function refreshPage() {
|
||||
const oldUrl = $('#page-loader iframe').attr('src');
|
||||
console.log(oldUrl);
|
||||
$('#page-loader iframe').attr('src', '');
|
||||
function refreshPage() {
|
||||
const oldUrl = $('#page-loader iframe').attr('src');
|
||||
console.log(oldUrl);
|
||||
$('#page-loader iframe').attr('src', '');
|
||||
|
||||
// delay is needed for some reason
|
||||
setTimeout(() => {
|
||||
$('#page-loader iframe').attr('src', oldUrl);
|
||||
}, 10);
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates a clone of the current window in an about:blank.
|
||||
*
|
||||
* @return {void}
|
||||
*/
|
||||
function makecloak(replaceUrl = preferences.cloakUrl) {
|
||||
if (window.top.location.href !== 'about:blank') {
|
||||
var url = window.location.href;
|
||||
const win = window.open();
|
||||
if (!win || win.closed || typeof win.closed == 'undefined') {
|
||||
return;
|
||||
}
|
||||
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(replaceUrl);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Changes the browser tab's title and favicon
|
||||
*
|
||||
* @return {void}
|
||||
*/
|
||||
function mask(title = preferences.maskTitle, iconUrl = preferences.maskIconUrl) {
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
// Function to mute or unmute all sounds
|
||||
function toggleMute() {
|
||||
// cant find working code rn
|
||||
// delay is needed for some reason
|
||||
setTimeout(() => {
|
||||
$('#page-loader iframe').attr('src', oldUrl);
|
||||
}, 10);
|
||||
}
|
||||
|
||||
function getMainSave() {
|
||||
var mainSave = {};
|
||||
|
||||
localStorageSave = Object.entries(localStorage);
|
||||
|
||||
localStorageSave = btoa(JSON.stringify(localStorageSave));
|
||||
|
||||
mainSave.localStorage = localStorageSave;
|
||||
|
||||
cookiesSave = document.cookie;
|
||||
|
||||
cookiesSave = btoa(cookiesSave);
|
||||
|
||||
mainSave.cookies = cookiesSave;
|
||||
|
||||
mainSave = btoa(JSON.stringify(mainSave));
|
||||
|
||||
mainSave = CryptoJS.AES.encrypt(mainSave, 'save').toString();
|
||||
|
||||
return mainSave;
|
||||
}
|
||||
|
||||
function downloadMainSave() {
|
||||
var data = new Blob([getMainSave()]);
|
||||
var dataURL = URL.createObjectURL(data);
|
||||
|
||||
var fakeElement = document.createElement('a');
|
||||
fakeElement.href = dataURL;
|
||||
fakeElement.download = 'monkey.data';
|
||||
fakeElement.click();
|
||||
URL.revokeObjectURL(dataURL);
|
||||
}
|
||||
|
||||
function getMainSaveFromUpload(data) {
|
||||
data = CryptoJS.AES.decrypt(data, 'save').toString(CryptoJS.enc.Utf8);
|
||||
|
||||
var mainSave = JSON.parse(atob(data));
|
||||
var mainLocalStorageSave = JSON.parse(atob(mainSave.localStorage));
|
||||
var cookiesSave = atob(mainSave.cookies);
|
||||
|
||||
for (let item in mainLocalStorageSave) {
|
||||
localStorage.setItem(mainLocalStorageSave[item][0], mainLocalStorageSave[item][1]);
|
||||
}
|
||||
|
||||
document.cookie = cookiesSave;
|
||||
}
|
||||
|
||||
function uploadMainSave() {
|
||||
var hiddenUpload = document.createElement('input');
|
||||
hiddenUpload.type = 'file';
|
||||
hiddenUpload.accept = '.data';
|
||||
document.body.appendChild(hiddenUpload);
|
||||
hiddenUpload.click();
|
||||
|
||||
hiddenUpload.addEventListener('change', function (e) {
|
||||
var files = e.target.files;
|
||||
var file = files[0];
|
||||
|
||||
if (!file) {
|
||||
return;
|
||||
}
|
||||
|
||||
var reader = new FileReader();
|
||||
|
||||
reader.onload = function (e) {
|
||||
getMainSaveFromUpload(e.target.result);
|
||||
|
||||
var uploadResult = document.querySelector('.upload-result');
|
||||
uploadResult.innerText = 'Uploaded save!';
|
||||
setTimeout(function () {
|
||||
uploadResult.innerText = '';
|
||||
}, 3000);
|
||||
};
|
||||
|
||||
reader.readAsText(file);
|
||||
|
||||
document.body.removeChild(hiddenUpload);
|
||||
});
|
||||
}
|
||||
|
||||
const keyConfig = JSON.parse(localStorage.getItem('keyConfig')) || {};
|
||||
const keySlots = document.querySelectorAll('.keySlot');
|
||||
const actions = document.querySelectorAll('.slot-action');
|
||||
|
||||
for (var slot in keyConfig) {
|
||||
if (keyConfig.hasOwnProperty(slot)) {
|
||||
for (var key in keyConfig[slot]) {
|
||||
if (keyConfig[slot].hasOwnProperty(key)) {
|
||||
var correctKey = keyConfig[slot][key];
|
||||
var slotDiv = document.getElementById(slot);
|
||||
if (slotDiv) {
|
||||
if (key.includes("keySlot")) {
|
||||
key = key.replace(/-/g, " ");
|
||||
}
|
||||
var keyElement = slotDiv.getElementsByClassName(key)[0];
|
||||
if (keyElement) {
|
||||
if (key != "slot-action"){
|
||||
keyElement.textContent = correctKey;
|
||||
} else {
|
||||
for (var i = 0; i < keyElement.options.length; i++) {
|
||||
if (keyElement.options[i].value === correctKey) {
|
||||
keyElement.selectedIndex = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Generates a clone of the current window in an about:blank.
|
||||
*
|
||||
* @return {void}
|
||||
*/
|
||||
function makecloak(replaceUrl = preferences.cloakUrl) {
|
||||
if (window.top.location.href !== 'about:blank') {
|
||||
var url = window.location.href;
|
||||
const win = window.open();
|
||||
if (!win || win.closed || typeof win.closed == 'undefined') {
|
||||
return;
|
||||
}
|
||||
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(replaceUrl);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Changes the browser tab's title and favicon
|
||||
*
|
||||
* @return {void}
|
||||
*/
|
||||
function mask(title = preferences.maskTitle, iconUrl = preferences.maskIconUrl) {
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
// Function to mute or unmute all sounds
|
||||
function toggleMute() {
|
||||
// cant find working code rn
|
||||
}
|
||||
|
||||
function getMainSave() {
|
||||
var mainSave = {};
|
||||
|
||||
localStorageSave = Object.entries(localStorage);
|
||||
|
||||
localStorageSave = btoa(JSON.stringify(localStorageSave));
|
||||
|
||||
mainSave.localStorage = localStorageSave;
|
||||
|
||||
cookiesSave = document.cookie;
|
||||
|
||||
cookiesSave = btoa(cookiesSave);
|
||||
|
||||
mainSave.cookies = cookiesSave;
|
||||
|
||||
mainSave = btoa(JSON.stringify(mainSave));
|
||||
|
||||
mainSave = CryptoJS.AES.encrypt(mainSave, 'save').toString();
|
||||
|
||||
return mainSave;
|
||||
}
|
||||
|
||||
function downloadMainSave() {
|
||||
var data = new Blob([getMainSave()]);
|
||||
var dataURL = URL.createObjectURL(data);
|
||||
|
||||
var fakeElement = document.createElement('a');
|
||||
fakeElement.href = dataURL;
|
||||
fakeElement.download = 'monkey.data';
|
||||
fakeElement.click();
|
||||
URL.revokeObjectURL(dataURL);
|
||||
}
|
||||
|
||||
function getMainSaveFromUpload(data) {
|
||||
data = CryptoJS.AES.decrypt(data, 'save').toString(CryptoJS.enc.Utf8);
|
||||
|
||||
var mainSave = JSON.parse(atob(data));
|
||||
var mainLocalStorageSave = JSON.parse(atob(mainSave.localStorage));
|
||||
var cookiesSave = atob(mainSave.cookies);
|
||||
|
||||
for (let item in mainLocalStorageSave) {
|
||||
localStorage.setItem(mainLocalStorageSave[item][0], mainLocalStorageSave[item][1]);
|
||||
}
|
||||
|
||||
document.cookie = cookiesSave;
|
||||
}
|
||||
|
||||
function uploadMainSave() {
|
||||
var hiddenUpload = document.createElement('input');
|
||||
hiddenUpload.type = 'file';
|
||||
hiddenUpload.accept = '.data';
|
||||
document.body.appendChild(hiddenUpload);
|
||||
hiddenUpload.click();
|
||||
|
||||
hiddenUpload.addEventListener('change', function (e) {
|
||||
var files = e.target.files;
|
||||
var file = files[0];
|
||||
|
||||
if (!file) {
|
||||
return;
|
||||
}
|
||||
|
||||
var reader = new FileReader();
|
||||
|
||||
reader.onload = function (e) {
|
||||
getMainSaveFromUpload(e.target.result);
|
||||
|
||||
var uploadResult = document.querySelector('.upload-result');
|
||||
uploadResult.innerText = 'Uploaded save!';
|
||||
setTimeout(function () {
|
||||
uploadResult.innerText = '';
|
||||
}, 3000);
|
||||
};
|
||||
|
||||
reader.readAsText(file);
|
||||
|
||||
document.body.removeChild(hiddenUpload);
|
||||
});
|
||||
}
|
||||
|
||||
const keyConfig = JSON.parse(localStorage.getItem('keyConfig')) || {};
|
||||
const keySlots = document.querySelectorAll('.keySlot');
|
||||
const actions = document.querySelectorAll('.slot-action');
|
||||
|
||||
for (var slot in keyConfig) {
|
||||
if (keyConfig.hasOwnProperty(slot)) {
|
||||
for (var key in keyConfig[slot]) {
|
||||
if (keyConfig[slot].hasOwnProperty(key)) {
|
||||
var correctKey = keyConfig[slot][key];
|
||||
var slotDiv = document.getElementById(slot);
|
||||
if (slotDiv) {
|
||||
if (key.includes('keySlot')) {
|
||||
key = key.replace(/-/g, ' ');
|
||||
}
|
||||
var keyElement = slotDiv.getElementsByClassName(key)[0];
|
||||
if (keyElement) {
|
||||
if (key != 'slot-action') {
|
||||
keyElement.textContent = correctKey;
|
||||
} else {
|
||||
for (var i = 0; i < keyElement.options.length; i++) {
|
||||
if (keyElement.options[i].value === correctKey) {
|
||||
keyElement.selectedIndex = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
actions.forEach((action) => {
|
||||
action.addEventListener('change', () => {
|
||||
@@ -633,10 +666,9 @@ function onKeyPress(event) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
document.addEventListener('keydown', onKeyPress);
|
||||
document.addEventListener('keyup', onKeyRelease);
|
||||
|
||||
document.addEventListener('keydown', onKeyPress);
|
||||
document.addEventListener('keyup', onKeyRelease);
|
||||
|
||||
const defaultColorSettings = {
|
||||
bg: '#202020',
|
||||
|
||||
Reference in New Issue
Block a user