AWSW better navigation

Make img fullsize and add navigations with ← → keys

// ==UserScript==
// @name         AWSW better navigation
// @namespace    https://gf.qytechs.cn/ru/users/303426
// @version      1.0.1
// @description  Make img fullsize and add navigations with ← → keys
// @author       Титан
// @match        https://angelswithscalywings.com/comics/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=angelswithscalywings.com
// @require      https://cdn.jsdelivr.net/npm/[email protected]/src/arrive.min.js
// @grant        none
// @license      MIT
// ==/UserScript==

(function() {
	'use strict';
	var styles = `
    img {
    width: unset;
    }
`
	var styleSheet = document.createElement("style")
	styleSheet.textContent = styles
	document.head.appendChild(styleSheet)
	console.log("[AWSW BN] AWSW better navigation loded");

	document.arrive("div.comics-navigation", {onceOnly: false, existing: true},function(newElem) {
		console.log("[AWSW BN] comics-navigation arrived");
		addNavHotkeys(newElem);
	}, );

	function addNavHotkeys(comicsNavigation){
		console.log("[AWSW BN] injecting hotkeys of navigation");

		let comicNavChilds = comicsNavigation.children;
		//: buttons in comicsNavigation
		let firstPage = comicNavChilds[0];
		let prevPage = comicNavChilds[1];
		let nextPage = comicNavChilds[2];
		let lastPage = comicNavChilds[3];

		document.addEventListener('keydown', function(event) {
			if (event.key === 'ArrowRight') {
				//: if alt is holding
				if (event.altKey) {
					lastPage.click();
				}
				else {
					nextPage.click();
				}
			}

			if (event.key === 'ArrowLeft') {
				//: if alt is holding
				if (event.altKey) {
					firstPage.click();
				}
				else {
					prevPage.click();
				}
			}
		});
	}

})();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址