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 Nov 12, 2019
2 parents eb9f1fe + f9b3910 commit c3eb428
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 20 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@ himuro\_majika氏作のユーザースタイルシートも使ってみてくだ
[futaba\_catalog\_mod(クラシックバージョン)](https://userstyles.org/styles/114130/futaba-catalog-mod-classic)

## 更新履歴
* v1.6.6rev27 2019-11-12
- 特定の条件下でピックアップしたスレにボタンやポップアップが表示されない不具合を修正
- 赤福ExtendedやKOSHIAN タブ制御で新レイアウトのピックアップからスレを開いたときに別のタブに開く不具合を修正
* v1.6.6rev26 2019-11-11
- 新レイアウトのカタログに暫定対応
* v1.6.6rev25 2019-09-06
Expand Down
43 changes: 23 additions & 20 deletions futaba_thread_highlighter.user.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
// @description スレ本文を検索してカタログでスレッド監視しちゃう
// @include http://*.2chan.net/*/futaba.php?mode=cat*
// @include https://*.2chan.net/*/futaba.php?mode=cat*
// @version 1.6.6rev26
// @version 1.6.6rev27
// @require http://ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js
// @grant GM_registerMenuCommand
// @grant GM_getValue
Expand Down Expand Up @@ -119,6 +119,7 @@ this.$ = this.jQuery = jQuery.noConflict(true);
$("#GM_fth_config_container").fadeOut(100);
highlight(true);
pickup_opened_threads();
notifyPickup();
/*
* 板毎の個別検索ワードを保存
*/
Expand Down Expand Up @@ -405,6 +406,8 @@ this.$ = this.jQuery = jQuery.noConflict(true);
if ($("#cat_search").length) {
// ふたクロ
highlight();
pickup_opened_threads();
notifyPickup();
target = $("#cattable").get(0);
config = { attributes: true , attributeFilter: ["style"] };
}
Expand Down Expand Up @@ -497,7 +500,7 @@ this.$ = this.jQuery = jQuery.noConflict(true);
return;
}

