)\s*(((〉|》|>|>)[^>]+))(?!([^<]+)?>)/gmi, `$1$2`).replace(/\s*(((〉|》|>|>)[^>]+))(?!([^<]+)?>)/gmi, `$1`).replace(/
\s*(((〉|》|>|>)[^>]+))(?!([^<]+)?>)/gmi, `
$1`).replace(/
\s*(((〉|》|>|>)[^>]+))(?!([^<]+)?>)/gmi, `
$1`) } }); // 引用に着色,タグの外側だけ置き換え // これをやるとシステムのサムネ添付が終わる setTimeout(() => { popuponquote() }, location.href.match0(/shitaraba/) ? 2000 : 0) } setTimeout(() => { elegeta('//a[@class="reply_link"]').forEach(e => e.setAttribute("onclick", "return false;")) }, location.href.match0(/shitaraba/) ? 2000 : 0) document.addEventListener("click", c => { let word if (c?.target?.matches(".quoteSpeechBalloon")) { word = c?.target?.dataset?.quoteno } else { let e = c.target.closest(".t5quote,.allpopup,.reply_link"); if (e) { word = e.textContent.replace(/^〉+|^》+|^>+|^>+/gm, "").trim() } } if (word) { let t = (word.match0(/^[0-9-]+$/) && eleget0(NEW5CH ? `//article[@id="${word?.match0(/^\d+/)?.replace(/post/,"")}"]` : `//div[@id="${word?.match0(/^\d+/)?.replace(/post/,"")}"]`)) || elegeta('.message,section.post-content').filter(f => !f.closest(".ch5pu")).find(c => c.textContent.indexOf(word) !== -1); //let t = (word.match0(/^[0-9-]+$/) && eleget0(NEW5CH ? `//article[@id="${word?.match0(/^\d+/)?.replace(/post/,"")}"]` : `//div[@id="${word?.match0(/^\d+/)?.replace(/post/,"")}"]`)) || elegeta('.message').filter(f => !f.closest(".ch5pu")).find(c => c.textContent.indexOf(word) !== -1); // let t = (word.match0(/^[0-9-]+$/) && eleget0(`//div[@id="${word?.match0(/^\d+/)?.replace(/post/,"")}"]`)) || elegeta('.message').filter(f => !f.closest(".ch5pu")).find(c => c.textContent.indexOf(word) !== -1); if ($(t).is(":hidden")) $(t.closest(".post")).show(0).css({ "display": "table" }) // 学園祭で消していたら出す t?.scrollIntoView({ behavior: "smooth", block: "center", inline: "center" }); $(t.closest(".post")).effect("highlight", 750); } }) } // h抜きのURLをリンクにする function hNukiURLHokan() { if (IIS == 2) { $("section,.message").prepend('
'); addstyle.add(`.imgbox{text-align:right; float:right;clear:both; max-width:66%;vertical-align:bottom;} .post-content,.message{overflow-y:auto;clear:both}`) } if (IIS == 1) { $("section,.message").append('
') } elegeta('article section img').forEach(e => e.dataset.gakusai = "1"); [...document.querySelectorAll(".post .message .escaped:not([data-urlcomplemented]),dd:not([data-urlcomplemented]),article.post section.post-content:not([data-urlcomplemented])")].forEach(function(ele) { [...ele.childNodes].filter(e => e.nodeType == 3).forEach(obj => { let html = obj.textContent?.trim() let url2 = html.match0(/^(t?tps?:\/\/[\w\/:%#\$&\?\(\)~\.=\+\-]+)$/) if (url2) { let url = html.replace(/^t?(tps?:\/\/[\w\/:%#\$&\?\(\)~\.=\+\-]+)$/, `ht$1`); if (/\.(jpg|jpeg|png|gif|bmp|webp|mp4|webm|mkv)$/i.test(url)) ele.dataset.gakusai = "1"; let dom = document.createElement("a") obj.replaceWith(dom) dom.outerHTML = `${sani(url2)}`; } }) }) } function setFloatKakikomi2({ textareaXP = '//form/p/textarea[@name="MESSAGE"]', submitbuttonXP = '//input[@class="submitbtn btn"]', wid = "70%", minwid = 900 } = {}) { var mes = eleget0(textareaXP); if (mes) { mes.addEventListener("input", () => floatKakikomi2({ textareaXP: textareaXP, submitbuttonXP: submitbuttonXP, wid: wid, minwid: minwid })); mes.addEventListener("focus", () => floatKakikomi2({ textareaXP: textareaXP, submitbuttonXP: submitbuttonXP, wid: wid, minwid: minwid })); resListen = 1; } } // 書き込み欄調整、クリックでフロート化 function floatKakikomi2({ string = null, addMode = 0, command = "", textareaXP = '//form/p/textarea[@name="MESSAGE"]', submitbuttonXP = '//input[@class="submitbtn btn"]', wid = '70%', minwid = 900, preventFocus = 0 } = {}) { var textarea = eleget0(textareaXP); if (!textarea) return var submitbutton = eleget0(submitbuttonXP) if (!resFloat) { $(window).resize(() => { $(textarea).css({ "width": wid, "min-width": Math.min(minwid, (window.innerWidth - 100)) + "px", "max-width": (window.innerWidth - 100) + "px" }).attr("wrap", "on").attr("tabIndex", "1"); kakikomiStretch2(textareaXP, "resetHeight") }); } resListen || setFloatKakikomi2() resFloat = true; let curRes = $(textarea).val(); $(textarea).css({ "overflow-x": "hidden", "z-index": "10", "position": "fixed", "right": "1em", "bottom": "3em", "height": "auto" }).attr("tabIndex", "1"); $(textarea).css({ "width": wid, "min-width": Math.min(minwid, (window.innerWidth - 100)) + "px", "max-width": (window.innerWidth - 100) + "px" }).attr("wrap", "on").attr("tabIndex", "1").attr("floated", ""); $(submitbutton).css({ "z-index": "10", "position": "fixed", "right": "1em", "bottom": "0em" }).attr("tabIndex", "2").attr("floated", ""); $(`input[type="file"][name="upfile"]`).css({ "z-index": "999", "position": "fixed", "right": "48em", "left": "auto", "bottom": "3px", "height": "auto", "padding": "0.1em 0.2em", "border": "2px solid #dddddd", "background-color": "#ffffff" }) GM.addStyle('#ftbl,#ftb2,.ftbl,.ftb2{margin:0px 0px 0px 1em !important; left:1em !important;}') if (string > "") $(textarea).val((addMode ? curRes + ((curRes == "" || curRes.slice(-1) == "\n") ? "" : "\n") : "") + string); $(textarea).attr("stretchabletextarea", "1") if (!preventFocus) { $(textarea).focus() } else { textarea.blur() } // .idw:IDスレかIPスレ警告があればしない if ((textarea).value == "" || command === "resetHeight") textarea.rows = MINIMUM_ROWS; kakikomiStretch2(textareaXP); } function kakikomiStretch2(xp, command = "") { if ($(elegeta(xp)).is(":hidden")) return let target = eleget0(xp); var targetvalue = target ? target.value : "" if (command === "resetHeight" || targetvalue.length < 100 || targetvalue.match(/\n/gm).length < 5) target.rows = MINIMUM_ROWS; let lineHeight = Number(target.getAttribute("rows")); let height = target.scrollHeight; //+12; let clientHeight = Math.min(document.documentElement.clientHeight, window.innerHeight) - 165; for (let i = 0; i < 90 && (height >= target.offsetHeight) && target.offsetHeight < clientHeight; i++) { lineHeight++; target.setAttribute("rows", lineHeight); } displayLineLimit(target); return target; } function displayLineLimit(target) { let line = target.value.split(/\r\n|\r|\n/).length; if (line_number && message_count) { target.style.backgroundColor = line > line_number * 2 ? "#fff0f0" : (new Blob([target.value]).size) > message_count ? "#fffff0" : "#ffffff"; } if (ld(".2chan.net")) { target.style.backgroundColor = (target.value.split("\n").reduce((a, b) => Math.max(getWidth(b), a), 0) >= 801 ? "#fffff0" : "#ffffff"); } } function getWidth(str) { var canvas = document.createElement('canvas') let width = canvas.getContext('2d').measureText(str).width * 16 / 10; canvas.remove() return width; } function sortDescendMiddle(array) { return array; /*return array.sort((a, b) => { return Math.abs(a.getBoundingClientRect().top - document.documentElement.clientHeight / 2) > Math.abs(b.getBoundingClientRect().top - document.documentElement.clientHeight / 2) ? 1 : -1 });*/ } // 画像と動画をインライン埋め込み function imageUmekomi() { if (eleget0('.ch5pu')) return; var i = 0; let IIScss = (IIS >= 2 ? "margin:0.3em 0 0 1em;" : "margin:0.3em 1em 0 0;") GF.headerbottom = eleget0('.stickymenu')?.getBoundingClientRect()?.bottom || 0; sw1("removeSysThumbs"); //for (let a of sortDescendMiddle(elegeta('//a[@imge="af"]/div[@div="thumb5ch"]'))) { if (isinscreen(a)) setTimeout((function(a) { return function() { { a.remove(); } } })(a), WAIT_IMAGE_EMBED_INTERVAL * 3 / NUMBER_IMAGE_EMBED_AT_ONCE) } for (let a of sortDescendMiddle(elegeta('a[imge="af"]>div[div="thumb5ch"]'))) { if (isinscreen(a)) setTimeout((function(a) { return function() { { a.remove(); } } })(a), WAIT_IMAGE_EMBED_INTERVAL * 3 / NUMBER_IMAGE_EMBED_AT_ONCE) } sw2("removeSysThumbs"); // 画像埋め込み sw1("umegazo") // for (let ele of sortDescendMiddle(elegeta('//a[not(@imge)]'))) { for (let ele of sortDescendMiddle(elegeta('a:not([imge])'))) { let isImg = 0; var url = ele.href || ($(ele).text()); url = url.replace(/^t?(tps?:\/\/)/m, "ht$1"); try { var urlImg = decodeURIComponent(url.replace(/https?:\/\/jump\.5ch\.net\/\?|https?:\/\/jbbs\.shitaraba\.net\/bbs\/link\.cgi\?url=/, "")) //.replace(/https?:\/\/jbbs\.shitaraba\.net\/bbs\/link\.cgi\?url=/,""); } catch (e) { var urlImg = url.replace(/https?:\/\/jump\.5ch\.net\/\?|https?:\/\/jbbs\.shitaraba\.net\/bbs\/link\.cgi\?url=/, "") } if ($(ele).text().match(/\.jpg|\.jpeg|\.png|\.gif|\.bmp|\.webp/)) { isImg = 1; } else { isImg = 0; } if (!isImg) ele.setAttribute("imge", "!i"); if ((!isinscreen(ele))) continue; // 画面内に無い if (isImg) { //notifyMe(url)//notifyMe(decodeURIComponent(urlImg)) let next = ele.children ? ele.children[0] : null; if (next && next.tagName === "DIV") { // システムのサムネイルあり // if (ALTERNATIVE_THUMBNAIL) next.outerHTML = '
'; if (ALTERNATIVE_THUMBNAIL) next.outerHTML = '
'; ele.setAttribute("imge", "rp"); } else { // if ( /^ttp/.test(ele.textContent)){ // システムのサムネ添付はhtmlに変更があると諦めて中断される // $(ele).after($('
')); /*if(IIS==2){ $(``).hide().appendTo(eleget0('.imgbox', ele.closest(`.post,article`))).show(222); } else*/ if (IIS >= 1) { $(``).hide().appendTo(eleget0('.imgbox', ele.closest(`.post,article`))).show(222); } else { $('
').hide().insertAfter(ele).show(222); } ele.setAttribute("imge", "af"); } if (++i >= NUMBER_IMAGE_EMBED_AT_ONCE) break; // 一度に設定枚数ずつしかやらない } } sw2("umegazo") if (eleget0('.ch5pu')) return; sw1("umedouga") var i = 0; // ニコ動埋め込み(PrivacyBadger等は要Disable) // for (let ele of sortDescendMiddle(elegeta('//a[contains(@href,"www.nicovideo.jp")][not(@nde)]|//a[contains(@href,"//nico.ms/sm")][not(@nde)]'))) { for (let ele of sortDescendMiddle(elegeta('a[href*="www.nicovideo.jp"]:not([nde]),a[href*="//nico.ms/sm"]:not([nde])'))) { if ((!isinscreen(ele))) continue; // 画面内に無い //if (!isinscreen(ele) && Date.now() - (GF?.lateVideo || 0) < 5000) continue; else GF.lateVideo = Date.now() // 画面内にない&5秒未満 //let url = ele.innerText.replace(/^t?(tps?:\/\/)/i, "ht$1"); let url = ele.href; ele.setAttribute("nde", "nde"); var nico = url.match(/h?t?tps?:\/\/(?:www\.)?nicovideo.jp\/watch\/(.*)/i); //var nico = url.match(/h?ttps?:\/\/www.nicovideo.jp\/watch\/(.*)/i); if (!nico) var nico = url.match(/h?t?tps:\/\/nico\.ms\/(.*)/i); if (!nico) continue; //$(`
`).hide().insertAfter(ele).show(222) // 埋め込み外部プレイヤー版 if (IIS >= 1) { $(``).hide().appendTo(eleget0('.imgbox', ele.closest(`.post,article`))).show(222) // 埋め込み外部プレイヤー版 } else { $(`
`).hide().appendTo(ele).show(222); // 埋め込み外部プレイヤー版 } // $(``).hide().appendTo(eleget0('.imgbox',ele.closest(`.post,article`))).show(222); if (++i >= (NUMBER_VIDEO_EMBED_AT_ONCE)) break; // 一度に設定枚数ずつしかやらない // break; // 一度に1つずつしかやらない } sw2("umedouga") sw1("umeYT") // youtube埋め込み var i = 0; // for (let ele of sortDescendMiddle(elegeta('//a[contains(@href,"youtube.com")][not(@yte)]|//a[contains(@href,"youtu.be")][not(@yte)]'))) { for (let ele of sortDescendMiddle(elegeta('a[href*="youtube.com"]:not([yte]),a[href*="youtu.be"]:not([yte])'))) { if ((!isinscreen(ele))) continue; // 画面内に無い //if (!isinscreen(ele) && Date.now() - (GF?.lateVideo || 0) < 5000) continue; else GF.lateVideo = Date.now() // 画面内にない&5秒未満 //let url = ele.href; let url = ele.href?.replace(/jump.5ch.net\/\?/, ""); ele.setAttribute("yte", "yte"); // var sm = (url.match(/(?:h?ttps?:\/\/)youtu\.be\/([a-zA-Z0-9_\-]{11}).*[\?\&]t=(\d*).*$/i) || url.match(/(?:h?ttps?:\/\/)(?:www\.)?youtube\.com\/watch\?v=([a-zA-Z0-9_\-]{11}).*&t=(\d*).*$/i)) || url.match(/(?:h?ttps?:\/\/)youtu\.be\/([a-zA-Z0-9_\-]{11})/i) || url.match(/(?:h?ttps?:\/\/)(?:www\.)?youtube\.com\/shorts\/([a-zA-Z0-9_\-]{11})/i) || url.match(/(?:h?ttps?:\/\/)(?:www\.)?youtube\.com\/watch\?v=([a-zA-Z0-9_\-]{11})/i); var sm = (url.match(/(?:h?t?tps?:\/\/)youtu\.be\/([a-zA-Z0-9_\-]{11}).*[\?\&]t=(\d*).*$/i) || url.match(/(?:h?t?tps?:\/\/)(?:www\.|m\.)?youtube\.com\/watch\?v=([a-zA-Z0-9_\-]{11}).*&t=(\d*).*$/i)) || url.match(/(?:h?t?tps?:\/\/)youtu\.be\/([a-zA-Z0-9_\-]{11})/i) || url.match(/(?:h?t?tps?:\/\/)(?:www\.|m\.)?youtube\.com\/shorts\/([a-zA-Z0-9_\-]{11})/i) || url.match(/(?:h?t?tps?:\/\/)(?:www\.|m\.)?youtube\.com\/watch\?v=([a-zA-Z0-9_\-]{11})/i); if (!sm) continue var pl = (url.match0(/[\&\?]list=([a-zA-Z0-9_\-]+)/)); /*if (IIS==2){ $('