Need some basic find/replace help
|
|
I'm working on a basic script to convert the time/dates shown on a page to local time, however I seem to be having some trouble as I know virtually nothing about javascript and am horrible with regular expressions (some might call these insurmountable problems... I would probably agree). My script is missing two parts: a way to parse out the existing time/day, and a way to output the changed time/day. Any help would be appreciated. // ==UserScript==
textnodes = document.evaluate(
//Parse out any text strings matching "<td>hh:mm Uhr dd.mm.</td>" or "<td>h:mm Uhr dd.mm.</td>" and use it to set the following ikariamDate variable //Code would go here if I knew how... //UTC Offset of displayed time (+1 UTC) in milliseconds
//Set ikariamDate object to values parsed from page text
//convert displayed date to UTC by removing offset from date
//get local offset in milliseconds
//get local time by adding local offset to UTC time
//Using the new fixedDate variable, output a replacement string in the format "<td>hh:mm On dd.mm</td>" //Code would go here if I knew how... } |
|
|
|
|
|
Haxim, I just created a script to changed the date/time on the Trade Fleet and Port pages to a countdown instead of that nasty timestamp. You're welcome to use that code as an example if you want. It's called the Ikariam Transport Countdown. |
