index1.html 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685
  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 type="text/css" rel="stylesheet" href="../pcdl/css/style_mobile.css" media="screen and (max-width:767px)">
  11. <script src="../public/js/jquery.js"></script>
  12. <script src="../public/js/comm.js"></script>
  13. <script src="jquery-3.3.1.min.js"></script>
  14. <script src="julian.js"></script>
  15. <script src="lune.js"></script>
  16. <script src="suncalc.js"></script>
  17. <script src="../studio/js/fixedsticky.js"></script>
  18. <script src="../guide/guide.js"></script>
  19. <link type="text/css" rel="stylesheet" href="../guide/guide.css" />
  20. <script src="../public/js/marked.js"></script>
  21. <!--获取语言-->
  22. <script>
  23. var g_language = "en";
  24. var g_currLink = "";
  25. function lang_init(strPage) {
  26. g_currLink = strPage;
  27. }
  28. function setLang(strLang) {
  29. g_language = strLang;
  30. setCookie('language', g_language, 365);
  31. window.location.assign(location.pathname + "?language=" + g_language);
  32. }
  33. </script>
  34. <script>
  35. var localString = new Array();
  36. localString["zh-cn"] = {
  37. "and_another": "又 ",
  38. "atitude": "纬度",
  39. "BE": "佛历",
  40. "bhumma": "周二",
  41. "budha": "周三",
  42. "canda": "周一",
  43. "confirm": "确认",
  44. "date": "日期",
  45. "day": "日",
  46. "days": "天 ",
  47. "departure_in_detail": "起飞详情",
  48. "dhamma_time": "会延续五千年的教法 ",
  49. "eat": "进餐",
  50. "gama_entry": "入村",
  51. "guru": "周四",
  52. "hori_ref_time": "蒙气差修正 ",
  53. "kala": "适当的时间",
  54. "language_select": "选择语言",
  55. "left": "还剩下",
  56. "loading": "载入中……",
  57. "longitude": "经度",
  58. "māsa": "月",
  59. "mins": "分钟",
  60. "month": "月 ",
  61. "month_1": "月 ",
  62. "months": "个月 ",
  63. "my_loc": "我的位置",
  64. "need_inform": "未告知其他比库",
  65. "no_string": "不能",
  66. "noon_time": "正午",
  67. "noon_time": "正午",
  68. "note": "注释",
  69. "now_time": "现在",
  70. "pacchā_māsa": "下个月",
  71. "pakkha": "月相变化 ",
  72. "past": "已过去",
  73. "pubba_māsa": "上个月",
  74. "ravi": "周日",
  75. "saṃvacchara": "年",
  76. "season": "季节 ",
  77. "sec": "秒",
  78. "sora": "周六",
  79. "sukka": "周五",
  80. "sun_height_degree": "正午太阳高度 ",
  81. "time": "时间",
  82. "twilight_time": "曙光",
  83. "twilight_time": "曙光",
  84. "vikala": "不适当的时间",
  85. "week_day": "星期",
  86. "year_0": "年",
  87. "year_1": "年 ",
  88. "years": "年 ",
  89. "yes_string": "可以"
  90. };
  91. localString["zh-tw"] = {
  92. "and_another": "又 ",
  93. "atitude": "緯度",
  94. "BE": "佛曆",
  95. "bhumma": "週二",
  96. "budha": "週三",
  97. "canda": "週一",
  98. "confirm": "確認",
  99. "date": "日期",
  100. "day": "日",
  101. "days": "天 ",
  102. "departure_in_detail": "起飛詳情",
  103. "dhamma_time": "會延續五千年的教法 ",
  104. "eat": "進餐",
  105. "gama_entry": "入村",
  106. "guru": "週四",
  107. "hori_ref_time": "蒙氣差修正 ",
  108. "kala": "適當的時間",
  109. "language_select": "選擇語言",
  110. "left": "還剩下",
  111. "loading": "載入中……",
  112. "longitude": "經度",
  113. "māsa": "月",
  114. "mins": "分鐘",
  115. "month": "月 ",
  116. "month_1": "月 ",
  117. "months": "個月 ",
  118. "my_loc": "我的位置",
  119. "need_inform": "未告知其他比庫",
  120. "no_string": "不能",
  121. "noon_time": "正午",
  122. "noon_time": "正午",
  123. "note": "註釋",
  124. "now_time": "現在",
  125. "pacchā_māsa": "下個月",
  126. "pakkha": "月相變化 ",
  127. "past": "已過去",
  128. "pubba_māsa": "上個月",
  129. "ravi": "週日",
  130. "saṃvacchara": "年",
  131. "season": "季節 ",
  132. "sec": "秒",
  133. "sora": "週六",
  134. "sukka": "週五",
  135. "sun_height_degree": "正午太陽高度 ",
  136. "time": "時間",
  137. "twilight_time": "曙光",
  138. "twilight_time": "曙光",
  139. "vikala": "不適當的時間",
  140. "week_day": "星期",
  141. "year_0": "年",
  142. "year_1": "年 ",
  143. "years": "年 ",
  144. "yes_string": "可以"
  145. };
  146. localString["default"] = {
  147. "and_another": " and ",
  148. "atitude": "Atitude",
  149. "BE": "Buddhist Era ",
  150. "bhumma": "Bhumma",
  151. "budha": "Budha",
  152. "canda": "Canda",
  153. "confirm": "Confirm",
  154. "date": "Date ",
  155. "day": " day(s) ",
  156. "days": " day(s) ",
  157. "departure_in_detail": "departure in detail",
  158. "dhamma_time": "5000 Years of the Buddha’s Dispensation ",
  159. "eat": "eat",
  160. "gama_entry": "entry the village",
  161. "guru": "Guru",
  162. "hori_ref_time": "horizontal refraction correct ",
  163. "kala": "suitable time",
  164. "language_select": "bhāsā",
  165. "left": "Remains ",
  166. "loading": "loading…",
  167. "longitude": "Longitude",
  168. "māsa": "māsa",
  169. "mins": "(min)",
  170. "month": "Month ",
  171. "month_1": "- ",
  172. "months": " month(s) ",
  173. "my_loc": "attasmiṃ",
  174. "need_inform": "without informing other Bhikkhu ",
  175. "no_string": "cannot ",
  176. "noon_time": "NOON",
  177. "noon_time": "NOON",
  178. "note": "Note",
  179. "now_time": "NOW",
  180. "pacchā_māsa": "pacchā-māsa",
  181. "pakkha": "Lunar Phases ",
  182. "past": "Passed ",
  183. "pubba_māsa": "pubba-māsa",
  184. "ravi": "Ravi",
  185. "saṃvacchara": "saṃvacchara",
  186. "season": "Season ",
  187. "sec": "sec ",
  188. "sora": "Sora",
  189. "sukka": "Sukka",
  190. "sun_height_degree": "Max solar altitude ",
  191. "time": "Time",
  192. "twilight_time": "dawn",
  193. "twilight_time": "dawn",
  194. "vikala": "unsuitable time",
  195. "week_day": "Day",
  196. "year_0": "saṃvacchara",
  197. "year_1": "- ",
  198. "years": " year(s) ",
  199. "yes_string": "can "
  200. };
  201. localString["en"] = {
  202. "and_another": " and ",
  203. "atitude": "Atitude",
  204. "BE": "Buddhist Era ",
  205. "bhumma": "Bhumma",
  206. "budha": "Budha",
  207. "canda": "Canda",
  208. "confirm": "Confirm",
  209. "date": "Date",
  210. "day": " day(s) ",
  211. "days": " day(s) ",
  212. "departure_in_detail": "departure in detail",
  213. "dhamma_time": "5000 Years of the Buddha’s Dispensation ",
  214. "eat": "eat",
  215. "gama_entry": "entry the village",
  216. "guru": "Guru",
  217. "hori_ref_time": "horizontal refraction correct ",
  218. "kala": "suitable time",
  219. "language_select": "Language",
  220. "left": "Remains ",
  221. "loading": "loading…",
  222. "longitude": "Longitude",
  223. "māsa": "māsa",
  224. "mins": "(min)",
  225. "month": "Month ",
  226. "month_1": "- ",
  227. "months": " month(s) ",
  228. "my_loc": "my location",
  229. "need_inform": "without informing other Bhikkhu ",
  230. "no_string": "cannot ",
  231. "noon_time": "NOON",
  232. "noon_time": "NOON",
  233. "note": "Note",
  234. "now_time": "NOW",
  235. "pacchā_māsa": "pacchā-māsa",
  236. "pakkha": "Lunar Phases ",
  237. "past": "Passed ",
  238. "pubba_māsa": "pubba-māsa",
  239. "ravi": "Ravi",
  240. "saṃvacchara": "saṃvacchara",
  241. "season": "Season ",
  242. "sec": "sec",
  243. "sora": "Sora",
  244. "sukka": "Sukka",
  245. "sun_height_degree": "Max solar altitude ",
  246. "time": "time",
  247. "twilight_time": "dawn",
  248. "twilight_time": "dawn",
  249. "vikala": "unsuitable time",
  250. "week_day": "Day",
  251. "year_0": "year",
  252. "year_1": "- ",
  253. "years": " year(s) ",
  254. "yes_string": "can "
  255. };
  256. localString["my"] = {
  257. "and_another": " and ",
  258. "atitude": "Atitude",
  259. "BE": "Buddhist Era ",
  260. "bhumma": "ဘုမ္မ",
  261. "budha": "ဗုဓ",
  262. "canda": "စန္ဒ",
  263. "confirm": "Confirm",
  264. "date": "Date ",
  265. "day": " day(s) ",
  266. "days": " day(s) ",
  267. "departure_in_detail": "departure in detail",
  268. "dhamma_time": "5000 Years of the Buddha’s Dispensation ",
  269. "eat": "eat",
  270. "gama_entry": "entry the village",
  271. "guru": "ဂုရု",
  272. "hori_ref_time": "horizontal refraction correct ",
  273. "kala": "ကာလ",
  274. "language_select": "ဘာသာ",
  275. "left": "Remains ",
  276. "loading": "loading…",
  277. "longitude": "Longitude",
  278. "māsa": "မာသ",
  279. "mins": "(min)",
  280. "month": "Month ",
  281. "month_1": "- ",
  282. "months": " month(s) ",
  283. "my_loc": "အတ္တသ္မိံ",
  284. "need_inform": "without informing other Bhikkhu ",
  285. "no_string": "cannot ",
  286. "noon_time": "မဇ္ဈန္ဟိက",
  287. "noon_time": "မဇ္ဈန္ဟိက",
  288. "note": "Note",
  289. "now_time": "ပစ္စုပ္ပန္န",
  290. "pacchā_māsa": "ပစ္ဆာ-မာသ",
  291. "pakkha": "Lunar Phases ",
  292. "past": "Passed ",
  293. "pubba_māsa": "ပုဗ္ဗ-မာသ",
  294. "ravi": "ရဝိ",
  295. "saṃvacchara": "သံဝစ္ဆရ",
  296. "season": "Season ",
  297. "sec": "sec ",
  298. "sora": "သောရ",
  299. "sukka": "သုက္က",
  300. "sun_height_degree": "Max solar altitude ",
  301. "time": "Time",
  302. "twilight_time": "အရုဏုဂ္ဂမန",
  303. "twilight_time": "အရုဏုဂ္ဂမန",
  304. "vikala": "ဝိကာလ",
  305. "week_day": "Day",
  306. "year_0": "year",
  307. "year_1": "- ",
  308. "years": " year(s) ",
  309. "yes_string": "can "
  310. };
  311. localString["si"] = {
  312. "and_another": " ච ",
  313. "atitude": "Atitude",
  314. "BE": "බුද්ධ වර්ෂය ",
  315. "bhumma": "භුම්ම",
  316. "budha": "බුධ",
  317. "canda": "චන්ද",
  318. "confirm": "Confirm",
  319. "date": "දිවස ",
  320. "day": " දිවසා(නි) ",
  321. "days": " දිවසා(නි) ",
  322. "departure_in_detail": "departure in detail",
  323. "dhamma_time": "සම්මා සම්බුද්ධස්ස සාසනං පට්ච-වස්ස-සහස්සානි පවත්තිස්සති ",
  324. "eat": "eat",
  325. "gama_entry": "entry the village",
  326. "guru": "ගු‍රු",
  327. "hori_ref_time": "horizontal refraction correct ",
  328. "kala": "කාල",
  329. "language_select": "භාෂාව",
  330. "left": "අවසිට්ඨ ",
  331. "loading": "ප්‍රවේශනය වෙනවා ",
  332. "longitude": "Longitude",
  333. "māsa": "මාස",
  334. "mins": "(min)",
  335. "month": "මාස ",
  336. "month_1": "- ",
  337. "months": " මාසා(නි) ",
  338. "my_loc": "අත‍්තස‍්මිං",
  339. "need_inform": "without informing other Bhikkhu ",
  340. "no_string": "cannot ",
  341. "noon_time": "මජ්ඣන්හික",
  342. "noon_time": "මජ්ඣන්හික",
  343. "note": "නෝට්ටුව ",
  344. "now_time": "පච්චුප්පන්න",
  345. "pacchā_māsa": "පච්ඡා-මාස",
  346. "pakkha": "පක්ඛ ",
  347. "past": "අතික්කන්ත ",
  348. "pubba_māsa": "පුබ්බ-මාස",
  349. "ravi": "රවි",
  350. "saṃvacchara": "සංවච්ඡ‍ර",
  351. "season": "උතු ",
  352. "sec": "sec",
  353. "sora": "සො‍ර",
  354. "sukka": "සුක්ක",
  355. "sun_height_degree": "Max solar altitude ",
  356. "time": "time",
  357. "twilight_time": "අ‍රුණුග්ගමන",
  358. "twilight_time": "අ‍රුණුග්ගමන",
  359. "vikala": "විකාල",
  360. "week_day": "වා‍ර ",
  361. "year_0": "සංවච්ඡ‍ර",
  362. "year_1": "- ",
  363. "years": " සංවච්ඡ‍රා(නි) ",
  364. "yes_string": "can "
  365. };
  366. </script>
  367. <style>
  368. .card {
  369. box-shadow: 0 0 10px rgba(0, 0, 0, 0.15);
  370. font-size: 1em;
  371. line-height: 1.3;
  372. }
  373. .card>.title>a,
  374. .card>.title>a:link {
  375. color: var(--main-color);
  376. }
  377. .card a:hover {
  378. color: var(--tool-link-hover-color);
  379. }
  380. .index_inner {
  381. width: 960px;
  382. margin-left: auto;
  383. margin-right: auto;
  384. }
  385. .table_line {
  386. display: flex;
  387. border-bottom: solid;
  388. }
  389. .table_column {
  390. flex: 1;
  391. }
  392. .correct {
  393. background-color: gold;
  394. }
  395. </style>
  396. <title id='title_text'>
  397. </title>
  398. </head>
  399. <body>
  400. <!--多语言范例
  401. <script>
  402. document.write(localString["language"].XXXX);
  403. </script>
  404. -->
  405. <div id='position_change'>
  406. <span id='selected_position_string'>
  407. <script>
  408. document.write(localString[g_language].loading);
  409. //localString[g_language].loading;
  410. </script>
  411. </span>
  412. <!--自动定位-->
  413. <button onclick='getLocation()' style='font-size: 100%; padding: 2px 6px;'>
  414. <svg class='icon' style='min-width: 1.8em; min-height: 1.8em;'>
  415. <path
  416. 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' />
  417. </svg>
  418. <script>
  419. document.write(localString[g_language].my_loc);
  420. //localString[g_language].my_loc
  421. </script>
  422. </button>
  423. <input id="input_time" type="datetime-local">
  424. </div>
  425. <div>
  426. <div onclick="show_time()">Sun time table</div>
  427. <div>破晓<span id="today_dawn"></span></div>
  428. <div>正午<span id="today_solarNoon"></span></div>
  429. <div>日落<span id="today_sunset"></span></div>
  430. <div>月相<span id="today_moon_phase"></span></div>
  431. <div>圆满度<span id="today_moon_percent"></span></div>
  432. <div>太阳相位于南偏西<span id="today_sun_azimuth"></span></div>
  433. <div>月亮相位于北偏东<span id="today_moon_azimuth"></span></div>
  434. <div>日月角<span id="angle_sun_e_moon"></span></div>
  435. <div>月相角<span id="today_moon_angle"></span></div>
  436. <div>当前时间<span id="curr_time"></span></div>
  437. <div>现在时间<span id="now_time"></span></div>
  438. <div>
  439. <span>精准月相(强化戒德之日)</span>
  440. <table id="lunar_phase_list" style="min-width: 40vw;">
  441. </table>
  442. </div>
  443. </div>
  444. <script>
  445. var current_phase = phase()
  446. console.log(current_phase)//输出到控制台
  447. $("#title_text").html(localString[g_language].BE);
  448. var new_list = new Array()//新月列表
  449. var first_list = new Array()//上弦月列表
  450. var full_list = new Array()//满月列表
  451. var last_list = new Array()//下弦月列表
  452. var g_coordinate_this = new Object();
  453. var g_now_date = new Date();
  454. var today = new Date()
  455. var start_day = new Date()
  456. var next_year = new Date();
  457. var sun_times = new Object();
  458. var curr_position = localStorage.getItem("local_position");
  459. if (curr_position) {
  460. g_coordinate_this.AT = curr_position.split("#")[0];
  461. g_coordinate_this.LT = curr_position.split("#")[1];
  462. g_coordinate_this.height = curr_position.split("#")[2];
  463. if (g_coordinate_this.AT >= 0) {
  464. var AT_string = angle_trans(g_coordinate_this.AT) + "N";
  465. }
  466. else {
  467. var AT_string = angle_trans(g_coordinate_this.AT) + "S";
  468. }
  469. if (g_coordinate_this.LT >= 0) {
  470. var LT_string = angle_trans(g_coordinate_this.LT) + "E";
  471. }
  472. else {
  473. var LT_string = angle_trans(g_coordinate_this.LT) + "W";
  474. }
  475. let height_string = g_coordinate_this.height + "M"
  476. $("#selected_position_string").html(AT_string + " " + LT_string + " " + height_string);
  477. }
  478. else {
  479. getLocation();
  480. }
  481. function show_time() {
  482. if ($("#input_time").val()) {
  483. today = new Date($("#input_time").val());
  484. }
  485. else {
  486. today = g_now_date
  487. }
  488. if (phase(today).phase <= 0.5) {
  489. start_day.setDate(today.getDate() - 16)//退到本月的新月之前
  490. start_day = phaseHunt(start_day).full_date//得到之前最近的满月日
  491. start_day.setDate(start_day.getDate() + 1)
  492. }
  493. else {
  494. start_day.setDate(today.getDate() - 31)//退到本月的新月之前
  495. start_day = phaseHunt(start_day).full_date//得到之前最近的满月日
  496. start_day.setDate(start_day.getDate() + 1)
  497. }
  498. next_year.setDate(start_day.getDate() + 360)
  499. last_list = phaseRange(start_day, next_year, LAST)//获取下弦月列表
  500. new_list = phaseRange(start_day, next_year, NEW)//获取新月列表
  501. first_list = phaseRange(start_day, next_year, FIRST)//获取上弦月列表
  502. full_list = phaseRange(start_day, next_year, FULL)//获取满月列表
  503. console.log(last_list)//输出到控制台
  504. console.log(new_list)//输出到控制台
  505. console.log(first_list)//输出到控制台
  506. console.log(full_list)//输出到控制台
  507. lunar_phase_list_refresh()
  508. sun_times = SunCalc.getTimes(today, g_coordinate_this.AT, g_coordinate_this.LT, g_coordinate_this.height / 1000);
  509. sun_position = SunCalc.getPosition(today, g_coordinate_this.AT, g_coordinate_this.LT);
  510. moon_position = SunCalc.getMoonPosition(today, g_coordinate_this.AT, g_coordinate_this.LT);
  511. moon_Illumination = SunCalc.getMoonIllumination(today)
  512. $("#today_dawn").html(sun_times.dawn.toLocaleTimeString());
  513. $("#today_solarNoon").html(sun_times.solarNoon.toLocaleTimeString());
  514. $("#today_sunset").html(sun_times.sunset.toLocaleTimeString());
  515. $("#today_sun_azimuth").html(angle_trans(sun_position.azimuth / Math.PI * 180));//太阳水平弧度
  516. $("#today_moon_azimuth").html(angle_trans(moon_position.azimuth / Math.PI * 180));//月亮水平弧度
  517. $("#today_moon_phase").html(phase(today).phase);//月相值
  518. $("#today_moon_percent").html(phase(today).illuminated);//月照度
  519. $("#today_moon_angle").html(angle_trans(moon_Illumination.angle / Math.PI * 180));//月相角
  520. $("#angle_sun_e_moon").html(angle_trans(Math.abs(Math.PI + sun_position.azimuth - moon_position.azimuth) / Math.PI * 180));//月亮水平弧度
  521. $("#curr_time").html(today.toLocaleTimeString());//当前时间
  522. $("#now_time").html(g_now_date.toLocaleTimeString());//现在
  523. }
  524. function lunar_phase_list_refresh() {
  525. let output = ""
  526. //画表头
  527. output += "<tr class='table_line'>"
  528. output += "<th class='table_column'>月份</th>"
  529. output += "<th class='table_column'>下弦</th>"
  530. output += "<th class='table_column'>新月(诵戒)</th>"
  531. output += "<th class='table_column'>上弦</th>"
  532. output += "<th class='table_column'>满月(诵戒)</th>"
  533. output += "</tr>"
  534. //画内容
  535. let month_num = Math.min(last_list.length, new_list.length, first_list.length, full_list.length)
  536. for (let i_month = 0; i_month < month_num; i_month++) {
  537. output += "<tr class='table_line'>"
  538. output += "<td class='table_column'>"
  539. output += i_month + 1
  540. output += "</td>"
  541. if (SunCalc.getTimes(last_list[i_month], g_coordinate_this.AT, g_coordinate_this.LT, g_coordinate_this.height / 1000).dawn - last_list[i_month] <= 0) {//如果在破晓之后,不修正
  542. output += "<td class='table_column' title='" + last_list[i_month].toLocaleTimeString() + "'>"
  543. output += last_list[i_month].toLocaleDateString()
  544. output += "</td>"
  545. }
  546. else {//如果在破晓之前,修正提前一天
  547. output += "<td class='table_column correct' title='" + last_list[i_month].toLocaleString() + "'>"
  548. let temp_date = last_list[i_month]
  549. temp_date.setDate(temp_date.getDate() - 1)
  550. output += temp_date.toLocaleDateString()
  551. output += "</td>"
  552. }
  553. if (SunCalc.getTimes(new_list[i_month], g_coordinate_this.AT, g_coordinate_this.LT, g_coordinate_this.height / 1000).dawn - new_list[i_month] <= 0) {//如果在破晓之后,不修正
  554. output += "<td class='table_column' title='" + new_list[i_month].toLocaleTimeString() + "'>"
  555. output += new_list[i_month].toLocaleDateString()
  556. output += "</td>"
  557. }
  558. else {//如果在破晓之前,修正提前一天
  559. output += "<td class='table_column correct' title='" + new_list[i_month].toLocaleString() + "'>"
  560. let temp_date = new_list[i_month]
  561. temp_date.setDate(temp_date.getDate() - 1)
  562. output += temp_date.toLocaleDateString()
  563. output += "</td>"
  564. }
  565. if (SunCalc.getTimes(first_list[i_month], g_coordinate_this.AT, g_coordinate_this.LT, g_coordinate_this.height / 1000).dawn - first_list[i_month] <= 0) {//如果在破晓之后,不修正
  566. output += "<td class='table_column' title='" + first_list[i_month].toLocaleTimeString() + "'>"
  567. output += first_list[i_month].toLocaleDateString()
  568. output += "</td>"
  569. }
  570. else {//如果在破晓之前,修正提前一天
  571. output += "<td class='table_column correct' title='" + first_list[i_month].toLocaleString() + "'>"
  572. let temp_date = first_list[i_month]
  573. temp_date.setDate(temp_date.getDate() - 1)
  574. output += temp_date.toLocaleDateString()
  575. output += "</td>"
  576. }
  577. if (SunCalc.getTimes(full_list[i_month], g_coordinate_this.AT, g_coordinate_this.LT, g_coordinate_this.height / 1000).dawn - full_list[i_month] <= 0) {//如果在破晓之后,不修正
  578. output += "<td class='table_column' title='" + full_list[i_month].toLocaleTimeString() + "'>"
  579. output += full_list[i_month].toLocaleDateString()
  580. output += "</td>"
  581. }
  582. else {//如果在破晓之前,修正提前一天
  583. output += "<td class='table_column correct' title='" + full_list[i_month].toLocaleString() + "'>"
  584. let temp_date = full_list[i_month]
  585. temp_date.setDate(temp_date.getDate() - 1)
  586. output += temp_date.toLocaleDateString()
  587. output += "</td>"
  588. }
  589. output += "</tr>"
  590. }
  591. $("#lunar_phase_list").html(output)
  592. }
  593. function getLocation() {//自动定位
  594. if (navigator.geolocation) {
  595. navigator.geolocation.getCurrentPosition(showPosition, showError);
  596. }
  597. else {
  598. $("#selected_position_string").html("Geolocation is not supported by this browser.");
  599. }
  600. }
  601. function showPosition(position) {
  602. alert("get cordinate success");
  603. g_coordinate_this.AT = position.coords.latitude;//纬度
  604. g_coordinate_this.LT = position.coords.longitude;//经度
  605. g_coordinate_this.height = position.coords.altitude;//海拔高度
  606. let position_string = g_coordinate_this.AT + "#" + g_coordinate_this.LT + "#" + g_coordinate_this.height
  607. localStorage.setItem("local_position", position_string);
  608. if (g_coordinate_this.AT >= 0) {
  609. var AT_string = angle_trans(g_coordinate_this.AT) + "N";
  610. }
  611. else {
  612. var AT_string = angle_trans(g_coordinate_this.AT) + "S";
  613. }
  614. if (g_coordinate_this.LT >= 0) {
  615. var LT_string = angle_trans(g_coordinate_this.LT) + "E";
  616. }
  617. else {
  618. var LT_string = angle_trans(g_coordinate_this.LT) + "W";
  619. }
  620. let height_string = g_coordinate_this.height + "M"
  621. $("#selected_position_string").html(AT_string + " " + LT_string + " " + height_string);
  622. }
  623. function showError(error) {
  624. switch (error.code) {
  625. case error.PERMISSION_DENIED:
  626. alert("定位失败,用户拒绝请求地理定位");
  627. break;
  628. case error.POSITION_UNAVAILABLE:
  629. alert("定位失败,位置信息是不可用");
  630. break;
  631. case error.TIMEOUT:
  632. alert("定位失败,请求获取用户位置超时");
  633. break;
  634. case error.UNKNOWN_ERROR:
  635. alert("定位失败,定位系统失效");
  636. break;
  637. }
  638. }
  639. function angle_trans(angle) {
  640. var angle_str = "";
  641. var num_d = Math.floor(angle);
  642. var num_m = Math.floor((angle - num_d) * 60);
  643. var num_s = Math.round((angle - num_d) * 60 - num_m);
  644. if (num_d != 0) {
  645. angle_str += num_d + "°";
  646. }
  647. if (num_m != 0) {
  648. angle_str += num_m + "’";
  649. }
  650. if (num_s != 0) {
  651. angle_str += num_s + "”";
  652. }
  653. return (angle_str);
  654. }
  655. </script>
  656. </body>
  657. </html>