2016-03-18 21:26:17 -07:00
|
|
|
|
define(['jQuery'], function ($) {
|
2015-08-21 19:59:10 -07:00
|
|
|
|
|
|
|
|
|
var guideController;
|
|
|
|
|
|
2015-08-22 09:55:23 -07:00
|
|
|
|
function init(page, type) {
|
2015-08-21 19:59:10 -07:00
|
|
|
|
|
2015-08-22 09:55:23 -07:00
|
|
|
|
Dashboard.showLoadingMsg();
|
2015-08-21 19:59:10 -07:00
|
|
|
|
|
2015-08-22 09:55:23 -07:00
|
|
|
|
var apiClient = ApiClient;
|
2015-08-21 19:59:10 -07:00
|
|
|
|
|
2015-12-14 08:43:03 -07:00
|
|
|
|
apiClient.getJSON(apiClient.getUrl('Startup/Configuration')).then(function (config) {
|
2015-08-22 09:55:23 -07:00
|
|
|
|
|
|
|
|
|
var providerId = null;
|
|
|
|
|
|
2015-08-22 11:09:02 -07:00
|
|
|
|
if ((config.LiveTvGuideProviderType || '').toLowerCase() == type.toLowerCase()) {
|
2015-08-22 09:55:23 -07:00
|
|
|
|
if (config.LiveTvGuideProviderId) {
|
|
|
|
|
providerId = config.LiveTvGuideProviderId;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2015-10-27 11:21:30 -07:00
|
|
|
|
var url = 'components/tvproviders/' + type.toLowerCase() + '.js';
|
2015-08-22 09:55:23 -07:00
|
|
|
|
|
|
|
|
|
require([url], function (factory) {
|
|
|
|
|
|
|
|
|
|
var instance = new factory(page, providerId, {
|
|
|
|
|
showCancelButton: false,
|
|
|
|
|
showSubmitButton: false,
|
|
|
|
|
showConfirmation: false
|
|
|
|
|
});
|
2015-08-21 19:59:10 -07:00
|
|
|
|
|
2015-08-22 09:55:23 -07:00
|
|
|
|
Dashboard.hideLoadingMsg();
|
|
|
|
|
instance.init();
|
|
|
|
|
guideController = instance;
|
|
|
|
|
|
|
|
|
|
$(guideController).on('submitted', skip);
|
|
|
|
|
});
|
2015-08-21 19:59:10 -07:00
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
2015-08-22 09:55:23 -07:00
|
|
|
|
function loadTemplate(page, type) {
|
2015-08-21 19:59:10 -07:00
|
|
|
|
|
|
|
|
|
guideController = null;
|
|
|
|
|
|
|
|
|
|
ApiClient.ajax({
|
|
|
|
|
|
|
|
|
|
type: 'GET',
|
2016-05-12 19:32:12 -07:00
|
|
|
|
url: 'components/tvproviders/' + type.toLowerCase() + '.template.html'
|
2015-08-21 19:59:10 -07:00
|
|
|
|
|
2015-12-14 08:43:03 -07:00
|
|
|
|
}).then(function (html) {
|
2015-08-21 19:59:10 -07:00
|
|
|
|
|
|
|
|
|
var elem = page.querySelector('.providerTemplate');
|
2016-03-05 12:07:58 -07:00
|
|
|
|
elem.innerHTML = Globalize.translateDocument(html);
|
2015-08-21 19:59:10 -07:00
|
|
|
|
|
2015-08-22 09:55:23 -07:00
|
|
|
|
init(page, type);
|
2015-08-21 19:59:10 -07:00
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function skip() {
|
2016-06-23 10:04:18 -07:00
|
|
|
|
require(['scripts/wizardcontroller'], function (wizardcontroller) {
|
|
|
|
|
wizardcontroller.navigateToComponents();
|
2015-08-21 19:59:10 -07:00
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function next() {
|
|
|
|
|
guideController.submit();
|
|
|
|
|
}
|
|
|
|
|
|
2015-08-22 09:55:23 -07:00
|
|
|
|
function reload(page) {
|
|
|
|
|
|
|
|
|
|
$('#selectType', page).trigger('change');
|
|
|
|
|
}
|
|
|
|
|
|
2015-09-01 07:01:59 -07:00
|
|
|
|
$(document).on('pageinit', "#wizardGuidePage", function () {
|
2015-08-21 19:59:10 -07:00
|
|
|
|
|
|
|
|
|
var page = this;
|
|
|
|
|
|
|
|
|
|
$('#selectType', page).on('change', function () {
|
|
|
|
|
|
|
|
|
|
loadTemplate(page, this.value);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
$('.btnSkip', page).on('click', skip);
|
|
|
|
|
$('.btnNext', page).on('click', next);
|
|
|
|
|
|
2015-09-24 10:08:10 -07:00
|
|
|
|
}).on('pageshow', "#wizardGuidePage", function () {
|
2015-08-21 19:59:10 -07:00
|
|
|
|
|
|
|
|
|
var page = this;
|
|
|
|
|
|
2015-08-22 09:55:23 -07:00
|
|
|
|
reload(page);
|
2015-08-21 19:59:10 -07:00
|
|
|
|
});
|
|
|
|
|
|
2016-03-18 21:26:17 -07:00
|
|
|
|
});
|