index1.html 33 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
  2. <html>
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  5. <meta name="viewport" content="width=device-width, initial-scale=1" />
  6. <link type="text/css" rel="stylesheet" href="../pcdl/css/font.css" />
  7. <link type="text/css" rel="stylesheet" href="../pcdl/css/basic_style.css" />
  8. <link type="text/css" rel="stylesheet" href="../pcdl/css/style.css" />
  9. <link type="text/css" rel="stylesheet" href="../pcdl/css/color_day.css" id="colorchange" />
  10. <link
  11. type="text/css"
  12. rel="stylesheet"
  13. href="../pcdl/css/style_mobile.css"
  14. media="screen and (max-width:800px)"
  15. />
  16. <script src="../public/js/jquery.js"></script>
  17. <script src="../public/js/comm.js"></script>
  18. <script src="jquery-3.3.1.min.js"></script>
  19. <script src="julian.js"></script>
  20. <script src="lune.js"></script>
  21. <script src="suncalc.js"></script>
  22. <script src="./planet_position/js/planet-positions.js"></script>
  23. <script src="../studio/js/fixedsticky.js"></script>
  24. <script src="../guide/guide.js"></script>
  25. <link type="text/css" rel="stylesheet" href="../guide/guide.css" />
  26. <script src="../public/js/marked.js"></script>
  27. <!--获取语言-->
  28. <script>
  29. var g_language = "en";
  30. var g_currLink = "";
  31. function lang_init(strPage) {
  32. g_currLink = strPage;
  33. }
  34. function setLang(strLang) {
  35. g_language = strLang;
  36. setCookie("language", g_language, 365);
  37. window.location.assign(location.pathname + "?language=" + g_language);
  38. }
  39. </script>
  40. <script>
  41. var localString = new Array();
  42. localString["zh-cn"] = {
  43. and_another: "又 ",
  44. atitude: "纬度",
  45. BE: "佛历",
  46. bhumma: "周二",
  47. budha: "周三",
  48. canda: "周一",
  49. confirm: "确认",
  50. date: "日期",
  51. day: "日",
  52. days: "天 ",
  53. departure_in_detail: "起飞详情",
  54. dhamma_time: "会延续五千年的教法 ",
  55. eat: "进餐",
  56. gama_entry: "入村",
  57. guru: "周四",
  58. hori_ref_time: "蒙气差修正 ",
  59. kala: "适当的时间",
  60. language_select: "选择语言",
  61. left: "还剩下",
  62. loading: "载入中……",
  63. longitude: "经度",
  64. māsa: "月",
  65. mins: "分钟",
  66. month: "月 ",
  67. month_1: "月 ",
  68. months: "个月 ",
  69. my_loc: "我的位置",
  70. need_inform: "未告知其他比库",
  71. no_string: "不能",
  72. noon_time: "正午",
  73. noon_time: "正午",
  74. note: "注释",
  75. now_time: "现在",
  76. pacchā_māsa: "下个月",
  77. pakkha: "月相变化 ",
  78. past: "已过去",
  79. pubba_māsa: "上个月",
  80. ravi: "周日",
  81. saṃvacchara: "年",
  82. season: "季节 ",
  83. sec: "秒",
  84. sora: "周六",
  85. sukka: "周五",
  86. sun_height_degree: "正午太阳高度 ",
  87. time: "时间",
  88. twilight_time: "曙光",
  89. twilight_time: "曙光",
  90. vikala: "不适当的时间",
  91. week_day: "星期",
  92. year_0: "年",
  93. year_1: "年 ",
  94. years: "年 ",
  95. yes_string: "可以",
  96. };
  97. localString["zh-tw"] = {
  98. and_another: "又 ",
  99. atitude: "緯度",
  100. BE: "佛曆",
  101. bhumma: "週二",
  102. budha: "週三",
  103. canda: "週一",
  104. confirm: "確認",
  105. date: "日期",
  106. day: "日",
  107. days: "天 ",
  108. departure_in_detail: "起飛詳情",
  109. dhamma_time: "會延續五千年的教法 ",
  110. eat: "進餐",
  111. gama_entry: "入村",
  112. guru: "週四",
  113. hori_ref_time: "蒙氣差修正 ",
  114. kala: "適當的時間",
  115. language_select: "選擇語言",
  116. left: "還剩下",
  117. loading: "載入中……",
  118. longitude: "經度",
  119. māsa: "月",
  120. mins: "分鐘",
  121. month: "月 ",
  122. month_1: "月 ",
  123. months: "個月 ",
  124. my_loc: "我的位置",
  125. need_inform: "未告知其他比庫",
  126. no_string: "不能",
  127. noon_time: "正午",
  128. noon_time: "正午",
  129. note: "註釋",
  130. now_time: "現在",
  131. pacchā_māsa: "下個月",
  132. pakkha: "月相變化 ",
  133. past: "已過去",
  134. pubba_māsa: "上個月",
  135. ravi: "週日",
  136. saṃvacchara: "年",
  137. season: "季節 ",
  138. sec: "秒",
  139. sora: "週六",
  140. sukka: "週五",
  141. sun_height_degree: "正午太陽高度 ",
  142. time: "時間",
  143. twilight_time: "曙光",
  144. twilight_time: "曙光",
  145. vikala: "不適當的時間",
  146. week_day: "星期",
  147. year_0: "年",
  148. year_1: "年 ",
  149. years: "年 ",
  150. yes_string: "可以",
  151. };
  152. localString["default"] = {
  153. and_another: " and ",
  154. atitude: "Atitude",
  155. BE: "Buddhist Era ",
  156. bhumma: "Bhumma",
  157. budha: "Budha",
  158. canda: "Canda",
  159. confirm: "Confirm",
  160. date: "Date ",
  161. day: " day(s) ",
  162. days: " day(s) ",
  163. departure_in_detail: "departure in detail",
  164. dhamma_time: "5000 Years of the Buddha’s Dispensation ",
  165. eat: "eat",
  166. gama_entry: "entry the village",
  167. guru: "Guru",
  168. hori_ref_time: "horizontal refraction correct ",
  169. kala: "suitable time",
  170. language_select: "bhāsā",
  171. left: "Remains ",
  172. loading: "loading…",
  173. longitude: "Longitude",
  174. māsa: "māsa",
  175. mins: "(min)",
  176. month: "Month ",
  177. month_1: "- ",
  178. months: " month(s) ",
  179. my_loc: "attasmiṃ",
  180. need_inform: "without informing other Bhikkhu ",
  181. no_string: "cannot ",
  182. noon_time: "NOON",
  183. noon_time: "NOON",
  184. note: "Note",
  185. now_time: "NOW",
  186. pacchā_māsa: "pacchā-māsa",
  187. pakkha: "Lunar Phases ",
  188. past: "Passed ",
  189. pubba_māsa: "pubba-māsa",
  190. ravi: "Ravi",
  191. saṃvacchara: "saṃvacchara",
  192. season: "Season ",
  193. sec: "sec ",
  194. sora: "Sora",
  195. sukka: "Sukka",
  196. sun_height_degree: "Max solar altitude ",
  197. time: "Time",
  198. twilight_time: "dawn",
  199. twilight_time: "dawn",
  200. vikala: "unsuitable time",
  201. week_day: "Day",
  202. year_0: "saṃvacchara",
  203. year_1: "- ",
  204. years: " year(s) ",
  205. yes_string: "can ",
  206. };
  207. localString["en"] = {
  208. and_another: " and ",
  209. atitude: "Atitude",
  210. BE: "Buddhist Era ",
  211. bhumma: "Bhumma",
  212. budha: "Budha",
  213. canda: "Canda",
  214. confirm: "Confirm",
  215. date: "Date",
  216. day: " day(s) ",
  217. days: " day(s) ",
  218. departure_in_detail: "departure in detail",
  219. dhamma_time: "5000 Years of the Buddha’s Dispensation ",
  220. eat: "eat",
  221. gama_entry: "entry the village",
  222. guru: "Guru",
  223. hori_ref_time: "horizontal refraction correct ",
  224. kala: "suitable time",
  225. language_select: "Language",
  226. left: "Remains ",
  227. loading: "loading…",
  228. longitude: "Longitude",
  229. māsa: "māsa",
  230. mins: "(min)",
  231. month: "Month ",
  232. month_1: "- ",
  233. months: " month(s) ",
  234. my_loc: "my location",
  235. need_inform: "without informing other Bhikkhu ",
  236. no_string: "cannot ",
  237. noon_time: "NOON",
  238. noon_time: "NOON",
  239. note: "Note",
  240. now_time: "NOW",
  241. pacchā_māsa: "pacchā-māsa",
  242. pakkha: "Lunar Phases ",
  243. past: "Passed ",
  244. pubba_māsa: "pubba-māsa",
  245. ravi: "Ravi",
  246. saṃvacchara: "saṃvacchara",
  247. season: "Season ",
  248. sec: "sec",
  249. sora: "Sora",
  250. sukka: "Sukka",
  251. sun_height_degree: "Max solar altitude ",
  252. time: "time",
  253. twilight_time: "dawn",
  254. twilight_time: "dawn",
  255. vikala: "unsuitable time",
  256. week_day: "Day",
  257. year_0: "year",
  258. year_1: "- ",
  259. years: " year(s) ",
  260. yes_string: "can ",
  261. };
  262. localString["my"] = {
  263. and_another: " and ",
  264. atitude: "Atitude",
  265. BE: "Buddhist Era ",
  266. bhumma: "ဘုမ္မ",
  267. budha: "ဗုဓ",
  268. canda: "စန္ဒ",
  269. confirm: "Confirm",
  270. date: "Date ",
  271. day: " day(s) ",
  272. days: " day(s) ",
  273. departure_in_detail: "departure in detail",
  274. dhamma_time: "5000 Years of the Buddha’s Dispensation ",
  275. eat: "eat",
  276. gama_entry: "entry the village",
  277. guru: "ဂုရု",
  278. hori_ref_time: "horizontal refraction correct ",
  279. kala: "ကာလ",
  280. language_select: "ဘာသာ",
  281. left: "Remains ",
  282. loading: "loading…",
  283. longitude: "Longitude",
  284. māsa: "မာသ",
  285. mins: "(min)",
  286. month: "Month ",
  287. month_1: "- ",
  288. months: " month(s) ",
  289. my_loc: "အတ္တသ္မိံ",
  290. need_inform: "without informing other Bhikkhu ",
  291. no_string: "cannot ",
  292. noon_time: "မဇ္ဈန္ဟိက",
  293. noon_time: "မဇ္ဈန္ဟိက",
  294. note: "Note",
  295. now_time: "ပစ္စုပ္ပန္န",
  296. pacchā_māsa: "ပစ္ဆာ-မာသ",
  297. pakkha: "Lunar Phases ",
  298. past: "Passed ",
  299. pubba_māsa: "ပုဗ္ဗ-မာသ",
  300. ravi: "ရဝိ",
  301. saṃvacchara: "သံဝစ္ဆရ",
  302. season: "Season ",
  303. sec: "sec ",
  304. sora: "သောရ",
  305. sukka: "သုက္က",
  306. sun_height_degree: "Max solar altitude ",
  307. time: "Time",
  308. twilight_time: "အရုဏုဂ္ဂမန",
  309. twilight_time: "အရုဏုဂ္ဂမန",
  310. vikala: "ဝိကာလ",
  311. week_day: "Day",
  312. year_0: "year",
  313. year_1: "- ",
  314. years: " year(s) ",
  315. yes_string: "can ",
  316. };
  317. localString["si"] = {
  318. and_another: " ච ",
  319. atitude: "Atitude",
  320. BE: "බුද්ධ වර්ෂය ",
  321. bhumma: "භුම්ම",
  322. budha: "බුධ",
  323. canda: "චන්ද",
  324. confirm: "Confirm",
  325. date: "දිවස ",
  326. day: " දිවසා(නි) ",
  327. days: " දිවසා(නි) ",
  328. departure_in_detail: "departure in detail",
  329. dhamma_time: "සම්මා සම්බුද්ධස්ස සාසනං පට්ච-වස්ස-සහස්සානි පවත්තිස්සති ",
  330. eat: "eat",
  331. gama_entry: "entry the village",
  332. guru: "ගු‍රු",
  333. hori_ref_time: "horizontal refraction correct ",
  334. kala: "කාල",
  335. language_select: "භාෂාව",
  336. left: "අවසිට්ඨ ",
  337. loading: "ප්‍රවේශනය වෙනවා ",
  338. longitude: "Longitude",
  339. māsa: "මාස",
  340. mins: "(min)",
  341. month: "මාස ",
  342. month_1: "- ",
  343. months: " මාසා(නි) ",
  344. my_loc: "අත‍්තස‍්මිං",
  345. need_inform: "without informing other Bhikkhu ",
  346. no_string: "cannot ",
  347. noon_time: "මජ්ඣන්හික",
  348. noon_time: "මජ්ඣන්හික",
  349. note: "නෝට්ටුව ",
  350. now_time: "පච්චුප්පන්න",
  351. pacchā_māsa: "පච්ඡා-මාස",
  352. pakkha: "පක්ඛ ",
  353. past: "අතික්කන්ත ",
  354. pubba_māsa: "පුබ්බ-මාස",
  355. ravi: "රවි",
  356. saṃvacchara: "සංවච්ඡ‍ර",
  357. season: "උතු ",
  358. sec: "sec",
  359. sora: "සො‍ර",
  360. sukka: "සුක්ක",
  361. sun_height_degree: "Max solar altitude ",
  362. time: "time",
  363. twilight_time: "අ‍රුණුග්ගමන",
  364. twilight_time: "අ‍රුණුග්ගමන",
  365. vikala: "විකාල",
  366. week_day: "වා‍ර ",
  367. year_0: "සංවච්ඡ‍ර",
  368. year_1: "- ",
  369. years: " සංවච්ඡ‍රා(නි) ",
  370. yes_string: "can ",
  371. };
  372. var pali_month_name = [
  373. { id: "1", value: "jeṭṭha", season: "gimhāna", season_icon: "☀" }, //5.X-四-十五-心
  374. { id: "2", value: "asāḷha", season: "gimhāna", season_icon: "☀" }, //6.X-五-十五、十六-箕、斗
  375. { id: "3", value: "sāvana", season: "vassāna", season_icon: "☔" }, //7.X-六-十五-女
  376. { id: "4", value: "poṭṭhapāda", season: "vassāna", season_icon: "☔" }, //8.x-七-十五、十六-室、壁
  377. { id: "5", value: "assajuja", season: "vassāna", season_icon: "☔" }, //9.X-八-十五-樓
  378. { id: "6", value: "kattika", season: "vassāna", season_icon: "☔" }, //10.X-九-十五-昂
  379. { id: "7", value: "māgasira", season: "hemanta", season_icon: "❄" }, //11.X-十-十五-觜
  380. { id: "8", value: "phussa", season: "hemanta", season_icon: "❄" }, //12.X-十一-十五-鬼
  381. { id: "9", value: "māgha", season: "hemanta", season_icon: "❄" }, //1.X-十二-十五-星
  382. { id: "10", value: "phagguna", season: "hemanta", season_icon: "❄" }, //2.X-正月-十四、十五-張、異
  383. { id: "11", value: "citta", season: "gimhāna", season_icon: "☀" }, //3.X-二月-十五-角
  384. { id: "12", value: "vesākha", season: "gimhāna", season_icon: "☀" }, //4.X-三月-十五-氐
  385. ];
  386. var pali_nakkhatta_name = [
  387. { id: "0", value: "assayuja", name_zh: "娄宿" },
  388. { id: "1", value: "bharaṇī", name_zh: "胃宿" },
  389. { id: "2", value: "Kattikā", name_zh: "昂宿" },
  390. { id: "3", value: "rohiṇī", name_zh: "毕宿" },
  391. { id: "4", value: "magasira", name_zh: "觜宿" },
  392. { id: "5", value: "Addā", name_zh: "参宿" },
  393. { id: "6", value: "punabbasu", name_zh: "井宿" },
  394. { id: "7", value: "phussa", name_zh: "鬼宿" },
  395. { id: "8", value: "Asilesā", name_zh: "柳宿" },
  396. { id: "9", value: "maghā", name_zh: "星宿" },
  397. { id: "10", value: "pubbaphagguṇī", name_zh: "张宿" },
  398. { id: "11", value: "uttaraphagguṇī", name_zh: "翼宿" },
  399. { id: "12", value: "hattha", name_zh: "轸宿" },
  400. { id: "13", value: "cittā", name_zh: "角宿" },
  401. { id: "14", value: "sāti", name_zh: "亢宿" },
  402. { id: "15", value: "visākhā", name_zh: "氐宿" },
  403. { id: "16", value: "anurādhā", name_zh: "房宿" },
  404. { id: "17", value: "jeṭṭha", name_zh: "心宿" },
  405. { id: "18", value: "mūlā", name_zh: "尾宿" },
  406. { id: "19", value: "pubbāsāḷha", name_zh: "箕宿" },
  407. { id: "20", value: "uttarāsāḷha", name_zh: "斗宿" },
  408. { id: "21", value: "savaṇa", name_zh: "女宿" },
  409. { id: "22", value: "dhaniṭṭhā", name_zh: "虚宿" },
  410. { id: "23", value: "satabhisaja", name_zh: "危宿" },
  411. { id: "24", value: "pubbabhaddapadā", name_zh: "室宿" },
  412. { id: "25", value: "uttarabhaddapadā", name_zh: "壁宿" },
  413. { id: "26", value: "revatī", name_zh: "奎宿" },
  414. ];
  415. var horoscope_name = [
  416. { id: "0", value: "Aries", name_zh: "白羊", icon: "♈" },
  417. { id: "1", value: "Taurus", name_zh: "金牛", icon: "♉" },
  418. { id: "2", value: "Gemini", name_zh: "双子", icon: "♊" },
  419. { id: "3", value: "Cancer", name_zh: "巨蟹", icon: "♋" },
  420. { id: "4", value: "Leo", name_zh: "狮子", icon: "♌" },
  421. { id: "5", value: "Virgo", name_zh: "处女", icon: "♍" },
  422. { id: "6", value: "Libra", name_zh: "天秤", icon: "♎" },
  423. { id: "7", value: "Scorpio", name_zh: "天蝎", icon: "♏" },
  424. { id: "8", value: "Sagittarius", name_zh: "射手", icon: "♐" },
  425. { id: "9", value: "Capricornus", name_zh: "摩羯", icon: "♑" },
  426. { id: "10", value: "Aquarius", name_zh: "水瓶", icon: "♒" },
  427. { id: "11", value: "Pisces", name_zh: "双鱼", icon: "♓" },
  428. ];
  429. </script>
  430. <style>
  431. .card {
  432. box-shadow: 0 0 10px rgba(0, 0, 0, 0.15);
  433. font-size: 1em;
  434. line-height: 1.3;
  435. }
  436. .card > .title > a,
  437. .card > .title > a:link {
  438. color: var(--main-color);
  439. }
  440. .card a:hover {
  441. color: var(--tool-link-hover-color);
  442. }
  443. .index_inner {
  444. width: 960px;
  445. margin-left: auto;
  446. margin-right: auto;
  447. }
  448. .table_line {
  449. display: flex;
  450. border-bottom: solid;
  451. }
  452. .table_column {
  453. flex: 1;
  454. }
  455. .correct {
  456. background-color: gold;
  457. }
  458. </style>
  459. <title id="title_text"> </title>
  460. </head>
  461. <body>
  462. <!--多语言范例
  463. <script>
  464. document.write(localString["language"].XXXX);
  465. </script>
  466. -->
  467. <div id="position_change">
  468. <span id="selected_position_string">
  469. <script>
  470. document.write(localString[g_language].loading);
  471. //localString[g_language].loading;
  472. </script>
  473. </span>
  474. <!--自动定位-->
  475. <button onclick="getLocation()" style="font-size: 100%; padding: 2px 6px">
  476. <svg class="icon" style="min-width: 1.8em; min-height: 1.8em">
  477. <path
  478. 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"
  479. />
  480. </svg>
  481. <script>
  482. document.write(localString[g_language].my_loc);
  483. //localString[g_language].my_loc
  484. </script>
  485. </button>
  486. <input id="input_time" type="datetime-local" />
  487. </div>
  488. <div>
  489. <div onclick="show_time()">Sun time table</div>
  490. <div>破晓<span id="today_dawn"></span></div>
  491. <div>正午<span id="today_solarNoon"></span></div>
  492. <div>日落<span id="today_sunset"></span></div>
  493. <div>月相<span id="today_moon_phase"></span></div>
  494. <div>圆满度<span id="today_moon_percent"></span></div>
  495. <div>太阳相位于南偏西<span id="today_sun_azimuth"></span></div>
  496. <div>月亮相位于北偏东<span id="today_moon_azimuth"></span></div>
  497. <div>日月角<span id="angle_sun_e_moon"></span></div>
  498. <div>月相角<span id="today_moon_angle"></span></div>
  499. <div>当前时间<span id="curr_time"></span></div>
  500. <div>现在时间<span id="now_time"></span></div>
  501. <div>当前時間戳<span id="curr_time_unix"></span></div>
  502. <div>地球角度<span id="earth_angle"></span></div>
  503. <div>月亮角度<span id="moon_angle"></span></div>
  504. <div>月亮角度2<span id="moon_angle2"></span></div>
  505. <div>
  506. <span>精准月相时间及星宿(强化戒德之日)</span>
  507. <table id="lunar_phase_list" style="max-width: 70vw; width: -webkit-fill-available"></table>
  508. </div>
  509. </div>
  510. <script>
  511. var current_phase = phase();
  512. console.log(current_phase); //输出到控制台
  513. $("#title_text").html(localString[g_language].BE);
  514. var new_list = new Array(); //新月列表
  515. var first_list = new Array(); //上弦月列表
  516. var full_list = new Array(); //满月列表
  517. var last_list = new Array(); //下弦月列表
  518. var planets = new Array(); //
  519. var lunar_position = new Object();
  520. var g_coordinate_this = new Object();
  521. var g_now_date = new Date();
  522. var today = new Date();
  523. var start_day = new Date();
  524. var next_year = new Date();
  525. var sun_times = new Object();
  526. var curr_position = localStorage.getItem("local_position");
  527. if (curr_position) {
  528. g_coordinate_this.AT = curr_position.split("#")[0];
  529. g_coordinate_this.LT = curr_position.split("#")[1];
  530. g_coordinate_this.height = curr_position.split("#")[2];
  531. if (g_coordinate_this.AT >= 0) {
  532. var AT_string = angle_trans(g_coordinate_this.AT) + "N";
  533. } else {
  534. var AT_string = angle_trans(g_coordinate_this.AT) + "S";
  535. }
  536. if (g_coordinate_this.LT >= 0) {
  537. var LT_string = angle_trans(g_coordinate_this.LT) + "E";
  538. } else {
  539. var LT_string = angle_trans(g_coordinate_this.LT) + "W";
  540. }
  541. let height_string = g_coordinate_this.height + "M";
  542. $("#selected_position_string").html(AT_string + " " + LT_string + " " + height_string);
  543. } else {
  544. getLocation();
  545. }
  546. function show_time() {
  547. if ($("#input_time").val()) {
  548. today = new Date($("#input_time").val());
  549. } else {
  550. today = g_now_date;
  551. }
  552. if (phase(today).phase <= 0.5) {
  553. start_day.setDate(today.getDate() - 16); //退到本月的新月之前
  554. start_day = phaseHunt(start_day).full_date; //得到之前最近的满月日
  555. start_day.setDate(start_day.getDate() + 1);
  556. } else {
  557. start_day.setDate(today.getDate() - 31); //退到本月的新月之前
  558. start_day = phaseHunt(start_day).full_date; //得到之前最近的满月日
  559. start_day.setDate(start_day.getDate() + 1);
  560. }
  561. next_year.setDate(start_day.getDate() + 360);
  562. last_list = phaseRange(start_day, next_year, LAST); //获取下弦月列表
  563. new_list = phaseRange(start_day, next_year, NEW); //获取新月列表
  564. first_list = phaseRange(start_day, next_year, FIRST); //获取上弦月列表
  565. full_list = phaseRange(start_day, next_year, FULL); //获取满月列表
  566. console.log(last_list); //输出到控制台
  567. console.log(new_list); //输出到控制台
  568. console.log(first_list); //输出到控制台
  569. console.log(full_list); //输出到控制台
  570. lunar_phase_list_refresh();
  571. get_position(today);
  572. let d_earth_to_moon =
  573. lunar_position.position.x ^
  574. (2 + lunar_position.position.y) ^
  575. (2 + lunar_position.position.z) ^
  576. 2 ^
  577. 0.5;
  578. let d_earth_to_moon_0 = phase(today).distance;
  579. sun_times = SunCalc.getTimes(
  580. today,
  581. g_coordinate_this.AT,
  582. g_coordinate_this.LT,
  583. g_coordinate_this.height / 1000
  584. );
  585. sun_position = SunCalc.getPosition(today, g_coordinate_this.AT, g_coordinate_this.LT);
  586. moon_position = SunCalc.getMoonPosition(today, g_coordinate_this.AT, g_coordinate_this.LT);
  587. moon_Illumination = SunCalc.getMoonIllumination(today);
  588. $("#today_dawn").html(sun_times.dawn.toLocaleTimeString());
  589. $("#today_solarNoon").html(sun_times.solarNoon.toLocaleTimeString());
  590. $("#today_sunset").html(sun_times.sunset.toLocaleTimeString());
  591. $("#today_sun_azimuth").html(angle_trans((sun_position.azimuth / Math.PI) * 180)); //太阳水平弧度
  592. $("#today_moon_azimuth").html(angle_trans((moon_position.azimuth / Math.PI) * 180)); //月亮水平弧度
  593. $("#today_moon_phase").html(phase(today).phase); //月相值
  594. $("#today_moon_percent").html(phase(today).illuminated); //月照度
  595. $("#today_moon_angle").html(angle_trans((moon_Illumination.angle / Math.PI) * 180)); //月相角
  596. $("#angle_sun_e_moon").html(
  597. angle_trans((Math.abs(Math.PI + sun_position.azimuth - moon_position.azimuth) / Math.PI) * 180)
  598. ); //月亮水平弧度
  599. $("#curr_time").html(today.toLocaleTimeString()); //当前时间
  600. $("#now_time").html(g_now_date.toLocaleTimeString()); //现在
  601. $("#curr_time_unix").html(today.getTime()); //時間戳
  602. let earth_angle_string = "";
  603. earth_angle_string += get_position(today).solar_position_angle + "——";
  604. earth_angle_string += get_position(today).solar_position_angle_round + "——";
  605. earth_angle_string += get_position(today).solar_station + "——";
  606. earth_angle_string += get_station_name(today).solar.icon;
  607. $("#earth_angle").html(earth_angle_string); //地球角度
  608. let moon_angle_string = "";
  609. moon_angle_string += get_position(today).lunar_position_angle + "——";
  610. moon_angle_string += get_position(today).lunar_position_angle_round + "——";
  611. moon_angle_string += get_position(today).lunar_station + "——";
  612. moon_angle_string += get_station_name(today).lunar.value;
  613. $("#moon_angle").html(moon_angle_string); //月亮角度——角度差算法
  614. let moon_angle_string2 = "";
  615. moon_angle_string2 += get_position(today).lunar_position_angle2 + "——";
  616. moon_angle_string2 += get_position(today).lunar_position_angle_round2 + "——";
  617. moon_angle_string2 += get_position(today).lunar_station2 + "——";
  618. moon_angle_string2 += get_station_name(today).lunar.value;
  619. $("#moon_angle2").html(moon_angle_string2); //月亮角度——向量差算法
  620. }
  621. function get_position(date_time) {
  622. let planets_position = new Object();
  623. planets = window.lagrange.planet_positions.getPositions(date_time);
  624. //planets = global.planet_positions.getPositions(today);
  625. //console.log(planets)//输出到控制台
  626. earth_position = window.lagrange.planet_positions.getPositions(date_time)[3];
  627. lunar_position = window.lagrange.planet_positions.getPositions(date_time)[11];
  628. let lunar_position_angle = 0;
  629. let lunar_station = 0;
  630. let earth_position_angle = 0;
  631. let earth_station = 0;
  632. let earth_position_angle_round = 0;
  633. let lunar_position_angle_round = 0;
  634. //太阳相对地球的黄道偏角
  635. if (earth_position.position.y >= 0) {
  636. earth_position_angle = Math.atan2(earth_position.position.y, earth_position.position.x);
  637. } else {
  638. earth_position_angle =
  639. Math.PI * 2 + Math.atan2(earth_position.position.y, earth_position.position.x);
  640. }
  641. earth_position_angle_round = earth_position_angle / Math.PI / 2 + 0.5;
  642. earth_position_angle_round = earth_position_angle_round - Math.floor(earth_position_angle_round);
  643. earth_station = earth_position_angle_round * 12;
  644. planets_position.solar_station = earth_station;
  645. planets_position.solar_position_angle = earth_position_angle_round * Math.PI * 2;
  646. planets_position.solar_position_angle_round = earth_position_angle_round;
  647. //月球相对地球的黄道偏角——角度差算法
  648. lunar_position_angle_round = earth_position_angle_round + phase(date_time).phase;
  649. lunar_position_angle_round = lunar_position_angle_round - Math.floor(lunar_position_angle_round);
  650. lunar_position_angle = lunar_position_angle_round * Math.PI * 2;
  651. lunar_station = lunar_position_angle_round * 27;
  652. //月球相对地球的黄道偏角算法——向量差算法
  653. let lunar_to_earth = new Object();
  654. lunar_to_earth.y = lunar_position.position.y - earth_position.position.y;
  655. lunar_to_earth.x = lunar_position.position.x - earth_position.position.x;
  656. if (lunar_to_earth.y >= 0) {
  657. lunar_position_angle2 = Math.atan2(lunar_to_earth.y, lunar_to_earth.x);
  658. } else {
  659. lunar_position_angle2 = Math.PI * 2 + Math.atan2(lunar_to_earth.y, lunar_to_earth.x);
  660. }
  661. lunar_position_angle_round2 = lunar_position_angle2 / Math.PI / 2;
  662. //lunar_position_angle_round = lunar_position_angle_round - Math.floor(lunar_position_angle_round)
  663. lunar_position_angle2 = lunar_position_angle_round2 * Math.PI * 2;
  664. lunar_station2 = lunar_position_angle_round2 * 27;
  665. planets_position.lunar_station = lunar_station;
  666. planets_position.lunar_position_angle = lunar_position_angle;
  667. planets_position.lunar_position_angle_round = lunar_position_angle_round;
  668. planets_position.lunar_station2 = lunar_station2;
  669. planets_position.lunar_position_angle2 = lunar_position_angle2;
  670. planets_position.lunar_position_angle_round2 = lunar_position_angle_round2;
  671. return planets_position;
  672. }
  673. function get_station_name(data_time) {
  674. //获取星象信息
  675. let solar_num = 0;
  676. let lunar_num = 0;
  677. solar_num = get_position(data_time).solar_station;
  678. solar_num = Math.floor(solar_num);
  679. lunar_num = get_position(data_time).lunar_station;
  680. lunar_num = Math.floor(lunar_num);
  681. let result = new Object();
  682. result.solar = horoscope_name[solar_num];
  683. result.lunar = pali_nakkhatta_name[lunar_num];
  684. return result;
  685. }
  686. function lunar_phase_list_refresh() {
  687. let output = "";
  688. //画表头
  689. output += "<tr class='table_line'>";
  690. output += "<th class='table_column'>月份</th>";
  691. output += "<th class='table_column'>下弦</th>";
  692. output += "<th class='table_column'>新月(诵戒)</th>";
  693. output += "<th class='table_column'>上弦</th>";
  694. output += "<th class='table_column'>满月(诵戒)</th>";
  695. output += "</tr>";
  696. //画内容
  697. let month_num = Math.min(last_list.length, new_list.length, first_list.length, full_list.length);
  698. for (let i_month = 0; i_month < month_num; i_month++) {
  699. output += "<tr class='table_line'>";
  700. output += "<td class='table_column'>";
  701. output += Math.round(get_position(full_list[i_month]).solar_station * 100) / 100;
  702. //output += "—"
  703. //output += get_station_name(full_list[i_month]).lunar.value
  704. //output += "—"
  705. //output += get_station_name(full_list[i_month]).solar.name_zh
  706. //output += "—"
  707. //output += get_station_name(full_list[i_month]).solar.icon
  708. output += "</td>";
  709. //下弦月
  710. if (
  711. SunCalc.getTimes(
  712. last_list[i_month],
  713. g_coordinate_this.AT,
  714. g_coordinate_this.LT,
  715. g_coordinate_this.height / 1000
  716. ).dawn -
  717. last_list[i_month] <=
  718. 0
  719. ) {
  720. //如果在破晓之后,不修正
  721. output += "<td class='table_column' title='" + last_list[i_month].toLocaleTimeString() + "'>";
  722. output += last_list[i_month].toLocaleDateString();
  723. output += "<br />";
  724. output += get_station_name(last_list[i_month]).lunar.value;
  725. //output += Math.round(get_position(last_list[i_month]).lunar_station * 100) / 100
  726. output += "</td>";
  727. } else {
  728. //如果在破晓之前,修正提前一天
  729. output +=
  730. "<td class='table_column correct' title='" + last_list[i_month].toLocaleString() + "'>";
  731. let temp_date = last_list[i_month];
  732. temp_date.setDate(temp_date.getDate() - 1);
  733. output += temp_date.toLocaleDateString();
  734. output += "<br />";
  735. output += get_station_name(last_list[i_month]).lunar.value;
  736. //output += Math.round(get_position(last_list[i_month]).lunar_station * 100) / 100
  737. output += "</td>";
  738. }
  739. //新月
  740. if (
  741. SunCalc.getTimes(
  742. new_list[i_month],
  743. g_coordinate_this.AT,
  744. g_coordinate_this.LT,
  745. g_coordinate_this.height / 1000
  746. ).dawn -
  747. new_list[i_month] <=
  748. 0
  749. ) {
  750. //如果在破晓之后,不修正
  751. output += "<td class='table_column' title='" + new_list[i_month].toLocaleTimeString() + "'>";
  752. output += new_list[i_month].toLocaleDateString();
  753. output += "<br />";
  754. output += get_station_name(new_list[i_month]).lunar.value;
  755. //output += Math.round(get_position(new_list[i_month]).lunar_station * 100) / 100
  756. output += "</td>";
  757. } else {
  758. //如果在破晓之前,修正提前一天
  759. output +=
  760. "<td class='table_column correct' title='" + new_list[i_month].toLocaleString() + "'>";
  761. let temp_date = new_list[i_month];
  762. temp_date.setDate(temp_date.getDate() - 1);
  763. output += temp_date.toLocaleDateString();
  764. output += "<br />";
  765. output += get_station_name(new_list[i_month]).lunar.value;
  766. //output += Math.round(get_position(new_list[i_month]).lunar_station * 100) / 100
  767. output += "</td>";
  768. }
  769. //上弦月
  770. if (
  771. SunCalc.getTimes(
  772. first_list[i_month],
  773. g_coordinate_this.AT,
  774. g_coordinate_this.LT,
  775. g_coordinate_this.height / 1000
  776. ).dawn -
  777. first_list[i_month] <=
  778. 0
  779. ) {
  780. //如果在破晓之后,不修正
  781. output += "<td class='table_column' title='" + first_list[i_month].toLocaleTimeString() + "'>";
  782. output += first_list[i_month].toLocaleDateString();
  783. output += "<br />";
  784. output += get_station_name(first_list[i_month]).lunar.value;
  785. //output += Math.round(get_position(first_list[i_month]).lunar_station * 100) / 100
  786. output += "</td>";
  787. } else {
  788. //如果在破晓之前,修正提前一天
  789. output +=
  790. "<td class='table_column correct' title='" + first_list[i_month].toLocaleString() + "'>";
  791. let temp_date = first_list[i_month];
  792. temp_date.setDate(temp_date.getDate() - 1);
  793. output += temp_date.toLocaleDateString();
  794. output += "<br />";
  795. output += get_station_name(first_list[i_month]).lunar.value;
  796. //output += Math.round(get_position(first_list[i_month]).lunar_station * 100) / 100
  797. output += "</td>";
  798. }
  799. //满月
  800. if (
  801. SunCalc.getTimes(
  802. full_list[i_month],
  803. g_coordinate_this.AT,
  804. g_coordinate_this.LT,
  805. g_coordinate_this.height / 1000
  806. ).dawn -
  807. full_list[i_month] <=
  808. 0
  809. ) {
  810. //如果在破晓之后,不修正
  811. output += "<td class='table_column' title='" + full_list[i_month].toLocaleTimeString() + "'>";
  812. output += full_list[i_month].toLocaleDateString();
  813. output += "<br />";
  814. output += get_station_name(full_list[i_month]).lunar.value;
  815. //output += Math.round(get_position(full_list[i_month]).lunar_station * 100) / 100
  816. output += "</td>";
  817. } else {
  818. //如果在破晓之前,修正提前一天
  819. output +=
  820. "<td class='table_column correct' title='" + full_list[i_month].toLocaleString() + "'>";
  821. let temp_date = full_list[i_month];
  822. temp_date.setDate(temp_date.getDate() - 1);
  823. output += temp_date.toLocaleDateString();
  824. output += "<br />";
  825. output += get_station_name(full_list[i_month]).lunar.value;
  826. //output += Math.round(get_position(full_list[i_month]).lunar_station * 100) / 100
  827. output += "</td>";
  828. }
  829. output += "</tr>";
  830. }
  831. $("#lunar_phase_list").html(output);
  832. }
  833. function getLocation() {
  834. //自动定位
  835. if (navigator.geolocation) {
  836. navigator.geolocation.getCurrentPosition(showPosition, showError);
  837. } else {
  838. $("#selected_position_string").html("Geolocation is not supported by this browser.");
  839. }
  840. }
  841. function showPosition(position) {
  842. alert("get cordinate success");
  843. g_coordinate_this.AT = position.coords.latitude; //纬度
  844. g_coordinate_this.LT = position.coords.longitude; //经度
  845. g_coordinate_this.height = position.coords.altitude; //海拔高度
  846. let position_string =
  847. g_coordinate_this.AT + "#" + g_coordinate_this.LT + "#" + g_coordinate_this.height;
  848. localStorage.setItem("local_position", position_string);
  849. if (g_coordinate_this.AT >= 0) {
  850. var AT_string = angle_trans(g_coordinate_this.AT) + "N";
  851. } else {
  852. var AT_string = angle_trans(g_coordinate_this.AT) + "S";
  853. }
  854. if (g_coordinate_this.LT >= 0) {
  855. var LT_string = angle_trans(g_coordinate_this.LT) + "E";
  856. } else {
  857. var LT_string = angle_trans(g_coordinate_this.LT) + "W";
  858. }
  859. let height_string = g_coordinate_this.height + "M";
  860. $("#selected_position_string").html(AT_string + " " + LT_string + " " + height_string);
  861. }
  862. function showError(error) {
  863. switch (error.code) {
  864. case error.PERMISSION_DENIED:
  865. alert("定位失败,用户拒绝请求地理定位");
  866. break;
  867. case error.POSITION_UNAVAILABLE:
  868. alert("定位失败,位置信息是不可用");
  869. break;
  870. case error.TIMEOUT:
  871. alert("定位失败,请求获取用户位置超时");
  872. break;
  873. case error.UNKNOWN_ERROR:
  874. alert("定位失败,定位系统失效");
  875. break;
  876. }
  877. }
  878. function angle_trans(angle) {
  879. var angle_str = "";
  880. var num_d = Math.floor(angle);
  881. var num_m = Math.floor((angle - num_d) * 60);
  882. var num_s = Math.round((angle - num_d) * 60 - num_m);
  883. if (num_d != 0) {
  884. angle_str += num_d + "°";
  885. }
  886. if (num_m != 0) {
  887. angle_str += num_m + "’";
  888. }
  889. if (num_s != 0) {
  890. angle_str += num_s + "”";
  891. }
  892. return angle_str;
  893. }
  894. </script>
  895. </body>
  896. </html>