'; if (rId.indexOf("detail") > -1) { jQuery('#detailActions'+rId).prepend(goodReadsButton); } else { var displayType='hitlist'; var hitnum=rId.split(displayType)[1]; jQuery('#results_bio'+hitnum).siblings('.results_right').prepend(goodReadsButton); } jQuery('.goodreadsbutton').css('background-image', 'url(https://www.goodreads.com/images/badge/badge1.jpg)'); //https://www.goodreads.com/images/atmb_add_book-70x25.png jQuery('.goodreadsbutton').css('background-repeat', 'no-repeat'); jQuery('.goodreadsbutton').css('width', '100px'); jQuery('.goodreadsbutton').css('height', '24px'); jQuery('.goodreadsbutton').css('background-color', 'none'); jQuery('.goodreadsbutton').css('border', 'none'); jQuery('.goodreadsbutton').text(''); } } } } function modifyAvailable() { var tableContents = document.querySelectorAll('.detailItemsTableRow'); /* Pull all of the rows from the holdings table in the accordion of Detail Status into an array */ var tableHeight = tableContents.length; /* Determine how many rows were pulled as they will have to be gone through one-by-one until the height of the table has been searched */ //console.log(tableHeight); //console.log(tableContents); addColors(tableContents, tableHeight); } function addColors(table, height){ for (i = 0; i < height; i++){ var row = table[i].querySelectorAll('td'); var colorCheck = row[4].innerHTML; var notHere = colorCheck.search(/Due|Work Room|loan|transferred|acquired|fixed|mended|returned to standard|On hold|Withdrawn|In Transit|Missing|Damaged|processed|order|lost|storage|overdue|unreturned|Checked/i); var didalready=colorCheck.search(/font/i); //Regex expression, OR statements and case-insensitive var redText = ''+row[4].innerHTML+''; var greenText = ''+row[4].innerHTML+''; //	var greenText = 'Available'; //alert(notHere); console.log(didalready); if(didalready >-1) { //console.log("*"); //console.log(colorCheck); } else { //console.log(colorCheck); //console.log(notHere); //alert(notHere); if(colorCheck.search(/Searching/i)>-1) { } else { if (notHere >-1 ) { //If notHere set to a number, item is Not Available: row[4].innerHTML = redText;	} else { row[4].innerHTML = greenText; } } } } } //$J(document).ready(function(){ //modifyAvailable(); //}) //console.log(jQuery.fn.jquery); //jQuery(document).bind("DOMNodeInserted", function(){ // modifyAvailable(); //}); var checkExist = setInterval(function() { //console.log(jQuery('#detailItemTable0').length); if (jQuery('.detailItemTable').length > 0) { // console.log("Exists!"); // if(jQuery('detailItemTable0').length > 0 ) modifyAvailable(); // clearInterval(checkExist); } }, 500); // check every 100ms function hide_item_hold() { jQuery('.detailItemsTable_SD_ITEM_HOLD_LINK').each(function(){ jQuery(this).css("display","none"); }); }