您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Provides utility functions to make your geoguessr scripts independent of arbitrary changes to class name suffixes
当前为
此脚本不应直接安装。它是供其他脚本使用的外部库,要使用该库请加入元指令 // @require https://update.cn-greasyfork.org/scripts/460322/1151654/Geoguessr%20Styles%20Scan.js
- // ==UserScript==
- // @name Geoguessr Styles Scan
- // @description Provides utility functions to make your geoguessr scripts independent of arbitrary changes to class name suffixes
- // @version 1.0.0
- // @author victheturtle#5159
- // @license MIT
- // @namespace https://greasyfork.org/users/967692-victheturtle
- // ==/UserScript==
- const _cndic = {};
- const _hrefset = new Set();
- async function scanStyles() {
- for (let node of document.querySelectorAll('head link[rel="preload"], head style[data-n-href*=".css"]')) {
- const href = node.href || location.origin+node.dataset.nHref;
- if (_hrefset.has(href)) continue;
- _hrefset.add(href);
- await fetch(href)
- .then(res => res.text())
- .then(stylesheet => {
- for (let className of stylesheet.split(".")) {
- const ind = className.indexOf("__");
- if (ind != -1) _cndic[className.substr(0, ind+2)] = className.substr(0, ind+7);
- };
- });
- };
- };
- const cn = (classNameStart) => _cndic[classNameStart]; // cn("status_section__") -> "status_section__8uP8o"
- const checkAllStylesFound = (STYLES_USED) => STYLES_USED.reduce((res, className) => res && cn(className), true);