diff options
| author | Scott Ostler <sostler@ubuntu.(none)> | 2009-12-15 22:09:02 -0500 |
|---|---|---|
| committer | Scott Ostler <sostler@ubuntu.(none)> | 2009-12-15 22:09:02 -0500 |
| commit | 5a8312ca25868679df1acb3b3fc208482460ee0e (patch) | |
| tree | ea10033604aad870d3eb1fe849a47999919d7164 /static/background.js | |
| parent | 3e3015be26c5d73a864a693e9694b5dee26e8a31 (diff) | |
New design
Diffstat (limited to 'static/background.js')
| -rw-r--r-- | static/background.js | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/static/background.js b/static/background.js new file mode 100644 index 0000000..8eed157 --- /dev/null +++ b/static/background.js @@ -0,0 +1,33 @@ + + +var bgImages = ['shaq.gif','background4.gif','background13.gif','wayne.gif','blink.gif','rhianamoney.gif','britglobe2.gif','gaga.gif']; +var bgIndex = -1; + +function killBackground() { + document.getElementsByTagName('html')[0].style.background = 'none'; +} + +function setBackground(i) { + document.getElementsByTagName('html')[0].style.background = (bgImages[i].indexOf('#')+1?bgImages[i]:'#222 url(/static/'+bgImages[i]+(bgImages[i].indexOf('.gif')==-1?'.jpg':'')+') 50% 50%'); +} + +function getBackground() { + if (++bgIndex>=bgImages.length) bgIndex = 0; + setBackground(bgIndex); +} + +window.onload = function() { + var nAV = navigator.appVersion.toLowerCase(); + if (nAV.match(/msie 5/) || nAV.match(/msie 6/)) return false; + var items = utils.getElementsByClassName('dialog','div'); + for (var i=0,j=items.length; i<j; i++) { + widgets[widgets.length] = new DialogWidget(items[i],i); + } + var d = document.createElement('div'); + d.style.cssText = 'position:fixed;bottom:3px;right:3px;font-size:xx-small;z-index:10'; + d.innerHTML = '<button onclick="getBackground()" title="Rotate background image" style="font-size:xx-small">1</button><button id="animation-demo" onclick="doAnimationDemo()" title="Cheap demo: Adjust width, height and margins, showing fluidity" style="font-size:xx-small">2</button>'; + document.body.appendChild(d); + document.getElementById('animation-demo').style.display = 'block'; + getBackground(); + window.onresize = handleResize; +}
\ No newline at end of file |
