PWI Server Status

BareBear - Lost City
BareBear - Lost City Posts: 8 Arc User
edited November 2010 in General Discussion
I noticed today that they modified the pwi-status display pretty nicely, and here .
Any chance we can get exactly the same thing for our own sites? I've got a basic one working but I gotta admit this is really nice.
Post edited by BareBear - Lost City on

Comments

  • Deora - Lost City
    Deora - Lost City Posts: 1,086 Arc User
    edited October 2010
    That has been there for a while and it is broken b/c whoever made it obviously don't know how to force flash to display time in a particular timezone not the local time (which isn't that hard)
  • BareBear - Lost City
    BareBear - Lost City Posts: 8 Arc User
    edited October 2010
    LOL, nice catch, i never even noticed that. Yep, I had to learn how to do that for our guild site.
  • SylenThunder - Twilight Temple
    edited October 2010
    Yes, I liked the old widget that showed all the servers. I've tried several ways of re-creating it and can't seem to.
    [SIGPIC][/SIGPIC]
  • Cun - Lost City
    Cun - Lost City Posts: 685 Arc User
    edited October 2010
    If you noticed that take a look at this b:chuckle
    [SIGPIC][/SIGPIC]

    To be or not to be.
    Current Goals: none.
  • sangodoc
    sangodoc Posts: 0 Arc User
    edited November 2010
    It's not done in Flash, it's done in JavaScript.

    I sent the fixed JavaScript to FrankieRaye, but they haven't implemented it.

    Then again, the servers themselves don't seem to be doing Daylight Saving Time properly, so my fixed code which does do Daylight Saving Time properly conflicts with the servers this week. b:chuckle
    [SIGPIC][/SIGPIC]
    Visit the PWI wiki for the useful information. Stay at the PWI wiki for the pie. ;-)
  • DaKillanator - Raging Tide
    DaKillanator - Raging Tide Posts: 2,965 Arc User
    edited November 2010
    a mod posted in a thread and it's not locked afterwards? b:puzzled

    Anyone else thinks this should be stickied?b:question

    edit: and hello der Sang :) havnt seen you before
  • Deora - Lost City
    Deora - Lost City Posts: 1,086 Arc User
    edited November 2010
    a mod posted in a thread and it's not locked afterwards? b:puzzled

    Anyone else thinks this should be stickied?b:question

    edit: and hello der Sang :) havnt seen you before
    He is the wiki rent-a-cop b:chuckle not a mod
    Sangodoc wrote: »
    It's not done in Flash, it's done in JavaScript.

    I sent the fixed JavaScript to FrankieRaye, but they haven't implemented it.

    Then again, the servers themselves don't seem to be doing Daylight Saving Time properly, so my fixed code which does do Daylight Saving Time properly conflicts with the servers this week. b:chuckle

    Well it was originally in flash when I first saw it...

    So they apparently did change something only to have it still not work
  • DaKillanator - Raging Tide
    DaKillanator - Raging Tide Posts: 2,965 Arc User
    edited November 2010
    Look at his sig, go ahead I'll wait...






















    omg did you see that? FREE PIE!!!b:faint
  • Allisandre - Sanctuary
    Allisandre - Sanctuary Posts: 1,452 Arc User
    edited November 2010
    Sangodoc wrote: »
    It's not done in Flash, it's done in JavaScript.

    I sent the fixed JavaScript to FrankieRaye, but they haven't implemented it.

    Then again, the servers themselves don't seem to be doing Daylight Saving Time properly, so my fixed code which does do Daylight Saving Time properly conflicts with the servers this week. b:chuckle

    Any chance we can get the script for making widgets on our guild sites? I would love to have a server status widget for the guildies.
    Take the time to look for your answer before you post like an idiot.

    There are two kinds of people in this world...
    There are those who panic,
    And then there is us.
    ~ Sarah Jane Smith
  • Rambox - Sanctuary
    Rambox - Sanctuary Posts: 23 Arc User
    edited November 2010
    I dont know why, but I think I may have a problem with that server status. I'm in Brazil (GMT -3) and the status shows the west coast time as my own time and east coast +3 hours.
    (Like, now its 3:37pm and the west coast shows 3:37 pm and East 6:37 pm). Thats not right, since west coast should be my time minus 4 hours (if I'm not mistaken).

    Sorry about the english
  • grimreaperhc
    grimreaperhc Posts: 0 Arc User
    edited November 2010
    I dont know why, but I think I may have a problem with that server status. I'm in Brazil (GMT -3) and the status shows the west coast time as my own time and east coast +3 hours.
    (Like, now its 3:37pm and the west coast shows 3:37 pm and East 6:37 pm). Thats not right, since west coast should be my time minus 4 hours (if I'm not mistaken).

    Sorry about the english

    GM's are already aware of this, but thanks!
  • sangodoc
    sangodoc Posts: 0 Arc User
    edited November 2010
    Any chance we can get the script for making widgets on our guild sites? I would love to have a server status widget for the guildies.
    Well, I suppose I can post the modified JavaScript I wrote, but you'll have to pull anything else you need from the status page's HTML and CSS.

    First, remove the reference to "templates/common/js/time.js", my code modifies that code. Then replace everything after the line with that reference down to the "</script>" with this:
    <script type="text/javascript">
    
    lt = new Date();  // Local time
    wct = new Date(); // West Coast time
    ect = new Date(); // East Coast time
    d = 0;
    
    setTimes();
    setInterval("writeTime()", 1000);
    
    function dotime(unix, x){
    				now = new Date();
    				now.setTime(unix);
    				hr= now.getHours();
    				mn= now.getMinutes();
    				se= now.getSeconds();
    				yr = now.getFullYear();
    				mo = now.getMonth();
    				dy = now.getDate();
    				var mths = new Array("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec");
    				if(se < 10) {
    					se = '0'+se;
    				}
    				if(mn < 10) {
    					mn = '0'+mn;
    				}
    				if(hr >= 12) {
    					hr = hr - 12;
    					if(hr == 0) {
    						hr = 12;
    					} else if (hr < 10) {
    						hr = hr;
    					} else {
    						hr = hr;
    					}
    					am = 'PM';
    				} else {
    					am = 'AM';
    				}
    				if(dy < 10) {
    					dy = '0'+dy;
    				}
    				
    				if(hr == 0){
    					
    					hr = 12;
    					
    				}
    				
    				//date_view_var =''+mths[mo]+' '+dy+', '+yr;
    				time_view_var =hr+':'+mn+':'+se;
    				
    				if(x){
    					
    					return am;
    					
    				}else{
    					
    					return time_view_var;
    				}
    					
    			}
    
    function writeTime(){
    
    	d += 1000;
    
    	msecs = wct.getTime() + d;
    	str = dotime(msecs, false);
    	str2 = dotime(msecs, true);
    
    	msecs = ect.getTime() + d;
    	str3 = dotime(msecs, false);
    	str4 = dotime(msecs, true);
    
    	msecs = lt.getTime() + d;
    	str5 = dotime(msecs, false);
    	str6 = dotime(msecs, true);
    	
    	$('#pwi_stat_server_times').find('p').eq(0).find('span').eq(0).text(str + ' ');
    	$('#pwi_stat_server_times').find('p').eq(0).find('em').eq(0).text(str2);
    
    	$('#pwi_stat_server_times').find('p').eq(1).find('span').eq(0).text(str3 + ' ');
    	$('#pwi_stat_server_times').find('p').eq(1).find('em').eq(0).text(str4);
    
    	$('#my_time').text(str5 + ' ' + str6);
    	
    }
    
    function setTimes(){
      var lsm = new Date;
      var lso = new Date;
      var dst = 0;
    
        // convert to msec since Jan 1 1970
        localTimeMsec = lt.getTime();
        // obtain local UTC offset in minutes and convert to msec
        localOffset = lt.getTimezoneOffset() * 60000;
        // obtain UTC time in msec
        utc = localTimeMsec + localOffset;
        lsm.setMonth(2); // March
        lsm.setDate(1);
        var day = lsm.getDay(); // day of week of 1st
        if (day == 0) { // find 2nd Sunday
            lsm.setDate(8);
          } else {
            lsm.setDate(14-day);
          }
        lso.setMonth(10); // November
        lso.setDate(1);
        day = lso.getDay();
        if (day > 0) { // find 1st Sunday
            lso.setDate(7-day);
          }
        if (lt < lsm || lt >= lso) {
            dst = 0;  //Not Daylight Saving Time
          } else {
            dst = 1;  //Daylight Saving Time
          }
        if (dst == 1) {  //Daylight Saving Time
            wct.setTime(utc + (3600000*-7));
            ect.setTime(utc + (3600000*-4));
          } else {       //Not Daylight Saving Time
            wct.setTime(utc + (3600000*-8));
            ect.setTime(utc + (3600000*-5));
          }
    }
    
    </script>
    
    Short description of what that does, it gets the local time, figures out what GMT is from that, then gives the times for the East Coast and West Coast servers.

    However, until they either fix the servers to do Daylight Saving Time properly or next week when DST ends, the above code will be off by an hour, since I assumed they were doing DST correctly. b:surrender Just modify the DST handling code if you want it to match the pre-2007 system for DST in the US if you want to match the servers.
    [SIGPIC][/SIGPIC]
    Visit the PWI wiki for the useful information. Stay at the PWI wiki for the pie. ;-)
  • sangodoc
    sangodoc Posts: 0 Arc User
    edited November 2010
    I just noticed that I handle changing DST more or less properly, but I ignore the hour. So it sets the clock back at midnight local time, instead of 2 AM Pacific Time and 2 AM Eastern Time.

    So, if the servers did do DST properly, my code would be off by an hour on the days DST start and end for some of the day in most time zones. Probably not a big deal, but I thought I should mention it.
    [SIGPIC][/SIGPIC]
    Visit the PWI wiki for the useful information. Stay at the PWI wiki for the pie. ;-)