downloading of script, script updated, support for distrib upload finalized (i think)

This commit is contained in:
sandb
2009-12-29 22:53:31 +01:00
parent 6366bfdef4
commit b77e986a16
9 changed files with 107 additions and 37 deletions

View File

@@ -80,6 +80,37 @@ FullScreenButton.prototype.execute = function() {
//TODO: do somth
};
// Class DownloadScriptButton
jQuery.extend(DownloadScriptButton.prototype, IFaceButton.prototype);
function DownloadScriptButton(x, y) {
this.width = 64;
this.height = 64;
this.isHover = false;
this.dlCol = new Image();
this.dlCol.src = "img/dl-col.png";
this.dl = new Image();
this.dl.src = "img/dl.png";
};
DownloadScriptButton.prototype.draw = function() {
if (this.isHover) {
context.fillStyle = 'rgb(192,192,192)';
context.font = "18pt sans-serif";
context.fillText("Download pamela scanner script", this.x, this.y - 10);
context.drawImage(this.dlCol, this.x, this.y);
} else {
context.drawImage(this.dl, this.x, this.y);
}
};
DownloadScriptButton.prototype.execute = function() {
location.href = 'pamela-scanner.sh';
};
// Class IFace buttons
function IFaceButtons() {
this.buttons = [];
@@ -91,11 +122,11 @@ IFaceButtons.prototype.add = function(button) {
};
IFaceButtons.prototype.reposition = function() {
var x = width - 64;
var x = 20;
var y = height - 64;
for (var i = 0; i < this.buttons.length; i++) {
this.buttons[i].moveTo(x, y);
x -= 64;
x += 64;
}
};
@@ -104,3 +135,17 @@ IFaceButtons.prototype.draw = function() {
this.buttons[i].draw();
};
IFaceButtons.prototype.mousemove = function(event) {
for (var i =0; i < this.buttons.length; i++) {
var b = this.buttons[i];
b.isHover = b.isHovered(event.offsetX, event.offsetY);
}
};
IFaceButtons.prototype.mouseclick = function(event) {
for (var i =0; i < this.buttons.length; i++) {
var b = this.buttons[i];
if (b.isHovered(event.offsetX, event.offsetY))
b.execute();
}
};

View File

@@ -156,7 +156,7 @@ NorbertNode.prototype.draw = function() {
s *= 2;
//var x = Math.floor(this.projection.x - (186 / s));
//var y = Math.floor(this.projection.y - (50 / s));
var x = Math.floor(this.projection.x - (250 / s));
var x = Math.floor(this.projection.x - (192 / s));
var y = Math.floor(this.projection.y - (180 / s));
context.drawImage(this.norbert, x, y);
};

View File

@@ -36,8 +36,8 @@ function Pamela(canvas) {
};
this.buttons = new IFaceButtons();
this.fullScreenButton = new FullScreenButton();
this.buttons.add(this.fullScreenButton);
this.downloadScriptButton = new DownloadScriptButton();
this.buttons.add(this.downloadScriptButton);
this.resize();
this.m = new Matrix();
@@ -114,20 +114,13 @@ Pamela.prototype.start = function() {
};
Pamela.prototype.mousemove = function(event) {
this.fullScreenButton.isHover = this.fullScreenButton.isHovered(event.offsetX, event.offsetY);
this.buttons.mousemove(event);
this.mouse.x = event.offsetX;
this.mouse.y = event.offsetY;
};
Pamela.prototype.mouseclick = function(event) {
if (this.fullScreenButton.isHovered(event.offsetX, event.offsetY))
this.fullScreenButton.execute();
};
Pamela.prototype.mousein = function(event) {
};
Pamela.prototype.mouseout = function(event) {
this.buttons.mouseclick(event);
};
Pamela.prototype.fire = function() {
@@ -199,7 +192,7 @@ Pamela.prototype.resize = function() {
Pamela.prototype.updateEntries = function() {
var self = this;
$.getJSON("js/input.php", function(data) {
$.getJSON("macs.php", function(data) {
self.updateNodes(data);
});
self.entriesTimer = setTimeout(function() { self.updateEntries(); }, 60000);