Mudanças entre as edições de "MediaWiki:Common.js"

De Wiki Gla
Ir para navegação Ir para pesquisar
Linha 1: Linha 1:
   $(document).ready(function() {
   $(document).ready(function() {
     //------- TOOLTIP IMAGE---------
     //------- TOOLTIP IMAGE---------
    const offset = { x: 20, y: 10 };
    const offset = {  
    x: 20, y: 10 };
   
   
  $('.tooltip-image').hover(function(e) {
  $('.tooltip-image').hover(function(e) {

Edição das 22h59min de 28 de maio de 2022

  $(document).ready(function() {
  	  	//------- TOOLTIP IMAGE---------
	  	  	const offset = { 
	  	  		x: 20, y: 10 };
	  	  	
	  		$('.tooltip-image').hover(function(e) {
	  			var src = $(this).attr('src');
	  			
	  			$('<img src="'+ src +'" id="bigImage" />').css('left', e.pageX + offset.x).css('top', e.pageY + offset.y).appendTo('body').hide().fadeIn(500);
	  			}, function(){
	  				$('#bigImage').remove();
	  		});
	  		
	  		$('.tooltip-image').mousemove(function(e) {
	  			$('#bigImage').css('left', e.pageX + offset.x).css('top', e.pageY + offset.y)
	  		});
  		//------- TOOLTIP IMAGE---------
  		
  		const timer = $('#event-time');
  		const eventsInfo = {
  			sunday: [
  				{name: 'Foxy race (ship)', time: '09:30:00'},
  				{name: 'Foxy count', time: '15:00:00'},
  				{name: 'Foxy quiz', time: '19:00:00'},
  				{name: 'Deathmatch', time: '22:00:00'},
  			],
  			monday: [
  				{name: 'Foxy count', time: '09:30:00'},
  				{name: 'Foxy quiz', time: '15:00:00'},
  				{name: 'Deathmatch', time: '19:00:00'},
  				{name: 'Foxy race (ship)', time: '22:00:00'},
  			],
  			tuesday: [
  				{name: 'Foxy quiz', time: '09:30:00'},
  				{name: 'Deathmatch', time: '15:00:00'},
  				{name: 'Foxy race', time: '19:00:00'},
  				{name: 'Foxy count', time: '22:00:00'},
  			],
  			wednesday: [
  				{name: 'Deathmatch', time: '09:30:00'},
  				{name: 'Foxy race (ship)', time: '15:00:00'},
  				{name: 'Foxy count', time: '19:00:00'},
  				{name: 'Foxy quiz', time: '22:00:00'},
  			],
  			 thursday: [
  				{name: 'Foxy race', time: '09:30:00'},
  				{name: 'Foxy count', time: '15:00:00'},
  				{name: 'Foxy quiz', time: '19:00:00'},
  				{name: 'Deathmatch', time: '22:00:00'},
  			],
  			 friday: [
  				{name: 'Foxy count', time: '09:30:00'},
  				{name: 'Foxy quiz', time: '15:00:00'},
  				{name: 'Deathmatch', time: '19:00:00'},
  				{name: 'Foxy race (ship)', time: '22:00:00'},
  			],
  			 saturday: [
  				{name: 'Foxy quiz', time: '09:30:00'},
  				{name: 'Deathmatch', time: '15:00:00'},
  				{name: 'Foxy race', time: '19:00:00'},
  				{name: 'Foxy count', time: '22:00:00'},
  			]
  		};
  		
  		let dayEvents;
  		
  		const getNextEvent = (item, key) => {
  			let split = item.time.split(":");
  			let currentTime = new Date();
  			let eventTime = new Date();
  			eventTime.setHours(split[0], split[1], split[2]);
  			
  			if(currentTime <= eventTime){
  				let distance = eventTimer - currentTime;
  				hour = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
  				minute = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60));
  				seconds = Math.floor((distance % (1000 * 60)) / 1000);
  				timer.html( hour + ":" + minute + ":" + seconds +":")
  			}
  		}
  		
  		const setsetDayEvents = (array) => {
  			dayEvents = array;
  			dayEvents.foreach(getNextEvent(item, key));
  		}
  		
  		switch(new Date().getDay()) {
  			case 0:
  				setDayEvents(eventsInfo.sunday);
  			break;
  			case 1:
  				setDayEvents(eventsInfo.monday);
  			break;
  			case 2:
  				setDayEvents(eventsInfo.tuesday);
  			break;
  			case 3:
  				setDayEvents(eventsInfo.wednesday);
  			break;
  			case 4:
  				setDayEvents(eventsInfo.thursday);
  			break;
  			case 5:
  				setDayEvents(eventsInfo.friday);
  			break;
  			case 6:
  				setDayEvents(eventsInfo.saturday);
  			break;
  			default:
  				setDayEvents(eventsInfo.sunday);
  		}
  		
  		
  		
  });