-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add chrome extension code and screenshot
- Loading branch information
Thomas Wang
committed
Jul 18, 2019
1 parent
d52d171
commit ce87ab9
Showing
11 changed files
with
161 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
# Minimal Twitter | ||
|
||
Minimal Theme for the new Twitter UI! | ||
|
||
![screenshot](./screenshot.png) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
chrome.browserAction.onClicked.addListener(function(activeTab) { | ||
var newURL = "https://twitter.com/"; | ||
chrome.tabs.create({ url: newURL }); | ||
}); |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
} | ||
--- */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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); |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.