// DeviantART - FullViewer v0.3.2
// Made By Luke Stevenson {http://lucanos.deviantart.com}
// Distributed and Maintained via GMVC
// Last updated: 05 November 2005
//
//   This script modifies all links to "*/deviation/*" pages to point to
// the corresponding "*/view/*" page.  This means the links jump straight
// to Full View as opposed to going through the Standard View page
// first.
//   This script does not change the target for the "Zoom Out" button
// shown on Full View Pages.
//
// ==UserScript==
// @name              DeviantART - FullViewer
// @namespace         http://gmvc.lucanos.com/
// @description       (v0.3.2) Makes all links which refer to "*/deviation/*" refer to "*/view/*".
// @include           http://deviouslyartistic.com*
// ==/UserScript==

(function () {

	var viewLinkRegExp    = /http\:\/\/www\.deviantart\.com\/deviation\/([0-9]{1,})\/$/ig;
	var zoomOutLinkRegExp = / <img src=\"http\:\/\/i\.deviantart\.com\/icons\/deviation\/view.gif\" alt=\"\"\/> Zoom Out/ig;

	for ( a = 0 ; a < document.links.length ; a++ ) {
		var linkMatch = viewLinkRegExp.exec(document.links[a].href);
		var zoomOut   = zoomOutLinkRegExp.test(document.links[a].innerHTML);
		if ( linkMatch && !zoomOut ) {
			document.links[a].href = "http://www.deviantart.com/view/"+linkMatch[1];
		}
	}

})(); 
