customizing hosted library services with jquery

63
CUSTOMIZING HOSTED LIBRARY SERVICES WITH MATTHEW REIDSMA jQUERY

Upload: matthew-reidsma

Post on 10-May-2015

4.203 views

Category:

Self Improvement


0 download

DESCRIPTION

Every library struggles to provide some sort of unified experience for its users, despite using hosted solutions for many of its resources. Getting these varied sites designed by countless different vendors to look like part of your library's site can be a challenge. I've found great success in combating the lackluster HTML and CSS of library vendors by using jQuery to make the page I want, rather than the page I have. I'll show some examples of projects I've completed as well as the Open Source projects they have spawned (360Link Reset, hasMedia?).

TRANSCRIPT

Page 1: Customizing Hosted Library Services with jQuery

CUSTOMIZING HOSTED LIBRARY SERVICES WITH

MATTHEW REIDSMA

jQUERY

Page 2: Customizing Hosted Library Services with jQuery
Page 3: Customizing Hosted Library Services with jQuery
Page 4: Customizing Hosted Library Services with jQuery

(ANGER)

Page 5: Customizing Hosted Library Services with jQuery

jQUERY

Page 6: Customizing Hosted Library Services with jQuery

Photograph by Matthew Oliphant: http://www.flickr.com/photos/fajalar/5685561863/

Page 7: Customizing Hosted Library Services with jQuery

animatable.com/demos/madmanimation/

Page 8: Customizing Hosted Library Services with jQuery

animatable.com/demos/madmanimation/

Page 9: Customizing Hosted Library Services with jQuery

jQUERY

Page 10: Customizing Hosted Library Services with jQuery

<h1><b>Mad</b>manimation</h1>

<ol><li id=”scene01”>[...]</li><li id=”scene02”>[...]</li><li id=”scene03”>[...]</li><li id=”scene04”>[...]</li><li id=”scene05”>[...]</li><li id=”scene06”>[...]</li>[...]</ol>

Page 11: Customizing Hosted Library Services with jQuery

if (Modernizr.cssanimations) { $("h1").prepend('<a href="#">Watch</a> ') $("#scene-01").append('[...]');

[...]

}

Page 12: Customizing Hosted Library Services with jQuery

.prepend()

.append()

Page 13: Customizing Hosted Library Services with jQuery

QuickTime™ and aGIF decompressor

are needed to see this picture.

Page 14: Customizing Hosted Library Services with jQuery
Page 15: Customizing Hosted Library Services with jQuery

WHAT IF?I STRIP INLINE STYLES

Page 16: Customizing Hosted Library Services with jQuery

.removeAttr()

Page 17: Customizing Hosted Library Services with jQuery

PREVIOUSLY:<table align=”center” width=”100%” border=”0” cellspacing=”2” cellpadding=”0” style=”color: #000;” class=”CandyWrapper” id=”CandyWrapper”>

ETC.

Page 18: Customizing Hosted Library Services with jQuery

PREVIOUSLY:<table align=”center” width=”100%” border=”0” cellspacing=”2” cellpadding=”0” style=”color: #000;” class=”CandyWrapper” id=”CandyWrapper”>

ETC.

Page 19: Customizing Hosted Library Services with jQuery

$(“table”).removeAttr(“align”);

Page 20: Customizing Hosted Library Services with jQuery

$(“table”).removeAttr(“align”);$(“table”).removeAttr(“width”);$(“table”).removeAttr(“border”);$(“table”).removeAttr(“cellspacing”);$(“table”).removeAttr(“cellpadding”);$(“table”).removeAttr(“style”);

Page 21: Customizing Hosted Library Services with jQuery

$(“table”).removeAttr(“align”);$(“table”).removeAttr(“width”);$(“table”).removeAttr(“border”);$(“table”).removeAttr(“cellspacing”);$(“table”).removeAttr(“cellpadding”);$(“table”).removeAttr(“style”);BAM.

Page 22: Customizing Hosted Library Services with jQuery

<table id=”CandyWrapper” class=”CandyWrapper”>

Page 23: Customizing Hosted Library Services with jQuery

.removeClass();

Page 24: Customizing Hosted Library Services with jQuery

$(“table”).removeClass(“CandyWrapper”);

Page 25: Customizing Hosted Library Services with jQuery

<table id=”CandyWrapper”>

Page 26: Customizing Hosted Library Services with jQuery

WHAT IF?I REPLACE THEIR CSS WITH MINE

Page 27: Customizing Hosted Library Services with jQuery

.remove();

.replaceWith();.replaceWith();

.append();

Page 28: Customizing Hosted Library Services with jQuery

ONE STYLE SHEET?

$(“head link”).replaceWith(“<link [...] >”);

Page 29: Customizing Hosted Library Services with jQuery

STYLESHEETS & STYLESHEETS & STYLESHEETS, OH MY!

$(“head link”).remove();$(“head style”).remove();

THUS:

$(“head”).append(“<link [...] >”);

Page 30: Customizing Hosted Library Services with jQuery
Page 31: Customizing Hosted Library Services with jQuery

GETTING THERE.

Page 32: Customizing Hosted Library Services with jQuery

WHAT IF?I GRAB DATA, ERASE TABLES, AND SUPPLY STANDARDS-BASED,

SEMANTIC HTML?

Page 33: Customizing Hosted Library Services with jQuery
Page 34: Customizing Hosted Library Services with jQuery

.attr();

.text();

.replaceWith();

