// ==UserScript== // @name コミックDAYS&くらげバンチ&マガポケ&ジャンプ+&となりのヤングジャンプ 左キーだけでどんどん読む // @description 「次の話を読む」や「この作品の無料公開中の話へ」ボタンが出た時に左キーでそれをクリックします Enterで最新話に移動 fや[で全画面化 // @match *://comic-days.com/episode/* // @match *://kuragebunch.com/episode/* // @match *://pocket.shonenmagazine.com/episode/* // @match *://shonenjumpplus.com/episode/* // @match *://tonarinoyj.jp/episode/* // @run-at document-idle // @grant none // @version 0.2 // @namespace https://greasyfork.org/users/181558 // @downloadURL none // ==/UserScript== (function() { var nextl = '//div[@class="viewer-colophon-info-wrapper"]/div[@class="viewer-colophon-info"]/p[@class="viewer-colophon-next-episode"]/a[@class="next-link test-back-matter-next-link"]|//a[@class="next-episode-free-link common-button"]|//a[@class="next-open-link"]'; var ele = eleget0(nextl); if (ele) ele.innerText += " (←)"; var lastl = '//div[@class="js-readable-product-list"]/div[1]/ul[1]/li[1]/a/div/h4|//div[@class="js-readable-product-list"]/ul[1]/li[1]/a/div/h4'; var ele = eleget0(lastl); if (ele) ele.innerText += " (Enter)"; document.addEventListener('keydown', function(e) { if (/input|textarea/i.test(e.target.tagName) == false) { if (!e.getModifierState("Alt") && !e.getModifierState("Control") && !e.getModifierState("Shift") && e.key == "ArrowLeft") { // 左キー var ele = eleget0(nextl); if (isinscreen(ele)) { ele.focus(); ele.click() } } if (!e.getModifierState("Alt") && !e.getModifierState("Control") && !e.getModifierState("Shift") && e.key == "Enter") { // Enterキー var ele = eleget0(lastl); if (ele) { ele.parentNode.parentNode.focus(); ele.parentNode.parentNode.click() } } if (!e.getModifierState("Alt") && !e.getModifierState("Control") && !e.getModifierState("Shift") && (e.key == "f" || e.key == "[")) { // f [ 全画面化 var y = window.pageYOffset; var doc = window.document; var docEl = doc.documentElement; var requestFullScreen = docEl.requestFullscreen || docEl.mozRequestFullScreen || docEl.webkitRequestFullScreen || docEl.msRequestFullscreen; var cancelFullScreen = doc.exitFullscreen || doc.mozCancelFullScreen || doc.webkitExitFullscreen || doc.msExitFullscreen; if (!doc.fullscreenElement && !doc.mozFullScreenElement && !doc.webkitFullscreenElement && !doc.msFullscreenElement) { requestFullScreen.call(docEl); } else { cancelFullScreen.call(doc); } setTimeout(window.scroll, 100, 0, y); } } }, false); return function eleget0(xpath) { var ele = document.evaluate(xpath, document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null); return ele.snapshotLength > 0 ? ele.snapshotItem(0) : ""; } function isinscreen(ele) { var eler = ele.getBoundingClientRect(); return ele && (eler.top > 0 && eler.left > 0 && eler.left < window.parent.screen.width && eler.top < window.parent.screen.height); } })();