UHM CS proxy converter Bookmarklet source

Update: Don’t use this bookmarklet, use the better one discussed here.

This is the source for the bookmarklet I wrote to switch to the UH Manoa proxy for some sites that are useful to computer scientists. The first comment line has the source converted into a form that can be pasted into the location field of a browser or pasted into the URL field of a bookmark.

// javascript:void((function(){switch%20(location.host)%20{case%20%22ieeexplore.ieee.org%22:location.href=location.href.replace(/^http\:\/\/([^\/\@]+)\/(?:)/,%22http://micro189.lib3.hawaii.edu:2393/%22);break;case%20%22portal.acm.org%22:location.href=location.href.replace(/^http\:\/\/([^\/\@]+)\/(?:)/,%22http://micro189.lib3.hawaii.edu:2540/%22);break;case%20%22safari.oreilly.com%22:location.href=location.href.replace(/^http\:\/\/([^\/\@]+)\/(?:)/,%22http://micro189.lib3.hawaii.edu:3217/%22);break;default:alert(%22Current%20page%20is%20not%20IEEE%20Xplore,%20ACM%20Digital%20Library,%20or%20Safari%20Online,%20no%20action%20taken%22);}})())
//   Redirects from IEEE Xplore, ACM Digital Library, or Safari Books Online sites to the
//   University of Hawaii proxy that allows UH users full access.

void(
    (function(){
    	switch (location.host) {
    	case "ieeexplore.ieee.org":
    		location.href=location.href.replace(
    			/^http\:\/\/([^\/\@]+)\/(?:)/,
    			"http://micro189.lib3.hawaii.edu:2393/");
    		break;
    	case "portal.acm.org":
    		location.href=location.href.replace(
    			/^http\:\/\/([^\/\@]+)\/(?:)/,
    			"http://micro189.lib3.hawaii.edu:2540/");
			break;
    	case "safari.oreilly.com":
    		location.href=location.href.replace(
    			/^http\:\/\/([^\/\@]+)\/(?:)/,
    			"http://micro189.lib3.hawaii.edu:3217/");
			break;
		default:
			alert("Current page is not IEEE Xplore, ACM Digital Library, or Safari Online, no action taken");
    	}
    })()
)

One thought on “UHM CS proxy converter Bookmarklet source

  1. Pingback: IEEE Xplore, ACM Digital Library, Safari Online Bookmarklet « Seize the Moment of Excited Curiosity for the Acquisition of Knowledge

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s