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
 
(8 intermediate revisions by the same user not shown)
Line 19: Line 19:
     }  
     }  
     catch (error) {
     catch (error) {
         //lol
      //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
     }
     }
    if (ethTimeLinkedDiv.innerHTML != null) ethTimeLinkedDiv.innerHTML = result +
        "<a href=\"/index.php?title=Ð;redirect=no\" class=\"mw-redirect\" title=\"Ð\">Ð</a>";
}());
}());

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
    }
}());