Bone Overlord.gif The Roost of the Graveborn Quest Spoiler!
Domine Graveborn: todos os bosses e mecânicas ilustradas!
Saiba mais ➔
Winter Tree.png Winter Update 2025
Acompanhe tudo sobre o Winter Update 2025!
Saiba mais ➔
Stag.gif The Order of the Stag Quest Spoiler!
Conheça Isle of Ada: sua quest, missões secundárias e todos os bosses!
Saiba mais ➔

MediaWiki:Common.js: mudanças entre as edições

De Tibia Wiki - A Enciclopédia do Tibia
Ir para navegação Ir para pesquisar
Linha 180: Linha 180:
}
}
});
});
/****  Server Save ***/
function CountDown(initDate, id){
now = new Date();
ss = new Date(now.getFullYear(), now.getMonth(), now.getDate(), 7, 0, 0, 0);
if (now.getHours() > 10){
ss.setDate(now.getDate() + 1);
}
if (now.getTimezoneOffset() == 180){ //não tá em horario de verão
ss.setHours(ss.getHours() - 1);
}
    this.endDate = new Date(ss);
    this.countainer = document.getElementById(id);
    this.numOfDays = [ 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 ];
    this.borrowed = 0, this.years = 0, this.months = 0, this.days = 0;
    this.hours = 0, this.minutes = 0, this.seconds = 0;
    this.updateNumOfDays();
    this.updateCounter();
}
 
CountDown.prototype.updateNumOfDays=function(){
    var dateNow = new Date();
    var currYear = dateNow.getFullYear();
    if ( (currYear % 4 == 0 && currYear % 100 != 0 ) || currYear % 400 == 0 ) {
        this.numOfDays[1] = 29;
    }
    var self = this;
    setTimeout(function(){self.updateNumOfDays();}, (new Date((currYear+1), 1, 2) - dateNow));
}
 
CountDown.prototype.datePartDiff=function(then, now, MAX){
    var diff = now - then - this.borrowed;
    this.borrowed = 0;
    if ( diff > -1 ) return diff;
    this.borrowed = 1;
    return (MAX + diff);
}
 
CountDown.prototype.calculate=function(){
    var futureDate = this.endDate;
    var currDate = new Date();
    this.seconds = this.datePartDiff(currDate.getSeconds(), futureDate.getSeconds(), 60);
    this.minutes = this.datePartDiff(currDate.getMinutes(), futureDate.getMinutes(), 60);
    this.hours = this.datePartDiff(currDate.getHours(), futureDate.getHours(), 24);
    this.days = this.datePartDiff(currDate.getDate(), futureDate.getDate(), this.numOfDays[futureDate.getMonth()]);
    this.months = this.datePartDiff(currDate.getMonth(), futureDate.getMonth(), 12);
    this.years = this.datePartDiff(currDate.getFullYear(), futureDate.getFullYear(),0);
}
 
CountDown.prototype.addLeadingZero=function(value){
    return value < 10 ? ("0" + value) : value;
}
 
CountDown.prototype.formatTime=function(){
    this.seconds = this.addLeadingZero(this.seconds);
    this.minutes = this.addLeadingZero(this.minutes);
    this.hours = this.addLeadingZero(this.hours);
}
 
CountDown.prototype.updateCounter=function(){
    this.calculate();
    this.formatTime();
    this.countainer.innerHTML =
      " <strong>" + this.hours + "</strong> <small>" + (this.hours == 1? "hora" : "horas") + "</small>" +
      " <strong>" + this.minutes + "</strong> <small>" + (this.minutes == 1? "minuto" : "minutos") + "</small>" +
      " <strong>" + this.seconds + "</strong> <small>" + (this.seconds == 1? "segundo" : "segundos") + "</small>";
    if ( this.endDate > (new Date()) ) {
        var self = this;
        setTimeout(function(){self.updateCounter();}, 1000);
    }
}
window.onload=function(){ new CountDown('December 09, 2012 06:00:00', 'counter'); }

