Wenku8++ basic assets support
当前为
此脚本不应直接安装。它是供其他脚本使用的外部库,要使用该库请加入元指令 // @require https://update.cn-greasyfork.org/scripts/449712/1085778/assets.js
/* eslint-disable no-multi-spaces */
/* eslint-disable userscripts/no-invalid-headers */
/* eslint-disable userscripts/no-invalid-grant */
/* eslint-disable no-implicit-globals */
// ==UserScript==
// @name assets
// @namespace Wenku8++
// @version 0.1
// @description Wenku8++ basic assets support
// @author PY-DNG
// @license GPL-v3
// @regurl https?://www\.wenku8\.net/.*
// ==/UserScript==
(function() {
const ClassName = {
Button: 'plus_btn',
Text: 'plus_text'
};
const URL = {};
const CSS = {
Button_Text_Disabled: '.{CT} {color: rgb(30, 100, 220) !important;} .{CB} {color: rgb(0, 160, 0) !important; cursor: pointer !important; user-select: none;} .{CB}:hover {color: rgb(0, 100, 0) !important;} .{CB}:focus {color: rgb(0, 100, 0) !important;} .{CB}.{CD} {color: rgba(150, 150, 150) !important; cursor: not-allowed !important;}'.replaceAll('{CB}', CLASSNAME_BUTTON).replaceAll('{CT}', CLASSNAME_TEXT).replaceAll('{CD}', CLASSNAME_DISABLED)
};
const Number = {
Interval: 500
};
const Text = {
'zh-CN': {}
};
// Init language
let i18n = navigator.language;
let i18n_default = 'zh-CN';
if (!Object.keys(Text).includes(i18n)) {i18n = i18n_default;}
// Common css
addStyle(CSS.Button_Text_Disabled);
// Export
exports = {
ClassName: ClassName,
URL: URL,
CSS: CSS,
Number: Number,
Text: Text[i18n],
Text_Full: Text
}
// Append a style text to document(<head>) with a <style> element
function addStyle(css, id) {
const style = document.createElement("style");
id && (style.id = id);
style.textContent = css;
for (const elm of document.querySelectorAll('#' + id)) {
elm.parentElement && elm.parentElement.removeChild(elm);
}
document.head.appendChild(style);
}
}) ();