jellyfin-web/dashboard-ui/devices/ie/ie.js

63 lines
2.0 KiB
JavaScript
Raw Normal View History

2016-03-07 12:13:58 -07:00
define(['browser', 'appStorage'], function (browser, appStorage) {
2015-10-17 09:29:42 -07:00
2015-12-14 08:43:03 -07:00
require(['css!devices/ie/ie.css']);
var browserSwitchKey = "ieswitchbrowser";
function getWeek(date) {
var onejan = new Date(date.getFullYear(), 0, 1);
2016-01-22 18:35:43 -07:00
return Math.ceil((((date - onejan) / 86400000) + onejan.getDay() + 1) / 4);
2015-12-14 08:43:03 -07:00
}
2015-10-17 09:29:42 -07:00
function onPageShow() {
2015-12-14 08:43:03 -07:00
var expectedValue;
var msg;
2015-10-18 16:23:48 -07:00
if (navigator.userAgent.toLowerCase().indexOf('windows nt 10.') != -1) {
2015-10-17 09:29:42 -07:00
2015-12-14 08:43:03 -07:00
expectedValue = new Date().toDateString() + "1";
if (appStorage.getItem(browserSwitchKey) == expectedValue) {
2015-10-17 09:29:42 -07:00
return;
}
2015-12-14 08:43:03 -07:00
msg = Globalize.translate('MessageTryMicrosoftEdge');
2015-10-17 09:29:42 -07:00
msg += "<br/><br/>";
msg += '<a href="https://www.microsoft.com/en-us/windows/microsoft-edge" target="_blank">' + Globalize.translate('ButtonLearnMore') + '</a>';
Dashboard.alert({
message: msg,
title: Globalize.translate('HeaderTryMicrosoftEdge')
});
2015-10-18 16:23:48 -07:00
2016-01-24 15:00:57 -07:00
} else if (!browser.mobile) {
2015-12-14 08:43:03 -07:00
expectedValue = getWeek(new Date()) + "_7";
if (appStorage.getItem(browserSwitchKey) == expectedValue) {
return;
}
if (!appStorage.getItem(browserSwitchKey)) {
appStorage.setItem(browserSwitchKey, expectedValue);
return;
}
msg = Globalize.translate('MessageTryModernBrowser');
msg += "<br/><br/>";
msg += '<a href="https://www.google.com/chrome" target="_blank">' + Globalize.translate('ButtonLearnMore') + '</a>';
Dashboard.alert({
message: msg,
title: Globalize.translate('HeaderTryModernBrowser')
});
2015-10-17 09:29:42 -07:00
}
2015-12-14 08:43:03 -07:00
appStorage.setItem(browserSwitchKey, expectedValue);
2015-10-17 09:29:42 -07:00
}
pageClassOn('pageshow', "libraryPage", onPageShow);
pageClassOn('pageshow', "type-interior", onPageShow);
2016-01-24 15:00:57 -07:00
});