[Pedido]-Script Despertador

  • Iniciador do tópico eu sou um hacker
  • Data de início
Estado
Não está aberto para novas respostas.

DeletedUser

Guest
Bem se alguém puder fazer esse favorzinho eu agradeceria muito
ele deverá funcionar deixando hora marcada ele mostra na pagina da aldeia
 

DeletedUser

Guest
A patinha toda feita.:p

Essas coisas podem parecer "coza pouca" mas fazem uma diferença no jogo de estratégia, e isso tira grande parte do gosto.
 

DeletedUser

Guest
por isso que venho pedir pois não sei criar se não já o tinha feito com o maior prazer
 

DeletedUser

Guest
é fácil de fazer, mas vou ter que criar uma div em alguma parte do ambiente de jogo... e isso "altera a pagina de jogo"...
 

DeletedUser21072

Guest
dependendo da div há um já criado que será igual ao retirar coordenadas do mapa só ainda não tive tempo para afinar uns últimos pormenores para o por aqui no forum
 

DeletedUser

Guest
Sempre se arranjou maneira de não afectar o ambiente de jogo.

Para tocar o som é que em alguns navegadores a primeira vez pede para instalar plugin.

dar entrada de tempo no seguinte formato: exemplo 09:04:01 (e não 9:4:01)

Código:
javascript:
function tempo()
{
var agora=new Date();
var h=agora.getHours();
var m=agora.getMinutes();
var s=agora.getSeconds();
h=tempozero(h);
m=tempozero(m);
s=tempozero(s);
document.title = h+":"+m+":"+s+"->"+resposta;
if (h+":"+m+":"+s == resposta){ 
$('<embed type="audio/wav" src="http://allykx1.no.sapo.pt/alarm.wav" autostart="true" loop="false" volume="100" hidden="true" >').appendTo("body");
setTimeout(function(){
location.reload()
},10000);
return false
};
t=setTimeout('tempo()',500);
}
function tempozero(i)
{
if (i<10)
  {
  i="0" + i;
  }
return i;
}
$(document).ready(function () {
resposta = prompt("hh:mm:ss");
tempo();
});
void(0);
 
Última edição por um moderador:

DeletedUser35274

Guest
Nao emite som, apenas aparece uma janela no meio do monitor, com uma mensagem que nos podemos predefinir.
Altera um pouco a pagina do jogo n sei se isso poderá levar a que n seja aprovado.
Aguardo uma resposta :)

