Loading docs/.vuepress/components/DataRequest.vue +8 −2 Changes for docs/.vuepress/components/DataRequest.vue: 8 added lines, 2 removed lines. Original line number Diff line number Diff line Loading @@ -35,10 +35,16 @@ export default { props: { path: { type: String }, }, mounted() { if (this.path) return fetchJSONData(this.path).then((data) => { this.data = data; }); }, watch: { path(val) { if (val) return fetchJSONData(val).then((data) => { if (this.path) return fetchJSONData(this.path).then((data) => { this.data = data; }); }, Loading docs/transport/bustimer-wx.md +14 −18 Changes for docs/transport/bustimer-wx.md: 14 added lines, 18 removed lines. Original line number Diff line number Diff line Loading @@ -17,26 +17,26 @@ navbar: false ## 时间表 Timetable <script> import axios from "axios"; export default { mounted() { axios .get("/2021.json") .then(response => (bus_redirect(response.data))); function bus_redirect(holidata) { methods: { isHoliday: function (holidata) { // JSON is from https://github.com/NateScarlet/holiday-cn // need to update by year. // Download the JSON to path "docs/.vuepress/public/YYYY.json" if (!holidata) return false var day_map = {}; for (let i = 0; i < holidata.days.length; i++) { day_map[holidata.days[i].date] = holidata.days[i].isOffDay; } var now_date = new Date(); var ye = new Intl.DateTimeFormat('en', { year: 'numeric' }).format(now_date); var mo = new Intl.DateTimeFormat('en', { month: '2-digit' }).format(now_date); var da = new Intl.DateTimeFormat('en', { day: '2-digit' }).format(now_date); var day_key = `${ye}-${mo}-${da}`; var is_holiday; if (day_map[day_key] == null) { // 不在国家假日调整表里 console.log("Not in GOV declaration"); Loading @@ -48,24 +48,18 @@ navbar: false console.log("In GOV declaration"); is_holiday = day_map[day_key]; } if (is_holiday) { console.log("节假日"); var bus_div = document.getElementById("bustable"); var this_day_btn = bus_div.getElementsByTagName("button")[1]; this_day_btn.click(); } else { console.log("工作日"); var bus_div = document.getElementById("bustable"); var this_day_btn = bus_div.getElementsByTagName("button")[0]; this_day_btn.click(); return is_holiday } } }, } </script> <div id="bustable"> <object-selector :objs="{ <data-request path="/2021.json" v-slot="{ data : holidata }"> <object-selector :objs="isHoliday(holidata)?{ '节假日 Holiday': true, '工作日 Workday': false }:{ '工作日 Workday': true, '节假日 Holiday': false }" v-slot="weekdayProps"> Loading @@ -86,4 +80,6 @@ navbar: false </data-request> </object-selector> </object-selector> </data-request> </div> docs/transport/bustimer.md +14 −18 Changes for docs/transport/bustimer.md: 14 added lines, 18 removed lines. Original line number Diff line number Diff line Loading @@ -13,26 +13,26 @@ ## 时间表 Timetable <script> import axios from "axios"; export default { mounted() { axios .get("/2021.json") .then(response => (bus_redirect(response.data))); function bus_redirect(holidata) { methods: { isHoliday: function (holidata) { // JSON is from https://github.com/NateScarlet/holiday-cn // need to update by year. // Download the JSON to path "docs/.vuepress/public/YYYY.json" if (!holidata) return false var day_map = {}; for (let i = 0; i < holidata.days.length; i++) { day_map[holidata.days[i].date] = holidata.days[i].isOffDay; } var now_date = new Date(); var ye = new Intl.DateTimeFormat('en', { year: 'numeric' }).format(now_date); var mo = new Intl.DateTimeFormat('en', { month: '2-digit' }).format(now_date); var da = new Intl.DateTimeFormat('en', { day: '2-digit' }).format(now_date); var day_key = `${ye}-${mo}-${da}`; var is_holiday; if (day_map[day_key] == null) { // 不在国家假日调整表里 console.log("Not in GOV declaration"); Loading @@ -44,24 +44,18 @@ console.log("In GOV declaration"); is_holiday = day_map[day_key]; } if (is_holiday) { console.log("节假日"); var bus_div = document.getElementById("bustable"); var this_day_btn = bus_div.getElementsByTagName("button")[1]; this_day_btn.click(); } else { console.log("工作日"); var bus_div = document.getElementById("bustable"); var this_day_btn = bus_div.getElementsByTagName("button")[0]; this_day_btn.click(); return is_holiday } } }, } </script> <div id="bustable"> <object-selector :objs="{ <data-request path="/2021.json" v-slot="{ data : holidata }"> <object-selector :objs="isHoliday(holidata)?{ '节假日 Holiday': true, '工作日 Workday': false }:{ '工作日 Workday': true, '节假日 Holiday': false }" v-slot="weekdayProps"> Loading @@ -82,6 +76,8 @@ </data-request> </object-selector> </object-selector> </data-request> </div> <Adsense_unit> Loading Loading
docs/.vuepress/components/DataRequest.vue +8 −2 Changes for docs/.vuepress/components/DataRequest.vue: 8 added lines, 2 removed lines. Original line number Diff line number Diff line Loading @@ -35,10 +35,16 @@ export default { props: { path: { type: String }, }, mounted() { if (this.path) return fetchJSONData(this.path).then((data) => { this.data = data; }); }, watch: { path(val) { if (val) return fetchJSONData(val).then((data) => { if (this.path) return fetchJSONData(this.path).then((data) => { this.data = data; }); }, Loading
docs/transport/bustimer-wx.md +14 −18 Changes for docs/transport/bustimer-wx.md: 14 added lines, 18 removed lines. Original line number Diff line number Diff line Loading @@ -17,26 +17,26 @@ navbar: false ## 时间表 Timetable <script> import axios from "axios"; export default { mounted() { axios .get("/2021.json") .then(response => (bus_redirect(response.data))); function bus_redirect(holidata) { methods: { isHoliday: function (holidata) { // JSON is from https://github.com/NateScarlet/holiday-cn // need to update by year. // Download the JSON to path "docs/.vuepress/public/YYYY.json" if (!holidata) return false var day_map = {}; for (let i = 0; i < holidata.days.length; i++) { day_map[holidata.days[i].date] = holidata.days[i].isOffDay; } var now_date = new Date(); var ye = new Intl.DateTimeFormat('en', { year: 'numeric' }).format(now_date); var mo = new Intl.DateTimeFormat('en', { month: '2-digit' }).format(now_date); var da = new Intl.DateTimeFormat('en', { day: '2-digit' }).format(now_date); var day_key = `${ye}-${mo}-${da}`; var is_holiday; if (day_map[day_key] == null) { // 不在国家假日调整表里 console.log("Not in GOV declaration"); Loading @@ -48,24 +48,18 @@ navbar: false console.log("In GOV declaration"); is_holiday = day_map[day_key]; } if (is_holiday) { console.log("节假日"); var bus_div = document.getElementById("bustable"); var this_day_btn = bus_div.getElementsByTagName("button")[1]; this_day_btn.click(); } else { console.log("工作日"); var bus_div = document.getElementById("bustable"); var this_day_btn = bus_div.getElementsByTagName("button")[0]; this_day_btn.click(); return is_holiday } } }, } </script> <div id="bustable"> <object-selector :objs="{ <data-request path="/2021.json" v-slot="{ data : holidata }"> <object-selector :objs="isHoliday(holidata)?{ '节假日 Holiday': true, '工作日 Workday': false }:{ '工作日 Workday': true, '节假日 Holiday': false }" v-slot="weekdayProps"> Loading @@ -86,4 +80,6 @@ navbar: false </data-request> </object-selector> </object-selector> </data-request> </div>
docs/transport/bustimer.md +14 −18 Changes for docs/transport/bustimer.md: 14 added lines, 18 removed lines. Original line number Diff line number Diff line Loading @@ -13,26 +13,26 @@ ## 时间表 Timetable <script> import axios from "axios"; export default { mounted() { axios .get("/2021.json") .then(response => (bus_redirect(response.data))); function bus_redirect(holidata) { methods: { isHoliday: function (holidata) { // JSON is from https://github.com/NateScarlet/holiday-cn // need to update by year. // Download the JSON to path "docs/.vuepress/public/YYYY.json" if (!holidata) return false var day_map = {}; for (let i = 0; i < holidata.days.length; i++) { day_map[holidata.days[i].date] = holidata.days[i].isOffDay; } var now_date = new Date(); var ye = new Intl.DateTimeFormat('en', { year: 'numeric' }).format(now_date); var mo = new Intl.DateTimeFormat('en', { month: '2-digit' }).format(now_date); var da = new Intl.DateTimeFormat('en', { day: '2-digit' }).format(now_date); var day_key = `${ye}-${mo}-${da}`; var is_holiday; if (day_map[day_key] == null) { // 不在国家假日调整表里 console.log("Not in GOV declaration"); Loading @@ -44,24 +44,18 @@ console.log("In GOV declaration"); is_holiday = day_map[day_key]; } if (is_holiday) { console.log("节假日"); var bus_div = document.getElementById("bustable"); var this_day_btn = bus_div.getElementsByTagName("button")[1]; this_day_btn.click(); } else { console.log("工作日"); var bus_div = document.getElementById("bustable"); var this_day_btn = bus_div.getElementsByTagName("button")[0]; this_day_btn.click(); return is_holiday } } }, } </script> <div id="bustable"> <object-selector :objs="{ <data-request path="/2021.json" v-slot="{ data : holidata }"> <object-selector :objs="isHoliday(holidata)?{ '节假日 Holiday': true, '工作日 Workday': false }:{ '工作日 Workday': true, '节假日 Holiday': false }" v-slot="weekdayProps"> Loading @@ -82,6 +76,8 @@ </data-request> </object-selector> </object-selector> </data-request> </div> <Adsense_unit> Loading