Greasy Fork is available in English.

CssUtil

css utility methods

Verzia zo dňa 02.12.2019. Pozri najnovšiu verziu.

Tento skript by nemal byť nainštalovaný priamo. Je to knižnica pre ďalšie skripty, ktorú by mali používať cez meta príkaz // @require https://update.greatest.deepsurf.us/scripts/393202/754549/CssUtil.js

  1. // ==UserScript==
  2. // @author gaojr
  3. // @namespace https://github.com/gaojr/tampermonkey-scripts
  4. // @name:CN-zh_cn css工具类
  5. // @name CssUtil
  6. // @version 0.1
  7. // @description css utility methods
  8. // @grant GM_addStyle
  9. // ==/UserScript==
  10.  
  11. /**
  12. * 隐藏
  13. * @param selector 选择器
  14. */
  15. const hide = function (selector) {
  16. GM_addStyle(selector + ' { display: none!important;height: 0!important;width: 0!important; }');
  17. };
  18. /**
  19. * 取消浮动
  20. * @param selector 选择器
  21. */
  22. const floatNone = function (selector) {
  23. GM_addStyle(selector + ' { float: none; }');
  24. };
  25.  
  26. /**
  27. * 左右居中
  28. * @param selector 选择器
  29. */
  30. const marginCenter = function (selector) {
  31. GM_addStyle(selector + ' { margin-left: auto;margin-right: auto; }');
  32. };
  33.  
  34. /**
  35. * 左右居中
  36. * @param selector 选择器
  37. */
  38. const clearCenter = function (selector) {
  39. floatNone(selector);
  40. marginCenter(selector);
  41. };