// ==UserScript==
// @name        HCL Request Status
// @namespace   http://www.longhighway.com/monkeyisland
// @description Highlight Hennepin County Library requests page item status.
// @include     http://catalog.hclib.org/ipac20/ipac.jsp*
// @include     https://catalog.hclib.org/*
// ==/UserScript==

(

function() {
    //var pattern = "//table/tbody/tr[2]/td[5]/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(/Active/g)) {
        //    res.setAttribute("style", "color:blue");
        //}
        if (res.innerHTML.match(/In transit/g)) {
            res.setAttribute("style", "color:blue");
        }
        if (res.innerHTML.match(/Suspended/g)) {
            res.setAttribute("style", "color:red");
        }
        i++ ;
    }
}

)();
