您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Automatically paginate the OpenCart My Downloads page.
// ==UserScript== // @name Show all OpenCart downloads // @namespace https://peschar.net/userscripts/show-all-opencart-downloads // @version 0.1 // @description Automatically paginate the OpenCart My Downloads page. // @author You // @match https://www.opencart.com/*?*route=account/download* // @grant none // ==/UserScript== (function() { 'use strict'; const seen = {}; paginate(); function paginate() { const nextPage = document.querySelector('#account-download nav li.active + li a[href]'); if (!nextPage) { return; } const nextUrl = nextPage.href; if (seen[nextUrl]) { return; } seen[nextUrl] = true; console.log("GET", nextUrl); fetch(nextUrl) .then(r => r.text()) .then(t => { const body = document.createElement('div'); body.innerHTML = t; const nav = body.querySelector('#account-download nav'); if (!nav) { return; } replaceElement(document.querySelector('#account-download nav'), nav); body.querySelectorAll('#downloads-list').forEach(item => nav.parentNode.insertBefore(item, nav)); paginate(); }); } function replaceElement(oldElement, newElement) { oldElement.parentNode.replaceChild(newElement, oldElement); } })();