diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 00000000..5008ddfc Binary files /dev/null and b/.DS_Store differ diff --git a/README.md b/README.md index c66199a9..d1bd8157 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,5 @@ # Minimal Twitter Minimal Theme for the new Twitter UI! + +![screenshot](./screenshot.png) diff --git a/chrome/background.js b/chrome/background.js new file mode 100644 index 00000000..c0dc3248 --- /dev/null +++ b/chrome/background.js @@ -0,0 +1,4 @@ +chrome.browserAction.onClicked.addListener(function(activeTab) { + var newURL = "https://twitter.com/"; + chrome.tabs.create({ url: newURL }); +}); diff --git a/chrome/images/MinimalTwitterIcon128.png b/chrome/images/MinimalTwitterIcon128.png new file mode 100644 index 00000000..6c784492 Binary files /dev/null and b/chrome/images/MinimalTwitterIcon128.png differ diff --git a/chrome/images/MinimalTwitterIcon16.png b/chrome/images/MinimalTwitterIcon16.png new file mode 100644 index 00000000..c21f6a17 Binary files /dev/null and b/chrome/images/MinimalTwitterIcon16.png differ diff --git a/chrome/images/MinimalTwitterIcon32.png b/chrome/images/MinimalTwitterIcon32.png new file mode 100644 index 00000000..ccd867dd Binary files /dev/null and b/chrome/images/MinimalTwitterIcon32.png differ diff --git a/chrome/images/MinimalTwitterIcon48.png b/chrome/images/MinimalTwitterIcon48.png new file mode 100644 index 00000000..9a057303 Binary files /dev/null and b/chrome/images/MinimalTwitterIcon48.png differ diff --git a/chrome/manifest.json b/chrome/manifest.json new file mode 100644 index 00000000..54fb0a61 --- /dev/null +++ b/chrome/manifest.json @@ -0,0 +1,44 @@ +{ + "name": "Minimal Twitter", + "short_name": "MinTwitter", + "description": "A minimal twitter theme for the new Twitter!", + "version": "1.0", + "manifest_version": 2, + "permissions": ["activeTab"], + "content_scripts": [ + { + "css": ["minimal-twitter.css"], + "matches": ["https://twitter.com/*"] + }, + { + "js": ["removePromoted.js"], + "matches": ["https://twitter.com/home"] + } + ], + "background": { + "scripts": ["background.js"] + }, + "browser_action": { + "default_icon": { + "16": "images/MinimalTwitterIcon16.png", + "32": "images/MinimalTwitterIcon32.png", + "48": "images/MinimalTwitterIcon48.png", + "128": "images/MinimalTwitterIcon128.png" + } + }, + "icons": { + "16": "images/MinimalTwitterIcon16.png", + "32": "images/MinimalTwitterIcon32.png", + "48": "images/MinimalTwitterIcon48.png", + "128": "images/MinimalTwitterIcon128.png" + }, + "commands": { + "_execute_browser_action": { + "suggested_key": { + "default": "Ctrl+Shift+T", + "mac": "MacCtrl+Shift+T" + }, + "description": "Opens Minimal Twitter" + } + } +} diff --git a/chrome/minimal-twitter.css b/chrome/minimal-twitter.css new file mode 100644 index 00000000..27f0208b --- /dev/null +++ b/chrome/minimal-twitter.css @@ -0,0 +1,61 @@ +header[role="banner"] { + align-items: start !important; + max-width: 100px !important; +} + +main[role="main"] { + align-items: center !important; +} + +@media all and (min-width: 1265px) { + main[role="main"] { + transform: translateX(-56px) !important; + } +} + +div[title="Home"], +div[title="Explore"], +div[title="Notifications"], +div[title="Messages"], +div[title="Bookmarks"], +div[title="Lists"], +div[title="Profile"], +div[title="More"] { + display: none !important; +} + +a[aria-label="Tweet"][role="button"] { + position: fixed; + right: 24px; + bottom: 24px; + max-width: 125px; +} + +header[role="banner"] > div > div > div { + justify-content: center !important; +} + +div[data-testid="sidebarColumn"] { + display: none !important; +} + +/* --- Use this to make columns bigger on home page + +div[data-testid="primaryColumn"] { + max-width: 750px !important; +} + +div[data-testid="primaryColumn"] > div > div > div:nth-child(3) { + max-width: 750px !important; +} + +div[data-testid="primaryColumn"] + > div + > div + > div:nth-child(2) + > div + > div:nth-child(2) { + max-width: 750px !important; +} + +--- */ diff --git a/chrome/removePromoted.js b/chrome/removePromoted.js new file mode 100644 index 00000000..eacfa781 --- /dev/null +++ b/chrome/removePromoted.js @@ -0,0 +1,50 @@ +// Removing promoted tweets +function scrollStop(callback) { + // Make sure a valid callback was provided + if (!callback || typeof callback !== "function") return; + + // Setup scrolling variable + var isScrolling; + + // Listen for scroll events + window.addEventListener( + "scroll", + function(event) { + // Clear our timeout throughout the scroll + window.clearTimeout(isScrolling); + + // Set a timeout to run after scrolling ends + isScrolling = setTimeout(function() { + // Run the callback + callback(); + }, 66); + }, + false + ); +} + +function removeAds() { + var spanTags = document.getElementsByTagName("span"); + var promotedText = "Promoted"; + var found; + + for (var i = 0; i < spanTags.length; i++) { + if (spanTags[i].textContent == promotedText) { + found = spanTags[i]; + found.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.removeChild( + found.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode + .parentNode.parentNode + ); + } + } + + return; +} + +scrollStop(function() { + removeAds(); +}); + +setTimeout(() => { + removeAds(); +}, 2000); diff --git a/screenshot.png b/screenshot.png new file mode 100644 index 00000000..85d98afc Binary files /dev/null and b/screenshot.png differ