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

stub out mock sync provider

This commit is contained in:
Luke Pulverenti 2014-07-22 12:36:34 -04:00
parent 68e7007105
commit 3944c8c0cb
4 changed files with 109 additions and 7 deletions

View file

@ -476,9 +476,9 @@
$(document.body).append(html); $(document.body).append(html);
var elem = $('#playerSelectionPanel').panel({}).trigger('create').panel("open").on("panelafterclose", function () { var elem = $('#playerSelectionPanel').panel({}).trigger('create').panel("open").on("panelclose", function () {
$(this).off("panelafterclose").remove(); $(this).off("panelclose").remove();
}); });
promise.done(function (targets) { promise.done(function (targets) {

View file

@ -522,9 +522,9 @@ var Dashboard = {
$(document.body).append(html); $(document.body).append(html);
var elem = $('#userFlyout').panel({}).trigger('create').panel("open").on("panelafterclose", function () { var elem = $('#userFlyout').panel({}).trigger('create').panel("open").on("panelclose", function () {
$(this).off("panelafterclose").remove(); $(this).off("panelclose").remove();
}); });
}); });
}, },

View file

@ -1,13 +1,115 @@
(function (window, $) { (function (window, $) {
function submitJob(userId, items, form) {
var targets = $('.chkSyncTarget:checked', form).get().map(function (c) {
return c.getAttribute('data-targetid');
});
if (!targets.length) {
Dashboard.alert('Please select one or more sync targets.');
return;
}
var options = {
userId: userId,
TargetIds: targets.join(','),
ItemIds: items.map(function (i) {
return i.Id;
}).join(','),
Quality: $('.radioSyncQuality', form)[0].getAttribute('data-value')
};
ApiClient.ajax({
type: "POST",
url: ApiClient.getUrl("Sync/Jobs"),
data: JSON.stringify(options),
contentType: "application/json"
}).done(function () {
$('.syncPanel').panel('close');
});
}
function showSyncMenu(items) { function showSyncMenu(items) {
Dashboard.alert('Coming soon.'); var userId = Dashboard.getCurrentUserId();
ApiClient.getJSON(ApiClient.getUrl('Sync/Targets', {
UserId: userId
})).done(function (targets) {
var html = '<div data-role="panel" data-position="right" data-display="overlay" class="syncPanel" data-position-fixed="true" data-theme="a">';
html += '<div>';
html += '<h1 style="margin-top:.5em;">Sync Media</h1>';
html += '<form class="formSubmitSyncRequest">';
html += '<div>';
html += '<fieldset data-role="controlgroup">';
html += '<legend>Sync to:</legend>';
html += targets.map(function (t) {
var targetHtml = '<label for="chkSync' + t.Id + '">' + t.Name + '</label>';
targetHtml += '<input class="chkSyncTarget" data-targetid="' + t.Id + '" type="checkbox" id="chkSync' + t.Id + '" />';
return targetHtml;
}).join('');
html += '</fieldset>';
html += '</div>';
html += '<br/>';
html += '<div>';
html += '<fieldset data-role="controlgroup">';
html += '<legend>Quality:</legend>';
html += '<label for="radioHighSyncQuality">High</label>';
html += '<input type="radio" id="radioHighSyncQuality" name="radioSyncQuality" checked="checked" class="radioSyncQuality" data-value="High" />';
html += '<label for="radioMediumSyncQuality">Medium</label>';
html += '<input type="radio" id="radioMediumSyncQuality" name="radioSyncQuality" class="radioSyncQuality" data-value="Medium" />';
html += '<label for="radioLowSyncQuality">Low</label>';
html += '<input type="radio" id="radioLowSyncQuality" name="radioSyncQuality" class="radioSyncQuality" data-value="Low" />';
html += '</fieldset>';
html += '</div>';
html += '<br/>';
html += '<p>';
html += '<button type="submit" data-icon="refresh" data-theme="b">Sync</button>';
html += '</p>';
html += '</form>';
html += '</div>';
html += '</div>';
$(document.body).append(html);
var elem = $('.syncPanel').panel({}).trigger('create').panel("open").on("panelclose", function () {
$(this).off("panelclose").remove();
});
$('form', elem).on('submit', function () {
submitJob(userId, items, this);
return false;
});
});
} }
function isAvailable(item, user) { function isAvailable(item, user) {
return true; return item.SupportsSync;
} }
window.SyncManager = { window.SyncManager = {

View file

@ -5,7 +5,7 @@ chrome.cast.ApiBootstrap_ = function() {
}; };
chrome.cast.ApiBootstrap_.EXTENSION_IDS = ["boadgeojelhgndaghljhdicfkmllpafd", "dliochdbjfkdbacpmhlcpmleaejidimm", "hfaagokkkhdbgiakmmlclaapfelnkoah", "fmfcbgogabcbclcofgocippekhfcmgfj", "enhhojjnijigcajfphajepfemndkmdlo"]; chrome.cast.ApiBootstrap_.EXTENSION_IDS = ["boadgeojelhgndaghljhdicfkmllpafd", "dliochdbjfkdbacpmhlcpmleaejidimm", "hfaagokkkhdbgiakmmlclaapfelnkoah", "fmfcbgogabcbclcofgocippekhfcmgfj", "enhhojjnijigcajfphajepfemndkmdlo"];
chrome.cast.ApiBootstrap_.findInstalledExtension_ = function(callback) { chrome.cast.ApiBootstrap_.findInstalledExtension_ = function(callback) {
//chrome.cast.ApiBootstrap_.findInstalledExtensionHelper_(0, callback); chrome.cast.ApiBootstrap_.findInstalledExtensionHelper_(0, callback);
}; };
chrome.cast.ApiBootstrap_.findInstalledExtensionHelper_ = function(index, callback) { chrome.cast.ApiBootstrap_.findInstalledExtensionHelper_ = function(index, callback) {
index == chrome.cast.ApiBootstrap_.EXTENSION_IDS.length ? callback(null) : chrome.cast.ApiBootstrap_.isExtensionInstalled_(chrome.cast.ApiBootstrap_.EXTENSION_IDS[index], function(installed) { index == chrome.cast.ApiBootstrap_.EXTENSION_IDS.length ? callback(null) : chrome.cast.ApiBootstrap_.isExtensionInstalled_(chrome.cast.ApiBootstrap_.EXTENSION_IDS[index], function(installed) {