Skip to content

Commit

Permalink
Fixes and bump version
Browse files Browse the repository at this point in the history
  • Loading branch information
linuz90 committed Oct 24, 2023
1 parent 6725ca5 commit 448b09d
Showing 9 changed files with 37 additions and 33 deletions.
2 changes: 1 addition & 1 deletion bundle-extension.js
Original file line number Diff line number Diff line change
@@ -20,7 +20,7 @@ let manifest = {
name: "Minimal Theme for Twitter / X",
short_name: "Minimal Twitter",
description: "Refine and declutter the 𝕏/Twitter web experience.",
version: "6.0.0",
version: "6.0.1",
icons: {
16: "images/MinimalTwitterIcon16.png",
32: "images/MinimalTwitterIcon32.png",
Binary file modified bundle/chrome.zip
Binary file not shown.
Binary file modified bundle/firefox.zip
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -512,7 +512,7 @@
"@executable_path/../../../../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 10.14;
MARKETING_VERSION = 6.0.0;
MARKETING_VERSION = 6.0.1;
OTHER_LDFLAGS = (
"-framework",
SafariServices,
@@ -545,7 +545,7 @@
"@executable_path/../../../../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 10.14;
MARKETING_VERSION = 6.0.0;
MARKETING_VERSION = 6.0.1;
OTHER_LDFLAGS = (
"-framework",
SafariServices,
@@ -582,7 +582,7 @@
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 10.14;
MARKETING_VERSION = 6.0.0;
MARKETING_VERSION = 6.0.1;
OTHER_LDFLAGS = (
"-framework",
SafariServices,
@@ -620,7 +620,7 @@
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 10.14;
MARKETING_VERSION = 6.0.0;
MARKETING_VERSION = 6.0.1;
OTHER_LDFLAGS = (
"-framework",
SafariServices,
4 changes: 2 additions & 2 deletions content-scripts/src/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { KeyExtensionStatus, allSettingsKeys } from "../../storage-keys";
import { addMutationsOnDomChanges, addMutationsOnNavigation, addMutationsOnResize, addStylesheets } from "./modules/initialize";
import { addMutationsOnDomChanges, addMutationsOnPageLoad, addMutationsOnResize, addStylesheets } from "./modules/initialize";
import { injectAllChanges } from "./modules/options/all";
import constructNewData from "./modules/utilities/constructNewData";
import { getStorage } from "./modules/utilities/storage";
@@ -33,7 +33,7 @@ const init = async () => {

addStylesheets();
addMutationsOnDomChanges();
addMutationsOnNavigation();
addMutationsOnPageLoad();
addMutationsOnResize();

// Inject user preferences
22 changes: 10 additions & 12 deletions content-scripts/src/modules/initialize.js
Original file line number Diff line number Diff line change
@@ -10,7 +10,7 @@ import {
KeyXPremiumButton,
} from "../../../storage-keys";
import { checkUrlForFollow } from "./check";
import hideViewCount from "./options/hideViewCount";
import changeHideViewCounts from "./options/hideViewCount";
import { addAnalyticsButton, addCommunitiesButton, addListsButton, addTopicsButton, addXPremiumButton } from "./options/navigation";
import { changeFollowingTimeline, changeRecentMedia, changeTimelineTabs, changeTrendsHomeTimeline } from "./options/timeline";
import { addWriterModeButton, changeWriterMode } from "./options/writer-mode";
@@ -53,7 +53,7 @@ export const addStylesheets = async () => {
externalStylesheet.appendChild(styleSheetText);
};

const runDocumentMutations = throttle(async () => {
export const runDocumentMutations = throttle(async () => {
extractColorsAsRootVars();

const data = await getStorage([KeyWriterMode, KeyFollowingTimeline, KeyTrendsHomeTimeline, KeyRemoveTimelineTabs]);
@@ -72,7 +72,7 @@ const runDocumentMutations = throttle(async () => {
saveCurrentReplyToLink();
addTypefullyReplyPlug();
checkUrlForFollow();
hideViewCount();
changeHideViewCounts();
changeRecentMedia();
hideRightSidebar();
addSmallerSearchBarStyle();
@@ -81,7 +81,7 @@ const runDocumentMutations = throttle(async () => {
if (scheduleButton) addWriterModeButton(scheduleButton);

return;
}, 250);
}, 50);

// Function to start MutationObserver
export const addMutationsOnDomChanges = () => {
@@ -97,14 +97,12 @@ export const addMutationsOnDomChanges = () => {
});
};

function runPageLoadMutations() {
addSidebarButtons(false);
runDocumentMutations();
}

export const addMutationsOnNavigation = () => {
window.onload = runPageLoadMutations;
window.addEventListener("popstate", runPageLoadMutations);
export const addMutationsOnPageLoad = () => {
// Inject on page load
document.addEventListener("DOMContentLoaded", () => {
addSidebarButtons(false);
runDocumentMutations();
});
};

// On resize, remove and re-add the sidebar buttons, because their original
3 changes: 1 addition & 2 deletions content-scripts/src/modules/utilities/addStyles.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
import { removeElementById } from "./removeElement";

// Utility function to inject CSS into page
export default function addStyles(id, css) {
removeElementById("mt-style-" + id);

const head = document.querySelector("head");
const style = document.createElement("style");
style.id = "mt-style-" + id;
style.textContent = `${css}`;
style.textContent = css.trim().split("\n").join("");
head.appendChild(style);
}

26 changes: 14 additions & 12 deletions content-scripts/src/modules/utilities/hideRightSidebar.js
Original file line number Diff line number Diff line change
@@ -1,26 +1,28 @@
import selectors from "../../selectors";
import addStyles, { removeStyles, stylesExist } from "./addStyles";

export default async function hideRightSidebar() {
const sidebar = document.querySelector(selectors.rightSidebar);

const isSearchPage = window.location.pathname === "/search";

if (!sidebar) return;

if (sidebar.style.visibility === "hidden") return;

if (isSearchPage) {
sidebar.style.marginLeft = "12px";
removeStyles("hide-sidebar");
removeOtherSections();
setTimeout(() => {
removeOtherSections();
}, 500); // Sometimes the trends appear with a delay
} else {
sidebar.style.visibility = "hidden";
sidebar.style.width = "0";
sidebar.style.margin = "0";
sidebar.style.padding = "0";
sidebar.style.zIndex = "1";
if (stylesExist("hide-sidebar")) return;

addStyles(
"hide-sidebar",
`${selectors.rightSidebar} {
visibility: hidden;
width: 0;
margin: 0;
padding: 0;
z-index: 1;
}`
);
}
}

5 changes: 5 additions & 0 deletions css/main.css
Original file line number Diff line number Diff line change
@@ -106,6 +106,11 @@ a[href*="quick_promote_web"] {
}
}

/* Add some margin to the right sidebar, since it shows in the search page — see hideRightSidebar.js */
[data-testid="sidebarColumn"] {
margin-left: 12px;
}

/* Reveal searchbar and search filters at desktop breakpoint */
@media only screen and (min-width: 1100px) {
/* Reveal searchbar */

0 comments on commit 448b09d

Please sign in to comment.