Reverse Engineering

Leading Your Users through the Amazon Web Forest
by Jeffrey Bower & Matthew David

 

Terminology

User Scripts

á             Scripts that are created by users. These scripts are often used to change the appearance of a web page. A Òscript is a list of commands that can be executed without user interactionÓ (www.webopedia.com).

Greasemonkey

á             Allows you to customize the way a webpage displays using small bits of JavaScript.

Add-ons

á             Add-ons (also known as plug-ins/extensions) are additions to a browser that are used to affect the appearance of the browser or web page.

Reverse Engineer

á             ÒTo disassemble and examine or analyze in detail (as a product or device) to discover the concepts involved in manufacture usually in order to produce something similarÓ (www.merriam-webster.com).

IE/IE7

á             Internet Explorer/Internet Explorer 7

 

 

Resources

á             Userscripts.org

á              addons.mozilla.org

á              iescripts.org

á              ie7pro.com

 

Desired Outcome

á             At the end of this process you will be able to create a presence of your libraryÕs catalog on AmazonÕs site.

 

 

Before You Begin

á             Get in touch with your IT Department and give them a copy of the instructions, so they know what you want to do and can assist. The instructions below may need to be adjusted depending on what ILS you use.


Instructions

1.         Create a userscripts.org account: http://userscripts.org/signup

2.          Activate your account; Login to your account

3.          Go to: http://userscripts.org/scripts/review/25711?format=txt

4.          Select all of the text and paste it into a Notepad (or TextEdit) document. You will make the changes there before you save it to your account.

5.          Edit the title section of the script (only edit the sections highlighted here in yellow) to reflect your library:

// ==UserScript==

// @name                               Madigan Library Lookup

// @namespace                  http://www.pct.edu/library

// @description                    Search Madigan Library Catalog from Amazon book listings.

// @include                              http://*.amazon.*

// ==/UserScript==

 

6.        Edit the catalog variables (listed below) in the script to point to your catalog

a.          Search (ctrl-f) for Òvar urlSearchÓ and you will be taken directly to this code:

var urlSearch

urlSearch = "http://proteus.pct.edu/uhtbin/cgisirsi/X/0/0/123?searchdata1="

urlSearch += isbn

urlSearch += "&srchfield1=GENERAL^SUBJECT^GENERAL^^words or phrase"

var urlCat = http://proteus.pct.edu/uhtbin/cgisirsi/X/0/0/60/502/X

var library = ÒMadigan LibraryÓ

var loading = "<img src='http://www.pct.edu/library/images/misc/loading.gif'>"

 

 

¤    urlSearch is your (static) link to your online library catalog.

¤    A static catalog link is a link that will give users persistent access to your catalog (without logging in).

¤    As illustrated above, the urlSearch link is created in three sections.

¤    In able to place the link into the three sections, you need to decrypt the search string qualifiers within your static search link. For example:

http://proteus.pct.edu/uhtbin/cgisirsi/X/0/0/123?searchdata1= 9780470241998&srchfield1=GENERAL^SUBJECT^GENERAL^^words or phrase

is the Madigan LibraryÕs static catalog link for the book ÒWeb 2.0 HerosÓ.

¤    The search string qualifier for the ISBN number is Òsearchdata1=Ó

Òhttp://proteus.pct.edu/uhtbin/cgisirsi/X/0/0/123?searchdata1= 9780470241998&srchfield1=GENERAL^SUBJECT^GENERAL^^words or phraseÓ

as the ISBN number follows after Òsearchdata1=Ó. This is the main qualifier that we are looking for and will be our main ÒsplittingÓ point.

¤    You may need to contact your IT Department to figure out exactly what your static link should be. They should also be able to help you in figuring out which qualifier in the link is the one where the ISBN value should go.

 

 

 

b.         We are now ready to insert this link into the proper variable positions:

var urlSearch

urlSearch = http://proteus.pct.edu/uhtbin/cgisirsi/X/0/0/123?searchdata1=

We now split the link by the isbn value. The first half goes into the highlighted section above.

urlSearch += isbn

You do not need to change this line of code.

urlSearch += &srchfield1=GENERAL^SUBJECT^GENERAL^^words or phrase

This is where the second half of the url string goes.

If your catalog doesnÕt have conditions after the isbn string query, then simply use double quotes: urlSearch += ÒÓ

var urlCat = http://proteus.pct.edu/uhtbin/cgisirsi/X/0/0/60/502/X

This will be the link to your online catalog (static link needed).

var library = ÒMadigan LibraryÓ

The name of your library in quotes.

var loading = "<img src='http://www.pct.edu/library/images/misc/loading.gif'>"

Either change the url to the loading image of your choosing or replace the whole string with loading text, example: var loading = ÒLoadingÉÓ

7.          Once you have made all the changes to this file in Notepad go back to your userscript.org account (login if necessary).

8.          Once logged in proceed to this link: http://userscripts.org/scripts/new

9.          Select ÒInput script source manuallyÓ from the radio button selection, this will open a text field. In this text field you will copy & paste the edited code that you have in Notepad (or TextEdit). Once you pasted your code into this field click ÒcreateÓ.

10.    Once you have it created all you have to do is install GreaseMonkey (see instructions below) and then install your newly uploaded script at userscripts.org.

 

 

Installing GreaseMonkey (Firefox only)

1.        Download and install the add-on ÒGreasemonkeyÓ for Firefox. (click ÒAdd to FirefoxÓ)

a.          https://addons.mozilla.org/en-US/firefox/addon/748

2.          Once installed return back to userscripts.org and (if not already done) log into your account.

3.          Go to: http://userscripts.org/home/scripts

4.          Click on the title of your uploaded script. This will take you to the installation page.

5.          Click ÒinstallÓ to install your script that you created.

6.          You will be confronted with a ÒGreasemonkey InstallationÓ window, click install.

7.          Do a search on Amazon, once the script is installed, to see if it is properly configured.

8.          If the script is properly configured you should see a library catalog search result appear underneath the Òadd to cartÓ section of the page.

 

 

Installing IE7Pro & GreaseMonkey Emulator (IE7 only)

Internet Explorer requires a few separate steps to be able to have IE7 users use the scripts.

1.        Download and install the IE7Pro add-on http://www.ie7pro.com/

2.          Close & restart IE7

3.          Download and install (see note on next page) FremyCompanyÕs IE7 Greasemonkey Emulator Script http://userscripts.org/scripts/source/8275.user.js

4.          Once this script is installed return back to your script page and click ÒinstallÓ to install your Library Lookup script that you created (see note on next page).

5.          Go to Tools -> IE7pro Preferences -> User Scripts

6.          Enable ÒEnable User ScriptsÓ if it is not already checked.

7.          Also check to see that Ò.FremyCompany ScriptÓ and your ÒLibrary Lookup script isÓ checked. Check any of those scripts if they are unchecked then click ÒReload All ScriptsÓ, click ok.

8.          Do a search on Amazon, once the script is installed, to see if it is properly configured.

9.          If the script is properly configured you should see a library catalog search result appear underneath the Òadd to cartÓ section of the page.

 

Note: When saving scripts in IE it will only save them to your download directory. To save the scripts to their proper place, save (or move after downloading) to the following folder location:

C:\Program Files\IEPro\userscripts\

 

This will allow the scripts to run in IE7