2023-02-05 02:21:30 +00:00
|
|
|
// Replicates the Stylus app: <https://addons.mozilla.org/en-GB/firefox/addon/styl-us/>
|
|
|
|
|
2023-02-15 02:24:47 +00:00
|
|
|
var styles = null;
|
|
|
|
|
2023-09-15 09:41:31 +00:00
|
|
|
if (document.domain == "forum.effectivealtruism.org") {
|
|
|
|
styles = `
|
2023-02-05 02:21:30 +00:00
|
|
|
.Layout-main {
|
|
|
|
margin-left: 100px;
|
|
|
|
}
|
|
|
|
.SingleColumnSection-root {
|
|
|
|
width: 1000px !important;
|
|
|
|
max-width: 1400px !important;
|
|
|
|
padding-left: 100px !important;
|
|
|
|
}
|
|
|
|
.NavigationStandalone-sidebar {
|
|
|
|
display: none;
|
|
|
|
}
|
|
|
|
.intercom-lightweight-app{
|
|
|
|
display: none;
|
|
|
|
}
|
2023-09-15 09:41:31 +00:00
|
|
|
`;
|
|
|
|
var styleSheet = document.createElement("style");
|
|
|
|
styleSheet.innerText = styles;
|
|
|
|
document.head.appendChild(styleSheet);
|
|
|
|
console.log("Style changed");
|
2023-02-05 02:21:30 +00:00
|
|
|
}
|
|
|
|
|
2023-09-15 09:41:31 +00:00
|
|
|
if (document.domain == "mail.proton.me") {
|
|
|
|
styles = `
|
2023-06-20 14:30:36 +00:00
|
|
|
/*
|
2023-02-11 13:40:15 +00:00
|
|
|
.item-container-row.read, .item-container.read {
|
|
|
|
background-color: white;
|
|
|
|
}
|
|
|
|
.item-container-row.unread, .item-container.unread {
|
|
|
|
background-color: #E8E8E8;
|
|
|
|
}
|
|
|
|
.selection .item-container-row.item-is-selected, .item-container.item-is-selected {
|
|
|
|
background-color: var(--selection-background-color) !important;
|
|
|
|
}
|
2023-06-20 14:30:36 +00:00
|
|
|
zoom: 0.625 !important;
|
|
|
|
*/
|
2023-09-15 09:41:31 +00:00
|
|
|
`;
|
2023-02-15 02:24:47 +00:00
|
|
|
}
|
2023-09-15 09:41:31 +00:00
|
|
|
if (document.domain == "forum.nunosempere.com") {
|
2023-04-21 23:08:55 +00:00
|
|
|
styles = `
|
|
|
|
body {
|
|
|
|
zoom: 0.625 !important;
|
|
|
|
}
|
2023-09-15 09:41:31 +00:00
|
|
|
`;
|
2023-04-21 23:08:55 +00:00
|
|
|
}
|
2023-09-15 09:41:31 +00:00
|
|
|
if (document.domain == "search.nunosempere.com") {
|
2023-04-29 22:33:09 +00:00
|
|
|
styles = `
|
2023-06-26 10:26:53 +00:00
|
|
|
body {
|
|
|
|
/* zoom: 1.8; */
|
|
|
|
}
|
|
|
|
|
2023-04-29 22:33:09 +00:00
|
|
|
footer {
|
|
|
|
display: none;
|
|
|
|
}
|
2023-09-15 09:41:31 +00:00
|
|
|
`;
|
2023-04-29 22:33:09 +00:00
|
|
|
}
|
2023-09-15 09:41:31 +00:00
|
|
|
if (document.domain == "twitter.com") {
|
2023-05-06 00:08:53 +00:00
|
|
|
styles = `
|
2023-08-03 12:40:40 +00:00
|
|
|
/* hide promoted tweets */
|
|
|
|
:has(meta[property="og:site_name"][content="Twitter"])
|
|
|
|
[data-testid="cellInnerDiv"]:has(svg + [dir="auto"]) {
|
|
|
|
display: none;
|
|
|
|
}
|
2023-07-27 15:36:04 +00:00
|
|
|
[data-testid^="placementTracking"] {
|
2023-05-06 00:08:53 +00:00
|
|
|
display: none;
|
|
|
|
}
|
2023-08-03 12:40:40 +00:00
|
|
|
|
|
|
|
/* hide what's happening section */
|
|
|
|
:has(meta[property="og:site_name"][content="Twitter"])
|
|
|
|
[aria-label="Timeline: Trending now"] {
|
|
|
|
display: none !important;
|
|
|
|
}
|
2023-07-27 15:36:04 +00:00
|
|
|
[data-testid^="sidebarColumn"] {
|
2023-05-06 00:08:53 +00:00
|
|
|
display: none;
|
|
|
|
}
|
2023-11-20 00:50:27 +00:00
|
|
|
|
|
|
|
/* Hide DMs v2 */
|
2023-11-20 00:29:44 +00:00
|
|
|
[data-testid^="DMDrawerHeader"] {
|
|
|
|
display: none;
|
|
|
|
}
|
2023-11-20 00:50:27 +00:00
|
|
|
|
|
|
|
/* Tweak main column */
|
2023-11-20 00:29:44 +00:00
|
|
|
[data-testid^="primaryColumn"] {
|
|
|
|
min-width: 900px;
|
|
|
|
max-width: 900px;
|
2023-11-20 00:50:27 +00:00
|
|
|
}
|
2023-11-20 10:54:40 +00:00
|
|
|
[data-testid^="cellInnerDiv"] {
|
|
|
|
min-width: 700px;
|
|
|
|
max-width: 700px;
|
|
|
|
}
|
|
|
|
[aria-label^="Timeline: Conversation"]{
|
|
|
|
margin-left: 145px;
|
|
|
|
}
|
2023-11-22 20:41:21 +00:00
|
|
|
[data-testid^="DMDrawer"]{
|
|
|
|
display: none;
|
|
|
|
}
|
2023-11-20 00:50:27 +00:00
|
|
|
|
|
|
|
/* Delete a few unused or annoying elements */
|
|
|
|
[aria-label^="Verified Orgs"] {
|
|
|
|
display: none;
|
|
|
|
}
|
|
|
|
[aria-label^="Lists"] {
|
|
|
|
display: none;
|
|
|
|
}
|
|
|
|
[aria-label^="Communities"] {
|
|
|
|
display: none;
|
|
|
|
}
|
|
|
|
[aria-label^="Primary"] {
|
|
|
|
margin-top: 50px;
|
|
|
|
}
|
|
|
|
[role^="progressbar"]{
|
|
|
|
display: none;
|
|
|
|
}
|
2023-11-20 00:29:44 +00:00
|
|
|
|
2023-11-08 23:00:31 +00:00
|
|
|
/* hide video */
|
|
|
|
[data-testid^="videoPlayer"] {
|
2023-11-08 23:18:10 +00:00
|
|
|
display: none !important;
|
2023-11-08 23:00:31 +00:00
|
|
|
}
|
2023-11-28 16:30:56 +00:00
|
|
|
|
|
|
|
/* No change of colors in hover */
|
|
|
|
*:hover {
|
|
|
|
background-color: inherit !important;
|
|
|
|
transition: none !important;
|
|
|
|
}
|
2023-12-29 17:37:50 +00:00
|
|
|
/* Hide go to top button */
|
|
|
|
[aria-label^="New posts are available. Push the period key to go to the them."]{
|
|
|
|
display: none;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* No transparency at the top */
|
|
|
|
[aria-live^="polite"]{
|
|
|
|
background: white !important;
|
|
|
|
}
|
2023-11-28 16:30:56 +00:00
|
|
|
|
2023-09-15 09:41:31 +00:00
|
|
|
`;
|
2023-11-08 23:18:10 +00:00
|
|
|
|
2023-11-08 23:18:55 +00:00
|
|
|
// Function to hide the grandparent of video players
|
|
|
|
function hideVideoPlayerGrandparent() {
|
|
|
|
document
|
|
|
|
.querySelectorAll('[data-testid="videoPlayer"]')
|
|
|
|
.forEach(function (videoPlayer) {
|
2023-11-08 23:24:06 +00:00
|
|
|
var grandparentElement = videoPlayer.parentElement.parentElement.parentElement.parentElement.parentElement.parentElement;
|
2023-11-09 10:13:11 +00:00
|
|
|
var newTextElement = document.createElement('div');
|
2023-11-20 01:03:01 +00:00
|
|
|
newTextElement.textContent = ' [ twitter video ] ';
|
2023-11-20 10:54:40 +00:00
|
|
|
newTextElement.style["margin-top"] = "10px";
|
|
|
|
newTextElement.style["margin-left"] = "10px";
|
|
|
|
newTextElement.style["margin-bottom"] = "10px";
|
2023-11-09 10:13:11 +00:00
|
|
|
grandparentElement.replaceWith(newTextElement);
|
2023-11-08 23:18:55 +00:00
|
|
|
});
|
|
|
|
}
|
2023-11-08 23:18:10 +00:00
|
|
|
|
2023-11-08 23:18:55 +00:00
|
|
|
// Create a new MutationObserver instance
|
|
|
|
var observer = new MutationObserver(function (mutations) {
|
|
|
|
mutations.forEach(function (mutation) {
|
|
|
|
if (mutation.addedNodes.length) {
|
|
|
|
hideVideoPlayerGrandparent(); // Call the function to hide video players
|
|
|
|
}
|
2023-11-08 23:18:10 +00:00
|
|
|
});
|
|
|
|
});
|
2023-11-08 23:18:55 +00:00
|
|
|
|
|
|
|
// Options for the observer (which mutations to observe)
|
|
|
|
var config = { childList: true, subtree: true };
|
|
|
|
|
|
|
|
// Start observing the target node for configured mutations
|
|
|
|
observer.observe(document.body, config);
|
|
|
|
|
|
|
|
// Call the function initially to hide any video players on initial load
|
|
|
|
hideVideoPlayerGrandparent();
|
2023-05-06 00:08:53 +00:00
|
|
|
}
|
|
|
|
|
2023-09-15 09:41:31 +00:00
|
|
|
if (document.domain == "reddit.com" || document.domain == "old.reddit.com") {
|
|
|
|
styles = `
|
2023-07-27 12:34:16 +00:00
|
|
|
/* kill sidebar ads */
|
|
|
|
.native-ad-container,
|
|
|
|
.premium-banner-outer,
|
|
|
|
.native-sidebar-ad,
|
|
|
|
.infobar-toaster-container,
|
|
|
|
#eu-cookie-policy,
|
|
|
|
.ad-container,
|
2023-08-03 12:40:40 +00:00
|
|
|
.listingsignupbar,
|
2023-07-27 12:34:16 +00:00
|
|
|
a[href="/premium"],
|
|
|
|
[data-promoted^="true"],
|
|
|
|
a[href^="https://alb.reddit.com"]
|
|
|
|
{
|
|
|
|
display: none !important;
|
|
|
|
}
|
2023-09-15 09:41:31 +00:00
|
|
|
`;
|
2023-07-27 12:34:16 +00:00
|
|
|
}
|
|
|
|
|
2023-09-15 09:41:31 +00:00
|
|
|
if (styles != null) {
|
|
|
|
var styleSheet = document.createElement("style");
|
|
|
|
styleSheet.innerText = styles;
|
|
|
|
document.head.appendChild(styleSheet);
|
|
|
|
console.log("Style changed");
|
2023-02-11 13:40:15 +00:00
|
|
|
}
|
|
|
|
|
2023-06-17 06:19:29 +00:00
|
|
|
// Replace default alert with new function
|
|
|
|
// whose style can be changed!
|
2023-06-17 06:29:27 +00:00
|
|
|
window.alert = (message) => {
|
2023-09-15 09:41:31 +00:00
|
|
|
let alertDiv = document.getElementById("customAlert");
|
|
|
|
if (!alertDiv) {
|
|
|
|
const html = `
|
2023-06-17 06:29:27 +00:00
|
|
|
<div id="customAlert" class="custom-alert">
|
|
|
|
<div class="custom-alert-content">
|
|
|
|
<p id="alertMessage"></p>
|
|
|
|
<button id="alertOkButton">OK</button>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<style>
|
|
|
|
.custom-alert {
|
|
|
|
display: none;
|
|
|
|
position: fixed;
|
|
|
|
z-index: 999;
|
|
|
|
left: 0;
|
|
|
|
top: 0;
|
|
|
|
width: 100%;
|
|
|
|
height: 100%;
|
|
|
|
overflow: auto;
|
|
|
|
background-color: rgba(0,0,0,0.4);
|
|
|
|
}
|
|
|
|
.custom-alert-content {
|
|
|
|
background-color: #fefefe;
|
|
|
|
margin: 15% auto;
|
|
|
|
padding: 20px;
|
|
|
|
border: 1px solid #888;
|
|
|
|
width: 80%;
|
|
|
|
font-family: monospace; /* Use monospace font */
|
|
|
|
}
|
|
|
|
.visible {
|
|
|
|
display: block;
|
|
|
|
}
|
|
|
|
</style>
|
|
|
|
`;
|
2023-09-15 09:41:31 +00:00
|
|
|
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);
|
2023-06-17 06:19:29 +00:00
|
|
|
}
|
2023-09-15 09:41:31 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
document.addEventListener("keydown", dismissAlert);
|
|
|
|
document.getElementById("alertMessage").textContent = message;
|
|
|
|
alertDiv.classList.add("visible");
|
|
|
|
};
|
2023-06-17 06:40:05 +00:00
|
|
|
// ^ takes 0.014ms to run, so performance is not the concern here.
|
|
|
|
// timed with console.time, console.timeEnd
|
2023-06-17 06:29:27 +00:00
|
|
|
|
2023-09-15 09:41:31 +00:00
|
|
|
document.body.style.visibility = "visible";
|