|
|
@@ -6,10 +6,18 @@
|
|
|
* @time 17:42
|
|
|
*/
|
|
|
|
|
|
+var fetchHeaders = {
|
|
|
+ 'Accept': 'text/html',
|
|
|
+ 'Content-Type': 'text/html',
|
|
|
+ 'X-Requested-With': 'XMLHttpRequest',
|
|
|
+ 'Cache-Control': 'no-cache',
|
|
|
+ 'Pragma': 'no-cache',
|
|
|
+ 'Expires': '0'
|
|
|
+};
|
|
|
function NotificationBuilder(notifications) {
|
|
|
let tplNotify = '';
|
|
|
let htmlNotificationArea = '';
|
|
|
- if (notifications.length == 0) {
|
|
|
+ if (notifications.length === 0) {
|
|
|
$('#notification_area_button').addClass('disabled');
|
|
|
$('#sysmsgnum').empty();
|
|
|
} else {
|
|
|
@@ -30,9 +38,9 @@ ${tplNotify}
|
|
|
}
|
|
|
|
|
|
function refreshNotificationArea() {
|
|
|
- fetch(`${BASEURL}/api.system.getserverstatus`)
|
|
|
+ fetch(`${BASEURL}/api.system.getserverstatus`, {headers: fetchHeaders})
|
|
|
.then(resp => {
|
|
|
- if (resp.status == 200)
|
|
|
+ if (resp.status === 200)
|
|
|
return resp.json();
|
|
|
else
|
|
|
return Promise.reject("getserverstatus: error");
|
|
|
@@ -48,7 +56,7 @@ function refreshNotificationArea() {
|
|
|
function NotificationDelete(link, code) {
|
|
|
fetch(`${BASEURL}/api.system.removenotification/${code}`, {method: "POST"})
|
|
|
.then(() => {
|
|
|
- if (link != '#')
|
|
|
+ if (link !== '#')
|
|
|
window.location.href = `${BASEURL}${link}`;
|
|
|
})
|
|
|
.catch(() => {
|
|
|
@@ -75,18 +83,20 @@ $(function () {
|
|
|
|
|
|
refreshNotificationArea();
|
|
|
|
|
|
- ForceFocus();
|
|
|
+ ForceFocus(); // INPUT AUTOFOCUS
|
|
|
|
|
|
- $('form').on('submit', function () {
|
|
|
- $('form input,select').prop('disabled', false);
|
|
|
+ $('#filters #filterIndex').val(currentFilterIdx);
|
|
|
+
|
|
|
+ $('body').on('submit', 'form', function () {
|
|
|
+ $('form input,form select').prop('disabled', false);
|
|
|
setTimeout(function () {
|
|
|
- $('form input,select').prop('disabled', true);
|
|
|
+ $('form input,form select').prop('disabled', true);
|
|
|
}, 500);
|
|
|
});
|
|
|
|
|
|
setInterval(() => {
|
|
|
refreshNotificationArea();
|
|
|
- }, 10000);
|
|
|
+ }, 3000);
|
|
|
});
|
|
|
|
|
|
|