Skip to content

Commit

Permalink
Merge branch 'release/1.0.3'
Browse files Browse the repository at this point in the history
  • Loading branch information
yusukesaitoh committed May 25, 2020
2 parents 2dabfb3 + 362fa06 commit 213662f
Show file tree
Hide file tree
Showing 12 changed files with 78 additions and 15 deletions.
3 changes: 3 additions & 0 deletions app/_locales/en/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@
"titleShowCalmText": {
"message": "Show \"Calm\" next to the logo"
},
"titleIsFollowingNumberHidden": {
"message": "Hide number of following"
},
"titleIsFollowerNumberHidden": {
"message": "Hide number of followers"
},
Expand Down
5 changes: 4 additions & 1 deletion app/_locales/ja/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"description": "The title of the browser action button"
},
"titleIsExploreHidden": {
"message": "話題を検索タブを隠す"
"message": "「話題を検索」タブを隠す"
},
"titleIsTrendsHidden": {
"message": "おすすめトレンド、ユーザーを隠す"
Expand All @@ -23,6 +23,9 @@
"titleShowCalmText": {
"message": "ロゴの隣に「おだやか」を表示する"
},
"titleIsFollowingNumberHidden": {
"message": "フォロー中数を隠す"
},
"titleIsFollowerNumberHidden": {
"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.2",
"version": "1.0.3",
"manifest_version": 2,
"default_locale": "en",
"icons": {
Expand Down
4 changes: 4 additions & 0 deletions app/pages/popup.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ <h1>__MSG_appName__</h1>
<span>__MSG_titleShowCalmText__</span>
</label>
<h2>__MSG_titleAdditionalSettings__</h2>
<label class="check">
<input type="checkbox" id="isFollowingNumberHidden">
<span>__MSG_titleIsFollowingNumberHidden__</span>
</label>
<label class="check">
<input type="checkbox" id="isFollowerNumberHidden">
<span>__MSG_titleIsFollowerNumberHidden__</span>
Expand Down
25 changes: 15 additions & 10 deletions app/scripts/contentscript.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
toggleClass(["isExploreHidden", "isTrendsHidden", "isReactionNumberHidden", "showCalmText", "isReactionNumberAlwaysHidden", "isFollowerNumberHidden",]);
toggleClass(["isExploreHidden", "isTrendsHidden", "isReactionNumberHidden", "showCalmText", "isFollowingNumberHidden", "isFollowerNumberHidden", "isReactionNumberAlwaysHidden"]);
addCalmTitle();
setTimeout(changeCalmColor, 50);
for (let i = 0; i < 2; i++) {
setTimeout(changeCalmColor, (i + 1)*100);
}

function toggleClass(keys: string[]) {
chrome.storage.local.get(keys, function (data) {
keys.forEach(key => {
if (key === "isFollowerNumberHidden" || key === "isReactionNumberAlwaysHidden") {
if (key === "isFollowingNumberHidden" || key === "isFollowerNumberHidden" || key === "isReactionNumberAlwaysHidden") {
if (typeof data[key] === "undefined") {
data[key] = false;
}
Expand Down Expand Up @@ -42,12 +44,15 @@ function addCalmTitle() {

function changeCalmColor() {
let body = document.body || document.getElementsByTagName('body')[0];
if (body.style.backgroundColor !== 'rgb(255, 255, 255)') {
let css = "body.showCalmText header[role=\"banner\"] h1[role=\"heading\"]::after { color: rgb(255, 255, 255);}";
let head = document.head || document.getElementsByTagName('head')[0];
let style = document.createElement('style');
head.appendChild(style);
style.type = 'text/css';
style.appendChild(document.createTextNode(css));
if (body.style.backgroundColor !== null) {
const logo = (<HTMLElement>document.querySelector('header[role="banner"] h1[role="heading"] > a svg'));
if (logo !== null) {
let css = "body.showCalmText header[role=\"banner\"] h1[role=\"heading\"]::after { color: " + window.getComputedStyle(logo).color + ";}";
let head = document.head || document.getElementsByTagName('head')[0];
let style = document.createElement('style');
head.appendChild(style);
style.type = 'text/css';
style.appendChild(document.createTextNode(css));
}
}
}
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", "isFollowerNumberHidden", "isReactionNumberAlwaysHidden", "showCalmText"]);
initValues(["isExploreHidden", "isTrendsHidden", "isReactionNumberHidden", "showCalmText", "isFollowingNumberHidden", "isFollowerNumberHidden", "isReactionNumberAlwaysHidden"]);

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 === "isFollowerNumberHidden" || key === "isReactionNumberAlwaysHidden") {
if (key === "isFollowingNumberHidden" || key === "isFollowerNumberHidden" || key === "isReactionNumberAlwaysHidden") {
if (typeof data[key] === "undefined") {
data[key] = false;
}
Expand Down
48 changes: 48 additions & 0 deletions app/styles/contentscript.scss
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,54 @@ body {
}
}

&.isFollowingNumberHidden {
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 {
display: none !important;
}
}

div[data-testid="primaryColumn"] > div > div > div > div > div {
&
> div.css-1dbjc4n.r-dr54s0
> div.css-1dbjc4n.r-18u37iz.r-1w6e6rj
> div:first-child
> a
> span.r-vw2c0b,
&
> div.css-1dbjc4n.r-1cad53l
> div.css-1dbjc4n.r-18u37iz.r-1w6e6rj
> div:first-child
> a
> span.r-vw2c0b,
&
> div.css-1dbjc4n.r-ku1wi2
> div.css-1dbjc4n.r-18u37iz.r-1w6e6rj
> div:first-child
> a
> span.r-vw2c0b,
&
> div.css-1dbjc4n.r-1ifxtd0
> div.css-1dbjc4n.r-18u37iz.r-1w6e6rj
> div:first-child
> a
> span.r-vw2c0b,
&
> div.css-1dbjc4n.r-le4sbl
> div.css-1dbjc4n.r-18u37iz.r-1w6e6rj
> div:first-child
> a
> span.r-vw2c0b {
display: none !important;
}
}
}

&.isFollowerNumberHidden {
div.r-u8s1d div.r-1upvrn0,
div.r-u8s1d div.r-xnswec,
Expand Down
Binary file modified design/Screenshot_03_en.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified design/Screenshot_03_ja.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added design/Share_SNS_2_ja.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified design/calm-twitter_design.sketch
Binary file not shown.
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.2",
"version": "1.0.3",
"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 213662f

Please sign in to comment.