add
This commit is contained in:
1 parent
bea0fff388
commit
4ac51969e2
37 files changed
+1270
-166
No files matched your search
+9
-2
@@ -1,5 +1,5 @@
|
||||
/* ============================================================
|
||||
AT Transit — hash router (single-page app)
|
||||
Atroute — hash router (single-page app)
|
||||
------------------------------------------------------------
|
||||
สลับ view โดยไม่โหลดหน้าใหม่ (no reflash):
|
||||
- #/ → หน้าแรก (partials/home.html)
|
||||
@@ -25,6 +25,8 @@
|
||||
check: { partial: 'partials/checkSchedule.html', nav: '/check', title: 'เช็กเวลาเดินรถ' },
|
||||
stop: { partial: 'partials/stopDetail.html', nav: '/stops/', title: 'รายละเอียดป้าย' },
|
||||
credits: { partial: 'partials/credits.html', nav: '/credits', title: 'เครดิต' },
|
||||
about: { partial: 'partials/about.html', nav: '/about', title: 'เกี่ยวกับเรา' },
|
||||
blog: { partial: 'partials/blog.html', nav: '/blog', title: 'บ่นไปเรื่อย' },
|
||||
};
|
||||
|
||||
function parseHash() {
|
||||
@@ -49,6 +51,11 @@
|
||||
return { name: 'stops', params: {}, query: query };
|
||||
}
|
||||
if (seg[0] === 'credits') return { name: 'credits', params: {}, query: query };
|
||||
if (seg[0] === 'about') return { name: 'about', params: {}, query: query };
|
||||
if (seg[0] === 'blog') {
|
||||
if (seg[1]) return { name: 'blog', params: { postId: decodeURIComponent(seg[1]) }, query: query };
|
||||
return { name: 'blog', params: {}, query: query };
|
||||
}
|
||||
if (seg[0] === 'check') return { name: 'check', params: {}, query: query };
|
||||
return { name: 'home', params: {}, query: query };
|
||||
}
|
||||
@@ -107,7 +114,7 @@
|
||||
var stateEl = viewEl.querySelector('.mu-inline-context strong');
|
||||
if (stateEl) stateEl.textContent = '?route=' + route.params.routeId;
|
||||
}
|
||||
document.title = 'AT Transit — ' + view.title;
|
||||
document.title = 'Atroute — ' + view.title;
|
||||
window.scrollTo(0, 0);
|
||||
})
|
||||
.catch(function () {
|
||||
|
||||
Reference in new issue
Block a user