Edição das 00h01min de 9 de dezembro de 2012

/* Tooltips */
$(document).ready(function() {
    $(".tooltip").hover(function(){
        tip = $(this).find('.tip');
        tip.show();
    }, function() {
        tip.hide();
    }).mousemove(function(e) {
        var mousex = e.pageX - 150;
        var mousey = e.pageY - 165;
    });
});

/* Tirar ícone de links externos */
$('.mapa > a').removeClass('external text');

/* Criaturas */
$(document).ready(function() {
    $('#show').click(function() {
        $('.hide').toggle();
    });
});

$(document).ready(function() {
    var height = $('#hab').height(); 
    if (height>=50) {
        $('#hab').addClass('hide');
        $('#show').append(' (mostrar)');
    }
});

/* Mapa */
$(document).ready(function() {
$('#map_show').click(function() {
        var id = $(this).attr('id');
     $('#div' + id).toggle();
     $('span',this).toggle(); 
        // alert(id);
     return false;
     });
});

$(document).bind('click', function(e){ 
      var $clicked = $(e.target); 
      if (!($clicked.is('#map_frameid') || $clicked.parents().is('#map_frameid'))) { 
         $('.map_frame').hide();
      }
});

/* Calculadoras */
$(document).ready(function(){
    $('.calc_shard').keyup(function(){
        var level = $('#level').val(); 
        var shards = $('#shards').val();
        var item = $("select#item").val(); 
        if (item == 2) {
            if (shards>=2) {
                $('#result').text(5000 * $('#level').val() * $('#shards').val());
                $('#result3').removeClass("hide"); 
            } else {
                if (shards<=0) {
                    $('#result').text("0");
                    $('#result3').addClass("hide");
                } else {
                    $('#result').text(5000 * $('#level').val());
                    $('#result3').addClass("hide");
                }
            }
        } else {
            if (shards<=0) {
                $('#result').text("0");
                $('#result2').addClass("hide");
            } else {
                if (shards>=41) {
                    $('#result2').removeClass("hide");
                } else {
                    $('#result2').addClass("hide");
                }
                if (shards>=1)  {
                    if (level>=200) {
                        $('#result').text((300 * 200) * $('#shards').val());
                    } else {
                        $('#result').text((300 * $('#level').val()) * $('#shards').val());
                    }
                } else {
                    if (level>=200) {
                        $('#result').text(300 * 200);
                    } else {
                        $('#result').text(300 * $('#level').val());
                    } 
                }
            }
        }
    });    
});

$(document).ready(function() {
    $(".calc_shard").keydown(function(event) {
        if ( event.keyCode == 46 || event.keyCode == 8 || event.keyCode == 9 || event.keyCode == 27 || event.keyCode == 13 || 
             (event.keyCode == 65 && event.ctrlKey === true) || 
             (event.keyCode >= 35 && event.keyCode <= 39)) {
                 return;
             } else {
                 if (event.shiftKey || (event.keyCode < 48 || event.keyCode > 57) && (event.keyCode < 96 || event.keyCode > 105 )) {
                     event.preventDefault(); 
                 }   
             }
    });
});

$(document).ready(function() {
    $('#item').change(function(){
        $('#shards').prop('value',1);
        $('#level').prop('value',0);
        $('#result').text('0');
        $('#result2').addClass("hide"); 
        $('#result3').addClass("hide"); 
    });
});

$("#botao_shard").append('<input name="shards" maxlength="3" id="shards" type="text" size="10" align="center" value="1" onclick="this.value=&#39;&#39;;" onblur="this.value=!this.value?&#39;1&#39;:this.value;" />');
$("#botao_level").append('<input name="level" maxlength="3" id="level" type="text" size="10" align="center" value="0" onclick="this.value=&#39;&#39;;" onblur="this.value=!this.value?&#39;0&#39;:this.value;" />');
$("#botao_item").append('<select id="item"><option value="1">Midnight Shard</option><option value="2">Stone of Wisdom</option></select>');

