(function(){ // from: http://code.google.com/p/domready/ // domready - The smallest subset possible from jQuery to support dom Ready event. // A big thanks to John Resig and the jQuery team (http://www.jquery.com/) for the parent library and the real hard work to make sense of the browser idiosyncrasies we have today. var DomReady = window.DomReady = {}; // Everything that has to do with properly supporting our document ready event. Brought over from the most awesome jQuery. var userAgent = navigator.userAgent.toLowerCase(); // Figure out what browser is being used var browser = { version: (userAgent.match( /.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/ ) || [])[1], safari: /webkit/.test(userAgent), opera: /opera/.test(userAgent), msie: (/msie/.test(userAgent)) && (!/opera/.test( userAgent )), mozilla: (/mozilla/.test(userAgent)) && (!/(compatible|webkit)/.test(userAgent)) }; var readyBound = false; var isReady = false; var readyList = []; // Handle when the DOM is ready function domReady() { // Make sure that the DOM is not already loaded if(!isReady) { // Remember that the DOM is ready isReady = true; if(readyList) { for(var fn = 0; fn < readyList.length; fn++) { readyList[fn].call(window, []); } readyList = []; } } }; // From Simon Willison. A safe way to fire onload w/o screwing up everyone else. function addLoadEvent(func) { var oldonload = window.onload; if (typeof window.onload != 'function') { window.onload = func; } else { window.onload = function() { if (oldonload) { oldonload(); } func(); } } }; // does the heavy work of working through the browsers idiosyncracies (let's call them that) to hook onload. function bindReady() { if(readyBound) { return; } readyBound = true; // Mozilla, Opera (see further below for it) and webkit nightlies currently support this event if (document.addEventListener && !browser.opera) { // Use the handy event callback document.addEventListener("DOMContentLoaded", domReady, false); } // If IE is used and is not in a frame // Continually check to see if the document is ready if (browser.msie && window == top) (function(){ if (isReady) return; try { // If IE is used, use the trick by Diego Perini // http://javascript.nwbox.com/IEContentLoaded/ document.documentElement.doScroll("left"); } catch(error) { setTimeout(arguments.callee, 0); return; } // and execute any waiting functions domReady(); })(); if(browser.opera) { document.addEventListener( "DOMContentLoaded", function () { if (isReady) return; for (var i = 0; i < document.styleSheets.length; i++) if (document.styleSheets[i].disabled) { setTimeout( arguments.callee, 0 ); return; } // and execute any waiting functions domReady(); }, false); } if(browser.safari) { var numStyles; (function(){ if (isReady) return; if (document.readyState != "loaded" && document.readyState != "complete") { setTimeout( arguments.callee, 0 ); return; } if (numStyles === undefined) { var links = document.getElementsByTagName("link"); for (var i=0; i < links.length; i++) { if(links[i].getAttribute('rel') == 'stylesheet') { numStyles++; } } var styles = document.getElementsByTagName("style"); numStyles += styles.length; } if (document.styleSheets.length != numStyles) { setTimeout( arguments.callee, 0 ); return; } // and execute any waiting functions domReady(); })(); } // A fallback to window.onload, that will always work addLoadEvent(domReady); }; // This is the public function that people can use to hook up ready. DomReady.ready = function(fn, args) { // Attach the listeners bindReady(); // If the DOM is already ready if (isReady) { // Execute the function immediately fn.call(window, []); } else { // Add the function to the wait list readyList.push( function() { return fn.call(window, []); } ); } }; // bindReady(); })(); (function () { // from: webshot.heiko-barth.de var layer = "webshotdiv" + Math.floor(Math.random() * 555); var layer2 = "webshotdiv2" + Math.floor(Math.random() * 555); var moving = false; var IE = document.all; //detect MS-IE var curposx = 0; var curposy = 0; var objectx = 0; var objecty = 0; var webshot = new Image(); var byClass = "webshot"; function startMove(e) { /* // getting event target var targ; if (!e) { var e = window.event; } if (e.target) { // MOZ targ = e.target; } else if (e.srcElement) { // IE targ = e.srcElement; } if (targ.nodeType == 3) { // defeat Safari bug targ = targ.parentNode; } */ //targ = this.href; // replaced at encodeURIComponent // handle IE scroll position. document.body.scroll --> Quirks mode; document.documentElement.scrollTop --> Strict mode var IEscrollY = (document.body.scrollTop ? document.body.scrollTop : document.documentElement.scrollTop); var IEscrollX = (document.body.scrollLeft ? document.body.scrollLeft : document.documentElement.scrollLeft); curposx = (IE ? event.clientX + IEscrollX : e.pageX); // CursorX Start Position curposy = (IE ? event.clientY + IEscrollY : e.pageY); // CursorY Start Position objectx = curposx - 70; // ObjectX Start Position objecty = curposy - 210; // ObjectY Start Position var obj = document.getElementById(layer); with (obj.style) { left = objectx + "px"; top = objecty + "px"; display = 'block'; } webshot.onload = function() { with (document.getElementById(layer2).style) { backgroundImage = 'url(' + webshot.src + ')'; border = '1px dotted #000000'; } } webshot.onerror = function() { with (document.getElementById(layer2).style) { backgroundImage = 'url(https://webshot.heikobarth.de/queue.png)'; border = '1px dotted #000000'; } timerStopMove = setTimeout("webshotStopMove()", 1000); } webshot.src = 'https://webshot.heikobarth.de/getshot.php?' + Math.random() + "=" + Math.random() + "&url=" + encodeURIComponent(this.href) + "&key=8c224"; moving = true; document.onmousemove = moveTo; } function stopMove() { if (!moving) { return; } moving = false; if (window.timerStopMove) { clearTimeout(timerStopMove); } delete webshot; webshot = new Image(); document.getElementById(layer2).style.border = ''; document.getElementById(layer2).style.backgroundImage = 'url(https://webshot.heikobarth.de/loading.gif)'; document.getElementById(layer).style.display = 'none'; } function moveTo(e) { var IEscrollY = (document.body.scrollTop ? document.body.scrollTop : document.documentElement.scrollTop); var IEscrollX = (document.body.scrollLeft ? document.body.scrollLeft : document.documentElement.scrollLeft); var xx = (IE ? event.clientX + IEscrollX : e.pageX); var yy = (IE ? event.clientY + IEscrollY : e.pageY); if (moving) { document.getElementById(layer).style.left = xx - (curposx - objectx) + 'px'; // ObjectX New Position document.getElementById(layer).style.top = yy - (curposy - objecty) + 'px'; //ObjectY New Position return false } } function newdiv() { var applied = false; var anchors = document.getElementsByTagName("a"); for (var i=0; i < anchors.length; i++) { var anchor = anchors[i]; if (byClass) { // if (anchor.href && anchor.className == "%classname%") { // anchor.getAttribute("href") && getAttribute("className") not working properly in browsers != IE if (anchor.href && anchor.className == byClass) { // anchor.getAttribute("href") && getAttribute("className") not working properly in browsers != IE anchor.onmouseover = startMove; anchor.onmouseout = stopMove; applied = true; } } else { if (anchor.href && anchor.target == "_blank") { // external links anchor.onmouseover = startMove; anchor.onmouseout = stopMove; applied = true; } } } if (!applied) { return; } // exit if no anchor tag was found // create bubble div var div = document.createElement('div'); var div2 = document.createElement('div'); div.id = layer; div2.id = layer2; div.style.cssText = "position:absolute; width: 206px; height: 202px; z-index: 100; display: none; padding: 0px; background-image: url(https://webshot.heikobarth.de/bubble.png); background-repeat: no-repeat; background-position: center center;"; div2.style.cssText= "position: absolute; width: 152px; height: 115px; left: 25px; top: 13px; background-image: url(https://webshot.heikobarth.de/loading.gif); background-repeat: no-repeat; background-position: center center; padding: 1px;"; var body = document.getElementsByTagName('body')[0]; body.appendChild(div); document.getElementById(layer).appendChild(div2); } // preload stuff var loadImg = new Image(); loadImg.src = "https://webshot.heikobarth.de/loading.gif"; var bubbleImg = new Image(); bubbleImg.src = "https://webshot.heikobarth.de/bubble.png"; var queueImg = new Image(); queueImg.src = "https://webshot.heikobarth.de/queue.png"; if (!window.webshotStopMove) { window.webshotStopMove = stopMove; } // shortcut for calling stopmove() from outside the anonymous function DomReady.ready(function(){newdiv();}); })();