mrj / Highlight non-repeats on the eBroadcast TV guide

// ==UserScript==
// @name        Highlight non-repeats on the eBroadcast TV guide
// @description Highlight in yellow the program slots of first-run (premiere) programs on the Australian eBroadcast TV guide.
// @namespace   openuserjs.org/users/mrj
// @oujs:author mrj
// @match       http*://www.ebroadcast.com.au/tv/
// @match       http*://www.ebroadcast.com.au/tv/static/*
// @version     6
// @grant       GM_addStyle
// @require     https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js
// @license     MIT

// ==/UserScript==

GM_addStyle('.premiere { background-color: yellow !important; }');

function doHighlight() {
  if (!timeChangeObserved) {
    observer.observe(document.getElementById('loaded'), {childList: true});
    timeChangeObserved = true;
  }

  $('tr.normalRow:visible img[alt="New"]').closest('td').addClass('premiere').removeClass('clear_bg highlight');
}

var timeChangeObserved;
var observer = new MutationObserver(doHighlight);

if ($('#static').val() == 1)
  doHighlight();
else
  observer.observe(document.getElementById('tv_guide'), {childList: true});