直した


左の時間部分の現在時間を強調して、その少し上へスクロールする。上の日付が、番組表は27時台まであるのに、24時を過ぎるとすぐ変わっちゃうのでそこもいじるかな。

// ==UserScript==
// @name           FOX channel list highlight
// @namespace      http://d.hatena.ne.jp/KGA/
// @description    FOX channel list highlight
// @include        http://www.foxjapan.com/tv/cgi-bin/timetable/timetable2.cgi
// ==/UserScript==

(function() {
  var now = new Date();
  var num = Math.floor((now.getHours() * 60 + now.getMinutes()) / 30 - 7);
  if (num < 0) num += 48;
  var xpath = ['/html/body/table/tbody/tr/td[1]/table/tbody/tr[', num, ']/td'].join('');

  var td = document.evaluate(xpath, document, null,
                             XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;
  td.style.backgroundColor = '#afff83';

  if ((num -= 3) < 0) num = 0;
  window.scroll(0, num * 57);
}());