index.html 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863
  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 = "en";
  20. var g_currLink = "";
  21. function lang_init(strPage) {
  22. g_currLink = strPage;
  23. }
  24. function setLang(strLang) {
  25. g_language = strLang;
  26. setCookie("language", g_language, 365);
  27. window.location.assign(location.pathname + "?language=" + g_language);
  28. }
  29. </script>
  30. <script>
  31. var localString = new Array();
  32. localString["zh-cn"] = {
  33. and_another: "又 ",
  34. atitude: "纬度",
  35. BE: "佛历",
  36. bhumma: "周二",
  37. budha: "周三",
  38. canda: "周一",
  39. confirm: "确认",
  40. date: "日期",
  41. day: "日",
  42. days: "天 ",
  43. departure_in_detail: "起飞详情",
  44. dhamma_time: "会延续五千年的教法 ",
  45. eat: "进餐",
  46. gama_entry: "入村",
  47. guru: "周四",
  48. hori_ref_time: "蒙气差修正 ",
  49. kala: "适当的时间",
  50. language_select: "选择语言",
  51. left: "还剩下",
  52. loading: "载入中……",
  53. longitude: "经度",
  54. māsa: "月",
  55. mins: "分钟",
  56. month: "月 ",
  57. month_1: "月 ",
  58. months: "个月 ",
  59. my_loc: "我的位置",
  60. need_inform: "未告知其他比库",
  61. no_string: "不能",
  62. noon_time: "正午",
  63. noon_time: "正午",
  64. note: "注释",
  65. now_time: "现在",
  66. pacchā_māsa: "下个月",
  67. pakkha: "月相变化 ",
  68. past: "已过去",
  69. pubba_māsa: "上个月",
  70. ravi: "周日",
  71. saṃvacchara: "年",
  72. season: "季节 ",
  73. sec: "秒",
  74. sora: "周六",
  75. sukka: "周五",
  76. sun_height_degree: "正午太阳高度 ",
  77. time: "时间",
  78. twilight_time: "曙光",
  79. twilight_time: "曙光",
  80. vikala: "不适当的时间",
  81. week_day: "星期",
  82. year_0: "年",
  83. year_1: "年 ",
  84. years: "年 ",
  85. yes_string: "可以",
  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. };
  142. localString["default"] = {
  143. and_another: " and ",
  144. atitude: "Atitude",
  145. BE: "Buddhist Era ",
  146. bhumma: "Bhumma",
  147. budha: "Budha",
  148. canda: "Canda",
  149. confirm: "Confirm",
  150. date: "Date ",
  151. day: " day(s) ",
  152. days: " day(s) ",
  153. departure_in_detail: "departure in detail",
  154. dhamma_time: "5000 Years of the Buddha’s Dispensation ",
  155. eat: "eat",
  156. gama_entry: "entry the village",
  157. guru: "Guru",
  158. hori_ref_time: "horizontal refraction correct ",
  159. kala: "suitable time",
  160. language_select: "bhāsā",
  161. left: "Remains ",
  162. loading: "loading…",
  163. longitude: "Longitude",
  164. māsa: "māsa",
  165. mins: "(min)",
  166. month: "Month ",
  167. month_1: "- ",
  168. months: " month(s) ",
  169. my_loc: "attasmiṃ",
  170. need_inform: "without informing other Bhikkhu ",
  171. no_string: "cannot ",
  172. noon_time: "NOON",
  173. noon_time: "NOON",
  174. note: "Note",
  175. now_time: "NOW",
  176. pacchā_māsa: "pacchā-māsa",
  177. pakkha: "Lunar Phases ",
  178. past: "Passed ",
  179. pubba_māsa: "pubba-māsa",
  180. ravi: "Ravi",
  181. saṃvacchara: "saṃvacchara",
  182. season: "Season ",
  183. sec: "sec ",
  184. sora: "Sora",
  185. sukka: "Sukka",
  186. sun_height_degree: "Max solar altitude ",
  187. time: "Time",
  188. twilight_time: "dawn",
  189. twilight_time: "dawn",
  190. vikala: "unsuitable time",
  191. week_day: "Day",
  192. year_0: "saṃvacchara",
  193. year_1: "- ",
  194. years: " year(s) ",
  195. yes_string: "can ",
  196. };
  197. localString["en"] = {
  198. and_another: " and ",
  199. atitude: "Atitude",
  200. BE: "Buddhist Era ",
  201. bhumma: "Bhumma",
  202. budha: "Budha",
  203. canda: "Canda",
  204. confirm: "Confirm",
  205. date: "Date",
  206. day: " day(s) ",
  207. days: " day(s) ",
  208. departure_in_detail: "departure in detail",
  209. dhamma_time: "5000 Years of the Buddha’s Dispensation ",
  210. eat: "eat",
  211. gama_entry: "entry the village",
  212. guru: "Guru",
  213. hori_ref_time: "horizontal refraction correct ",
  214. kala: "suitable time",
  215. language_select: "Language",
  216. left: "Remains ",
  217. loading: "loading…",
  218. longitude: "Longitude",
  219. māsa: "māsa",
  220. mins: "(min)",
  221. month: "Month ",
  222. month_1: "- ",
  223. months: " month(s) ",
  224. my_loc: "my location",
  225. need_inform: "without informing other Bhikkhu ",
  226. no_string: "cannot ",
  227. noon_time: "NOON",
  228. noon_time: "NOON",
  229. note: "Note",
  230. now_time: "NOW",
  231. pacchā_māsa: "pacchā-māsa",
  232. pakkha: "Lunar Phases ",
  233. past: "Passed ",
  234. pubba_māsa: "pubba-māsa",
  235. ravi: "Ravi",
  236. saṃvacchara: "saṃvacchara",
  237. season: "Season ",
  238. sec: "sec",
  239. sora: "Sora",
  240. sukka: "Sukka",
  241. sun_height_degree: "Max solar altitude ",
  242. time: "time",
  243. twilight_time: "dawn",
  244. twilight_time: "dawn",
  245. vikala: "unsuitable time",
  246. week_day: "Day",
  247. year_0: "year",
  248. year_1: "- ",
  249. years: " year(s) ",
  250. yes_string: "can ",
  251. };
  252. localString["my"] = {
  253. and_another: " and ",
  254. atitude: "Atitude",
  255. BE: "Buddhist Era ",
  256. bhumma: "ဘုမ္မ",
  257. budha: "ဗုဓ",
  258. canda: "စန္ဒ",
  259. confirm: "Confirm",
  260. date: "Date ",
  261. day: " day(s) ",
  262. days: " day(s) ",
  263. departure_in_detail: "departure in detail",
  264. dhamma_time: "5000 Years of the Buddha’s Dispensation ",
  265. eat: "eat",
  266. gama_entry: "entry the village",
  267. guru: "ဂုရု",
  268. hori_ref_time: "horizontal refraction correct ",
  269. kala: "ကာလ",
  270. language_select: "ဘာသာ",
  271. left: "Remains ",
  272. loading: "loading…",
  273. longitude: "Longitude",
  274. māsa: "မာသ",
  275. mins: "(min)",
  276. month: "Month ",
  277. month_1: "- ",
  278. months: " month(s) ",
  279. my_loc: "အတ္တသ္မိံ",
  280. need_inform: "without informing other Bhikkhu ",
  281. no_string: "cannot ",
  282. noon_time: "မဇ္ဈန္ဟိက",
  283. noon_time: "မဇ္ဈန္ဟိက",
  284. note: "Note",
  285. now_time: "ပစ္စုပ္ပန္န",
  286. pacchā_māsa: "ပစ္ဆာ-မာသ",
  287. pakkha: "Lunar Phases ",
  288. past: "Passed ",
  289. pubba_māsa: "ပုဗ္ဗ-မာသ",
  290. ravi: "ရဝိ",
  291. saṃvacchara: "သံဝစ္ဆရ",
  292. season: "Season ",
  293. sec: "sec ",
  294. sora: "သောရ",
  295. sukka: "သုက္က",
  296. sun_height_degree: "Max solar altitude ",
  297. time: "Time",
  298. twilight_time: "အရုဏုဂ္ဂမန",
  299. twilight_time: "အရုဏုဂ္ဂမန",
  300. vikala: "ဝိကာလ",
  301. week_day: "Day",
  302. year_0: "year",
  303. year_1: "- ",
  304. years: " year(s) ",
  305. yes_string: "can ",
  306. };
  307. localString["si"] = {
  308. and_another: " ච ",
  309. atitude: "Atitude",
  310. BE: "බුද්ධ වර්ෂය ",
  311. bhumma: "භුම්ම",
  312. budha: "බුධ",
  313. canda: "චන්ද",
  314. confirm: "Confirm",
  315. date: "දිවස ",
  316. day: " දිවසා(නි) ",
  317. days: " දිවසා(නි) ",
  318. departure_in_detail: "departure in detail",
  319. dhamma_time: "සම්මා සම්බුද්ධස්ස සාසනං පට්ච-වස්ස-සහස්සානි පවත්තිස්සති ",
  320. eat: "eat",
  321. gama_entry: "entry the village",
  322. guru: "ගු‍රු",
  323. hori_ref_time: "horizontal refraction correct ",
  324. kala: "කාල",
  325. language_select: "භාෂාව",
  326. left: "අවසිට්ඨ ",
  327. loading: "ප්‍රවේශනය වෙනවා ",
  328. longitude: "Longitude",
  329. māsa: "මාස",
  330. mins: "(min)",
  331. month: "මාස ",
  332. month_1: "- ",
  333. months: " මාසා(නි) ",
  334. my_loc: "අත‍්තස‍්මිං",
  335. need_inform: "without informing other Bhikkhu ",
  336. no_string: "cannot ",
  337. noon_time: "මජ්ඣන්හික",
  338. noon_time: "මජ්ඣන්හික",
  339. note: "නෝට්ටුව ",
  340. now_time: "පච්චුප්පන්න",
  341. pacchā_māsa: "පච්ඡා-මාස",
  342. pakkha: "පක්ඛ ",
  343. past: "අතික්කන්ත ",
  344. pubba_māsa: "පුබ්බ-මාස",
  345. ravi: "රවි",
  346. saṃvacchara: "සංවච්ඡ‍ර",
  347. season: "උතු ",
  348. sec: "sec",
  349. sora: "සො‍ර",
  350. sukka: "සුක්ක",
  351. sun_height_degree: "Max solar altitude ",
  352. time: "time",
  353. twilight_time: "අ‍රුණුග්ගමන",
  354. twilight_time: "අ‍රුණුග්ගමන",
  355. vikala: "විකාල",
  356. week_day: "වා‍ර ",
  357. year_0: "සංවච්ඡ‍ර",
  358. year_1: "- ",
  359. years: " සංවච්ඡ‍රා(නි) ",
  360. yes_string: "can ",
  361. };
  362. var pali_month_name = [
  363. { id: "1", value: "jeṭṭha", season: "gimhāna", season_icon: "☀" }, //5.X-四-十五-心
  364. { id: "2", value: "asāḷha", season: "gimhāna", season_icon: "☀" }, //6.X-五-十五、十六-箕、斗
  365. { id: "3", value: "sāvana", season: "vassāna", season_icon: "☔" }, //7.X-六-十五-女
  366. { id: "4", value: "poṭṭhapāda", season: "vassāna", season_icon: "☔" }, //8.x-七-十五、十六-室、壁
  367. { id: "5", value: "assajuja", season: "vassāna", season_icon: "☔" }, //9.X-八-十五-樓
  368. { id: "6", value: "kattika", season: "vassāna", season_icon: "☔" }, //10.X-九-十五-昂
  369. { id: "7", value: "māgasira", season: "hemanta", season_icon: "❄" }, //11.X-十-十五-觜
  370. { id: "8", value: "phussa", season: "hemanta", season_icon: "❄" }, //12.X-十一-十五-鬼
  371. { id: "9", value: "māgha", season: "hemanta", season_icon: "❄" }, //1.X-十二-十五-星
  372. { id: "10", value: "phagguna", season: "hemanta", season_icon: "❄" }, //2.X-正月-十四、十五-張、異
  373. { id: "11", value: "citta", season: "gimhāna", season_icon: "☀" }, //3.X-二月-十五-角
  374. { id: "12", value: "vesākha", season: "gimhāna", season_icon: "☀" }, //4.X-三月-十五-氐
  375. ];
  376. var pali_nakkhatta_name = [
  377. { id: "0", value: "assayuja", name_zh: "娄宿" },
  378. { id: "1", value: "bharaṇī", name_zh: "胃宿" },
  379. { id: "2", value: "Kattikā", name_zh: "昂宿" },
  380. { id: "3", value: "rohiṇī", name_zh: "毕宿" },
  381. { id: "4", value: "magasira", name_zh: "觜宿" },
  382. { id: "5", value: "Addā", name_zh: "参宿" },
  383. { id: "6", value: "punabbasu", name_zh: "井宿" },
  384. { id: "7", value: "phussa", name_zh: "鬼宿" },
  385. { id: "8", value: "Asilesā", name_zh: "柳宿" },
  386. { id: "9", value: "maghā", name_zh: "星宿" },
  387. { id: "10", value: "pubbaphagguṇī", name_zh: "张宿" },
  388. { id: "11", value: "uttaraphagguṇī", name_zh: "翼宿" },
  389. { id: "12", value: "hattha", name_zh: "轸宿" },
  390. { id: "13", value: "cittā", name_zh: "角宿" },
  391. { id: "14", value: "sāti", name_zh: "亢宿" },
  392. { id: "15", value: "visākhā", name_zh: "氐宿" },
  393. { id: "16", value: "anurādhā", name_zh: "房宿" },
  394. { id: "17", value: "jeṭṭha", name_zh: "心宿" },
  395. { id: "18", value: "mūlā", name_zh: "尾宿" },
  396. { id: "19", value: "pubbāsāḷha", name_zh: "箕宿" },
  397. { id: "20", value: "uttarāsāḷha", name_zh: "斗宿" },
  398. { id: "21", value: "savaṇa", name_zh: "女宿" },
  399. { id: "22", value: "dhaniṭṭhā", name_zh: "虚宿" },
  400. { id: "23", value: "satabhisaja", name_zh: "危宿" },
  401. { id: "24", value: "pubbabhaddapadā", name_zh: "室宿" },
  402. { id: "25", value: "uttarabhaddapadā", name_zh: "壁宿" },
  403. { id: "26", value: "revatī", name_zh: "奎宿" },
  404. ];
  405. var horoscope_name = [
  406. { id: "0", value: "Aries", name_zh: "白羊", icon: "♈" },
  407. { id: "1", value: "Taurus", name_zh: "金牛", icon: "♉" },
  408. { id: "2", value: "Gemini", name_zh: "双子", icon: "♊" },
  409. { id: "3", value: "Cancer", name_zh: "巨蟹", icon: "♋" },
  410. { id: "4", value: "Leo", name_zh: "狮子", icon: "♌" },
  411. { id: "5", value: "Virgo", name_zh: "处女", icon: "♍" },
  412. { id: "6", value: "Libra", name_zh: "天秤", icon: "♎" },
  413. { id: "7", value: "Scorpio", name_zh: "天蝎", icon: "♏" },
  414. { id: "8", value: "Sagittarius", name_zh: "射手", icon: "♐" },
  415. { id: "9", value: "Capricornus", name_zh: "摩羯", icon: "♑" },
  416. { id: "10", value: "Aquarius", name_zh: "水瓶", icon: "♒" },
  417. { id: "11", value: "Pisces", name_zh: "双鱼", icon: "♓" },
  418. ];
  419. </script>
  420. <script>
  421. var current_phase = phase();
  422. console.log(current_phase); //输出到控制台
  423. //$("#title_text").html(localString[g_language].BE);
  424. var new_list = new Array(); //新月列表
  425. var first_list = new Array(); //上弦月列表
  426. var full_list = new Array(); //满月列表
  427. var last_list = new Array(); //下弦月列表
  428. var planets = new Array(); //
  429. var lunar_position = new Object();
  430. var g_coordinate_this = new Object();
  431. var g_now_date = new Date();
  432. var today = new Date();
  433. var start_day = new Date();
  434. var next_year = new Date();
  435. var sun_times = new Object();
  436. var curr_position = localStorage.getItem("local_position");
  437. if (curr_position) {
  438. g_coordinate_this.AT = curr_position.split("#")[0];
  439. g_coordinate_this.LT = curr_position.split("#")[1];
  440. g_coordinate_this.height = curr_position.split("#")[2];
  441. if (g_coordinate_this.AT >= 0) {
  442. var AT_string = angle_trans(g_coordinate_this.AT) + "N";
  443. } else {
  444. var AT_string = angle_trans(g_coordinate_this.AT) + "S";
  445. }
  446. if (g_coordinate_this.LT >= 0) {
  447. var LT_string = angle_trans(g_coordinate_this.LT) + "E";
  448. } else {
  449. var LT_string = angle_trans(g_coordinate_this.LT) + "W";
  450. }
  451. let height_string = g_coordinate_this.height + "M";
  452. $("#selected_position_string").html(AT_string + " " + LT_string + " " + height_string);
  453. } else {
  454. getLocation();
  455. }
  456. function show_time() {
  457. if ($("#input_time").val()) {
  458. today = new Date($("#input_time").val());
  459. } else {
  460. today = g_now_date;
  461. }
  462. if (phase(today).phase <= 0.5) {
  463. start_day.setDate(today.getDate() - 16); //退到本月的新月之前
  464. start_day = phaseHunt(start_day).full_date; //得到之前最近的满月日
  465. start_day.setDate(start_day.getDate() + 1);
  466. } else {
  467. start_day.setDate(today.getDate() - 31); //退到本月的新月之前
  468. start_day = phaseHunt(start_day).full_date; //得到之前最近的满月日
  469. start_day.setDate(start_day.getDate() + 1);
  470. }
  471. next_year.setDate(start_day.getDate() + 360);
  472. last_list = phaseRange(start_day, next_year, LAST); //获取下弦月列表
  473. new_list = phaseRange(start_day, next_year, NEW); //获取新月列表
  474. first_list = phaseRange(start_day, next_year, FIRST); //获取上弦月列表
  475. full_list = phaseRange(start_day, next_year, FULL); //获取满月列表
  476. console.log(last_list); //输出到控制台
  477. console.log(new_list); //输出到控制台
  478. console.log(first_list); //输出到控制台
  479. console.log(full_list); //输出到控制台
  480. lunar_phase_list_refresh();
  481. get_position(today);
  482. let d_earth_to_moon =
  483. lunar_position.position.x ^
  484. (2 + lunar_position.position.y) ^
  485. (2 + lunar_position.position.z) ^
  486. 2 ^
  487. 0.5;
  488. let d_earth_to_moon_0 = phase(today).distance;
  489. sun_times = SunCalc.getTimes(
  490. today,
  491. g_coordinate_this.AT,
  492. g_coordinate_this.LT,
  493. g_coordinate_this.height / 1000
  494. );
  495. sun_position = SunCalc.getPosition(today, g_coordinate_this.AT, g_coordinate_this.LT);
  496. moon_position = SunCalc.getMoonPosition(today, g_coordinate_this.AT, g_coordinate_this.LT);
  497. moon_Illumination = SunCalc.getMoonIllumination(today);
  498. $("#today_dawn").html(sun_times.dawn.toLocaleTimeString()); //破晓
  499. $("#today_solarNoon").html(sun_times.solarNoon.toLocaleTimeString()); //正午
  500. $("#today_sunset").html(sun_times.sunset.toLocaleTimeString()); //日落
  501. $("#today_sun_azimuth").html(angle_trans((sun_position.azimuth / Math.PI) * 180)); //太阳水平弧度
  502. $("#today_moon_azimuth").html(angle_trans((moon_position.azimuth / Math.PI) * 180)); //月亮水平弧度
  503. $("#today_moon_phase").html(phase(today).phase); //月相值
  504. $("#today_moon_percent").html(phase(today).illuminated); //月照度
  505. $("#today_moon_angle").html(angle_trans((moon_Illumination.angle / Math.PI) * 180)); //月相角
  506. $("#angle_sun_e_moon").html(
  507. angle_trans((Math.abs(Math.PI + sun_position.azimuth - moon_position.azimuth) / Math.PI) * 180)
  508. ); //月亮水平弧度
  509. $("#curr_time").html(today.toLocaleTimeString()); //当前时间
  510. $("#now_time").html(g_now_date.toLocaleTimeString()); //现在
  511. $("#curr_time_unix").html(today.getTime()); //時間戳
  512. let earth_angle_string = "";
  513. earth_angle_string += get_position(today).solar_position_angle + "——";
  514. earth_angle_string += get_position(today).solar_position_angle_round + "——";
  515. earth_angle_string += get_position(today).solar_station + "——";
  516. earth_angle_string += get_station_name(today).solar.icon;
  517. $("#earth_angle").html(earth_angle_string); //地球角度
  518. let moon_angle_string = "";
  519. moon_angle_string += get_position(today).lunar_position_angle + "——";
  520. moon_angle_string += get_position(today).lunar_position_angle_round + "——";
  521. moon_angle_string += get_position(today).lunar_station + "——";
  522. moon_angle_string += get_station_name(today).lunar.value;
  523. $("#moon_angle").html(moon_angle_string); //月亮角度——角度差算法
  524. let moon_angle_string2 = "";
  525. moon_angle_string2 += get_position(today).lunar_position_angle2 + "——";
  526. moon_angle_string2 += get_position(today).lunar_position_angle_round2 + "——";
  527. moon_angle_string2 += get_position(today).lunar_station2 + "——";
  528. moon_angle_string2 += get_station_name(today).lunar.value;
  529. $("#moon_angle2").html(moon_angle_string2); //月亮角度——向量差算法
  530. }
  531. //根据时间计算偏角,输出
  532. function get_position(date_time) {
  533. let planets_position = new Object();
  534. planets = window.lagrange.planet_positions.getPositions(date_time);
  535. //planets = global.planet_positions.getPositions(today);
  536. //console.log(planets)//输出到控制台
  537. earth_position = window.lagrange.planet_positions.getPositions(date_time)[3];
  538. lunar_position = window.lagrange.planet_positions.getPositions(date_time)[11];
  539. let lunar_position_angle = 0;
  540. let lunar_station = 0;
  541. let earth_position_angle = 0;
  542. let earth_station = 0;
  543. let earth_position_angle_round = 0;
  544. let lunar_position_angle_round = 0;
  545. //太阳相对地球的黄道偏角
  546. if (earth_position.position.y >= 0) {
  547. earth_position_angle = Math.atan2(earth_position.position.y, earth_position.position.x);
  548. } else {
  549. earth_position_angle =
  550. Math.PI * 2 + Math.atan2(earth_position.position.y, earth_position.position.x);
  551. }
  552. earth_position_angle_round = earth_position_angle / Math.PI / 2 + 0.5;
  553. earth_position_angle_round = earth_position_angle_round - Math.floor(earth_position_angle_round);
  554. earth_station = earth_position_angle_round * 12;
  555. planets_position.solar_station = earth_station;
  556. planets_position.solar_position_angle = earth_position_angle_round * Math.PI * 2;
  557. planets_position.solar_position_angle_round = earth_position_angle_round;
  558. //月球相对地球的黄道偏角——角度差算法
  559. lunar_position_angle_round = earth_position_angle_round + phase(date_time).phase;
  560. lunar_position_angle_round = lunar_position_angle_round - Math.floor(lunar_position_angle_round);
  561. lunar_position_angle = lunar_position_angle_round * Math.PI * 2;
  562. lunar_station = lunar_position_angle_round * 27;
  563. //月球相对地球的黄道偏角算法——向量差算法
  564. let lunar_to_earth = new Object();
  565. lunar_to_earth.y = lunar_position.position.y - earth_position.position.y;
  566. lunar_to_earth.x = lunar_position.position.x - earth_position.position.x;
  567. if (lunar_to_earth.y >= 0) {
  568. lunar_position_angle2 = Math.atan2(lunar_to_earth.y, lunar_to_earth.x);
  569. } else {
  570. lunar_position_angle2 = Math.PI * 2 + Math.atan2(lunar_to_earth.y, lunar_to_earth.x);
  571. }
  572. lunar_position_angle_round2 = lunar_position_angle2 / Math.PI / 2;
  573. //lunar_position_angle_round = lunar_position_angle_round - Math.floor(lunar_position_angle_round)
  574. lunar_position_angle2 = lunar_position_angle_round2 * Math.PI * 2;
  575. lunar_station2 = lunar_position_angle_round2 * 27;
  576. planets_position.lunar_station = lunar_station; //月站值【角度差算夹角】
  577. planets_position.lunar_position_angle = lunar_position_angle; //月站角【角度差算夹角】
  578. planets_position.lunar_position_angle_round = lunar_position_angle_round; //月站圆周比率【角度差算夹角】
  579. planets_position.lunar_station2 = lunar_station2; //月站值【矢量差算夹角】
  580. planets_position.lunar_position_angle2 = lunar_position_angle2; //月站角【矢量差算夹角】
  581. planets_position.lunar_position_angle_round2 = lunar_position_angle_round2; //月站圆周比率【矢量差算夹角】
  582. return planets_position;
  583. }
  584. //根据;
  585. function get_station_name(data_time) {
  586. //获取星象信息
  587. let solar_num = 0;
  588. let lunar_num = 0;
  589. solar_num = get_position(data_time).solar_station;
  590. solar_num = Math.floor(solar_num);
  591. lunar_num = get_position(data_time).lunar_station;
  592. lunar_num = Math.floor(lunar_num);
  593. let result = new Object();
  594. result.solar = horoscope_name[solar_num]; //黄道十二宫星象名称
  595. result.lunar = pali_nakkhatta_name[lunar_num]; //27星宿月站名称
  596. return result;
  597. }
  598. function getLocation() {
  599. //自动定位
  600. if (navigator.geolocation) {
  601. navigator.geolocation.getCurrentPosition(showPosition, showError);
  602. } else {
  603. $("#selected_position_string").html("Geolocation is not supported by this browser.");
  604. }
  605. }
  606. function showPosition(position) {
  607. alert("get cordinate success");
  608. g_coordinate_this.AT = position.coords.latitude; //纬度
  609. g_coordinate_this.LT = position.coords.longitude; //经度
  610. g_coordinate_this.height = position.coords.altitude; //海拔高度
  611. //手动输入
  612. var LT = Number($("#LT_°")[0].value);
  613. LT += Number($("#LT_’")[0].value) / 60;
  614. LT += Number($("#LT_”")[0].value) / 3600;
  615. LT = Number($("#WE")[0].value + LT);
  616. var AT = Number($("#AT_°")[0].value);
  617. AT += Number($("#AT_’")[0].value) / 60;
  618. AT += Number($("#AT_”")[0].value) / 3600;
  619. AT = Number($("#NS")[0].value + AT);
  620. if (AT != 0) {
  621. g_coordinate_this.LT = LT;
  622. g_coordinate_this.AT = AT;
  623. }
  624. let position_string =
  625. g_coordinate_this.AT + "#" + g_coordinate_this.LT + "#" + g_coordinate_this.height;
  626. localStorage.setItem("local_position", position_string);
  627. if (g_coordinate_this.AT >= 0) {
  628. var AT_string = angle_trans(g_coordinate_this.AT) + "N";
  629. } else {
  630. var AT_string = angle_trans(g_coordinate_this.AT) + "S";
  631. }
  632. if (g_coordinate_this.LT >= 0) {
  633. var LT_string = angle_trans(g_coordinate_this.LT) + "E";
  634. } else {
  635. var LT_string = angle_trans(g_coordinate_this.LT) + "W";
  636. }
  637. let height_string = g_coordinate_this.height + "M";
  638. $("#selected_position_string").html(AT_string + " " + LT_string + " " + height_string);
  639. $("#position_input").hide();
  640. }
  641. function showError(error) {
  642. switch (error.code) {
  643. case error.PERMISSION_DENIED:
  644. alert("定位失败,用户拒绝请求地理定位");
  645. break;
  646. case error.POSITION_UNAVAILABLE:
  647. alert("定位失败,位置信息是不可用");
  648. break;
  649. case error.TIMEOUT:
  650. alert("定位失败,请求获取用户位置超时");
  651. break;
  652. case error.UNKNOWN_ERROR:
  653. alert("定位失败,定位系统失效");
  654. break;
  655. }
  656. }
  657. function angle_trans(angle) {
  658. var angle_str = "";
  659. var num_d = Math.floor(angle);
  660. var num_m = Math.floor((angle - num_d) * 60);
  661. var num_s = Math.round((angle - num_d) * 60 - num_m);
  662. if (num_d != 0) {
  663. angle_str += num_d + "°";
  664. }
  665. if (num_m != 0) {
  666. angle_str += num_m + "’";
  667. }
  668. if (num_s != 0) {
  669. angle_str += num_s + "”";
  670. }
  671. return angle_str;
  672. }
  673. function input_position() {
  674. $("#position_input").show();
  675. }
  676. var g_event_list_arr = new Array();
  677. function get_event_arr() {
  678. let from_str = new Date();
  679. let info_obj = new Object();
  680. }
  681. </script>
  682. <script src="../lib/main.js"></script>
  683. <script>
  684. function getCookie(name) {
  685. var start = document.cookie.indexOf(name + "=");
  686. var len = start + name.length + 1;
  687. if (!start && name != document.cookie.substring(0, name.length)) {
  688. return null;
  689. }
  690. if (start == -1) return null;
  691. var end = document.cookie.indexOf(";", len);
  692. if (end == -1) end = document.cookie.length;
  693. return decodeURI(document.cookie.substring(len, end));
  694. }
  695. document.addEventListener("DOMContentLoaded", function () {
  696. var initialTimeZone = "local";
  697. var timeZoneSelectorEl = document.getElementById("time-zone-selector");
  698. var loadingEl = document.getElementById("loading");
  699. var calendarEl = document.getElementById("calendar");
  700. var calendar = new FullCalendar.Calendar(calendarEl, {
  701. timeZone: initialTimeZone,
  702. locale: getCookie("language"),
  703. headerToolbar: {
  704. left: "prev,next today",
  705. center: "title",
  706. right: "dayGridMonth,timeGridWeek,timeGridDay,listWeek",
  707. },
  708. //initialDate: "2020-12-12",
  709. navLinks: true, // can click day/week names to navigate views
  710. editable: true,
  711. selectable: true,
  712. dayMaxEvents: true, // allow "more" link when too many events
  713. resources: g_event_list_arr,
  714. events: {
  715. /*url: "php/get-events.php",
  716. failure: function () {
  717. document.getElementById("script-warning").style.display = "inline"; // show
  718. },*/
  719. },
  720. eventClick: function (info) {
  721. info.jsEvent.preventDefault(); // don't let the browser navigate
  722. if (info.event.url) {
  723. window.open(info.event.url);
  724. }
  725. },
  726. loading: function (bool) {
  727. if (bool) {
  728. loadingEl.style.display = "inline"; // show
  729. } else {
  730. loadingEl.style.display = "none"; // hide
  731. }
  732. },
  733. eventTimeFormat: { hour: "numeric", minute: "2-digit" },
  734. dateClick: function (arg) {
  735. console.log("dateClick", calendar.formatIso(arg.date));
  736. },
  737. select: function (arg) {
  738. console.log("select", calendar.formatIso(arg.start), calendar.formatIso(arg.end));
  739. },
  740. });
  741. calendar.render();
  742. // load the list of available timezones, build the <select> options
  743. // it's HIGHLY recommended to use a different library for network requests, not this internal util func
  744. FullCalendar.requestJson(
  745. "GET",
  746. "php/get-time-zones.php",
  747. {},
  748. function (timeZones) {
  749. timeZones.forEach(function (timeZone) {
  750. var optionEl;
  751. if (timeZone !== "UTC") {
  752. // UTC is already in the list
  753. optionEl = document.createElement("option");
  754. optionEl.value = timeZone;
  755. optionEl.innerText = timeZone;
  756. timeZoneSelectorEl.appendChild(optionEl);
  757. }
  758. });
  759. },
  760. function () {
  761. // TODO: handle error
  762. }
  763. );
  764. // when the timezone selector changes, dynamically change the calendar option
  765. timeZoneSelectorEl.addEventListener("change", function () {
  766. calendar.setOption("timeZone", this.value);
  767. });
  768. });
  769. </script>
  770. <style>
  771. body {
  772. margin: 0;
  773. padding: 0;
  774. font-family: Arial, Helvetica Neue, Helvetica, sans-serif;
  775. font-size: 14px;
  776. }
  777. #top {
  778. background: #eee;
  779. border-bottom: 1px solid #ddd;
  780. padding: 0 10px;
  781. line-height: 40px;
  782. font-size: 12px;
  783. }
  784. .left {
  785. float: left;
  786. }
  787. .right {
  788. float: right;
  789. }
  790. .clear {
  791. clear: both;
  792. }
  793. #script-warning,
  794. #loading {
  795. display: none;
  796. }
  797. #script-warning {
  798. font-weight: bold;
  799. color: red;
  800. }
  801. #calendar {
  802. max-width: 1100px;
  803. margin: 40px auto;
  804. padding: 0 10px;
  805. }
  806. .tzo {
  807. color: #000;
  808. }
  809. </style>
  810. </head>
  811. <body>
  812. <div id="top">
  813. <div class="left">
  814. Timezone:
  815. <select id="time-zone-selector">
  816. <option value="local" selected>local</option>
  817. <option value="UTC">UTC</option>
  818. </select>
  819. </div>
  820. <div class="right">
  821. <span id="loading">loading...</span>
  822. <span id="script-warning"><code>php/get-events.php</code> must be running.</span>
  823. </div>
  824. <div class="clear"></div>
  825. </div>
  826. <div id="calendar"></div>
  827. </body>
  828. </html>