This commit is contained in:
SuperSonic 2020-02-26 06:20:54 +08:00
parent f58271bb40
commit cf128b3339
2 changed files with 10 additions and 7 deletions

View file

@ -9,8 +9,9 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
function nav_items(active, path, path_name) {
if (active)
if (active) {
return "<a class=\"nav-link active\" href=\"" + path + "\">" + path_name + "</a>";
}
return "<a class=\"nav-link\" data-transition-enter=\"slideleft\" href=\"" + path + "\">" + path_name + "</a>";
}
@ -23,10 +24,11 @@ function header2html(yuuki_name) {
};
let nav_list = "";
Object.keys(page_list).forEach(p_key => {
if (window.location.pathname === p_key)
if (window.location.pathname === p_key) {
nav_list += nav_items(true, p_key, page_list[p_key])
else
} else {
nav_list += nav_items(false, p_key, page_list[p_key])
}
});
return "<nav class=\"navbar navbar-expand-md navbar-dark fixed-top bg-dark\">" +
"<a class=\"navbar-brand\" href=\"/\">" + yuuki_name + " - WebAdmin</a>" +
@ -47,4 +49,4 @@ $(function () {
$.get("/api/i", function (data) {
$("#header").html(header2html(data));
});
});
});

View file

@ -21,10 +21,11 @@ function init(id, data) {
},
success: function (response) {
let ajax_result = response.result;
if (ajax_result.length)
if (ajax_result.length) {
$(id).text(ajax_result[ajax_result.length - 1]);
else
} else {
$(id).text("Nothing");
}
}
});
}
@ -34,4 +35,4 @@ $(function () {
init("#Kick_Event", "KickEvent");
init("#Cancel_Event", "CancelEvent");
init("#Block_Event", "BlackList");
});
});