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

update local sync

This commit is contained in:
Luke Pulverenti 2016-08-16 00:12:12 -04:00
parent 95f0f7874f
commit d0aee5580a
8 changed files with 93 additions and 39 deletions

View file

@ -3361,6 +3361,29 @@
}); });
}; };
self.cancelSyncItems = function (itemIds, targetId) {
if (!userId) {
throw new Error("null userId");
}
if (!itemId) {
throw new Error("null itemId");
}
var url = self.getUrl("Sync/Items/Cancel");
return self.ajax({
type: "POST",
data: JSON.stringify({
TargetId: targetId || self.deviceId(),
ItemIds: itemIds
}),
contentType: "application/json",
url: url
});
};
/** /**
* Reports a user has stopped playing an item * Reports a user has stopped playing an item
* @param {String} userId * @param {String} userId

View file

@ -97,7 +97,10 @@
return; return;
} }
var edgeHammer = new Hammer(options.edgeSwipeElement, null); require(['hammer-main'], initEdgeSwipeInternal);
}
function initEdgeSwipeInternal(edgeHammer) {
var isPeeking = false; var isPeeking = false;
edgeHammer.on('panstart panmove', function (ev) { edgeHammer.on('panstart panmove', function (ev) {

View file

@ -38,7 +38,7 @@
<div class="syncLocalContainer hide" style="margin-top:1em; display: inline-flex; padding: 0 .5em;"> <div class="syncLocalContainer hide" style="margin-top:1em; display: inline-flex; padding: 0 .5em;">
<label class="checkboxContainer" style="margin:0;"> <label class="checkboxContainer" style="margin:0;">
<input type="checkbox" is="emby-checkbox" class="chkOffline" /> <input type="checkbox" is="emby-checkbox" class="chkOffline" />
<span>Make Available Offline</span> <span>${MakeAvailableOffline}</span>
</label> </label>
</div> </div>
</div> </div>
@ -62,7 +62,7 @@
<div class="syncLocalContainer hide" style="margin-top:1em; display: inline-flex; padding: 0 .5em;"> <div class="syncLocalContainer hide" style="margin-top:1em; display: inline-flex; padding: 0 .5em;">
<label class="checkboxContainer" style="margin:0;"> <label class="checkboxContainer" style="margin:0;">
<input type="checkbox" is="emby-checkbox" class="chkOffline" /> <input type="checkbox" is="emby-checkbox" class="chkOffline" />
<span>Make Available Offline</span> <span>${MakeAvailableOffline}</span>
</label> </label>
</div> </div>
</div> </div>

View file

@ -2054,21 +2054,30 @@
}); });
} }
function onSyncLocalClick() {
if (this.checked) {
require(['syncDialog'], function (syncDialog) {
syncDialog.showMenu({
items: [currentItem]
});
});
} else {
}
}
return function (view, params) { return function (view, params) {
function onSyncLocalClick() {
if (this.checked) {
require(['syncDialog'], function (syncDialog) {
syncDialog.showMenu({
items: [currentItem]
});
});
} else {
require(['confirm'], function (confirm) {
confirm(Globalize.translate('ConfirmRemoveDownload')).then(function () {
ApiClient.cancelSyncItems([currentItem.Id]);
}, function () {
updateSyncStatus(view, currentItem);
});
});
}
}
function onPlayTrailerClick() { function onPlayTrailerClick() {
playTrailer(view); playTrailer(view);
} }

View file

@ -116,32 +116,43 @@
configureSwipeTabs: function (ownerpage, tabs) { configureSwipeTabs: function (ownerpage, tabs) {
if (!browser.touch) { if (!browser.touch) {
return; //return;
} }
//require(['hammer'], function (Hammer) {
// var hammertime = new Hammer(ownerpage);
// hammertime.get('swipe').set({ direction: Hammer.DIRECTION_HORIZONTAL });
//});
var pageCount = ownerpage.querySelectorAll('.pageTabContent').length; var pageCount = ownerpage.querySelectorAll('.pageTabContent').length;
var onSwipeLeft = function (e) {
require(['hammer'], function (Hammer) { if (LibraryBrowser.allowSwipe(e.target) && ownerpage.contains(e.target)) {
var selected = parseInt(tabs.selectedIndex() || '0');
var hammertime = new Hammer(ownerpage); if (selected < (pageCount - 1)) {
hammertime.get('swipe').set({ direction: Hammer.DIRECTION_HORIZONTAL }); tabs.selectedIndex(selected + 1);
hammertime.on('swipeleft', function (e) {
if (LibraryBrowser.allowSwipe(e.target)) {
var selected = parseInt(tabs.selectedIndex() || '0');
if (selected < (pageCount - 1)) {
tabs.selectedIndex(selected + 1);
}
} }
}); }
};
hammertime.on('swiperight', function (e) { var onSwipeRight = function (e) {
if (LibraryBrowser.allowSwipe(e.target)) { if (LibraryBrowser.allowSwipe(e.target) && ownerpage.contains(e.target)) {
var selected = parseInt(tabs.selectedIndex() || '0'); var selected = parseInt(tabs.selectedIndex() || '0');
if (selected > 0) { if (selected > 0) {
tabs.selectedIndex(selected - 1); tabs.selectedIndex(selected - 1);
}
} }
}
};
require(['hammer-main'], function (hammertime) {
hammertime.on('swipeleft', onSwipeLeft);
hammertime.on('swiperight', onSwipeRight);
ownerpage.addEventListener('viewdestroy', function () {
hammertime.off('swipeleft', onSwipeLeft);
hammertime.off('swiperight', onSwipeRight);
}); });
}); });
}, },

View file

@ -1055,8 +1055,7 @@
target: navDrawerElement, target: navDrawerElement,
onChange: onMainDrawerSelect, onChange: onMainDrawerSelect,
width: drawerWidth, width: drawerWidth,
disableEdgeSwipe: disableEdgeSwipe, disableEdgeSwipe: disableEdgeSwipe
edgeSwipeElement: document.querySelector('.mainDrawerPanelContent')
}; };
} }

View file

@ -1204,6 +1204,12 @@ var AppInfo = {};
return headroom; return headroom;
} }
function createMainContentHammer(Hammer) {
var hammer = new Hammer(document.querySelector('.mainDrawerPanelContent'), null);
return hammer;
}
function initRequire() { function initRequire() {
var urlArgs = "v=" + (window.dashboardVersion || new Date().getDate()); var urlArgs = "v=" + (window.dashboardVersion || new Date().getDate());
@ -1511,6 +1517,7 @@ var AppInfo = {};
}); });
define("headroom-window", ['headroom'], createWindowHeadroom); define("headroom-window", ['headroom'], createWindowHeadroom);
define("hammer-main", ['hammer'], createMainContentHammer);
// mock this for now. not used in this app // mock this for now. not used in this app
define("playbackManager", [], function () { define("playbackManager", [], function () {

View file

@ -2312,5 +2312,7 @@
"MoreFromValue": "More from {0}", "MoreFromValue": "More from {0}",
"OptionSaveMetadataAsHiddenHelp": "Changing this will apply to new metadata saved going forward. Existing metadata files will be updated the next time they are saved by Emby Server.", "OptionSaveMetadataAsHiddenHelp": "Changing this will apply to new metadata saved going forward. Existing metadata files will be updated the next time they are saved by Emby Server.",
"EnablePhotos": "Enable photos", "EnablePhotos": "Enable photos",
"EnablePhotosHelp": "Photos will be detected and displayed alongside other media files." "EnablePhotosHelp": "Photos will be detected and displayed alongside other media files.",
"MakeAvailableOffline": "Make available offline",
"ConfirmRemoveDownload": "Remove download?"
} }