// CONSTANT VARIABLES
const lmbReset = document.getElementById('lmbReset');
const rmbReset = document.getElementById('rmbReset');
const mmbReset = document.getElementById('mmbReset')
const themeToggle = document.getElementById('themeToggle');
const help = document.getElementById('help');
const container = document.getElementById('container');
const seperator = document.getElementById('seperator');
// CHANGING VARIABLES FOR COUNTERS AND LIGHT/DARK MODE
let leftCount = 0;
let rightCount = 0;
let middleCount = 0;
let isLightMode = false;
// DISABLES ADDING VALUES TO THE COUNTERS WHEN PRESSING BUTTONS
document.addEventListener('click', function (event) {
if (event.button === 0 && event.target.tagName !== 'BUTTON') {
leftCount++;
document.getElementById('leftClickCount').innerText = leftCount;
}
});
document.addEventListener('contextmenu', function (event) {
event.preventDefault();
if (event.target.tagName !== 'BUTTON') {
rightCount++;
document.getElementById('rightClickCount').innerText = rightCount;
}
});
document.addEventListener('mousedown', function (event) {
if (event.button === 1 && event.target.tagName !== 'BUTTON') {
middleCount++;
document.getElementById('middleClickCount').innerText = middleCount;
}
});
help.addEventListener('click', function () {
alert('SHIFT+RMB only works on Gecko browsers (Firefox, Librewolf, Waterfox, etc) and NOT on Chromium browsers (Chrome, Edge, Brave, Vivaldi). Please understand, that this is not my issue, but the browser\'s.')
})
// RESETS COUNTERS
lmbReset.addEventListener('click', function () {
leftCount = 0;
document.getElementById('leftClickCount').innerText = leftCount;
});
rmbReset.addEventListener('click', function () {
rightCount = 0;
document.getElementById('rightClickCount').innerText = rightCount;
});
mmbReset.addEventListener('click', function () {
middleCount = 0;
document.getElementById('middleClickCount').innerText = middleCount;
});
// LIGHT/DARK MODE LOGIC (this is extremely bad but whatever.. "If it ain't broke, don't fix it." - Wise Man)
themeToggle.addEventListener('click', function() {
if (!isLightMode) {
/*
LIGHT MODE
LIGHT MODE
LIGHT MODE
*/
document.body.style.backgroundColor = '#C8C8C8';
container.style.backgroundColor = "#B0B0B0";
themeToggle.innerHTML = ``;
container.style.color = "#1E1E1E"
seperator.style.backgroundColor = "#1E1E1E";
isLightMode = true;
document.getElementById('github').innerHTML = ` `;
document.getElementById('web').innerHTML = ``;
document.getElementById('help').innerHTML = ``;
let children = container.children;
for (let i = 0; i < children.length; i++) {
children[i].style.color = "#1E1E1E";
}
rmbReset.style.backgroundColor = "#1E1E1E";
lmbReset.style.backgroundColor = "#1E1E1E";
mmbReset.style.backgroundColor = "#1E1E1E";
rmbReset.style.color = "#b0b0b0";
lmbReset.style.color = "#b0b0b0";
mmbReset.style.color = "#b0b0b0";
} else {
/*
DARK MODE
DARK MODE
DARK MODE
*/
let children = container.children;
for (let i = 0; i < children.length; i++) {
children[i].style.color = "#f0f0f0";
}
document.body.style.backgroundColor = '#2a2a2a';
themeToggle.innerHTML = ``;
isLightMode = false;
container.style.backgroundColor = "#4b4b4b";
seperator.style.backgroundColor = "#747474";
document.getElementById('github').innerHTML = ` `;
document.getElementById('web').innerHTML = ``;
document.getElementById('help').innerHTML = ``;
rmbReset.style.backgroundColor = "#b0b0b0";
lmbReset.style.backgroundColor = "#b0b0b0";
mmbReset.style.backgroundColor = "#b0b0b0";
rmbReset.style.color = "#2a2a2a";
lmbReset.style.color = "#2a2a2a";
mmbReset.style.color = "#2a2a2a";
}
});