Better Hacker News

Fixes the hideous looking interface

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name        Better Hacker News
// @namespace   ycombinator.com
// @description Fixes the hideous looking interface
// @require     http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js
// @include     https://news.ycombinator.com/*
// @version     0.0.2
// @grant       GM_addStyle
// ==/UserScript==

// various better-looking styles (subjective, I know)
GM_addStyle('table { border-collapse: collapse; }');
GM_addStyle('.title a { font-size: 22px; }');
GM_addStyle('tr.spacer { display: none; }');
GM_addStyle('.rank { color: navy; }');

// add target: _blank to links
var links = $("a[href]:not([target])");
var numLinks = links.length;
for (var j = 0; j < numLinks; ++j) {
  links[j].setAttribute("target", "_blank");
}

// we don't need the spacer rows
$('tr.spacer').remove();

// highlight the title row background
var arTableRows = document.getElementsByTagName('tr');
  var bHighlight = true;
  for (var i = arTableRows.length - 2; i >= 0; i--) {
    var elmRow = arTableRows[i];
    elmRow.style.backgroundColor = bHighlight ? '#eee' : '#fff';
    elmRow.style.color = '#000';
    bHighlight = !bHighlight;
  }