// ==UserScript==
// @name        HCL Renewal Status
// @namespace   http://www.longhighway.com/monkeyisland
// @description Highlight Hennepin County Library items out page items that cannot be renewed.
// @include     http://catalog.hclib.org/ipac20/ipac.jsp*
// @include     https://catalog.hclib.org/*
// ==/UserScript==

(

function() {
    //var pattern = "//table/tbody/tr[2]/td[1]/a";
    var pattern = "//table/tbody//td[5]/a";
    var resultLinks = document.evaluate(pattern, document, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null);
    var i = 0;
    while ( (res = resultLinks.snapshotItem(i) ) != null ) {
        if (res.innerHTML.match(/Waiting/g)) {
            res.setAttribute("style", "color:red");
        }
        if (res.innerHTML.match(/Limit/g)) {
            res.setAttribute("style", "color:red");
        }
        if (res.innerHTML.match(/No renewals/g)) {
            res.setAttribute("style", "color:red");
        }
        i++ ;
    }
}

)();
