github.com/nicgrayson/terraform@v0.4.3-0.20150415203910-c4de50829380/website/source/assets/javascripts/app/Init.js (about) 1 (function( 2 Engine 3 ){ 4 5 // Quick and dirty IE detection 6 var isIE = (function(){ 7 if (window.navigator.userAgent.match('Trident')) { 8 return true; 9 } else { 10 return false; 11 } 12 })(); 13 14 // isIE = true; 15 16 var Init = { 17 18 start: function(){ 19 var id = document.body.id.toLowerCase(); 20 21 if (this.Pages[id]) { 22 this.Pages[id](); 23 } 24 }, 25 26 generateAnimatedLogo: function(){ 27 var container, x, block; 28 29 container = document.createElement('div'); 30 container.className = 'animated-logo'; 31 32 for (x = 1; x < 5; x++) { 33 block = document.createElement('div'); 34 block.className = 'white-block block-' + x; 35 container.appendChild(block); 36 } 37 38 return container; 39 }, 40 41 initializeEngine: function(){ 42 var jumbotron = document.getElementById('jumbotron'), 43 content = document.getElementById('jumbotron-content'), 44 tagLine = document.getElementById('tag-line'), 45 canvas, galaxy; 46 47 if (!jumbotron) { 48 return; 49 } 50 51 galaxy = document.createElement('div'); 52 galaxy.id = 'galaxy-bg'; 53 galaxy.className = 'galaxy-bg'; 54 jumbotron.appendChild(galaxy); 55 56 content.appendChild( 57 Init.generateAnimatedLogo() 58 ); 59 60 canvas = document.createElement('canvas'); 61 canvas.className = 'terraform-canvas'; 62 63 jumbotron.appendChild(canvas); 64 new Engine(canvas, galaxy, tagLine); 65 }, 66 67 Pages: { 68 'page-home': function(){ 69 if (isIE) { 70 document.getElementById('jumbotron').className += ' static'; 71 document.getElementById('tag-line').style.visibility = 'visible'; 72 return; 73 } 74 75 Init.initializeEngine(); 76 } 77 } 78 79 }; 80 81 Init.start(); 82 83 })(window.Engine);