It is currently Sun Apr 13, 2025 9:53 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 1, 2  Next
Author Message
 Post subject: Leve Refresh Timer
PostPosted: Sun Sep 26, 2010 5:49 am 
Crumpet
Crumpet
User avatar

Joined: Thu Jul 01, 2004 5:57 am
Posts: 5363
Location: England
This website has a small Leve refresh timer over on the right.

http://www.swaggerffxiv.com/

Someone figure out how it works and we can make our own (a better one!) and put it on our site.

EDIT: Nevermind, I've figured it out and managed to make my own. Just need to make it pretty now. Can I get it on the site once it's done Yarr? Not sure where to put it. If I make it small enough I could just overlay it on top of the banner image? I'll mock one up once I'm done.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Sep 26, 2010 9:38 am 
Crumpet
Crumpet
User avatar

Joined: Thu Jul 01, 2004 5:57 am
Posts: 5363
Location: England
Thinking something like this:

Image

(That "leve" up there is Kayne from the Ebony/Ivory thread photoshopped onto a leve card.)

If you can think of somewhere else that's fine.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Sep 26, 2010 9:46 am 
Crumpet
Crumpet
User avatar

Joined: Thu Jul 01, 2004 5:57 am
Posts: 5363
Location: England
For fun:

Image


Top
 Profile  
 
 Post subject:
PostPosted: Sun Sep 26, 2010 9:46 am 
Onionhead
Onionhead
User avatar

Joined: Thu May 20, 2004 6:38 pm
Posts: 7560
Location: Houston
cool

_________________
RIP Shiloh - I'll never forget ya


Top
 Profile  
 
 Post subject:
PostPosted: Sun Sep 26, 2010 9:50 am 
Star-Spangled Subligar
Star-Spangled Subligar
User avatar

Joined: Wed Dec 31, 1969 7:00 pm
Posts: 15671
Location: THE DOJO
Im sleepy. Explain this to me in game.

_________________
COBRA KAI DOJO NEVER DIES
RIP Shiloh


Top
 Profile  
 
 Post subject:
PostPosted: Sun Sep 26, 2010 10:38 am 
Posts way too much
Posts way too much
User avatar

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

_________________
Image


Top
 Profile  
 
 Post subject:
PostPosted: Sun Sep 26, 2010 12:54 pm 
Crumpet
Crumpet
User avatar

Joined: Thu Jul 01, 2004 5:57 am
Posts: 5363
Location: England
Finished making one, hopefully Yarr won't sit on it forever. Looks almost exactly like the photoshop mock a few posts up.

Also hopefully it doesn't break on Firefox, lol.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Sep 26, 2010 9:47 pm 
Posts way too much
Posts way too much
User avatar

Joined: Thu Jun 09, 2005 1:41 pm
Posts: 3187
Location: Pennsylvania, USA
Should use photoshop to make that pic of Kayne stained glass looking, like the levequest cards.