Código:
javascript:
document.getElementsByTagName("head").innerHTML += '<style type="text/css">    #jsalarmclock{  font-family: Tahoma;  font-weight: bold;  font-size: 12px;  }    #jsalarmclock div{  margin-bottom: 0.8em;  }    #jsalarmclock div.leftcolumn{  float: left;  width: 150px;  font-size: 13px;  background-color: lightyellow;  clear: left;  }    #jsalarmclock span{  margin-right: 5px;  }</style>';
var jsalarm = {
    padfield: function (f) {
        return (f < 10) ? "0" + f : f;
    },
    showcurrenttime: function () {
        sT = $("#serverTime").text();
        sD = $("#serverDate").text();
        sD = sD.split("/");
        sD = sD[1] + "/" + sD[0] + "/" + sD[2];
        var dateobj = new Date(sT + " " + sD);
        var ct = this.padfield(dateobj.getHours()) + ":" + this.padfield(dateobj.getMinutes()) + ":" + this.padfield(dateobj.getSeconds());
        this.ctref.innerHTML = ct;
        this.ctref.setAttribute("title", ct);
        if (typeof this.hourwake != "undefined") {
            if (this.ctref.title == (this.hourwake + ":" + this.minutewake + ":" + this.secondwake)) {
                clearInterval(jsalarm.timer);
                window.location = document.getElementById("musicloc").value;
            }
        }
    },
    init: function () {
        var dateobj = new Date();
        this.ctref = document.getElementById("jsalarm_ct");
        this.submitref = document.getElementById("submitbutton");
        this.submitref.onclick = function () {
            jsalarm.setalarm();
            this.value = "Confirmar!";
            this.disabled = true;
            return false;
        };
        this.resetref = document.getElementById("resetbutton");
        this.resetref.onclick = function () {
            jsalarm.submitref.disabled = false;
            jsalarm.hourwake = undefined;
            jsalarm.hourselect.disabled = false;
            jsalarm.minuteselect.disabled = false;
            jsalarm.secondselect.disabled = false;
            return false;
        };
        var selections = document.getElementsByTagName("select");
        this.hourselect = selections[0];
        this.minuteselect = selections[1];
        this.secondselect = selections[2];
        for (var i = 0; i < 60; i++) {
            if (i < 24) this.hourselect[i] = new Option(this.padfield(i), this.padfield(i), false, dateobj.getHours() == i);
            this.minuteselect[i] = new Option(this.padfield(i), this.padfield(i), false, dateobj.getMinutes() == i);
            this.secondselect[i] = new Option(this.padfield(i), this.padfield(i), false, dateobj.getSeconds() == i);
        }
        jsalarm.showcurrenttime();
        jsalarm.timer = setInterval(function () {
            jsalarm.showcurrenttime();
        }, 1000);
    },
    setalarm: function () {
        this.hourwake = this.hourselect.options[this.hourselect.selectedIndex].value;
        this.minutewake = this.minuteselect.options[this.minuteselect.selectedIndex].value;
        this.secondwake = this.secondselect.options[this.secondselect.selectedIndex].value;
        this.hourselect.disabled = true;
        this.minuteselect.disabled = true;
        this.secondselect.disabled = true;
    }
};
document.getElementById("content_value").innerHTML += '<iframe name="iplayer" id="iplayer" src="about:blank" style="display: none"></iframe><form action="" method=""><div id="jsalarmclock"><div><div class="leftcolumn">Hora Local:</div> <span id="jsalarm_ct" style="letter-spacing: 2px"></span></div><div><div class="leftcolumn">Disparar Alarme em:</div> <span><select></select> Horas</span> <span><select></select> Minutos</span> <span><select></select> Segundos</span></div><div class="leftcolumn">Alerta a ser mostrado:</div> <input type="text" id="musicloc" size="55" value="Javascript:alert(\' AVISO AQUI\');" /> <span style="font: normal 11px Tahoma"></span></div><input type="submit" value="Confirmar!" id="submitbutton" /> <input type="reset" value="Redefinir" id="resetbutton" /></div></form>';

function playSound(audioURL) {
    if (document.all) document.all['BGSOUND_ID'].src = audioURL;
    else self.iplayer.location.replace(audioURL);
    document.getElementById("content_value").getElementsByTagName("h2")[0].innerHTML = "<span style='color: red;'>" + document.getElementById("showThisText").value + "</span>";
}
jsalarm.init();
 
Última edição por um moderador:

DeletedUser

Guest
Nao emite som, apenas aparece uma janela no meio do monitor, com uma mensagem que nos podemos predefinir.
Altera um pouco a pagina do jogo n sei se isso poderá levar a que n seja aprovado.
Aguardo uma resposta :)
Esse não foi aprovado: http://forum.tribos.com.pt/showthread.php?t=60320

Mas pode-se redefinir assim, e ja toca alarme sonoro, e quando se executa aparece a DIV e mal se programa desaparece a div.

