WikiIndent

Four visual improvements for Wikipedia (and other wikis): Indents sub-sections to make the layout clearer. Hides the sidebar (toggle by clicking the header). Floats the Table of Contents for access when scrolled. Converts heading underlines to overlines.

当前为 2015-01-24 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name WikiIndent
  3. // @namespace joeytwiddle
  4. // @description Four visual improvements for Wikipedia (and other wikis): Indents sub-sections to make the layout clearer. Hides the sidebar (toggle by clicking the header). Floats the Table of Contents for access when scrolled. Converts heading underlines to overlines.
  5. // @downstreamURL http://userscripts.org/scripts/source/60832.user.js
  6. // @version 1.2.6
  7. // @include *wiki*
  8. // @include http://www.buzztard.com/*
  9. // @include http://encyclopediadramatica.com/*
  10. // @include http://www.wormus.com/leakytap/*
  11. // @include http://theinfosphere.org/*
  12. // @include http://rosettacode.org/mw/*
  13. // @grant GM_setValue
  14. // @grant GM_addStyle
  15. // @grant GM_getValue
  16. // @grant GM_log
  17. // ==/UserScript==
  18.  
  19. // Without this function wrapper, Mozilla Firefox rejects the whole script, because it sees the top-level 'return;' as invalid syntax!
  20.  
  21. (function(){
  22.  
  23. // Feature #1 : Make the sidebar collapsible so the page content can fill the whole width.
  24.  
  25. var toggleSidebar = true;
  26.  
  27. // Feature #2 : Float the TOC on the top-right of the screen, so it can still be used after scrolling down the page.
  28.  
  29. var makeTableOfContentsFloat = true;
  30.  
  31. // Feature #3 : Indent the blocks so their tree-like structure is visible.
  32.  
  33. var indentSubBlocks = true;
  34.  
  35. // Feature #4 : Change underlined headings to overlined headings. (So the lines separate the heading from the previous section, rather than separating the heading from its content.)
  36.  
  37. var fixUnderlinesToOverlines = true;
  38.  
  39.  
  40.  
  41. // var minimisedSidebarSize = 6; // Small
  42. var minimisedSidebarSize = 16;
  43.  
  44. // Wikipedia's new transition displays the sidebar text before there is space
  45. // for it, causing brief ugly overlap! So we delay unhiding to look prettier.
  46. var delayHide = 0;
  47. var delayUnhide = ( document.getElementById("mw-panel") ? 250 : 0 );
  48.  
  49. var debug = false;
  50.  
  51.  
  52.  
  53. /* CONSIDER: As we scroll the page, light up the "current" section in the TOC.
  54. *
  55. * FIXED: One occasional problem with the TOC is when it is taller than the
  56. * window! (I usually work around this by zooming out (reducing font
  57. * size), but perhaps we can use CSS overflow to solve it properly.)
  58. *
  59. * NOTE: The sidebar toggle now animates smoothly. This is caused by animation
  60. * rules in Wikipedia's CSS. I don't know why they are there, I haven't seen
  61. * anything that makes use of them, except by circumstance, this script!
  62. *
  63. * TODO: Indentation was not working well in edit preview on Hwiki(MW).
  64. */
  65.  
  66. /* Changelog
  67. * 5/ 2/2012 - Better (though more fragile) click-to-toggle areas.
  68. * 3/ 1/2012 - Fixed Chrome compatibility so it works! Doh.
  69. * 23/ 3/2011 - Added Chrome compatibility.
  70. */
  71.  
  72. // Recent versions do not play nice together, so just in case we run WI twice:
  73. if (unsafeWindow.WikiIndent_loaded) {
  74. return;
  75. } else {
  76. unsafeWindow.WikiIndent_loaded = true;
  77. }
  78.  
  79. function log(x) {
  80. x = "[WI] "+x;
  81. if (this.GM_log) {
  82. this.GM_log(x);
  83. } else if (this.console && console.log) {
  84. console.log(x);
  85. } else {
  86. window.status = ""+x;
  87. // alert(x);
  88. }
  89. }
  90.  
  91. // For bookmarklets:
  92. if (typeof GM_addStyle == "undefined") {
  93. GM_addStyle = function(css) {
  94. var head, style;
  95. head = document.getElementsByTagName("head")[0];
  96. if (!head) { return; }
  97. style = document.createElement("style");
  98. style.type = "text/css";
  99. style.innerHTML = css;
  100. head.appendChild(style);
  101. };
  102. }
  103.  
  104. if (typeof GM_setValue == 'undefined' || window.navigator.vendor.match(/Google/)) {
  105. GM_log("WikiIndent: Adding fallback implementation of GM_set/getValue");
  106.  
  107. if (typeof localStorage == 'undefined') {
  108.  
  109. GM_getValue = function(name, defaultValue) {
  110. return defaultValue;
  111. };
  112.  
  113. } else {
  114.  
  115. GM_setValue = function(name, value) {
  116. value = (typeof value)[0] + value;
  117. localStorage.setItem(name, value);
  118. };
  119.  
  120. GM_getValue = function(name, defaultValue) {
  121. var value = localStorage.getItem(name);
  122. if (!value)
  123. return defaultValue;
  124. var type = value[0];
  125. value = value.substring(1);
  126. switch (type) {
  127. case 'b':
  128. return value == 'true';
  129. case 'n':
  130. return Number(value);
  131. default:
  132. return value;
  133. }
  134. };
  135.  
  136. }
  137.  
  138. }
  139.  
  140.  
  141.  
  142. // The following block is mirrored in table_of_contents_everyw.user.js
  143.  
  144. // See also: resetProps
  145. function clearStyle(elem) {
  146. // We set some crucial defaults, so we don't inherit CSS from the page:
  147. elem.style.display = 'inline';
  148. elem.style.position = 'static';
  149. elem.style.top = 'auto';
  150. elem.style.right = 'auto';
  151. elem.style.bottom = 'auto';
  152. elem.style.left = 'auto';
  153. elem.style.color = 'black';
  154. elem.style.backgroundColor = 'white';
  155. return elem;
  156. }
  157.  
  158. function newNode(tag,data) {
  159. var elem = document.createElement(tag);
  160. if (data) {
  161. for (var prop in data) {
  162. elem[prop] = data[prop];
  163. }
  164. }
  165. return elem;
  166. }
  167.  
  168. function newSpan(text) {
  169. return clearStyle(newNode("span",{textContent:text}));
  170. }
  171.  
  172. function addCloseButtonTo(where, toc) {
  173. var closeButton = newSpan("[X]");
  174. // closeButton.style.float = 'right';
  175. // closeButton.style.cssFloat = 'right'; // Firefox
  176. // closeButton.style.styleFloat = 'right'; // IE7
  177. closeButton.style.cursor = 'pointer';
  178. closeButton.style.paddingLeft = '5px';
  179. closeButton.onclick = function() { toc.parentNode.removeChild(toc); };
  180. closeButton.id = "closeTOC";
  181. where.appendChild(closeButton);
  182. }
  183.  
  184. function addHideButtonTo(toc, tocInner) {
  185. var rollupButton = newSpan("[hide]");
  186. // rollupButton.style.float = 'right';
  187. // rollupButton.style.cssFloat = 'right'; // Firefox
  188. // rollupButton.style.styleFloat = 'right'; // IE7
  189. rollupButton.style.cursor = 'pointer';
  190. rollupButton.style.paddingLeft = '10px';
  191. function toggleRollUp() {
  192. if (tocInner.style.display == 'none') {
  193. tocInner.style.display = '';
  194. rollupButton.textContent = "[hide]";
  195. } else {
  196. tocInner.style.display = 'none';
  197. rollupButton.textContent = "[show]";
  198. }
  199. setTimeout(function(){
  200. GM_setValue("WI_toc_rolledUp", tocInner.style.display=='none');
  201. },5);
  202. }
  203. rollupButton.onclick = toggleRollUp;
  204. rollupButton.id = "togglelink";
  205. toc.appendChild(rollupButton);
  206. if (GM_getValue("WI_toc_rolledUp",false)) {
  207. toggleRollUp();
  208. }
  209. }
  210.  
  211. function addButtonsConditionally(toc) {
  212.  
  213. function verbosely(fn) {
  214. return function() {
  215. // GM_log("[WI] Calling: "+fn+" with ",arguments);
  216. return fn.apply(this,arguments);
  217. };
  218. };
  219.  
  220. // Provide a hide/show toggle button if the TOC does not already have one.
  221.  
  222. // Wikimedia's toc element is actually a table. We must put the
  223. // buttons in the title div, if we can find it!
  224.  
  225. var tocTitle = document.getElementById("toctitle"); // Wikipedia
  226. tocTitle = tocTitle || toc.getElementsByTagName("h2")[0]; // Mozdev
  227. // tocTitle = tocTitle || toc.getElementsByTagName("div")[0]; // Fingers crossed for general
  228. tocTitle = tocTitle || toc.firstChild; // Fingers crossed for general
  229.  
  230. // Sometimes Wikimedia does not add a hide/show button (if the TOC is small).
  231. // We cannot test this immediately, because it gets loaded in later!
  232. function addButtonsNow() {
  233.  
  234. var hideShowButton = document.getElementById("togglelink");
  235. if (!hideShowButton) {
  236. var tocInner = toc.getElementsByTagName("ol")[0]; // Mozdev (can't get them all!)
  237. tocInner = tocInner || toc.getElementsByTagName("ul")[0]; // Wikipedia
  238. tocInner = tocInner || toc.getElementsByTagName("div")[0]; // Our own
  239. if (tocInner) {
  240. verbosely(addHideButtonTo)(tocTitle || toc, tocInner);
  241. }
  242. }
  243.  
  244. // We do this later, to ensure it appears on the right of
  245. // any existing [hide/show] button.
  246. if (document.getElementById("closeTOC") == null) {
  247. verbosely(addCloseButtonTo)(tocTitle || toc, toc);
  248. }
  249.  
  250. }
  251.  
  252. // Sometimes Wikimedia does not add a hide/show button (if the TOC is small).
  253. // We cannot test this immediately, because it gets loaded in later!
  254. if (document.location.href.indexOf("wiki") >= 0) {
  255. setTimeout(addButtonsNow,2000);
  256. } else {
  257. addButtonsNow();
  258. }
  259.  
  260. }
  261.  
  262. // End mirror.
  263.  
  264.  
  265.  
  266. // == Main == //
  267.  
  268. function doIt() {
  269.  
  270.  
  271.  
  272. //// Feature #1 : Hide the sidebar. Fullsize the content.
  273.  
  274. // Toggle the sidebar by clicking the "page background" (empty space outside
  275. // the main content). Sometimes clicking the content background is enough.
  276.  
  277. if (toggleSidebar) {
  278.  
  279. var content = document.getElementById("content")
  280. || document.getElementById("column-content");
  281. var sideBar = document.getElementById("column-one")
  282. || document.getElementById("panel")
  283. || /* WikiMedia: */ document.getElementById("mw-panel")
  284. || /* forgot: */ document.getElementById("jq-interiorNavigation")
  285. || /* pmwiki: */ document.getElementById('wikileft');
  286. var toToggle = [ document.getElementById("page-base"), document.getElementById("siteNotice"), document.getElementById("head") ];
  287. var cac = document.getElementById("p-cactions");
  288. var cacOldHome = ( cac ? cac.parentNode : null );
  289.  
  290. function toggleWikipediaSidebar(evt) {
  291.  
  292. // We don't want to act on all clicked body elements (notably not the WP
  293. // image). I detected two types of tag we wanted to click.
  294. /*if (!evt || evt.target.tagName == "UL" || evt.target.tagName == "DIV") {*/
  295.  
  296. // That was still activating on divs in the content! (Gaps between paragraphs.)
  297. // This only acts on the header area.
  298. var thisElementTogglesSidebar;
  299. var inStartup = (evt == null);
  300. if (inStartup) {
  301. thisElementTogglesSidebar = true;
  302. } else {
  303. var elem = evt.target;
  304. var clickedHeader = (elem.id == 'mw-head');
  305. // For wikia.com:
  306. clickedHeader |= (elem.id=="WikiHeader");
  307. // For Wikimedia:
  308. var clickedPanelBackground = elem.id == 'mw-panel' || elem.className.indexOf('portal')>=0;
  309. clickedPanelBackground |= elem.id == 'column-content'; // for beebwiki (old mediawiki?)
  310. // Hopefully for sites in general. Allow one level below body. Needed for Wikia's UL.
  311. var clickedAreaBelowSidebar = (elem.tagName == 'HTML' || elem.tagName == 'BODY');
  312. var clickedBackground = (elem.parentNode && elem.parentNode.tagName == "BODY");
  313. thisElementTogglesSidebar = clickedHeader || clickedPanelBackground || clickedAreaBelowSidebar || clickedBackground;
  314. }
  315. if (thisElementTogglesSidebar) {
  316.  
  317. if (evt)
  318. evt.preventDefault();
  319. if (debug) { GM_log("evt=",evt); }
  320. // if (evt) GM_log("evt.target.tagName="+evt.target.tagName);
  321. /* We put the GM_setValue calls on timers, so they won't slow down the rendering. */
  322. if (sideBar) {
  323. if (sideBar.style.display == '') {
  324. // Wikipedia's column-one contains a lot of things we want to hide
  325. sideBar.style.display = 'none';
  326. if (content) {
  327. content.oldMarginLeft = content.style.marginLeft;
  328. content.style.marginLeft = minimisedSidebarSize+'px';
  329. }
  330. for (var i in toToggle) {
  331. if (toToggle[i]) { toToggle[i].style.display = 'none'; }
  332. }
  333. // but one of them we want to preserve
  334. // (the row of tools across the top):
  335. if (cac)
  336. sideBar.parentNode.insertBefore(cac,sideBar.nextSibling);
  337. setTimeout(function(){
  338. GM_setValue("sidebarVisible",false);
  339. },200);
  340. } else {
  341. function unhide() {
  342. sideBar.style.display = '';
  343. }
  344. setTimeout(unhide,delayUnhide);
  345. if (content) {
  346. content.style.marginLeft = content.oldMarginLeft;
  347. }
  348. for (var i in toToggle) {
  349. if (toToggle[i]) { toToggle[i].style.display = ''; }
  350. }
  351. if (cac && cacOldHome)
  352. cacOldHome.appendChild(cac); // almost back where it was :P
  353. setTimeout(function(){
  354. GM_setValue("sidebarVisible",true);
  355. },200);
  356. }
  357. }
  358.  
  359. }
  360. }
  361.  
  362. // log("sideBar="+sideBar+" and content="+content);
  363. if (sideBar) {
  364. // We need to watch window for clicks below sidebar (Chrome).
  365. document.documentElement.addEventListener('click',toggleWikipediaSidebar,false);
  366. } else {
  367. log("Did not have sideBar "+sideBar+" or content "+content); // @todo Better to warn or error?
  368. }
  369.  
  370. if (!GM_getValue("sidebarVisible",true)) {
  371. toggleWikipediaSidebar();
  372. }
  373.  
  374. // TODO: Make a toggle button for it!
  375.  
  376. // Fix for docs.jquery.com:
  377. /*
  378. var j = document.getElementById("jq-primaryContent");
  379. if (j) {
  380. j.style.setAttribute('display', 'block');
  381. j.style.setAttribute('float', 'none');
  382. j.style.setAttribute('width', '100%');
  383. }
  384. */
  385. GM_addStyle("#jq-primaryContent { display: block; float: none; width: 100%; }");
  386.  
  387. }
  388.  
  389.  
  390.  
  391. //// Feature #2: Make Table of Contents float
  392.  
  393. if (makeTableOfContentsFloat) {
  394.  
  395. /* @consider If the TOC has a "Hide/Show" link ("button") then we could
  396. * fire that instead of changing opacity.
  397. */
  398.  
  399. // document.getElementById('column-one').appendChild(document.getElementById('toc'));
  400.  
  401. // createFader basically worked but was a little bit buggy. (Unless the bugs were caused by conflict with other TOC script.)
  402. // Anyway createFader() has now been deprecated in favour of CSS :hover.
  403.  
  404. function createFader(toc) {
  405.  
  406. var timer = null;
  407.  
  408. // BUG: this didn't stop the two fades from conflicting when the user wiggles the mouse to start both!
  409. function resetTimeout(fn,ms) {
  410. if (timer) {
  411. clearTimeout(timer);
  412. }
  413. setTimeout(fn,ms);
  414. }
  415.  
  416. function fadeElement(elem,start,stop,speed,current) {
  417. if (current == null)
  418. current = start;
  419. if (speed == null)
  420. speed = (stop - start) / 8;
  421. if (Math.abs(current+speed-stop) > Math.abs(current-stop))
  422. current = stop;
  423. else
  424. current = current + speed;
  425. elem.style.opacity = current;
  426. if (current != stop)
  427. resetTimeout(function(){fadeElement(elem,start,stop,speed,current);},50);
  428. }
  429.  
  430. toc.style.opacity = 0.3;
  431. var listenElement = toc;
  432. // var listenElement = toc.getElementsByTagName('TD')[0];
  433. var focused = false;
  434. var visible = false;
  435. listenElement.addEventListener('mouseover',function(){
  436. if (!visible)
  437. setTimeout(function(){ if (focused) { visible=true; fadeElement(toc,0.4,1.0,0.2); } },10);
  438. focused = true;
  439. },false);
  440. listenElement.addEventListener('mouseout',function(){
  441. if (visible)
  442. setTimeout(function(){ if (!focused) { visible=false; fadeElement(toc,1.0,0.2,-0.1); } },10);
  443. focused = false;
  444. },false);
  445.  
  446. }
  447.  
  448.  
  449. function tryTOC() {
  450.  
  451. // Find the table of contents element:
  452. var toc = document.getElementById("toc") /* MediaWiki */
  453. || document.getElementsByClassName("table-of-contents")[0] /* BashFAQ */
  454. || document.getElementsByClassName("toc")[0] /* LeakyTap */
  455. || document.getElementsByClassName("wt-toc")[0]; /* Wikitravel */
  456.  
  457. if (toc) {
  458.  
  459. addButtonsConditionally(toc);
  460.  
  461. // toc.style.backgroundColor = '#eeeeee';
  462. // alert("doing it!");
  463. toc.style.position = 'fixed';
  464. toc.style.right = '16px';
  465. // toc.style.top = '16px';
  466. // A healthy gap from the top allows the user to access things fixed in the top right of the page, if they can scroll finely enough.
  467. // toc.style.top = '24px';
  468. toc.style.right = '4%';
  469. toc.style.top = '10%'; // We want to be below the search box!
  470. // toc.style.left = '';
  471. // toc.style.bottom = '';
  472. toc.style.zIndex = '5000';
  473. // fadeElement(toc,1.0,0.4);
  474. // This might work for a simple toc div
  475. toc.style.maxHeight = "80%";
  476. toc.style.maxWidth = "32%";
  477.  
  478. /*
  479. * Sometimes specifying max-height: 80% does not work, the toc won't shrink.
  480. * This may be when it's a table and not a div. Then we must set max-height on the content. (Maybe we don't actually need to set pixels if we find the right element.)
  481. */
  482. toc.id = "toc";
  483. var maxHeight = window.innerHeight * 0.8 | 0;
  484. var maxWidth = window.innerWidth * 0.4 | 0;
  485.  
  486. /*
  487. * WikiMedia tree looks like this: <table id="toc" class="toc"><tbody><tr><td><div id="toctitle"><h2>Contents</h2>...</div> <ul> <li class="toclevel-1 tocsection-1">
  488. Here is a long TOC: http://mewiki.project357.com/wiki/X264_Settings#Input.2FOutput
  489. */
  490. // GM_addStyle("#toc ul { overflow: auto; max-width: "+maxWidth+"px; max-height: "+maxHeight+"px; }");
  491. var rootUL = toc.getElementsByTagName("UL")[0];
  492. if (!rootUL)
  493. rootUL = toc;
  494. // TODO: If we can cleanly separate them, we might want to make put a scrollbar on the content element, leaving the title outside it.
  495. rootUL.style.overflow = "auto";
  496. rootUL.style.maxWidth = maxWidth+'px';
  497. rootUL.style.maxHeight = maxHeight+'px';
  498.  
  499. /*
  500. createFader(toc);
  501. */
  502. //// Alternative rules from table_of_contents_everywhere script:
  503. toc.id = "toc";
  504. // GM_addStyle("#toc { position: fixed; top: 10%; right: 4%; background-color: white; color: black; font-weight: normal; padding: 5px; border: 1px solid grey; z-index: 5555; max-height: 80%; overflow: auto; }");
  505. GM_addStyle("#toc { opacity: 0.2; }");
  506. GM_addStyle("#toc:hover { opacity: 1.0; }");
  507.  
  508. // For Wikia (tested in Chrome):
  509. if (getComputedStyle(toc)["background-color"] == "rgba(0, 0, 0, 0)") {
  510. toc.style.backgroundColor = 'white';
  511. }
  512.  
  513. return true;
  514.  
  515. }
  516.  
  517. return false;
  518.  
  519. }
  520.  
  521. // Ideally we want to act before # anchor position occurs, but we may
  522. // need to wait for the toc if it is not added to the DOM until later.
  523. if (!tryTOC()) {
  524. setTimeout(tryTOC,400);
  525. }
  526.  
  527. }
  528.  
  529.  
  530.  
  531. // In case you have * in your includes, only continue for pages which have
  532. // "wiki" before "?" in the URL, or who have both toc and content elements.
  533. var isWikiPage = document.location.href.split("?")[0].match("wiki")
  534. || ( document.getElementById("toc") && document.getElementById("content") );
  535.  
  536. if (!isWikiPage)
  537. return;
  538.  
  539.  
  540.  
  541. // Delay. Feature 3 and 4 can run a bit later, without *too* much page
  542. // change, but with significant processor saving!
  543. setTimeout(function(){
  544.  
  545.  
  546.  
  547. //// Feature #3 : Indent the blocks so their tree-like structure is visible
  548.  
  549. // Oct 2012: Disabled - was making a right mess of the header/nav on Wikia
  550. if (document.location.host.match(/wikia.com/)) {
  551. indentSubBlocks = false;
  552. }
  553.  
  554. if (indentSubBlocks) {
  555.  
  556. function indent(tag) {
  557. // By targetting search we avoid indenting any blocks in left-hand-column (sidebar).
  558. var whereToSearch = document.getElementById('bodyContent') || document.getElementById('content') || document.getElementById('WikiaMainContent') || document.body;
  559. var elems = whereToSearch.getElementsByTagName(tag);
  560. if (elems.length == 1)
  561. return;
  562. // for (var i=0;i<elems.length;i++) {
  563. for (var i=elems.length;i-->0;) {
  564. var elem = elems[i];
  565. /* Don't fiddle with main heading, siteSub, or TOC. */
  566. if (elem.className == 'firstHeading')
  567. continue;
  568. if (elem.id == 'siteSub')
  569. continue;
  570. if (elem.textContent == 'Contents')
  571. continue;
  572.  
  573. // We have found a "heading" element. Every sibling after this
  574. // element should be indented a bit.
  575.  
  576. //// Current method of indenting: Create a UL and put everything
  577. //// inside that.
  578. // var newChild = document.createElement('blockquote');
  579. //// Unfortunately blockquotes tend to indent too much!
  580. // var newChild = document.createElement('DIV');
  581. //var newChild = document.createElement('UL'); // UL works better with my Folding script, but we must not do this to the TOC!
  582. var newChild = document.createElement('div'); // <ul>s look wrong on bitbucket wikis (indent too much). And since I haven't used my folding script recently, I am switching back to a nice <div>.
  583. newChild.style.marginLeft = '1.0em';
  584. var toAdd = elem.nextSibling;
  585. while (toAdd && toAdd.tagName != tag) {
  586. // That last condition means a h3 might swallow an h2 if they
  587. // are on the same level! But it *should* swallow an h4.
  588. // TODO: We should break if we encounter any marker with level
  589. // above or equal to our own, otherwise continue to swallow.
  590. var next = toAdd.nextSibling;
  591. newChild.appendChild(toAdd);
  592. toAdd = next;
  593. }
  594. elem.parentNode.insertBefore(newChild,elem.nextSibling);
  595.  
  596. // CONSIDER: Alternative: Do not swallow at all, do not create
  597. // newChild and change the page's tree. Just modify
  598. // style.marginLeft, resetting it if an incompatible element style
  599. // already exists there, updating it if we have already indented
  600. // this element!
  601.  
  602. // GM_log("Placed "+newChild+" after "+elem);
  603. }
  604. }
  605.  
  606. indent("H1"); indent("H2"); indent("H3"); indent("H4"); indent("H5"); indent("H6");
  607.  
  608. }
  609.  
  610.  
  611.  
  612. //// Feature #4: Change underlined headings to overlined headings.
  613.  
  614. if (fixUnderlinesToOverlines) {
  615.  
  616. // Hide any existing underlines
  617. // I made this !important to defeat the more specific `.markdown-body h*` rules on GitHub wikis.
  618. GM_addStyle("h1, h2, h3, h4, h5, h6 { border-bottom: 0 !important; }");
  619.  
  620. // Add our own overlines instead
  621. GM_addStyle("h1, h2, h3, h4, h5, h6 { border-top: 1px solid #AAAAAA; }");
  622.  
  623. // Do not use `text-decoration: underline;`. It will only appear as wide as the text (not filling the page width) and will make the text look like a hyperlink!
  624.  
  625. }
  626.  
  627.  
  628.  
  629. },1000);
  630.  
  631.  
  632.  
  633.  
  634. } // end doIt
  635.  
  636.  
  637. // setTimeout(doIt,2000);
  638. doIt();
  639.  
  640. })();
  641.  

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址