Difference between revisions of "Library"

From Freephile Wiki
Jump to navigation Jump to search
(adds semi-colon)
 
(10 intermediate revisions by the same user not shown)
Line 1: Line 1:
Suppose you're shopping on Amazon for a book like Lawrence Lessig's '''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 ISBN 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
+
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 ==
 +
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 ==
 +
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 11: Line 22:
 
     var t = window.getSelection ? window.getSelection().toString() : document.selection.createRange().text;
 
     var t = window.getSelection ? window.getSelection().toString() : document.selection.createRange().text;
 
     // create a Regular Expression to test the validity of our input
 
     // create a Regular Expression to test the validity of our input
     var re = /97(?:8|9)([ -])\d{1,5}\1\d{1,7}\1\d{1,6}\1\d$/;
+
     var re = /[\s\-xX0-9]{10,17}/;
 
     var OK = re.exec(t);
 
     var OK = re.exec(t);
 
     if (!OK) {
 
     if (!OK) {
 
       // Notify the user if their selection doesn't look right
 
       // Notify the user if their selection doesn't look right
       alert(t + " isn't a valid ISBN\n Please just select a 10 or 13 digit ISBN\ndashes and spaces are OK");
+
       alert(t + ' is not a valid ISBN\n Please just select a 10 or 13 digit ISBN\ndashes and spaces are OK');
 
     } else {
 
     } else {
       // hand off to MLVC search
+
      // clean up by removing dashes and spaces
 +
      t = t.replace(/[\-\s]/,'');
 +
       // hand off to MVLC search
 
       window.location = 'http://newburyport.mvlc.org/eg/opac/results?contains=contains;_special=1;qtype=identifier%7Cisbn;locg=1;pane=numeric;query=' + t;
 
       window.location = 'http://newburyport.mvlc.org/eg/opac/results?contains=contains;_special=1;qtype=identifier%7Cisbn;locg=1;pane=numeric;query=' + t;
 
     }
 
     }
Line 25: Line 38:
 
{{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.}}
  
Want this bookmarklet?  Drag this link to your browser bookmark bar: <html><a href="javascript: (function(){var t=window.getSelection?window.getSelection().toString():document.selection.createRange().text;var re=/97(?:8|9)([ -])\d{1,5}\1\d{1,7}\1\d{1,6}\1\d$/;var OK=re.exec(t);if(!OK){alert(t+" isn't a valid ISBN\n Please just select a 10 or 13 digit ISBN\ndashes and spaces are OK")}else{window.location="http://newburyport.mvlc.org/eg/opac/results?contains=contains;_special=1;qtype=identifier%7Cisbn;locg=1;pane=numeric;query="+t}})();">Search MLVC</a></html>
+
== Try it ==
  
== Try it ==
+
Select ONLY the numeric portion of an ISBN.  Do not include the letters "ISBN"  The samples listed below also link to the internal ISBN handler of this website.
Select ONLY the numeric portion of an ISBN (dashes and spaces are OK)
 
 
* Little Rabbit Foo Foo is ISBN 0671709682
 
* Little Rabbit Foo Foo is ISBN 0671709682
 
* Free Culture is ISBN 1594200068
 
* Free Culture is ISBN 1594200068
  
If you want to customize the location of the search, you must change the '''locg''' parameter.  <code>locg=1</code> searches across all the MLVC rather than a specific library to cast the widest net - and of course you can always ask for the material to be loaned to your local library.
+
If you want to customize the location of the search, you must change the '''locg''' parameter.  <code>locg=1</code> searches across all the MVLC rather than a specific library to cast the widest net - and of course you can always ask for the material to be loaned to your local library. The Merrimack Valley Library Consortium includes the towns of
 +
 
 +
# Amesbury
 +
# Andover
 +
# Billerica
 +
# Boxford
 +
# Burlington
 +
# Carlisle
 +
# Chelmsford
 +
# Dracut
 +
# Dunstable
 +
# Essex
 +
# Georgetown
 +
# Groton
 +
# Groveland
 +
# Hamilton-Wenham
 +
# Haverhill
 +
# Ipswich
 +
# Lawrence
 +
# Littleton
 +
# Lowell
 +
# Manchester
 +
# Merrimac
 +
# Methuen
 +
# Middleton
 +
# Newbury
 +
# Newburyport
 +
# North
 +
# North
 +
# Rockport
 +
# Rowley
 +
# Salisbury
 +
# Tewksbury
 +
# Topsfield
 +
# Tyngsborough
 +
# West
 +
# Westford
 +
# Wilmington
  
 
[[Category:Library]]
 
[[Category:Library]]

Latest revision as of 12:02, 14 May 2015

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 Library category for all things library.


The bookmarklet[edit | edit source]

Want this bookmarklet? Drag the following link to your browser bookmark bar: Search MVLC

Description[edit | edit source]

Suppose you're shopping on Amazon for a book like Lawrence Lessig's 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 ISBN 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[edit | edit source]

The catalog for the Merrimack Valley Library Consortium supports lookup by ISBN. If you perform the search, you'll notice that the resulting URL for that search is

http://newburyport.mvlc.org/eg/opac/record/888792?contains=contains;_special=1;qtype=identifier%7Cisbn;query=978-1594200069;locg=1

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:

javascript: (function () {
    // first we get the selection; or do it the Microsoft way
    var t = window.getSelection ? window.getSelection().toString() : document.selection.createRange().text;
    // create a Regular Expression to test the validity of our input
    var re = /[\s\-xX0-9]{10,17}/;
    var OK = re.exec(t);
    if (!OK) {
      // Notify the user if their selection doesn't look right
      alert(t + ' is not a valid ISBN\n Please just select a 10 or 13 digit ISBN\ndashes and spaces are OK');
    } else {
      // clean up by removing dashes and spaces
      t = t.replace(/[\-\s]/,'');
      // hand off to MVLC search
      window.location = 'http://newburyport.mvlc.org/eg/opac/results?contains=contains;_special=1;qtype=identifier%7Cisbn;locg=1;pane=numeric;query=' + t;
    }
})()

Note: for the bookmarklet to work, it all has to be on one line. The code above is presented on several lines for readability.

Try it[edit | edit source]

Select ONLY the numeric portion of an ISBN. Do not include the letters "ISBN" The samples listed below also link to the internal ISBN handler of this website.

  • Little Rabbit Foo Foo is ISBN 0671709682
  • Free Culture is ISBN 1594200068

If you want to customize the location of the search, you must change the locg parameter. locg=1 searches across all the MVLC rather than a specific library to cast the widest net - and of course you can always ask for the material to be loaned to your local library. The Merrimack Valley Library Consortium includes the towns of

  1. Amesbury
  2. Andover
  3. Billerica
  4. Boxford
  5. Burlington
  6. Carlisle
  7. Chelmsford
  8. Dracut
  9. Dunstable
  10. Essex
  11. Georgetown
  12. Groton
  13. Groveland
  14. Hamilton-Wenham
  15. Haverhill
  16. Ipswich
  17. Lawrence
  18. Littleton
  19. Lowell
  20. Manchester
  21. Merrimac
  22. Methuen
  23. Middleton
  24. Newbury
  25. Newburyport
  26. North
  27. North
  28. Rockport
  29. Rowley
  30. Salisbury
  31. Tewksbury
  32. Topsfield
  33. Tyngsborough
  34. West
  35. Westford
  36. Wilmington