js/bootstrap-386.js
changeset 0 ba8ab09f730e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/js/bootstrap-386.js	Fri Jul 04 16:42:41 2014 +0400
     1.3 @@ -0,0 +1,73 @@
     1.4 +$(function(){
     1.5 +  var 
     1.6 +    character = {
     1.7 +      height: 20,
     1.8 +      width: 12.4
     1.9 +    },
    1.10 +    wrap = document.createElement('div'),
    1.11 +    bar = wrap.appendChild(document.createElement('div')),
    1.12 +
    1.13 +    cursor = document.createElement('div'),
    1.14 +    // If the user specified that the visibility is hidden, then we
    1.15 +    // start at the first pass ... otherwise we just do the 
    1.16 +    // cursor fly-by
    1.17 +    pass = ($(document.body).css('visibility') == 'visible') ? 1 : 0,
    1.18 +    height = $(window).height(),
    1.19 +    width = $(window).width(),
    1.20 +
    1.21 +    // this makes the loading of the screen proportional to the real-estate of the window.
    1.22 +    // it helps keep the cool sequence there while not making it waste too much time.
    1.23 +    rounds = (height * width / 165000),
    1.24 +    column = width, row = height - character.height;
    1.25 +    // TODO: externalize this
    1.26 +    //
    1.27 +  wrap.setAttribute('style', 'z-index:9999999;background:#000084;position:fixed;bottom:0;right:0;height:100%;width:100%');
    1.28 +  bar.setAttribute('style', 'color:#fff;font-weight:bold;float:right;background:#000084;height:20px;margin-top:-20px;width:100%');
    1.29 +  cursor.setAttribute('style', 'z-index:9999999;color:#fff;font-weight:bold;position:fixed;bottom:0;right:0');
    1.30 +
    1.31 +  cursor.innerHTML = bar.innerHTML = '▄';
    1.32 +
    1.33 +  // only inject the wrap if the pass is 0
    1.34 +  if(pass === 0) {
    1.35 +    document.body.appendChild(wrap);
    1.36 +    document.body.style.visibility='visible';
    1.37 +  } else {
    1.38 +    document.body.appendChild(cursor);
    1.39 +    rounds /= 2;
    1.40 +    character.height *= 4;
    1.41 +  }
    1.42 +
    1.43 +  var ival = setInterval(function(){
    1.44 +    for(var m = 0; m < rounds; m++) {
    1.45 +      column -= character.width;
    1.46 +
    1.47 +      if(column <= 0) {
    1.48 +        column = width;
    1.49 +        row -= character.height;
    1.50 +      }
    1.51 +      if(row <= 0) {
    1.52 +        pass++;
    1.53 +        row = height - character.height;
    1.54 +
    1.55 +        if(pass == 2) {
    1.56 +          document.body.removeChild(cursor);
    1.57 +          clearInterval(ival);
    1.58 +        } else {
    1.59 +          wrap.parentNode.removeChild(wrap);
    1.60 +          document.body.appendChild(cursor);
    1.61 +          rounds /= 2;
    1.62 +          character.height *= 4;
    1.63 +        }
    1.64 +      }
    1.65 +
    1.66 +      if(pass === 0) {
    1.67 +        bar.style.width = column + "px";
    1.68 +        wrap.style.height = row + "px";
    1.69 +      } else {
    1.70 +        cursor.style.right = column + "px";
    1.71 +        cursor.style.bottom = row + "px";
    1.72 +      }
    1.73 +    }
    1.74 +  }, 1);
    1.75 +});
    1.76 +