/* Profile */
$("#input_nome").append('<form action="/Sano/char.php" type="post" id="searchForm"><input name="character" id="nome" type="text" size="25" align="center" value="Nome do Personagem" onclick="this.value=&#39;&#39;;" onblur="this.value=!this.value?&#39;Nome do Personagem&#39;:this.value;"/> <input type="submit" value="Ir" /></form>');

$("#searchForm").submit(function(event) {
	
    event.preventDefault(); 

    var $form = $( this ),
        term = $form.find('input[name="character"]').val(),
        url = $form.attr( 'action' );
		
    $.post( '/Sano/char.php', $("#searchForm").serialize(),
      function( data ) {
          $( "#result_personagem" ).empty().append('<center><table id="alter" style="text-align:left;border:none;margin-top:5px;"><tr><td colspan="4" style="text-align:center;"><b>Informações do Personagem</b></td></tr><tr><td style="width:5%"><b>Nome:</b></td><td style="width:45%">' + data.Nome + '</td><td style="width:5%"><b>Level:</b></td><td style="width:45%">' + data.Level + '</td></tr><tr class="dif"><td><b>Vocação:</b></td><td>' + data.Vocacao + '</td><td><b>Mundo:</b></td><td>' + data.Mundo + '</td></tr><tr><td><b>Guild:</b></td><td>' + data.Guild + '</td><td><b>Tutor:</b></td><td>' + data.Tutor + '</td></tr><tr class="dif"><td><b>Residencia:</b></td><td>' + data.Residencia + '</td><td><b>Casa:</b></td><td>' + data.Casa + '</td></tr><tr><td><b>Casado com:</b></td><td>' + data.Casado + '</td><td><b>Sexo:</b></td><td>' + data.Sexo + '</td></tr><tr class="dif"><td><b>Achievements:</b></td><td>' + data.Achievements + '</td><td><b>Capacidade:</b></td><td>' + data.Capacidade + '</td></tr><tr><td><b>Vida:</b></td><td>' + data.Life + '</td><td><b>Mana:</b></td><td>' + data.Mana + '</td></tr><tr class="dif"><td><b>Status:</b></td><td>' + data.Status + '</td><td><b>Velocidade:</b></td><td>' + data.Velocidade + '</td></tr><tr><td colspan="4">Você pagará ' + data.Bless + ' gps por cada benção. E pagará ' + data.Bless2 + ' gps por todas elas.<br/>Em uma party, você poderá compartilhar experiência com leveis: ' + data.Party + '</td></tr></table></center>');
      }, "json");
  });

/* Quest Spoils */

$(document).ready(function(){
  $('#spoil').toggle();
  $('.showhide').toggle();
  $('.showhide').click(function(){
    $('#spoil').toggle();
    $('.showhide').toggle();
  });    
});

/**  Calculadora de Exp **/

$("#input_exp").append('<form action="" type="post" id="searchForm"><input name="characterExp" onclick="this.value=&#39;&#39;;" id="exp" type="text" size="25" align="center" value="Experiência" /> <input type="submit" value="Ir" /></form>');

$("#searchForm").submit(function(event) {

    event.preventDefault(); 
	var exp = new Array();
	var $form = $( this ),
	userExp= $form.find('input[name="characterExp"]').val()


	exp[1] = 100;
	for (i=2; i < 1000 ; i++){
		exp[i] = exp[ i - 1 ] + 50 * Math.pow(i , 2)  - 150 * i + 200;
		if (userExp < exp[i - 1]){
                        var expTnl = exp[i - 1] - parseInt(userExp);
			$( "#result" ).append(
					"<TABLE BGCOLOR=#CEDFF2 BORDER=0 CELLPADDING=2 CELLSPACING=5 WIDTH=30%>" +
					"<TR><TD><TABLE BORDER=0 CELLPADDING=2 CELLSPACING=1 WIDTH=100%>" +
					"<TR BGCOLOR=#E8F2F8><TD><B>Level</B></TD><TD align=\"center\">" + (i - 1) + "</TD></TR>" +
					"<TR BGCOLOR=#E8F2F8><TD><B>Experiência</B></TD><TD align=\"center\">" + userExp + "</TD></TR>" +
					"<TR BGCOLOR=#E8F2F8><TD><B>Exp. para o próximo level</B></TD><TD align=\"center\">" + expTnl + "</TD></TR>" +
					"</TABLE></TD></TR>" +
					"</TABLE>");
			break;
        }
	}
});

