Better Hacker News

Fixes the hideous looking interface

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

Bạn sẽ cần cài đặt một tiện ích mở rộng như Tampermonkey hoặc Violentmonkey để cài đặt kịch bản này.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(Tôi đã có Trình quản lý tập lệnh người dùng, hãy cài đặt nó!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==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;
  }