您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
A small script to skip the silly countdown of One Piece Ex website
当前为
- // ==UserScript==
- // @name OpEx Countdown Skip
- // @name:pt-BR OpEx Pula Tempo de Espera
- // @autor SecretX
- // @namespace namespace_secretx
- // @description A small script to skip the silly countdown of One Piece Ex website
- // @description:pt-br Um pequeno script para pular o contador irritante do site OpEx
- // @version 2022.03.12
- // @match *://onepieceex.net/download/?*
- // @grant none
- // @icon https://onepieceex.net/favicon/favicon-32x32.png
- // @license GNU LGPLv3
- // ==/UserScript==
- Object.defineProperty(Array.prototype, "firstNotNull", {
- value: function firstNotNull() {
- for (const element of this) if (element != null) return element;
- throw new Error("Array contains no non null element.");
- },
- writable: true,
- configurable: true
- });
- function fallback() {
- // if everything else fails, at least set the countdown to 1
- countElem().innerHTML = 1;
- }
- const countElem = () => document.getElementById('contador');
- const countdownScript = () => document.querySelector("body > script:nth-child(4)").innerText;
- function firstScriptLineThatMatches(regex) {
- return countdownScript().split("\n")
- .map(line => line.trim().match(regex))
- .firstNotNull();
- }
- function haltCountdown() {
- try {
- countElem().remove();
- } catch (e) {}
- }
- window.addEventListener("DOMContentLoaded", function() {
- 'use strict';
- const magnetLinkRegex = /^.+?href="(magnet[^"]+)".*$/i;
- try {
- const magnetLink = firstScriptLineThatMatches(magnetLinkRegex)[1];
- console.info(`Automatically redirecting you to the extracted magnet link from this page: ${magnetLink}`);
- haltCountdown();
- window.location.replace(magnetLink);
- } catch (e) {
- console.error(`Oops, this script was not able to automatically grab the magnet link from this page because of an error. Using fallback that set the countdown to 1. ${e}`);
- fallback();
- }
- }, false);