IMPR: Offline functionality

This commit is contained in:
Tony Air 2020-04-02 07:54:52 +07:00
parent df000626f8
commit 163461bf3c
7 changed files with 43 additions and 27 deletions

8
dist/css/app.css vendored
View File

@ -15383,6 +15383,14 @@ textarea,
}
}
.alert-offline {
display: none;
}
body.is-offline .alert-offline {
display: block;
}
input.date[readonly],
input.time[readonly] {
background-color: #fff;

File diff suppressed because one or more lines are too long

2
dist/js/app.js vendored

File diff suppressed because one or more lines are too long

2
dist/js/app.js.map vendored

File diff suppressed because one or more lines are too long

View File

@ -1,6 +1,6 @@
{
"name": "@a2nt/ss-bootstrap-ui-webpack-boilerplate",
"version": "1.8.7",
"version": "1.8.9",
"author": "Tony Air <tony@twma.pro>",
"license": "MIT",
"description": "This UI Kit allows you to build Bootstrap 4 webapp with some extra UI features. It's easy to extend and easy to convert HTML templates to CMS templates.",

View File

@ -4,7 +4,7 @@ import $ from 'jquery';
import Events from './_events';
const LayoutUI = ($ => {
const LayoutUI = (($) => {
// Constants
const W = window;
const D = document;

View File

@ -49,6 +49,9 @@ const MainUI = (($) => {
// update online/offline state
const updateOnlineStatus = () => {
if (typeof navigator.onLine === 'undefined') {
return;
}
if (!navigator.onLine) {
console.log('Tab: offline');
$Body.addClass('is-offline');
@ -60,7 +63,6 @@ const MainUI = (($) => {
}
};
if (typeof navigator.onLine !== 'undefined') {
W.addEventListener(
'offline',
() => {
@ -80,7 +82,10 @@ const MainUI = (($) => {
W.addEventListener('load', () => {
updateOnlineStatus();
});
}
$(W).on(`${Events.AJAX}`, () => {
updateOnlineStatus();
});
// scrollTo
const ScrollTo = (trigger, selector) => {
@ -359,7 +364,10 @@ const MainUI = (($) => {
});
}
if ($AlertNotify.length && typeof $AlertNotify[0].stop !== 'undefined') {
if (
$AlertNotify.length &&
typeof $AlertNotify[0].stop !== 'undefined'
) {
$AlertNotify[0].stop();
}