1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00

fix windows restart

This commit is contained in:
Luke Pulverenti 2015-09-21 21:05:33 -04:00
parent 4ef47844d8
commit 257a7d2879
18 changed files with 221 additions and 141 deletions

View file

@ -117,7 +117,7 @@
var query = {
StartIndex: DashboardPage.newsStartIndex,
Limit: 5
Limit: 7
};
ApiClient.getProductNews(query).done(function (result) {
@ -126,15 +126,31 @@
var itemHtml = '';
itemHtml += '<div class="newsItem">';
itemHtml += '<a class="newsItemHeader" href="' + item.Link + '" target="_blank">' + item.Title + '</a>';
itemHtml += '<a class="clearLink" href="' + item.Link + '" target="_blank">';
itemHtml += '<paper-icon-item>';
var date = parseISO8601Date(item.Date, { toLocal: true });
itemHtml += '<div class="newsItemDate">' + date.toLocaleDateString() + '</div>';
itemHtml += '<paper-fab class="listAvatar blue" icon="dvr" item-icon></paper-fab>';
itemHtml += '<div class="newsItemDescription">' + item.Description + '</div>';
itemHtml += '<paper-item-body three-line>';
itemHtml += '<div>';
itemHtml += item.Title;
itemHtml += '</div>';
itemHtml += '<div secondary>';
var date = parseISO8601Date(item.Date, { toLocal: true });
itemHtml += date.toLocaleDateString();
itemHtml += '</div>';
itemHtml += '<div secondary>';
itemHtml += item.Description;
itemHtml += '</div>';
itemHtml += '</paper-item-body>';
itemHtml += '</paper-icon-item>';
itemHtml += '</a>';
return itemHtml;
});
@ -1068,61 +1084,43 @@ $(document).on('pageshowready', "#dashboardPage", DashboardPage.onPageShow).on('
var html = '';
html += '<div class="newsItem" style="padding: .5em 0;">';
html += '<paper-icon-item>';
html += '<div class="notificationContent" style="display:block;">';
var color = entry.Severity == 'Error' || entry.Severity == 'Fatal' || entry.Severity == 'Warn' ? '#cc0000' : '#52B54B';
var date = parseISO8601Date(entry.Date, { toLocal: true });
var color = entry.Severity == 'Error' || entry.Severity == 'Fatal' || entry.Severity == 'Warn' ? '#cc0000' : 'green';
html += '<div style="margin: 0;color:' + color + ';">';
if (entry.UserId && entry.UserPrimaryImageTag) {
var userImgUrl = ApiClient.getUserImageUrl(entry.UserId, {
type: 'Primary',
tag: entry.UserPrimaryImageTag,
height: 20
height: 40
});
html += '<img src="' + userImgUrl + '" style="height:20px;vertical-align:middle;margin-right:5px;" />';
html += '<paper-fab class="listAvatar" style="background-color:' + color + ';background-image:url(\'' + userImgUrl + '\');background-repeat:no-repeat;background-position:center center;background-size: cover;" item-icon></paper-fab>';
}
else {
html += '<paper-fab class="listAvatar" icon="dvr" style="background-color:' + color + '" item-icon></paper-fab>';
}
html += date.toLocaleDateString() + ' ' + date.toLocaleTimeString().toLowerCase();
html += '</div>';
html += '<paper-item-body three-line>';
html += '<div class="notificationName" style="margin:.5em 0 0;white-space:nowrap;">';
html += '<div>';
html += entry.Name;
html += '</div>';
entry.ShortOverview = entry.ShortOverview || '&nbsp;';
if (entry.ShortOverview) {
html += '<div class="newsItemDescription" style="margin: .5em 0 0;">';
if (entry.Overview) {
html += '<a href="#" class="btnShowOverview" style="text-decoration:none;font-weight:500;">';
}
html += entry.ShortOverview;
if (entry.Overview) {
html += '</a>';
}
html += '</div>';
if (entry.Overview) {
html += '<div class="newsItemLongDescription" style="display:none;">' + entry.Overview + '</div>';
}
}
//if (notification.Url) {
// html += '<p style="margin: .25em 0;"><a href="' + notification.Url + '" target="_blank">' + Globalize.translate('ButtonMoreInformation') + '</a></p>';
//}
html += '<div secondary>';
var date = parseISO8601Date(entry.Date, { toLocal: true });
html += date.toLocaleDateString();
html += '</div>';
html += '<div secondary>';
html += entry.ShortOverview || '';
html += '</div>';
html += '</paper-item-body>';
html += '</paper-icon-item>';
return html;
}

