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

auto-organize fix

This commit is contained in:
Luke Pulverenti 2015-06-08 17:32:20 -04:00
parent bbfda77868
commit f64e0c7c53
54 changed files with 838 additions and 666 deletions

View file

@ -326,7 +326,12 @@
}
}
$(document).on('pageinit', "#libraryFileOrganizerLogPage", function () {
function onEpisodeCorrectionFormSubmit() {
submitEpisodeForm(this);
return false;
}
$(document).on('pageinitdepends', "#libraryFileOrganizerLogPage", function () {
var page = this;
@ -338,7 +343,9 @@
});
}).on('pageshow', "#libraryFileOrganizerLogPage", function () {
$('.episodeCorrectionForm').off('submit', onEpisodeCorrectionFormSubmit).on('submit', onEpisodeCorrectionFormSubmit);
}).on('pageshowready', "#libraryFileOrganizerLogPage", function () {
var page = this;
@ -368,13 +375,4 @@
$(ApiClient).off(".autoorganizelog");
});
window.OrganizerLogPage = {
onEpisodeCorrectionFormSubmit: function () {
submitEpisodeForm(this);
return false;
}
};
})(jQuery, document, window);

View file

@ -1,16 +1,16 @@
(function ($, document, window) {
function updateSeasonPatternHelp(page, value) {
var resultValue = value.replace('%s', '1').replace('%0s', '01').replace('%00s', '001');
var replacementHtmlResult = Globalize.translate('OrganizePatternResult').replace('{0}', resultValue);
$('.seasonFolderFieldDescription', page).html(replacementHtmlResult);
}
function getEpisodeFileName(value, enableMultiEpisode) {
var seriesName = "Series Name";
var episodeTitle = "Episode Four";
@ -24,7 +24,7 @@
.replace('%en', episodeTitle)
.replace('%e.n', episodeTitle.replace(' ', '.'))
.replace('%e_n', episodeTitle.replace(' ', '_'));
if (enableMultiEpisode) {
result = result
.replace('%ed', '5')
@ -41,7 +41,7 @@
function updateEpisodePatternHelp(page, value) {
value = getEpisodeFileName(value, false);
var replacementHtmlResult = Globalize.translate('OrganizePatternResult').replace('{0}', value);
$('.episodePatternDescription', page).html(replacementHtmlResult);
@ -74,11 +74,42 @@
$('#txtDeleteLeftOverFiles', page).val(tvOptions.LeftOverFileExtensionsToDelete.join(';'));
$('#copyOrMoveFile', page).val(tvOptions.CopyOriginalFile.toString()).selectmenu('refresh');
$('#copyOrMoveFile', page).val(tvOptions.CopyOriginalFile.toString()).selectmenu('refresh');
}
$(document).on('pageinit', "#libraryFileOrganizerPage", function () {
function onSubmit() {
var form = this;
ApiClient.getNamedConfiguration('autoorganize').done(function (config) {
var tvOptions = config.TvOptions;
tvOptions.IsEnabled = $('#chkEnableTvSorting', form).checked();
tvOptions.OverwriteExistingEpisodes = $('#chkOverwriteExistingEpisodes', form).checked();
tvOptions.DeleteEmptyFolders = $('#chkDeleteEmptyFolders', form).checked();
tvOptions.MinFileSizeMb = $('#txtMinFileSize', form).val();
tvOptions.SeasonFolderPattern = $('#txtSeasonFolderPattern', form).val();
tvOptions.SeasonZeroFolderName = $('#txtSeasonZeroName', form).val();
tvOptions.EpisodeNamePattern = $('#txtEpisodePattern', form).val();
tvOptions.MultiEpisodeNamePattern = $('#txtMultiEpisodePattern', form).val();
tvOptions.LeftOverFileExtensionsToDelete = $('#txtDeleteLeftOverFiles', form).val().split(';');
var watchLocation = $('#txtWatchFolder', form).val();
tvOptions.WatchLocations = watchLocation ? [watchLocation] : [];
tvOptions.CopyOriginalFile = $('#copyOrMoveFile', form).val();
ApiClient.updateNamedConfiguration('autoorganize', config).done(Dashboard.processServerConfigurationUpdateResult);
});
return false;
}
$(document).on('pageinitdepends', "#libraryFileOrganizerPage", function () {
var page = this;
@ -120,7 +151,9 @@
});
});
}).on('pageshow', "#libraryFileOrganizerPage", function () {
$('.libraryFileOrganizerForm').off('submit', onSubmit).on('submit', onSubmit);
}).on('pageshowready', "#libraryFileOrganizerPage", function () {
var page = this;
@ -129,40 +162,4 @@
});
});
window.LibraryFileOrganizerPage = {
onSubmit: function() {
var form = this;
ApiClient.getNamedConfiguration('autoorganize').done(function (config) {
var tvOptions = config.TvOptions;
tvOptions.IsEnabled = $('#chkEnableTvSorting', form).checked();
tvOptions.OverwriteExistingEpisodes = $('#chkOverwriteExistingEpisodes', form).checked();
tvOptions.DeleteEmptyFolders = $('#chkDeleteEmptyFolders', form).checked();
tvOptions.MinFileSizeMb = $('#txtMinFileSize', form).val();
tvOptions.SeasonFolderPattern = $('#txtSeasonFolderPattern', form).val();
tvOptions.SeasonZeroFolderName = $('#txtSeasonZeroName', form).val();
tvOptions.EpisodeNamePattern = $('#txtEpisodePattern', form).val();
tvOptions.MultiEpisodeNamePattern = $('#txtMultiEpisodePattern', form).val();
tvOptions.LeftOverFileExtensionsToDelete = $('#txtDeleteLeftOverFiles', form).val().split(';');
var watchLocation = $('#txtWatchFolder', form).val();
tvOptions.WatchLocations = watchLocation ? [watchLocation] : [];
tvOptions.CopyOriginalFile = $('#copyOrMoveFile', form).val();
ApiClient.updateNamedConfiguration('autoorganize', config).done(Dashboard.processServerConfigurationUpdateResult);
});
return false;
}
};
})(jQuery, document, window);

View file

@ -20,7 +20,36 @@
Dashboard.hideLoadingMsg();
}
$(document).on('pageinit', "#cinemaModeConfigurationPage", function () {
function onSubmit() {
Dashboard.showLoadingMsg();
var form = this;
var page = $(form).parents('.page');
ApiClient.getNamedConfiguration("cinemamode").done(function (config) {
config.CustomIntroPath = $('#txtCustomIntrosPath', page).val();
config.TrailerLimit = $('#txtNumTrailers', page).val();
config.EnableIntrosForMovies = $('#chkMovies', page).checked();
config.EnableIntrosForEpisodes = $('#chkEpisodes', page).checked();
config.EnableIntrosFromMoviesInLibrary = $('#chkMyMovieTrailers', page).checked();
config.EnableIntrosForWatchedContent = !$('#chkUnwatchedOnly', page).checked();
config.EnableIntrosParentalControl = $('#chkEnableParentalControl', page).checked();
config.EnableIntrosFromUpcomingTrailers = $('#chkUpcomingTheaterTrailers', page).checked();
config.EnableIntrosFromUpcomingDvdMovies = $('#chkUpcomingDvdTrailers', page).checked();
config.EnableIntrosFromUpcomingStreamingMovies = $('#chkUpcomingStreamingTrailers', page).checked();
ApiClient.updateNamedConfiguration("cinemamode", config).done(Dashboard.processServerConfigurationUpdateResult);
});
// Disable default form submission
return false;
}
$(document).on('pageinitdepends', "#cinemaModeConfigurationPage", function () {
var page = this;
@ -42,7 +71,9 @@
});
});
}).on('pageshow', "#cinemaModeConfigurationPage", function () {
$('.cinemaModeConfigurationForm').off('submit', onSubmit).on('submit', onSubmit);
}).on('pageshowready', "#cinemaModeConfigurationPage", function () {
Dashboard.showLoadingMsg();
@ -61,40 +92,6 @@
}
});
function cinemaModeConfigurationPage() {
var self = this;
self.onSubmit = function () {
Dashboard.showLoadingMsg();
var form = this;
var page = $(form).parents('.page');
ApiClient.getNamedConfiguration("cinemamode").done(function (config) {
config.CustomIntroPath = $('#txtCustomIntrosPath', page).val();
config.TrailerLimit = $('#txtNumTrailers', page).val();
config.EnableIntrosForMovies = $('#chkMovies', page).checked();
config.EnableIntrosForEpisodes = $('#chkEpisodes', page).checked();
config.EnableIntrosFromMoviesInLibrary = $('#chkMyMovieTrailers', page).checked();
config.EnableIntrosForWatchedContent = !$('#chkUnwatchedOnly', page).checked();
config.EnableIntrosParentalControl = $('#chkEnableParentalControl', page).checked();
config.EnableIntrosFromUpcomingTrailers = $('#chkUpcomingTheaterTrailers', page).checked();
config.EnableIntrosFromUpcomingDvdMovies = $('#chkUpcomingDvdTrailers', page).checked();
config.EnableIntrosFromUpcomingStreamingMovies = $('#chkUpcomingStreamingTrailers', page).checked();
ApiClient.updateNamedConfiguration("cinemamode", config).done(Dashboard.processServerConfigurationUpdateResult);
});
// Disable default form submission
return false;
};
}
window.CinemaModeConfigurationPage = new cinemaModeConfigurationPage();
})(jQuery, document, window);

