User:Arch dude/worldcat

Worldcat is a catalog of the works available in 57,000 physical libraries around the world. The catalog is now freely available online. It is far and away the largest such resource. Worldcat has recently added a usable "identities" feature. I became interested in Worldcat through the work of User:Dsp13. I have added a template: template:worldcat id.

To use this template, first do a worldcat identies lookup. Enter the person's name (e.g, Samuel Phillips.) This will often lead to a list of possible matches. Select the correct link (e.g., "Phillips, Samuel 1752-1802") and click on it. This will lead to the correct page on Worldcat. The id is the string after the last slash in the URL, e.g., lccn-n85-221132. Now, fill in your template as follows:
 * or
 * if the article name is not the name you wish to display
 * if the article name is not the name you wish to display
 * if the article name is not the name you wish to display

This yields
 * [//worldcat.org/identities/lccn-n85-221132 Works by or about Samuel Philips, LL.D.] in libraries (WorldCat catalog)

Here is the question: should we encourage the use of this template? User:Dsp13 tried to introduce Worldcat links a year ago and got a lot of push-back from the folks who worry about link spam. I think that Worldcat links are perhaps the most useful links there are, and are not by any means spam. I see this as part of a "grand unification" of two major web resources, but I would like to see a consensus before proceeding.

I feel that the justifications for Worldcat are clear:
 * With one link, we add a massive bibliography an article.
 * The Worldcat bibliography is biased, but the bias is at least based on the consensus of thousands of librarians throughout the (mostly english-speaking part of) the world rather than a few Wikipedia editors.
 * A high number of library accessions as subject or author is prima facie evidence of notability and the link makes it trivially easy to verify the notability.
 * The easy availability of this link may encourage editors to actually go find the real books rather than just surfing the web for references.
 * Worldcat is starting to link to Wikipedia. We should return the favor. The community that uses Worldcat should be enticed to become Wikipedia editors as they are likely to be knowledgeable.

If we reach a consensus that Worldcat links should be encouraged, It should be relatively easy to use a semi-automated technique to add the templates to the articles. Based on User:Dsp13's lists, we have articles on all but 37 of the 1500 subjects with the largest library presence, and I suspect a very large percentage of our pre-1995 biographies have Worldcat bibliographies.

Add-on basics
The basic problem here is that I have never written a Firefox extension before, but what the heck, let's try. ... Yuck. It took me about 40 minutes to get the trivial example running. The Building an Extension page gives good basic advice. It misses three things:
 * Where exactly is the "extensions" directory for Firefox.
 * In Linux, the extensions directory is at:
 * ~/.mozilla/firefox/ .default/extensions/
 * Where is a random string of characters. Put your sample@sample.sample file in this directory.
 * What is XUL and where does the javascript go?
 * The meat of an add-on is in the XUL file and in any javascript files used by it. XUL defines the graphical elements, and names the javascript files. Put the Javascript files in the same directory (i.e., .../contents/) with the XUL file. Then go read the XUL tutorial
 * What is "the DOM" and where is it documented?
 * This is the scary one, and I do not yet have an answer after spending at least four hours over six days. It took about ten minutes to understand in the abstract what "the DOM" is: to a first approximation it is the class hierarchy for the Firefox GUI, with all methods and variables defined. The rest of the time has been spent trying to find the documentation for the Firefox DOM. No luck so far. I only need the names DOM names for the following
 * I am making slow progress. I dropped this project for awhile, then came back. As of now, I automatically load the Wikipedia pagename into the searchbar, and I automatically recognize and extract the WorldCat page and go back to the Wikipedia page. I now need to implement the edit-assist part. -Arch dude (talk) 01:07, 19 November 2007 (UTC)
 * My edit-assist is crude. I cannot figure our how to modify the context menu (i.e., the right-click popup) so I am using special keyboard keys instead. First, I use the standart Wikipedia edit page instead of using WikED. This lets my identify the two interesting fields by name:
 * editform=content.document.getElementById("wpTextbox1");
 * and
 * editsummary=content.document.getElementById("wpSummary");


 * I simply attach a keypress event to the editform, and then capture the keys of interest. -Arch dude (talk) 01:24, 26 November 2007 (UTC)

Functionality
First, get a list of Wikipedia articles with WorldCat names. This is a separate manual or automated process. I hope that User:Dsp13 will deal with this. The Firefox add-on will then assist the user to make the edits on a one-by-one basis. For each item in the list:
 * User surfs to Wikipedia page
 * whenever a user loads any page, check if it is a Wikipedia mainspace page. If so, preload the search box with a cleaned-up version of the article name.
 * make the identity search
 * user optionally edits the name in the searchbox
 * user clicks the search button
 * the search add-on formats a Worldcat searh URL and loads the page:
 * http://orlabs.oclc.org/Identities/find?fullName=Samuel+Phillips
 * Whenever a user loads a page, the add-on checks to see if the URL is a WorldCat ID page with a URL of the form:
 * http://orlabs.oclc.org/Identities/lccn-n85-221132
 * user hits the "get id" button.
 * script extracts id string and stores it internally
 * script goes back to Wikipedia page.
 * user edits the article
 * user clicks edit on section or page
 * user navigates to correct location
 * user types the paste id key
 * script pastes worldcat id template
 * script adds edit summary

Toolbar shows an "id" button next to the searchbar. This is the only extra button. We use the searchbar for everything else.

Instead of doing the Worldcat search from within this addon, I have created a separate Worldcat ID search addon. A search addon is a completely different type of addon that adds a new search engine to the list of engines in the searchbar. This approach lets the user make worldcat searches independently of the linker addon. It also lets the user use the linker addon with other search engines, since the linker addon loads the searchbar with the (cleaned) page title.

Features to add
As implemented, this is now four independent but interacting features:
 * Searchbar preloader for Wikipedia mainpages
 * Worldcat search engine addon
 * Store id and go back to Wikipedia
 * Edit assistant for Wikipedia.

Each of these is independently useful and can readily be extended.The preloader could be extended to non-wiki. Teh search engine can search any site, not just Worldcat (this is already done.) The Store-and-back can go back to the page prior to any search, not just back to Wikipedia, and and work with the Store to dynamically define the strings to add to the edit form.