您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
AMP sucks, thus no AMP thanks.
当前为
- // ==UserScript==
- // @name deAMP
- // @description AMP sucks, thus no AMP thanks.
- // @author Jason Kwok
- // @namespace https://jasonhk.dev/
- // @version 1.0.0
- // @license MIT
- // @match http*://*/*
- // @run-at document_end
- // @grant none
- // ==/UserScript==
- const isAmp = (document.querySelector("html[⚡], html[amp]") !== null);
- const canonical = document.head.querySelector("link[rel=canonical][href]");
- if (isAmp && (canonical !== null))
- {
- const lastVisit = sessionStorage.getItem("deAmp.lastVisit");
- if (location.href !== lastVisit)
- {
- sessionStorage.setItem("deAmp.lastVisit", location.href);
- location.replace(canonical.href);
- }
- else
- {
- sessionStorage.removeItem("deAmp.lastVisit");
- }
- }
- else
- {
- console.debug("[deAMP] Not a valid AMP page.");
- sessionStorage.removeItem("deAmp.lastVisit");
- }