NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript== // @name Show local time // @namespace local_time // @description Shows local time in Retro Server // @include *://ogame1304.de/game/index.php?page=overview&session=* // @require https://ajax.googleapis.com/ajax/libs/jquery/2.2.4/jquery.min.js // @author JBWKZ2099 // @version 1.1 // @grant none // ==/UserScript== $(document).ready(function(){ var date = getDate(); var ger_time_zone = getTimeZone("Germany", "+2"); $("th:contains(Server)").next().text(); $("th:contains(Server)").next().addClass("add_clock"); $("table[width='519'] tr:first").addClass('player-info'); $(".player-info").next().addClass('server-time'); var day = $("th:contains(Server)").next().text(); var splitted = day.split(" "); $(".server-time").after("<tr class='local-time'> <th>Local Time</th><th colspan='3'>"+splitted[0]+" "+splitted[1]+" "+splitted[2]+" <span class='replace'>"+date+"</span> L</th> </tr>"); $(".add_clock").html(splitted[0]+" "+splitted[1]+" "+splitted[2]+" <span class='replace_two'>"+ger_time_zone+"</span>"); window.setInterval( function(){ date = getDate(); ger_time_zone = getTimeZone("Germany", "+2"); $(".replace").text(date); $(".replace_two").text(ger_time_zone); },1000); function getDate() { var current_time = new Date(), hr = current_time.getHours(), min = current_time.getMinutes(), sec = current_time.getSeconds(); if( min < 10 ) { min = "0"+min; } if( sec < 10 ) { sec = "0"+sec; } var local_time = hr + ":" + min + ":" + sec; return local_time; } function getTimeZone(city, offset) { var date = new Date(); var utc = date.getTime() + (date.getTimezoneOffset() * 60000); var new_date = new Date(utc + (3600000 * offset)); var split = ( new_date.toLocaleString() ).split(" ")[1]; return split; } });