您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Greasy Fork is available in English.
PubMed reddit ニコレポ ニコニコ静画 DuckDuckGo pixiv YouTube Quora 音泉 Yahoo!ニュース ライブドアニュース Togetter gooニュース はてな匿名ダイアリー Yahoo!知恵袋 スキマ
当前为
// ==UserScript== // @name 「Show more」ボタンを自動で押す // @description PubMed reddit ニコレポ ニコニコ静画 DuckDuckGo pixiv YouTube Quora 音泉 Yahoo!ニュース ライブドアニュース Togetter gooニュース はてな匿名ダイアリー Yahoo!知恵袋 スキマ // @version 0.1.10 // @match *://www.nicovideo.jp/my* // @match *://www.nicovideo.jp/user/* // @match *://seiga.nicovideo.jp/seiga/* // @match *://duckduckgo.com/* // @match *://www.pixiv.net/* // @match *://www.reddit.com/* // @match *://www.reddit.com/r/* // @match *://www.youtube.com // @match *://www.youtube.com/* // @match *://www.youtube.com/watch* // @match *://pubmed.ncbi.nlm.nih.gov/* // @match https://www.quora.com/* // @match https://www.onsen.ag/ // @match *://news.yahoo.co.jp/pickup* // @match https://news.livedoor.com/topics/detail/* // @match https://togetter.com/* // @match *://news.goo.ne.jp/* // @match *://anond.hatelabo.jp/* // @match *://detail.chiebukuro.yahoo.co.jp/qa/question_detail/* // @match https://www.sukima.me/* // @match *://yanmaga.jp/* // @run-at document-idle // @grant GM_addStyle // @namespace http://greasyfork.icu/users/181558 // ==/UserScript== (function() { const moreButtonIntervalDefault = 1500; const SCREEN_HEIGHT_CORRECTION_DEFAULT = window.innerHeight * 0; // (px)画面内と判定する縦ピクセル数の補正量 var clickedalready = []; var rest = 0; const siteinfo = [{ url: '//yanmaga.jp/', moreButton: '//div/div/button[@class="mod-episode-more-button"]/span[text()="もっと見る"]', }, { url: 'https://www.sukima.me/', moreButton: '//span[@class="get-more" and text()="もっとみる"]', moreButtonInterval: 2500, moreButtonSame: 1, }, { url: '//detail.chiebukuro.yahoo.co.jp/qa/question_detail/', moreButton: '//div[text()="その他の回答をもっと見る"]|//button[text()="…続きを読む"]|//div/button[@data-ylk="rsec:ans_re;slk:more"]/div', moreButtonInterval: 500, }, { url: '//anond.hatelabo.jp/', moreButton: '//img[@class="icon" and @src="/images/common/open.gif"]/..', moreButtonInterval: 400, //GM_addStyle("div.section p{line-height:1}") }, { url: '//news.goo.ne.jp/', moreButton: '//a[@id="topics_1_more"]|//div[last()]/a[text()="続きを読む"]', }, { url: '//togetter.com/', moreButton: '//div/a[@id="more_tweet_btn"]', }, { url: '//news.livedoor.com/topics/detail/', moreButton: '//a[(text()="記事を読む")]', }, { // url: '//news.yahoo.co.jp/pickup', moreButton: '//div/p/a[text()="続きを読む"]', }, { // url: '//www.onsen.ag', moreButton: '//a[@class="load-more-btn"]', moreButtonSame: true, moreButtonInterval: 1000, }, { // url: '//pubmed.ncbi', moreButton: '//button[@class="load-button next-page"]', moreButtonSame: true, moreButtonInterval: 1000, screenHeightCorrection: 0, /* }, { // reddit 常にBest順にしない版 url: '//www.reddit.com/r/', moreButton: '//font[contains(text(),"ディスカッション全体を表示")]|.//font[contains(text(),"ディスカッション全体を見る")]|.//button[contains(text(),"View entire discussion")]|.//button[contains(text(),"View Entire Discussion")]', moreButtonSame: false, moreButtonInterval: 500, */ }, { // reddit 常にBest順にする版 url: '//www.reddit.com/r/', moreButton: '//font[contains(text(),"ディスカッション全体を表示")]|.//font[contains(text(),"ディスカッション全体を見る")]|.//button[contains(text(),"View entire discussion")]|.//button[contains(text(),"View Entire Discussion")]|.//font[text()="ベスト"]|.//span[text()="best"]', moreButtonSame: false, moreButtonInterval: 500, /* }, { // サイトがダウン? url: '//www.ytplaylist.com', moreButton: '//li[@id="search-more-results"]/a', moreButtonInterval: 500, focusID: 'player' }, { // サイトがダウン? url: '//musictonic.com/music/', moreButton: '', focusID: 'player_container', optionFunc: 'musictonic' */ }, { // url: '//www.nicovideo.jp/my/top|//www.nicovideo.jp/user/|//www.nicovideo.jp/my', moreButton: '//div[@class="next-page"]/a|//a[@class="next-page-link timeline-next-link"]|//button[@class="NicorepoTimeline-more"]|//button[@class="ShowMoreList-more"]', moreButtonInterval: 1500, moreButtonSame: true, }, { // url: '//seiga.nicovideo.jp/seiga/', moreButton: '//a[@id="gif_play_button" and contains(text()," gifアニメを再生")]/span', moreButtonInterval: 500, }, { // url: '//duckduckgo.com/', moreButton: '//a[@class="result--more__btn btn btn--full"]', moreButtonInterval: 500, }, { // url: '//www.pixiv.net/', moreButton: '//div[text()="すべて見る"]/..', //moreButton: '//section/div[last()]/a/div[contains(text(),"すべて見る")]/..', moreButtonInterval: 2000, }, { // url: '//www.quora.com/', moreButton: '//div[text()="Continue Reading"]|//font[text()="読み続けてください"]|//font[text()="読み続けて"]', moreButtonInterval: 300, }, { // url: '', moreButton: '', moreButtonInterval: '', focusID: '', focusInterval: '' }, { // url: '//www.youtube.com', requireUrl: /\/\/www\.youtube\.com\/watch\?|\/\/www\.youtube\.com\/results\?/, moreButton: '//tp-yt-paper-button[@id="button" and @role="button" and @animated="" and @aria-label="検索フィルタ" and @aria-pressed="false"]/yt-formatted-string|//yt-formatted-string[@slot="more-button"]|//ytd-button-renderer[@id="more-replies"]|//paper-button[@id="button" and contains(aria-label,"を表示")]|//yt-formatted-string[@class="style-scope yt-next-continuation" and contains(text(),"を表示")]|//yt-formatted-string[@class="style-scope ytd-button-renderer" and contains(text(),"を表示")]|//span[@class="more-button style-scope ytd-comment-renderer" and text()="続きを読む"]|//yt-formatted-string[contains(@class,"style-scope ytd-button-renderer") and contains(text(),"を表示")]|//yt-formatted-string[@class="style-scope ytd-button-renderer"]/span[contains(text(),"を表示")]', // コメントも全展開(簡易、不完全)版 // moreButton: '//tp-yt-paper-button[@id="button" and @role="button" and @animated="" and @aria-label="検索フィルタ" and @aria-pressed="false"]/yt-formatted-string', // フィルタ展開のみ版 moreButtonInterval: 500, funcUrlChanged: () => { rest = 1; clickedalready = []; setTimeout(() => { rest = 0; elegeta('//paper-button[@id="button" and contains(aria-label,"を非表示")]|//yt-formatted-string[@class="style-scope yt-next-continuation" and contains(text(),"を非表示")]|//yt-formatted-string[@class="style-scope ytd-button-renderer" and contains(text(),"を非表示")]|//yt-formatted-string[contains(@class,"style-scope ytd-button-renderer") and contains(text(),"を非表示")]|//yt-formatted-string[@class="style-scope ytd-button-renderer"]/span[contains(text(),"を非表示")]').forEach(e => { e.click(); }); }, 3000); }, funcNeedToPause: () => { return eleget0('//div[contains(@class,"ytp-right-controls")]/button[@aria-haspopup="true" and @aria-expanded="true"]|//button[@class="ytp-button ytp-settings-button" and @data-tooltip-target-id="ytp-settings-button" and @aria-expanded="true"]') }, // true:動画の設定を開いた状態 /* }, { // url: '', // 対応させるページのURLの正規表現 matchすると有効 moreButton: '', // クリックさせる要素のXPath moreButtonSame: false, // trueなら同じボタンを何度でも押す falseなら1回のみ moreButtonInterval: '', // クリックする間隔(ms) 省略時はデフォルト(1500) focusID: 0, // trueならmoreButtonをfocusIntervalごとにfocusする focusInterval: '', // (focusIDが1のときのみ)moreButtonをfocusする間隔(ms) funcUrlChanged: null, // urlが変化した時に実行する関数 SPAで使う requireUrl: '', // urlにmatchしないと動作を飛ばす正規表現 youtubeのようなSPAで特定url以外では確実に動作を止めたいサイトでintervalごとに常時チェックしている funcNeedToPause: null, // この関数がtrueを返している間はクリックを休む youtubeで設定操作中に邪魔しないためなどで使用 screenHeightCorrection: 0, // (px)画面内と判定する縦ピクセル数の補正量 デフォルトより優先使用 */ }]; var thissite = 0; for (var i = 0; i < siteinfo.length; i++) { if (siteinfo[i].url == "") continue; if (location.href.match(siteinfo[i].url)) { thissite = i; } } var SITE = { ...siteinfo[thissite] }; var morebutton = elegeta(SITE.moreButton); var morebuttoninterval = (SITE.moreButtonInterval || moreButtonIntervalDefault) if (SITE.funcUrlChanged) { // URL変化時に実行する関数があれば登録 var observeUrlHasChangedhref = location.href; var observeUrlHasChanged = new MutationObserver(mutations => { if (observeUrlHasChangedhref !== location.href) { observeUrlHasChangedhref = location.href; SITE.funcUrlChanged(); // console.log("url has changed") } }); observeUrlHasChanged.observe(document, { childList: true, subtree: true }); } /* // DOM追加を監視 var DNIDelay = null; document.body.addEventListener('DOMNodeInserted', dnifunc, false); function dnifunc() { if (DNIDelay) { clearTimeout(DNIDelay); DNIDelay = null; } DNIDelay = setTimeout(() => { //console.time("ea") morebutton = elegeta(SITE.moreButton); //console.log("ea: " + morebutton.length) //console.timeEnd("ea") }, 1000); } */ setInterval(() => { morebutton = elegeta(SITE.moreButton); }, morebuttoninterval > 1000 ? morebuttoninterval : 1000); if (SITE.moreButton) setTimeout(() => { setInterval(kurikku, SITE.moreButtonInterval ? SITE.moreButtonInterval : moreButtonIntervalDefault); }, SITE.delay ? SITE.delay : 1); if (SITE.focusID) setInterval(focusid, SITE.focusInterval ? SITE.focusInterval : moreButtonIntervalDefault); /* if (location.href.match("musictonic")) { eleget0('//input[@id="q" and @name="q"]').value = eleget0('//h1[@class="artist"]').innerText.replace(/ Music Videos/, "") + " "; GM_addStyle("ul.videos li a { text-decoration: none; color: #999; }"); } */ return; function kurikku() { if (rest || !(location.href.match(SITE.requireUrl))) return; if (SITE.funcNeedToPause && SITE.funcNeedToPause()) return; //console.time("kuri") for (let ele of morebutton) { if (!(clickedalready.some(e => e === ele)) && isinscreen(ele)) { ele.click(); if (SITE.moreButtonSame) {} else { clickedalready.push(ele); // 一度押した break; } break; // 1度に一個しか押さない } } // console.timeEnd("kuri") } function focusid() { if (document.activeElement != document.body && document.activeElement != null && /input|textarea/i.test(document.activeElement.tagName)) return; //入力フォームなら戻る if (window.getSelection() != "") return; //選択文字列があるなら戻る if (/BODY|A/i.test(document.activeElement.tagName)) { var ele = document.getElementById(SITE.focusID); if (ele) { ele.tabIndex = 0; ele.focus(); } } } function isinscreen(ele) { if (!ele) return; var eler = ele.getBoundingClientRect(); return (eler.top > (0 - (SITE.screenHeightCorrection || SCREEN_HEIGHT_CORRECTION_DEFAULT)) && eler.left > 0 && eler.left < document.documentElement.clientWidth && eler.top < (Math.min(window.innerHeight, document.documentElement.clientHeight)) + SCREEN_HEIGHT_CORRECTION_DEFAULT); } function eleget0(xpath) { var ele = document.evaluate(xpath, document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null); return ele.snapshotLength > 0 ? ele.snapshotItem(0) : ""; } function elegeta(xpath, node = document) { var ele = document.evaluate("." + xpath, node, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null); var array = []; let l = ele.snapshotLength; for (var i = 0; i < l; i++) array[i] = ele.snapshotItem(i); return array; } })();