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

added cloud sync model objects

This commit is contained in:
Luke Pulverenti 2014-07-21 21:29:06 -04:00
parent 640fc18b21
commit 68e7007105
28 changed files with 373 additions and 456 deletions

View file

@ -28,6 +28,10 @@
$('#chkRunAtStartup', page).checked(config.RunAtStartup).checkboxradio("refresh");
$('#txtMinResumePct', page).val(config.MinResumePct);
$('#txtMaxResumePct', page).val(config.MaxResumePct);
$('#txtMinResumeDuration', page).val(config.MinResumeDurationSeconds);
Dashboard.hideLoadingMsg();
}
@ -80,6 +84,10 @@
config.SystemUpdateLevel = $('#selectAutomaticUpdateLevel', form).val();
config.EnableAutomaticRestart = $('#chkEnableAutomaticRestart', form).checked();
config.MinResumePct = $('#txtMinResumePct', form).val();
config.MaxResumePct = $('#txtMaxResumePct', form).val();
config.MinResumeDurationSeconds = $('#txtMinResumeDuration', form).val();
ApiClient.updateServerConfiguration(config).done(Dashboard.processServerConfigurationUpdateResult);
});

View file

@ -1,43 +0,0 @@
(function ($, document, window) {
$(document).on('pageshow', "#appsPlaybackPage", function () {
Dashboard.showLoadingMsg();
var page = this;
ApiClient.getServerConfiguration().done(function (config) {
$('#txtMinResumePct', page).val(config.MinResumePct);
$('#txtMaxResumePct', page).val(config.MaxResumePct);
$('#txtMinResumeDuration', page).val(config.MinResumeDurationSeconds);
$('input:first', page).focus();
Dashboard.hideLoadingMsg();
});
});
window.AppsPlaybackPage = {
onSubmit: function () {
var form = this;
Dashboard.showLoadingMsg();
ApiClient.getServerConfiguration().done(function (config) {
config.MinResumePct = $('#txtMinResumePct', form).val();
config.MaxResumePct = $('#txtMaxResumePct', form).val();
config.MinResumeDurationSeconds = $('#txtMinResumeDuration', form).val();
ApiClient.updateServerConfiguration(config).done(Dashboard.processServerConfigurationUpdateResult);
});
// Disable default form submission
return false;
}
};
})($, document, window);

View file

@ -101,7 +101,7 @@
var userId = Dashboard.getCurrentUserId();
var val = store.getItem('enableBackdrops', userId);
var val = store.getItem('enableBackdrops-' + userId);
// For bandwidth
return val == '1' || (val != '0' && !$.browser.mobile);

View file

@ -1225,11 +1225,21 @@
var errorMsg = Globalize.translate('MessageErrorPlayingVideo');
if (item.Type == "TvChannel") {
errorMsg += "<br/><br/>" + Globalize.translate('MessageEnsureOpenTuner');
errorMsg += '<p>';
errorMsg += Globalize.translate('MessageEnsureOpenTuner');
errorMsg += '</p>';
}
if ($.browser.msie && !$.browser.mobile) {
errorMsg += '<p>';
errorMsg += '<a href="https://tools.google.com/dlpage/webmmf/" target="_blank">';
errorMsg += Globalize.translate('MessageInternetExplorerWebm');
errorMsg += '</a>';
errorMsg += '</p>';
}
Dashboard.alert({
title: 'Video Error',
title: Globalize.translate('HeaderVideoError'),
message: errorMsg
});

View file

