index.html 36 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8" />
  5. <link href="../lib/main.css" rel="stylesheet" />
  6. <script src="../public/js/jquery.js"></script>
  7. <script src="../public/js/comm.js"></script>
  8. <script src="jquery-3.3.1.min.js"></script>
  9. <script src="julian.js"></script>
  10. <script src="lune.js"></script>
  11. <script src="suncalc.js"></script>
  12. <script src="./planet_position/js/planet-positions.js"></script>
  13. <script src="../studio/js/fixedsticky.js"></script>
  14. <script src="../guide/guide.js"></script>
  15. <link type="text/css" rel="stylesheet" href="../guide/guide.css" />
  16. <script src="../public/js/marked.js"></script>
  17. <!--获取语言-->
  18. <script>
  19. var g_language = getCookie("language");
  20. </script>
  21. <script>
  22. var localString = new Array();
  23. localString["zh-cn"] = {
  24. and_another: "又 ",
  25. atitude: "纬度",
  26. BE: "佛历",
  27. bhumma: "周二",
  28. budha: "周三",
  29. canda: "周一",
  30. confirm: "确认",
  31. date: "日期",
  32. day: "日",
  33. days: "天 ",
  34. departure_in_detail: "起飞详情",
  35. dhamma_time: "会延续五千年的教法 ",
  36. eat: "进餐",
  37. gama_entry: "入村",
  38. guru: "周四",
  39. hori_ref_time: "蒙气差修正 ",
  40. kala: "适当的时间",
  41. language_select: "选择语言",
  42. left: "还剩下",
  43. loading: "载入中……",
  44. longitude: "经度",
  45. māsa: "月",
  46. mins: "分钟",
  47. month: "月 ",
  48. month_1: "月 ",
  49. months: "个月 ",
  50. my_loc: "我的位置",
  51. need_inform: "未告知其他比库",
  52. no_string: "不能",
  53. noon_time: "正午",
  54. noon_time: "正午",
  55. note: "注释",
  56. now_time: "现在",
  57. pacchā_māsa: "下个月",
  58. pakkha: "月相变化 ",
  59. past: "已过去",
  60. pubba_māsa: "上个月",
  61. ravi: "周日",
  62. saṃvacchara: "年",
  63. season: "季节 ",
  64. sec: "秒",
  65. sora: "周六",
  66. sukka: "周五",
  67. sun_height_degree: "正午太阳高度 ",
  68. time: "时间",
  69. twilight_time: "曙光",
  70. twilight_time: "曙光",
  71. vikala: "不适当的时间",
  72. week_day: "星期",
  73. year_0: "年",
  74. year_1: "年 ",
  75. years: "年 ",
  76. yes_string: "可以",
  77. timezone: "时区",
  78. local: "本地",
  79. loading: "载入中",
  80. sun_set: "日落",
  81. unknown: "未知",
  82. altitude: "海拔",
  83. today: "今天",
  84. week: "周",
  85. list: "列表",
  86. };
  87. localString["zh-tw"] = {
  88. and_another: "又 ",
  89. atitude: "緯度",
  90. BE: "佛曆",
  91. bhumma: "週二",
  92. budha: "週三",
  93. canda: "週一",
  94. confirm: "確認",
  95. date: "日期",
  96. day: "日",
  97. days: "天 ",
  98. departure_in_detail: "起飛詳情",
  99. dhamma_time: "會延續五千年的教法 ",
  100. eat: "進餐",
  101. gama_entry: "入村",
  102. guru: "週四",
  103. hori_ref_time: "蒙氣差修正 ",
  104. kala: "適當的時間",
  105. language_select: "選擇語言",
  106. left: "還剩下",
  107. loading: "載入中……",
  108. longitude: "經度",
  109. māsa: "月",
  110. mins: "分鐘",
  111. month: "月 ",
  112. month_1: "月 ",
  113. months: "個月 ",
  114. my_loc: "我的位置",
  115. need_inform: "未告知其他比庫",
  116. no_string: "不能",
  117. noon_time: "正午",
  118. noon_time: "正午",
  119. note: "註釋",
  120. now_time: "現在",
  121. pacchā_māsa: "下個月",
  122. pakkha: "月相變化 ",
  123. past: "已過去",
  124. pubba_māsa: "上個月",
  125. ravi: "週日",
  126. saṃvacchara: "年",
  127. season: "季節 ",
  128. sec: "秒",
  129. sora: "週六",
  130. sukka: "週五",
  131. sun_height_degree: "正午太陽高度 ",
  132. time: "時間",
  133. twilight_time: "曙光",
  134. twilight_time: "曙光",
  135. vikala: "不適當的時間",
  136. week_day: "星期",
  137. year_0: "年",
  138. year_1: "年 ",
  139. years: "年 ",
  140. yes_string: "可以",
  141. timezone: "時區",
  142. local: "本地",
  143. loading: "載入中",
  144. sun_set: "日落",
  145. unknown: "未知",
  146. altitude: "海拔",
  147. today: "今天",
  148. week: "周",
  149. list: "列表",
  150. };
  151. localString["default"] = {
  152. and_another: " and ",
  153. atitude: "Atitude",
  154. BE: "Buddhist Era ",
  155. bhumma: "Bhumma",
  156. budha: "Budha",
  157. canda: "Canda",
  158. confirm: "Confirm",
  159. date: "Date ",
  160. day: " day(s) ",
  161. days: " day(s) ",
  162. departure_in_detail: "departure in detail",
  163. dhamma_time: "5000 Years of the Buddha’s Dispensation ",
  164. eat: "eat",
  165. gama_entry: "entry the village",
  166. guru: "Guru",
  167. hori_ref_time: "horizontal refraction correct ",
  168. kala: "suitable time",
  169. language_select: "bhāsā",
  170. left: "Remains ",
  171. loading: "loading…",
  172. longitude: "Longitude",
  173. māsa: "māsa",
  174. mins: "(min)",
  175. month: "Month ",
  176. month_1: "- ",
  177. months: " month(s) ",
  178. my_loc: "attasmiṃ",
  179. need_inform: "without informing other Bhikkhu ",
  180. no_string: "cannot ",
  181. noon_time: "NOON",
  182. noon_time: "NOON",
  183. note: "Note",
  184. now_time: "NOW",
  185. pacchā_māsa: "pacchā-māsa",
  186. pakkha: "Lunar Phases ",
  187. past: "Passed ",
  188. pubba_māsa: "pubba-māsa",
  189. ravi: "Ravi",
  190. saṃvacchara: "saṃvacchara",
  191. season: "Season ",
  192. sec: "sec ",
  193. sora: "Sora",
  194. sukka: "Sukka",
  195. sun_height_degree: "Max solar altitude ",
  196. time: "Time",
  197. twilight_time: "dawn",
  198. twilight_time: "dawn",
  199. vikala: "unsuitable time",
  200. week_day: "Day",
  201. year_0: "saṃvacchara",
  202. year_1: "- ",
  203. years: " year(s) ",
  204. yes_string: "can ",
  205. timezone: "Timezone",
  206. local: "local",
  207. loading: "loading",
  208. sun_set: "sunset",
  209. unknown: "unknown",
  210. altitude: "Altitude",
  211. today: "today",
  212. week: "week",
  213. list: "list",
  214. };
  215. localString["en"] = {
  216. and_another: " and ",
  217. atitude: "Atitude",
  218. BE: "Buddhist Era ",
  219. bhumma: "Bhumma",
  220. budha: "Budha",
  221. canda: "Canda",
  222. confirm: "Confirm",
  223. date: "Date",
  224. day: " day(s) ",
  225. days: " day(s) ",
  226. departure_in_detail: "departure in detail",
  227. dhamma_time: "5000 Years of the Buddha’s Dispensation ",
  228. eat: "eat",
  229. gama_entry: "entry the village",
  230. guru: "Guru",
  231. hori_ref_time: "horizontal refraction correct ",
  232. kala: "suitable time",
  233. language_select: "Language",
  234. left: "Remains ",
  235. loading: "loading…",
  236. longitude: "Longitude",
  237. māsa: "māsa",
  238. mins: "(min)",
  239. month: "Month ",
  240. month_1: "- ",
  241. months: " month(s) ",
  242. my_loc: "my location",
  243. need_inform: "without informing other Bhikkhu ",
  244. no_string: "cannot ",
  245. noon_time: "NOON",
  246. noon_time: "NOON",
  247. note: "Note",
  248. now_time: "NOW",
  249. pacchā_māsa: "pacchā-māsa",
  250. pakkha: "Lunar Phases ",
  251. past: "Passed ",
  252. pubba_māsa: "pubba-māsa",
  253. ravi: "Ravi",
  254. saṃvacchara: "saṃvacchara",
  255. season: "Season ",
  256. sec: "sec",
  257. sora: "Sora",
  258. sukka: "Sukka",
  259. sun_height_degree: "Max solar altitude ",
  260. time: "time",
  261. twilight_time: "dawn",
  262. twilight_time: "dawn",
  263. vikala: "unsuitable time",
  264. week_day: "Day",
  265. year_0: "year",
  266. year_1: "- ",
  267. years: " year(s) ",
  268. yes_string: "can ",
  269. timezone: "Timezone",
  270. local: "local",
  271. loading: "loading",
  272. sun_set: "sunset",
  273. unknown: "unknown",
  274. altitude: "Altitude",
  275. today: "today",
  276. week: "week",
  277. list: "list",
  278. };
  279. localString["my"] = {
  280. and_another: " and ",
  281. atitude: "Atitude",
  282. BE: "Buddhist Era ",
  283. bhumma: "ဘုမ္မ",
  284. budha: "ဗုဓ",
  285. canda: "စန္ဒ",
  286. confirm: "Confirm",
  287. date: "Date ",
  288. day: " day(s) ",
  289. days: " day(s) ",
  290. departure_in_detail: "departure in detail",
  291. dhamma_time: "5000 Years of the Buddha’s Dispensation ",
  292. eat: "eat",
  293. gama_entry: "entry the village",
  294. guru: "ဂုရု",
  295. hori_ref_time: "horizontal refraction correct ",
  296. kala: "ကာလ",
  297. language_select: "ဘာသာ",
  298. left: "Remains ",
  299. loading: "loading…",
  300. longitude: "Longitude",
  301. māsa: "မာသ",
  302. mins: "(min)",
  303. month: "Month ",
  304. month_1: "- ",
  305. months: " month(s) ",
  306. my_loc: "အတ္တသ္မိံ",
  307. need_inform: "without informing other Bhikkhu ",
  308. no_string: "cannot ",
  309. noon_time: "မဇ္ဈန္ဟိက",
  310. noon_time: "မဇ္ဈန္ဟိက",
  311. note: "Note",
  312. now_time: "ပစ္စုပ္ပန္န",
  313. pacchā_māsa: "ပစ္ဆာ-မာသ",
  314. pakkha: "Lunar Phases ",
  315. past: "Passed ",
  316. pubba_māsa: "ပုဗ္ဗ-မာသ",
  317. ravi: "ရဝိ",
  318. saṃvacchara: "သံဝစ္ဆရ",
  319. season: "Season ",
  320. sec: "sec ",
  321. sora: "သောရ",
  322. sukka: "သုက္က",
  323. sun_height_degree: "Max solar altitude ",
  324. time: "Time",
  325. twilight_time: "အရုဏုဂ္ဂမန",
  326. twilight_time: "အရုဏုဂ္ဂမန",
  327. vikala: "ဝိကာလ",
  328. week_day: "Day",
  329. year_0: "year",
  330. year_1: "- ",
  331. years: " year(s) ",
  332. yes_string: "can ",
  333. timezone: "Timezone",
  334. local: "local",
  335. loading: "loading",
  336. sun_set: "sunset",
  337. unknown: "unknown",
  338. altitude: "Altitude",
  339. today: "today",
  340. week: "week",
  341. list: "list",
  342. };
  343. localString["si"] = {
  344. and_another: " ච ",
  345. atitude: "Atitude",
  346. BE: "බුද්ධ වර්ෂය ",
  347. bhumma: "භුම්ම",
  348. budha: "බුධ",
  349. canda: "චන්ද",
  350. confirm: "Confirm",
  351. date: "දිවස ",
  352. day: " දිවසා(නි) ",
  353. days: " දිවසා(නි) ",
  354. departure_in_detail: "departure in detail",
  355. dhamma_time: "සම්මා සම්බුද්ධස්ස සාසනං පට්ච-වස්ස-සහස්සානි පවත්තිස්සති ",
  356. eat: "eat",
  357. gama_entry: "entry the village",
  358. guru: "ගු‍රු",
  359. hori_ref_time: "horizontal refraction correct ",
  360. kala: "කාල",
  361. language_select: "භාෂාව",
  362. left: "අවසිට්ඨ ",
  363. loading: "ප්‍රවේශනය වෙනවා ",
  364. longitude: "Longitude",
  365. māsa: "මාස",
  366. mins: "(min)",
  367. month: "මාස ",
  368. month_1: "- ",
  369. months: " මාසා(නි) ",
  370. my_loc: "අත‍්තස‍්මිං",
  371. need_inform: "without informing other Bhikkhu ",
  372. no_string: "cannot ",
  373. noon_time: "මජ්ඣන්හික",
  374. noon_time: "මජ්ඣන්හික",
  375. note: "නෝට්ටුව ",
  376. now_time: "පච්චුප්පන්න",
  377. pacchā_māsa: "පච්ඡා-මාස",
  378. pakkha: "පක්ඛ ",
  379. past: "අතික්කන්ත ",
  380. pubba_māsa: "පුබ්බ-මාස",
  381. ravi: "රවි",
  382. saṃvacchara: "සංවච්ඡ‍ර",
  383. season: "උතු ",
  384. sec: "sec",
  385. sora: "සො‍ර",
  386. sukka: "සුක්ක",
  387. sun_height_degree: "Max solar altitude ",
  388. time: "time",
  389. twilight_time: "අ‍රුණුග්ගමන",
  390. twilight_time: "අ‍රුණුග්ගමන",
  391. vikala: "විකාල",
  392. week_day: "වා‍ර ",
  393. year_0: "සංවච්ඡ‍ර",
  394. year_1: "- ",
  395. years: " සංවච්ඡ‍රා(නි) ",
  396. yes_string: "can ",
  397. timezone: "Timezone",
  398. local: "local",
  399. loading: "loading",
  400. sun_set: "sunset",
  401. unknown: "unknown",
  402. altitude: "Altitude",
  403. today: "today",
  404. week: "week",
  405. list: "list",
  406. };
  407. var pali_month_name = [
  408. { id: "1", value: "jeṭṭha", season: "gimhāna", season_icon: "☀" }, //5.X-四-十五-心
  409. { id: "2", value: "asāḷha", season: "gimhāna", season_icon: "☀" }, //6.X-五-十五、十六-箕、斗
  410. { id: "3", value: "sāvana", season: "vassāna", season_icon: "☔" }, //7.X-六-十五-女
  411. { id: "4", value: "poṭṭhapāda", season: "vassāna", season_icon: "☔" }, //8.x-七-十五、十六-室、壁
  412. { id: "5", value: "assajuja", season: "vassāna", season_icon: "☔" }, //9.X-八-十五-樓
  413. { id: "6", value: "kattika", season: "vassāna", season_icon: "☔" }, //10.X-九-十五-昂
  414. { id: "7", value: "māgasira", season: "hemanta", season_icon: "❄" }, //11.X-十-十五-觜
  415. { id: "8", value: "phussa", season: "hemanta", season_icon: "❄" }, //12.X-十一-十五-鬼
  416. { id: "9", value: "māgha", season: "hemanta", season_icon: "❄" }, //1.X-十二-十五-星
  417. { id: "10", value: "phagguna", season: "hemanta", season_icon: "❄" }, //2.X-正月-十四、十五-張、異
  418. { id: "11", value: "citta", season: "gimhāna", season_icon: "☀" }, //3.X-二月-十五-角
  419. { id: "12", value: "vesākha", season: "gimhāna", season_icon: "☀" }, //4.X-三月-十五-氐
  420. ];
  421. var pali_nakkhatta_name = [
  422. { id: "0", value: "assayuja", name_zh: "娄宿" },
  423. { id: "1", value: "bharaṇī", name_zh: "胃宿" },
  424. { id: "2", value: "Kattikā", name_zh: "昂宿" },
  425. { id: "3", value: "rohiṇī", name_zh: "毕宿" },
  426. { id: "4", value: "magasira", name_zh: "觜宿" },
  427. { id: "5", value: "Addā", name_zh: "参宿" },
  428. { id: "6", value: "punabbasu", name_zh: "井宿" },
  429. { id: "7", value: "phussa", name_zh: "鬼宿" },
  430. { id: "8", value: "Asilesā", name_zh: "柳宿" },
  431. { id: "9", value: "maghā", name_zh: "星宿" },
  432. { id: "10", value: "pubbaphagguṇī", name_zh: "张宿" },
  433. { id: "11", value: "uttaraphagguṇī", name_zh: "翼宿" },
  434. { id: "12", value: "hattha", name_zh: "轸宿" },
  435. { id: "13", value: "cittā", name_zh: "角宿" },
  436. { id: "14", value: "sāti", name_zh: "亢宿" },
  437. { id: "15", value: "visākhā", name_zh: "氐宿" },
  438. { id: "16", value: "anurādhā", name_zh: "房宿" },
  439. { id: "17", value: "jeṭṭha", name_zh: "心宿" },
  440. { id: "18", value: "mūlā", name_zh: "尾宿" },
  441. { id: "19", value: "pubbāsāḷha", name_zh: "箕宿" },
  442. { id: "20", value: "uttarāsāḷha", name_zh: "斗宿" },
  443. { id: "21", value: "savaṇa", name_zh: "女宿" },
  444. { id: "22", value: "dhaniṭṭhā", name_zh: "虚宿" },
  445. { id: "23", value: "satabhisaja", name_zh: "危宿" },
  446. { id: "24", value: "pubbabhaddapadā", name_zh: "室宿" },
  447. { id: "25", value: "uttarabhaddapadā", name_zh: "壁宿" },
  448. { id: "26", value: "revatī", name_zh: "奎宿" },
  449. ];
  450. var horoscope_name = [
  451. { id: "0", value: "Aries", name_zh: "白羊", icon: "♈" },
  452. { id: "1", value: "Taurus", name_zh: "金牛", icon: "♉" },
  453. { id: "2", value: "Gemini", name_zh: "双子", icon: "♊" },
  454. { id: "3", value: "Cancer", name_zh: "巨蟹", icon: "♋" },
  455. { id: "4", value: "Leo", name_zh: "狮子", icon: "♌" },
  456. { id: "5", value: "Virgo", name_zh: "处女", icon: "♍" },
  457. { id: "6", value: "Libra", name_zh: "天秤", icon: "♎" },
  458. { id: "7", value: "Scorpio", name_zh: "天蝎", icon: "♏" },
  459. { id: "8", value: "Sagittarius", name_zh: "射手", icon: "♐" },
  460. { id: "9", value: "Capricornus", name_zh: "摩羯", icon: "♑" },
  461. { id: "10", value: "Aquarius", name_zh: "水瓶", icon: "♒" },
  462. { id: "11", value: "Pisces", name_zh: "双鱼", icon: "♓" },
  463. ];
  464. </script>
  465. <script>
  466. var current_phase = phase();
  467. console.log(current_phase); //输出到控制台
  468. //$("#title_text").html(localString[g_language].BE);
  469. var new_list = new Array(); //新月列表
  470. var first_list = new Array(); //上弦月列表
  471. var full_list = new Array(); //满月列表
  472. var last_list = new Array(); //下弦月列表
  473. var planets = new Array(); //
  474. var lunar_position = new Object();
  475. var g_coordinate_this = new Object();
  476. var g_now_date = new Date();
  477. var today = new Date();
  478. var start_day = new Date();
  479. var next_year = new Date();
  480. var sun_times = new Object();
  481. var curr_position = localStorage.getItem("local_position");
  482. if (curr_position) {
  483. g_coordinate_this.AT = curr_position.split("#")[0];
  484. g_coordinate_this.LT = curr_position.split("#")[1];
  485. g_coordinate_this.height = curr_position.split("#")[2];
  486. var AT_string =
  487. angle_trans(g_coordinate_this.AT)[0] +
  488. "°" +
  489. angle_trans(g_coordinate_this.AT)[1] +
  490. "’" +
  491. angle_trans(g_coordinate_this.AT)[2] +
  492. "”";
  493. if (g_coordinate_this.AT >= 0) {
  494. AT_string += "N";
  495. } else {
  496. AT_string += "S";
  497. }
  498. var LT_string =
  499. angle_trans(g_coordinate_this.LT)[0] +
  500. "°" +
  501. angle_trans(g_coordinate_this.LT)[1] +
  502. "’" +
  503. angle_trans(g_coordinate_this.LT)[2] +
  504. "”";
  505. if (g_coordinate_this.LT >= 0) {
  506. LT_string += "E";
  507. } else {
  508. LT_string += "W";
  509. }
  510. if (g_coordinate_this.height != "null") {
  511. var height_string = g_coordinate_this.height + "M";
  512. } else {
  513. var height_string = localString[g_language].unknown;
  514. }
  515. } else {
  516. getLocation();
  517. }
  518. function show_time() {
  519. if ($("#input_time").val()) {
  520. today = new Date($("#input_time").val());
  521. } else {
  522. today = g_now_date;
  523. }
  524. lunar_phase_list_refresh();
  525. get_position(today);
  526. let d_earth_to_moon =
  527. lunar_position.position.x ^
  528. (2 + lunar_position.position.y) ^
  529. (2 + lunar_position.position.z) ^
  530. 2 ^
  531. 0.5;
  532. let d_earth_to_moon_0 = phase(today).distance;
  533. sun_times = SunCalc.getTimes(
  534. today,
  535. g_coordinate_this.AT,
  536. g_coordinate_this.LT,
  537. g_coordinate_this.height / 1000
  538. );
  539. sun_position = SunCalc.getPosition(today, g_coordinate_this.AT, g_coordinate_this.LT);
  540. moon_position = SunCalc.getMoonPosition(today, g_coordinate_this.AT, g_coordinate_this.LT);
  541. moon_Illumination = SunCalc.getMoonIllumination(today);
  542. }
  543. //根据时间计算偏角,输出
  544. function get_position(date_time) {
  545. let planets_position = new Object();
  546. planets = window.lagrange.planet_positions.getPositions(date_time);
  547. //planets = global.planet_positions.getPositions(today);
  548. //console.log(planets)//输出到控制台
  549. earth_position = window.lagrange.planet_positions.getPositions(date_time)[3];
  550. lunar_position = window.lagrange.planet_positions.getPositions(date_time)[11];
  551. let lunar_position_angle = 0;
  552. let lunar_station = 0;
  553. let earth_position_angle = 0;
  554. let earth_station = 0;
  555. let earth_position_angle_round = 0;
  556. let lunar_position_angle_round = 0;
  557. //太阳相对地球的黄道偏角
  558. if (earth_position.position.y >= 0) {
  559. earth_position_angle = Math.atan2(earth_position.position.y, earth_position.position.x);
  560. } else {
  561. earth_position_angle =
  562. Math.PI * 2 + Math.atan2(earth_position.position.y, earth_position.position.x);
  563. }
  564. earth_position_angle_round = earth_position_angle / Math.PI / 2 + 0.5;
  565. earth_position_angle_round = earth_position_angle_round - Math.floor(earth_position_angle_round);
  566. earth_station = earth_position_angle_round * 12;
  567. planets_position.solar_station = earth_station;
  568. planets_position.solar_position_angle = earth_position_angle_round * Math.PI * 2;
  569. planets_position.solar_position_angle_round = earth_position_angle_round;
  570. //月球相对地球的黄道偏角——角度差算法
  571. lunar_position_angle_round = earth_position_angle_round + phase(date_time).phase;
  572. lunar_position_angle_round = lunar_position_angle_round - Math.floor(lunar_position_angle_round);
  573. lunar_position_angle = lunar_position_angle_round * Math.PI * 2;
  574. lunar_station = lunar_position_angle_round * 27;
  575. //月球相对地球的黄道偏角算法——向量差算法
  576. let lunar_to_earth = new Object();
  577. lunar_to_earth.y = lunar_position.position.y - earth_position.position.y;
  578. lunar_to_earth.x = lunar_position.position.x - earth_position.position.x;
  579. if (lunar_to_earth.y >= 0) {
  580. lunar_position_angle2 = Math.atan2(lunar_to_earth.y, lunar_to_earth.x);
  581. } else {
  582. lunar_position_angle2 = Math.PI * 2 + Math.atan2(lunar_to_earth.y, lunar_to_earth.x);
  583. }
  584. lunar_position_angle_round2 = lunar_position_angle2 / Math.PI / 2;
  585. //lunar_position_angle_round = lunar_position_angle_round - Math.floor(lunar_position_angle_round)
  586. lunar_position_angle2 = lunar_position_angle_round2 * Math.PI * 2;
  587. lunar_station2 = lunar_position_angle_round2 * 27;
  588. planets_position.lunar_station = lunar_station; //月站值【角度差算夹角】
  589. planets_position.lunar_position_angle = lunar_position_angle; //月站角【角度差算夹角】
  590. planets_position.lunar_position_angle_round = lunar_position_angle_round; //月站圆周比率【角度差算夹角】
  591. planets_position.lunar_station2 = lunar_station2; //月站值【矢量差算夹角】
  592. planets_position.lunar_position_angle2 = lunar_position_angle2; //月站角【矢量差算夹角】
  593. planets_position.lunar_position_angle_round2 = lunar_position_angle_round2; //月站圆周比率【矢量差算夹角】
  594. return planets_position;
  595. }
  596. //根据;
  597. function get_station_name(data_time) {
  598. //获取星象信息
  599. let solar_num = 0;
  600. let lunar_num = 0;
  601. solar_num = get_position(data_time).solar_station;
  602. solar_num = Math.floor(solar_num);
  603. lunar_num = get_position(data_time).lunar_station;
  604. lunar_num = Math.floor(lunar_num);
  605. let result = new Object();
  606. result.solar = horoscope_name[solar_num]; //黄道十二宫星象名称
  607. result.lunar = pali_nakkhatta_name[lunar_num]; //27星宿月站名称
  608. return result;
  609. }
  610. function getLocation() {
  611. //自动定位
  612. if (navigator.geolocation) {
  613. navigator.geolocation.getCurrentPosition(showPosition, showError);
  614. } else {
  615. $("#selected_position_string").html("Geolocation is not supported by this browser.");
  616. }
  617. }
  618. function position_input() {
  619. //手动输入
  620. var LT = Number($("#LT_°")[0].value);
  621. LT += Number($("#LT_’")[0].value) / 60;
  622. LT += Number($("#LT_”")[0].value) / 3600;
  623. LT = Number($("#WE")[0].value + LT);
  624. var AT = Number($("#AT_°")[0].value);
  625. AT += Number($("#AT_’")[0].value) / 60;
  626. AT += Number($("#AT_”")[0].value) / 3600;
  627. AT = Number($("#NS")[0].value + AT);
  628. if (AT != 0) {
  629. g_coordinate_this.LT = LT;
  630. g_coordinate_this.AT = AT;
  631. }
  632. }
  633. function showError(error) {
  634. switch (error.code) {
  635. case error.PERMISSION_DENIED:
  636. alert("定位失败,用户拒绝请求地理定位");
  637. break;
  638. case error.POSITION_UNAVAILABLE:
  639. alert("定位失败,位置信息是不可用");
  640. break;
  641. case error.TIMEOUT:
  642. alert("定位失败,请求获取用户位置超时");
  643. break;
  644. case error.UNKNOWN_ERROR:
  645. alert("定位失败,定位系统失效");
  646. break;
  647. }
  648. }
  649. function angle_trans(angle) {
  650. var angle_str = new Array();
  651. var num_d = Math.floor(angle);
  652. var num_m = Math.floor((angle - num_d) * 60);
  653. var num_s = Math.round((angle - num_d) * 60 - num_m);
  654. angle_str.push(num_d);
  655. angle_str.push(num_m);
  656. angle_str.push(num_s);
  657. return angle_str;
  658. }
  659. function input_position() {
  660. $("#position_input").show();
  661. }
  662. var g_event_list_arr = new Array();
  663. function get_event_arr() {
  664. let today = new Date();
  665. let date = new Date();
  666. for (i = -360; i < 360; i++) {
  667. date.setTime(today.getTime() + i * 3600 * 24 * 1000);
  668. let info_obj = new Object();
  669. info_obj.id = "dawn" + i;
  670. info_obj.title = localString[g_language].twilight_time;
  671. info_obj.start = SunCalc.getTimes(
  672. date,
  673. g_coordinate_this.AT,
  674. g_coordinate_this.LT,
  675. g_coordinate_this.height / 1000
  676. ).dawn;
  677. g_event_list_arr.push(info_obj);
  678. info_obj = new Object();
  679. info_obj.id = "noon" + i;
  680. info_obj.title = localString[g_language].noon_time;
  681. info_obj.start = SunCalc.getTimes(
  682. date,
  683. g_coordinate_this.AT,
  684. g_coordinate_this.LT,
  685. g_coordinate_this.height / 1000
  686. ).solarNoon;
  687. g_event_list_arr.push(info_obj);
  688. info_obj = new Object();
  689. info_obj.id = "sunset" + i;
  690. info_obj.title = localString[g_language].sun_set;
  691. info_obj.start = SunCalc.getTimes(
  692. date,
  693. g_coordinate_this.AT,
  694. g_coordinate_this.LT,
  695. g_coordinate_this.height / 1000
  696. ).sunset;
  697. g_event_list_arr.push(info_obj);
  698. }
  699. next_year.setDate(start_day.getDate() + 360);
  700. start_day.setDate(today.getDate() - 360);
  701. last_list = phaseRange(start_day, next_year, LAST); //获取下弦月列表
  702. for (i_last in last_list) {
  703. info_obj = new Object();
  704. info_obj.id = "last_moon" + i_last;
  705. info_obj.title = "🌗" + get_station_name(last_list[i_last]).lunar.value;
  706. info_obj.start = last_list[i_last];
  707. g_event_list_arr.push(info_obj);
  708. }
  709. new_list = phaseRange(start_day, next_year, NEW); //获取新月列表
  710. for (i_new in new_list) {
  711. info_obj = new Object();
  712. info_obj.id = "new_moon" + i_new;
  713. info_obj.title = "🌑" + get_station_name(new_list[i_new]).lunar.value;
  714. info_obj.start = new_list[i_new];
  715. g_event_list_arr.push(info_obj);
  716. }
  717. first_list = phaseRange(start_day, next_year, FIRST); //获取上弦月列表
  718. for (i_first in first_list) {
  719. info_obj = new Object();
  720. info_obj.id = "first_moon" + i_first;
  721. info_obj.title = "🌓" + get_station_name(first_list[i_first]).lunar.value;
  722. info_obj.start = first_list[i_first];
  723. g_event_list_arr.push(info_obj);
  724. }
  725. full_list = phaseRange(start_day, next_year, FULL); //获取满月列表
  726. for (i_full in full_list) {
  727. info_obj = new Object();
  728. info_obj.id = "full_moon" + i_full;
  729. info_obj.title = "🌕" + get_station_name(full_list[i_full]).lunar.value;
  730. info_obj.start = full_list[i_full];
  731. g_event_list_arr.push(info_obj);
  732. }
  733. /*console.log(last_list); //输出到控制台
  734. console.log(new_list); //输出到控制台
  735. console.log(first_list); //输出到控制台
  736. console.log(full_list); //输出到控制台*/
  737. }
  738. get_event_arr();
  739. </script>
  740. <script src="../lib/main.js"></script>
  741. <script>
  742. function getCookie(name) {
  743. var start = document.cookie.indexOf(name + "=");
  744. var len = start + name.length + 1;
  745. if (!start && name != document.cookie.substring(0, name.length)) {
  746. return null;
  747. }
  748. if (start == -1) return null;
  749. var end = document.cookie.indexOf(";", len);
  750. if (end == -1) end = document.cookie.length;
  751. return decodeURI(document.cookie.substring(len, end));
  752. }
  753. document.addEventListener("DOMContentLoaded", function () {
  754. var initialTimeZone = "local";
  755. var timeZoneSelectorEl = document.getElementById("time-zone-selector");
  756. var loadingEl = document.getElementById("loading");
  757. var calendarEl = document.getElementById("calendar");
  758. var calendar = new FullCalendar.Calendar(calendarEl, {
  759. timeZone: initialTimeZone,
  760. locale: getCookie("language"),
  761. headerToolbar: {
  762. left: "prev,next today",
  763. center: "title",
  764. right: "dayGridMonth,timeGridWeek,timeGridDay,listWeek",
  765. },
  766. //initialDate: "2020-12-12",
  767. navLinks: true, // can click day/week names to navigate views
  768. editable: true,
  769. selectable: true,
  770. dayMaxEvents: true, // allow "more" link when too many events
  771. //resources: g_event_list_arr,
  772. events: g_event_list_arr,
  773. defaultTimedEventDuration: "00:01",
  774. eventClick: function (info) {
  775. info.jsEvent.preventDefault(); // don't let the browser navigate
  776. if (info.event.url) {
  777. window.open(info.event.url);
  778. }
  779. },
  780. loading: function (bool) {
  781. if (bool) {
  782. loadingEl.style.display = "inline"; // show
  783. } else {
  784. loadingEl.style.display = "none"; // hide
  785. }
  786. },
  787. eventTimeFormat: { hour: "numeric", minute: "2-digit" },
  788. dateClick: function (arg) {
  789. console.log("dateClick", calendar.formatIso(arg.date));
  790. },
  791. select: function (arg) {
  792. console.log("select", calendar.formatIso(arg.start), calendar.formatIso(arg.end));
  793. },
  794. });
  795. calendar.render();
  796. // load the list of available timezones, build the <select> options
  797. // it's HIGHLY recommended to use a different library for network requests, not this internal util func
  798. FullCalendar.requestJson(
  799. "GET",
  800. "php/get-time-zones.php",
  801. {},
  802. function (timeZones) {
  803. timeZones.forEach(function (timeZone) {
  804. var optionEl;
  805. if (timeZone !== "UTC") {
  806. // UTC is already in the list
  807. optionEl = document.createElement("option");
  808. optionEl.value = timeZone;
  809. optionEl.innerText = timeZone;
  810. timeZoneSelectorEl.appendChild(optionEl);
  811. }
  812. });
  813. },
  814. function () {
  815. // TODO: handle error
  816. }
  817. );
  818. // when the timezone selector changes, dynamically change the calendar option
  819. timeZoneSelectorEl.addEventListener("change", function () {
  820. calendar.setOption("timeZone", this.value);
  821. });
  822. });
  823. </script>
  824. <style>
  825. body {
  826. margin: 0;
  827. padding: 0;
  828. font-family: Arial, Helvetica Neue, Helvetica, sans-serif;
  829. font-size: 14px;
  830. }
  831. #top {
  832. background: #eee;
  833. border-bottom: 1px solid #ddd;
  834. padding: 0 10px;
  835. line-height: 40px;
  836. font-size: 12px;
  837. }
  838. .left {
  839. float: left;
  840. }
  841. .right {
  842. float: right;
  843. }
  844. .clear {
  845. clear: both;
  846. }
  847. #script-warning,
  848. #loading {
  849. display: none;
  850. }
  851. #script-warning {
  852. font-weight: bold;
  853. color: red;
  854. }
  855. #calendar {
  856. max-width: 1100px;
  857. margin: 40px auto;
  858. padding: 0 10px;
  859. }
  860. .tzo {
  861. color: #000;
  862. }
  863. input[type="number" i] {
  864. width: 2.5em;
  865. }
  866. </style>
  867. </head>
  868. <body>
  869. <div id="top">
  870. <div class="left">
  871. <script>
  872. document.write(localString[g_language].timezone + ":");
  873. </script>
  874. <select id="time-zone-selector">
  875. <option value="local" selected>
  876. <script>
  877. document.write(localString[g_language].local);
  878. </script>
  879. </option>
  880. <option value="UTC">UTC</option>
  881. </select>
  882. </div>
  883. <div style="display: inline-block; width: 50%; justify-content: center; margin-left: 20%">
  884. <div style="line-height: 2em; margin-top: 7px">
  885. <script>
  886. document.write(localString[g_language].atitude);
  887. </script>
  888. <span id="AT_str" onclick="show_ele(this)"></span>
  889. <span class="coordinate_input" style="flex: 7; white-space: nowrap; display: none">
  890. <input id="AT_°" type="number" min="0" max="89" /> °
  891. <input id="AT_’" type="number" min="0" max="59" /> ’
  892. <input id="AT_”" type="number" min="0" max="59" /> ”
  893. <select id="NS">
  894. <option value="+">N</option>
  895. <option value="-">S</option>
  896. </select>
  897. <button onclick="show_ele('#AT_str')">
  898. <script>
  899. document.write(localString[g_language].confirm);
  900. </script>
  901. </button>
  902. </span>
  903. </div>
  904. <div style="line-height: 2em">
  905. <script>
  906. document.write(localString[g_language].longitude);
  907. </script>
  908. <span id="LT_str" onclick="show_ele(this)"></span>
  909. <span
  910. class="coordinate_input"
  911. onblur="show_ele(this)"
  912. style="flex: 7; white-space: nowrap; display: none"
  913. >
  914. <input id="LT_°" type="number" min="0" max="179" style="width: 3em" /> °
  915. <input id="LT_’" type="number" min="0" max="59" /> ’
  916. <input id="LT_”" type="number" min="0" max="59" /> ”
  917. <select id="WE">
  918. <option value="+">E</option>
  919. <option value="-">W</option>
  920. </select>
  921. <button onclick="show_ele('#LT_str')">
  922. <script>
  923. document.write(localString[g_language].confirm);
  924. </script>
  925. </button>
  926. </span>
  927. </div>
  928. <div style="line-height: 2em">
  929. <script>
  930. document.write(localString[g_language].altitude);
  931. </script>
  932. <span id="altitude_string" onclick="show_ele(this)"></span>
  933. <span class="coordinate_input" style="flex: 7; white-space: nowrap; display: none">
  934. <input id="HT_M" type="number" min="0" max="19999" style="width: 4em" /> M
  935. <button onclick="show_ele('#altitude_string')">
  936. <script>
  937. document.write(localString[g_language].confirm);
  938. </script>
  939. </button>
  940. </span>
  941. </div>
  942. </div>
  943. <div class="right">
  944. <span id="loading">
  945. <script>
  946. document.write(localString[g_language].loading + "…");
  947. </script>
  948. </span>
  949. <span id="script-warning"><code>php/get-events.php</code> must be running.</span>
  950. </div>
  951. <div class="clear"></div>
  952. </div>
  953. <div id="calendar"></div>
  954. </body>
  955. <script>
  956. function position_modify() {
  957. var LT = Number($("#LT_°")[0].value);
  958. LT += Number($("#LT_’")[0].value) / 60;
  959. LT += Number($("#LT_”")[0].value) / 3600;
  960. LT = Number($("#WE")[0].value + LT);
  961. var AT = Number($("#AT_°")[0].value);
  962. AT += Number($("#AT_’")[0].value) / 60;
  963. AT += Number($("#AT_”")[0].value) / 3600;
  964. AT = Number($("#NS")[0].value + AT);
  965. if (AT != 0) {
  966. g_coordinate_this.LT = LT;
  967. g_coordinate_this.AT = AT;
  968. }
  969. //将新的坐标数据存到localStorage
  970. let position_string = g_coordinate_this.AT + "#" + g_coordinate_this.LT + "#" + g_coordinate_this.height;
  971. localStorage.setItem("local_position", position_string);
  972. }
  973. function position_modify_confirm(obj) {
  974. position_modify();
  975. show_ele(obj);
  976. }
  977. function show_ele(obj) {
  978. if ($(obj).siblings("span").css("display") == "none") {
  979. $(obj).hide();
  980. $(obj).siblings("span").show();
  981. } else {
  982. $(obj).show();
  983. $(obj).siblings("span").hide();
  984. }
  985. }
  986. function getLocation() {
  987. //自动定位
  988. if (navigator.geolocation) {
  989. navigator.geolocation.getCurrentPosition(showPosition, showError);
  990. } else {
  991. $("#selected_position_string").html("Geolocation is not supported by this browser.");
  992. }
  993. }
  994. function position_input() {
  995. //手动输入
  996. var LT = Number($("#LT_°")[0].value);
  997. LT += Number($("#LT_’")[0].value) / 60;
  998. LT += Number($("#LT_”")[0].value) / 3600;
  999. LT = Number($("#WE")[0].value + LT);
  1000. var AT = Number($("#AT_°")[0].value);
  1001. AT += Number($("#AT_’")[0].value) / 60;
  1002. AT += Number($("#AT_”")[0].value) / 3600;
  1003. AT = Number($("#NS")[0].value + AT);
  1004. if (AT != 0) {
  1005. g_coordinate_this.LT = LT;
  1006. g_coordinate_this.AT = AT;
  1007. }
  1008. }
  1009. function showError(error) {
  1010. switch (error.code) {
  1011. case error.PERMISSION_DENIED:
  1012. alert("定位失败,用户拒绝请求地理定位");
  1013. break;
  1014. case error.POSITION_UNAVAILABLE:
  1015. alert("定位失败,位置信息是不可用");
  1016. break;
  1017. case error.TIMEOUT:
  1018. alert("定位失败,请求获取用户位置超时");
  1019. break;
  1020. case error.UNKNOWN_ERROR:
  1021. alert("定位失败,定位系统失效");
  1022. break;
  1023. }
  1024. }
  1025. $("#AT_str").html(AT_string);
  1026. $("#LT_str").html(LT_string);
  1027. $("#altitude_string").html(height_string);
  1028. $("#AT_°")[0].value = angle_trans(g_coordinate_this.AT)[0];
  1029. $("#AT_’")[0].value = angle_trans(g_coordinate_this.AT)[1];
  1030. $("#AT_”")[0].value = angle_trans(g_coordinate_this.AT)[2];
  1031. $("#LT_°")[0].value = angle_trans(g_coordinate_this.LT)[0];
  1032. $("#LT_’")[0].value = angle_trans(g_coordinate_this.LT)[1];
  1033. $("#LT_”")[0].value = angle_trans(g_coordinate_this.LT)[2];
  1034. $("#HT_M")[0].value = g_coordinate_this.height;
  1035. $(document).ready(function () {
  1036. $("button").each(function () {
  1037. if ($(this).html() == "today") {
  1038. $(this).html(localString[g_language].today);
  1039. }
  1040. if ($(this).html() == "list") {
  1041. $(this).html(localString[g_language].list);
  1042. }
  1043. if ($(this).html() == "week") {
  1044. $(this).html(localString[g_language].week);
  1045. }
  1046. if ($(this).html() == "month") {
  1047. $(this).html(localString[g_language].month);
  1048. }
  1049. if ($(this).html() == "day") {
  1050. $(this).html(localString[g_language].day);
  1051. }
  1052. });
  1053. });
  1054. $(document).ready(function () {
  1055. $("button").click(function () {
  1056. $("button").each(function () {
  1057. if ($(this).html().indexOf("today") != -1) {
  1058. $(this).html(localString[g_language].today);
  1059. }
  1060. if ($(this).html().indexOf("list") != -1) {
  1061. $(this).html(localString[g_language].list);
  1062. }
  1063. if ($(this).html().indexOf("week") != -1) {
  1064. $(this).html(localString[g_language].week);
  1065. }
  1066. if ($(this).html().indexOf("month") != -1) {
  1067. $(this).html(localString[g_language].month);
  1068. }
  1069. if ($(this).html().indexOf("day") != -1 && $(this).html().indexOf("today") == -1) {
  1070. $(this).html(localString[g_language].day);
  1071. }
  1072. });
  1073. });
  1074. });
  1075. $(document).ready(function () {
  1076. $("div").click(function () {
  1077. $("button").each(function () {
  1078. if ($(this).html().indexOf("today") != -1) {
  1079. $(this).html(localString[g_language].today);
  1080. }
  1081. if ($(this).html().indexOf("list") != -1) {
  1082. $(this).html(localString[g_language].list);
  1083. }
  1084. if ($(this).html().indexOf("week") != -1) {
  1085. $(this).html(localString[g_language].week);
  1086. }
  1087. if ($(this).html().indexOf("month") != -1) {
  1088. $(this).html(localString[g_language].month);
  1089. }
  1090. if ($(this).html().indexOf("day") != -1 && $(this).html().indexOf("today") == -1) {
  1091. $(this).html(localString[g_language].day);
  1092. }
  1093. });
  1094. });
  1095. });
  1096. </script>
  1097. </html>