thoughts-ui优化

优化Thoughs样式

  1. // ==UserScript==
  2. // @require http://code.jquery.com/jquery-3.4.1.min.js
  3. // @name thoughts-ui优化
  4. // @namespace http://tampermonkey.net/
  5. // @version 0.2
  6. // @description 优化Thoughs样式
  7. // @author 邱道长
  8. // @include *://thoughts.teambition.com/*
  9. // @grant none
  10. // ==/UserScript==
  11.  
  12.  
  13. (function() {
  14. 'use strict';
  15. window.setTimeout(function() {
  16. $(function() {
  17. $('h2 span[data-slate-content]').css('marginLeft','1em');
  18. $('h2').css('backgroundColor','#64ACE4').css('color','white')
  19. .css('marginLeft','0');
  20. // 普通段落设置
  21. $('span[data-slate-content]').css('fontSize','24px');
  22. $('p').css('textIndent','50px');
  23. // 有序列表数字符号字体大小和普通段落,字体大小保持一致,否则会不协调。
  24. $('.number__31Gh').css('fontSize','24px');
  25. $('h1 span').css('fontSize','36px');// 一级标题设置字体
  26. $('h1').css('textAlign','center');
  27. $('a').css('fontSize','18px');//修改链接字体
  28.  
  29. // 给所有的标题添加编号,要求只能有一个一级标题,并且里面必须写上前缀比如 2.1 后面要跟上一个空格以方便截取
  30. // 二级标记则开始2.1
  31. // 获取一级标题内容
  32. var h1vs = $('h1 span[data-slate-content]').text().split(' ');
  33. var h2Prex = null;
  34. if(h1vs != null && h1vs != '') {
  35. h2Prex = h1vs[0];
  36. }
  37. // 获取所有的h2
  38. $('h2 span[data-slate-content]').each(function(index) {
  39. $(this).text(h2Prex + '.' + (index+1) + ' ' + $(this).text());
  40. });
  41. })
  42. },1500)// 延时执行防止渲染不出来
  43. })();