prompt error message when localstroage and cookies are unavailable
This commit is contained in:
parent
7d804424ab
commit
63356e6b7d
|
@ -212,6 +212,7 @@ URL is not base64 encoded!=指定 URL 不是 Base64 编码后的字符串!
|
||||||
Tap to configure and get started with AriaNg.=您还没有进行过设置, 点击这里进行设置.
|
Tap to configure and get started with AriaNg.=您还没有进行过设置, 点击这里进行设置.
|
||||||
Cannot initialize WebSocket!=无法初始化 WebSocket!
|
Cannot initialize WebSocket!=无法初始化 WebSocket!
|
||||||
Access Denied!=拒绝访问!
|
Access Denied!=拒绝访问!
|
||||||
|
You cannot use AriaNg because this browser does not support data storage.=您无法使用 AriaNg, 您的浏览器不支持数据存储.
|
||||||
|
|
||||||
[error]
|
[error]
|
||||||
unknown=未知错误.
|
unknown=未知错误.
|
||||||
|
|
|
@ -212,6 +212,7 @@ URL is not base64 encoded!=指定 URL 不是 Base64 編碼後的字串!
|
||||||
Tap to configure and get started with AriaNg.=您還沒有進行過設定, 點選這裡進行設定.
|
Tap to configure and get started with AriaNg.=您還沒有進行過設定, 點選這裡進行設定.
|
||||||
Cannot initialize WebSocket!=無法初始化 WebSocket!
|
Cannot initialize WebSocket!=無法初始化 WebSocket!
|
||||||
Access Denied!=拒絕訪問!
|
Access Denied!=拒絕訪問!
|
||||||
|
You cannot use AriaNg because this browser does not support data storage.=您無法使用 AriaNg, 您的瀏覽器不支援資料儲存.
|
||||||
|
|
||||||
[error]
|
[error]
|
||||||
unknown=不詳錯誤.
|
unknown=不詳錯誤.
|
||||||
|
|
|
@ -217,6 +217,7 @@
|
||||||
'Tap to configure and get started with AriaNg.': 'Tap to configure and get started with AriaNg.',
|
'Tap to configure and get started with AriaNg.': 'Tap to configure and get started with AriaNg.',
|
||||||
'Cannot initialize WebSocket!': 'Cannot initialize WebSocket!',
|
'Cannot initialize WebSocket!': 'Cannot initialize WebSocket!',
|
||||||
'Access Denied!': 'Access Denied!',
|
'Access Denied!': 'Access Denied!',
|
||||||
|
'You cannot use AriaNg because this browser does not support data storage.': 'You cannot use AriaNg because this browser does not support data storage.',
|
||||||
'error': {
|
'error': {
|
||||||
'unknown': 'Unknown error occurred.',
|
'unknown': 'Unknown error occurred.',
|
||||||
'operation.timeout': 'Operation timed out.',
|
'operation.timeout': 'Operation timed out.',
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
(function () {
|
(function () {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
angular.module('ariaNg').run(['$rootScope', '$location', '$document', 'SweetAlert', 'ariaNgNotificationService', 'ariaNgSettingService', 'aria2TaskService', function ($rootScope, $location, $document, SweetAlert, ariaNgNotificationService, ariaNgSettingService, aria2TaskService) {
|
angular.module('ariaNg').run(['$rootScope', '$location', '$document', 'SweetAlert', 'ariaNgNotificationService', 'ariaNgSettingService', 'ariaNgLogService', 'aria2TaskService', function ($rootScope, $location, $document, SweetAlert, ariaNgNotificationService, ariaNgSettingService, ariaNgLogService, aria2TaskService) {
|
||||||
var isUrlMatchUrl2 = function (url, url2) {
|
var isUrlMatchUrl2 = function (url, url2) {
|
||||||
if (url === url2) {
|
if (url === url2) {
|
||||||
return true;
|
return true;
|
||||||
|
@ -22,6 +22,29 @@
|
||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
var initCheck = function () {
|
||||||
|
var browserFeatures = ariaNgSettingService.getBrowserFeatures();
|
||||||
|
|
||||||
|
if (!browserFeatures.localStroage) {
|
||||||
|
ariaNgLogService.warn('[root.initCheck] LocalStorage is not supported!');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!browserFeatures.cookies) {
|
||||||
|
ariaNgLogService.warn('[root.initCheck] Cookies is not supported!');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!ariaNgSettingService.isBrowserSupportStorage()) {
|
||||||
|
angular.element('body').prepend('<div class="disable-overlay"></div>');
|
||||||
|
angular.element('.main-sidebar').addClass('blur');
|
||||||
|
angular.element('.navbar').addClass('blur');
|
||||||
|
angular.element('.content-body').addClass('blur');
|
||||||
|
ariaNgNotificationService.notifyInPage('', 'You cannot use AriaNg because this browser does not support data storage.', {
|
||||||
|
type: 'error',
|
||||||
|
delay: false
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
var initNavbar = function () {
|
var initNavbar = function () {
|
||||||
angular.element('section.sidebar > ul > li[data-href-match] > a').click(function () {
|
angular.element('section.sidebar > ul > li[data-href-match] > a').click(function () {
|
||||||
angular.element('section.sidebar > ul li').removeClass('active');
|
angular.element('section.sidebar > ul li').removeClass('active');
|
||||||
|
@ -219,6 +242,7 @@
|
||||||
$document.unbind('keypress');
|
$document.unbind('keypress');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
initCheck();
|
||||||
initNavbar();
|
initNavbar();
|
||||||
}]);
|
}]);
|
||||||
}());
|
}());
|
||||||
|
|
|
@ -2,6 +2,17 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
angular.module('ariaNg').factory('ariaNgSettingService', ['$window', '$location', '$filter', '$translate', 'base64', 'amMoment', 'localStorageService', 'ariaNgConstants', 'ariaNgDefaultOptions', 'ariaNgLanguages', 'ariaNgCommonService', function ($window, $location, $filter, $translate, base64, amMoment, localStorageService, ariaNgConstants, ariaNgDefaultOptions, ariaNgLanguages, ariaNgCommonService) {
|
angular.module('ariaNg').factory('ariaNgSettingService', ['$window', '$location', '$filter', '$translate', 'base64', 'amMoment', 'localStorageService', 'ariaNgConstants', 'ariaNgDefaultOptions', 'ariaNgLanguages', 'ariaNgCommonService', function ($window, $location, $filter, $translate, base64, amMoment, localStorageService, ariaNgConstants, ariaNgDefaultOptions, ariaNgLanguages, ariaNgCommonService) {
|
||||||
|
var browserFeatures = (function () {
|
||||||
|
var supportLocalStroage = localStorageService.isSupported;
|
||||||
|
var supportCookies = $window.navigator.cookieEnabled;
|
||||||
|
|
||||||
|
return {
|
||||||
|
localStroage: supportLocalStroage,
|
||||||
|
cookies: supportCookies
|
||||||
|
};
|
||||||
|
})();
|
||||||
|
var browserSupportStorage = browserFeatures.localStroage || browserFeatures.cookies;
|
||||||
|
|
||||||
var onFirstVisitCallbacks = [];
|
var onFirstVisitCallbacks = [];
|
||||||
var firstVisitCallbackfired = false;
|
var firstVisitCallbackfired = false;
|
||||||
var sessionSettings = {
|
var sessionSettings = {
|
||||||
|
@ -9,6 +20,10 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
var fireFirstVisitEvent = function () {
|
var fireFirstVisitEvent = function () {
|
||||||
|
if (!browserSupportStorage) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (firstVisitCallbackfired || !angular.isArray(onFirstVisitCallbacks) || onFirstVisitCallbacks.length < 1) {
|
if (firstVisitCallbackfired || !angular.isArray(onFirstVisitCallbacks) || onFirstVisitCallbacks.length < 1) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -182,6 +197,12 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
isBrowserSupportStorage: function () {
|
||||||
|
return browserSupportStorage;
|
||||||
|
},
|
||||||
|
getBrowserFeatures: function () {
|
||||||
|
return browserFeatures;
|
||||||
|
},
|
||||||
getAllOptions: function () {
|
getAllOptions: function () {
|
||||||
var options = angular.extend({}, ariaNgDefaultOptions, getOptions());
|
var options = angular.extend({}, ariaNgDefaultOptions, getOptions());
|
||||||
|
|
||||||
|
|
|
@ -22,6 +22,24 @@ td {
|
||||||
vertical-align: middle !important;
|
vertical-align: middle !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.blur {
|
||||||
|
-webkit-filter: blur(5px);
|
||||||
|
-moz-filter: blur(5px);
|
||||||
|
-ms-filter: blur(5px);
|
||||||
|
filter: blur(5px);
|
||||||
|
filter: progid:DXImageTransform.Microsoft.Blur(PixelRadius=5, MakeShadow=false);
|
||||||
|
}
|
||||||
|
|
||||||
|
.disable-overlay {
|
||||||
|
position: fixed;
|
||||||
|
left: 0;
|
||||||
|
top: 0;
|
||||||
|
right: 0;
|
||||||
|
bottom: 0;
|
||||||
|
z-index: 9999;
|
||||||
|
cursor: not-allowed;
|
||||||
|
}
|
||||||
|
|
||||||
.main-header .logo {
|
.main-header .logo {
|
||||||
overflow: visible;
|
overflow: visible;
|
||||||
}
|
}
|
||||||
|
|
Reference in a new issue