Skip to content

Commit

Permalink
rm dev, fix timeline tabs
Browse files Browse the repository at this point in the history
  • Loading branch information
Thomas Wang committed Feb 8, 2023
1 parent a74e3a5 commit 95e1a78
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 11 deletions.
2 changes: 1 addition & 1 deletion bundle-extension.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ let manifest = {
name: "Minimal Theme for Twitter",
short_name: "Minimal Twitter",
description: "Refine and declutter the Twitter web experience.",
version: "5.1.0",
version: "5.1.1",
icons: {
16: "images/MinimalTwitterIcon16.png",
32: "images/MinimalTwitterIcon32.png",
Expand Down
Binary file modified bundle/chrome.zip
Binary file not shown.
Binary file modified bundle/firefox.zip
Binary file not shown.
8 changes: 3 additions & 5 deletions content-scripts/src/modules/initialize.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
import {
changeFollowingTimeline,
changeRecentMedia,
changeTimelineTabs,
changeTrendsHomeTimeline,
} from "./options/timeline";
import { addGrowButton } from "./options/typefully";
Expand All @@ -19,7 +20,6 @@ import {
addTypefullyReplyPlug,
saveCurrentReplyToLink,
} from "./typefully";
import { isDevelopment } from "./utilities/chrome";
import { colorsAreSet, extractColorsAsRootVars } from "./utilities/colors";
import removeElement from "./utilities/removeElement";
import { getStorage } from "./utilities/storage";
Expand Down Expand Up @@ -82,10 +82,6 @@ export const addStylesheets = async () => {
);

externalStylesheet.appendChild(styleSheetText);

const isDev = isDevelopment();

if (isDev) removeElement("mt-external-stylesheet");
};

// Function to start MutationObserver
Expand All @@ -109,12 +105,14 @@ export const observe = () => {
"typefullyGrowTab",
"followingTimeline",
"trendsHomeTimeline",
"removeTimelineTabs",
"writerMode",
]);

if (data?.writerMode === "on") {
changeWriterMode(data?.writerMode);
} else {
changeTimelineTabs(data?.removeTimelineTabs, data?.writerMode);
changeTrendsHomeTimeline(data?.trendsHomeTimeline, data?.writerMode);
changeFollowingTimeline(data?.followingTimeline);
addTypefullyPlug();
Expand Down
2 changes: 1 addition & 1 deletion content-scripts/src/modules/options/all.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ export const injectAllChanges = (data) => {
changePromotedPosts(data?.removePromotedPosts); // Remove Promoted Posts
changeWhoToFollow(data?.removeWhoToFollow); // Who to Follow
changeTopicsToFollow(data?.removeTopicsToFollow); // Topics to Follow
changeTimelineTabs(data?.removeTimelineTabs); // For you / Following tabs
changeTimelineTabs(data?.removeTimelineTabs, data?.writerMode); // For you / Following tabs
changeGrowButton(data?.typefullyGrowTab); // Typefully Grow Button
changeFollowingTimeline(data?.followingTimeline); // Always Show Following Timeline
changeLatestTweets(data?.latestTweets); // Always Show Latest Tweets
Expand Down
14 changes: 13 additions & 1 deletion content-scripts/src/modules/options/timeline.js
Original file line number Diff line number Diff line change
Expand Up @@ -212,13 +212,25 @@ export const changeTopicsToFollow = (removeTopicsToFollow) => {
}
};

export const changeTimelineTabs = (removeTimelineTabs) => {
export const changeTimelineTabs = (removeTimelineTabs, writerMode) => {
if (
writerMode === "on" ||
window.location.pathname.includes("compose/tweet") ||
!window.location.pathname.includes("/home") ||
!window.location.pathname === "/"
) {
removeElement("mt-removeTimelineTabs");
return;
}

switch (removeTimelineTabs) {
case "off":
removeElement("mt-removeTimelineTabs");
break;

case "on":
if (document.getElementById("mt-removeTimelineTabs")) return;

addStyles(
"mt-removeTimelineTabs",
`
Expand Down
3 changes: 0 additions & 3 deletions content-scripts/src/modules/utilities/chrome.js

This file was deleted.

0 comments on commit 95e1a78

Please sign in to comment.