_________________
[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: Mon Sep 27, 2010 6:23 am 
Crumpet
Crumpet
User avatar

Joined: Thu Jul 01, 2004 5:57 am
Posts: 5363
Location: England
My timer is totally not here yet.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Sep 27, 2010 1:33 pm 
Spammer, to the max!
User avatar

Joined: Mon May 17, 2004 1:29 pm
Posts: 1887
Still no timer irl, Yarr sucks :p


Top
 Profile  
 
 Post subject:
PostPosted: Mon Sep 27, 2010 1:50 pm 
Easy Prey
Easy Prey
User avatar

Joined: Mon Sep 05, 2005 2:36 pm
Posts: 223
Location: Tennessee
This site needs more options

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


Top
 Profile  
 
 Post subject:
PostPosted: Mon Sep 27, 2010 4:07 pm 
Spammer, to the max!
User avatar

Joined: Mon May 17, 2004 1:29 pm
Posts: 1887
omg, stealing Ket's thunder irl (actually was just bored at work and wanted to see if I could do it):

script name = countdown.js

Code:
countdowninitialized = 0;

function formattime(time)
{
  if(new String(time).length==1) return "0" + time;
  return time;
}

function returntime(time)
{
  time = Math.round(time/1000);
  return formattime(Math.floor(time/3600)) + ":" + formattime(Math.floor((time/60)%60)) +

":" + formattime(time%60);
}

function initializecountdown()
{
  countdowninitialized = 1;
  imgtags = document.getElementsByTagName("img");
  for(i=0;i<imgtags.length;i++) if(imgtags[i].src.match(/newlogo3c.jpg/gi)) break;
  imgtags[i].parentNode.parentNode.style.position = "relative";
  imgtags[i].parentNode.parentNode.innerHTML = imgtags[i].parentNode.parentNode.innerHTML +

"<div style=\"position:absolute; left:5px; top:5px;\"><table

style=\"background-color:black; border:white solid 1px; color:white;

filter:progid:DXImageTransform.Microsoft.Alpha(Opacity=40);\"><tr><td><img

src=\"lq.jpg\"/></td><td style=\"vertical-align:top;\"><table style=\"color:white;

font-family:arial; font-size:8pt;\"><col style=\"font-weight:bold;

white-space:nowrap;\"/><col style=\"white-space:nowrap\"/><tr><td colspan=\"2\"

style=\"border-bottom:white solid 1px;\">Levequest Countdown</td></tr><tr><td

style=\"padding-top:2px;\">Last Reset:</td><td id=\"lastreset\"

style=\"padding-top:2px;\"></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></div>";
}

function countdown()
{
  if(!countdowninitialized) initializecountdown();
  starttime = new Date("9/22/2010 0:00 GMT");
  while(starttime <= new Date()) starttime.setHours(starttime.getHours() + 36);
  document.getElementById("lastreset").innerHTML = new

Date(starttime.setHours(starttime.getHours() - 36)).toLocaleString();
  document.getElementById("nextreset").innerHTML = new

Date(starttime.setHours(starttime.getHours() + 36)).toLocaleString();
  document.getElementById("countdown").innerHTML = returntime(starttime - new Date());
  setTimeout("countdown()",500);
}


I'm not sure if Ket had a countdown in his, so maybe he'll want to add it.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Sep 27, 2010 4:23 pm 
Too Weak
Too Weak
User avatar

Joined: Sun Mar 20, 2005 4:18 pm
Posts: 128
I heard there there was a countdown timer here, but I can't find it

_________________
Image


Top
 Profile  
 
 Post subject:
PostPosted: Mon Sep 27, 2010 4:52 pm 
Star-Spangled Subligar
Star-Spangled Subligar
User avatar

Joined: Wed Dec 31, 1969 7:00 pm
Posts: 15671
Location: THE DOJO
I'll try and get this working tonight. Just stuck at work still (2h overtime I dont get paid for)

_________________
COBRA KAI DOJO NEVER DIES
RIP Shiloh


Top
 Profile  
 
 Post subject:
PostPosted: Mon Sep 27, 2010 4:56 pm 
Crumpet
Crumpet
User avatar

Joined: Thu Jul 01, 2004 5:57 am
Posts: 5363
Location: England
Consider my thunder stolen.

Here's mine, since it might be the only way you get to see it.

Differences are I used a more complicated way of formatting the time string, which I had to look up online, but that was because it originally made it say "1 day, 3 hours, 20 minutes, 5 seconds" and then people said I should just make it compact. It also just looks for the first img tag on the page where I stupidly hardcoded the banner image so Yarr can never change it again. What it ought to do is find the src of the first image and set it as the tablecell background. Too lazy now.

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 class="LeveTrans" style="padding: 5px; margin: 5px; background-color: #04002a; border: solid 1px #FFFFFF; width: 190px;">' +
               '<div class="LeveText">' +
               '<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 class="LeveText" style="margin-bottom: 4px; font-weight: bold;">Levequest Reset Timer</div>' +
               '        <table cellpadding="0" cellspacing="0">' +
               '            <col width="65" />' +
               '            <tr><td class="LeveText">Last Reset:</td><td class="LeveText"><div id="TimeSince"></div></td></tr>' +
               '            <tr><td class="LeveText">Next Reset:</td><td class="LeveText"><div id="TimeUntil"></div></td></tr>' +
               '        </table>' +
               '        </div></div></td>' +
               '    </tr>' +
               '    </div>' +
               '</div>' +
               '<style type="text/css">' +
               '    .LeveText {font-family: Tahoma; font-size: 11px; color: white;}' +
               '    .LeveTrans {filter:alpha(opacity=50); opacity: 0.5; -moz-opacity:0.5;}' +
               '</style>';

        tableCell.style.backgroundImage = "url('images/logo/newlogo3c.jpg')";
        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);
    var SinceDiv = document.getElementById('TimeSince');
    var UntilDiv = document.getElementById('TimeUntil');
    if (SinceDiv) SinceDiv.innerText = 'Calculating...';
    if (UntilDiv) UntilDiv.innerText = 'Calculating...';
   
    setTimeout(recalculateLeveTimes, 1000);
}

// 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, 1000);
}

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



Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 28, 2010 11:43 am 
Spammer, to the max!
User avatar

Joined: Mon May 17, 2004 1:29 pm
Posts: 1887
Yarr, make me an account and I'll post the timer for you :p


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 28, 2010 11:53 am 
Star-Spangled Subligar
Star-Spangled Subligar
User avatar

Joined: Wed Dec 31, 1969 7:00 pm
Posts: 15671
Location: THE DOJO
lol i might just do that today.

_________________
COBRA KAI DOJO NEVER DIES
RIP Shiloh


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 28, 2010 3:54 pm 
Too Weak
Too Weak
User avatar

