1 /* Copyright 2011 The Dominion of Awesome
2 * See COPYING for licensing information */
6 style: "background-color: black",
10 {style: "border: 2px solid green; padding: 4px", components: [
11 {name: "terminal", nodeTag: "pre", style: "margin: 0; font-family: PCSenior; font-size: 16px"}
15 this.inherited(arguments);
19 this.rate = 360.0 / 1000.0;
23 rendered: function() {
24 this.terminal = this.$.terminal.hasNode();
25 this.blinker = document.getElementById('spinner_blinker');
26 this.blink_active = true;
31 this.timer = setInterval(this.spinner.bind(this), this.delay);
32 this.blinkerTimer = setInterval(this.blink.bind(this), 500);
36 clearInterval(this.timer);
37 clearInterval(this.blinkerTimer);
39 this.blinkerTimer = null;
43 var ms = (new Date()).getMilliseconds();
44 var r = ms * this.rate;
45 var a = Math.tan((r / 180.0) * Math.PI);
46 var b = Math.tan(((r+90) / 180.0) * Math.PI);
49 for (var j=0; j < this.h; j++) {
50 for (var i=0; i < this.w; i++) {
51 if ((r > 90 && r <= 180) || (r > 270 && r < 360) || r == 0) {
52 if ((j-this.ch) * 2 > a * (i-this.cw) && (j-this.ch) * 2 < b * (i-this.cw) ||
53 (j-this.ch) * 2 < a * (i-this.cw) && (j-this.ch) * 2 > b * (i-this.cw) ) {
59 if ((j-this.ch) * 2 > a * (i-this.cw) && (j-this.ch) * 2 > b * (i-this.cw) ||
60 (j-this.ch) * 2 < a * (i-this.cw) && (j-this.ch) * 2 < b * (i-this.cw) ) {
69 this.terminal.innerHTML = t;
72 if (this.blink_active)
73 this.blinker.style.color = '#00FF00';
75 this.blinker.style.color = 'black';
76 this.blink_active = !this.blink_active;