Skip to content

Commit

Permalink
Ver. 0.5.2
Browse files Browse the repository at this point in the history
  • Loading branch information
tanjoin committed Sep 1, 2021
1 parent 25ef25b commit 46a436c
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 85 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ Twitterが優遇するクソメディアはどんどん非表示にする予定
4. 完了

## CHANGELOG
### Ver. 0.5.2
- バグ修正
- ログ非表示
- ミュート処理の頻度をもとに戻す
- それに関連する設定を削除
### Ver. 0.5.1
- バグ修正
### Ver. 0.5.0
Expand Down
50 changes: 0 additions & 50 deletions src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,11 +109,6 @@ const MUTE_LIST = [
"default_value": false,
"mute_word": ["誕生日"]
},
{
"id": "mute_level_hard",
"default_value": false,
"mute_word": []
},
{
"id": "sankeibiz",
"default_value": false,
Expand Down Expand Up @@ -239,11 +234,6 @@ const MUTE_LIST = [
"default_value": false,
"mute_word": []
},
{
"id": "move_hard_translate_y",
"default_value": false,
"mute_word": []
},
{
"id": "apply_new_mute_list",
"default_value": false,
Expand All @@ -263,31 +253,13 @@ const filterFunc = (e) => {
}
const observer = new MutationObserver((mutations) => {
muteCounter++;
if (muteCounter % 3 !== 0) {
return;
}
console.log(settings);
try {
[...document.querySelectorAll('div[aria-label="タイムライン: トレンド"] > div > div')]
.filter(filterFunc)
.forEach((e) => e.style.display = 'none');
[...document.querySelectorAll('div[aria-label="タイムライン: 話題を検索"] > div > div')]
.filter(filterFunc)
.forEach((e) => e.style.display = 'none');

if (settings.move_hard_translate_y) {
[...document.querySelectorAll('div[aria-label="タイムライン: トレンド"] > div > div')]
.filter(filterFunc)
.forEach((e) => e.style.display = undefined);
[...document.querySelectorAll('div[aria-label="タイムライン: 話題を検索"] > div > div')]
.filter(filterFunc)
.forEach((e) => e.style.display = undefined);
[...document.querySelectorAll('div[aria-label="タイムライン: トレンド"] > div > div')]
.filter(filterFunc)
.forEach((e) => e.style.display = 'none');
[...document.querySelectorAll('div[aria-label="タイムライン: 話題を検索"] > div > div')]
.filter(filterFunc)
.forEach((e) => e.style.display = 'none'); }
if (settings.auto_scroll_by_1) {
window.scrollBy(0, 1);
window.scrollBy(0, -1);
Expand All @@ -311,34 +283,14 @@ const observer = new MutationObserver((mutations) => {
console.error(e);
}
}
if (settings.mute_level_hard) {
setTimeout(() => {
try {
[...document.querySelectorAll('div[aria-label="タイムライン: トレンド"] > div > div')]
.filter(filterFunc)
.forEach((e) => e.style.display = 'none');
[...document.querySelectorAll('div[aria-label="タイムライン: 話題を検索"] > div > div')]
.filter(filterFunc)
.forEach((e) => e.style.display = 'none');
if (settings.auto_scroll_by_1) {
window.scrollBy(0, 1);
window.scrollBy(0, -1);
}
} catch (e) {
console.error(e);
}
}, 1000);
}
});
const config = { attributes: false, childList: true, characterData: false, subtree: true };
observer.observe(document.body, config);

chrome.storage.sync.get(Object.assign({
mute_list: ["BuzzFeed", "バズフィード", "ハフポスト"],
auto_scroll_by_1: false,
mute_level_hard: false,
mode_overseas: false,
move_hard_translate_y: false,
apply_new_mute_list: false
}, MUTE_LIST.reduce((a, c) => {
a[c.id] = c.default_value;
Expand All @@ -354,9 +306,7 @@ chrome.storage.sync.get(Object.assign({
settings.mute_list = mute_list;
// options
settings.auto_scroll_by_1 = data.auto_scroll_by_1;
settings.mute_level_hard = data.mute_level_hard;
settings.mode_overseas = data.mode_overseas;
settings.move_hard_translate_y = data.move_hard_translate_y;
settings.apply_new_mute_list = data.apply_new_mute_list;
} else {
settings = Object.assign(settings, data);
Expand Down
2 changes: 1 addition & 1 deletion src/manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"manifest_version": 2,
"name": "twitter-mute-buzzfuff",
"version": "0.5.1",
"version": "0.5.2",
"description": "鬱陶しいメディアを目に入らなくする",
"icons": {
"128": "img/128.png",
Expand Down
22 changes: 2 additions & 20 deletions src/options.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,14 @@ <h1 id="section1">非表示にしたいサイト</h1>
<h1 id="section2">トレンド</h1>
<h1 id="section3">キーワード(試用)</h1>
<h1 id="section4">設定</h1>
<h2>ミュート強度</h2>
<div class="form-check">
<input class="form-check-input" type="checkbox" name="mute_level_hard" id="mute_level_hard">
<label class="form-check-label" for="mute_level_hard" aria-describedby="mute_level_hard_help">
しっかりミュート
</label>
<div>
<small id="mute_level_hard_help" class="form-text text-muted">引用記事の場合はミュート漏れが発生するので、2重に処理してミュート漏れをふせぐ機能</small>
</div>
</div>
<h2>言語</h2>
<div class="form-check">
<input class="form-check-input" type="checkbox" name="mode_overseas" id="mode_overseas">
<label class="form-check-label" for="mode_overseas" aria-describedby="mode_overseas_help">
海外言語対応
</label>
<div>
<small id="mode_overseas_help" class="form-text text-muted">言語設定を海外にしている場合はこちらのチェックを有効にしてください</small>
<small id="mode_overseas_help" class="form-text text-muted">言語設定を海外にしている場合はこちらのチェックを有効にしてください(検索結果等にも影響があるため日本語の方は非推奨)</small>
</div>
</div>
<h2>描画補助</h2>
Expand All @@ -41,15 +32,6 @@ <h2>描画補助</h2>
<small id="auto_scroll_by_1_help" class="form-text text-muted">処理後にホワイトアウトするのを軽減するため、1ピクセルだけスクロールする処理(window.scrollBy(0, 1))を行います</small>
</div>
</div>
<div class="form-check">
<input class="form-check-input" type="checkbox" name="move_hard_translate_y" id="move_hard_translate_y">
<label class="form-check-label" for="move_hard_translate_y" aria-describedby="move_hard_translate_y_help">
無理やり空白を消す処理
</label>
<div>
<small id="move_hard_translate_y_help" class="form-text text-muted">非表示処理を2回適用するので画面がチラつく可能性があります</small>
</div>
</div>
<h2>フリーワード</h2>
<textarea id="freeword_area" style="width: 100%;"></textarea>
<div>
Expand Down
14 changes: 0 additions & 14 deletions src/options.js
Original file line number Diff line number Diff line change
Expand Up @@ -153,13 +153,6 @@ const MUTE_LIST = [
"section": 3,
"mute_word": ["誕生日"]
},
{
"id": "mute_level_hard",
"default_value": false,
"name": "",
"section": 4,
"mute_word": []
},
{
"id": "sankeibiz",
"default_value": false,
Expand Down Expand Up @@ -335,13 +328,6 @@ const MUTE_LIST = [
"section": 4,
"mute_word": []
},
{
"id": "move_hard_translate_y",
"default_value": false,
"name": "",
"section": 4,
"mute_word": []
},
{
"id": "apply_new_mute_list",
"default_value": false,
Expand Down

0 comments on commit 46a436c

Please sign in to comment.