[ Index ] |
|
Code source de vtiger CRM 5.0.2 |
1 if (document.getElementById){ 2 3 fCol='#000000'; //face/number colour. 4 dCol='#cccccc'; //dot colour. 5 hCol='#000000'; //hours colour. 6 mCol='#000000'; //minutes colour. 7 sCol='#ff0000'; //seconds colour. 8 cCol='#000000'; //date colour. 9 aCol='#999999'; //am-pm colour. 10 bCol='#ffffff'; //select/form background colour. 11 tCol='#000000'; //select/form text colour. 12 13 //Alter nothing below! Alignments will be lost! 14 y=87; 15 xpos=60; 16 h=4; 17 m=5; 18 s=6; 19 cf=new Array(); 20 cd=new Array(); 21 ch=new Array(); 22 cm=new Array(); 23 cs=new Array(); 24 face="3 4 5 6 7 8 9 10 11 12 1 2"; 25 face=face.split(" "); 26 n=face.length; 27 e=360/n; 28 hDims=7; 29 zone=0; 30 isItLocal=true; 31 ampm=""; 32 daysInMonth=31; 33 todaysDate=""; 34 var addHours; 35 var oddMinutes; 36 var getOddMinutes; 37 var addOddMinutes; 38 plusMinus=false; 39 40 var mon=new Array("January","February","March","April","May","June","July","August","September","October","November","December"); 41 42 document.write('<div id="theDate" class="datestyle" style="color:'+cCol+'">\!<\/div>'); 43 document.write('<div id="amOrPm" class="ampmstyle" style="color:'+aCol+'">\!<\/div>'); 44 for (i=0; i < n; i++){ 45 document.write('<div id="theFace'+i+'" class="facestyle" style="color:'+fCol+'">'+face[i]+'<\/div>'); 46 47 cf[i]=document.getElementById("theFace"+i).style; 48 cf[i].top=y-6+30*1.4*Math.sin(i*e*Math.PI/180)+"px"; 49 cf[i].left=xpos-6+30*1.4*Math.cos(i*e*Math.PI/180)+"px"; 50 } 51 for (i=0; i < n; i++){} 52 for (i=0; i < h; i++){ 53 document.write('<div id="H'+i+'" class="handsanddotsstyle" style="background-color:'+hCol+'"><\/div>'); 54 ch[i]=document.getElementById("H"+i).style; 55 } 56 for (i=0; i < m; i++){ 57 document.write('<div id="M'+i+'" class="handsanddotsstyle" style="background-color:'+mCol+'"><\/div>'); 58 cm[i]=document.getElementById("M"+i).style; 59 } 60 for (i=0; i < s; i++){ 61 document.write('<div id="S'+i+'" class="handsanddotsstyle" style="background-color:'+sCol+'"><\/div>'); 62 cs[i]=document.getElementById("S"+i).style; 63 } 64 65 var dsp1=document.getElementById("amOrPm").style; 66 var dsp2=document.getElementById("theCities").style; 67 var dsp3=document.getElementById("theDate").style; 68 //var dsp4=document.getElementById("city").style; 69 var dsp5=document.getElementById("theClockLayer").style; 70 dsp1.top=y+"px"; 71 dsp1.left=xpos-8+"px"; 72 dsp2.top=y-80+"px"; 73 dsp2.left=xpos-55+"px"; 74 dsp3.top=y+55+"px"; 75 dsp3.left=xpos-60+"px"; 76 77 dsp5.backgroundImage="url(themes/blue/images/clock_bg.gif)" 78 dsp5.backgroundRepeat="no-repeat" 79 dsp5.backgroundPosition="4px 38px" 80 81 function lcl(currIndex,localState){ 82 zone=document.frmtimezone.city.options[currIndex].value; 83 isItLocal=localState; 84 plusMinus=(zone.charAt(0) == "-")?true:false; 85 oddMinutes=(zone.indexOf(".") != -1)?true:false; 86 if (oddMinutes){ 87 getOddMinutes=zone.substring(zone.indexOf(".")+1,zone.length) 88 } 89 90 addHours=(oddMinutes)?parseInt(zone.substring(0,zone.indexOf("."))):parseInt(zone) 91 if (plusMinus){ 92 addOddMinutes=(oddMinutes)?parseInt(-getOddMinutes):0; 93 } else{ 94 addOddMinutes=(oddMinutes)?parseInt(getOddMinutes):0; 95 } 96 97 set_cookie("timezone",currIndex) 98 } 99 100 function ClockAndAssign(){ 101 hourAdjust=0; 102 dayAdjust=0; 103 monthAdjust=0; 104 now=new Date(); 105 106 secs=now.getSeconds(); 107 sec=Math.PI*(secs-15)/30; 108 109 mins=(isItLocal)?now.getMinutes():now.getUTCMinutes(); 110 if (oddMinutes){ 111 mins=eval(mins+addOddMinutes); 112 } 113 min=Math.PI*(mins-15)/30; 114 if (mins<0){ 115 mins+=60;hourAdjust=-1; 116 } 117 if (mins>59){ 118 mins-=60;hourAdjust=1; 119 } 120 121 hr=(isItLocal)?now.getHours()+hourAdjust:now.getUTCHours()+addHours+hourAdjust 122 hrs=Math.PI*(hr-3)/6+Math.PI*parseInt(now.getMinutes())/360; 123 124 if (!isItLocal){ 125 if (addHours<0){ 126 if(now.getUTCHours()+parseInt(addHours)<0) 127 dayAdjust-=1 128 } else{ 129 if(now.getUTCHours()+parseInt(addHours)>23) 130 dayAdjust+=1 131 } 132 } 133 134 day=now.getDate()+dayAdjust; 135 136 if (day<1){ 137 day+=daysInMonth; 138 monthAdjust=-1; 139 } 140 if (day>daysInMonth){ 141 day-=daysInMonth; 142 monthAdjust=1; 143 } 144 145 month=parseInt(now.getMonth()+1+monthAdjust); 146 147 if (month==2){ 148 daysInMonth=28; 149 } 150 year=now.getYear(); 151 if (year<2000){ 152 year=year+1900; 153 } 154 leap_year=(eval(year%4)==0)?true:false; 155 if (leap_year&&month==2){ 156 daysInMonth=29; 157 } 158 if (month<1){ 159 month+=12; 160 year--; 161 } 162 if (month>12){ 163 month-=12; 164 year++; 165 } 166 todaysDate=mon[month-1]+" "+day+", "+year; 167 168 if (hr<0) hr+=24; 169 if (hr>23) hr-=24; 170 171 ampm=(hr>11)?"PM":"AM"; 172 173 for (i=0;i<s;i++){ 174 cs[i].top=y+(i*hDims)*Math.sin(sec)+"px"; 175 cs[i].left=xpos+(i*hDims)*Math.cos(sec)+"px"; 176 } 177 for (i=0;i<m;i++){ 178 cm[i].top=y+(i*hDims)*Math.sin(min)+"px"; 179 cm[i].left=xpos+(i*hDims)*Math.cos(min)+"px"; 180 } 181 for (i=0;i<h;i++){ 182 ch[i].top=y+(i*hDims)*Math.sin(hrs)+"px"; 183 ch[i].left=xpos+(i*hDims)*Math.cos(hrs)+"px"; 184 } 185 186 document.getElementById("amOrPm").firstChild.data=ampm; 187 188 if (hr==0) 189 { 190 hr=12 191 } 192 else if (hr>12) 193 { 194 hr-=12; 195 } 196 197 198 if (mins.toString().length==1) mins="0"+mins; 199 200 document.getElementById("theDate").firstChild.data=todaysDate+" "+hr+":"+mins+" "+ampm; 201 setTimeout('ClockAndAssign()',100); 202 } 203 ClockAndAssign(); 204 } 205 206 207 if (get_cookie("timezone")==null || get_cookie("timezone")==false || get_cookie("timezone")<0 || get_cookie("timezone")=="1") { 208 lcl(0,true) 209 } else { 210 lcl(get_cookie("timezone"),false) 211 document.frmtimezone.city.options[get_cookie("timezone")].selected=true 212 }
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Sun Feb 25 10:22:19 2007 | par Balluche grâce à PHPXref 0.7 |