It is currently Tue May 07, 2024 3:59 pm View unanswered posts | View active topics |


Board index » Final Fantasy XIV » Final Fantasy XIV Discussion


Post new topic Reply to topic  [ 46 posts ]  Go to page Previous  1, 2
Author Message
 Post subject:
PostPosted: Tue Sep 28, 2010 10:49 pm 
Star-Spangled Subligar
Star-Spangled Subligar
User avatar

Joined: Wed Dec 31, 1969 7:00 pm
Posts: 15671
Location: THE DOJO
OK. Not sure I love it. The calculating every time i refresh the page is a little weird.

This would be better as a single page.

_________________
COBRA KAI DOJO NEVER DIES
RIP Shiloh


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 28, 2010 10:52 pm 
Easy Prey
Easy Prey
User avatar

Joined: Mon Aug 08, 2005 6:03 pm
Posts: 252
firefox, on os 10.5.6, does not load any time. just shows last reset, next reset, but the fields are blank. Maby it is still being worked on?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 28, 2010 10:55 pm 
Star-Spangled Subligar
Star-Spangled Subligar
User avatar

Joined: Wed Dec 31, 1969 7:00 pm
Posts: 15671
Location: THE DOJO
yeah only works with IE

_________________
COBRA KAI DOJO NEVER DIES
RIP Shiloh


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 28, 2010 11:18 pm 
Easy Prey
Easy Prey
User avatar

Joined: Mon Aug 08, 2005 6:03 pm
Posts: 252
good to know.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Sep 29, 2010 12:13 am 
Posts way too much
Posts way too much
User avatar

Joined: Fri May 21, 2004 1:07 am
Posts: 4142
Location: Oregon
Browser requirements... lol

_________________
Image


Top
 Profile  
 
 Post subject:
PostPosted: Wed Sep 29, 2010 12:19 am 
Even Match
Even Match

Joined: Sat Apr 30, 2005 5:19 pm
Posts: 640
works for chrome, just the text is large... and black. so you cant read it.

_________________
Image

FFXI - Yurichan: 75THF(Ret) / SC2 - Lawncare / XBOX - Zombie Sharks / PS3 - Zombie_Sharks


Top
 Profile  
 
 Post subject:
PostPosted: Wed Sep 29, 2010 1:11 am 
Mike&Ike Irl
Mike&Ike Irl

Joined: Mon Sep 20, 2004 5:59 pm
Posts: 5256
Location: The Internet
this is what it looks like in chrome.

Image


Top
 Profile  
 
 Post subject:
PostPosted: Wed Sep 29, 2010 4:10 am 
DL Hughley
User avatar

Joined: Sat Mar 26, 2005 11:47 am
Posts: 3129
Location: Far From Home
Doesn't appear with CKDNew board style, but I may be the only person who uses it and I don't play FF14.

_________________
Image
Some stories can't be told with words, some legends are meant to die


Top
 Profile  
 
 Post subject:
PostPosted: Wed Sep 29, 2010 7:25 am 
Crumpet
Crumpet
User avatar

Joined: Thu Jul 01, 2004 5:57 am
Posts: 5363
Location: England
The text stuff must be because Firefox/Chrome doesn't like you just injecting a style tag into the page. Can be fixed but would make the code kind of long and untidy. Also the calculating can be toned down a lot. I forced a 2 second delay into it while I was testing what would happen when the page is refreshed during the leve reset. I'll just take the delay out and it'll be almost instant.

I'll fix it when I'm home from work.


Last edited by Ketrebu on Wed Sep 29, 2010 7:26 am, edited 1 time in total.

Top
 Profile  
 
 Post subject:
PostPosted: Wed Sep 29, 2010 7:26 am 
Spammer, to the max!
User avatar

