/* Ancient fireworks slider control code (2005) http://schillmania.com/projects/fireworks/ -------------------------------------------- Not required for your use! */ function Animator2() { var self = this; this.tweens = []; this.tweens['default'] = [1,2,3,4,5,6,7,8,9,10,9,8,7,6,5,4,3,2,1]; this.tweens['blast'] = [12,12,11,10,10,9,8,7,6,5,4,3,2,1]; this.tweens['fade'] = [10,10,10,10,10,10,10,10,10,10]; this.queue = []; this.queue.IDs = []; this.active = false; this.timer = null; this.createTween = function(start,end,type) { // return array of tween coordinate data (start->end) type = type||'default'; var tween = [start]; var tmp = start; var diff = end-start; var x = self.tweens[type].length; for (var i=0; i= 0.4 && pos <= 0.6) { pos = 0.5; } pos = parseInt(pos*100); // writeDebug('getPanX('+x+'): '+pos+'%'); return pos; } this.isEmpty = function(o) { // needs further hacking return (typeof(o)=='undefined'||(o==null&&o!=0)||(o==''&&o!=0)||o=='null'); } this.init = function() { // self.oFW = document.getElementById('fw'); // self.oFP = document.getElementById('fp'); // if (typeof(enableDebugMode)!='undefined' && (self.DEBUG||window.location.toString().toLowerCase().indexOf('debug')>=0)) enableDebugMode(); self.getWindowCoords(); self.animator = new Animator2(); } this.destructor = function() { /* for (var i=self.fireworks.length; i--;) { self.fireworks[i] = null; } self.fireworks = null; if (soundManager) { soundManager.destructor(); soundManager = null; } */ } if (this.isSafari || this.isOpera) this.getWindowCoords = this.getWindowCoordsAlt; } function Controller(o) { var self = this; this.o = o; this.controls = []; this.cb = []; this.options = []; this.functionExample = document.getElementById('function-example'); this.fbIE = null; this.randomize = function() { for (var i=1; i,\n\ autoPlay: "+threeSixtyPlayer.config.autoPlay+",\n\ allowMultiple: "+threeSixtyPlayer.config.allowMultiple+",\n\ loadRingColor: '"+threeSixtyPlayer.config.loadRingColor+"',\n\ playRingColor: '"+threeSixtyPlayer.config.playRingColor+"',\n\ backgroundRingColor: '"+threeSixtyPlayer.config.backgroundRingColor+"',\n\ circleDiameter: "+threeSixtyPlayer.config.circleDiameter+",\n\ circleRadius: "+threeSixtyPlayer.config.circleRadius+",\n\ imageRoot: '"+threeSixtyPlayer.config.imageRoot+"',\n\ animDuration: "+threeSixtyPlayer.config.animDuration+",\n\ animTransition: Animator.tx.bouncy,\n\ showHMSTime: "+threeSixtyPlayer.config.showHMSTime+",\n\ \n\ useWaveformData: "+threeSixtyPlayer.config.useWaveformData+",\n\ waveformDataColor: '"+threeSixtyPlayer.config.waveformDataColor+"',\n\ waveformDataDownsample: "+threeSixtyPlayer.config.waveformDataDownsample+",\n\ waveformDataOutside: "+threeSixtyPlayer.config.waveformDataOutside+",\n\ waveformDataConstrain: false,\n\ waveformDataLineRatio: "+threeSixtyPlayer.config.waveformDataLineRatio+",\n\ \n\ useEQData: "+threeSixtyPlayer.config.useEQData+",\n\ eqDataColor: '"+threeSixtyPlayer.config.eqDataColor+"',\n\ eqDataDownsample: "+threeSixtyPlayer.config.eqDataDownsample+",\n\ eqDataOutside: "+threeSixtyPlayer.config.eqDataOutside+",\n\ eqDataLineRatio: "+threeSixtyPlayer.config.eqDataLineRatio+",\n\ \n\ usePeakData: "+threeSixtyPlayer.config.usePeakData+",\n\ peakDataColor: '"+threeSixtyPlayer.config.peakDataColor+"',\n\ peakDataOutside: "+threeSixtyPlayer.config.peakDataOutside+",\n\ peakDataLineRatio: "+threeSixtyPlayer.config.peakDataLineRatio+",\n\ \n\ useAmplifier: "+threeSixtyPlayer.config.useAmplifier+"\n\ \n\ }"; document.getElementById('config-code').style.display = 'block'; // weird Fx fix } this.createCustomFirework = function() { } this.destructor = function() { for (var i=self.controls.length; i--;) { self.controls[i].destructor(); } for (i=self.cb.length; i--;) { self.cb.onclick = null; self.cb[i] = null; } for (i=self.options.length; i--;) { self.options[i] = null; } if (navigator.userAgent.match(/msie/i)) { self.fbIE.onmouseover = null; self.fbIE.onmouseout = null; self.fbIE = null; } self.cb = null; self.options = null; self.controls = null; self.functionExample = null; self.o = null; } var items = parseInt(this.o.length/3); for (var i=0; iself.xMax) { x = self.xMax; } else if (x=self.tween.length-1) { self.active = false; self.frame = 0; if (self._oncomplete) self._oncomplete(); // self.doUpdate(); return false; } self.doUpdate(); return true; } this.doUpdate = function(t) { // if (!self.timer) self.timer = setTimeout(self.update,t||20); self.update(); } this.update = function() { self.timer = null; self.value = 1+parseInt(self.x/self.xMax*(self.scale-1)); if (self.value<1) self.value = 1; // if (self.oV.innerHTML != self.value) self.oV.innerHTML = self.value; // self.oV.innerHTML = self.value; } this.setValue = function(x) { self.slide(self.x,Math.min(self.xMax,x)); } this.randomize = function() { self.slide(self.x,parseInt(Math.random()*self.xMax)); } this.destructor = function() { self.o.onmouseover = null; self.o.onmouseout = null; self.o.onmousedown = null; self.o = null; self.oV = null; self.oB.onclick = null; self.oB = null; } if (soundManager.isIE) { // IE is lame, no :hover this.o.onmouseover = this.over; this.o.onmouseout = this.out; } this.o.onmousedown = this.down; this.oB.onclick = this.barClick; self.update(); } var gOID = 0; function demoInit() { controller = new Controller(document.getElementById('controls').getElementsByTagName('dd')); } function demoDestuctor() { controller.destructor(); controller = null; } var controller = null; var mc = new MainController(); // create null objects if APIs not present function createCP(oInput,oHandler) { var Event = YAHOO.util.Event; cpHandler = oHandler; if (picker != null) { // picker.showcontrols(true); var c = oInput.value.substr(1); picker.setValue(hex2decArray([c.substr(0,2),c.substr(2,2),c.substr(4,2)]),true); // be silent return false; } Event.onDOMReady(function() { picker = new YAHOO.widget.ColorPicker("cp-container", { showhsvcontrols: true, showhexcontrols: true, images: { PICKER_THUMB: "../_image/picker_thumb.png", HUE_THUMB: "../_image/hue_thumb.png" } }); // picker.showcontrols(false); //a listener for logging RGB color changes; //this will only be visible if logger is enabled: var onRgbChange = function(o) { /*o is an object { newValue: (array of R, G, B values), prevValue: (array of R, G, B values), type: "rgbChange" } */ cpHandler(o.newValue); controller.updateExampleCode(); } //subscribe to the rgbChange event; picker.on("rgbChange", onRgbChange); //use setValue to reset the value to white: Event.on("reset", "click", function(e) { picker.setValue([255, 255, 255], false); //false here means that rgbChange //wil fire; true would silence it }); //use the "get" method to get the current value //of one of the Color Picker's properties; in //this case, we'll get the hex value and write it //to the log: Event.on("gethex", "click", function(e) { console.log("Current hex value: " + picker.get("hex")); }); }); } var picker = null; cpHandler = function() { } // hex -> dec / dec -> hex // http://www.southwest.com.au/~jfuller/binary/converter.htm function dec2hex(cval) { if (cval > 255) cval = 255; var hexascii = "0123456789ABCDEF"; var cval0 = Math.floor(cval/16); var cval1 = cval-(cval0*16); var c1 = hexascii.charAt(cval0); var c2 = hexascii.charAt(cval1); return (c1+c2); } function hex2dec(cval) { cval = cval.toUpperCase(); var tval = 0; var hexascii = "0123456789ABCDEF"; var mychar, ch; for (var c=0; c