0

enter image description here

Hello,

So the above top left world clock is how I have everything set up in SD Designer. The color is fine, I need the clock to be moved all the way to the right and condensend to the one below.

I am using SharePoint 2016 and Designer 2013

enter image description here

Below is the JavaScript that I have that I could use an assist on to position it to the left.

Thank you!

    <script language="JavaScript">

      var Regions = Array();
      var UTCTime = new Date().getUTCMilliseconds();
      var monthArray = new Array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December")
      var gmt = new Date()
      var gmtMilisecondsOffset = gmt.getTimezoneOffset() * 60 * 1000;      

      function WorldClockRegion(name, title, offset, SpringDTSMonth, SpringDTSWeekDate, SpringDTSWeekDateOrderNumber, SpringDTSHours, SpringDTSMinutes, FallDTSMonth, FallDTSWeekDate, FallDTSWeekDateOrderNumber, FallDTSHours, FallDTSMinutes){
        this.RegionName = name;
        this.RegionTitle = title;
        this.RegionTimeOffset = offset;

        this.SpringDTSMonth = SpringDTSMonth;
        this.SpringDTSWeekDate = SpringDTSWeekDate;
        this.SpringDTSWeekDateOrderNumber = SpringDTSWeekDateOrderNumber;
        this.SpringDTSHours = SpringDTSHours;
        this.SpringDTSMinutes = SpringDTSMinutes;

        this.FallDTSMonth = FallDTSMonth;
        this.FallDTSWeekDate = FallDTSWeekDate;
        this.FallDTSWeekDateOrderNumber = FallDTSWeekDateOrderNumber;
        this.FallDTSHours = FallDTSHours;
        this.FallDTSMinutes = FallDTSMinutes;
        this.DST = "";
      }

      function InitWorldClockRegions(){
        var index = 0;

Regions[index++] = new WorldClockRegion("Atlantic","East Coast",-5, 2,0,2,2,0, 9,0,2,0,0);
Regions[index++] = new WorldClockRegion("ZULU","(GMT)",0);   // zulu looks like corrected already     
Regions[index++] = new WorldClockRegion("Kuwait","Riyadh",3, 2,0,"LAST",2,0, 9,0,"LAST",3,0);
Regions[index++] = new WorldClockRegion("Iraq","(OIF)",3);  
Regions[index++] = new WorldClockRegion("Afghanistan","(OEF)",4.5);        

      }
      function InitDTS(){
        for(var i =0; i < Regions.length;i++){
          if(Regions[i].SpringDTSMonth != null && Regions[i].SpringDTSWeekDate != null && Regions[i].SpringDTSWeekDateOrderNumber != null){
            var springDD = getMonthWeekOrderDay(Regions[i].SpringDTSMonth, Regions[i].SpringDTSWeekDate, Regions[i].SpringDTSWeekDateOrderNumber);
            var fallDD = getMonthWeekOrderDay(Regions[i].SpringDTSMonth, Regions[i].SpringDTSWeekDate, Regions[i].SpringDTSWeekDateOrderNumber);

            springDD.setHours(Regions[i].SpringDTSHours);
            springDD.setMinutes(Regions[i].SpringDTSMinutes);

            var today = new Date();
            if(springDD.getTime() < today.getTime()){
              Regions[i].RegionTimeOffset++;
              Regions[i].DST = "DST";
            }
          }
          if(Regions[i].FallDTSMonth != null && Regions[i].FallDTSWeekDate != null && Regions[i].FallDTSWeekDateOrderNumber != null){

            var fallDD = getMonthWeekOrderDay(Regions[i].FallDTSMonth, Regions[i].FallDTSWeekDate, Regions[i].FallDTSWeekDateOrderNumber);
            fallDD.setHours(Regions[i].FallDTSHours);
            fallDD.setMinutes(Regions[i].FallDTSMinutes);

            var today = new Date();
            if(fallDD.getTime() < today.getTime()){
              Regions[i].RegionTimeOffset--;
              Regions[i].DST = "";
            }
          }                    
        }
      }
      function getTotalDaysInMonth(month){
        var TotalDaysInMonth = 31;
        if(month == 1)
          TotalDaysInMonth = 29;

        var d = new Date();
        d.setMonth(month);
        d.setDate(TotalDaysInMonth);
        var check_month = d.getMonth();
        if(month != check_month){
          if(month == 1)
            TotalDaysInMonth = 28;
          else
            TotalDaysInMonth = 30;
        }
        return TotalDaysInMonth;
      }
      function getMonthWeekOrderDay(month, WeekDay, Order){
        var mwkd = getMonthWeekDays(month, WeekDay);
        if(Order == "LAST")
          return mwkd[mwkd.length-1];
        return mwkd[Order-1];
      }      
      function getMonthWeekDays(month, WeekDay){

        var TotalDaysInMonth = getTotalDaysInMonth(month);
        var aWeekDays = Array();

        for(var i=1; i <= TotalDaysInMonth; i++){
          var dd = new Date();
          dd.setMonth(month);
          dd.setDate(i);
          if(WeekDay == dd.getDay()){
            aWeekDays[aWeekDays.length] = dd;
          }
        }        
        return aWeekDays;
      }

      function RenderWorldClockRegionsPlaceholders(){
        var output = '<table>';

        var tr1 = '<tr class="hrow">';
        var tr2 = '<tr>';
        for(i=0; i < Regions.length; i++){

          tr1 += "<td class=regionHeader><CENTER>"+Regions[i].RegionName+"</td>";                          
          tr2 += "<td><center><span id="+Regions[i].RegionName+" class=></span></td>";

        }
        tr1 += '</tr>';
        tr2 += '<tr>';
        output += tr1 + tr2 +'</table>';

        document.getElementById("WorldClock").innerHTML = output;
      }
      function SetWorldClockTime(){

        for(i=0; i < Regions.length; i++){
          regionTime = new Date();

          regionTime = regionTime.getTime() + (gmtMilisecondsOffset + (Regions[i].RegionTimeOffset * 60 * 60 * 1000));
          regionTime = new Date(regionTime);

          var hr = regionTime.getHours();
          hr = CorrectTime(hr);

          var min = regionTime.getMinutes();
          min = CorrectTime(min);

          var sec = regionTime.getSeconds();
          sec = CorrectTime(sec);

          var currentTime = new Date();
          var boldBegin = "<span class=otherRegion>";
          var boldEnd = "</span>";

         // window.alert((currentTime.getTime() - regionTime.getTime()))
         var dif = (currentTime.getTime() - regionTime.getTime());
          if(dif > -10000 && dif < 10000){
            boldBegin = "<span class=currentRegion>";
            boldEnd = "</span>";
          }

          var time = boldBegin + regionTime.toDateString() + "<br>" + hr + ":" + min + ":" + sec + " " + Regions[i].DST + boldEnd;

          document.getElementById(Regions[i].RegionName).innerHTML = time;
        }

        setTimeout("SetWorldClockTime()", 1000)
      }
      function CorrectTime(t){
        if(t < 10)
          return "0" + t;
        return t;
      }
      function InitWorldClock(){
        InitWorldClockRegions();
        InitDTS();
        RenderWorldClockRegionsPlaceholders();
        SetWorldClockTime();
      }
      //]]>
        </script>
        <style type="text/css">
//<![CDATA[
.hrow {
font-weight:bold;
color: #C1E97C;
}
.hrow td{
padding-top: 20px;
width: 140px;
}
.otherRegion{
    font-weight: normal;
    color: #000000;
    font-family: Cambria;
    font-size: small;
}
        </style>
        <div id="WorldClock">
        </div>
        <script language="JavaScript">
 InitWorldClock();
        </script>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.