Joined: Fri Sep 10, 2010 1:49 am
Posts: 67
Won't this just return the time from the client pc and not the server? I've been trying to figure this out myself. I got it going but when the page refreshes it will reset the timer.

Code:
<script type = "text/javascript">

var timeInSecs;
var ticker;

function startTimer(secs) {
timeInSecs = parseInt(secs);
ticker = setInterval("tick()", 1000);
}

function tick( ) {
var secs = timeInSecs;
if (secs > 0) {
timeInSecs--;
}
else {
clearInterval(ticker);
startTimer(129600);  // start again
}

var hours= Math.floor(secs/3600);
secs %= 3600;
var mins = Math.floor(secs/60);
secs %= 60;
var pretty = ( (hours < 10 ) ? "0" : "" ) + hours + ":" + ( (mins < 10) ? "0" : "" ) + mins + ":" + ( (secs < 10) ? "0" : "" ) + secs;
document.getElementById("countdown").innerHTML = pretty;
}

startTimer(129600);  // 36 hours in seconds

</script>


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

Joined: Mon Sep 05, 2005 2:36 pm
Posts: 223
Location: Tennessee
http://www.youtube.com/watch?v=9jK-NcRmVcw&ob=av3n

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


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 28, 2010 7:03 pm 
Youre a Crappy HNM like Roc or something
Youre a Crappy HNM like Roc or something
User avatar

Joined: Wed Jun 16, 2004 4:50 pm
Posts: 1326
Location: Somewhere
http://www.thephphub.com/dbtest/cms/?ce=

A site me and rushal were fucking around with. OMG THIS TIMER WILL GIVE US MORE OPTIONS

©Kayne


Last edited by Pix on Tue Sep 28, 2010 7:13 pm, edited 1 time in total.

Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 28, 2010 7:10 pm 
Crumpet
Crumpet
User avatar

Joined: Thu Jul 01, 2004 5:57 am
Posts: 5363
Location: England
Every site is gonna have a timer before this one irl.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 28, 2010 7:13 pm 
Spammer, to the max!
User avatar

Joined: Mon May 17, 2004 1:29 pm
Posts: 1887
Copy and paste the following into notepad and save it as a .htm file if you want your own timer:

Code:
<html>
<head>
<title></title>
<script type="text/javascript">
<!--
function formattime(time)
{
  if(new String(time).length==1) return "0" + time;
  return time;
}

function returntime(time)
{
  time = Math.round(time/1000);
  return formattime(Math.floor(time/3600)) + ":" + formattime(Math.floor((time/60)%60)) + ":" + formattime(time%60);
}

function countdown()
{
  for(starttime = new Date("9/22/2010 0:00 GMT"); starttime <= new Date(); starttime.setHours(starttime.getHours() + 36));
  document.getElementById("lastreset").innerHTML = new Date(starttime.setHours(starttime.getHours() - 36)).toLocaleString();
  document.getElementById("nextreset").innerHTML = new Date(starttime.setHours(starttime.getHours() + 36)).toLocaleString();
  document.getElementById("countdown").innerHTML = returntime(starttime - new Date());
  setTimeout("countdown()",500);
}
//-->
</script>
</head>
<body style="background-color:gray; margin:0px;" onload="countdown();">
<div style="position:absolute; left:5px; top:5px;"><table style="background-color:black; border:white solid 1px; color:white; filter:progid:DXImageTransform.Microsoft.Alpha(Opacity=80);"><tr><td><img src="http://imgur.com/6nAow.png" style="height:70px;"/></td><td style="vertical-align:top;"><table style="color:white; font-family:arial; font-size:8pt;"><col style="font-weight:bold; white-space:nowrap;"/><col style="white-space:nowrap"/><tr><td colspan="2" style="border-bottom:white solid 1px;">Levequest Countdown</td></tr><tr><td style="padding-top:2px;">Last Reset:</td><td id="lastreset" style="padding-top:2px;"></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></div>
</body>
</html>


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 28, 2010 7:21 pm 
Crumpet
Crumpet
User avatar

Joined: Thu Jul 01, 2004 5:57 am
Posts: 5363
Location: England
Gonna end up making an iframe version on a new domain called yarrthelazypirate.com that puts this site underneath.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 28, 2010 10:11 pm 
Spammer, to the max!
User avatar

Joined: Mon May 17, 2004 1:29 pm
Posts: 1887
lol


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

Joined: Wed Dec 31, 1969 7:00 pm
Posts: 15671
Location: THE DOJO
Im not lazy. Im just expressing myself.

_________________
COBRA KAI DOJO NEVER DIES
RIP Shiloh


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

Board index » Final Fantasy XIV » Final Fantasy XIV Discussion


Who is online

Users browsing this forum: No registered users and 22 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