indvd00m@0: $(function(){ indvd00m@0: var indvd00m@0: character = { indvd00m@0: height: 20, indvd00m@0: width: 12.4 indvd00m@0: }, indvd00m@0: wrap = document.createElement('div'), indvd00m@0: bar = wrap.appendChild(document.createElement('div')), indvd00m@0: indvd00m@0: cursor = document.createElement('div'), indvd00m@0: // If the user specified that the visibility is hidden, then we indvd00m@0: // start at the first pass ... otherwise we just do the indvd00m@0: // cursor fly-by indvd00m@0: pass = ($(document.body).css('visibility') == 'visible') ? 1 : 0, indvd00m@0: height = $(window).height(), indvd00m@0: width = $(window).width(), indvd00m@0: indvd00m@0: // this makes the loading of the screen proportional to the real-estate of the window. indvd00m@0: // it helps keep the cool sequence there while not making it waste too much time. indvd00m@0: rounds = (height * width / 165000), indvd00m@0: column = width, row = height - character.height; indvd00m@0: // TODO: externalize this indvd00m@0: // indvd00m@0: wrap.setAttribute('style', 'z-index:9999999;background:#000084;position:fixed;bottom:0;right:0;height:100%;width:100%'); indvd00m@0: bar.setAttribute('style', 'color:#fff;font-weight:bold;float:right;background:#000084;height:20px;margin-top:-20px;width:100%'); indvd00m@0: cursor.setAttribute('style', 'z-index:9999999;color:#fff;font-weight:bold;position:fixed;bottom:0;right:0'); indvd00m@0: indvd00m@0: cursor.innerHTML = bar.innerHTML = '▄'; indvd00m@0: indvd00m@0: // only inject the wrap if the pass is 0 indvd00m@0: if(pass === 0) { indvd00m@0: document.body.appendChild(wrap); indvd00m@0: document.body.style.visibility='visible'; indvd00m@0: } else { indvd00m@0: document.body.appendChild(cursor); indvd00m@0: rounds /= 2; indvd00m@0: character.height *= 4; indvd00m@0: } indvd00m@0: indvd00m@0: var ival = setInterval(function(){ indvd00m@0: for(var m = 0; m < rounds; m++) { indvd00m@0: column -= character.width; indvd00m@0: indvd00m@0: if(column <= 0) { indvd00m@0: column = width; indvd00m@0: row -= character.height; indvd00m@0: } indvd00m@0: if(row <= 0) { indvd00m@0: pass++; indvd00m@0: row = height - character.height; indvd00m@0: indvd00m@0: if(pass == 2) { indvd00m@0: document.body.removeChild(cursor); indvd00m@0: clearInterval(ival); indvd00m@0: } else { indvd00m@0: wrap.parentNode.removeChild(wrap); indvd00m@0: document.body.appendChild(cursor); indvd00m@0: rounds /= 2; indvd00m@0: character.height *= 4; indvd00m@0: } indvd00m@0: } indvd00m@0: indvd00m@0: if(pass === 0) { indvd00m@0: bar.style.width = column + "px"; indvd00m@0: wrap.style.height = row + "px"; indvd00m@0: } else { indvd00m@0: cursor.style.right = column + "px"; indvd00m@0: cursor.style.bottom = row + "px"; indvd00m@0: } indvd00m@0: } indvd00m@0: }, 1); indvd00m@0: }); indvd00m@0: