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

@ -4,18 +4,18 @@
var self = this; var self = this;
self.sync = function () { self.sync = function (options) {
var deferred = DeferredBuilder.Deferred(); var deferred = DeferredBuilder.Deferred();
connectionManager.getAvailableServers().done(function (result) { connectionManager.getAvailableServers().done(function (result) {
syncNext(result, 0, deferred); syncNext(result, 0, options, deferred);
}); });
return deferred.promise(); return deferred.promise();
}; };
function syncNext(servers, index, deferred) { function syncNext(servers, index, options, deferred) {
var length = servers.length; var length = servers.length;
@ -34,13 +34,13 @@
require(['serversync'], function () { require(['serversync'], function () {
new MediaBrowser.ServerSync(connectionManager).sync(server).done(function () { new MediaBrowser.ServerSync(connectionManager).sync(server, options).done(function () {
syncNext(servers, index + 1, deferred); syncNext(servers, index + 1, options, deferred);
}).fail(function () { }).fail(function () {
syncNext(servers, index + 1, deferred); syncNext(servers, index + 1, options, deferred);
}); });
}); });
} }

View file

@ -4,7 +4,7 @@
var self = this; var self = this;
self.sync = function (server) { self.sync = function (server, options) {
var deferred = DeferredBuilder.Deferred(); var deferred = DeferredBuilder.Deferred();
@ -24,7 +24,7 @@
connectionManager.connectToServer(server, connectionOptions).done(function (result) { connectionManager.connectToServer(server, connectionOptions).done(function (result) {
if (result.State == MediaBrowser.ConnectionState.SignedIn) { if (result.State == MediaBrowser.ConnectionState.SignedIn) {
performSync(server, deferred); performSync(server, options, deferred);
} else { } else {
Logger.log('Unable to connect to server id: ' + server.Id); Logger.log('Unable to connect to server id: ' + server.Id);
deferred.reject(); deferred.reject();
@ -39,23 +39,34 @@
return deferred.promise(); return deferred.promise();
}; };
function performSync(server, deferred) { function performSync(server, options, deferred) {
Logger.log("Creating ContentUploader to server: " + server.Id); Logger.log("Creating ContentUploader to server: " + server.Id);
var nextAction = function () {
syncOfflineUsers(server, deferred);
};
options = options || {};
if (options.uploadPhotos === false) {
nextAction();
return;
}
require(['contentuploader'], function () { require(['contentuploader'], function () {
new MediaBrowser.ContentUploader(connectionManager).uploadImages(server).done(function () { new MediaBrowser.ContentUploader(connectionManager).uploadImages(server).done(function () {
Logger.log("ContentUploaded succeeded to server: " + server.Id); Logger.log("ContentUploaded succeeded to server: " + server.Id);
syncOfflineUsers(server, deferred); nextAction();
}).fail(function () { }).fail(function () {
Logger.log("ContentUploaded failed to server: " + server.Id); Logger.log("ContentUploaded failed to server: " + server.Id);
syncOfflineUsers(server, deferred); nextAction();
}); });
}); });
} }

View file

@ -25,14 +25,14 @@
"web-component-tester": "*", "web-component-tester": "*",
"webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0" "webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0"
}, },
"homepage": "https://github.com/polymerelements/iron-meta", "homepage": "https://github.com/PolymerElements/iron-meta",
"_release": "1.0.3", "_release": "1.0.3",
"_resolution": { "_resolution": {
"type": "version", "type": "version",
"tag": "v1.0.3", "tag": "v1.0.3",
"commit": "91529259262b0d8f33fed44bc3fd47aedf35cb04" "commit": "91529259262b0d8f33fed44bc3fd47aedf35cb04"
}, },
"_source": "git://github.com/polymerelements/iron-meta.git", "_source": "git://github.com/PolymerElements/iron-meta.git",
"_target": "^1.0.0", "_target": "^1.0.0",
"_originalSource": "polymerelements/iron-meta" "_originalSource": "PolymerElements/iron-meta"
} }

View file

@ -6,7 +6,7 @@
return true; return true;
}, },
startSync: function () { sync: function () {
AndroidSync.startSync(); AndroidSync.startSync();
}, },

View file

@ -0,0 +1,52 @@
(function () {
function onDeviceReady() {
var fetcher = window.BackgroundFetch;
fetcher.configure(onBackgroundFetch, onBackgroundFetchFailed, {
stopOnTerminate: false // <-- false is default
});
}
function onSyncFinish() {
Logger.log('BackgroundFetch completed');
var fetcher = window.BackgroundFetch;
fetcher.finish(); // <-- N.B. You MUST called #finish so that native-side can signal completion of the background-thread to the os.
}
function onSyncFail() {
Logger.log('BackgroundFetch completed - sync failed');
var fetcher = window.BackgroundFetch;
fetcher.finish(); // <-- N.B. You MUST called #finish so that native-side can signal completion of the background-thread to the os.
}
function onBackgroundFetch() {
Logger.log('BackgroundFetch initiated');
require(['localsync'], function () {
if (LocalSync.getSyncStatus() == 'Syncing') {
onSyncFinish();
return;
}
var syncOptions = {
uploadPhotos: false
};
LocalSync.sync(syncOptions).done(onSyncFinish).fail(onSyncFail);
});
}
function onBackgroundFetchFailed() {
Logger.log('- BackgroundFetch failed');
}
onDeviceReady();
})();

View file

@ -135,10 +135,6 @@
display: none; display: none;
} }
.barsMenuButton:hover {
opacity: .5 !important;
}
.libraryMenuButtonText { .libraryMenuButtonText {
color: #fff !important; color: #fff !important;
text-decoration: none; text-decoration: none;
@ -236,10 +232,6 @@
vertical-align: middle; vertical-align: middle;
} }
.headerButtonRight:hover {
opacity: .5;
}
.viewMenuLink:hover { .viewMenuLink:hover {
color: #fff; color: #fff;
} }
@ -374,11 +366,11 @@
display: none !important; display: none !important;
} }
.libraryDocument .sidebarLinkNotifications { .dashboardDocument .lnkMySync {
display: none !important; display: none !important;
} }
.dashboardDocument .lnkMySync { .dashboardDocument .dashboardEntryHeaderButton {
display: none !important; display: none !important;
} }
@ -390,6 +382,10 @@
display: none !important; display: none !important;
} }
body:not(.dashboardDocument) .btnNotifications{
display: none !important;
}
.darkDrawer { .darkDrawer {
background-color: #282828 !important; background-color: #282828 !important;
} }

View file

