Warfacts Starlog Real dates

Changes time and date for war-facts.com starlog to real. For the new game interface.

スクリプトをインストールするには、Tampermonkey, GreasemonkeyViolentmonkey のような拡張機能のインストールが必要です。

You will need to install an extension such as Tampermonkey to install this script.

スクリプトをインストールするには、TampermonkeyViolentmonkey のような拡張機能のインストールが必要です。

スクリプトをインストールするには、TampermonkeyUserscripts のような拡張機能のインストールが必要です。

このスクリプトをインストールするには、Tampermonkeyなどの拡張機能をインストールする必要があります。

このスクリプトをインストールするには、ユーザースクリプト管理ツールの拡張機能をインストールする必要があります。

(ユーザースクリプト管理ツールは設定済みなのでインストール!)

このスタイルをインストールするには、Stylusなどの拡張機能をインストールする必要があります。

このスタイルをインストールするには、Stylus などの拡張機能をインストールする必要があります。

このスタイルをインストールするには、Stylus tなどの拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

(ユーザースタイル管理ツールは設定済みなのでインストール!)

このスクリプトの質問や評価の投稿はこちら通報はこちらへお寄せください
// ==UserScript==
// @name        Warfacts Starlog Real dates
// @namespace   https://github.com/guardian21
// @description Changes time and date for war-facts.com starlog to real. For the new game interface.
// @include     *.war-facts.com/starlog.php*
// @version     3
// @grant       none
// ==/UserScript==




/* Configuration Settings */



/* Script */


//Set Time zone Difference
var currentdate = new Date(); 
var timeZoneDiff = currentdate.getTimezoneOffset() / 60;	// Difference between user time and UTC time in hours
	timeZoneDiff = -timeZoneDiff;	// I want to know user compared to utc, not utc compared to user
	timeZoneDiff += 5;	//Difference between UTC and EST (server is in EST)






//Each starlog entry is a div, grab them all
var divs = document.getElementById("midcolumn").getElementsByTagName("div")[0].getElementsByTagName("div");
var i;
var current_div;
var realTimeEST;
var timetext;
var timeDateSpan;
var temp;




//For each starlog entry
 for (i = 3; i < divs.length; i+=3) {	//i=3 because first are headers 




    current_div = divs[i].children[0];


    temp = current_div.getElementsByTagName("span");
    timeDateSpan = temp[0];



    realTimeEST = timeDateSpan.title;




    //Process real time. Add the timezone diffrence, change Date if needed
    var thehours = parseInt(realTimeEST.substr(0,2));
    var dateString =  realTimeEST.substr(9,2);  
    thedate  = parseInt(dateString);
    thehours += timeZoneDiff;

    if (thehours >= 24) {
    	thehours -= 24;
    	thedate ++ ;
    	//Normally I would also need to check if month changes etc, but will not bother as it doesn't causes problem

    	dateString = thedate.toString();
    	if (thedate < 10) {
    		dateString = "0" + dateString;
     	}

    }

    var hoursString = thehours.toString();
    if (thehours < 10) {
    	hoursString = "0" + hoursString;
    }

//    var myTimeDate = hoursString + realTimeEST.substring(2,9) + dateString + realTimeEST.substring(11,19);    //hour - date format
    var myTimeDate = dateString + realTimeEST.substring(11,19) + "  " + hoursString + realTimeEST.substring(2,8);

 

    var myp = document.createElement("p");
    myp.style.color="yellow";
    myp.innerHTML = myTimeDate;

 
    current_div.appendChild(myp);
	
}