var target = isNewLayout ? $("#cattable .cs") : $("#cattable td");
var target = isNewLayout ? $("#cattable > .cs") : $("#cattable td");
var config = { attributes: true , attributeFilter: ["style"] };
// オブザーバインスタンスが既にあれば事前に解除
if (openedThreadObserver) {
Expand All @@ -524,7 +527,7 @@ this.$ = this.jQuery = jQuery.noConflict(true);

if ($(".akahuku_markup_catalog_table").length) {
// 赤福の既読マーク
target = isNewLayout ? $("#cattable .cs .cu a[style]") : $("#cattable td a[style]");
target = isNewLayout ? $("#cattable .cu a[style]") : $("#cattable td a[style]");
config = { attributes: true, attributeFilter: ["class"] };
for (var j = 0; j < target.length; ++j) {
openedThreadObserver.observe(target[j], config);
Expand Down Expand Up @@ -561,12 +564,12 @@ this.$ = this.jQuery = jQuery.noConflict(true);
if( words !== "" ) {
removeOldHighlighted();
if (isNewLayout) {
$("#cattable .cu").each(function() {
$("#cattable > .cs").each(function() {
var matches = $(this).get(0).innerText.match(/([^\n]+)\n/);
if( matches && matches[1].match(re) &&
($(this).parent(".cs").attr("class") + "").indexOf("GM_fcn_ng_") == -1 && // 「futaba catalog NG」NGスレ
($(this).parent(".cs").attr("style") + "").indexOf("display: none") == -1 && // NGスレ
($(this).children("small").attr("style") + "").indexOf("display: none") == -1 ) { // 「合間合間に」NGスレ
($(this).attr("class") + "").indexOf("GM_fcn_ng_") == -1 && // 「futaba catalog NG」NGスレ
($(this).attr("style") + "").indexOf("display: none") == -1 && // NGスレ
($(this).children("cu").children("small").attr("style") + "").indexOf("display: none") == -1 ) { // 「合間合間に」NGスレ
/* 新レイアウトでは検索ワードのハイライトは無効
if ( !$(this).children(".GM_fth_matchedword").length ) {
$(this).html($(this).html().replace(re,
Expand All @@ -575,14 +578,14 @@ this.$ = this.jQuery = jQuery.noConflict(true);
"</span>"));
}
*/
$(this).parent(".cs").addClass("GM_fth_highlighted");
$(this).addClass("GM_fth_highlighted");
}
});
} else {
$("#cattable td small").each(function() {
if( $(this).text().match(re) &&
($(this).parent("td").attr("class") + "").indexOf("GM_fcn_ng_") == -1 && // 「futaba catalog NG」NGスレ
($(this).parent("td").attr("style") + "").indexOf("display: none") == -1 && // NGスレ
($(this).closest("td").attr("class") + "").indexOf("GM_fcn_ng_") == -1 && // 「futaba catalog NG」NGスレ
($(this).closest("td").attr("style") + "").indexOf("display: none") == -1 && // NGスレ
($(this).attr("style") + "").indexOf("display: none") == -1 ) { // 「合間合間に」NGスレ
if ( !$(this).children(".GM_fth_matchedword").length ) {
$(this).html($(this).html().replace(re,
Expand Down Expand Up @@ -637,14 +640,14 @@ this.$ = this.jQuery = jQuery.noConflict(true);
$clone.children("br").replaceWith();
}
// 「合間合間に」のボタンを削除
$clone.children("small.aima_aimani_generated").replaceWith();
$clone.find("small.aima_aimani_generated").replaceWith();

// 「KOSHIAN 画像をポップアップで表示 改」のポップアップを削除
$clone.children(".KOSHIAN_image_popup_container").replaceWith();
$clone.find(".KOSHIAN_image_popup_container").replaceWith();

// aタグがクリックされたらカタログのaタグをクリックする
$clone.children("a").click((e) => {
var origin_anchor = $(this).children("a:first").get(0);
$clone.find("a").click((e) => {
var origin_anchor = $(this).find("a:first").get(0);
if (origin_anchor) {
origin_anchor.click();
e.preventDefault();
Expand Down Expand Up @@ -729,10 +732,10 @@ this.$ = this.jQuery = jQuery.noConflict(true);
"[class *= 'GM_fcn_ng_']"; // futaba catalog NG
if ($(".akahuku_markup_catalog_table").length) {
// 赤福の既読スレ
opened = isNewLayout ? $("#cattable .cs:has('a.akahuku_visited'):not(" + filter + ")") : $("#cattable td:has('a.akahuku_visited'):not(" + filter + ")");
opened = isNewLayout ? $("#cattable > .cs:has('a.akahuku_visited'):not(" + filter + ")") : $("#cattable td:has('a.akahuku_visited'):not(" + filter + ")");
} else {
// 既読スレ
opened = isNewLayout ? $("#cattable .cs[style]:not(" + filter +")") : $("#cattable td[style]:not(" + filter +")");
opened = isNewLayout ? $("#cattable > .cs[style]:not(" + filter +")") : $("#cattable td[style]:not(" + filter +")");
}
// OPENED_THREAD_MARKER_STYLEが未設定でKOSHIANカタログマーカー改v2以外のマークならスタイルをコピー
if (opened.length && !openedThreadCssText && !opened.first().attr("opened")) {
Expand Down Expand Up @@ -761,14 +764,14 @@ this.$ = this.jQuery = jQuery.noConflict(true);
$clone.children("br").replaceWith();
}
// 「合間合間に」のボタンを削除
$clone.children("small.aima_aimani_generated").replaceWith();
$clone.find("small.aima_aimani_generated").replaceWith();

// 「KOSHIAN 画像をポップアップで表示 改」のポップアップを削除
$clone.children(".KOSHIAN_image_popup_container").replaceWith();
$clone.find(".KOSHIAN_image_popup_container").replaceWith();

// aタグがクリックされたらカタログのaタグをクリックする
$clone.children("a").click((e) => {
var origin_anchor = $(this).children("a:first").get(0);
$clone.find("a").click((e) => {
var origin_anchor = $(this).find("a:first").get(0);
if (origin_anchor) {
origin_anchor.click();
e.preventDefault();
Expand Down

0 comments on commit c3eb428

Please sign in to comment.