github.com/jmbataller/terraform@v0.6.8-0.20151125192640-b7a12e3a580c/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 //always init sidebar 25 Init.initializeSidebar(); 26 }, 27 28 initializeSidebar: function(){ 29 new Sidebar(); 30 }, 31 32 generateAnimatedLogo: function(){ 33 var container, x, block; 34 35 container = document.createElement('div'); 36 container.className = 'animated-logo'; 37 38 for (x = 1; x < 5; x++) { 39 block = document.createElement('div'); 40 block.className = 'white-block block-' + x; 41 container.appendChild(block); 42 } 43 44 return container; 45 }, 46 47 initializeEngine: function(){ 48 var jumbotron = document.getElementById('jumbotron'), 49 content = document.getElementById('jumbotron-content'), 50 tagLine = document.getElementById('tag-line'), 51 canvas, galaxy; 52 53 if (!jumbotron) { 54 return; 55 } 56 57 galaxy = document.createElement('div'); 58 galaxy.id = 'galaxy-bg'; 59 galaxy.className = 'galaxy-bg'; 60 jumbotron.appendChild(galaxy); 61 62 content.appendChild( 63 Init.generateAnimatedLogo() 64 ); 65 66 canvas = document.createElement('canvas'); 67 canvas.className = 'terraform-canvas'; 68 69 jumbotron.appendChild(canvas); 70 new Engine(canvas, galaxy, tagLine); 71 }, 72 73 Pages: { 74 'page-home': function(){ 75 if (isIE) { 76 document.getElementById('jumbotron').className += ' static'; 77 document.getElementById('tag-line').style.visibility = 'visible'; 78 return; 79 } 80 81 Init.initializeEngine(); 82 } 83 } 84 85 }; 86 87 Init.start(); 88 89 })(window.Engine);