View file

@ -302,7 +302,13 @@
$('.itemTabs', page).hide();
if (context == 'tv') {
$(page).removeClass('noSecondaryNavPage');
if (AppInfo.enableBottomTabs) {
$(page).addClass('noSecondaryNavPage');
}
else {
$(page).removeClass('noSecondaryNavPage');
}
$('#tvShowsTabs', page).show();
LibraryMenu.setMenuButtonVisible(true);

View file

@ -273,25 +273,20 @@
function fadeOutLeft(elem, iterations) {
var keyframes = [{ opacity: '1', transform: 'none', offset: 0 },
{ opacity: '0', transform: 'translate3d(-100%, 0, 0)', offset: 1 }];
var timing = { duration: 600, iterations: iterations };
var timing = { duration: 400, iterations: iterations };
return elem.animate(keyframes, timing);
}
if (!LibraryBrowser.navigateOnLibraryTabSelect()) {
tabs.addEventListener('iron-select', function () {
var animateTab = !$.browser.safari;
var selected = pages.selected;
if (selected != null) {
if (selected != null && animateTab) {
var newValue = this.selected;
var currentTab = pages.querySelectorAll('.pageTabContent')[selected];
if ($.browser.safari) {
// Need this it flashes the previous content after the animation
currentTab.classList.add('hidingAnimatedTab');
}
fadeOutLeft(currentTab, 1).onfinish = function () {
pages.selected = newValue;
setTimeout(function () { currentTab.classList.remove('hidingAnimatedTab'); }, 500);
};
}
else {
@ -926,16 +921,16 @@
var href = LibraryBrowser.getHrefInternal(item, context);
//if (context != 'livetv') {
// if (topParentId == null && context != 'playlists') {
// topParentId = LibraryMenu.getTopParentId();
// }
if (context == 'tv') {
if (!topParentId) {
topParentId = LibraryMenu.getTopParentId();
}
// if (topParentId) {
// href += href.indexOf('?') == -1 ? "?topParentId=" : "&topParentId=";
// href += topParentId;
// }
//}
if (topParentId) {
href += href.indexOf('?') == -1 ? "?topParentId=" : "&topParentId=";
href += topParentId;
}
}
return href;
},

View file

@ -28,12 +28,14 @@
html += '<paper-icon-button icon="mic" class="headerButton headerButtonRight headerVoiceButton hide" onclick="VoiceInputManager.startListening();"></paper-icon-button>';
//html += '<paper-button class="headerButton headerButtonRight btnNotifications subdued" type="button" title="Notifications"><div class="btnNotificationsInner">0</div></paper-button>';
if (!showUserAtTop()) {
html += '<paper-icon-button icon="person" class="headerButton headerButtonRight headerUserButton" onclick="return Dashboard.showUserFlyout(this);"></paper-icon-button>';
}
if (!$.browser.mobile && !Dashboard.isConnectMode()) {
html += '<paper-icon-button icon="settings" class="headerButton headerButtonRight dashboardEntryHeaderButton hide" onclick="return LibraryMenu.onSettingsClicked(event);"></paper-icon-button>';
html += '<paper-icon-button icon="settings" class="headerButton headerButtonRight dashboardEntryHeaderButton" onclick="return LibraryMenu.onSettingsClicked(event);"></paper-icon-button>';
}
html += '</div>';
@ -350,11 +352,6 @@
html += '<div class="sidebarDivider"></div>';
html += '<a class="sidebarLink lnkMediaFolder sidebarLinkNotifications" data-itemid="inbox" onclick="return LibraryMenu.onLinkClicked(event, this);" href="notificationlist.html"><iron-icon icon="inbox" class="sidebarLinkIcon"></iron-icon>';
html += Globalize.translate('ButtonInbox');
html += '<div class="btnNotifications"><div class="btnNotificationsInner">0</div></div>';
html += '</a>';
if (user.localUser && showUserAtTop()) {
html += '<a class="sidebarLink lnkMediaFolder lnkMySettings" onclick="return LibraryMenu.onLinkClicked(event, this);" data-itemid="mysync" href="mypreferencesmenu.html?userId=' + user.localUser.Id + '"><iron-icon icon="settings" class="sidebarLinkIcon"></iron-icon><span class="sidebarLinkText">' + Globalize.translate('ButtonSettings') + '</span></a>';
}

View file

@ -9,22 +9,29 @@
return AppInfo.isNativeApp;
},
startSync: function () {
sync: function (options) {
if (!syncPromise) {
require(['multiserversync'], function () {
lastStart = new Date().getTime();
syncPromise = new MediaBrowser.MultiServerSync(ConnectionManager).sync().done(function () {
syncPromise = null;
}).fail(function () {
syncPromise = null;
});
});
if (syncPromise) {
return syncPromise.promise();
}
var deferred = DeferredBuilder.Deferred();
require(['multiserversync'], function () {
lastStart = new Date().getTime();
syncPromise = new MediaBrowser.MultiServerSync(ConnectionManager).sync(options).done(function () {
syncPromise = null;
deferred.resolve();
}).fail(function () {
syncPromise = null;
});
});
return deferred.promise();
},
getSyncStatus: function () {
@ -42,12 +49,12 @@
if (LocalSync.isSupported) {
setInterval(function () {
LocalSync.startSync();
//LocalSync.startSync();
}, syncInterval);
if (lastStart > 0 && (now - lastStart) >= syncInterval) {
LocalSync.startSync();
//LocalSync.startSync();
}
}
//LocalSync.startSync();

View file

@ -26,7 +26,7 @@
require(['localsync'], function () {
LocalSync.startSync();
LocalSync.sync();
Dashboard.alert(Globalize.translate('MessageSyncStarted'));
refreshSyncStatus(page);
});

View file

@ -27,6 +27,10 @@
return;
}
if (!window.ApiClient) {
return;
}
var promise = self.getNotificationsSummary();
if (!promise) {
@ -168,13 +172,7 @@
}
window.Notifications = new notifications();
$(document).on('libraryMenuCreated', function (e) {
if (window.ApiClient) {
Notifications.updateNotificationCount();
}
});
var needsRefresh = true;
function onWebSocketMessage(e, msg) {
if (msg.MessageType === "NotificationUpdated" || msg.MessageType === "NotificationAdded" || msg.MessageType === "NotificationsMarkedRead") {
@ -198,6 +196,24 @@
$(ConnectionManager).on('apiclientcreated', function (e, apiClient) {
initializeApiClient(apiClient);
});
Events.on(ConnectionManager, 'localusersignedin', function () {
needsRefresh = true;
});
Events.on(ConnectionManager, 'localusersignedout', function () {
needsRefresh = true;
});
});
pageClassOn('pageshowready', "type-interior", function () {
var page = $(this);
if (needsRefresh) {
Notifications.updateNotificationCount();
}
});
})(jQuery, document, Dashboard, LibraryBrowser);

View file

@ -1408,10 +1408,14 @@ var Dashboard = {
setPageTitle: function (title) {
var elem = $($.mobile.activePage)[0].querySelector('.pageTitle');
var page = $.mobile.activePage;
if (elem) {
elem.innerHTML = title;
if (page) {
var elem = $(page)[0].querySelector('.pageTitle');
if (elem) {
elem.innerHTML = title;
}
}
if (title) {
@ -2281,6 +2285,9 @@ var AppInfo = {};
if (AppInfo.isNativeApp && !$.browser.android) {
require(['localsync']);
}
if (AppInfo.isNativeApp && $.browser.safari) {
require(['cordova/ios/backgroundfetch']);
}
//require(['localsync']);
}

View file

@ -339,7 +339,7 @@
function onWebSocketMessage(e, msg) {
var page = $.mobile.activePage;
var page = $($.mobile.activePage)[0];
if (msg.MessageType == "SyncJobs") {