Joined: Mon May 17, 2004 1:29 pm
Posts: 1887
Optimized it for Rid (now it doesn't use a loop to find the next time):

Code:
<html>
<head>
<title></title>
<script type="text/javascript">
<!--
starttime = new Date("9/22/2010 0:00 GMT");

function formatdate(date)
{
  date = new Date(date).toLocaleString().split(", ");
  return date[0] + ", " + date[1] + " @ " + date[2].split(" ")[1].replace(/:00:00/gi,"") + " " + date[2].split(" ")[2];
}

function formattime(time)
{
  time = Math.floor(time%60);
  if(time < 10) return "0" + time;
  return time;
}

function countdown()
{
  time = (new Date() - starttime)%129600000;
  document.getElementById("lastreset").innerHTML = formatdate(new Date() - time);
  document.getElementById("nextreset").innerHTML = formatdate(new Date() - time + 129600000);
  time = ((new Date() - time + 129600000) - new Date())/1000;
  document.getElementById("countdown").innerHTML = formattime(time/3600) + ":" + formattime(time/60) + ":" + formattime(time);
  setTimeout("countdown()",500);
}
//-->
</script>
</head>
<body style="background-color:gray;" onload="countdown();">
<table style="background-color:black; border:white solid 1px;">
<tr><td><img src="http://imgur.com/6nAow.png" style="height:60px;"/></td><td style="vertical-align:top;"><table style="color:white; font-family:arial; font-size:8pt;"><colgroup style="white-space:nowrap;"><col style="font-weight:bold;"/><col/></colgroup><tr><td>Last Reset:</td><td id="lastreset"></td></tr><tr><td>Next Reset:</td><td id="nextreset"></td></tr><tr><td>Countdown:</td><td id="countdown"></td></tr></table></td></tr>
</table>
</body>
</html>


Last edited by Kayne on Wed Sep 29, 2010 7:29 am, edited 1 time in total.

Top
 Profile  
 
 Post subject:
PostPosted: Wed Sep 29, 2010 7:29 am 
Crumpet
Crumpet
User avatar

Joined: Thu Jul 01, 2004 5:57 am
Posts: 5363
Location: England
Or Kayne can fix it for me omgs (if Yarr set you up an account in the end). Just take the 1000 ms delay out of the calculating functions initLeveTimes and recalculateLeveTimes()

Also shove the text style into the style="" parameter of all the tablecells (stupid IE6 doesnt automatically inherit font styles outside table cells or something) instead of using the class=""


Top
 Profile  
 
 Post subject:
PostPosted: Wed Sep 29, 2010 12:29 pm 
Crumpet
Crumpet
User avatar

Joined: Thu Jul 01, 2004 5:57 am
Posts: 5363
Location: England
Fixed code. Removes the "Calculating" delay and forces the style onto the tags instead of injecting style so it should show in Firefox/Chrome too.

Code:
// This is the FFXIV Server Launch Date
var BaseDate = new Date("September 22, 2010 00:00:00 GMT");

// Variables
var CurrentDate, LastDate, NextDate;
var i18n = {weeks: ['week', 'weeks'], days: ['day', 'days'], hours: ['hour', 'hours'], minutes: ['minute', 'minutes'], seconds: ['second', 'seconds']};
var i18c = {days: ['', ''],hours: ['', ''],minutes: ['', ''],seconds: ['', '']};
var units = {days: 24 * 60 * 60, hours: 60 * 60, minutes: 60, seconds: 1};

// This function adds the HTML to the banner, then initializes the leve timer.
function setupLevePage() {

    var imgTag = document.getElementsByTagName('img')[0]

    if (!imgTag) {
        // Not loaded yet for some reason, add a timer and try again in a bit.
        setTimeout(setupLevePage, 100);
    } else {
        var tableCell = imgTag.parentNode.parentNode;
        var html = '<div style="filter:alpha(opacity=50); opacity: 0.5; -moz-opacity:0.5; padding: 5px; margin: 5px; background-color: #04002a; border: solid 1px #FFFFFF; width: 190px;">' +
               '<div style="font-family: Tahoma; font-size: 11px; color: white;">' +
               '<table cellpadding="0" cellspacing="0">' +
               '    <tr>' +
               '        <td style="width:36px; height: 47px;" valign="top"><img style="position: absolute;" src="http://imgur.com/6nAow.png" width="30" height="47" border="0"></td>' +
               '        <td valign="top"><div style="position: absolute; width: 150px;"><div style="position: relative; top:2px;">' +
               '        <div style="font-family: Tahoma; font-size: 11px; color: white; margin-bottom: 4px; font-weight: bold;">Levequest Reset Timer</div>' +
               '        <table cellpadding="0" cellspacing="0">' +
               '            <col width="65" />' +
               '            <tr><td style="font-family: Tahoma; font-size: 11px; color: white;">Last Reset:</td><td style="font-family: Tahoma; font-size: 11px; color: white;"><div id="TimeSince"></div></td></tr>' +
               '            <tr><td style="font-family: Tahoma; font-size: 11px; color: white;">Next Reset:</td><td style="font-family: Tahoma; font-size: 11px; color: white;"><div id="TimeUntil"></div></td></tr>' +
               '        </table>' +
               '        </div></div></td>' +
               '    </tr>' +
               '    </div>' +
               '</div>';

        tableCell.style.backgroundImage = "url('" + imgTag.src + "')";
        tableCell.style.height = "245px";
        tableCell.style.cursor = "pointer";
        tableCell.vAlign = "top";
        tableCell.onclick = function () { window.location = "index.php"; };
        tableCell.innerHTML = html;
       
        // Initialize
        initLeveTimes();
    }

}

// Automatically load without fiddling with body onload stuff.
setupLevePage();

// Recalculate!
function initLeveTimes() {
    NextDate = new Date(BaseDate);
    setTimeout(recalculateLeveTimes, 10);
}

// Calculate current Leve times using a 36 hour loop
function recalculateLeveTimes() {
    var i = 0;
    CurrentDate = new Date();
    while (NextDate < CurrentDate) {
        NextDate.setHours(NextDate.getHours() + 36);
    }
    LastDate = new Date(NextDate);
    LastDate.setHours(NextDate.getHours() - 36);

    setTimeout(updateLeveTimerDivs, 10);
}

// Update the divs with the calculated text.
function updateLeveTimerDivs() {
    CurrentDate = new Date();
    var TimeSince = CurrentDate - LastDate;
    var TimeSinceSeconds = parseInt(TimeSince / 1000);
    var TimeUntil = NextDate - CurrentDate;
    var TimeUntilSeconds = parseInt(TimeUntil / 1000);

    if (TimeUntilSeconds <= 0) {
        initLeveTimes();
    } else {
        var SinceDiv = document.getElementById('TimeSince');
        var UntilDiv = document.getElementById('TimeUntil');
        if (SinceDiv) SinceDiv.innerText = getTimeStringCompact(TimeSinceSeconds);
        if (UntilDiv) UntilDiv.innerText = getTimeStringCompact(TimeUntilSeconds);
        if (SinceDiv) SinceDiv.title = LastDate;
        if (UntilDiv) UntilDiv.title = NextDate;
        setTimeout(updateLeveTimerDivs, 1000);
    }

}

// This function takes a number of seconds and turns it into a formatted string.
function getTimeStringCompact(seconds) {
    if (seconds < 1) {
        return '00:00:00:00';
    }

    var hideEmpty = false;
    var onlyLargestUnit = false;
    var returnArray = [];
    var value;

    for (unit in units) {
        value = units[unit];
        if (seconds / value >= 1 || unit == 'seconds' || !hideEmpty) {
            secondsConverted = Math.floor(seconds / value);
            var i18cUnit = i18c[unit][secondsConverted == 1 ? 0 : 1];
            returnArray.push(((secondsConverted + '').length == 2 || unit == 'weeks') ? secondsConverted : '0' + secondsConverted);
            seconds -= secondsConverted * value;

            if (onlyLargestUnit) {
                break;
            }
        }
    };

    return returnArray.join(':');
}


I'm too lazy to actually install Firefox/Chrome to check though. Don't see the point of installing multiple browsers when IE8/9 work just fine for me.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Sep 29, 2010 1:19 pm 
Posts way too much
Posts way too much
User avatar

Joined: Thu Jun 09, 2005 1:41 pm
Posts: 3187
Location: Pennsylvania, USA
You do it for the options, Ket

_________________
[In Yarr we trust.]
Yarr wrote:
Ulgokiem sounds like the name of an anal STD. Why anyone even listens to that douche bag is beyond me.

Ponuh wrote:
i love how half of this thread is about racism in america and the other half is pictures of kittens


Top
 Profile  
 
 Post subject:
PostPosted: Wed Sep 29, 2010 1:33 pm 
Easy Prey
Easy Prey
User avatar

Joined: Mon Sep 05, 2005 2:36 pm
Posts: 223
Location: Tennessee
needs more firefox support

_________________
Pharmacist by Day, Gamer for Life
XBL: Zuldane, PSN: Zuldane


Top
 Profile  
 
 Post subject:
PostPosted: Wed Sep 29, 2010 1:48 pm 
CKD's Minimum Fuck up
User avatar

Joined: Thu Jul 08, 2004 7:54 pm
Posts: 1204
Location: Texas
I also support the movement for support other than IE

_________________
Image


Top
 Profile  
 
 Post subject:
PostPosted: Wed Sep 29, 2010 7:10 pm 
Mike&Ike Irl
Mike&Ike Irl

Joined: Mon Sep 20, 2004 5:59 pm
Posts: 5256
Location: The Internet
OMG THIS THREAD IS TURNING INTO A CODING WAR!


Top
 Profile  
 
 Post subject:
PostPosted: Wed Sep 29, 2010 8:14 pm 
Easy Prey
Easy Prey
User avatar

Joined: Mon Aug 08, 2005 6:03 pm
Posts: 252
This now works on Safari 4, just fyi.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Sep 30, 2010 2:26 am 
Posts way too much
Posts way too much
User avatar

Joined: Thu Jun 09, 2005 1:41 pm
Posts: 3187
Location: Pennsylvania, USA
COME ON. Safari and not FF?

_________________
[In Yarr we trust.]
Yarr wrote:
Ulgokiem sounds like the name of an anal STD. Why anyone even listens to that douche bag is beyond me.

Ponuh wrote:
i love how half of this thread is about racism in america and the other half is pictures of kittens


Top
 Profile  
 
 Post subject:
PostPosted: Thu Sep 30, 2010 4:09 am 
Mike&Ike Irl
Mike&Ike Irl

Joined: Mon Sep 20, 2004 5:59 pm
Posts: 5256
Location: The Internet
Not that it really matters for the refresh timer... but has anyone had the chance to test drive IE9 beta? From what i've been reading, microsoft actually did something right for once... they copied everyone else.

I haven't had the chance to test it out myself but from what everyone is saying, its like a web designers dream come true.

I just thought this was interesting. http://samples.msdn.microsoft.com/ietestcenter/ lolIE8


Top
 Profile  
 
 Post subject:
PostPosted: Thu Sep 30, 2010 4:49 am 
DL Hughley
User avatar

Joined: Sat Mar 26, 2005 11:47 am
Posts: 3129
Location: Far From Home
Ketrebu wrote:
Fixed code. Removes the "Calculating" delay and forces the style onto the tags instead of injecting style so it should show in Firefox/Chrome too.

Code:
// This is the FFXIV Server Launch Date
var BaseDate = new Date("September 22, 2010 00:00:00 GMT");

// Variables
var CurrentDate, LastDate, NextDate;
var i18n = {weeks: ['week', 'weeks'], days: ['day', 'days'], hours: ['hour', 'hours'], minutes: ['minute', 'minutes'], seconds: ['second', 'seconds']};
var i18c = {days: ['', ''],hours: ['', ''],minutes: ['', ''],seconds: ['', '']};
var units = {days: 24 * 60 * 60, hours: 60 * 60, minutes: 60, seconds: 1};

// This function adds the HTML to the banner, then initializes the leve timer.
function setupLevePage() {

    var imgTag = document.getElementsByTagName('img')[0]

    if (!imgTag) {
        // Not loaded yet for some reason, add a timer and try again in a bit.
        setTimeout(setupLevePage, 100);
    } else {
        var tableCell = imgTag.parentNode.parentNode;
        var html = '<div style="filter:alpha(opacity=50); opacity: 0.5; -moz-opacity:0.5; padding: 5px; margin: 5px; background-color: #04002a; border: solid 1px #FFFFFF; width: 190px;">' +
               '<div style="font-family: Tahoma; font-size: 11px; color: white;">' +
               '<table cellpadding="0" cellspacing="0">' +
               '    <tr>' +
               '        <td style="width:36px; height: 47px;" valign="top"><img style="position: absolute;" src="http://imgur.com/6nAow.png" width="30" height="47" border="0"></td>' +
               '        <td valign="top"><div style="position: absolute; width: 150px;"><div style="position: relative; top:2px;">' +
               '        <div style="font-family: Tahoma; font-size: 11px; color: white; margin-bottom: 4px; font-weight: bold;">Levequest Reset Timer</div>' +
               '        <table cellpadding="0" cellspacing="0">' +
               '            <col width="65" />' +
               '            <tr><td style="font-family: Tahoma; font-size: 11px; color: white;">Last Reset:</td><td style="font-family: Tahoma; font-size: 11px; color: white;"><div id="TimeSince"></div></td></tr>' +
               '            <tr><td style="font-family: Tahoma; font-size: 11px; color: white;">Next Reset:</td><td style="font-family: Tahoma; font-size: 11px; color: white;"><div id="TimeUntil"></div></td></tr>' +
               '        </table>' +
               '        </div></div></td>' +
               '    </tr>' +
               '    </div>' +
               '</div>';

        tableCell.style.backgroundImage = "url('" + imgTag.src + "')";
        tableCell.style.height = "245px";
        tableCell.style.cursor = "pointer";
        tableCell.vAlign = "top";
        tableCell.onclick = function () { window.location = "index.php"; };
        tableCell.innerHTML = html;
       
        // Initialize
        initLeveTimes();
    }

}

// Automatically load without fiddling with body onload stuff.
setupLevePage();

// Recalculate!
function initLeveTimes() {
    NextDate = new Date(BaseDate);
    setTimeout(recalculateLeveTimes, 10);
}

// Calculate current Leve times using a 36 hour loop
function recalculateLeveTimes() {
    var i = 0;
    CurrentDate = new Date();
    while (NextDate < CurrentDate) {
        NextDate.setHours(NextDate.getHours() + 36);
    }
    LastDate = new Date(NextDate);
    LastDate.setHours(NextDate.getHours() - 36);

    setTimeout(updateLeveTimerDivs, 10);
}

// Update the divs with the calculated text.
function updateLeveTimerDivs() {
    CurrentDate = new Date();
    var TimeSince = CurrentDate - LastDate;
    var TimeSinceSeconds = parseInt(TimeSince / 1000);
    var TimeUntil = NextDate - CurrentDate;
    var TimeUntilSeconds = parseInt(TimeUntil / 1000);

    if (TimeUntilSeconds <= 0) {
        initLeveTimes();
    } else {
        var SinceDiv = document.getElementById('TimeSince');
        var UntilDiv = document.getElementById('TimeUntil');
        if (SinceDiv) SinceDiv.innerText = getTimeStringCompact(TimeSinceSeconds);
        if (UntilDiv) UntilDiv.innerText = getTimeStringCompact(TimeUntilSeconds);
        if (SinceDiv) SinceDiv.title = LastDate;
        if (UntilDiv) UntilDiv.title = NextDate;
        setTimeout(updateLeveTimerDivs, 1000);
    }

}

// This function takes a number of seconds and turns it into a formatted string.
function getTimeStringCompact(seconds) {
    if (seconds < 1) {
        return '00:00:00:00';
    }

    var hideEmpty = false;
    var onlyLargestUnit = false;
    var returnArray = [];
    var value;

    for (unit in units) {
        value = units[unit];
        if (seconds / value >= 1 || unit == 'seconds' || !hideEmpty) {
            secondsConverted = Math.floor(seconds / value);
            var i18cUnit = i18c[unit][secondsConverted == 1 ? 0 : 1];
            returnArray.push(((secondsConverted + '').length == 2 || unit == 'weeks') ? secondsConverted : '0' + secondsConverted);
            seconds -= secondsConverted * value;

            if (onlyLargestUnit) {
                break;
            }
        }
    };

    return returnArray.join(':');
}


I'm too lazy to actually install Firefox/Chrome to check though. Don't see the point of installing multiple browsers when IE8/9 work just fine for me.


Just blows my mind that when I scroll past it, it's green and when I stop and look, it's black.


Magic.

_________________
Image
Some stories can't be told with words, some legends are meant to die


Top
 Profile  
 
 Post subject:
PostPosted: Thu Sep 30, 2010 5:49 am 
Crumpet
Crumpet
User avatar

Joined: Thu Jul 01, 2004 5:57 am
Posts: 5363
Location: England
Something up with your eyes or monitor? That text is definately green.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 46 posts ]  Go to page Previous  1, 2

Board index » Final Fantasy XIV » Final Fantasy XIV Discussion


Who is online

Users browsing this forum: No registered users and 5 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group