View file

@ -36,7 +36,75 @@
});
}
$(document).on('pageshow', "#dashboardGeneralPage", function () {
function onSubmit() {
Dashboard.showLoadingMsg();
var form = this;
var page = $(form).parents('.page');
ApiClient.getServerConfiguration().done(function (config) {
config.ServerName = $('#txtServerName', form).val();
config.UICulture = $('#selectLocalizationLanguage', form).val();
config.CachePath = $('#txtCachePath', form).val();
if (config.UICulture != currentLanguage) {
Dashboard.showDashboardRefreshNotification();
}
ApiClient.updateServerConfiguration(config).done(function () {
refreshPageTitle(page);
ApiClient.getNamedConfiguration(brandingConfigKey).done(function (brandingConfig) {
brandingConfig.LoginDisclaimer = $('#txtLoginDisclaimer', form).val();
brandingConfig.CustomCss = $('#txtCustomCss', form).val();
var cssChanged = currentBrandingOptions && brandingConfig.CustomCss != currentBrandingOptions.CustomCss;
ApiClient.updateNamedConfiguration(brandingConfigKey, brandingConfig).done(Dashboard.processServerConfigurationUpdateResult);
if (cssChanged) {
Dashboard.showDashboardRefreshNotification();
}
});
});
});
// Disable default form submission
return false;
}
$(document).on('pageinitdepends', "#dashboardGeneralPage", function () {
var page = this;
$('#btnSelectCachePath', page).on("click.selectDirectory", function () {
var picker = new DirectoryBrowser(page);
picker.show({
callback: function (path) {
if (path) {
$('#txtCachePath', page).val(path);
}
picker.close();
},
header: Globalize.translate('HeaderSelectServerCachePath'),
instruction: Globalize.translate('HeaderSelectServerCachePathHelp')
});
});
$('.dashboardGeneralForm').off('submit', onSubmit).on('submit', onSubmit);
}).on('pageshowready', "#dashboardGeneralPage", function () {
Dashboard.showLoadingMsg();
@ -60,75 +128,6 @@
$('#txtCustomCss', page).val(config.CustomCss || '');
});
}).on('pageinit', "#dashboardGeneralPage", function () {
var page = this;
$('#btnSelectCachePath', page).on("click.selectDirectory", function () {
var picker = new DirectoryBrowser(page);
picker.show({
callback: function (path) {
if (path) {
$('#txtCachePath', page).val(path);
}
picker.close();
},
header: Globalize.translate('HeaderSelectServerCachePath'),
instruction: Globalize.translate('HeaderSelectServerCachePathHelp')
});
});
});
window.DashboardGeneralPage = {
onSubmit: function () {
Dashboard.showLoadingMsg();
var form = this;
var page = $(form).parents('.page');
ApiClient.getServerConfiguration().done(function (config) {
config.ServerName = $('#txtServerName', form).val();
config.UICulture = $('#selectLocalizationLanguage', form).val();
config.CachePath = $('#txtCachePath', form).val();
if (config.UICulture != currentLanguage) {
Dashboard.showDashboardRefreshNotification();
}
ApiClient.updateServerConfiguration(config).done(function () {
refreshPageTitle(page);
ApiClient.getNamedConfiguration(brandingConfigKey).done(function (brandingConfig) {
brandingConfig.LoginDisclaimer = $('#txtLoginDisclaimer', form).val();
brandingConfig.CustomCss = $('#txtCustomCss', form).val();
var cssChanged = currentBrandingOptions && brandingConfig.CustomCss != currentBrandingOptions.CustomCss;
ApiClient.updateNamedConfiguration(brandingConfigKey, brandingConfig).done(Dashboard.processServerConfigurationUpdateResult);
if (cssChanged) {
Dashboard.showDashboardRefreshNotification();
}
});
});
});
// Disable default form submission
return false;
}
};
})(jQuery, document, window);

View file

