summaryrefslogtreecommitdiff
path: root/static/background.js
blob: edbe5b1b257ec69f99ad1396a4c26d92fc43a1be (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
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 = document.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;
}