mirror of
https://github.com/a2nt/webpack-bootstrap-ui-kit.git
synced 2024-10-22 11:05:45 +02:00
IMPR: Offline functionality
This commit is contained in:
parent
df000626f8
commit
163461bf3c
8
dist/css/app.css
vendored
8
dist/css/app.css
vendored
@ -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;
|
||||
|
2
dist/css/app.css.map
vendored
2
dist/css/app.css.map
vendored
File diff suppressed because one or more lines are too long
2
dist/js/app.js
vendored
2
dist/js/app.js
vendored
File diff suppressed because one or more lines are too long
2
dist/js/app.js.map
vendored
2
dist/js/app.js.map
vendored
File diff suppressed because one or more lines are too long
@ -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.",
|
||||
|
@ -4,7 +4,7 @@ import $ from 'jquery';
|
||||
|
||||
import Events from './_events';
|
||||
|
||||
const LayoutUI = ($ => {
|
||||
const LayoutUI = (($) => {
|
||||
// Constants
|
||||
const W = window;
|
||||
const D = document;
|
||||
|
@ -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,27 +63,29 @@ const MainUI = (($) => {
|
||||
}
|
||||
};
|
||||
|
||||
if (typeof navigator.onLine !== 'undefined') {
|
||||
W.addEventListener(
|
||||
'offline',
|
||||
() => {
|
||||
updateOnlineStatus();
|
||||
},
|
||||
false,
|
||||
);
|
||||
|
||||
W.addEventListener(
|
||||
'online',
|
||||
() => {
|
||||
updateOnlineStatus();
|
||||
},
|
||||
false,
|
||||
);
|
||||
|
||||
W.addEventListener('load', () => {
|
||||
W.addEventListener(
|
||||
'offline',
|
||||
() => {
|
||||
updateOnlineStatus();
|
||||
});
|
||||
}
|
||||
},
|
||||
false,
|
||||
);
|
||||
|
||||
W.addEventListener(
|
||||
'online',
|
||||
() => {
|
||||
updateOnlineStatus();
|
||||
},
|
||||
false,
|
||||
);
|
||||
|
||||
W.addEventListener('load', () => {
|
||||
updateOnlineStatus();
|
||||
});
|
||||
|
||||
$(W).on(`${Events.AJAX}`, () => {
|
||||
updateOnlineStatus();
|
||||
});
|
||||
|
||||
// scrollTo
|
||||
const ScrollTo = (trigger, selector) => {
|
||||
@ -324,7 +329,7 @@ const MainUI = (($) => {
|
||||
|
||||
W.URLDetails.relative = location.split('#')[0];
|
||||
W.URLDetails.hash =
|
||||
hash >= 0 ? location.substr(location.indexOf('#')) : '';
|
||||
hash >= 0 ? location.substr(location.indexOf('#')) : '';
|
||||
}
|
||||
|
||||
// show site-wide alert
|
||||
@ -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();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user