Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
akoya-tomo committed May 14, 2018
2 parents 59f0e2a + b467362 commit d359636
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 14 deletions.
15 changes: 10 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,15 @@
NGワードの登録画面で判定範囲(「本文」「メール欄など」)をNGワード単位で選択できます。
- NGワードの判定に大文字・小文字を区別しない設定を追加
NGワードの登録画面で「大文字・小文字を区別しない」をNGワード単位で選択できます。
- \(New\) ツールバーボタンからNGワードを登録する機能を追加
- ツールバーボタンからNGワードを登録する機能を追加
ツールバーボタンのポップアップからNGワードを直接登録することができます。
またポップアップの右上の[設定]ボタンから設定画面を開くことができます。
- \(New\) 設定の変更やNGワードの登録が直ぐにスレに反映されるように変更
またポップアップの右上の[設定]ボタンから設定画面を開くことができます。
\(New\) NGにしたい文字列を選択してからツールバーボタンを押すとNGワード入力欄に反映されます。
- 設定の変更やNGワードの登録が直ぐにスレに反映されるように変更
スレを更新しなくても設定の変更やNGワードの登録が直ぐに反映されます。

## インストール
[GitHub](https://github.com/akoya-tomo/koshian_ng_kai/releases/download/v1.1.0/koshian_ng_kai-1.1.0-an.fx.xpi)
[GitHub](https://github.com/akoya-tomo/koshian_ng_kai/releases/download/v1.2.1/koshian_ng_kai-1.2.1-an.fx.xpi)

※「接続エラーのため、アドオンをダウンロードできませんでした。」と表示されてインストール出来ないときはリンクを右クリックしてxpiファイルをダウンロードし、メニューのツール→アドオン(またはCtrl+Shift+A)で表示されたアドオンマネージャーのページにxpiファイルをドラッグ&ドロップして下さい。

Expand All @@ -36,12 +37,16 @@
再度設定をお願い致します。

## 今後の予定
* ツールバーボタンのポップアップを開くときに選択文字列をNGワード入力欄へ反映
* NGワードのエクスポート・インポート
* 一時的なNGワードの登録
- 永続的な登録を必要としないIDやIPの登録を想定しています。

## 更新履歴
* v1.2.1 2018-05-14
- NGワード登録で[隠す]ボタンで隠したレスが表示される不具合を修正
* v1.2.0 2018-05-14
- ツールバーボタンからポップアップを開くときに選択文字列をNGワード入力欄へ反映する機能を追加
- NGワード登録で隠れた削除レスが表示される不具合を修正
* v1.1.0 2018-05-01
- ツールバーボタンからNGワードを登録する機能を追加
- 設定の変更やNGワードの登録が直ぐにスレに反映されるように変更
Expand Down
2 changes: 1 addition & 1 deletion koshian_ng/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

"name":"KOSHIAN NG 改",

"version":"1.1.0",
"version":"1.2.1",

"applications": {
"gecko": {
Expand Down
8 changes: 6 additions & 2 deletions koshian_ng/popup.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@ function onLoad() {
g_check_header = document.getElementById("check_header");
g_ignore_case = document.getElementById("ignore_case");

console.log("res.js selection_text: " + window.getSelection().toString());
g_ng_input.value = window.getSelection().toString();
g_check_body.checked = "checked";

g_ng_input.addEventListener("keypress", (e) => {
Expand Down Expand Up @@ -65,6 +63,12 @@ function onLoad() {
}
});

browser.tabs.query({active:true}, function(tab) {
browser.tabs.sendMessage(tab[0].id, {}, function(response) {
g_ng_input.value = response.selection;
});
});

browser.storage.local.get().then(setCurrentChoice, onError);
}

Expand Down
37 changes: 32 additions & 5 deletions koshian_ng/res.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ let hide_size = 16;
let have_sod = false;
let have_del = false;
let words_changed = false;
let show_deleted = false;

function fixFormPosition(){
let form = document.getElementById("ftbl");
Expand Down Expand Up @@ -114,15 +115,17 @@ function show(response){
}
}

for(let node = response.parentNode; node != null; node = node.parentNode){
for(let node = response.parentNode; node; node = node.parentNode){
if(node.nodeName == "TABLE"){
node.style.display = "block";
if(show_deleted || node.className != "deleted"){
node.style.display = "table";
}
break;
}
}
}

function putHideButton(block){
function putHideButton(block, hide){
let btn = document.createElement("a");
btn.className = "KOSHIAN_HideButton";
btn.href="javascript:void(0)";
Expand All @@ -138,6 +141,10 @@ function putHideButton(block){
}else{
response.insertBefore(btn, block);
}

if(hide){
switchHide({target: btn});
}
}

let last_process_num = 0;
Expand All @@ -163,15 +170,21 @@ function process(beg = 0){
});
header_regex_list = header_regex_list.filter(Boolean); //配列からnullを削除

checkDdbut(); //削除レスの表示状態を確認

loop: for(let i = beg; i < end; ++i){
let block = responses[i].getElementsByTagName("blockquote")[0];
let hide = false;

if (words_changed) {
show(responses[i]);
}
//既存の[隠す]ボタンがあれば削除
let hide_buttons = responses[i].getElementsByClassName("KOSHIAN_HideButton");
if (hide_buttons.length) {
if (hide_buttons.length){
if (hide_buttons[0].textContent == "[見る]") {
hide = true;
}
hide_buttons[0].remove();
} else {
let ng_switches = responses[i].getElementsByClassName("KOSHIAN_NGSwitch");
Expand Down Expand Up @@ -224,7 +237,7 @@ function process(beg = 0){
}

if(put_hide_button){
putHideButton(block);
putHideButton(block, hide);
}
}

Expand Down Expand Up @@ -266,6 +279,15 @@ function handleVisibilityChange() {
}
}

function checkDdbut() {
let ddbut = document.getElementById("ddbut");
if (ddbut && ddbut.textContent == "隠す") {
show_deleted = true;
} else {
show_deleted = false;
}
}

function getResponseNum(){
return document.getElementsByClassName("rtd").length;
}
Expand All @@ -282,6 +304,11 @@ function main(){
});

document.addEventListener("visibilitychange", handleVisibilityChange, false);

browser.runtime.onMessage.addListener(function(msg, sender, sendResponse) {
let sel = window.getSelection().toString();
sendResponse( {selection:sel} );
});
}

function onLoadSetting(result) {
Expand Down
2 changes: 1 addition & 1 deletion updates.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"addons": {
"{709CBCCE-3EDF-11E8-817A-C6D28A3A6C14}": {
"updates": [
{ "version": "1.1.0", "update_link": "https://github.com/akoya-tomo/koshian_ng_kai/releases/download/v1.1.0/koshian_ng_kai-1.1.0-an.fx.xpi" }
{ "version": "1.2.1", "update_link": "https://github.com/akoya-tomo/koshian_ng_kai/releases/download/v1.2.1/koshian_ng_kai-1.2.1-an.fx.xpi" }
]
}
}
Expand Down

0 comments on commit d359636

Please sign in to comment.