@ -47,10 +47,6 @@ Array.prototype.remove = function (from, to) {
return this.push.apply(this, rest);
};
String.prototype.endsWith = function (suffix) {
return this.indexOf(suffix, this.length - suffix.length) !== -1;
};
$.fn.checked = function (value) {
if (value === true || value === false) {
// Set the value of the checkbox
@ -68,31 +64,6 @@ $.fn.buttonEnabled = function (enabled) {
return enabled ? this.attr('disabled', '').removeAttr('disabled') : this.attr('disabled', 'disabled');
};
$.fn.dateTimeVal = function (val) {
if (val != null) {
var now = val;
var year = now.getFullYear();
var month = now.getMonth().toString().length === 1 ? '0' + (now.getMonth() + 1).toString() : now.getMonth() + 1;
var date = now.getDate().toString().length === 1 ? '0' + (now.getDate()).toString() : now.getDate();
var hours = now.getHours().toString().length === 1 ? '0' + now.getHours().toString() : now.getHours();
var minutes = now.getMinutes().toString().length === 1 ? '0' + now.getMinutes().toString() : now.getMinutes();
var seconds = now.getSeconds().toString().length === 1 ? '0' + now.getSeconds().toString() : now.getSeconds();
var formattedDateTime = year + '-' + month + '-' + date + 'T' + hours + ':' + minutes + ':' + seconds;
//if (onlyBlank === true && $(this).val()) {
// return this;
//}
return this.val(formattedDateTime);
}
return this.val();
};
if (!Array.prototype.filter) {
Array.prototype.filter = function (fun /*, thisp*/) {
"use strict";
@ -125,7 +96,7 @@ var WebNotifications = {
show: function (data) {
// Seeing crashes in android
if (window.cordova && window.cordova.plugins && window.cordova.plugins.notification && !$.browser.android) {
if (window.cordova && window.cordova.plugins && window.cordova.plugins.notification) {
if (!WebNotifications.lastId) {
// Cordova plugin will crash on android with long. need an int

View file

@ -535,7 +535,7 @@
});
}
$(document).on('pageinit', "#itemByNameDetailPage", function () {
$(document).on('pageinitdepends', "#itemByNameDetailPage", function () {
var page = this;
@ -571,7 +571,7 @@
});
});
}).on('pageshow', "#itemByNameDetailPage", function () {
}).on('pageshowready', "#itemByNameDetailPage", function () {
var page = this;

View file

@ -393,7 +393,7 @@
html += '<li data-icon="false"><a class="btnMoreMenuDelete" href="#" onclick="$(\'.playFlyout\').popup(\'close\');LibraryBrowser.deleteItem([\'' + itemId + '\']);">' + Globalize.translate('ButtonDelete') + '</a></li>';
}
if (commands.indexOf('false') != -1) {
if (commands.indexOf('download') != -1) {
var downloadHref = ApiClient.getUrl("Items/" + itemId + "/Download", {
api_key: ApiClient.accessToken()
});

View file

@ -4,7 +4,7 @@
var html = '<div class="viewMenuBar ui-bar-b">';
html += '<button type="button" data-role="none" onclick="history.back();" class="headerButton headerButtonLeft headerBackButton"><div class="fa fa-arrow-left"></div></button>';
html += '<button type="button" data-role="none" class="headerButton headerButtonLeft headerBackButton"><div class="fa fa-arrow-left"></div></button>';
html += '<button type="button" data-role="none" title="Menu" class="headerButton dashboardMenuButton barsMenuButton headerButtonLeft">';
html += '<div class="barMenuInner fa fa-bars">';
@ -53,6 +53,15 @@
bindMenuEvents();
}
function onBackClick() {
if (Dashboard.exitOnBack()) {
Dashboard.exit();
}
else {
history.back();
}
}
function addUserToHeader(user) {
var header = $('.viewMenuBar');
@ -96,6 +105,8 @@
$('.dashboardMenuButton').createHoverTouch().on('hovertouch', showDashboardMenu);
}
$('.headerBackButton').on('click', onBackClick);
// Have to wait for document ready here because otherwise
// we may see the jQM redirect back and forth problem
$(initViewMenuBarHeadroom);

View file

@ -94,7 +94,30 @@
});
}
$(document).on('pageshow', "#libraryPathMappingPage", function () {
function onSubmit() {
Dashboard.showLoadingMsg();
var form = this;
var page = $(form).parents('.page');
ApiClient.getServerConfiguration().done(function (config) {
addSubstitution(page, config);
ApiClient.updateServerConfiguration(config).done(function () {
reload(page);
});
});
// Disable default form submission
return false;
}
$(document).on('pageinitdepends', "#libraryPathMappingPage", function () {
$('.libraryPathMappingForm').off('submit', onSubmit).on('submit', onSubmit);
}).on('pageshowready', "#libraryPathMappingPage", function () {
Dashboard.showLoadingMsg();
@ -112,29 +135,4 @@
});
window.LibraryPathMappingPage = {
onSubmit: function () {
Dashboard.showLoadingMsg();
var form = this;
var page = $(form).parents('.page');
ApiClient.getServerConfiguration().done(function (config) {
addSubstitution(page, config);
ApiClient.updateServerConfiguration(config).done(function () {
reload(page);
});
});
// Disable default form submission
return false;
}
};
})(jQuery, document, window);

View file

@ -274,6 +274,8 @@
});
$('.liveTvSeriesTimerForm').off('submit', onSubmit).on('submit', onSubmit);
}).on('pagebeforeshowready', "#liveTvSeriesTimerPage", function () {
var page = this;
@ -288,13 +290,4 @@
currentItem = null;
});
function liveTvSeriesTimerPage() {
var self = this;
self.onSubmit = onSubmit;
}
window.LiveTvSeriesTimerPage = new liveTvSeriesTimerPage();
})(window, jQuery, document);

