Greasy Fork 还支持 简体中文。

Better Hacker News

Fixes the hideous looking interface

  1. // ==UserScript==
  2. // @name Better Hacker News
  3. // @namespace ycombinator.com
  4. // @description Fixes the hideous looking interface
  5. // @require http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js
  6. // @include https://news.ycombinator.com/*
  7. // @version 0.0.2
  8. // @grant GM_addStyle
  9. // ==/UserScript==
  10.  
  11. // various better-looking styles (subjective, I know)
  12. GM_addStyle('table { border-collapse: collapse; }');
  13. GM_addStyle('.title a { font-size: 22px; }');
  14. GM_addStyle('tr.spacer { display: none; }');
  15. GM_addStyle('.rank { color: navy; }');
  16.  
  17. // add target: _blank to links
  18. var links = $("a[href]:not([target])");
  19. var numLinks = links.length;
  20. for (var j = 0; j < numLinks; ++j) {
  21. links[j].setAttribute("target", "_blank");
  22. }
  23.  
  24. // we don't need the spacer rows
  25. $('tr.spacer').remove();
  26.  
  27. // highlight the title row background
  28. var arTableRows = document.getElementsByTagName('tr');
  29. var bHighlight = true;
  30. for (var i = arTableRows.length - 2; i >= 0; i--) {
  31. var elmRow = arTableRows[i];
  32. elmRow.style.backgroundColor = bHighlight ? '#eee' : '#fff';
  33. elmRow.style.color = '#000';
  34. bHighlight = !bHighlight;
  35. }