您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
You can quickly access the previous and next episodes, perform smooth scrolling up or down, and even enable or disable full-screen mode. This script is designed to enhance the reading experience of web content such as manga and comics in a more convenient and efficient way.
当前为
- // ==UserScript==
- // @name SmoothScroll & Navigation Enhancer
- // @namespace http://tampermonkey.net/
- // @version 1.3
- // @description You can quickly access the previous and next episodes, perform smooth scrolling up or down, and even enable or disable full-screen mode. This script is designed to enhance the reading experience of web content such as manga and comics in a more convenient and efficient way.
- // @match https://westmanga.info/*
- // @match https://komikcast.vip/*
- // @match https://aquamanga.com/read/*
- // @match https://www.webtoons.com/*
- // @match https://kiryuu.id/*
- // @match https://mangatale.co/*
- // @grant none
- // @license MIT
- // ==/UserScript==
- (function() {
- 'use strict';
- var scrollInterval = null;
- var isScrolling = false
- var isFullscreen = false;
- var activeElement;
- var smoothScrollSpeed = 9; // Kecepatan pengguliran yang mulus
- var smoothScrollDelay = 10; // Penundaan di antara setiap langkah pengguliran yang mulus
- function smoothScrollStep(direction) {
- var scrollDistance = direction === 'up' ? -smoothScrollSpeed : smoothScrollSpeed;
- window.scrollBy(0, scrollDistance);
- }
- function startSmoothScrolling(direction) {
- if (!isScrolling) {
- isScrolling = true;
- smoothScrollStep(direction);
- scrollInterval = setInterval(function() {
- smoothScrollStep(direction);
- }, smoothScrollDelay);
- }
- }
- function stopSmoothScrolling() {
- if (isScrolling) {
- isScrolling = false;
- clearInterval(scrollInterval);
- }
- }
- document.addEventListener('keydown', function(event) {
- if ((event.key === 'a' || event.key === 'A' || event.key === 'ArrowLeft') && !event.ctrlKey && !event.altKey && event.key !== 'Tab') {
- var prevButton;
- if (window.location.host === 'westmanga.info') {
- prevButton = document.querySelector('.ch-prev-btn');
- } else if (window.location.host === 'komikcast.vip') {
- prevButton = document.querySelector('.nextprev a[rel="prev"]');
- } else if (window.location.host === 'aquamanga.com') {
- prevButton = document.querySelector('a.btn.prev_page');
- } else if (window.location.host === 'kiryuu.id') {
- prevButton = document.querySelector('a.ch-prev-btn');
- } else if (window.location.host === 'www.webtoons.com') {
- prevButton = document.querySelector('a[title="Episode sebelumnya"]');
- } else if (window.location.host === 'mangatale.co') {
- prevButton = document.querySelector('a.ch-prev-btn');
- }
- if (prevButton) {
- // Periksa elemen yang sedang dalam fokus
- activeElement = document.activeElement;
- if (!(activeElement && (activeElement.tagName === 'INPUT' || activeElement.tagName === 'TEXTAREA'))) {
- // Pengguna tidak sedang mengetik
- prevButton.click();
- }
- }
- } else if ((event.key === 'd' || event.key === 'D' || event.key === 'ArrowRight') && !event.ctrlKey && !event.altKey && event.key !== 'Tab') {
- var nextButton;
- if (window.location.host === 'westmanga.info') {
- nextButton = document.querySelector('.ch-next-btn');
- } else if (window.location.host === 'komikcast.vip') {
- nextButton = document.querySelector('.nextprev a[rel="next"]');
- } else if (window.location.host === 'aquamanga.com') {
- nextButton = document.querySelector('a.btn.next_page');
- } else if (window.location.host === 'kiryuu.id') {
- nextButton = document.querySelector('a.ch-next-btn');
- } else if (window.location.host === 'www.webtoons.com') {
- nextButton = document.querySelector('a[title="Episode selanjutnya"]');
- } else if (window.location.host === 'mangatale.co') {
- nextButton = document.querySelector('a.ch-next-btn');
- }
- if (nextButton) {
- // Periksa elemen yang sedang dalam fokus
- activeElement = document.activeElement;
- if (!(activeElement && (activeElement.tagName === 'INPUT' || activeElement.tagName === 'TEXTAREA'))) {
- // Pengguna tidak sedang mengetik
- nextButton.click();
- }
- }
- } else if ((event.key === 's' || event.key === 'S') && !event.ctrlKey && !event.altKey && event.key !== 'Tab') {
- // Periksa elemen yang sedang dalam fokus
- activeElement = document.activeElement;
- if (!(activeElement && (activeElement.tagName === 'INPUT' || activeElement.tagName === 'TEXTAREA'))) {
- // Pengguna tidak sedang mengetik
- startSmoothScrolling('down');
- }
- } else if ((event.key === 'w' || event.key === 'W') && !event.ctrlKey && !event.altKey && event.key !== 'Tab') {
- // Periksa elemen yang sedang dalam fokus
- activeElement = document.activeElement;
- if (!(activeElement && (activeElement.tagName === 'INPUT' || activeElement.tagName === 'TEXTAREA'))) {
- // Pengguna tidak sedang mengetik
- startSmoothScrolling('up');
- }
- } else if ((event.key === 'f' || event.key === 'F') && !event.ctrlKey && !event.altKey && event.key !== 'Tab') {
- // Periksa elemen yang sedang dalam fokus
- activeElement = document.activeElement;
- if (!(activeElement && (activeElement.tagName === 'INPUT' || activeElement.tagName === 'TEXTAREA'))) {
- // Pengguna tidak sedang mengetik, masuk ke mode fullscreen
- event.preventDefault();
- toggleFullscreen(); // Fungsi Anda untuk masuk/keluar dari mode fullscreen
- }
- } else if ((event.key === 'q' || event.key === 'Q') && !event.ctrlKey && !event.altKey && event.key !== 'Tab') {
- var allChapterButton;
- if (window.location.host === 'westmanga.info') {
- allChapterButton = document.querySelector('.allc a');
- } else if (window.location.host === 'www.webtoons.com') {
- allChapterButton = document.querySelector('a[class="subj NPI=a:end,g:in_id"]');
- } else if (window.location.host === 'kiryuu.id') {
- allChapterButton = document.evaluate("//div[contains(text(), 'Semua chapter ada di')]/a", document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;
- } else if (window.location.host === 'komikcast.vip') {
- allChapterButton = document.querySelector('div.allc a');
- } else if (window.location.host === 'mangatale.co') {
- allChapterButton = document.evaluate("//div[contains(text(), 'All chapters are in ')]/a", document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;
- } else if (window.location.host === 'aquamanga.com') {
- // Ambil URL saat ini
- var currentUrl = window.location.href;
- // Gunakan ekspresi reguler untuk menghapus segmen URL setelah judul komik
- var newUrl = currentUrl.replace(/\/read\/([^/]+)\/.*/, '/read/$1/');
- // Periksa elemen yang sedang dalam fokus
- activeElement = document.activeElement;
- if (!(activeElement && (activeElement.tagName === 'INPUT' || activeElement.tagName === 'TEXTAREA'))) {
- // Pengguna tidak sedang mengetik memindahkan pengguna ke URL yang telah diubah
- window.location.href = newUrl;
- }
- }
- if (allChapterButton) {
- // Periksa elemen yang sedang dalam fokus
- activeElement = document.activeElement;
- if (!(activeElement && (activeElement.tagName === 'INPUT' || activeElement.tagName === 'TEXTAREA'))) {
- // Pengguna tidak sedang mengetik
- allChapterButton.click();
- }
- }
- }
- });
- function toggleFullscreen() {
- if (!isFullscreen) {
- enterFullscreen();
- } else {
- exitFullscreen();
- }
- isFullscreen = !isFullscreen;
- }
- function enterFullscreen() {
- const elem = document.documentElement;
- if (elem.requestFullscreen) {
- elem.requestFullscreen();
- } else if (elem.mozRequestFullScreen) {
- elem.mozRequestFullScreen();
- } else if (elem.webkitRequestFullscreen) {
- elem.webkitRequestFullscreen();
- } else if (elem.msRequestFullscreen) {
- elem.msRequestFullscreen();
- }
- }
- function exitFullscreen() {
- if (document.exitFullscreen) {
- document.exitFullscreen();
- } else if (document.mozCancelFullScreen) {
- document.mozCancelFullScreen();
- } else if (document.webkitExitFullscreen) {
- document.webkitExitFullscreen();
- } else if (document.msExitFullscreen) {
- document.msExitFullscreen();
- }
- }
- document.addEventListener('keyup', function(event) {
- if ((event.key === 's' || event.key === 'S' || event.key === 'w' || event.key === 'W') && !event.ctrlKey && !event.altKey && event.key !== 'Tab') {
- stopSmoothScrolling();
- window.scrollTo(window.pageXOffset, window.pageYOffset); // Menghentikan scroll secara instan
- }
- });
- })();