Skip to content

Commit

Permalink
4.2.0 (#103)
Browse files Browse the repository at this point in the history
* version

* easy lists, remove promote web

* attribute selector ends with

* directly apply inner html
  • Loading branch information
Thomas Wang authored Jun 5, 2022
1 parent 4321542 commit 7850287
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 4 deletions.
3 changes: 2 additions & 1 deletion extension/content/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@

/* Remove Promoted Posts */
/* Keep article combinator or it will remove all videos as well */
[data-testid="placementTracking"] article {
[data-testid="placementTracking"] article,
a[href*="quick_promote_web"] {
display: none !important;
}

Expand Down
28 changes: 28 additions & 0 deletions extension/content/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -173,13 +173,38 @@ const checkUrlForFollow = () => {
}
};

// Function to add Lists button
const addListsButton = () => {
if (!document.querySelector('a[href$="/lists"][role="link"][aria-label]')) {
const profileNode = document.querySelector(
'a[role="link"][data-testid="AppTabBar_Profile_Link"]'
);

if (profileNode) {
const profileNodeClone = profileNode.cloneNode(true);

profileNodeClone.id = "mt-listsButtonNode";
profileNodeClone.href += "/lists";
profileNodeClone.ariaLabel = "Minimal Twitter Lists";
profileNodeClone.removeAttribute("data-testid");
profileNodeClone.firstChild.firstChild.firstChild.innerHTML = `<g>
<path d="M19.75 22H4.25C3.01 22 2 20.99 2 19.75V4.25C2 3.01 3.01 2 4.25 2h15.5C20.99 2 22 3.01 22 4.25v15.5c0 1.24-1.01 2.25-2.25 2.25zM4.25 3.5c-.414 0-.75.337-.75.75v15.5c0 .413.336.75.75.75h15.5c.414 0 .75-.337.75-.75V4.25c0-.413-.336-.75-.75-.75H4.25z"></path>
<path d="M17 8.64H7c-.414 0-.75-.337-.75-.75s.336-.75.75-.75h10c.414 0 .75.335.75.75s-.336.75-.75.75zm0 4.11H7c-.414 0-.75-.336-.75-.75s.336-.75.75-.75h10c.414 0 .75.336.75.75s-.336.75-.75.75zm-5 4.11H7c-.414 0-.75-.335-.75-.75s.336-.75.75-.75h5c.414 0 .75.337.75.75s-.336.75-.75.75z"></path>
</g>`;
profileNodeClone.firstChild.lastChild.firstChild.innerText = "Lists";
profileNode.insertAdjacentElement("beforebegin", profileNodeClone);
}
}
};

// Function to start MutationObserver
const observe = () => {
const observer = new MutationObserver((mutationsList) => {
if (mutationsList.length) {
revealSearchFilters();
addTypefullyPlug();
checkUrlForFollow();
addListsButton();
}
});

Expand Down Expand Up @@ -366,6 +391,7 @@ const changeBookmarksButton = (bookmarksButton) => {
const changeListsButton = (listsButton) => {
switch (listsButton) {
case "off":
removeElement("mt-listsButtonNode");
addStyles(
"mt-listsButton",
`
Expand All @@ -378,6 +404,8 @@ const changeListsButton = (listsButton) => {

case "on":
removeElement("mt-listsButton");
addListsButton();

break;
}
};
Expand Down
2 changes: 1 addition & 1 deletion extension/manifest.firefox.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "Minimal Theme for Twitter",
"short_name": "Minimal Twitter",
"description": "Declutter the Twitter web experience.",
"version": "4.1.10",
"version": "4.2.0",
"manifest_version": 2,
"browser_specific_settings": {
"gecko": {
Expand Down
2 changes: 1 addition & 1 deletion extension/manifest.v2.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "Minimal Theme for Twitter",
"short_name": "Minimal Twitter",
"description": "Declutter the Twitter web experience.",
"version": "4.1.10",
"version": "4.2.0",
"manifest_version": 2,
"icons": {
"16": "images/MinimalTwitterIcon16.png",
Expand Down
2 changes: 1 addition & 1 deletion extension/manifest.v3.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "Minimal Theme for Twitter",
"short_name": "Minimal Twitter",
"description": "Declutter the Twitter web experience.",
"version": "4.1.10",
"version": "4.2.0",
"manifest_version": 3,
"icons": {
"16": "images/MinimalTwitterIcon16.png",
Expand Down

0 comments on commit 7850287

Please sign in to comment.