jellyfin-web/dashboard-ui/scripts/wizardlivetvtuner.js

1 line
1.4 KiB
JavaScript
Raw Normal View History

2017-01-27 20:16:59 -07:00
define(["jQuery"],function($){"use strict";function save(page){Dashboard.showLoadingMsg();var apiClient=ApiClient;apiClient.getJSON(apiClient.getUrl("Startup/Configuration")).then(function(config){config.LiveTvTunerType=$("#selectTunerType",page).val(),config.LiveTvTunerPath=$(".txtDevicePath",page).val(),apiClient.ajax({type:"POST",data:config,url:apiClient.getUrl("Startup/Configuration")}).then(function(){Dashboard.hideLoadingMsg(),navigateToNextPage(config)},function(){Dashboard.hideLoadingMsg(),Dashboard.alert({message:Globalize.translate("ErrorSavingTvProvider")})})})}function reload(page){Dashboard.showLoadingMsg();var apiClient=ApiClient;apiClient.getJSON(apiClient.getUrl("Startup/Configuration")).then(function(config){$("#selectTunerType",page).val(config.LiveTvTunerType||"hdhomerun"),page.querySelector(".txtDevicePath").value=config.LiveTvTunerPath||"",Dashboard.hideLoadingMsg()})}function navigateToNextPage(config){config.LiveTvTunerPath&&config.LiveTvTunerType?Dashboard.navigate("wizardlivetvguide.html"):skip()}function skip(){require(["scripts/wizardcontroller"],function(wizardcontroller){wizardcontroller.navigateToComponents()})}function onSubmit(){var form=this;return save(form),!1}$(document).on("pageinit","#wizardTunerPage",function(){var page=this;$("form",page).off("submit",onSubmit).on("submit",onSubmit),$(".btnSkip",page).on("click",skip)}).on("pageshow","#wizardTunerPage",function(){var page=this;reload(page)})});