Додане повідомлення про оновлення застосунку Оновлен Service Worker Перероблен WebSocket APІ
75 lines
2.0 KiB
JavaScript
75 lines
2.0 KiB
JavaScript
Router
|
|
.add('auth', function () {
|
|
pageActive('');
|
|
Auth.init();;
|
|
})
|
|
.add('territory/constructor', function () {
|
|
pageActive();
|
|
Territory_constructor.init();;
|
|
})
|
|
.add('territory/manager/(.*)/(.*)', function (type, id) {
|
|
pageActive();
|
|
Territory_Manager.init(type, id);
|
|
})
|
|
.add('territory/editor/(.*)/(.*)', function (type, id) {
|
|
pageActive();
|
|
Territory_editor.init(type, id);
|
|
})
|
|
.add('territory/card/(.*)/(.*)', function (type, id) {
|
|
pageActive();
|
|
Territory_card.init(type, id);
|
|
})
|
|
.add('territory/history', function () {
|
|
pageActive();
|
|
Territory_History.init();
|
|
})
|
|
.add('territory', function () {
|
|
pageActive('territory');
|
|
Territory_list.init();
|
|
})
|
|
.add('sheeps/(.*)', function (name) {
|
|
pageActive('sheeps');
|
|
Sheeps.init(name);;
|
|
})
|
|
.add('sheeps', function () {
|
|
pageActive('sheeps');
|
|
Sheeps.init();;
|
|
})
|
|
.add('home', function () {
|
|
pageActive('home');
|
|
Home.init();
|
|
})
|
|
.add('schedule', function () {
|
|
pageActive('schedule');
|
|
Schedule.init();;
|
|
})
|
|
.add('stand/constructor', function () {
|
|
pageActive();
|
|
Stand_constructor.init();;
|
|
})
|
|
.add('stand/card/(.*)', function (id) {
|
|
pageActive();
|
|
Stand_card.init(id);;
|
|
})
|
|
.add('stand', function () {
|
|
pageActive('stand');
|
|
Stand_list.init();;
|
|
})
|
|
.add('options', function () {
|
|
pageActive('options');
|
|
Options.init();;
|
|
})
|
|
.add(function () {
|
|
page_404();;
|
|
pageActive();
|
|
})
|
|
|
|
function pageActive(element) {
|
|
const active = document.querySelector("nav li [data-state='active']");
|
|
if (active) active.setAttribute('data-state', '');
|
|
|
|
if (element) {
|
|
const target = document.getElementById(`nav-${element}`);
|
|
if (target) target.setAttribute('data-state', 'active');
|
|
}
|
|
} |