View file

@ -113,6 +113,8 @@
});
$('.liveTvTimerForm').off('submit', onSubmit).on('submit', onSubmit);
}).on('pagebeforeshowready', "#liveTvTimerPage", function () {
var page = this;
@ -124,13 +126,4 @@
currentItem = null;
});
function liveTvTimerPage() {
var self = this;
self.onSubmit = onSubmit;
}
window.LiveTvTimerPage = new liveTvTimerPage();
})(window, jQuery, document);

View file

@ -506,7 +506,7 @@
var deferred = DeferredBuilder.Deferred();
Dashboard.loadLocalAssetManager().done(function () {
require(['localassetmanager'], function () {
var serverInfo = ApiClient.serverInfo();
@ -528,7 +528,6 @@
}).fail(function () {
deferred.reject();
});
});
return deferred.promise();

View file

@ -347,7 +347,7 @@
}
};
$(document).on('pageinit', ".mediaLibraryPage", MediaLibraryPage.onPageInit).on('pageshow', ".mediaLibraryPage", MediaLibraryPage.onPageShow);
$(document).on('pageinitdepends', ".mediaLibraryPage", MediaLibraryPage.onPageInit).on('pageshowready', ".mediaLibraryPage", MediaLibraryPage.onPageShow);
var WizardLibraryPage = {
@ -371,7 +371,7 @@ var WizardLibraryPage = {
(function ($, document, window) {
$(document).on('pageshow', "#mediaLibraryPage", function () {
$(document).on('pageshowready', "#mediaLibraryPage", function () {
var page = this;

View file

@ -448,12 +448,14 @@
self.canPlayNativeHls = function () {
// Don't use HLS on android 4.4, regardless of what the browser reports
// Don't use HLS on android 4.x, regardless of what the browser reports
if ($.browser.android) {
var agent = navigator.userAgent.toLowerCase();
if (agent.indexOf('android 4.4') != -1) {
return false;
for (var i = 0; i <= 4; i++) {
if (agent.indexOf('android 4.' + i) != -1) {
return false;
}
}
}

View file

@ -1,39 +1,6 @@
var MetadataConfigurationPage = {
onPageShow: function () {
Dashboard.showLoadingMsg();
var page = this;
var config;
var allCultures;
var allCountries;
ApiClient.getServerConfiguration().done(function (result) {
config = result;
MetadataConfigurationPage.load(page, config, allCultures, allCountries);
});
ApiClient.getCultures().done(function (result) {
Dashboard.populateLanguages($('#selectLanguage', page), result);
allCultures = result;
MetadataConfigurationPage.load(page, config, allCultures, allCountries);
});
ApiClient.getCountries().done(function (result) {
Dashboard.populateCountries($('#selectCountry', page), result);
allCountries = result;
MetadataConfigurationPage.load(page, config, allCultures, allCountries);
});
},
load: function (page, config, allCultures, allCountries) {
(function () {
function load(page, config, allCultures, allCountries) {
if (!config || !allCultures || !allCountries) {
return;
}
@ -46,9 +13,9 @@
$('#selectImageSavingConvention', page).val(config.ImageSavingConvention).selectmenu("refresh");
Dashboard.hideLoadingMsg();
},
onSubmit: function () {
}
function onSubmit() {
var form = this;
Dashboard.showLoadingMsg();
@ -68,6 +35,44 @@
// Disable default form submission
return false;
}
};
$(document).on('pageshow', "#metadataConfigurationPage", MetadataConfigurationPage.onPageShow);
$(document).on('pageinitdepends', "#metadataConfigurationPage", function () {
Dashboard.showLoadingMsg();
$('.metadataConfigurationForm').off('submit', onSubmit).on('submit', onSubmit);
}).on('pageshowready', "#metadataConfigurationPage", function () {
Dashboard.showLoadingMsg();
var page = this;
var config;
var allCultures;
var allCountries;
ApiClient.getServerConfiguration().done(function (result) {
config = result;
load(page, config, allCultures, allCountries);
});
ApiClient.getCultures().done(function (result) {
Dashboard.populateLanguages($('#selectLanguage', page), result);
allCultures = result;
load(page, config, allCultures, allCountries);
});
ApiClient.getCountries().done(function (result) {
Dashboard.populateCountries($('#selectCountry', page), result);
allCountries = result;
load(page, config, allCultures, allCountries);
});
});
})();

View file

@ -518,7 +518,7 @@
return false;
}
$(document).on('pageinit', "#metadataImagesConfigurationPage", function () {
$(document).on('pageinitdepends', "#metadataImagesConfigurationPage", function () {
var page = this;
@ -558,7 +558,9 @@
loadType(page, this.value);
});
}).on('pageshow', "#metadataImagesConfigurationPage", function () {
$('.metadataImagesConfigurationForm').off('submit', onSubmit).on('submit', onSubmit);
}).on('pageshowready', "#metadataImagesConfigurationPage", function () {
Dashboard.showLoadingMsg();
@ -567,9 +569,4 @@
loadPage(page);
});
window.MetadataImagesPage = {
onSubmit: onSubmit
};
})(jQuery, document, window);

View file

@ -43,7 +43,45 @@
}).checkboxradio('refresh');
}
$(document).on('pageshow', "#metadataSubtitlesPage", function () {
function onSubmit() {
Dashboard.showLoadingMsg();
var form = this;
ApiClient.getNamedConfiguration("subtitles").done(function (config) {
config.DownloadMovieSubtitles = $('#chkSubtitlesMovies', form).checked();
config.DownloadEpisodeSubtitles = $('#chkSubtitlesEpisodes', form).checked();
config.SkipIfGraphicalSubtitlesPresent = $('#chkSkipIfGraphicalSubsPresent', form).checked();
config.SkipIfAudioTrackMatches = $('#chkSkipIfAudioTrackPresent', form).checked();
config.OpenSubtitlesUsername = $('#txtOpenSubtitleUsername', form).val();
var newPassword = $('#txtOpenSubtitlePassword', form).val();
if (newPassword) {
config.OpenSubtitlesPasswordHash = newPassword;
}
config.DownloadLanguages = $('.chkLang:checked', form).get().map(function (c) {
return c.getAttribute('data-lang');
});
ApiClient.updateNamedConfiguration("subtitles", config).done(Dashboard.processServerConfigurationUpdateResult);
});
// Disable default form submission
return false;
}
$(document).on('pageinitdepends', "#metadataSubtitlesPage", function () {
$('.metadataSubtitlesForm').off('submit', onSubmit).on('submit', onSubmit);
}).on('pageshowready', "#metadataSubtitlesPage", function () {
Dashboard.showLoadingMsg();
@ -60,45 +98,4 @@
});
function metadataSubtitlesPage() {
var self = this;
self.onSubmit = function () {
Dashboard.showLoadingMsg();
var form = this;
ApiClient.getNamedConfiguration("subtitles").done(function (config) {
config.DownloadMovieSubtitles = $('#chkSubtitlesMovies', form).checked();
config.DownloadEpisodeSubtitles = $('#chkSubtitlesEpisodes', form).checked();
config.SkipIfGraphicalSubtitlesPresent = $('#chkSkipIfGraphicalSubsPresent', form).checked();
config.SkipIfAudioTrackMatches = $('#chkSkipIfAudioTrackPresent', form).checked();
config.OpenSubtitlesUsername = $('#txtOpenSubtitleUsername', form).val();
var newPassword = $('#txtOpenSubtitlePassword', form).val();
if (newPassword) {
config.OpenSubtitlesPasswordHash = newPassword;
}
config.DownloadLanguages = $('.chkLang:checked', form).get().map(function (c) {
return c.getAttribute('data-lang');
});
ApiClient.updateNamedConfiguration("subtitles", config).done(Dashboard.processServerConfigurationUpdateResult);
});
// Disable default form submission
return false;
};
}
window.MetadataSubtitlesPage = new metadataSubtitlesPage();
})(jQuery, document, window);

View file

@ -9,7 +9,29 @@
Dashboard.hideLoadingMsg();
}
$(document).on('pageshow', "#playbackConfigurationPage", function () {
function onSubmit() {
Dashboard.showLoadingMsg();
var form = this;
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).on('pageinitdepends', "#playbackConfigurationPage", function () {
$('.playbackConfigurationForm').off('submit', onSubmit).on('submit', onSubmit);
}).on('pageshowready', "#playbackConfigurationPage", function () {
Dashboard.showLoadingMsg();
@ -23,29 +45,4 @@
});
function playbackConfigurationPage() {
var self = this;
self.onSubmit = function () {
Dashboard.showLoadingMsg();
var form = this;
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;
};
}
window.PlaybackConfigurationPage = new playbackConfigurationPage();
})(jQuery, document, window);

View file

@ -175,7 +175,7 @@
$('#selectPageSize', page).val(query.Limit).selectmenu('refresh');
}
$(document).on('pageinit', "#playlistEditorPage", function () {
$(document).on('pageinitdepends', "#playlistEditorPage", function () {
var page = this;
@ -215,7 +215,7 @@
});
}).on('pagebeforeshow', "#playlistEditorPage", function () {
}).on('pageshowready', "#playlistEditorPage", function () {
var page = this;
@ -234,8 +234,6 @@
LibraryBrowser.loadSavedQueryValues(viewkey, query);
reloadItems(page);
}).on('pageshow', "#playlistEditorPage", function () {
updateFilterControls(this);
});

View file

@ -137,7 +137,7 @@
$('#selectPageSize', page).val(query.Limit).selectmenu('refresh');
}
$(document).on('pageinit', "#playlistsPage", function () {
$(document).on('pageinitdepends', "#playlistsPage", function () {
var page = this;
@ -183,7 +183,7 @@
reloadItems(page);
});
}).on('pagebeforeshow', "#playlistsPage", function () {
}).on('pageshowready', "#playlistsPage", function () {
var page = this;
@ -210,8 +210,6 @@
}
});
}).on('pageshow', "#playlistsPage", function () {
updateFilterControls(this);
});