@ -895,6 +895,12 @@
self.currentItem = null;
self.currentMediaSource = null;
// When the browser regains focus it may start auto-playing the last video
if ($.browser.safari) {
elem.src = 'files/dummy.mp4';
elem.play();
}
}).trigger("ended");
} else {

View file

@ -1,19 +1,125 @@
var AdvancedMetadataConfigurationPage = {
(function (window, $) {
onPageShow: function () {
function loadAdvancedConfig(page, config) {
Dashboard.showLoadingMsg();
$('#chkEnableTmdbPersonUpdates', page).checked(config.EnableTmdbUpdates).checkboxradio("refresh");
$('#chkEnableTvdbUpdates', page).checked(config.EnableTvDbUpdates).checkboxradio("refresh");
$('#chkEnableFanartUpdates', page).checked(config.EnableFanArtUpdates).checkboxradio("refresh");
$('#txtMetadataPath', page).val(config.MetadataPath || '');
var page = this;
Dashboard.hideLoadingMsg();
}
ApiClient.getServerConfiguration().done(function (configuration) {
function loadChapters(page, config, providers) {
AdvancedMetadataConfigurationPage.load(page, configuration);
if (providers.length) {
$('.noChapterProviders', page).hide();
$('.chapterDownloadSettings', page).show();
} else {
$('.noChapterProviders', page).show();
$('.chapterDownloadSettings', page).hide();
}
$('#chkChaptersMovies', page).checked(config.EnableMovieChapterImageExtraction).checkboxradio("refresh");
$('#chkChaptersEpisodes', page).checked(config.EnableEpisodeChapterImageExtraction).checkboxradio("refresh");
$('#chkChaptersOtherVideos', page).checked(config.EnableOtherVideoChapterImageExtraction).checkboxradio("refresh");
$('#chkDownloadChapterMovies', page).checked(config.DownloadMovieChapters).checkboxradio("refresh");
$('#chkDownloadChapterEpisodes', page).checked(config.DownloadEpisodeChapters).checkboxradio("refresh");
renderChapterFetchers(page, config, providers);
Dashboard.hideLoadingMsg();
}
function renderChapterFetchers(page, config, plugins) {
var html = '';
if (!plugins.length) {
$('.chapterFetchers', page).html(html).hide().trigger('create');
return;
}
var i, length, plugin, id;
html += '<div class="ui-controlgroup-label" style="margin-bottom:0;padding-left:2px;">';
html += Globalize.translate('LabelChapterDownloaders');
html += '</div>';
html += '<div style="display:inline-block;width: 75%;vertical-align:top;">';
html += '<div data-role="controlgroup" class="chapterFetcherGroup">';
for (i = 0, length = plugins.length; i < length; i++) {
plugin = plugins[i];
id = 'chkChapterFetcher' + i;
var isChecked = config.DisabledFetchers.indexOf(plugin.Name) == -1 ? ' checked="checked"' : '';
html += '<input class="chkChapterFetcher" type="checkbox" name="' + id + '" id="' + id + '" data-pluginname="' + plugin.Name + '" data-mini="true"' + isChecked + '>';
html += '<label for="' + id + '">' + plugin.Name + '</label>';
}
html += '</div>';
html += '</div>';
if (plugins.length > 1) {
html += '<div style="display:inline-block;vertical-align:top;margin-left:5px;">';
for (i = 0, length = plugins.length; i < length; i++) {
html += '<div style="margin:6px 0;">';
if (i == 0) {
html += '<button data-inline="true" disabled="disabled" class="btnUp" data-pluginindex="' + i + '" type="button" data-icon="arrow-u" data-mini="true" data-iconpos="notext" style="margin: 0 1px;">Up</button>';
html += '<button data-inline="true" class="btnDown" data-pluginindex="' + i + '" type="button" data-icon="arrow-d" data-mini="true" data-iconpos="notext" style="margin: 0 1px;">Down</button>';
} else if (i == (plugins.length - 1)) {
html += '<button data-inline="true" class="btnUp" data-pluginindex="' + i + '" type="button" data-icon="arrow-u" data-mini="true" data-iconpos="notext" style="margin: 0 1px;">Up</button>';
html += '<button data-inline="true" disabled="disabled" class="btnDown" data-pluginindex="' + i + '" type="button" data-icon="arrow-d" data-mini="true" data-iconpos="notext" style="margin: 0 1px;">Down</button>';
}
else {
html += '<button data-inline="true" class="btnUp" data-pluginindex="' + i + '" type="button" data-icon="arrow-u" data-mini="true" data-iconpos="notext" style="margin: 0 1px;">Up</button>';
html += '<button data-inline="true" class="btnDown" data-pluginindex="' + i + '" type="button" data-icon="arrow-d" data-mini="true" data-iconpos="notext" style="margin: 0 1px;">Down</button>';
}
html += '</div>';
}
}
html += '</div>';
html += '<div class="fieldDescription">' + Globalize.translate('LabelChapterDownloadersHelp') + '</div>';
var elem = $('.chapterFetchers', page).html(html).show().trigger('create');
$('.btnDown', elem).on('click', function () {
var index = parseInt(this.getAttribute('data-pluginindex'));
var elemToMove = $('.chapterFetcherGroup .ui-checkbox', page)[index];
var insertAfter = $(elemToMove).next('.ui-checkbox')[0];
elemToMove.parentNode.removeChild(elemToMove);
$(elemToMove).insertAfter(insertAfter);
$('.chapterFetcherGroup', page).controlgroup('destroy').controlgroup();
});
},
onPageInit: function () {
$('.btnUp', elem).on('click', function () {
var index = parseInt(this.getAttribute('data-pluginindex'));
var elemToMove = $('.chapterFetcherGroup .ui-checkbox', page)[index];
var insertBefore = $(elemToMove).prev('.ui-checkbox')[0];
elemToMove.parentNode.removeChild(elemToMove);
$(elemToMove).insertBefore(insertBefore);
$('.chapterFetcherGroup', page).controlgroup('destroy').controlgroup();
});
}
$(document).on('pageinit', "#advancedMetadataConfigurationPage", function () {
var page = this;
@ -36,22 +142,27 @@
instruction: Globalize.translate('HeaderSelectMetadataPathHelp')
});
});
},
load: function (page, config) {
}).on('pageshow', "#advancedMetadataConfigurationPage", function () {
$('#chkEnableTmdbPersonUpdates', page).checked(config.EnableTmdbUpdates).checkboxradio("refresh");
$('#chkEnableTvdbUpdates', page).checked(config.EnableTvDbUpdates).checkboxradio("refresh");
$('#chkEnableFanartUpdates', page).checked(config.EnableFanArtUpdates).checkboxradio("refresh");
$('#txtMetadataPath', page).val(config.MetadataPath || '');
var page = this;
Dashboard.hideLoadingMsg();
},
ApiClient.getServerConfiguration().done(function (configuration) {
onSubmit: function () {
var form = this;
loadAdvancedConfig(page, configuration);
Dashboard.showLoadingMsg();
});
var promise1 = ApiClient.getNamedConfiguration("chapters");
var promise2 = ApiClient.getJSON(ApiClient.getUrl("Providers/Chapters"));
$.when(promise1, promise2).done(function (response1, response2) {
loadChapters(page, response1[0], response2[0]);
});
});
function saveAdvancedConfig(form) {
ApiClient.getServerConfiguration().done(function (config) {
@ -62,10 +173,49 @@
ApiClient.updateServerConfiguration(config).done(Dashboard.processServerConfigurationUpdateResult);
});
// Disable default form submission
return false;
}
};
$(document).on('pageinit', "#advancedMetadataConfigurationPage", AdvancedMetadataConfigurationPage.onPageInit).on('pageshow', "#advancedMetadataConfigurationPage", AdvancedMetadataConfigurationPage.onPageShow);
function saveChapters(form) {
ApiClient.getNamedConfiguration("chapters").done(function (config) {
config.EnableMovieChapterImageExtraction = $('#chkChaptersMovies', form).checked();
config.EnableEpisodeChapterImageExtraction = $('#chkChaptersEpisodes', form).checked();
config.EnableOtherVideoChapterImageExtraction = $('#chkChaptersOtherVideos', form).checked();
config.DownloadMovieChapters = $('#chkDownloadChapterMovies', form).checked();
config.DownloadEpisodeChapters = $('#chkDownloadChapterEpisodes', form).checked();
config.DisabledFetchers = $('.chkChapterFetcher:not(:checked)', form).get().map(function (c) {
return c.getAttribute('data-pluginname');
});
config.FetcherOrder = $('.chkChapterFetcher', form).get().map(function (c) {
return c.getAttribute('data-pluginname');
});
ApiClient.updateNamedConfiguration("chapters", config);
});
}
window.AdvancedMetadataConfigurationPage = {
onSubmit: function () {
var form = this;
Dashboard.showLoadingMsg();
saveAdvancedConfig(form);
saveChapters(form);
// Disable default form submission
return false;
}
};
})(window, jQuery);