/****  Server Save ***/

function CountDown(initDate, id){
	
	now = new Date();
	ss = new Date(now.getFullYear(), now.getMonth(), now.getDate(), 7, 0, 0, 0);
	
	if (now.getHours() > 10){
		ss.setDate(now.getDate() + 1);
	}
	if (now.getTimezoneOffset() == 180){ //não tá em horario de verão
		ss.setHours(ss.getHours() - 1);
	}
		
    this.endDate = new Date(ss);
    this.countainer = document.getElementById(id);
    this.numOfDays = [ 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 ];
    this.borrowed = 0, this.years = 0, this.months = 0, this.days = 0;
    this.hours = 0, this.minutes = 0, this.seconds = 0;
    this.updateNumOfDays();
    this.updateCounter();
}
  
CountDown.prototype.updateNumOfDays=function(){
    var dateNow = new Date();
    var currYear = dateNow.getFullYear();
    if ( (currYear % 4 == 0 && currYear % 100 != 0 ) || currYear % 400 == 0 ) {
        this.numOfDays[1] = 29;
    }
    var self = this;
    setTimeout(function(){self.updateNumOfDays();}, (new Date((currYear+1), 1, 2) - dateNow));
}
  
CountDown.prototype.datePartDiff=function(then, now, MAX){
    var diff = now - then - this.borrowed;
    this.borrowed = 0;
    if ( diff > -1 ) return diff;
    this.borrowed = 1;
    return (MAX + diff);
}
  
CountDown.prototype.calculate=function(){
    var futureDate = this.endDate;
    var currDate = new Date();
    this.seconds = this.datePartDiff(currDate.getSeconds(), futureDate.getSeconds(), 60);
    this.minutes = this.datePartDiff(currDate.getMinutes(), futureDate.getMinutes(), 60);
    this.hours = this.datePartDiff(currDate.getHours(), futureDate.getHours(), 24);
    this.days = this.datePartDiff(currDate.getDate(), futureDate.getDate(), this.numOfDays[futureDate.getMonth()]);
    this.months = this.datePartDiff(currDate.getMonth(), futureDate.getMonth(), 12);
    this.years = this.datePartDiff(currDate.getFullYear(), futureDate.getFullYear(),0);
}
  
CountDown.prototype.addLeadingZero=function(value){
    return value < 10 ? ("0" + value) : value;
}
  
CountDown.prototype.formatTime=function(){
    this.seconds = this.addLeadingZero(this.seconds);
    this.minutes = this.addLeadingZero(this.minutes);
    this.hours = this.addLeadingZero(this.hours);
}
  
CountDown.prototype.updateCounter=function(){
    this.calculate();
    this.formatTime();
    this.countainer.innerHTML =
       " <strong>" + this.hours + "</strong> <small>" + (this.hours == 1? "hora" : "horas") + "</small>" +
       " <strong>" + this.minutes + "</strong> <small>" + (this.minutes == 1? "minuto" : "minutos") + "</small>" +
       " <strong>" + this.seconds + "</strong> <small>" + (this.seconds == 1? "segundo" : "segundos") + "</small>";
    if ( this.endDate > (new Date()) ) {
        var self = this;
        setTimeout(function(){self.updateCounter();}, 1000);
    }
}
 
window.onload=function(){ new CountDown('December 09, 2012 06:00:00', 'counter'); }