index.php 52 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505
  1. <?php
  2. //require '../../app/checklogin.inc';
  3. require '../public/config.php';
  4. require_once '../public/load_lang.php';
  5. if(isset($_GET["language"])){
  6. $currLanguage=$_GET["language"];
  7. $_COOKIE["language"]=$currLanguage;
  8. }
  9. else{
  10. if(isset($_COOKIE["language"])){
  11. $currLanguage=$_COOKIE["language"];
  12. }
  13. else{
  14. $currLanguage="en";
  15. $_COOKIE["language"]=$currLanguage;
  16. }
  17. }
  18. //load language file
  19. /*
  20. if(file_exists($dir_language.$currLanguage.".php")){
  21. require $dir_language.$currLanguage.".php";
  22. }
  23. else{
  24. require $dir_language."default.php";
  25. }
  26. require __DIR__."/../../app/language/default.php";
  27. */
  28. if(isset($_GET["device"])){
  29. $currDevice=$_GET["device"];
  30. }
  31. else{
  32. if(isset($_COOKIE["device"])){
  33. $currDevice=$_COOKIE["device"];
  34. }
  35. else{
  36. $currDevice="computer";
  37. }
  38. }
  39. //修改页面编码
  40. //header("content-type:text/html;charset=utf-8");
  41. //获取当前年
  42. $year=$_GET['y']?$_GET['y']:date('Y');
  43. //获取当年月
  44. $month=$_GET['m']?$_GET['m']:date('m');
  45. //获取当前日
  46. //$selected_date=$_GET['d']?$_GET['d']:date('j');
  47. $dir_app="../studio/";
  48. ?>
  49. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
  50. <html>
  51. <head>
  52. <script language="javascript" src="../studio/charcode/sinhala.js"></script>
  53. <script language="javascript" src="../studio/charcode/myanmar.js"></script>
  54. <script language="javascript" src="../studio/charcode/unicode.js"></script>
  55. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
  56. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  57. <link type="text/css" rel="stylesheet" href="<?php echo $dir_app; ?>css/style.css"/>
  58. <link type="text/css" rel="stylesheet" href="<?php echo $dir_app; ?>css/color_day.css" id="colorchange" />
  59. <link type="text/css" rel="stylesheet" href="<?php echo $dir_app; ?>css/style.css"/>
  60. <title><?php echo $_local->gui->pcd_studio;?></title>
  61. <script src="<?php echo $dir_app; ?>js/jquery-3.3.1.min.js"></script>
  62. <!-- <script language="javascript" src="<?php echo $dir_app; ?>charcode/sinhala.js"></script>
  63. <script language="javascript" src="<?php echo $dir_app; ?>charcode/myanmar.js"></script>
  64. <script language="javascript" src="<?php echo $dir_app; ?>charcode/unicode.js"></script>
  65. -->
  66. <script>
  67. <?php
  68. //加载js语言包
  69. require_once '../public/load_lang_js.php';
  70. ?>
  71. </script>
  72. <style type="text/css">
  73. .BE_icon_span{
  74. width: 7em;
  75. display: inline-block;
  76. }
  77. #BE_icon{
  78. font-size: 100%;
  79. }
  80. .td_today{
  81. margin: auto;
  82. background: silver;
  83. color: black;
  84. width: 2em;
  85. }
  86. .new_moon_uposatha{
  87. background:black;
  88. border-radius: 2em;
  89. width: 2em;
  90. margin: auto;
  91. }
  92. .full_moon_uposatha{
  93. background:orange;
  94. border-radius: 2em;
  95. width: 2em;
  96. margin: auto;
  97. }
  98. .table_body{
  99. width:700px;
  100. border:1px;
  101. font-size: 60%;
  102. width: 95%;
  103. max-width: 45em;
  104. line-height: 2em;
  105. text-align: center;
  106. margin: 20px 0px;
  107. border-collapse: collapse;
  108. }
  109. .table_line{
  110. display: flex;
  111. }
  112. .table_column{
  113. border:solid;
  114. border-width: thin;
  115. flex:1;
  116. }
  117. input[type="number"]{
  118. width: 3em;
  119. }
  120. input[type="date"]{
  121. width: 10em;
  122. }
  123. </style>
  124. <?php
  125. /*
  126. if(file_exists("../user/App/language/$currLanguage.js")){
  127. echo("<script language=\"javascript\" src=\"../user/App/language/$currLanguage.js\"></script>");
  128. }
  129. else{
  130. echo("<script language=\"javascript\" src=\"language/$currLanguage.js\"></script>");
  131. }
  132. */
  133. ?>
  134. <!--加载语言文件结束 -->
  135. <script type="text/javascript">
  136. var g_device = "computer";
  137. var strSertch = location.search;
  138. if(strSertch.length>0){
  139. strSertch = strSertch.substr(1);
  140. var sertchList=strSertch.split('&');
  141. for ( i in sertchList){
  142. var item = sertchList[i].split('=');
  143. if(item[0]=="device"){
  144. g_device=item[1];
  145. }
  146. }
  147. }
  148. if(g_device=="mobile"){
  149. g_is_mobile=true;
  150. }
  151. else{
  152. g_is_mobile=false;
  153. }
  154. var g_langrage="en";
  155. function setCookie(c_name,value,expiredays)
  156. {
  157. var exdate=new Date()
  158. exdate.setDate(exdate.getDate()+expiredays)
  159. document.cookie=c_name+ "=" +escape(value)+((expiredays==null) ? "" : "; expires="+exdate.toGMTString())
  160. }
  161. var pali_num_str=[
  162. { "id":"1" , "value":"eka" },
  163. { "id":"2" , "value":"dve" },
  164. { "id":"3" , "value":"ti" },
  165. { "id":"4" , "value":"catu" },
  166. { "id":"5" , "value":"pañca" },
  167. { "id":"6" , "value":"cha" },
  168. { "id":"7" , "value":"satta" },
  169. { "id":"8" , "value":"aṭṭha" },
  170. { "id":"9" , "value":"nava" },
  171. { "id":"10" , "value":"dasa" },
  172. { "id":"11" , "value":"ekādasa" },
  173. { "id":"12" , "value":"dvādasa " },
  174. { "id":"13" , "value":"terasa" },
  175. { "id":"14" , "value":"cuddasa" },
  176. { "id":"15" , "value":"paṇṇarasa" },
  177. { "id":"16" , "value":"soḷasa" },
  178. { "id":"17" , "value":"sattarasa" },
  179. { "id":"18" , "value":"aṭṭharasa" },
  180. { "id":"19" , "value":"ekūna-vīsati" },
  181. { "id":"20" , "value":"vīsati" },
  182. { "id":"21" , "value":"eka-vīsati" },
  183. { "id":"22" , "value":"dve-vīsati" },
  184. { "id":"23" , "value":"te-vīsati" },
  185. { "id":"24" , "value":"catu-vīsati" },
  186. { "id":"25" , "value":"pañca-vīsati" },
  187. { "id":"26" , "value":"cha-bbīsati" },
  188. { "id":"27" , "value":"satta-vīsati" },
  189. { "id":"28" , "value":"aṭṭha-vīsati" },
  190. { "id":"29" , "value":"ekūna-tiṃsati" },
  191. { "id":"30" , "value":"tiṃsati" },
  192. { "id":"31" , "value":"eka-tiṃsati" },
  193. { "id":"32" , "value":"dvattiṃsati" },
  194. { "id":"33" , "value":"tettiṃsati" },
  195. { "id":"34" , "value":"catuttiṃsati" },
  196. { "id":"35" , "value":"pañcatiṃsati" },
  197. { "id":"36" , "value":"chattiṃsati" },
  198. { "id":"37" , "value":"sattatiṃsati" },
  199. { "id":"38" , "value":"aṭṭhatiṃsati" },
  200. { "id":"39" , "value":"ekūna-cattālīsati" },
  201. { "id":"40" , "value":"cattālīsati" },
  202. { "id":"41" , "value":"eka-cattālīsati" },
  203. { "id":"42" , "value":"dve-cattālīsati" },
  204. { "id":"43" , "value":"ti-cattālīsati" },
  205. { "id":"44" , "value":"catu-cattālīsati" },
  206. { "id":"45" , "value":"pañca-cattālīsati" },
  207. { "id":"46" , "value":"cha-cattālīsati" },
  208. { "id":"47" , "value":"satta-cattālīsati" },
  209. { "id":"48" , "value":"aṭṭha-cattālīsati" },
  210. { "id":"49" , "value":"ekūna-paññāsā" },
  211. { "id":"50" , "value":"paññāsā" },
  212. { "id":"51" , "value":"eka-paññāsā" },
  213. { "id":"52" , "value":"dve-paññāsā" },
  214. { "id":"53" , "value":"ti-paññāsā" },
  215. { "id":"54" , "value":"catu-paññāsā" },
  216. { "id":"55" , "value":"pañca-paññāsā" },
  217. { "id":"56" , "value":"cha-paññāsā" },
  218. { "id":"57" , "value":"satta-paññāsā" },
  219. { "id":"58" , "value":"aṭṭha-paññāsā" },
  220. { "id":"59" , "value":"ekūna-saṭṭhi" },
  221. { "id":"60" , "value":"saṭṭhi" },
  222. { "id":"61" , "value":"eka-saṭṭhi" },
  223. { "id":"62" , "value":"dve-saṭṭhi" },
  224. { "id":"63" , "value":"ti-saṭṭhi" },
  225. { "id":"64" , "value":"catu-saṭṭhi" },
  226. { "id":"65" , "value":"pañca-saṭṭhi" },
  227. { "id":"66" , "value":"cha-saṭṭhi" },
  228. { "id":"67" , "value":"satta-saṭṭhi" },
  229. { "id":"68" , "value":"aṭṭha-saṭṭhi" },
  230. { "id":"69" , "value":"ekūna-sattati" },
  231. { "id":"70" , "value":"sattati" },
  232. { "id":"71" , "value":"eka-sattati" },
  233. { "id":"72" , "value":"dve-sattati" },
  234. { "id":"73" , "value":"ti-sattati" },
  235. { "id":"74" , "value":"catu-sattati" },
  236. { "id":"75" , "value":"pañca-sattati" },
  237. { "id":"76" , "value":"cha-sattati" },
  238. { "id":"77" , "value":"satta-sattati" },
  239. { "id":"78" , "value":"aṭṭha-sattati" },
  240. { "id":"79" , "value":"ekūnāsīti" },
  241. { "id":"80" , "value":"asīti" },
  242. { "id":"81" , "value":"eka-asīti" },
  243. { "id":"82" , "value":"dve-asīti" },
  244. { "id":"83" , "value":"ti-asīti" },
  245. { "id":"84" , "value":"catu-asīti" },
  246. { "id":"85" , "value":"pañca-asīti" },
  247. { "id":"86" , "value":"cha-asīti" },
  248. { "id":"87" , "value":"satta-asīti" },
  249. { "id":"88" , "value":"aṭṭha-asīti" },
  250. { "id":"89" , "value":"ekūna-navuti" },
  251. { "id":"90" , "value":"navuti" },
  252. { "id":"91" , "value":"eka-navuti" },
  253. { "id":"92" , "value":"dve-navuti" },
  254. { "id":"93" , "value":"ti-navuti" },
  255. { "id":"94" , "value":"catu-navuti" },
  256. { "id":"95" , "value":"pañca-navuti" },
  257. { "id":"96" , "value":"cha-navuti" },
  258. { "id":"97" , "value":"satta-navuti" },
  259. { "id":"98" , "value":"aṭṭha-navuti" },
  260. { "id":"99" , "value":"ekūna-sata" },
  261. { "id":"100" , "value":"sata" },
  262. { "id":"200" , "value":"dvi-sata" },
  263. { "id":"300" , "value":"ti-sata" },
  264. { "id":"400" , "value":"catu-sata" },
  265. { "id":"500" , "value":"pañca-sata" },
  266. { "id":"600" , "value":"cha-sata" },
  267. { "id":"700" , "value":"satta-sata" },
  268. { "id":"800" , "value":"aṭṭha-sata" },
  269. { "id":"900" , "value":"nava-sata" },
  270. { "id":"1000" , "value":"sahassa" },
  271. { "id":"2000" , "value":"dve-sahassa" },
  272. { "id":"3000" , "value":"ti-sahassa" },
  273. { "id":"4000" , "value":"catu-sahassa" },
  274. { "id":"5000" , "value":"pañca-sahassa" }
  275. ]
  276. var pali_num_str_pl=[
  277. //{ "id":"0" , "value":"na" },
  278. //{ "id":"1" , "value":"eka" },
  279. { "id":"2" , "value":"dve" },
  280. { "id":"3" , "value":"tīṇi" },
  281. { "id":"4" , "value":"cattāri" },
  282. { "id":"5" , "value":"pañca" },
  283. { "id":"6" , "value":"cha" },
  284. { "id":"7" , "value":"satta" },
  285. { "id":"8" , "value":"aṭṭha" },
  286. { "id":"9" , "value":"nava" },
  287. { "id":"10" , "value":"dasa" },
  288. { "id":"11" , "value":"ekādasa" },
  289. { "id":"12" , "value":"dvādasa " },
  290. { "id":"13" , "value":"terasa" },
  291. { "id":"14" , "value":"cuddasa" },
  292. { "id":"15" , "value":"paṇṇarasa" },
  293. { "id":"16" , "value":"soḷasa" },
  294. { "id":"17" , "value":"sattarasa" },
  295. { "id":"18" , "value":"aṭṭharasa" },
  296. { "id":"19" , "value":"ekūna-vīsati" },
  297. { "id":"20" , "value":"vīsati" },
  298. { "id":"21" , "value":"eka-vīsati" },
  299. { "id":"22" , "value":"dve-vīsati" },
  300. { "id":"23" , "value":"te-vīsati" },
  301. { "id":"24" , "value":"catu-vīsati" },
  302. { "id":"25" , "value":"pañca-vīsati" },
  303. { "id":"26" , "value":"cha-bbīsati" },
  304. { "id":"27" , "value":"satta-vīsati" },
  305. { "id":"28" , "value":"aṭṭha-vīsati" },
  306. { "id":"29" , "value":"ekūna-tiṃsati" }
  307. ]
  308. var pali_year_name=[
  309. { "id":"0" , "value":"sappa" , "icon":"🐍"},
  310. //🐀🐃🐄🐏🐑
  311. //🐭🐮🐯🐰🐲🐍🐴🐵🐔🐶🐷
  312. { "id":"1" , "value":"assa" , "icon":"🐎"},
  313. { "id":"2" , "value":"aja" , "icon":"🐐"},
  314. { "id":"3" , "value":"kapi" , "icon":"🐒"},
  315. { "id":"4" , "value":"kukkuṭa" , "icon":"🐓"},
  316. { "id":"5" , "value":"soṇa" , "icon":"🐕"},
  317. { "id":"6" , "value":"sūkara" , "icon":"🐖"},
  318. { "id":"7" , "value":"mūsika" , "icon":"🐁"},
  319. { "id":"8" , "value":"vasabha" , "icon":"🐂"},
  320. { "id":"9" , "value":"vyaggaha" , "icon":"🐅"},
  321. { "id":"10" , "value":"sasa" , "icon":"🐇"},
  322. { "id":"11" , "value":"nāga" , "icon":"🐉"}
  323. ]
  324. var pali_month_name=[
  325. { "id":"1" , "value":"jeṭṭha" , "season":"gimhāna" , "season_icon":"☀"},//5.X-四-十五-心
  326. { "id":"2" , "value":"asāḷha" , "season":"gimhāna" , "season_icon":"☀"},//6.X-五-十五、十六-箕、斗
  327. { "id":"3" , "value":"sāvana" , "season":"vassāna" , "season_icon":"☔"},//7.X-六-十五-女
  328. { "id":"4" , "value":"poṭṭhapāda" , "season":"vassāna" , "season_icon":"☔"},//8.x-七-十五、十六-室、壁
  329. { "id":"5" , "value":"assajuja" , "season":"vassāna" , "season_icon":"☔"},//9.X-八-十五-樓
  330. { "id":"6" , "value":"kattika" , "season":"vassāna" , "season_icon":"☔"},//10.X-九-十五-昂
  331. { "id":"7" , "value":"māgasira" , "season":"hemanta" , "season_icon":"❄"},//11.X-十-十五-觜
  332. { "id":"8" , "value":"phussa" , "season":"hemanta" , "season_icon":"❄"},//12.X-十一-十五-鬼
  333. { "id":"9" , "value":"māgha" , "season":"hemanta" , "season_icon":"❄"},//1.X-十二-十五-星
  334. { "id":"10" , "value":"phagguna" , "season":"hemanta" , "season_icon":"❄"},//2.X-正月-十四、十五-張、異
  335. { "id":"11" , "value":"citta" , "season":"gimhāna" , "season_icon":"☀"},//3.X-二月-十五-角
  336. { "id":"12" , "value":"vesākha" , "season":"gimhāna" , "season_icon":"☀"}//4.X-三月-十五-氐
  337. ]
  338. var pali_date_name=[
  339. { "id":"1" , "value":"paṭhamaṃ" },
  340. { "id":"2" , "value":"dutiyaṃ" },
  341. { "id":"3" , "value":"tatiyaṃ" },
  342. { "id":"4" , "value":"catutthaṃ" },
  343. { "id":"5" , "value":"pañcamaṃ" },
  344. { "id":"6" , "value":"chaṭṭhamaṃ" },
  345. { "id":"7" , "value":"sattamaṃ" },
  346. { "id":"8" , "value":"aṭṭhamaṃ" },
  347. { "id":"9" , "value":"navamaṃ" },
  348. { "id":"10" , "value":"dasamaṃ" },
  349. { "id":"11" , "value":"ekādasamaṃ" },
  350. { "id":"12" , "value":"dvādasamaṃ" },
  351. { "id":"13" , "value":"terasamaṃ" },
  352. { "id":"14" , "value":"cuddasamaṃ" },
  353. { "id":"15" , "value":"paṇṇarasamaṃ" }
  354. ]
  355. var pali_week_day_name=[
  356. { "id":"0" , "value":"ravi" ,"icon":"☀"},
  357. { "id":"1" , "value":"canda" ,"icon":"🌙"},
  358. { "id":"2" , "value":"bhumma" ,"icon":""},//土
  359. { "id":"3" , "value":"budha" ,"icon":""},//水星
  360. { "id":"4" , "value":"guru" ,"icon":""},//木星
  361. { "id":"5" , "value":"sukka" ,"icon":"♀"},//金星
  362. { "id":"6" , "value":"sora" ,"icon":"♂"}//火星
  363. ]
  364. var g_Unix_now=0;
  365. function startTime(){
  366. var today=new Date()
  367. var h=today.getHours()
  368. var m=today.getMinutes()
  369. var s=today.getSeconds()
  370. // add a zero in front of numbers<10
  371. h=checkTime(h)
  372. m=checkTime(m)
  373. s=checkTime(s)
  374. document.getElementById('clock_string').innerHTML=h+":"+m+":"+s
  375. g_Unix_now=today.getTime()
  376. t=setTimeout('startTime()',500)
  377. }
  378. function checkTime(i){
  379. if (i<10)
  380. {i="0" + i}
  381. return i
  382. }
  383. </script>
  384. </head>
  385. <body class="indexbody" onload="startTime()">
  386. <!-- tool bar begin-->
  387. <div class='index_toolbar'>
  388. <div class="toolgroup1">
  389. <span><?php echo $_local->gui->language_select;?></span>
  390. <?php
  391. echo "<select id='id_language' name='menu' onchange=\"menuLangrage(this,".$year.",".$month.")\">";
  392. echo "<option value='pali' >Pāḷi Roman</option>";
  393. echo "<option value='en' >English</option>";
  394. echo "<option value='si' >සිංහල</option>";
  395. echo "<option value='my' >myanmar</option>";
  396. echo "<option value='zh-cn' >简体中文</option>";
  397. echo "<option value='zh-tw' >繁體中文</option>";
  398. echo "</select>";
  399. ?>
  400. </div>
  401. </div>
  402. <!--tool bar end -->
  403. <script>
  404. document.getElementById("id_language").value="<?php echo($currLanguage); ?>";
  405. </script>
  406. <?php
  407. //獲取今天是幾號
  408. $cur_date=date('j');
  409. //获取当前月多少天
  410. $days=date('t',strtotime("{$year}-{$month}-1"));
  411. //選定日
  412. if($cur_date>$days){
  413. $selected_date=1;
  414. }
  415. else{
  416. $selected_date=$cur_date;
  417. }
  418. //当前一号周几
  419. $week=date('w',strtotime("{$year}-{$month}-1"));
  420. //居中
  421. echo "<br/><br/><br/>";
  422. echo "<div style='display:flex; flex-direction: column;'>";
  423. echo "<center style='display: flex;flex: 3;flex-direction: column;padding: 10px;'>";
  424. //設定vesakha日
  425. $vesakha_day=date_create("2019-5-18");
  426. $vesakha_day_1=date_sub($vesakha_day,date_interval_create_from_date_string("-354 days"));
  427. $vesakha_day=date_create("2019-5-18");
  428. //當前日差值
  429. $diff=date_diff($vesakha_day,date_create("{$year}-{$month}-{$selected_date}"));
  430. $diff_1=date_diff($vesakha_day_1,date_create("{$year}-{$month}-{$selected_date}"));
  431. $days_diff=$diff->format("%R%a");
  432. $days_diff_1=$diff_1->format("%R%a");
  433. if($days_diff_1>0){
  434. $days_diff=$days_diff_1;
  435. }
  436. //當前年差值
  437. if($diff->format("%R")=="+" && $diff_1->format("%R")=="+"){
  438. $years_diff_total=544-1+date_format($vesakha_day_1,"Y");
  439. }
  440. else if($diff->format("%R")=="+" && $diff_1->format("%R")=="-"){
  441. $years_diff_total=544-1+date_format($vesakha_day,"Y");
  442. }
  443. else{
  444. $years_diff_total=544-2+date_format($vesakha_day,"Y");
  445. }
  446. //计算上个月
  447. if($month==1){
  448. $prevyear=$year-1;
  449. $prevmonth=12;
  450. }
  451. else{
  452. $prevyear=$year;
  453. $prevmonth=$month-1;
  454. }
  455. //计算下个月
  456. if($month==12){
  457. $nextyear=$year+1;
  458. $nextmonth=1;
  459. }
  460. else{
  461. $nextyear=$year;
  462. $nextmonth=$month+1;
  463. }
  464. //生成年份名稱
  465. if($currLanguage=="en"){
  466. $year_text=$year."/";
  467. }
  468. else{
  469. $year_text="{$year}".$_local->gui->saṃvacchara;//年
  470. }
  471. //生成月份名稱
  472. if($currLanguage=="en"){
  473. $month_text=date('F',strtotime("{$year}-{$month}-1"));
  474. }
  475. else{
  476. $month_text="{$month}".$_local->gui->māsa;//月
  477. }
  478. //输出表头
  479. echo "<h2 style='font-size: 80%;'>";
  480. echo "<a href='index.php?y={$prevyear}&m={$prevmonth}'>";
  481. echo $_local->gui->pubba_māsa;//上一月
  482. echo "</a>|";
  483. echo $year_text;
  484. echo $month_text;
  485. echo "|<a href='index.php?y={$nextyear}&m={$nextmonth}'>";
  486. echo $_local->gui->pacchā_māsa;//下一月
  487. echo "</a></h2>";
  488. //输出日期表格
  489. echo "<table class='table_body' >";
  490. echo "<tr class='table_line'>";
  491. echo "<th class='table_column'>".$_local->gui->ravi."</th>";
  492. echo "<th class='table_column'>".$_local->gui->canda."</th>";
  493. echo "<th class='table_column'>".$_local->gui->bhumma."</th>";
  494. echo "<th class='table_column'>".$_local->gui->budha."</th>";
  495. echo "<th class='table_column'>".$_local->gui->guru."</th>";
  496. echo "<th class='table_column'>".$_local->gui->sukka."</th>";
  497. echo "<th class='table_column'>".$_local->gui->sora."</th>";
  498. echo "</tr>";
  499. //铺表格
  500. for($i=1-$week; $i <=$days ;){
  501. echo "<tr class='table_line'>";
  502. for ($j=0; $j < 7; $j++){
  503. if ($i>$days || $i<1){
  504. echo "<td class='table_column'>&nbsp;</td>";
  505. }
  506. else if($i==$cur_date && $month==date('m')){
  507. $days_diff_X=$days_diff-$selected_date+$i;
  508. $cur_years_diff_total=$years_diff_total;
  509. $cur_days_diff=$days_diff_X;
  510. $cur_week_day=$j;
  511. echo "<td class='table_column' id='td_{$i}' onclick=\"pali_date($i,$days,$years_diff_total,$days_diff_X,$j,'".$currLanguage."',g_coordinate_this)\")' ><div class='td_today'>{$i}</div>";
  512. echo "</td>";
  513. if($i==$days){
  514. $key_days_num=$days_diff_X;
  515. }
  516. }
  517. else if($i==$selected_date){
  518. $days_diff_X=$days_diff-$selected_date+$i;
  519. $cur_years_diff_total=$years_diff_total;
  520. $cur_days_diff=$days_diff_X;
  521. $cur_week_day=$j;
  522. echo "<td class='table_column' id='td_{$i}' onclick=\"pali_date($i,$days,$years_diff_total,$days_diff,$j,'".$currLanguage."',g_coordinate_this)\">{$i}</td>";
  523. if($i==$days){
  524. $key_days_num=$days_diff;
  525. }
  526. }
  527. else{
  528. $days_diff_X=$days_diff-$selected_date+$i;
  529. $cur_years_diff_total=$years_diff_total;
  530. $cur_days_diff=$days_diff_X;
  531. $cur_week_day=$j;
  532. echo "<td class='table_column' id='td_{$i}' onclick=\"pali_date($i,$days,$years_diff_total,$days_diff_X,$j,'".$currLanguage."',g_coordinate_this)\">{$i}</td>";
  533. if($i==$days){
  534. $key_days_num=$days_diff_X;
  535. }
  536. }
  537. $i++;
  538. }
  539. echo "</tr>";
  540. }
  541. echo "</table>";
  542. echo "<div id='position_change'>";
  543. echo "<span id='selected_position_string'>".$_local->gui->loading."</span>";
  544. echo "<button onclick='getLocation()' style='font-size: 100%; padding: 2px 6px;'>";
  545. echo "<svg class='icon' style='min-width: 1.8em; min-height: 1.8em;' >";
  546. echo "<path d='M12 8c-2.21 0-4 1.79-4 4s1.79 4 4 4 4-1.79 4-4-1.79-4-4-4zm8.94 3A8.994 8.994 0 0 0 13 3.06V1h-2v2.06A8.994 8.994 0 0 0 3.06 11H1v2h2.06A8.994 8.994 0 0 0 11 20.94V23h2v-2.06A8.994 8.994 0 0 0 20.94 13H23v-2h-2.06zM12 19c-3.87 0-7-3.13-7-7s3.13-7 7-7 7 3.13 7 7-3.13 7-7 7z'/>";
  547. echo "</svg>".$_local->gui->my_loc."</button>";//自动定位
  548. echo "<button onclick='set_display(\"position_change\",\"position_input\")' style='display: none;'>".$_local->gui->change_position."</button>";//變更地點
  549. echo "</div>";
  550. echo "<div id='position_input' style='display:none;'><span>";
  551. echo $_local->gui->atitude;//緯度
  552. echo ":<input id='AT_selected_°' type='number' min='0' max='90' /> ° ";
  553. echo "<input id='AT_selected_’' type='number' min='0' max='60' /> ’ ";
  554. echo "<input id='AT_selected_”' type='number' min='0' max='60' /> ” ";
  555. echo "<select id='selected_NS'>";
  556. echo "<option value='+' >N</option>";
  557. echo "<option value='-' >S</option>";
  558. echo "</select>";
  559. echo "</span><span>";
  560. echo $_local->gui->longitude;//經度
  561. echo ":<input id='LT_selected_°' type='number' min='0' max='180' /> ° ";
  562. echo "<input id='LT_selected_’' type='number' min='0' max='60' /> ’ ";
  563. echo "<input id='LT_selected_”' type='number' min='0' max='60' /> ” ";
  564. echo "<select id='selected_WE'>";
  565. echo "<option value='+' >E</option>";
  566. echo "<option value='-' >W</option>";
  567. echo "</select>";
  568. echo "</span>";
  569. echo "<div id='position_selected'>";
  570. echo "</div>";
  571. echo "<div><button onclick='confirm()'>";
  572. echo $_local->gui->confirm;//確認
  573. echo "</button></div>";
  574. echo "</div>";
  575. echo "<div style='display:flex; margin: 20px;'>";
  576. echo "<div style='display:grid; flex:3'>";
  577. echo "<span id='time_A_string_X' style='font-size: 100%;'></span>";
  578. echo "<span id='clock_string_X' style='font-size: 100%;'></span>";
  579. echo "<span id='time_B_string_X' style='font-size: 100%; '></span>";
  580. echo "</div>";
  581. echo "<div id='time_sting_div' style='display:grid; flex:2'>";
  582. echo "<span id='time_A_string' style='font-size: 100%; '></span>";
  583. echo "<span id='clock_string' style='font-size: 100%; '></span>";
  584. echo "<span id='time_B_string' style='font-size: 100%; '></span>";
  585. echo "</div>";
  586. echo "<div style='display:grid; flex:6'>";
  587. echo "<span id='kala_judge' style='font-size: 100%; '></span>";
  588. echo "<span id='kala_inst_1' style='font-size: 100%; '></span>";
  589. echo "<span id='kala_inst_2' style='font-size: 100%; '></span>";
  590. echo "</div>";
  591. echo "</div>";
  592. echo "<div id='hori_ref' style='font-size: 100%; '></div>";
  593. //飛機過午問題
  594. echo "<div style='display:flex; font-size: 100%;'>";
  595. //起飛
  596. echo "<div style='flex:3;'>";
  597. echo "<div id='departure_position_result'>";
  598. echo "<span id='departure_position_string'></span>";
  599. echo "<button onclick='set_display(\"departure_position_result\",\"departure_position_input\")'>";
  600. echo $_local->gui->departure_in_detail;//起飛詳情
  601. echo "</button>";
  602. echo "</div>";
  603. echo "<div id='departure_position_input' style='display:none;'>";
  604. //起飛時間
  605. echo $_local->gui->date;//日期
  606. echo ":<input id='departure_date' type='date' />";
  607. echo $_local->gui->time;//時間
  608. echo ":<input id='departure_time' type='time' /><br>";
  609. //起飛地點
  610. echo "<span>";
  611. echo $_local->gui->atitude;//緯度
  612. echo ":<input id='AT_departure_°' type='number' min='0' max='90' /> ° ";
  613. echo "<input id='AT_departure_’' type='number' min='0' max='60' /> ’ ";
  614. echo "<input id='AT_departure_”' type='number' min='0' max='60' /> ” ";
  615. echo "<select id='departure_NS'>";
  616. echo "<option value='+' >N</option>";
  617. echo "<option value='-' >S</option>";
  618. echo "</select>";
  619. echo "</span><br><span>";
  620. echo $_local->gui->longitude;//經度
  621. echo ":<input id='LT_departure_°' type='number' min='0' max='180' /> ° ";
  622. echo "<input id='LT_departure_’' type='number' min='0' max='60' /> ’ ";
  623. echo "<input id='LT_departure_”' type='number' min='0' max='60' /> ” ";
  624. echo "<select id='departure_WE'>";
  625. echo "<option value='+' >E</option>";
  626. echo "<option value='-' >W</option>";
  627. echo "</select>";
  628. echo "</span>";
  629. echo "<div><button onclick='air_confirm(\"departure\")'>";
  630. echo $_local->gui->confirm;//確認
  631. echo "</button></div></div></div>";
  632. //降落
  633. echo "<div style='flex:3;'>";
  634. echo "<div id='arrival_position_result'>";
  635. echo "<span id='arrival_position_string'></span>";
  636. echo "<button onclick='set_display(\"arrival_position_result\",\"arrival_position_input\")'>";
  637. echo $_local->gui->arrival_in_detail;//降落詳情
  638. echo "</button>";
  639. echo "</div>";
  640. echo "<div id='arrival_position_input' style='display:none;'>";
  641. //降落時間
  642. echo $_local->gui->date;//日期
  643. echo ":<input id='arrival_date' type='date' />";
  644. echo $_local->gui->time;//時間
  645. echo ":<input id='arrival_time' type='time' /><br>";
  646. //降落地點
  647. echo "<span>";
  648. echo $_local->gui->atitude;//緯度
  649. echo ":<input id='AT_arrival_°' type='number' min='0' max='90' /> ° ";
  650. echo "<input id='AT_arrival_’' type='number' min='0' max='60' /> ’ ";
  651. echo "<input id='AT_arrival_”' type='number' min='0' max='60' /> ” ";
  652. echo "<select id='arrival_NS'>";
  653. echo "<option value='+' >N</option>";
  654. echo "<option value='-' >S</option>";
  655. echo "</select>";
  656. echo "</span><br><span>";
  657. echo $_local->gui->longitude;//經度
  658. echo ":<input id='LT_arrival_°' type='number' min='0' max='180' /> ° ";
  659. echo "<input id='LT_arrival_’' type='number' min='0' max='60' /> ’ ";
  660. echo "<input id='LT_arrival_”' type='number' min='0' max='60' /> ” ";
  661. echo "<select id='arrival_WE'>";
  662. echo "<option value='+' >E</option>";
  663. echo "<option value='-' >W</option>";
  664. echo "</select>";
  665. echo "</span>";
  666. echo "<div><button onclick='air_confirm(\"arrival\")'>";
  667. echo $_local->gui->confirm;//確認
  668. echo "</button></div></div></div>";
  669. echo "</div>";
  670. echo "<span id='key_num_string' style='display: none; '>{$key_days_num}-{$days}-{$year}-{$month}</span>";
  671. if($cur_years_diff_total!=null && $cur_days_diff!=null && $cur_week_day!=null){
  672. echo "<span id='cur_day_string' style='display: none; '>{$cur_date}-{$days}-{$cur_years_diff_total}-{$cur_days_diff}-{$cur_week_day}-{$currLanguage}</span>";
  673. }
  674. echo "</center>";
  675. /*date_default_timezone_set("Asia/Rangoon");
  676. $Unix_now_time=strtotime("now");
  677. $sun_info=date_sun_info(strtotime("now"),7.738562,80.519675);
  678. $sun_info_1=date_sun_info(strtotime("+1 day"),7.738562,80.519675);
  679. $Unix_dawn=$sun_info['civil_twilight_begin']*1000;
  680. $Unix_dawn_1=$sun_info_1['civil_twilight_begin']*1000;
  681. $Unix_noon=($sun_info['sunrise']+$sun_info['sunset'])/2*1000;
  682. $Unix_noon_1=($sun_info_1['sunrise']+$sun_info_1['sunset'])/2*1000;*/
  683. echo "<span id='time_string' style='display: none;'></span>";//
  684. echo "<span id='air_time_string' style='display: none;'></span>";//
  685. //echo date("H:i:s",$Unix_dawn)."<br/>";
  686. //echo date("H:i:s",$Unix_noon)."<br/>";
  687. echo "<div id='sun_AT' style='display:none;'>{$month}-{$selected_date}</div>";
  688. //echo "<button onclick='set_uposatha_day()'>set uposatha</button>";
  689. echo "<div id='pali_era' style='font-size: 150%;display: flex;flex: 7;padding: 10px;flex-direction: column;'>";
  690. echo "<div id='pali_era_graph' style='display:grid;flex:3;'></div>";
  691. echo "<div id='pali_era_pali' style='display:grid;flex:7;'></div>";
  692. echo "</div>";
  693. //echo date_format($vesakha_day,"Y-m-d")."|".date_format($vesakha_day_1,"Y-m-d")
  694. echo "</div>";
  695. ?>
  696. <script language="javascript">
  697. //設定經緯度
  698. var g_coordinate_this=new Object;
  699. getLocation();
  700. g_coordinate_this=get_coordinate_num("selected");
  701. if(g_coordinate_this.AT==0 || g_coordinate_this.LT==0){
  702. g_coordinate_this.AT=7.738562;
  703. g_coordinate_this.LT=80.519675;
  704. }
  705. function angle_trans(angle){
  706. var angle_str="";
  707. var num_d=Math.floor(angle);
  708. var num_m=Math.floor((angle-num_d)*60);
  709. var num_s=Math.round((angle-num_d)*60-num_m);
  710. if(num_d!=0){
  711. angle_str+=num_d+"°";
  712. }
  713. if(num_m!=0){
  714. angle_str+=num_m+"’";
  715. }
  716. if(num_s!=0){
  717. angle_str+=num_s+"”";
  718. }
  719. return(angle_str);
  720. }
  721. function dwan_noon_display(){
  722. var Unix_string=document.getElementById('time_string').innerHTML
  723. var Unix_Array=Unix_string.split("-");
  724. var time_A=new Date();
  725. var time_B=new Date();
  726. $("#clock_string_X").html(gLocal.gui.now_time+":")
  727. var note_str="";
  728. var sun_hd_str=angle_trans(Unix_Array[4]/Math.PI*180);
  729. var hori_ref_time=Math.floor(Unix_Array[5]/60)+gLocal.gui.mins;
  730. hori_ref_time+=Math.floor(Unix_Array[5]%60)+gLocal.gui.sec;
  731. note_str+=gLocal.gui.note+":";
  732. note_str+=gLocal.gui.sun_height_degree+" "+sun_hd_str+";";
  733. note_str+=gLocal.gui.hori_ref_time+" "+hori_ref_time;
  734. $("#hori_ref").html(note_str);
  735. if(g_Unix_now<Unix_Array[0]){
  736. time_A.setTime(Unix_Array[1])
  737. time_B.setTime(Unix_Array[0])
  738. $("#time_A_string_X").html(gLocal.gui.noon_time+":");
  739. $("#time_A_string").html(set_time_string(time_A));
  740. $("#time_B_string_X").html(gLocal.gui.twilight_time+":");
  741. $("#time_B_string").html(set_time_string(time_B));
  742. $("#kala_judge").html("【"+gLocal.gui.vikala+"】");
  743. $("#kala_inst_1").html(gLocal.gui.no_string+gLocal.gui.eat);
  744. $("#kala_inst_2").html(gLocal.gui.need_inform+gLocal.gui.no_string+gLocal.gui.gama_entry);
  745. }
  746. else if(g_Unix_now>=Unix_Array[0] && g_Unix_now<Unix_Array[1]){
  747. time_A.setTime(Unix_Array[0])
  748. time_B.setTime(Unix_Array[1])
  749. $("#time_A_string_X").html(gLocal.gui.twilight_time+":");
  750. $("#time_A_string").html(set_time_string(time_A));
  751. $("#time_B_string_X").html(gLocal.gui.noon_time+":");
  752. $("#time_B_string").html(set_time_string(time_B));
  753. $("#kala_judge").html("【"+gLocal.gui.kala+"】");
  754. $("#kala_inst_1").html(gLocal.gui.yes_string+gLocal.gui.eat);
  755. $("#kala_inst_2").html(gLocal.gui.need_inform+gLocal.gui.yes_string+gLocal.gui.gama_entry);
  756. }
  757. else if(g_Unix_now>=Unix_Array[1] && g_Unix_now<Unix_Array[2]){
  758. time_A.setTime(Unix_Array[1])
  759. time_B.setTime(Unix_Array[2])
  760. $("#time_A_string_X").html(gLocal.gui.noon_time+":");
  761. $("#time_A_string").html(set_time_string(time_A));
  762. $("#time_B_string_X").html(gLocal.gui.twilight_time+":");
  763. $("#time_B_string").html(set_time_string(time_B));
  764. $("#kala_judge").html("【"+gLocal.gui.vikala+"】");
  765. $("#kala_inst_1").html(gLocal.gui.no_string+gLocal.gui.eat);
  766. $("#kala_inst_2").html(gLocal.gui.need_inform+gLocal.gui.no_string+gLocal.gui.gama_entry);
  767. }
  768. t=setTimeout('dwan_noon_display()',1000)
  769. }
  770. function set_time_string(date_obj){
  771. var hh=date_obj.getHours()
  772. var mm=date_obj.getMinutes()
  773. var ss=date_obj.getSeconds()
  774. // add a zero in front of numbers<10
  775. hh=checkTime(hh)
  776. mm=checkTime(mm)
  777. ss=checkTime(ss)
  778. return(hh+":"+mm+":"+ss)
  779. }
  780. function menuLangrage(obj,year,month){
  781. g_langrage=obj.value;
  782. setCookie('language',g_langrage,365);
  783. window.location.assign("index.php?language="+g_langrage+"&y="+year+"&m="+month);
  784. }
  785. set_uposatha_day();
  786. set_cur_day_era();
  787. function set_cur_day_era(){
  788. if(document.getElementById('cur_day_string')!=null){
  789. var cur_day_string=document.getElementById('cur_day_string').innerHTML;
  790. var cur_date=cur_day_string.split("-")[0];
  791. var cur_years_diff_total=cur_day_string.split("-")[1];
  792. var cur_days_diff=cur_day_string.split("-")[2];
  793. var cur_week_day=cur_day_string.split("-")[3];
  794. var currLanguage=cur_day_string.split("-")[4];
  795. pali_date(cur_date,cur_years_diff_total,cur_days_diff,cur_week_day,currLanguage,g_coordinate_this);
  796. }
  797. }
  798. function set_uposatha_day(){
  799. var key_num=document.getElementById('key_num_string').innerHTML;
  800. var total_days=key_num.split("-")[0];
  801. var month_days=key_num.split("-")[1];
  802. var year=key_num.split("-")[2];
  803. for(i_uposatha=1;i_uposatha<=month_days;i_uposatha++){
  804. var pres_obj=pali_date_num(year,total_days-month_days+i_uposatha)[1];
  805. var uposatha_obj=uposatha_calculator(pres_obj.month,pres_obj.day);
  806. var day_id="td_"+i_uposatha;
  807. if(uposatha_obj.uposatha && uposatha_obj.pakkha=="kāla"){
  808. //document.getElementById(day_id).innerHTML+="<svg class='icon'><use xlink:href='svg/icon.svg#new_moon'></use></svg>";
  809. document.getElementById(day_id).innerHTML="<div class='new_moon_uposatha' >"+i_uposatha+"</div>";
  810. }
  811. else if(uposatha_obj.uposatha && uposatha_obj.pakkha=="sukka"){
  812. //document.getElementById(day_id).innerHTML+="<svg class='icon'><use xlink:href='svg/icon.svg#full_moon'></use></svg>";
  813. document.getElementById(day_id).innerHTML="<div class='full_moon_uposatha' >"+i_uposatha+"</div>";
  814. }
  815. }
  816. }
  817. function pali_date_num(year,days){
  818. var date_num_array=new Array;
  819. var past_obj=new Object;
  820. var pres_obj=new Object;
  821. var left_obj=new Object;
  822. past_obj.year=Number(year);
  823. pres_obj.year=Number(year)+1;
  824. left_obj.year=5000-Number(year)-1;
  825. if(days%59<=30 && days%59!=0){//奇數月
  826. past_obj.month=Math.floor(days/59)*2;
  827. pres_obj.month=past_obj.month+1
  828. past_obj.day=days%59-1;
  829. pres_obj.day=days%59;
  830. pres_obj.month_length=30;
  831. if(pres_obj.month>=13){
  832. pres_obj.month=pres_obj.month%12;
  833. past_obj.month=pres_obj.month-1;
  834. past_obj.year=past_obj.year+Math.floor(pres_obj.month/12);
  835. pres_obj.year=past_obj.year+1;
  836. }
  837. }
  838. else if(days%59>30){//偶數月
  839. past_obj.month=Math.floor(days/59)*2+1;
  840. pres_obj.month=past_obj.month+1
  841. past_obj.day=days%59-30-1;
  842. pres_obj.day=past_obj.day+1
  843. pres_obj.month_length=29;
  844. }
  845. else if(days%59==0){//偶數月最後一天
  846. past_obj.month=days/59*2-1;
  847. pres_obj.month=past_obj.month+1
  848. past_obj.day=28;
  849. pres_obj.day=29;
  850. pres_obj.month_length=29;
  851. }
  852. left_obj.month=12-past_obj.month-1;
  853. left_obj.day=pres_obj.month_length-past_obj.day-1;
  854. date_num_array.push(past_obj,pres_obj,left_obj);
  855. return(date_num_array);
  856. }
  857. function get_coordinate_num(id_key){
  858. var LT=Number($("#LT_"+id_key+"_°")[0].value);
  859. LT+=Number($("#LT_"+id_key+"_’")[0].value)/60;
  860. LT+=Number($("#LT_"+id_key+"_”")[0].value)/3600;
  861. LT=Number($("#"+id_key+"_WE")[0].value+LT);
  862. var AT=Number($("#AT_"+id_key+"_°")[0].value);
  863. AT+=Number($("#AT_"+id_key+"_’")[0].value)/60;
  864. AT+=Number($("#AT_"+id_key+"_”")[0].value)/3600;
  865. AT=Number($("#"+id_key+"_NS")[0].value+AT);
  866. var coordinate_obj=new Object;
  867. coordinate_obj.LT=LT;
  868. coordinate_obj.AT=AT;
  869. return(coordinate_obj);
  870. }
  871. function pali_date(id,m_days,year,days,week_day,currLanguage,position){
  872. //改參數
  873. $('#cur_day_string').html(id+"-"+m_days+"-"+year+"-"+days+"-"+week_day+"-"+currLanguage);
  874. var coordinate=new Object;
  875. coordinate=g_coordinate_this;
  876. //var month=$("#sun_AT")[0].innerText.split('-')[0];
  877. var day_selected=$("#sun_AT")[0].innerText.split('-')[1];
  878. //選定日期
  879. var date_select=$("#key_num_string")[0].innerText.split('-')[2]+"-";
  880. date_select+=$("#key_num_string")[0].innerText.split('-')[3]+"-";
  881. date_select+=id;
  882. var year_str=$("#key_num_string")[0].innerText.split('-')[2];
  883. var month_str=$("#key_num_string")[0].innerText.split('-')[3];
  884. //var date_select=$("#date_picker")[0].value;
  885. $("#time_string").load("calendar_data.php?atitude="+coordinate.AT+"&longitude="+coordinate.LT+"&date="+date_select);
  886. //改變日曆中選中日的樣式
  887. for(var i_date=1;i_date<=m_days;i_date++){
  888. $("#td_"+i_date)[0].style="";
  889. }
  890. $("#td_"+id)[0].style="background:purple;";
  891. //佛曆數據解析
  892. var date_num_array=pali_date_num(year,days);
  893. var past=date_num_array[0];
  894. var pres=date_num_array[1];
  895. var left=date_num_array[2];
  896. //生成佛曆圖表外殻
  897. var pres_date_string ="<span>"+gLocal.gui.BE+"</span>";
  898. pres_date_string+="<span style='font-size: 200%;'>";
  899. pres_date_string+=pres.year+gLocal.gui.year_1;
  900. pres_date_string+=pres.month+gLocal.gui.month_1;
  901. pres_date_string+=pres.day+gLocal.gui.day+"</span>";
  902. pres_date_string+="<span id='BE_icon'></span>";
  903. $("#pali_era_graph").html(pres_date_string);
  904. //生成佛曆巴利外殻
  905. var past_date_string_pali ="<span id='past_string'></span>";
  906. var pres_date_string_pali ="<span id='pres_string'></span>";
  907. var left_date_string_pali ="<span id='left_string'></span>";
  908. var output_string_pali = past_date_string_pali+left_date_string_pali+pres_date_string_pali;
  909. $("#pali_era_pali").html(output_string_pali);
  910. //寫入佛曆圖表數據
  911. var pres_language_string_0= "";
  912. pres_language_string_0+=get_year_name(pres.year).string_0;
  913. pres_language_string_0+=get_month_name(pres.month,pres.day).string_0;
  914. pres_language_string_0+=get_week_day_name(week_day).string_0;
  915. var past_date_string ="<div>"+gLocal.gui.dhamma_time+"</div>"
  916. past_date_string+="<div><span class='BE_icon_span'>"+gLocal.gui.past+":</span>";
  917. past_date_string+=past.year+gLocal.gui.years;
  918. if(past.month!=0){
  919. past_date_string+=past.month+gLocal.gui.months;
  920. }
  921. if(!(past.month==0 && past.day==0)){
  922. past_date_string+=gLocal.gui.and_another;
  923. }
  924. if(past.day!=0){
  925. past_date_string+=past.day+gLocal.gui.days;
  926. }
  927. past_date_string+="</div>";
  928. var left_date_string= "<div><span class='BE_icon_span'>"+gLocal.gui.left+":</span>";
  929. left_date_string+=left.year+gLocal.gui.years;
  930. if(left.month!=0){
  931. left_date_string+=left.month+gLocal.gui.months;
  932. }
  933. if(!(left.month==0 && left.day==0)){
  934. left_date_string+=gLocal.gui.and_another;
  935. }
  936. if(left.day!=0){
  937. left_date_string+=left.day+gLocal.gui.days;
  938. }
  939. left_date_string+="</div>";
  940. $('#BE_icon').html(pres_language_string_0+"<br>"+past_date_string+left_date_string);
  941. //解析佛曆數據為文字
  942. var past_language_string="";
  943. var pres_language_string="";
  944. var left_language_string="";
  945. var pali_begin="idāni kho pana ";
  946. var pali_past_end=" atikkantāni.";
  947. var pali_left_end=" avasiṭṭhāni.";
  948. if(past.day==1 && past.month!=0){
  949. past_language_string+=pali_begin;
  950. past_language_string+=get_year_pali_string(past.year)+"ceva, ";
  951. past_language_string+=get_day_pali_string(past.day).pre;
  952. past_language_string+=get_month_pali_string(past.month).suff
  953. past_language_string+=pali_past_end;
  954. }
  955. else if(past.day==1 && past.month==0){
  956. past_language_string+=pali_begin;
  957. past_language_string+=get_day_pali_string(past.day).pre;
  958. past_language_string+=get_year_pali_string(past.year);
  959. past_language_string+=get_month_pali_string(past.month).suff
  960. past_language_string+=pali_past_end;
  961. }
  962. else if(past.day==0 && past.month==1){
  963. past_language_string+=pali_begin;
  964. past_language_string+=get_day_pali_string(past.month).pre;
  965. past_language_string+=get_year_pali_string(past.year)+"ceva, "
  966. past_language_string+=get_month_pali_string(past.day).suff
  967. past_language_string+=pali_past_end;
  968. }
  969. else if(past.day==0 && past.month>1){
  970. past_language_string+=pali_begin;
  971. past_language_string+=get_year_pali_string(past.year)
  972. past_language_string+=get_month_pali_string(past.month).suff;
  973. past_language_string+=get_day_pali_string(past.day).suff;
  974. past_language_string+=pali_past_end;
  975. }
  976. else{
  977. past_language_string+=pali_begin;
  978. past_language_string+=get_year_pali_string(past.year)
  979. past_language_string+=get_month_pali_string(past.month).suff+"ca, ";
  980. past_language_string+=get_day_pali_string(past.day).suff;
  981. past_language_string+=pali_past_end;
  982. }
  983. if(left.day==1 && left.month!=0){
  984. left_language_string+=get_year_pali_string(left.year)+"ceva, ";
  985. left_language_string+=get_day_pali_string(left.day).pre;
  986. left_language_string+=get_month_pali_string(left.month).suff;
  987. left_language_string+=pali_left_end;
  988. }
  989. else if(left.day==1 && left.month==0){
  990. left_language_string+=get_day_pali_string(left.day).pre;
  991. left_language_string+=get_year_pali_string(left.year);
  992. left_language_string+=get_month_pali_string(left.month).suff
  993. left_language_string+=pali_left_end;
  994. }
  995. else if(left.day==0 && left.month==1){
  996. left_language_string+=get_day_pali_string(left.month).pre;
  997. left_language_string+=get_year_pali_string(left.year)+"ceva, ";
  998. left_language_string+=get_month_pali_string(left.day).suff
  999. left_language_string+=pali_left_end;
  1000. }
  1001. else if(left.day==0 && left.month>1){
  1002. left_language_string+=get_year_pali_string(left.year);
  1003. left_language_string+=get_month_pali_string(left.month).suff;
  1004. left_language_string+=get_day_pali_string(left.day).suff;
  1005. left_language_string+=pali_left_end;
  1006. }
  1007. else{
  1008. left_language_string+=get_year_pali_string(left.year);
  1009. left_language_string+=get_month_pali_string(left.month).suff+"ca, ";
  1010. left_language_string+=get_day_pali_string(left.day).suff;
  1011. left_language_string+=pali_left_end;
  1012. }
  1013. pres_language_string+=get_year_name(pres.year).string_1;
  1014. pres_language_string+=get_month_name(pres.month,pres.day).string_1;
  1015. pres_language_string+=get_week_day_name(week_day).string_1;
  1016. switch(currLanguage){
  1017. case "si":
  1018. for(i_sinhala in char_unicode_to_si_n){
  1019. eval("past_language_string=past_language_string.replace(/"+char_unicode_to_si_n[i_sinhala].id+"/g,char_unicode_to_si_n[i_sinhala].value);");
  1020. eval("pres_language_string=pres_language_string.replace(/"+char_unicode_to_si_n[i_sinhala].id+"/g,char_unicode_to_si_n[i_sinhala].value);");
  1021. eval("left_language_string=left_language_string.replace(/"+char_unicode_to_si_n[i_sinhala].id+"/g,char_unicode_to_si_n[i_sinhala].value);");
  1022. }
  1023. break;
  1024. case "my":
  1025. for(r_to_m_i in char_roman_to_myn){
  1026. eval("past_language_string=past_language_string.replace(/"+char_roman_to_myn[r_to_m_i].id+"/g,char_roman_to_myn[r_to_m_i].value);");
  1027. eval("pres_language_string=pres_language_string.replace(/"+char_roman_to_myn[r_to_m_i].id+"/g,char_roman_to_myn[r_to_m_i].value);");
  1028. eval("left_language_string=left_language_string.replace(/"+char_roman_to_myn[r_to_m_i].id+"/g,char_roman_to_myn[r_to_m_i].value);");
  1029. }
  1030. break;
  1031. default:
  1032. past_language_string=past_language_string.charAt(0).toUpperCase()+past_language_string.slice(1);
  1033. left_language_string=left_language_string.charAt(0).toUpperCase()+left_language_string.slice(1);
  1034. //pres_language_string=pres_language_string;
  1035. var new_string=pres_language_string.charAt(0).toUpperCase();
  1036. new_string+=pres_language_string.split('\. ')[0].slice(1)+". ";
  1037. new_string+=pres_language_string.split('\. ')[1].charAt(0).toUpperCase();
  1038. new_string+=pres_language_string.split('\. ')[1].slice(1);
  1039. pres_language_string=new_string;
  1040. }
  1041. $('#past_string').html(past_language_string);
  1042. $('#pres_string').html(pres_language_string);
  1043. $('#left_string').html(left_language_string);
  1044. }
  1045. function get_year_pali_string(year){
  1046. if(year>999){
  1047. year=year.toString()
  1048. Tp=year.charAt(0)*1000;
  1049. Hp=year.charAt(1)*100;
  1050. Sp=year.slice(2,4);
  1051. }
  1052. for(i_year in pali_num_str){
  1053. if(Tp==pali_num_str[i_year].id){
  1054. var Tp_string=pali_num_str[i_year].value;
  1055. }
  1056. if(Hp==pali_num_str[i_year].id){
  1057. var Hp_string=pali_num_str[i_year].value;
  1058. }
  1059. if(Sp==pali_num_str[i_year].id){
  1060. var Sp_string=pali_num_str[i_year].value;
  1061. }
  1062. }
  1063. if(year==1){
  1064. var year_pali_end=" saṃvaccharaṃ ceva, ";
  1065. }
  1066. else{
  1067. var year_pali_end=" saṃvaccharāni ";
  1068. }
  1069. var year_string=Tp_string+"-"+Hp_string+"-"+Sp_string+year_pali_end;
  1070. return(year_string);
  1071. }
  1072. function get_month_pali_string(month){
  1073. var month_obj=new Object;
  1074. if(month>=2){
  1075. month=month.toString();
  1076. for(i_month in pali_num_str_pl){
  1077. if(month==pali_num_str_pl[i_month].id){
  1078. var month_num_string=pali_num_str_pl[i_month].value;
  1079. }
  1080. }
  1081. month_obj.suff=month_num_string+" māsāni "
  1082. month_obj.pre="";
  1083. }
  1084. else if(month==1){
  1085. month_obj.suff="dve-pakkhāni";
  1086. month_obj.pre="eka-māsādhika-";
  1087. }
  1088. else if(month==0){
  1089. month_obj.suff="";
  1090. month_obj.pre="";
  1091. }
  1092. return(month_obj);
  1093. }
  1094. function get_day_pali_string(day){
  1095. var day_obj=new Object;
  1096. if(day>=2){
  1097. day=day.toString();
  1098. for(i_day in pali_num_str_pl){
  1099. if(day==pali_num_str_pl[i_day].id){
  1100. var day_num_string=pali_num_str_pl[i_day].value;
  1101. }
  1102. }
  1103. day_obj.suff=day_num_string+" divasāni "
  1104. day_obj.pre="";
  1105. }
  1106. else if(day==1){
  1107. day_obj.suff="";
  1108. day_obj.pre="eka-divasādhika-";
  1109. }
  1110. else if(day==0){
  1111. day_obj.suff="";
  1112. day_obj.pre="";
  1113. }
  1114. return(day_obj);
  1115. }
  1116. function get_year_name(year){
  1117. var year_num=year%12;
  1118. var year_name_string=new Object;
  1119. for(i_year_name in pali_year_name){
  1120. if(year_num==pali_year_name[i_year_name].id){
  1121. year_name_string.value=pali_year_name[i_year_name].value;
  1122. year_name_string.icon=pali_year_name[i_year_name].icon;
  1123. }
  1124. }
  1125. year_name_string.string_0 ="<div><span class='BE_icon_span'>"+gLocal.gui.year_0+"</span>";
  1126. year_name_string.string_0+=year_name_string.icon+"</div>";
  1127. year_name_string.string_1="ayaṃ "+year_name_string.value+"-saṃvacchare ";
  1128. return(year_name_string);
  1129. }
  1130. function uposatha_calculator(month,day){
  1131. var day_obj=new Object;
  1132. if(month%2==1){
  1133. var days_per_month=30;
  1134. }
  1135. else{
  1136. var days_per_month=29;
  1137. }
  1138. if(days_per_month==30){
  1139. if(day<=15){
  1140. day_obj.day=day;
  1141. day_obj.pakkha="kāla";
  1142. day_obj.pakkha_icon="🌖→🌑";
  1143. if(day==15){
  1144. day_obj.uposatha=true;
  1145. }
  1146. else{
  1147. day_obj.uposatha=false;
  1148. }
  1149. }
  1150. else{
  1151. day_obj.day=day-15;
  1152. day_obj.pakkha="sukka";//🌕🌗🌗🌒🌓🌔🌝🌚🌞🌜🌛
  1153. day_obj.pakkha_icon="🌒→🌕";
  1154. if(day==30){
  1155. day_obj.uposatha=true;
  1156. }
  1157. else{
  1158. day_obj.uposatha=false;
  1159. }
  1160. }
  1161. }
  1162. else if(days_per_month==29){
  1163. if(day<=14){
  1164. day_obj.day=day;
  1165. day_obj.pakkha="kāla";
  1166. day_obj.pakkha_icon="🌖→🌑";
  1167. if(day==14){
  1168. day_obj.uposatha=true;
  1169. }
  1170. else{
  1171. day_obj.uposatha=false;
  1172. }
  1173. }
  1174. else{
  1175. day_obj.day=day-14;
  1176. day_obj.pakkha="sukka";
  1177. day_obj.pakkha_icon="🌒→🌕";
  1178. if(day==29){
  1179. day_obj.uposatha=true;
  1180. }
  1181. else{
  1182. day_obj.uposatha=false;
  1183. }
  1184. }
  1185. }
  1186. return(day_obj);
  1187. }
  1188. function get_month_name(month,day){
  1189. var return_string=new Object;
  1190. for(i_month_name in pali_month_name){
  1191. if(month==pali_month_name[i_month_name].id){
  1192. var month_name_string=pali_month_name[i_month_name].value;
  1193. var season_name_string=pali_month_name[i_month_name].season;
  1194. var season_icon_string=pali_month_name[i_month_name].season_icon;
  1195. }
  1196. }
  1197. return_string.string_0 ="<div><span class='BE_icon_span'>"+gLocal.gui.season+"</span>";
  1198. return_string.string_0+=season_icon_string+"</div>";
  1199. return_string.string_0+="<div><span class='BE_icon_span'>"+gLocal.gui.month+"</span>";
  1200. return_string.string_0+=month_name_string+"</div>";
  1201. return_string.string_1=season_name_string+"-utu. "
  1202. return_string.string_1+="asmiṃ utumhi "+month_name_string+"-māsassa ";
  1203. var day_object=uposatha_calculator(month,day);
  1204. for(i_day_name in pali_date_name){
  1205. if(day_object.day==pali_date_name[i_day_name].id){
  1206. day_name_string=pali_date_name[i_day_name].value;
  1207. var day_num_string=day_object.day
  1208. }
  1209. }
  1210. var pakkha_name_string=day_object.pakkha+"-pakkhe "+day_name_string;
  1211. return_string.string_0+="<div><span class='BE_icon_span'>"+gLocal.gui.pakkha+"</span>";
  1212. return_string.string_0+=day_object.pakkha_icon+"</div>";
  1213. return_string.string_0+="<div><span class='BE_icon_span'>"+gLocal.gui.date+"</span>";
  1214. return_string.string_0+=day_num_string+"</div>";
  1215. return_string.string_1+=pakkha_name_string+", ";
  1216. return(return_string);
  1217. }
  1218. function get_week_day_name(week_day){
  1219. var week_day_string=new Object;
  1220. for(i_week in pali_week_day_name){
  1221. if(week_day==pali_week_day_name[i_week].id){
  1222. week_day_string.string_0=pali_week_day_name[i_week].value
  1223. week_day_string.string_1=pali_week_day_name[i_week].value
  1224. }
  1225. }
  1226. week_day_string.string_0="<div><span class='BE_icon_span'>"+gLocal.gui.week_day+"</span>"+week_day_string.string_0+"</div>";
  1227. week_day_string.string_1+="-varamidan’ti daṭṭhabbaṃ."
  1228. return(week_day_string);
  1229. }
  1230. function set_display(hide_id,show_id){
  1231. $("#"+show_id).show();
  1232. $("#"+hide_id).hide();
  1233. }
  1234. function confirm_position(hide_id,show_id,position){
  1235. $("#"+show_id).show();
  1236. $("#"+hide_id).hide();
  1237. var LT_str="";
  1238. if($("#LT_"+position+"_°")[0].value!=0){
  1239. LT_str+=$("#LT_"+position+"_°")[0].value+"°";
  1240. }
  1241. if($("#LT_"+position+"_’")[0].value!=0){
  1242. LT_str+=$("#LT_"+position+"_’")[0].value+"’";
  1243. }
  1244. if($("#LT_"+position+"_”")[0].value!=0){
  1245. LT_str+=$("#LT_"+position+"_”")[0].value+"”";
  1246. }
  1247. if(LT_str!=""){
  1248. if($("#"+position+"_WE")[0].value=="+"){
  1249. LT_str+="E";
  1250. }
  1251. else{
  1252. LT_str+="W";
  1253. }
  1254. }
  1255. var AT_str="";
  1256. if($("#AT_"+position+"_°")[0].value!=0){
  1257. AT_str+=$("#AT_"+position+"_°")[0].value+"°";
  1258. }
  1259. if($("#AT_"+position+"_’")[0].value!=0){
  1260. AT_str+=$("#AT_"+position+"_’")[0].value+"’";
  1261. }
  1262. if($("#AT_"+position+"_”")[0].value!=0){
  1263. AT_str+=$("#AT_"+position+"_”")[0].value+"”";
  1264. }
  1265. if(AT_str!=""){
  1266. if($("#"+position+"_NS")[0].value=="+"){
  1267. AT_str+="N";
  1268. }
  1269. else{
  1270. AT_str+="S";
  1271. }
  1272. }
  1273. $("#"+position+"_position_string").html(LT_str+" "+AT_str);
  1274. }
  1275. function getLocation(){//自动定位
  1276. if(navigator.geolocation){
  1277. navigator.geolocation.getCurrentPosition(showPosition,showError);
  1278. }
  1279. else{
  1280. $("#selected_position_string").html("Geolocation is not supported by this browser.");
  1281. }
  1282. }
  1283. function showPosition(position){
  1284. alert("get cordinate success");
  1285. g_coordinate_this.AT=position.coords.latitude;
  1286. g_coordinate_this.LT=position.coords.longitude;
  1287. if(g_coordinate_this.AT>=0){
  1288. var AT_string=angle_trans(g_coordinate_this.AT)+"N";
  1289. }
  1290. else{
  1291. var AT_string=angle_trans(g_coordinate_this.AT)+"S";
  1292. }
  1293. if(g_coordinate_this.LT>=0){
  1294. var LT_string=angle_trans(g_coordinate_this.LT)+"E";
  1295. }
  1296. else{
  1297. var LT_string=angle_trans(g_coordinate_this.LT)+"W";
  1298. }
  1299. $("#selected_position_string").html(AT_string+" "+LT_string);
  1300. }
  1301. function showError(error){
  1302. switch(error.code) {
  1303. case error.PERMISSION_DENIED:
  1304. alert("定位失败,用户拒绝请求地理定位");
  1305. break;
  1306. case error.POSITION_UNAVAILABLE:
  1307. alert("定位失败,位置信息是不可用");
  1308. break;
  1309. case error.TIMEOUT:
  1310. alert("定位失败,请求获取用户位置超时");
  1311. break;
  1312. case error.UNKNOWN_ERROR:
  1313. alert("定位失败,定位系统失效");
  1314. break;
  1315. }
  1316. }
  1317. function confirm(){
  1318. confirm_position("position_input","position_change","selected")
  1319. var select_day_string=new Array();
  1320. select_day_string=$('#cur_day_string')[0].innerText.split('-');
  1321. pali_date(select_day_string[0],select_day_string[1],select_day_string[2],select_day_string[3],select_day_string[4],select_day_string[5],g_coordinate_this)
  1322. }
  1323. dwan_noon_display();
  1324. function air_confirm(place){
  1325. confirm_position(place+"_position_input",place+"_position_result",place);
  1326. var coordinate= get_coordinate_num(place);
  1327. var air_date=$("#"+place+"_date")[0].value;
  1328. var air_time=$("#"+place+"_time")[0].value;
  1329. $("#"+place+"_position_string")[0].innerText+=" "+air_date+" "+air_time;
  1330. $("#air_time_string").load("calendar_data.php?atitude="+coordinate.AT+"&longitude="+coordinate.LT+"&date="+air_date);
  1331. var air_noon_time=new Date();
  1332. air_noon_time.setTime($("#air_time_string")[0].innerText.split('-')[1]);
  1333. $("#"+place+"_position_string")[0].innerText+=gLocal.gui.noon_time+set_time_string(air_noon_time);
  1334. }
  1335. function computeSunRiseSunSet(Latitude, Longitude, TimeZone) {
  1336. var curTime = new Date();
  1337. // Variable names used: B5, C, C2, C3, CD, D, DR, H, HR, HS, L0, L5, M, MR, MS, N, PI, R1, RD, S1, SC, SD, str
  1338. var retVal = new Object();
  1339. var PI = Math.PI;
  1340. var DR = PI / 180;
  1341. var RD = 1 / DR;
  1342. var B5 = Latitude;
  1343. var L5 = Longitude;
  1344. var H = -1 * (curTime.getTimezoneOffset() / 60 * -1); // Local timezone
  1345. // Overriding TimeZone to standardize on UTC
  1346. // H = 0;
  1347. var M = curTime.getMonth() + 1;
  1348. var D = curTime.getDate();
  1349. B5 = DR * B5;
  1350. var N = parseInt(275 * M / 9) - 2 * parseInt((M + 9) / 12) + D - 30;
  1351. var L0 = 4.8771 + .0172 * (N + .5 - L5 / 360);
  1352. var C = .03342 * Math.sin(L0 + 1.345);
  1353. var C2 = RD * (Math.atan(Math.tan(L0 + C)) - Math.atan(.9175 * Math.tan(L0 + C)) - C);
  1354. var SD = .3978 * Math.sin(L0 + C);
  1355. var CD = Math.sqrt(1 - SD * SD);
  1356. var SC = (SD * Math.sin(B5) + .0145) / (Math.cos(B5) * CD);
  1357. if (Math.abs(SC) <= 1) {
  1358. var C3 = RD * Math.atan(SC / Math.sqrt(1 - SC * SC));
  1359. var R1 = 6 - H - (L5 + C2 + C3) / 15;
  1360. var HR = parseInt(R1);
  1361. var MR = parseInt((R1 - HR) * 60);
  1362. retVal.SunRise = parseTime(HR + ":" + MR);
  1363. var TargetTimezoneOffset = (TimeZone * 60 * 60 * 1000) + (retVal.SunRise.getTimezoneOffset() * 60 * 1000);
  1364. var transformedSunRise = new Date(retVal.SunRise.getTime() + TargetTimezoneOffset);
  1365. var strSunRise = "日出" + transformedSunRise.getHours() + ":" + (transformedSunRise.getMinutes() < 10 ? "0" + transformedSunRise.getMinutes() : transformedSunRise.getMinutes());
  1366. var S1 = 18 - H - (L5 + C2 - C3) / 15;
  1367. var HS = parseInt(S1);
  1368. var MS = parseInt((S1 - HS) * 60);
  1369. retVal.SunSet = parseTime(HS + ":" + MS);
  1370. var transformedSunSet = new Date(retVal.SunSet.getTime() + TargetTimezoneOffset);
  1371. var strSunSet = "日落" + transformedSunSet.getHours() + ":" + (transformedSunSet.getMinutes() < 10 ? "0" + transformedSunSet.getMinutes() : transformedSunSet.getMinutes());
  1372. retVal.Noon = new Date((retVal.SunRise.getTime() + retVal.SunSet.getTime()) / 2);
  1373. var transformedNoon = new Date(retVal.Noon.getTime() + TargetTimezoneOffset);
  1374. var strNoon = "正午" + transformedNoon.getHours() + ":" + (transformedNoon.getMinutes() < 10 ? "0" + transformedNoon.getMinutes() : transformedNoon.getMinutes());
  1375. }
  1376. else {
  1377. if (SC > 1) {
  1378. // str="Sun up all day";
  1379. strSunRise = ".";
  1380. strNoon = ".";
  1381. strSunSet = ".";
  1382. var tDate = new Date();
  1383. // Set Sunset to be in the future ...
  1384. retVal.SunSet = new Date(tDate.getFullYear() + 1, tDate.getMonth(), tDate.getDay(), tDate.getHours());
  1385. // Set Sunrise to be in the past ...
  1386. retVal.SunRise = new Date(tDate.getFullYear() - 1, tDate.getMonth(), tDate.getDay(), tDate.getHours() - 1);
  1387. }
  1388. if (SC < -1) {
  1389. // str="Sun down all day";
  1390. strSunRise = ".";
  1391. strNoon = ".";
  1392. strSunSet = ".";
  1393. // Set Sunrise and Sunset to be in the future ...
  1394. retVal.SunRise = new Date(tDate.getFullYear() + 1, tDate.getMonth(), tDate.getDay(), tDate.getHours());
  1395. retVal.SunSet = new Date(tDate.getFullYear() + 1, tDate.getMonth(), tDate.getDay(), tDate.getHours());
  1396. }
  1397. }
  1398. retVal.strSunRise = strSunRise;
  1399. retVal.strNoon = strNoon;
  1400. retVal.strSunSet = strSunSet;
  1401. retVal.str = strSunRise + ' | ' + strNoon + ' | ' + strSunSet;
  1402. return retVal;
  1403. }
  1404. ////////////////////////////////////////////////////////////////////////////////
  1405. //
  1406. // parseTime(string aTime) - takes a string of time in the format HH:MM:SS
  1407. // and returns Javascript Date Object
  1408. //
  1409. ////////////////////////////////////////////////////////////////////////////////
  1410. function parseTime(aTime) {
  1411. var aDateTimeObject = 'none';
  1412. if (aTime !== undefined && aTime.length) {
  1413. aDateTimeObject = GMTTime();
  1414. try {
  1415. var theHour = parseInt(aTime.split(':')[0]);
  1416. var theMinutes = parseInt(aTime.split(':')[1]);
  1417. aDateTimeObject.setHours(theHour);
  1418. aDateTimeObject.setMinutes(theMinutes);
  1419. }
  1420. catch (ex) {
  1421. }
  1422. }
  1423. return aDateTimeObject;
  1424. }
  1425. ////////////////////////////////////////////////////////////////////////////////
  1426. //
  1427. // GMTTime() - returns time adjusted to GMT (Universal Time)
  1428. //
  1429. ////////////////////////////////////////////////////////////////////////////////
  1430. function GMTTime() {
  1431. var aDate = new Date();
  1432. var aDateAdjustedToGMTInMS = aDate.getTime() + (aDate.getTimezoneOffset() * 60 * 1000);
  1433. return (new Date(aDateAdjustedToGMTInMS));
  1434. }
  1435. </script>