Update rule, hint and add comment

wyn
This commit is contained in:
Adam Wróblewski
2024-11-20 17:58:41 +01:00
parent 85696f2c11
commit 16df0701ec
2 changed files with 3 additions and 2 deletions

View File

@@ -39,7 +39,8 @@ wiki.yjsnpi.nu#%#//scriptlet('prevent-eval-if', '/catch.+catch/')
wiki.yjsnpi.nu###mw-content-text div[style] a[href*="contents.fc2.com"]
wiki.yjsnpi.nu#%#//scriptlet('remove-node-text', 'script', '/catch.+catch/')
!#endif
!#if (! adguard_app_windows && !adguard_app_mac && !adguard_app_android && !adguard_ext_chromium_mv3 && !ext_ublock)
!#if (!adguard_app_windows && !adguard_app_mac && !adguard_app_android && !adguard_ext_chromium_mv3 && !ext_ublock)
! TODO: try to use trusted-replace-node-text scriptlet instead of rule below
! wiki.yjsnpi.nu#%#(()=>{let e;if(0==RLCONF.wgNamespaceNumber&&"view"==RLCONF.wgAction&&0!=RLCONF.wgArticleId&&!RLCONF.wgIsRedirect&&RLCONF.wgRevisionId==RLCONF.wgCurRevisionId){const n=document.querySelector("#bodyContent");if(n){const c=new XMLHttpRequest;c.onloadend=()=>{200===c.status&&(e=(new DOMParser).parseFromString(c.responseText,"text/html").body,n.appendChild(e.querySelector("#comments-section")),document.querySelector("#comment-submit").addEventListener("click",o),t(0))},c.open("GET","/comments/assets/template.html",!0),c.send()}}function t(t){const o=document.querySelector("#comments-more"),c=document.querySelector("#comments-message"),r=()=>{c.innerText="読み込めませんでした",o&&(o.innerText="もっと見る",o.disabled=!1)},m=new XMLHttpRequest;m.responseType="json",m.onloadend=()=>{const o=document.querySelector("#comments-loading");o&&o.remove(),200===m.status?function(t){const o=document.querySelector("#comments"),c=document.querySelector("#comments-contents"),r=document.querySelector("#comments-recent"),m=document.querySelector("#comments-more"),s=document.querySelector("#comments-message");m&&m.remove();if(s.innerHTML="",o&&c&&r){if(t.comments.forEach((t=>{const n=e.querySelector("#comment").cloneNode(!0);n.id="comment-"+t.number,n.dataset.commentId=t.number,n.querySelector(".comment-author").innerHTML=t.author,n.querySelector(".comment-timestamp").innerHTML=t.created_at,n.querySelector(".comment-body").innerHTML=t.comment,o.appendChild(n)})),t.cursor>0){const o=e.querySelector("#comments-more").cloneNode(!0);o.dataset.cursor=t.cursor,o.addEventListener("click",n),c.appendChild(o)}const m=document.createElement("ul");t.recent.sort((()=>Math.random()-Math.random())).forEach((e=>{const t=document.createElement("li"),n=document.createElement("a");n.href="/w/index.php?curid="+e.article_id,e.comment.length>70&&(e.comment=e.comment.substring(0,70)+"…"),n.innerHTML=e.comment,t.appendChild(n),m.appendChild(t)})),r.appendChild(m.cloneNode(!0)),r.appendChild(m.cloneNode(!0))}}(m.response):0==t&&r()},m.ontimeout=r,m.onerror=r,m.open("GET","/comments/comments.php?article_id="+RLCONF.wgArticleId+"&cursor="+t,!0),m.send()}function n(e){const n=document.querySelector("#comments-more");n.disabled=!0,n.innerText="読込中…",t(e.target.dataset.cursor)}function o(e){const n=document.querySelector('#comment-editor input[name="author"]'),o=document.querySelector("#comment-editor textarea");if(""==o.value)return void mw.notify("(本文が)ないです");e.target.disabled=!0,e.target.innerHTML="送信中…";const c={article_id:RLCONF.wgArticleId,author:n.value,comment:o.value},r=[];for(const[e,t]of Object.entries(c))r.push(`${encodeURIComponent(e)}=${encodeURIComponent(t)}`);const m=new XMLHttpRequest;m.onloadend=()=>{e.target.disabled=!1,e.target.innerHTML="投稿する",200===m.status?(mw.notify("投稿しました"),n.value="",o.value="",document.querySelector("#comments").innerHTML="",document.querySelector("#comments-recent").innerHTML="",t(0)):403===m.status?mw.notify("フリーWi-Fiからは書けないです"):429===m.status?mw.notify("書きすぎィ!ちょっと待って、どうぞ!"):mw.notify("投稿できませんでした…")},m.open("POST","/comments/comments.php"),m.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),m.send(r.join("&").replaceAll("%20","+"))}})();
wiki.yjsnpi.nu#%#function copyToClipboad(e){navigator.clipboard.writeText(this.caller.dataset.text).then((()=>{mw.notify("クリップボードにコピーしました"),gtag("event","clipboard",{wgTitle:RLCONF.wgTitle,clipboard_status:"done"})}),(()=>{mw.notify("クリップボードにコピーできませんでした…"),gtag("event","clipboard",{wgTitle:RLCONF.wgTitle,clipboard_status:"failed"})}))}function searchProduct(e){var t="";if("FANZA"===this.caller.dataset.asp){{const e="https://www.dmm.co.jp/digital/videoa/-/list/search/=/?searchstr="+encodeURI(RLCONF.wgPageName);t="https://al.dmm.co.jp/?lurl="+encodeURI(e)+"&af_id=takayama-001&ch=toolbar&ch_id=link"}window.open(t,"_blank"),gtag("event","search_products",{wgTitle:RLCONF.wgTitle,asp:this.caller.dataset.asp})}}function sfw(e){this.caller.classList.remove("nsfw"),gtag("event","nsfw",{wgTitle:RLCONF.wgTitle})}function getAbsolutePath(e){const t=location.href;return new URL(e,t).href}document.querySelectorAll(".copy_to_clipboard").forEach((e=>{e.addEventListener("click",{caller:e,handleEvent:copyToClipboad})})),document.querySelectorAll(".search_products").forEach((e=>{e.addEventListener("click",{caller:e,handleEvent:searchProduct})})),document.querySelectorAll(".share_button").forEach((e=>{e.addEventListener("click",(async e=>{const t={title:RLCONF.wgTitle+" - 真夏の夜の淫夢Wiki",text:RLCONF.wgTitle+" - 真夏の夜の淫夢Wiki",url:getAbsolutePath("/wiki/"+encodeURI(RLCONF.wgPageName))};if(navigator.canShare&&navigator.canShare(t))try{await navigator.share(t),mw.notify("シェアしました"),gtag("event","share",{wgTitle:RLCONF.wgTitle,share_type:"share",share_status:"done"})}catch(e){mw.notify("シェアできませんでした…"),gtag("event","share",{wgTitle:RLCONF.wgTitle,share_type:"share",share_status:"cancelled"})}else navigator.clipboard.writeText(t.text+" "+t.url).then((()=>{mw.notify("クリップボードにコピーしました"),gtag("event","share",{wgTitle:RLCONF.wgTitle,share_type:"clipboard",share_status:"done"})}),(()=>{mw.notify("クリップボードにコピーできませんでした…"),gtag("event","share",{wgTitle:RLCONF.wgTitle,share_type:"clipboard",share_status:"failed"})}))}))})),document.querySelectorAll(".nsfw").forEach((e=>{e.addEventListener("click",{caller:e,handleEvent:sfw})}));
||wiki.yjsnpi.nu^$script