View file

@ -1,168 +0,0 @@
(function ($, document, window) {
function loadPage(page, config, providers) {
if (providers.length) {
$('.noChapterProviders', page).hide();
$('.chapterDownloadSettings', page).show();
} else {
$('.noChapterProviders', page).show();
$('.chapterDownloadSettings', page).hide();
}
$('#chkChaptersMovies', page).checked(config.EnableMovieChapterImageExtraction).checkboxradio("refresh");
$('#chkChaptersEpisodes', page).checked(config.EnableEpisodeChapterImageExtraction).checkboxradio("refresh");
$('#chkChaptersOtherVideos', page).checked(config.EnableOtherVideoChapterImageExtraction).checkboxradio("refresh");
$('#chkDownloadChapterMovies', page).checked(config.DownloadMovieChapters).checkboxradio("refresh");
$('#chkDownloadChapterEpisodes', page).checked(config.DownloadEpisodeChapters).checkboxradio("refresh");
renderChapterFetchers(page, config, providers);
Dashboard.hideLoadingMsg();
}
function renderChapterFetchers(page, config, plugins) {
var html = '';
if (!plugins.length) {
$('.chapterFetchers', page).html(html).hide().trigger('create');
return;
}
var i, length, plugin, id;
html += '<div class="ui-controlgroup-label" style="margin-bottom:0;padding-left:2px;">';
html += Globalize.translate('LabelChapterDownloaders');
html += '</div>';
html += '<div style="display:inline-block;width: 75%;vertical-align:top;">';
html += '<div data-role="controlgroup" class="chapterFetcherGroup">';
for (i = 0, length = plugins.length; i < length; i++) {
plugin = plugins[i];
id = 'chkChapterFetcher' + i;
var isChecked = config.DisabledFetchers.indexOf(plugin.Name) == -1 ? ' checked="checked"' : '';
html += '<input class="chkChapterFetcher" type="checkbox" name="' + id + '" id="' + id + '" data-pluginname="' + plugin.Name + '" data-mini="true"' + isChecked + '>';
html += '<label for="' + id + '">' + plugin.Name + '</label>';
}
html += '</div>';
html += '</div>';
if (plugins.length > 1) {
html += '<div style="display:inline-block;vertical-align:top;margin-left:5px;">';
for (i = 0, length = plugins.length; i < length; i++) {
html += '<div style="margin:6px 0;">';
if (i == 0) {
html += '<button data-inline="true" disabled="disabled" class="btnUp" data-pluginindex="' + i + '" type="button" data-icon="arrow-u" data-mini="true" data-iconpos="notext" style="margin: 0 1px;">Up</button>';
html += '<button data-inline="true" class="btnDown" data-pluginindex="' + i + '" type="button" data-icon="arrow-d" data-mini="true" data-iconpos="notext" style="margin: 0 1px;">Down</button>';
} else if (i == (plugins.length - 1)) {
html += '<button data-inline="true" class="btnUp" data-pluginindex="' + i + '" type="button" data-icon="arrow-u" data-mini="true" data-iconpos="notext" style="margin: 0 1px;">Up</button>';
html += '<button data-inline="true" disabled="disabled" class="btnDown" data-pluginindex="' + i + '" type="button" data-icon="arrow-d" data-mini="true" data-iconpos="notext" style="margin: 0 1px;">Down</button>';
}
else {
html += '<button data-inline="true" class="btnUp" data-pluginindex="' + i + '" type="button" data-icon="arrow-u" data-mini="true" data-iconpos="notext" style="margin: 0 1px;">Up</button>';
html += '<button data-inline="true" class="btnDown" data-pluginindex="' + i + '" type="button" data-icon="arrow-d" data-mini="true" data-iconpos="notext" style="margin: 0 1px;">Down</button>';
}
html += '</div>';
}
}
html += '</div>';
html += '<div class="fieldDescription">' + Globalize.translate('LabelChapterDownloadersHelp') + '</div>';
var elem = $('.chapterFetchers', page).html(html).show().trigger('create');
$('.btnDown', elem).on('click', function () {
var index = parseInt(this.getAttribute('data-pluginindex'));
var elemToMove = $('.chapterFetcherGroup .ui-checkbox', page)[index];
var insertAfter = $(elemToMove).next('.ui-checkbox')[0];
elemToMove.parentNode.removeChild(elemToMove);
$(elemToMove).insertAfter(insertAfter);
$('.chapterFetcherGroup', page).controlgroup('destroy').controlgroup();
});
$('.btnUp', elem).on('click', function () {
var index = parseInt(this.getAttribute('data-pluginindex'));
var elemToMove = $('.chapterFetcherGroup .ui-checkbox', page)[index];
var insertBefore = $(elemToMove).prev('.ui-checkbox')[0];
elemToMove.parentNode.removeChild(elemToMove);
$(elemToMove).insertBefore(insertBefore);
$('.chapterFetcherGroup', page).controlgroup('destroy').controlgroup();
});
}
$(document).on('pageshow', "#chapterMetadataConfigurationPage", function () {
Dashboard.showLoadingMsg();
var page = this;
var promise1 = ApiClient.getNamedConfiguration("chapters");
var promise2 = ApiClient.getJSON(ApiClient.getUrl("Providers/Chapters"));
$.when(promise1, promise2).done(function (response1, response2) {
loadPage(page, response1[0], response2[0]);
});
});
function metadataChaptersPage() {
var self = this;
self.onSubmit = function () {
Dashboard.showLoadingMsg();
var form = this;
ApiClient.getNamedConfiguration("chapters").done(function (config) {
config.EnableMovieChapterImageExtraction = $('#chkChaptersMovies', form).checked();
config.EnableEpisodeChapterImageExtraction = $('#chkChaptersEpisodes', form).checked();
config.EnableOtherVideoChapterImageExtraction = $('#chkChaptersOtherVideos', form).checked();
config.DownloadMovieChapters = $('#chkDownloadChapterMovies', form).checked();
config.DownloadEpisodeChapters = $('#chkDownloadChapterEpisodes', form).checked();
config.DisabledFetchers = $('.chkChapterFetcher:not(:checked)', form).get().map(function (c) {
return c.getAttribute('data-pluginname');
});
config.FetcherOrder = $('.chkChapterFetcher', form).get().map(function (c) {
return c.getAttribute('data-pluginname');
});
ApiClient.updateNamedConfiguration("chapters", config).done(Dashboard.processServerConfigurationUpdateResult);
});
// Disable default form submission
return false;
};
}
window.MetadataChaptersPage = new metadataChaptersPage();
})(jQuery, document, window);

