prettier pass on style.js

This commit is contained in:
NunoSempere 2023-09-15 12:41:31 +03:00
parent 58b522be65
commit f75442ac2b

View File

@ -18,11 +18,11 @@ if (document.domain == "forum.effectivealtruism.org"){
.intercom-lightweight-app{
display: none;
}
`
var styleSheet = document.createElement('style')
styleSheet.innerText = styles
document.head.appendChild(styleSheet)
console.log('Style changed')
`;
var styleSheet = document.createElement("style");
styleSheet.innerText = styles;
document.head.appendChild(styleSheet);
console.log("Style changed");
}
if (document.domain == "mail.proton.me") {
@ -39,14 +39,14 @@ if (document.domain == "mail.proton.me" ){
}
zoom: 0.625 !important;
*/
`
`;
}
if (document.domain == "forum.nunosempere.com") {
styles = `
body {
zoom: 0.625 !important;
}
`
`;
}
if (document.domain == "search.nunosempere.com") {
styles = `
@ -57,7 +57,7 @@ if (document.domain == "search.nunosempere.com" ){
footer {
display: none;
}
`
`;
}
if (document.domain == "twitter.com") {
styles = `
@ -78,7 +78,7 @@ if (document.domain == "twitter.com" ){
[data-testid^="sidebarColumn"] {
display: none;
}
`
`;
}
if (document.domain == "reddit.com" || document.domain == "old.reddit.com") {
@ -97,21 +97,20 @@ if (document.domain == "reddit.com" || document.domain == "old.reddit.com"){
{
display: none !important;
}
`
`;
}
if (styles != null) {
var styleSheet = document.createElement('style')
styleSheet.innerText = styles
document.head.appendChild(styleSheet)
console.log('Style changed')
var styleSheet = document.createElement("style");
styleSheet.innerText = styles;
document.head.appendChild(styleSheet);
console.log("Style changed");
}
// Replace default alert with new function
// whose style can be changed!
window.alert = (message) => {
let alertDiv = document.getElementById('customAlert');
let alertDiv = document.getElementById("customAlert");
if (!alertDiv) {
const html = `
<div id="customAlert" class="custom-alert">
@ -145,26 +144,29 @@ window.alert = (message) => {
}
</style>
`;
document.body.insertAdjacentHTML('beforeend', html);
alertDiv = document.getElementById('customAlert');
document.getElementById('alertOkButton').onclick = () => {
alertDiv.classList.remove('visible');
document.removeEventListener('keydown', dismissAlert);
document.body.insertAdjacentHTML("beforeend", html);
alertDiv = document.getElementById("customAlert");
document.getElementById("alertOkButton").onclick = () => {
alertDiv.classList.remove("visible");
document.removeEventListener("keydown", dismissAlert);
};
}
const dismissAlert = (event) => {
if (event.key === 'Enter' /*&& event.ctrlKey*/ && alertDiv.classList.contains('visible')) {
alertDiv.classList.remove('visible');
document.removeEventListener('keydown', dismissAlert);
}
if (
event.key === "Enter" /*&& event.ctrlKey*/ &&
alertDiv.classList.contains("visible")
) {
alertDiv.classList.remove("visible");
document.removeEventListener("keydown", dismissAlert);
}
};
document.addEventListener('keydown', dismissAlert);
document.getElementById('alertMessage').textContent = message;
alertDiv.classList.add('visible');
}
document.addEventListener("keydown", dismissAlert);
document.getElementById("alertMessage").textContent = message;
alertDiv.classList.add("visible");
};
// ^ takes 0.014ms to run, so performance is not the concern here.
// timed with console.time, console.timeEnd
document.body.style.visibility = "visible"
document.body.style.visibility = "visible";