Library: Difference between revisions

move bookmarklet to the top of the page; fix typos; link term bookmarklet
m Text replacement - "<(\/?)source" to "<$1syntaxhighlight"
 
(2 intermediate revisions by one other user not shown)
Line 1: Line 1:
This page is about a useful bookmarklet (executable JavaScript bookmark) that let's you search the Merrimack Valley Library Consortium (MVLC).  There is also a [[:Category:Library|Library]] category for all things library.
== The bookmarklet ==
== The bookmarklet ==
Want this [[wp:bookmarklet|bookmarklet]]?  Drag the following link to your browser bookmark bar: <html><a href="javascript: (function(){var t=window.getSelection?window.getSelection().toString():document.selection.createRange().text;var re = /[\s\-xX0-9]{10,17}/;var OK = re.exec(t);if (!OK) {alert(t + ' is not a valid ISBN\n Please just select a 10 or 13 digit ISBN\ndashes and spaces are OK');} else {t = t.replace(/[\-\s]/,'');window.location='http://newburyport.mvlc.org/eg/opac/results?contains=contains;_special=1;qtype=identifier%7Cisbn;locg=1;pane=numeric;query='+t}})();">Search MVLC</a></html>
Want this [[wp:bookmarklet|bookmarklet]]?  Drag the following link to your browser bookmark bar: <html><a href="javascript: (function(){var t=window.getSelection?window.getSelection().toString():document.selection.createRange().text;var re = /[\s\-xX0-9]{10,17}/;var OK = re.exec(t);if (!OK) {alert(t + ' is not a valid ISBN\n Please just select a 10 or 13 digit ISBN\ndashes and spaces are OK');} else {t = t.replace(/[\-\s]/,'');window.location='http://newburyport.mvlc.org/eg/opac/results?contains=contains;_special=1;qtype=identifier%7Cisbn;locg=1;pane=numeric;query='+t}})();">Search MVLC</a></html>


== Description ==  
== Description ==  
Suppose you're shopping on Amazon for a book like Lawrence Lessig's '''[http://www.amazon.com/Free-Culture-Technology-Control-Creativity/dp/1594200068 Free Culture: How Big Media Uses Technology and the Law to Lock Down Culture and Control Creativity]''', and you wonder if your local library has a copy of the book.  Amazon displays the <abbr title='ISBN is an International Standard Book Number. ISBNs are 10-digit or 13-digit codes used by the publishing industry to uniquely identify individual book titles and editions. Some 10-digit ISBNs may end with an "X" instead of a digit.'>ISBN</abbr> near the title or product details.  The catalog for the [http://www.mvlc.org/Libraries Merrimack Valley Library Consortium] supports lookup by ISBN.  If you perform the search, you'll notice that the resulting URL for that search is
Suppose you're shopping on Amazon for a book like Lawrence Lessig's '''[http://www.amazon.com/Free-Culture-Technology-Control-Creativity/dp/1594200068 Free Culture: How Big Media Uses Technology and the Law to Lock Down Culture and Control Creativity]''', and you wonder if your local library has a copy of the book.  Amazon displays the '''<abbr title='ISBN is an International Standard Book Number. ISBNs are 10-digit or 13-digit codes used by the publishing industry to uniquely identify individual book titles and editions. Some 10-digit ISBNs may end with an "X" instead of a digit.'>ISBN</abbr>''' near the title or product details.  Highlight the ISBN, and click "Search MVLC" in your toolbar.  Presto, you're looking at the search results for that book / CD at your local library!
 
 
== How it works ==
The catalog for the [http://www.mvlc.org/Libraries Merrimack Valley Library Consortium] supports lookup by ISBN.  If you perform the search, you'll notice that the resulting URL for that search is
<pre>
<pre>
http://newburyport.mvlc.org/eg/opac/record/888792?contains=contains;_special=1;qtype=identifier%7Cisbn;query=978-1594200069;locg=1
http://newburyport.mvlc.org/eg/opac/record/888792?contains=contains;_special=1;qtype=identifier%7Cisbn;query=978-1594200069;locg=1
Line 10: Line 17:
Making this generic, you can change the string '''record/888792''' to '''results''' and put any ISBN after the '''query=''' part and get the lookup results immediately.  Taking it a step further, you can create a [[JavaScript]] bookmarklet that can be saved to your browser linkbar which allows you to simply highlight the ISBN on ''any webpage'' and instantly search your local library for the book.  This is what the JavaScript code looks like:
Making this generic, you can change the string '''record/888792''' to '''results''' and put any ISBN after the '''query=''' part and get the lookup results immediately.  Taking it a step further, you can create a [[JavaScript]] bookmarklet that can be saved to your browser linkbar which allows you to simply highlight the ISBN on ''any webpage'' and instantly search your local library for the book.  This is what the JavaScript code looks like:


<source lang=JavaScript>
<syntaxhighlight lang=JavaScript>
javascript: (function () {
javascript: (function () {
     // first we get the selection; or do it the Microsoft way
     // first we get the selection; or do it the Microsoft way
Line 27: Line 34:
     }
     }
})()
})()
</source>
</syntaxhighlight>


{{Messagebox|type=success|text=Note: for the bookmarklet to work, it all has to be on one line.  The code above is presented on several lines for readability.}}
{{Messagebox|type=success|text=Note: for the bookmarklet to work, it all has to be on one line.  The code above is presented on several lines for readability.}}