View file

@ -2,8 +2,8 @@
function loadForm(page, userId, displayPreferences) {
$('#selectThemeSong', page).val(store.getItem('enableThemeSongs', userId) || '').selectmenu("refresh");
$('#selectBackdrop', page).val(store.getItem('enableBackdrops', userId) || '').selectmenu("refresh");
$('#selectThemeSong', page).val(store.getItem('enableThemeSongs-' + userId) || '').selectmenu("refresh");
$('#selectBackdrop', page).val(store.getItem('enableBackdrops-' + userId) || '').selectmenu("refresh");
$('#selectHomeSection1', page).val(displayPreferences.CustomPrefs.home0 || '').selectmenu("refresh");
$('#selectHomeSection2', page).val(displayPreferences.CustomPrefs.home1 || '').selectmenu("refresh");
@ -15,8 +15,8 @@
function saveUser(page, userId, displayPreferences) {
store.setItem('enableThemeSongs', userId, $('#selectThemeSong', page).val());
store.setItem('enableBackdrops', userId, $('#selectBackdrop', page).val());
store.setItem('enableThemeSongs-' + userId, $('#selectThemeSong', page).val());
store.setItem('enableBackdrops-' + userId, $('#selectBackdrop', page).val());
displayPreferences.CustomPrefs.home0 = $('#selectHomeSection1', page).val();
displayPreferences.CustomPrefs.home1 = $('#selectHomeSection2', page).val();
@ -26,7 +26,7 @@
ApiClient.updateDisplayPreferences('home', displayPreferences, userId, 'webclient').done(function () {
Dashboard.alert(Globalize.translate('SettingsSaved'));
});
}

View file

@ -16,9 +16,11 @@
loadScheduledTask: function (task) {
Dashboard.setPageTitle(task.Name);
var page = $.mobile.activePage;
$('#pTaskDescription', $.mobile.activePage).html(task.Description);
$('.taskName', page).html(task.Name);
$('#pTaskDescription', page).html(task.Description);
ScheduledTaskPage.loadTaskTriggers(task);

View file

@ -18,8 +18,7 @@
statusCode: {
401: onAuthFailure,
403: onAuthFailure
401: onAuthFailure
},
error: function (event) {
@ -712,10 +711,6 @@ var Dashboard = {
divider: true,
href: "advanced.html",
selected: page.hasClass("advancedConfigurationPage")
}, {
name: Globalize.translate('TabScheduledTasks'),
href: "scheduledtasks.html",
selected: pageElem.id == "scheduledTasksPage" || pageElem.id == "scheduledTaskPage"
}, {
name: Globalize.translate('TabHelp'),
href: "support.html",

View file

@ -43,8 +43,8 @@
function enabled() {
var userId = Dashboard.getCurrentUserId();
var val = store.getItem('enableThemeSongs', userId);
var val = store.getItem('enableThemeSongs-' + userId);
// For bandwidth
return val == '1' || (val != '0' && !$.browser.mobile);