您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
R4 Utils Library
当前为
此脚本不应直接安装。它是供其他脚本使用的外部库,要使用该库请加入元指令 // @require https://update.gf.qytechs.cn/scripts/482597/1298686/R4%20Utils.js
- // ==UserScript==
- // @name R4 Utils
- // @description R4 Utils Library
- // @version 1.0.0
- // ==/UserScript==
- function R4Utils() {
- function fromHTML(html, trim = true) {
- // Process the HTML string.
- html = trim ? html : html.trim();
- if (!html) return null;
- // Then set up a new template element.
- const template = document.createElement('template');
- template.innerHTML = html;
- const result = template.content.children;
- // Then return either an HTMLElement or HTMLCollection,
- // based on whether the input HTML had one or more roots.
- if (result.length === 1) return result[0];
- return result;
- }
- function transliterate(word) {
- let answer = "";
- const a = {};
- a["Ё"] = "YO";
- a["Й"] = "I";
- a["Ц"] = "TS";
- a["У"] = "U";
- a["К"] = "K";
- a["Е"] = "E";
- a["Н"] = "N";
- a["Г"] = "G";
- a["Ш"] = "SH";
- a["Щ"] = "SCH";
- a["З"] = "Z";
- a["Х"] = "H";
- a["Ъ"] = "'";
- a["ё"] = "yo";
- a["й"] = "i";
- a["ц"] = "ts";
- a["у"] = "u";
- a["к"] = "k";
- a["е"] = "e";
- a["н"] = "n";
- a["г"] = "g";
- a["ш"] = "sh";
- a["щ"] = "sch";
- a["з"] = "z";
- a["х"] = "h";
- a["ъ"] = "'";
- a["Ф"] = "F";
- a["Ы"] = "I";
- a["В"] = "V";
- a["А"] = "A";
- a["П"] = "P";
- a["Р"] = "R";
- a["О"] = "O";
- a["Л"] = "L";
- a["Д"] = "D";
- a["Ж"] = "ZH";
- a["Э"] = "E";
- a["ф"] = "f";
- a["ы"] = "i";
- a["в"] = "v";
- a["а"] = "a";
- a["п"] = "p";
- a["р"] = "r";
- a["о"] = "o";
- a["л"] = "l";
- a["д"] = "d";
- a["ж"] = "zh";
- a["э"] = "e";
- a["Я"] = "Ya";
- a["Ч"] = "CH";
- a["С"] = "S";
- a["М"] = "M";
- a["И"] = "I";
- a["Т"] = "T";
- a["Ь"] = "'";
- a["Б"] = "B";
- a["Ю"] = "YU";
- a["я"] = "ya";
- a["ч"] = "ch";
- a["с"] = "s";
- a["м"] = "m";
- a["и"] = "i";
- a["т"] = "t";
- a["ь"] = "'";
- a["б"] = "b";
- a["ю"] = "yu";
- for (const i in word) {
- if (word.hasOwnProperty(i)) {
- answer += a[word[i]] === undefined ? word[i] : a[word[i]];
- }
- }
- return answer;
- }
- function slugify(str) {
- return String(str)
- .normalize("NFKD") // split accented characters into their base characters and diacritical marks
- .replace(/[\u0300-\u036f]/g, "") // remove all the accents, which happen to be all in the \u03xx UNICODE block.
- .trim() // trim leading or trailing whitespace
- .toLowerCase() // convert to lowercase
- .replace(/[^a-z0-9 -]/g, "") // remove non-alphanumeric characters
- .replace(/\s+/g, "-") // replace spaces with hyphens
- .replace(/-+/g, "-"); // remove consecutive hyphens
- }
- return {
- fromHTML,
- transliterate,
- slugify,
- };
- }
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址