Skip to content

Commit

Permalink
Merge branch 'release/1.1.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
yusukesaitoh committed Oct 29, 2020
2 parents 36cf38a + 7cced32 commit d558141
Show file tree
Hide file tree
Showing 8 changed files with 57 additions and 21 deletions.
6 changes: 6 additions & 0 deletions app/_locales/en/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,12 @@
"titleIsReactionNumberAlwaysHidden": {
"message": "Hide numbers of replies, retweets, and likes when mouse cursor is hovered"
},
"titleIsTopicsToFollowHidden": {
"message": "Hide Topics to follow"
},
"titleIsWhoToFollowHidden": {
"message": "Hide Who to follow"
},
"titleAdditionalSettings": {
"message": "Additional settings"
},
Expand Down
6 changes: 6 additions & 0 deletions app/_locales/ja/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,12 @@
"titleIsReactionNumberAlwaysHidden": {
"message": "カーソルをツイートにのせてもリプライ数、リツイート数、いいね数を隠す"
},
"titleIsTopicsToFollowHidden": {
"message": "おすすめトピックを隠す"
},
"titleIsWhoToFollowHidden": {
"message": "おすすめユーザーを隠す"
},
"titleAdditionalSettings": {
"message": "追加設定"
},
Expand Down
2 changes: 1 addition & 1 deletion app/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "__MSG_appName__",
"short_name": "__MSG_appShortName__",
"description": "__MSG_appDescription__",
"version": "1.0.4",
"version": "1.1.0",
"manifest_version": 2,
"default_locale": "en",
"icons": {
Expand Down
8 changes: 8 additions & 0 deletions app/pages/popup.html
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,14 @@ <h2>__MSG_titleAdditionalSettings__</h2>
<input type="checkbox" id="isReactionNumberAlwaysHidden">
<span>__MSG_titleIsReactionNumberAlwaysHidden__</span>
</label>
<label class="check">
<input type="checkbox" id="isWhoToFollowHidden">
<span>__MSG_titleIsWhoToFollowHidden__</span>
</label>
<label class="check">
<input type="checkbox" id="isTopicsToFollowHidden">
<span>__MSG_titleIsTopicsToFollowHidden__</span>
</label>
<script src="../scripts/popup.js"></script>
</body>
</html>
5 changes: 3 additions & 2 deletions app/scripts/contentscript.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
toggleClass(["isExploreHidden", "isTrendsHidden", "isReactionNumberHidden", "showCalmText", "isFollowingNumberHidden", "isFollowerNumberHidden", "isReactionNumberAlwaysHidden"]);
toggleClass(["isExploreHidden", "isTrendsHidden", "isReactionNumberHidden", "showCalmText", "isFollowingNumberHidden", "isFollowerNumberHidden", "isReactionNumberAlwaysHidden", "isWhoToFollowHidden", "isTopicsToFollowHidden"]);
addCalmTitle();
for (let i = 0; i < 2; i++) {
setTimeout(changeCalmColor, (i + 1)*100);
Expand All @@ -7,7 +7,7 @@ for (let i = 0; i < 2; i++) {
function toggleClass(keys: string[]) {
chrome.storage.local.get(keys, function (data) {
keys.forEach(key => {
if (key === "isFollowingNumberHidden" || key === "isFollowerNumberHidden" || key === "isReactionNumberAlwaysHidden") {
if (key === "isFollowingNumberHidden" || key === "isFollowerNumberHidden" || key === "isReactionNumberAlwaysHidden" || key === "isWhoToFollowHidden" || key === "isTopicsToFollowHidden") {
if (typeof data[key] === "undefined") {
data[key] = false;
}
Expand All @@ -28,6 +28,7 @@ function toggleClass(keys: string[]) {

chrome.runtime.onMessage.addListener(function (request, sender, sendResponse) {
toggleClass([request.key]);
sendResponse();
});

chrome.runtime.sendMessage({ from: 'content', subject: 'showPageAction' });
Expand Down
4 changes: 2 additions & 2 deletions app/scripts/popup.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
localize();
initValues(["isExploreHidden", "isTrendsHidden", "isReactionNumberHidden", "showCalmText", "isFollowingNumberHidden", "isFollowerNumberHidden", "isReactionNumberAlwaysHidden"]);
initValues(["isExploreHidden", "isTrendsHidden", "isReactionNumberHidden", "showCalmText", "isFollowingNumberHidden", "isFollowerNumberHidden", "isReactionNumberAlwaysHidden", "isWhoToFollowHidden", "isTopicsToFollowHidden"]);

function localize() {
var objects = document.getElementsByTagName('html');
Expand Down Expand Up @@ -37,7 +37,7 @@ function toggleChecked(keys: string[]) {
chrome.storage.local.get(keys, function (data) {
keys.forEach(key => {
console.log(key + ": " + data[key]);
if (key === "isFollowingNumberHidden" || key === "isFollowerNumberHidden" || key === "isReactionNumberAlwaysHidden") {
if (key === "isFollowingNumberHidden" || key === "isFollowerNumberHidden" || key === "isReactionNumberAlwaysHidden" || key === "isWhoToFollowHidden" || key === "isTopicsToFollowHidden") {
if (typeof data[key] === "undefined") {
data[key] = false;
}
Expand Down
45 changes: 30 additions & 15 deletions app/styles/contentscript.scss
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,7 @@ body {
div.r-u8s1d div.r-1upvrn0,
div.r-u8s1d div.r-xnswec,
div.r-u8s1d div.r-qo02w8 {
div.css-1dbjc4n.r-18u37iz.r-1w6e6rj
> div:first-child
> a
> span.r-vw2c0b {
div.css-1dbjc4n.r-18u37iz.r-1w6e6rj>div:first-child>a>span:first-child {
display: none !important;
}
}
Expand All @@ -90,31 +87,31 @@ body {
> div.css-1dbjc4n.r-18u37iz.r-1w6e6rj
> div:first-child
> a
> span.r-vw2c0b,
> span:first-child,
&
> div.css-1dbjc4n.r-1cad53l
> div.css-1dbjc4n.r-18u37iz.r-1w6e6rj
> div:first-child
> a
> span.r-vw2c0b,
> span:first-child,
&
> div.css-1dbjc4n.r-ku1wi2
> div.css-1dbjc4n.r-18u37iz.r-1w6e6rj
> div:first-child
> a
> span.r-vw2c0b,
> span:first-child,
&
> div.css-1dbjc4n.r-1ifxtd0
> div.css-1dbjc4n.r-18u37iz.r-1w6e6rj
> div:first-child
> a
> span.r-vw2c0b,
> span:first-child,
&
> div.css-1dbjc4n.r-le4sbl
> div.css-1dbjc4n.r-18u37iz.r-1w6e6rj
> div:first-child
> a
> span.r-vw2c0b {
> span:first-child {
display: none !important;
}
}
Expand All @@ -124,7 +121,7 @@ body {
div.r-u8s1d div.r-1upvrn0,
div.r-u8s1d div.r-xnswec,
div.r-u8s1d div.r-qo02w8 {
div.css-1dbjc4n.r-18u37iz.r-1w6e6rj > div:last-child > a > span.r-vw2c0b {
div.css-1dbjc4n.r-18u37iz.r-1w6e6rj > div:last-child > a > span:first-child {
display: none !important;
}
}
Expand All @@ -135,33 +132,51 @@ body {
> div.css-1dbjc4n.r-18u37iz.r-1w6e6rj
> div:last-child
> a
> span.r-vw2c0b,
> span:first-child,
&
> div.css-1dbjc4n.r-1cad53l
> div.css-1dbjc4n.r-18u37iz.r-1w6e6rj
> div:last-child
> a
> span.r-vw2c0b,
> span:first-child,
&
> div.css-1dbjc4n.r-ku1wi2
> div.css-1dbjc4n.r-18u37iz.r-1w6e6rj
> div:last-child
> a
> span.r-vw2c0b,
> span:first-child,
&
> div.css-1dbjc4n.r-1ifxtd0
> div.css-1dbjc4n.r-18u37iz.r-1w6e6rj
> div:last-child
> a
> span.r-vw2c0b,
> span:first-child,
&
> div.css-1dbjc4n.r-le4sbl
> div.css-1dbjc4n.r-18u37iz.r-1w6e6rj
> div:last-child
> a
> span.r-vw2c0b {
> span:first-child {
display: none !important;
}
}
}

&.isWhoToFollowHidden {
div[data-testid=primaryColumn] div.css-1dbjc4n[data-testid=UserCell] {
display: none;
}
div[data-testid=primaryColumn] a[href*="/i/connect_people?user_id="] {
display: none;
}
}

&.isTopicsToFollowHidden {
div[data-testid=primaryColumn] a[aria-labelledby*=" topic-name"] {
display: none;
}
div[data-testid=primaryColumn] a[href*="/i/flow/topics_selector"] {
display: none;
}
}
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "calm-twitter",
"private": true,
"version": "1.0.4",
"version": "1.1.0",
"description": "This extension hides trending information from twitter timelines to make your mind calm.",
"scripts": {
"start": "npm run dev:chrome",
Expand Down

0 comments on commit d558141

Please sign in to comment.