View file

@ -60,9 +60,7 @@
self.showSearchPanel = function () {
var viewMenuSearch = $('.viewMenuSearch');
viewMenuSearch.removeClass('hide');
showSearchMenu();
$('.headerSearchInput').focus();
};
}
@ -199,7 +197,43 @@
function closeSearchOverlay() {
$('.headerSearchInput').val('');
onHeaderSearchChange('');
$('.viewMenuSearch').addClass('hide');
hideSearchMenu();
}
function showSearchMenu() {
require(["jquery", "velocity"], function ($, Velocity) {
$('.btnCloseSearch').hide();
var elem = $('.viewMenuSearch')
.css({ left: '100%' })
.removeClass('hide')[0];
Velocity.animate(elem, { "left": "0px" },
{
complete: function () {
$('.btnCloseSearch').show();
}
});
});
}
function hideSearchMenu() {
require(["jquery", "velocity"], function ($, Velocity) {
$('.btnCloseSearch').hide();
var elem = $('.viewMenuSearch')
.css({ left: '0' })[0];
Velocity.animate(elem, { "left": "100%" },
{
complete: function () {
$('.viewMenuSearch').addClass('hide');
},
duration: 'fast'
});
});
}
$(document).on('pagehide', ".libraryPage", function () {

View file

@ -50,6 +50,7 @@ var Dashboard = {
$.event.special.swipe.verticalDistanceThreshold = 40;
$.mobile.loader.prototype.options.disabled = true;
//$.mobile.page.prototype.options.domCache = true;
},
isConnectMode: function () {
@ -1453,25 +1454,6 @@ var Dashboard = {
return deferred.promise();
},
loadLocalAssetManager: function () {
var deferred = DeferredBuilder.Deferred();
var file = 'thirdparty/apiclient/localassetmanager';
if (AppInfo.isNativeApp && $.browser.android) {
file = 'thirdparty/cordova/android/localassetmanager';
}
require([
file
], function () {
deferred.resolve();
});
return deferred.promise();
},
ready: function (fn) {
if (Dashboard.initPromiseDone) {
@ -1506,6 +1488,14 @@ var Dashboard = {
});
return deferred.promise();
},
exitOnBack: function () {
return $($.mobile.activePage).is('#indexPage');
},
exit: function () {
Dashboard.logout();
}
};
@ -1601,6 +1591,8 @@ var AppInfo = {};
function initializeApiClient(apiClient) {
apiClient.enableAppStorePolicy = AppInfo.enableAppStorePolicy;
apiClient.getDefaultImageQuality = Dashboard.getDefaultImageQuality;
apiClient.normalizeImageOptions = Dashboard.normalizeImageOptions;
$(apiClient).off('.dashboard')
.on("websocketmessage.dashboard", Dashboard.onWebSocketMessageReceived)
@ -1619,37 +1611,35 @@ var AppInfo = {};
initializeApiClient(newApiClient);
});
var apiClient;
var deferred = DeferredBuilder.Deferred();
if (Dashboard.isConnectMode()) {
apiClient = ConnectionManager.getLastUsedApiClient();
var server = ConnectionManager.getLastUsedServer();
if (!Dashboard.isServerlessPage()) {
if (apiClient && apiClient.serverAddress() && apiClient.getCurrentUserId() && apiClient.accessToken()) {
initializeApiClient(apiClient);
if (server && server.UserId && server.AccessToken) {
ConnectionManager.connectToServer(server).done(function (result) {
if (result.State == MediaBrowser.ConnectionState.SignedIn) {
window.ApiClient = result.ApiClient;
}
deferred.resolve();
});
return deferred.promise();
}
}
deferred.resolve();
} else {
apiClient = new MediaBrowser.ApiClient(Logger, Dashboard.serverAddress(), AppInfo.appName, AppInfo.appVersion, AppInfo.deviceName, AppInfo.deviceId);
var apiClient = new MediaBrowser.ApiClient(Logger, Dashboard.serverAddress(), AppInfo.appName, AppInfo.appVersion, AppInfo.deviceName, AppInfo.deviceId);
apiClient.enableAutomaticNetworking = false;
ConnectionManager.addApiClient(apiClient);
Dashboard.importCss(apiClient.getUrl('Branding/Css'));
window.ApiClient = apiClient;
}
window.ApiClient = apiClient;
if (window.ApiClient) {
ApiClient.getDefaultImageQuality = Dashboard.getDefaultImageQuality;
ApiClient.normalizeImageOptions = Dashboard.normalizeImageOptions;
if (!AppInfo.isNativeApp) {
Dashboard.importCss(ApiClient.getUrl('Branding/Css'));
}
}
return deferred.promise();
}
function initFastClick() {
@ -1833,7 +1823,7 @@ var AppInfo = {};
});
if (Dashboard.isRunningInCordova()) {
requirejs(['thirdparty/cordova/connectsdk', 'scripts/registrationservices']);
requirejs(['thirdparty/cordova/connectsdk', 'scripts/registrationservices', 'thirdparty/cordova/volume', 'thirdparty/cordova/back']);
if ($.browser.android) {
requirejs(['thirdparty/cordova/android/androidcredentials', 'thirdparty/cordova/android/immersive', 'thirdparty/cordova/android/filesystem']);
@ -1853,7 +1843,7 @@ var AppInfo = {};
}
}
function init(deferred, capabilities, appName, deviceId, deviceName, resolveOnReady) {
function init(deferred, capabilities, appName, deviceId, deviceName) {
requirejs.config({
map: {
@ -1861,7 +1851,11 @@ var AppInfo = {};
'css': 'thirdparty/requirecss' // or whatever the path to require-css is
}
},
urlArgs: "v=" + window.dashboardVersion
urlArgs: "v=" + window.dashboardVersion,
paths: {
"velocity": "thirdparty/velocity.min"
}
});
// Required since jQuery is loaded before requireJs
@ -1869,37 +1863,61 @@ var AppInfo = {};
return jQuery;
});
if (Dashboard.isRunningInCordova() && $.browser.android) {
define("appstorage", ["thirdparty/cordova/android/appstorage"]);
} else {
define('appstorage', [], function () {
return appStorage;
});
}
if (Dashboard.isRunningInCordova()) {
define("serverdiscovery", ["thirdparty/cordova/serverdiscovery"]);
define("wakeonlan", ["thirdparty/cordova/wakeonlan"]);
} else {
define("serverdiscovery", ["thirdparty/apiclient/serverdiscovery"]);
define("wakeonlan", ["thirdparty/apiclient/wakeonlan"]);
}
if (Dashboard.isRunningInCordova() && $.browser.android) {
define("localassetmanager", ["thirdparty/cordova/android/localassetmanager"]);
} else {
define("localassetmanager", ["thirdparty/apiclient/localassetmanager"]);
}
define("connectservice", ["thirdparty/apiclient/connectservice"]);
//requirejs(['http://viblast.com/player/free-version/qy2fdwajo1/viblast.js']);
setAppInfo();
$.extend(AppInfo, Dashboard.getAppInfo(appName, deviceId, deviceName));
createConnectionManager(capabilities);
if (Dashboard.isConnectMode()) {
if (!resolveOnReady) {
require(['appstorage'], function () {
capabilities.DeviceProfile = MediaPlayer.getDeviceProfile(Math.max(screen.height, screen.width));
createConnectionManager(capabilities).done(function() {
$(function () {
onDocumentReady();
Dashboard.initPromiseDone = true;
deferred.resolve();
});
});
});
} else {
createConnectionManager(capabilities);
Dashboard.initPromiseDone = true;
deferred.resolve();
}
$(function () {
onDocumentReady();
if (resolveOnReady) {
Dashboard.initPromiseDone = true;
deferred.resolve();
}
});
$(onDocumentReady);
}
}
function initCordovaWithDeviceId(deferred, deviceId) {
var screenWidth = Math.max(screen.height, screen.width);
initCordovaWithDeviceProfile(deferred, deviceId, MediaPlayer.getDeviceProfile(screenWidth));
}
function initCordovaWithDeviceProfile(deferred, deviceId, deviceProfile) {
if ($.browser.android) {
requirejs(['thirdparty/cordova/android/imagestore.js']);
} else {
@ -1908,9 +1926,7 @@ var AppInfo = {};
var capablities = Dashboard.capabilities();
capablities.DeviceProfile = deviceProfile;
init(deferred, capablities, "Emby Mobile", deviceId, device.model, true);
init(deferred, capablities, "Emby Mobile", deviceId, device.model);
}
function initCordova(deferred) {