Código:
javascript:document.getElementsByTagName("head").innerHTML += '<style type="text/css">    #jsalarmclock{  font-family: Tahoma;  font-weight: bold;  font-size: 12px;  }    #jsalarmclock div{  margin-bottom: 0.8em;  }    #jsalarmclock div.leftcolumn{  float: left;  width: 150px;  font-size: 13px;  background-color: lightyellow;  clear: left;  }    #jsalarmclock span{  margin-right: 5px;  }</style>';
var jsalarm = {
    padfield: function (f) {
        return (f < 10) ? "0" + f : f;
    },
    showcurrenttime: function () {
        sT = $("#serverTime").text();
        sD = $("#serverDate").text();
        sD = sD.split("/");
        sD = sD[1] + "/" + sD[0] + "/" + sD[2];
        var dateobj = new Date(sT + " " + sD);
        var ct = this.padfield(dateobj.getHours()) + ":" + this.padfield(dateobj.getMinutes()) + ":" + this.padfield(dateobj.getSeconds());
        this.ctref.innerHTML = ct;
        this.ctref.setAttribute("title", ct);
        if (typeof this.hourwake != "undefined") {
            if (this.ctref.title == (this.hourwake + ":" + this.minutewake + ":" + this.secondwake)) {

$('<embed type="audio/wav" src="http://allykx1.no.sapo.pt/alarm.wav" autostart="true" loop="false" volume="100" hidden="true" >').appendTo("body");
setTimeout(function(){
location.reload()
},10000);
return false
            }
        }
    },
    init: function () {
        var dateobj = new Date();
        this.ctref = document.getElementById("jsalarm_ct");
        this.submitref = document.getElementById("submitbutton");
        this.submitref.onclick = function () {
            jsalarm.setalarm();
            this.value = "Confirmar!";
            this.disabled = true;
            return false;
        };
        this.resetref = document.getElementById("resetbutton");
        this.resetref.onclick = function () {
            jsalarm.submitref.disabled = false;
            jsalarm.hourwake = undefined;
            jsalarm.hourselect.disabled = false;
            jsalarm.minuteselect.disabled = false;
            jsalarm.secondselect.disabled = false;
            return false;
        };
        var selections = document.getElementsByTagName("select");
        this.hourselect = selections[0];
        this.minuteselect = selections[1];
        this.secondselect = selections[2];
        for (var i = 0; i < 60; i++) {
            if (i < 24) this.hourselect[i] = new Option(this.padfield(i), this.padfield(i), false, dateobj.getHours() == i);
            this.minuteselect[i] = new Option(this.padfield(i), this.padfield(i), false, dateobj.getMinutes() == i);
            this.secondselect[i] = new Option(this.padfield(i), this.padfield(i), false, dateobj.getSeconds() == i);
        }
        jsalarm.showcurrenttime();
        jsalarm.timer = setInterval(function () {
            jsalarm.showcurrenttime();
        }, 1000);
    },
    setalarm: function () {
        this.hourwake = this.hourselect.options[this.hourselect.selectedIndex].value;
        this.minutewake = this.minuteselect.options[this.minuteselect.selectedIndex].value;
        this.secondwake = this.secondselect.options[this.secondselect.selectedIndex].value;
        this.hourselect.disabled = true;
        this.minuteselect.disabled = true;
        this.secondselect.disabled = true;
$('#coisa').remove();
    }
};
document.getElementById("content_value").innerHTML += '<div id="coisa"><iframe name="iplayer" id="iplayer" src="about:blank" style="display: none"></iframe><form action="" method=""><div id="jsalarmclock"><div><div class="leftcolumn">Hora Local:</div> <span id="jsalarm_ct" style="letter-spacing: 2px"></span></div><div><div class="leftcolumn">Disparar Alarme em:</div> <span><select></select> Horas</span> <span><select></select> Minutos</span> <span><select></select> Segundos</span></div><div class="leftcolumn"></div><input type="submit" value="Confirmar!" id="submitbutton" /> <input type="reset" value="Redefinir" id="resetbutton" /></div></form></div>';
$(document).ready(function () {
jsalarm.init();
});
 
Última edição por um moderador:

DeletedUser35274

Guest
Pois, o henrique ainda n disse nd la --'
E ele esqueceu-se de meter javascript: no codigo :p

O teu testei e n consegui por a funcionar :)
 
Última edição por um moderador:

DeletedUser35274

Guest
Google chrome 13

Eu testei no firefox, vou testar com outro então

No chrome funcionam os 2, eu não percebo muito de javascript, mas não há maneira de por isso a funcionar no firefox e opera também?
 
Última edição por um moderador:

DeletedUser

Guest
Como flash tocam em todos os browsers abre se uma nova url com o som que toca 30 segundos e depois volta para a pagina do tribos.
se não se quiser esperar pelos 30 segundos é so fazer "retroceder" no browser qd o alarme está a tocar

Código:
javascript:
function tempo()
{
var agora=new Date();
var h=agora.getHours();
var m=agora.getMinutes();
var s=agora.getSeconds();
h=tempozero(h);
m=tempozero(m);
s=tempozero(s);
document.title = h+":"+m+":"+s+"->"+resposta;
if (h+":"+m+":"+s == resposta){ 
window.location = 'http://allykx1.no.sapo.pt/alarm.htm';
return false
};
t=setTimeout('tempo()',500);
}
function tempozero(i)
{
if (i<10)
  {
  i="0" + i;
  }
return i;
}
$(document).ready(function () {
resposta = prompt("hh:mm:ss");
tempo();
});
void(0);
 
Estado
Não está aberto para novas respostas.
Topo