// ==UserScript==
// @name           kuvake.net antiprotect
// @namespace      http://tefra.fi/software/greasemonkey/
// @description    Removes the javascript-protection from kuvake.net images
// @include        http://kuvake.net/user/*
// ==/UserScript==

(function() {
    // run after the page has fully loaded
    window.addEventListener("load", removeProtect(), false);

    function removeProtect() {
	// the container holding all the mystical protection stuff
	var photo = document.getElementById("photocontainer");
	if(photo) {
	    // The actual image is hidden as a background image on a surrounding div, we dig it out.
	    var protectDiv = photo.getElementsByTagName("div")[0];
	    if(protectDiv) {
		var bgStyle = protectDiv.style.background;
		// grab the image url from the background
		var image = bgStyle.match(/http.*?jpg/);
		// ...and shove it in the image element already on the page, overwriting the protect gif
		var img = photo.getElementsByTagName("img")[0];
		img.src = image;
	    }
	}
    }

})();