Page 35: Customizing Hosted Library Services with jQuery

CITATION TABLE<table id=”CandyWrapper”> [...]<table class=”SS_CitationTable”> [...]

<td id=”Title”><div>Vital Speeches of the Day</div>

[...]

</table></table>

<a class=”link” href=”[...]”>Refworks</a>

[...]

Page 36: Customizing Hosted Library Services with jQuery

GIMME VAR

var journalTitle = $(“td#Title”).text();

var refWorksURL = $(“a.link:contains(‘RefWorks’)”).attr(“href”);

Page 37: Customizing Hosted Library Services with jQuery

$(“table#CandyWrapper table.SS_Citation”).replaceWith(‘<div id=”citation”>

<span id=”author”>’ + authorName + ‘</span>.<span id=”date”>(’ + articleDate + ‘)</span>.<cite id=”article”>’ + articleTitle + ‘</cite>.<span id=”journal”><i>’ + journalTitle + ‘</i></span>.<span id=”volume”>’ + journalVol + ‘</span><span id=”issue”>(’ + journalIssue + ‘)</span>,<span id=”pages”> ‘ + pages + ‘.</span><a href=”’ + refWorksURL + ‘“>RefWorks</a>

</div>‘);

Smith, Joe. (2010). My awesome article. My awesome journal. 1(1), 10-23.

THUS:

Page 38: Customizing Hosted Library Services with jQuery
Page 39: Customizing Hosted Library Services with jQuery
Page 40: Customizing Hosted Library Services with jQuery

NOT JUST A PRETTY FACE.

Page 41: Customizing Hosted Library Services with jQuery
Page 42: Customizing Hosted Library Services with jQuery

var metaData = $(“td.description_col2”).text();var hasMovie = “Moving Image”;

if(metaData.indexOf(hasMovie) != -1) {

$(“#tabs”).prepend(‘<video controls>

<source src=”[...]” type=”video/ogg”><source src=”[...]” type=”video/mp4”>[...]

</video>‘);

}

Page 43: Customizing Hosted Library Services with jQuery
Page 44: Customizing Hosted Library Services with jQuery

jQUERY &

PROGRESSIVE ENHANCEMENT

Page 45: Customizing Hosted Library Services with jQuery
Page 46: Customizing Hosted Library Services with jQuery

LET’S SLIDE

http://matmarquis.com/carousel/

Page 47: Customizing Hosted Library Services with jQuery

<div><img src=”[...]” alt=”Slide One” class=”splash-image” />

<p>Lorem ipsum dolem [...] </p></div>

SILDES.HTML:

INDEX.HTML:

<div class=”slidewrap”>

<ul class=”slider”><li class=”slide”><a href=”[...]”><img src=”[...] alt=”[...]” /></a></li><li class=”slide”><a href=”[...]”><img src=”[...] alt=”[...]” /></a></li><li class=”slide”><a href=”[...]”><img src=”[...] alt=”[...]” /></a></li>[...] <!-- etc. -->

</ul>

</div>

Page 48: Customizing Hosted Library Services with jQuery

$(document).ready(function() { $.get("slides.html", function(data) {

$(".splash-image").replaceWith(data); $(".slidewrap").carousel({ slider: '.slider' }) });

});

Page 49: Customizing Hosted Library Services with jQuery

QuickTime™ and a decompressor

are needed to see this picture.

Page 50: Customizing Hosted Library Services with jQuery

QuickTime™ and aGIF decompressor

are needed to see this picture.

FTW!

Page 51: Customizing Hosted Library Services with jQuery

jQUERY?WHY

Page 52: Customizing Hosted Library Services with jQuery

QuickTime™ and a decompressor

are needed to see this picture.

EXCELLENT CROSS-BROWSER SUPPORT

Page 53: Customizing Hosted Library Services with jQuery

QuickTime™ and a decompressor

are needed to see this picture.

RAPID PROTOTYPING

Page 54: Customizing Hosted Library Services with jQuery

QuickTime™ and a decompressor

are needed to see this picture.

USER TESTING

Page 55: Customizing Hosted Library Services with jQuery

QuickTime™ and a decompressor

are needed to see this picture.

QUICK FIXES

Page 56: Customizing Hosted Library Services with jQuery

QuickTime™ and a decompressor

are needed to see this picture.

MISSING FUNCTIONALIT

Y

Page 57: Customizing Hosted Library Services with jQuery

QuickTime™ and a decompressor

are needed to see this picture.

DESPERATION

Page 58: Customizing Hosted Library Services with jQuery

jQUERY?WHYNOT

Page 59: Customizing Hosted Library Services with jQuery

QuickTime™ and a decompressor

are needed to see this picture.

DEPENDENT ON BAD VENDOR PRACTICES

Page 60: Customizing Hosted Library Services with jQuery

QuickTime™ and a decompressor

are needed to see this picture.

LIMITED TO WHAT VENDOR ALREADY PROVIDES

Page 61: Customizing Hosted Library Services with jQuery

QuickTime™ and a decompressor

are needed to see this picture.

NOT EVERYONE HAS JAVASCRIPT SUPPORT

Page 62: Customizing Hosted Library Services with jQuery

QuickTime™ and a decompressor

are needed to see this picture.

Clips from Just Imagine! (1930).

Page 63: Customizing Hosted Library Services with jQuery

THANKYOU

[email protected] :: @mreidsmamatthewreidsma.com :: gvsu.edu/library/labs