您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Default to Legacy instead of Disney Canon.
// ==UserScript== // @name Wookieepedia Default to Legacy // @namespace https://holocronweaver.com/ // @version 0.1 // @description Default to Legacy instead of Disney Canon. // @author holocronweaver // @match http://starwars.wikia.com/* // @grant none // ==/UserScript== (function() { 'use strict'; // Check if this page has Canon/Legacy duality and find Legacy URL. var canontabLegendsFields = document.evaluate( "//table[@id='canontab']//td[@id='canontab-legends']//a", document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null); // Avoid infinite loop. var legendsNotInUrl = window.location.pathname.search(/Legends$/i) == -1; // If previous page was Legends, do nothing since user wanted to see the Canon page. var prevPageIsNotLegends = document.referrer.search(/Legends$/i) == -1; if (canontabLegendsFields.snapshotLength > 0 && legendsNotInUrl && prevPageIsNotLegends) { var a = canontabLegendsFields.snapshotItem(0); window.location = a.href; } })();