MediaWiki:EthTime.js: Difference between revisions

From Thorildsby Wiki
Jump to navigation Jump to search
No edit summary
Undo revision 1311 by Kat (talk)
Tag: Undo
 
(12 intermediate revisions by the same user not shown)
Line 15: Line 15:
     result /= 100;
     result /= 100;


     ethTimeDiv.innerHTML = result + "Ð";
     try {
     ethTimeLinkedDiv.innerHTML = result + "[[Ð]]";
        if (ethTimeDiv.innerHTML != null) ethTimeDiv.innerHTML = result + "Ð";
     }
    catch (error) {
      //lol
    }
    try {
        if (ethTimeLinkedDiv.innerHTML != null) ethTimeLinkedDiv.innerHTML = result +  
            "<a href=\"https://thorildsby.com/index.php?title=%C4%90-Time\">Ð</a>";
    }
    catch (error) {
        //lol again
    }
}());
}());

Latest revision as of 09:32, 15 October 2025

$(function () {
    var ethTimeDiv = document.getElementById('eth-time');
    var ethTimeLinkedDiv = document.getElementById('eth-time-linked');
    const now = new Date();
    const year = now.getUTCFullYear();

    var result = year - 2000;
    var decimal = Math.ceil((now - new Date(year,0,1)) / 86400000);

    decimal = decimal/((year % 4 == 0 && year % 100 != 0) || year % 400 == 0? 366 : 365);

    result += decimal;
    result *= 100;
    result = Math.round(result);
    result /= 100;

    try {
        if (ethTimeDiv.innerHTML != null) ethTimeDiv.innerHTML = result + "Ð";
    } 
    catch (error) {
       //lol 
    }
    try {
        if (ethTimeLinkedDiv.innerHTML != null) ethTimeLinkedDiv.innerHTML = result + 
            "<a href=\"https://thorildsby.com/index.php?title=%C4%90-Time\">Ð</a>";
    }
    catch (error) {
        //lol again
    }
}());