Customizing Vendor Tools

With JavaScript

Matthew Reidsma
Grand Valley State University

What your vendor tools are

Fat Pony by Kate Beaton, http://beatonna.livejournal.com/155875.html

Terrible Sierra Error message
Terrible Illiad Success message
What your vendor tools are

Fat Pony by Kate Beaton, http://beatonna.livejournal.com/155875.html

How JavaScript Works

How JavaScript Works

Summon Stats Dashbaord

Basic

Customizing the look and feel

Wicked CSS Hack
Asteroids at GVSU


var newCss = document.createElement('link');

					

var newCss = document.createElement('link');

newCss.setAttribute('rel', 'stylesheet');
newCss.setAttribute('type','text/css');
newCss.setAttribute('href','styles.css');

document.head.appendChild(newCss);

				


$('head').append('');

				


$('head').remove('link');

				


$('head').remove('link:last-child');

				
Old Ares
New Ares

Intermediate

Customizing for usability

Old Illiad


var emptyTables, numArticles;

if($('#electronic-articles').find('.row-message').find('td').text() == 
"No Electronic Articles Received")
{
    // This is the home page, and the table is empty
    emptyTables = emptyTables + 1;
    numArticles = 0;

    // Hide the electronic articles table
    $('#electronic-articles').hide();
} else {
	// There are articles
	var numArticles = 
	$('electronic-articles').find('tbody').find('tr').length;
}

				
New Illiad
New Illiad
Crummy book success message


$('.statusInformation').html('
Got it! Loans from other libraries can take 1-2 weeks. 
We’ll let you know when it’s here.
');

				
New Illiad


$('.statusInformation').html('
Got it! Loans from other libraries can take 1-2 weeks. 
We’ll let you know when it’s here.
');

				
New Illiad
New Illiad


$("option:contains('LIB')").text("Mary Idema Pew Library @ Allendale");
$("option:contains('STEEL')").text("Steelcase Library @ DeVos");
$("option:contains('AWRI')").text("Annis Water Research Institute");
$("option:contains('FREY')").text("Frey Learning Center @ CHS");
$("option:contains('OCS')").text("Ship books to me");
$("option:contains('VARI')").text("VanAndel Research Institute");

				
New Illiad
New Illiad

github.com/gvsulib/Illiad/blob/master/include_footer.html#L357

"

Advanced

Replacing the Whole Thing

Old 360 Link
Old 360 Link plus new CSS


$('#resultsTable').find('tr').each(function(index) {
	// Grab values from the results table
	if(index !== 0) {
	    if(format === 'Journal') {
	        articleLinkdata[i] =
	        $(this).find('#ArticleCL').find('a').attr('href');
	        journalLinkdata[i] =
	        $(this).find('#JournalCL').find('a').attr('href');

	    } else { // Not a journal article
			BookLinkdata[i] = 
            $(this).find('#BookCL').find('a').attr('href');
	    }
	 ...


				

        // Date range
        dateRangedata[i] = $(this).find('#DateCL').text();

        // Database name
        databaseNamedata[i] = $(this).find('#DatabaseCL').text();

        // Database link
        databaseLinkdata[i] = 
        $(this).find('#DatabaseCL').find('a').attr('href');

        i++;
    }
    results = index; // Get total number of results
});



				

// Replace all the content
$('#content').html('
<ul id="links">
    <li>
        <a class="button" href="' + articleLink + '">
            Full Text Online
        </a>
    </li>
...
');



				
New 360 Link
Help in 360 Link for doc delivery

More Examples

(And Caveats)

Placeholder in OPAC for author searches


$('select[name="searchtype"]').change(function() {
	if($(this).val() == 'a') {
	    $('input#searcharg').attr('placeholder', 'Last Name, First Name');
	}
});

				
Breaking out print in extra results
Journal requests
BYU Illiad
BYU Illiad

github.com/byuhbll/ILLiadPlus

Javascript doesn't always work.

Your Site Might Load Slower

Vendor Changes Might Break Your Code

Vendors Might Not Make it Easy

Summon settings

ThankYou

Questions?

reidsmam@gvsu.edu :: @mreidsma

I'm also teaching a 4-week course on this for Infopeople: http://gvsu.edu/s/Uz and writing a book on it for Libraries Unlimited (publication set for 2016)