@ -5,31 +5,34 @@
margin: 0 !important; margin: 0 !important;
float: right; float: right;
vertical-align: middle; vertical-align: middle;
min-width: 4.1em;
} }
.btnNotificationsInner { .btnNotificationsInner {
color: #fff; color: #fff;
font-weight: 400; font-weight: 500;
display: none;
position: relative; position: relative;
top: -4px; top: -8px;
padding: 3px 8px;
border-radius: 1000px; border-radius: 1000px;
background: #444;
line-height: 28px;
min-width: 30px;
display: inline-flex;
align-items: center;
justify-content: center;
text-align: center;
} }
.levelNormal { .levelNormal {
background-color: #4d90fe; background-color: #4d90fe;
display: block;
} }
.levelWarning { .levelWarning {
background-color: #FF7537; background-color: #FF7537;
display: block;
} }
.levelError { .levelError {
background-color: #d14836; background-color: #d14836;
display: block;
} }
.flyoutNotification { .flyoutNotification {

View file

@ -106,18 +106,14 @@
</div> </div>
<div class="readOnlyContent dashboardHomeRightColumn firstDashboardHomeRightColumn"> <div class="readOnlyContent dashboardHomeRightColumn firstDashboardHomeRightColumn">
<div data-role="collapsible" data-collapsed="false"> <h1>${HeaderRecentActivity}</h1>
<h3>${HeaderRecentActivity}</h3> <div class="paperList activityItems">
<div class="activityItems">
</div>
</div> </div>
</div> </div>
<div class="readOnlyContent dashboardHomeRightColumn"> <div class="readOnlyContent dashboardHomeRightColumn">
<div data-role="collapsible" data-collapsed="false"> <h1>${HeaderLatestNews}</h1>
<h3>${HeaderLatestNews}</h3> <div class="paperList latestNewsItems">
<div class="latestNewsItems">
</div>
</div> </div>
</div> </div>

View file

@ -117,7 +117,7 @@
var query = { var query = {
StartIndex: DashboardPage.newsStartIndex, StartIndex: DashboardPage.newsStartIndex,
Limit: 5 Limit: 7
}; };
ApiClient.getProductNews(query).done(function (result) { ApiClient.getProductNews(query).done(function (result) {
@ -126,15 +126,31 @@
var itemHtml = ''; var itemHtml = '';
itemHtml += '<div class="newsItem">'; itemHtml += '<a class="clearLink" href="' + item.Link + '" target="_blank">';
itemHtml += '<a class="newsItemHeader" href="' + item.Link + '" target="_blank">' + item.Title + '</a>'; itemHtml += '<paper-icon-item>';
var date = parseISO8601Date(item.Date, { toLocal: true }); itemHtml += '<paper-fab class="listAvatar blue" icon="dvr" item-icon></paper-fab>';
itemHtml += '<div class="newsItemDate">' + date.toLocaleDateString() + '</div>';
itemHtml += '<div class="newsItemDescription">' + item.Description + '</div>'; itemHtml += '<paper-item-body three-line>';
itemHtml += '<div>';
itemHtml += item.Title;
itemHtml += '</div>'; 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; return itemHtml;
}); });
@ -1068,61 +1084,43 @@ $(document).on('pageshowready', "#dashboardPage", DashboardPage.onPageShow).on('
var html = ''; 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) { if (entry.UserId && entry.UserPrimaryImageTag) {
var userImgUrl = ApiClient.getUserImageUrl(entry.UserId, { var userImgUrl = ApiClient.getUserImageUrl(entry.UserId, {
type: 'Primary', type: 'Primary',
tag: entry.UserPrimaryImageTag, 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 += '<paper-item-body three-line>';
html += '</div>';
html += '<div class="notificationName" style="margin:.5em 0 0;white-space:nowrap;">'; html += '<div>';
html += entry.Name; html += entry.Name;
html += '</div>'; html += '</div>';
entry.ShortOverview = entry.ShortOverview || '&nbsp;'; html += '<div secondary>';
var date = parseISO8601Date(entry.Date, { toLocal: true });
if (entry.ShortOverview) { html += date.toLocaleDateString();
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>'; html += '</div>';
html += '<div secondary>';
html += entry.ShortOverview || '';
html += '</div>'; html += '</div>';
html += '</paper-item-body>';
html += '</paper-icon-item>';
return html; return html;
} }

View file

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

View file

@ -273,25 +273,20 @@
function fadeOutLeft(elem, iterations) { function fadeOutLeft(elem, iterations) {
var keyframes = [{ opacity: '1', transform: 'none', offset: 0 }, var keyframes = [{ opacity: '1', transform: 'none', offset: 0 },
{ opacity: '0', transform: 'translate3d(-100%, 0, 0)', offset: 1 }]; { 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); return elem.animate(keyframes, timing);
} }
if (!LibraryBrowser.navigateOnLibraryTabSelect()) { if (!LibraryBrowser.navigateOnLibraryTabSelect()) {
tabs.addEventListener('iron-select', function () { tabs.addEventListener('iron-select', function () {
var animateTab = !$.browser.safari;
var selected = pages.selected; var selected = pages.selected;
if (selected != null) { if (selected != null && animateTab) {
var newValue = this.selected; var newValue = this.selected;
var currentTab = pages.querySelectorAll('.pageTabContent')[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 () { fadeOutLeft(currentTab, 1).onfinish = function () {
pages.selected = newValue; pages.selected = newValue;
setTimeout(function () { currentTab.classList.remove('hidingAnimatedTab'); }, 500);
}; };
} }
else { else {
@ -926,16 +921,16 @@
var href = LibraryBrowser.getHrefInternal(item, context); var href = LibraryBrowser.getHrefInternal(item, context);
//if (context != 'livetv') { if (context == 'tv') {
// if (topParentId == null && context != 'playlists') { if (!topParentId) {
// topParentId = LibraryMenu.getTopParentId(); topParentId = LibraryMenu.getTopParentId();
// } }
// if (topParentId) { if (topParentId) {
// href += href.indexOf('?') == -1 ? "?topParentId=" : "&topParentId="; href += href.indexOf('?') == -1 ? "?topParentId=" : "&topParentId=";
// href += topParentId; href += topParentId;
// } }
//} }
return href; 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-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()) { if (!showUserAtTop()) {
html += '<paper-icon-button icon="person" class="headerButton headerButtonRight headerUserButton" onclick="return Dashboard.showUserFlyout(this);"></paper-icon-button>'; html += '<paper-icon-button icon="person" class="headerButton headerButtonRight headerUserButton" onclick="return Dashboard.showUserFlyout(this);"></paper-icon-button>';
} }
if (!$.browser.mobile && !Dashboard.isConnectMode()) { 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>'; html += '</div>';
@ -350,11 +352,6 @@
html += '<div class="sidebarDivider"></div>'; 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()) { 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>'; 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; return AppInfo.isNativeApp;
}, },
startSync: function () { sync: function (options) {
if (!syncPromise) { if (syncPromise) {
require(['multiserversync'], function () { return syncPromise.promise();
lastStart = new Date().getTime();
syncPromise = new MediaBrowser.MultiServerSync(ConnectionManager).sync().done(function () {
syncPromise = null;
}).fail(function () {
syncPromise = null;
});
});
} }
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 () { getSyncStatus: function () {
@ -42,12 +49,12 @@
if (LocalSync.isSupported) { if (LocalSync.isSupported) {
setInterval(function () { setInterval(function () {
LocalSync.startSync(); //LocalSync.startSync();
}, syncInterval); }, syncInterval);
if (lastStart > 0 && (now - lastStart) >= syncInterval) { if (lastStart > 0 && (now - lastStart) >= syncInterval) {
LocalSync.startSync(); //LocalSync.startSync();
} }
} }
//LocalSync.startSync(); //LocalSync.startSync();

View file

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

View file

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

View file

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

View file

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

View file

@ -17,7 +17,7 @@
.viewMenuBar, .libraryViewNav, paper-tabs { .viewMenuBar, .libraryViewNav, paper-tabs {
background-color: rgba(28,28,28,.97); background-color: rgb(28,28,28);
} }
.viewMenuBar.semiTransparent { .viewMenuBar.semiTransparent {
@ -80,10 +80,6 @@
color: #FF2D55 !important; color: #FF2D55 !important;
} }
.viewMenuBar .headerButtonLeft {
color: #FF2D55 !important;
}
.channelTimeslotHeader { .channelTimeslotHeader {
border-right-color: #FF2D55 !important; border-right-color: #FF2D55 !important;
} }
@ -191,4 +187,4 @@ paper-tab {
#footer { #footer {
/* Eliminate transparency to prevent clicks from passing through to the elements underneath */ /* Eliminate transparency to prevent clicks from passing through to the elements underneath */
background-color: rgb(26,26,26); background-color: rgb(26,26,26);
} }