View File

@@ -749,7 +749,7 @@ wiki.yjsnpi.nu#@$##mw-content-text > div[style="text-align: center; margin: 1rem
wiki.yjsnpi.nu#@$##mw-content-text > div[style="text-align: center; margin: 1rem auto; max-width: 100%;"] { position: absolute !important; left: -4000px !important; }
wiki.yjsnpi.nu#%#//scriptlet('abort-current-inline-script', 'onload', 'catch')
wiki.yjsnpi.nu#%#//scriptlet('remove-node-text', 'script', '/catch.+catch/')
wiki.yjsnpi.nu#%#(()=>{let e;if(0==RLCONF.wgNamespaceNumber&&"view"==RLCONF.wgAction&&0!=RLCONF.wgArticleId&&!RLCONF.wgIsRedirect&&RLCONF.wgRevisionId==RLCONF.wgCurRevisionId){const n=document.querySelector("#bodyContent");if(n){const c=new XMLHttpRequest;c.onloadend=()=>{200===c.status&&(e=(new DOMParser).parseFromString(c.responseText,"text/html").body,n.appendChild(e.querySelector("#comments-section")),document.querySelector("#comment-submit").addEventListener("click",o),t(0))},c.open("GET","/comments/assets/template.html",!0),c.send()}}function t(t){const o=document.querySelector("#comments-more"),c=document.querySelector("#comments-message"),r=()=>{c.innerText="読み込めませんでした",o&&(o.innerText="もっと見る",o.disabled=!1)},m=new XMLHttpRequest;m.responseType="json",m.onloadend=()=>{const o=document.querySelector("#comments-loading");o&&o.remove(),200===m.status?function(t){const o=document.querySelector("#comments"),c=document.querySelector("#comments-contents"),r=document.querySelector("#comments-recent"),m=document.querySelector("#comments-more"),s=document.querySelector("#comments-message");m&&m.remove();if(s.innerHTML="",o&&c&&r){if(t.comments.forEach((t=>{const n=e.querySelector("#comment").cloneNode(!0);n.id="comment-"+t.number,n.dataset.commentId=t.number,n.querySelector(".comment-author").innerHTML=t.author,n.querySelector(".comment-timestamp").innerHTML=t.created_at,n.querySelector(".comment-body").innerHTML=t.comment,o.appendChild(n)})),t.cursor>0){const o=e.querySelector("#comments-more").cloneNode(!0);o.dataset.cursor=t.cursor,o.addEventListener("click",n),c.appendChild(o)}const m=document.createElement("ul");t.recent.sort((()=>Math.random()-Math.random())).forEach((e=>{const t=document.createElement("li"),n=document.createElement("a");n.href="/w/index.php?curid="+e.article_id,e.comment.length>70&&(e.comment=e.comment.substring(0,70)+"…"),n.innerHTML=e.comment,t.appendChild(n),m.appendChild(t)})),r.appendChild(m.cloneNode(!0)),r.appendChild(m.cloneNode(!0))}}(m.response):0==t&&r()},m.ontimeout=r,m.onerror=r,m.open("GET","/comments/comments.php?article_id="+RLCONF.wgArticleId+"&cursor="+t,!0),m.send()}function n(e){const n=document.querySelector("#comments-more");n.disabled=!0,n.innerText="読込中…",t(e.target.dataset.cursor)}function o(e){const n=document.querySelector('#comment-editor input[name="author"]'),o=document.querySelector("#comment-editor textarea");if(""==o.value)return void mw.notify("(本文が)ないです");e.target.disabled=!0,e.target.innerHTML="送信中…";const c={article_id:RLCONF.wgArticleId,author:n.value,comment:o.value},r=[];for(const[e,t]of Object.entries(c))r.push(`${encodeURIComponent(e)}=${encodeURIComponent(t)}`);const m=new XMLHttpRequest;m.onloadend=()=>{e.target.disabled=!1,e.target.innerHTML="投稿する",200===m.status?(mw.notify("投稿しました"),n.value="",o.value="",document.querySelector("#comments").innerHTML="",document.querySelector("#comments-recent").innerHTML="",t(0)):403===m.status?mw.notify("フリーWi-Fiからは書けないです"):429===m.status?mw.notify("書きすぎィ!ちょっと待って、どうぞ!"):mw.notify("投稿できませんでした…")},m.open("POST","/comments/comments.php"),m.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),m.send(r.join("&").replaceAll("%20","+"))}})();
wiki.yjsnpi.nu#%#(()=>{document.addEventListener("DOMContentLoaded",()=>{let e;if(0==RLCONF.wgNamespaceNumber&&"view"==RLCONF.wgAction&&0!=RLCONF.wgArticleId&&!RLCONF.wgIsRedirect&&RLCONF.wgRevisionId==RLCONF.wgCurRevisionId){const n=document.querySelector("#bodyContent");if(n){const c=new XMLHttpRequest;c.onloadend=()=>{200===c.status&&(e=(new DOMParser).parseFromString(c.responseText,"text/html").body,n.appendChild(e.querySelector("#comments-section")),document.querySelector("#comment-submit").addEventListener("click",o),t(0))},c.open("GET","/comments/assets/template.html",!0),c.send()}}function t(t){const o=document.querySelector("#comments-more"),c=document.querySelector("#comments-message"),r=()=>{c.innerText="読み込めませんでした",o&&(o.innerText="もっと見る",o.disabled=!1)},m=new XMLHttpRequest;m.responseType="json",m.onloadend=()=>{const o=document.querySelector("#comments-loading");o&&o.remove(),200===m.status?function(t){const o=document.querySelector("#comments"),c=document.querySelector("#comments-contents"),r=document.querySelector("#comments-recent"),m=document.querySelector("#comments-more"),s=document.querySelector("#comments-message");m&&m.remove();if(s.innerHTML="",o&&c&&r){if(t.comments.forEach((t=>{const n=e.querySelector("#comment").cloneNode(!0);n.id="comment-"+t.number,n.dataset.commentId=t.number,n.querySelector(".comment-author").innerHTML=t.author,n.querySelector(".comment-timestamp").innerHTML=t.created_at,n.querySelector(".comment-body").innerHTML=t.comment,o.appendChild(n)})),t.cursor>0){const o=e.querySelector("#comments-more").cloneNode(!0);o.dataset.cursor=t.cursor,o.addEventListener("click",n),c.appendChild(o)}const m=document.createElement("ul");t.recent.sort((()=>Math.random()-Math.random())).forEach((e=>{const t=document.createElement("li"),n=document.createElement("a");n.href="/w/index.php?curid="+e.article_id,e.comment.length>70&&(e.comment=e.comment.substring(0,70)+"…"),n.innerHTML=e.comment,t.appendChild(n),m.appendChild(t)})),r.appendChild(m.cloneNode(!0)),r.appendChild(m.cloneNode(!0))}}(m.response):0==t&&r()},m.ontimeout=r,m.onerror=r,m.open("GET","/comments/comments.php?article_id="+RLCONF.wgArticleId+"&cursor="+t,!0),m.send()}function n(e){const n=document.querySelector("#comments-more");n.disabled=!0,n.innerText="読込中…",t(e.target.dataset.cursor)}function o(e){const n=document.querySelector('#comment-editor input[name="author"]'),o=document.querySelector("#comment-editor textarea");if(""==o.value)return void mw.notify("(本文が)ないです");e.target.disabled=!0,e.target.innerHTML="送信中…";const c={article_id:RLCONF.wgArticleId,author:n.value,comment:o.value},r=[];for(const[e,t]of Object.entries(c))r.push(`${encodeURIComponent(e)}=${encodeURIComponent(t)}`);const m=new XMLHttpRequest;m.onloadend=()=>{e.target.disabled=!1,e.target.innerHTML="投稿する",200===m.status?(mw.notify("投稿しました"),n.value="",o.value="",document.querySelector("#comments").innerHTML="",document.querySelector("#comments-recent").innerHTML="",t(0)):403===m.status?mw.notify("フリーWi-Fiからは書けないです"):429===m.status?mw.notify("書きすぎィ!ちょっと待って、どうぞ!"):mw.notify("投稿できませんでした…")},m.open("POST","/comments/comments.php"),m.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),m.send(r.join("&").replaceAll("%20","+"))}})})();
wiki.yjsnpi.nu#%#function copyToClipboad(e){navigator.clipboard.writeText(this.caller.dataset.text).then((()=>{mw.notify("クリップボードにコピーしました"),gtag("event","clipboard",{wgTitle:RLCONF.wgTitle,clipboard_status:"done"})}),(()=>{mw.notify("クリップボードにコピーできませんでした…"),gtag("event","clipboard",{wgTitle:RLCONF.wgTitle,clipboard_status:"failed"})}))}function searchProduct(e){var t="";if("FANZA"===this.caller.dataset.asp){{const e="https://www.dmm.co.jp/digital/videoa/-/list/search/=/?searchstr="+encodeURI(RLCONF.wgPageName);t="https://al.dmm.co.jp/?lurl="+encodeURI(e)+"&af_id=takayama-001&ch=toolbar&ch_id=link"}window.open(t,"_blank"),gtag("event","search_products",{wgTitle:RLCONF.wgTitle,asp:this.caller.dataset.asp})}}function sfw(e){this.caller.classList.remove("nsfw"),gtag("event","nsfw",{wgTitle:RLCONF.wgTitle})}function getAbsolutePath(e){const t=location.href;return new URL(e,t).href}document.querySelectorAll(".copy_to_clipboard").forEach((e=>{e.addEventListener("click",{caller:e,handleEvent:copyToClipboad})})),document.querySelectorAll(".search_products").forEach((e=>{e.addEventListener("click",{caller:e,handleEvent:searchProduct})})),document.querySelectorAll(".share_button").forEach((e=>{e.addEventListener("click",(async e=>{const t={title:RLCONF.wgTitle+" - 真夏の夜の淫夢Wiki",text:RLCONF.wgTitle+" - 真夏の夜の淫夢Wiki",url:getAbsolutePath("/wiki/"+encodeURI(RLCONF.wgPageName))};if(navigator.canShare&&navigator.canShare(t))try{await navigator.share(t),mw.notify("シェアしました"),gtag("event","share",{wgTitle:RLCONF.wgTitle,share_type:"share",share_status:"done"})}catch(e){mw.notify("シェアできませんでした…"),gtag("event","share",{wgTitle:RLCONF.wgTitle,share_type:"share",share_status:"cancelled"})}else navigator.clipboard.writeText(t.text+" "+t.url).then((()=>{mw.notify("クリップボードにコピーしました"),gtag("event","share",{wgTitle:RLCONF.wgTitle,share_type:"clipboard",share_status:"done"})}),(()=>{mw.notify("クリップボードにコピーできませんでした…"),gtag("event","share",{wgTitle:RLCONF.wgTitle,share_type:"clipboard",share_status:"failed"})}))}))})),document.querySelectorAll(".nsfw").forEach((e=>{e.addEventListener("click",{caller:e,handleEvent:sfw})}));
wiki.yjsnpi.nu#@%#//scriptlet('prevent-setTimeout', '/\(\)=>\{.+catch/')
wiki.yjsnpi.nu#@%#//scriptlet('trusted-suppress-native-method', 'Document.prototype.querySelectorAll', '/^iframe$/', 'abort')