X-Git-Url: https://mop.ddnsfree.com/gitweb/?a=blobdiff_plain;f=web%2Fcommons.js;h=30108c64c742c5bb55a092efbae2c88519db0166;hb=ca639ef6d55d2e1bb85fd18a502d438ca08d3995;hp=76940cceb78b3c31467173ae9ede6fbe7f8290f9;hpb=dce5542c19cd926a07c852ed912c483a6b2e921d;p=brisk.git diff --git a/web/commons.js b/web/commons.js index 76940cc..30108c6 100644 --- a/web/commons.js +++ b/web/commons.js @@ -21,10 +21,20 @@ */ var PLAYERS_N = 3; -var EXIT_BAN_TIME = 15; +var EXIT_BAN_TIME = 900; function $(id) { return document.getElementById(id); } +function getStyle(x,IEstyleProp, MozStyleProp) +{ + if (x.currentStyle) { + var y = x.currentStyle[IEstyleProp]; + } else if (window.getComputedStyle) { + var y = document.defaultView.getComputedStyle(x,null).getPropertyValue(MozStyleProp); + } + return y; +} + /* replacement of setInterval on IE */ (function(){ /*if not IE, do nothing*/ @@ -258,7 +268,7 @@ function safelogout() var res; if (g_exitlock < 3) - res = window.confirm("Sei sicuro di volere abbandonare la partita?\nATTENZIONE: se esci adesso senza il consenso degli altri giocatori non potrai sederti ai tavoli per "+EXIT_BAN_TIME+" minuti."); + res = window.confirm("Sei sicuro di volere abbandonare la partita?\nATTENZIONE: se esci adesso senza il consenso degli altri giocatori non potrai sederti ai tavoli per "+(Math.floor(EXIT_BAN_TIME/60))+" minuti."); else res = window.confirm("Sei sicuro di volere abbandonare la partita?"); if (res) @@ -338,9 +348,11 @@ function sleep(st, delay) function slowimg(img,x1,y1,deltat,free,action,srcend) { this.img = img; - this.x0 = parseInt(document.defaultView.getComputedStyle(this.img, "").getPropertyValue("left")); - // alert("img.x0 = "+this.x0); - this.y0 = parseInt(document.defaultView.getComputedStyle(this.img, "").getPropertyValue("top")); + // this.x0 = parseInt(document.defaultView.getComputedStyle(this.img, "").getPropertyValue("left")); + this.x0 = parseInt(getStyle(this.img,"left", "left")); +// alert("img.x0 = "+this.x0); + // this.y0 = parseInt(document.defaultView.getComputedStyle(this.img, "").getPropertyValue("top")); + this.y0 = parseInt(getStyle(this.img,"top", "top")); this.x1 = x1; this.y1 = y1; this.deltat = deltat; @@ -379,13 +391,14 @@ slowimg.prototype = { this.action = act; }, + settime: function(time) { - this.time = time; - this.step_n = parseInt(time / this.deltat); + this.time = (time < this.deltat ? this.deltat : time); + this.step_n = parseInt(this.time / this.deltat); this.dx = (this.x1 - this.x0) / this.step_n; this.dy = (this.y1 - this.y0) / this.step_n; - if (this.step_n * this.deltat == time) { + if (this.step_n * this.deltat == this.time) { this.step_n--; } this.step_free = parseInt(this.step_n * this.free); @@ -579,6 +592,7 @@ function notify(st, text, tout, butt, w, h) box.innerHTML = text; box.style.zIndex = 200; box.style.width = w+"px"; + box.style.marginLeft = -parseInt(w/2)+"px"; box.style.height = h+"px"; box.appendChild(clodiv); box.style.visibility = "visible"; @@ -882,7 +896,6 @@ function room_checkspace(emme,tables,inpe) function playsound(tag, sound) { // g_withflash is a global var if (g_withflash) { - alert("PLAYSOUND "+sound); $(tag).innerHTML = '' + '' +