CssUtil

css utility methods

Version vom 04.07.2022. Aktuellste Version

Dieses Skript sollte nicht direkt installiert werden. Es handelt sich hier um eine Bibliothek für andere Skripte, welche über folgenden Befehl in den Metadaten eines Skriptes eingebunden wird // @require https://update.greatest.deepsurf.us/scripts/393202/1067207/CssUtil.js

// ==UserScript==
// @name CssUtil
// @name:CN-zh_cn css工具类
// @version 0.1
// @description css utility methods
// @author gaojr
// @namespace https://github.com/gaojr/scripts-styles
// @grant GM_addStyle
// @match https://*/*
// ==/UserScript==

/**
 * 隐藏
 * @param selector 选择器
 */
const hide = function (selector) {
  GM_addStyle(selector + ' { display: none!important;height: 0!important;width: 0!important; }');
};
/**
 * 取消浮动
 * @param selector 选择器
 */
const floatNone = function (selector) {
  GM_addStyle(selector + ' { float: none; }');
};

/**
 * 左右居中
 * @param selector 选择器
 */
const marginCenter = function (selector) {
  GM_addStyle(selector + ' { margin-left: auto;margin-right: auto; }');
};

/**
 * 左右居中
 * @param selector 选择器
 */
const clearCenter = function (selector) {
  floatNone(selector);
  marginCenter(selector);
};