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

update search

This commit is contained in:
Luke Pulverenti 2015-08-21 22:59:10 -04:00
parent 11aebfd219
commit 6b85af3c7e
16 changed files with 474 additions and 482 deletions

View file

@ -135,6 +135,8 @@
function translateDocument(html, dictionaryName) {
dictionaryName = dictionaryName || 'html';
var glossary = getDictionary(dictionaryName, currentCulture) || {};
return translateHtml(html, glossary);
}

View file

@ -1815,7 +1815,7 @@
// cardContent
html += '</a>';
if (options.overlayPlayButton) {
if (options.overlayPlayButton && !item.IsPlaceHolder && (item.LocationType != 'Virtual' || !item.MediaType)) {
html += '<paper-icon-button icon="play-arrow" class="cardOverlayPlayButton" onclick="return false;"></paper-icon-button>';
}
if (options.overlayMoreButton) {

View file

@ -1,233 +0,0 @@
(function ($, document, window) {
var listingsId;
function reload(page, providerId) {
Dashboard.showLoadingMsg();
ApiClient.getNamedConfiguration("livetv").done(function (config) {
var info = config.ListingProviders.filter(function (i) {
return i.Id == providerId;
})[0] || {};
listingsId = info.ListingsId;
$('#selectListing', page).val(info.ListingsId || '').selectmenu('refresh');
page.querySelector('.txtUser').value = info.Username || '';
page.querySelector('.txtPass').value = info.Username || '';
page.querySelector('.txtZipCode').value = info.ZipCode || '';
setCountry(page, info);
});
}
function setCountry(page, info) {
ApiClient.getJSON(ApiClient.getUrl('LiveTv/ListingProviders/SchedulesDirect/Countries')).done(function (result) {
var countryList = [];
var i, length;
for (var region in result) {
var countries = result[region];
if (countries.length && region !== 'ZZZ') {
for (i = 0, length = countries.length; i < length; i++) {
countryList.push({
name: countries[i].fullName,
value: countries[i].shortName
});
}
}
}
countryList.sort(function (a, b) {
if (a.name > b.name) {
return 1;
}
if (a.name < b.name) {
return -1;
}
// a must be equal to b
return 0;
});
$('#selectCountry', page).html(countryList.map(function (c) {
return '<option value="' + c.value + '">' + c.name + '</option>';
}).join('')).val(info.Country || '').selectmenu('refresh');
$(page.querySelector('.txtZipCode')).trigger('change');
}).fail(function () {
Dashboard.alert({
message: Globalize.translate('ErrorGettingTvLineups')
});
});
Dashboard.hideLoadingMsg();
}
function submitLoginForm(page) {
Dashboard.showLoadingMsg();
var info = {
Type: 'SchedulesDirect',
Username: page.querySelector('.txtUser').value,
Password: CryptoJS.SHA1(page.querySelector('.txtPass').value).toString()
};
var providerId = getParameterByName('id');
var id = providerId;
if (id) {
info.Id = id;
}
ApiClient.ajax({
type: "POST",
url: ApiClient.getUrl('LiveTv/ListingProviders', {
ValidateLogin: true
}),
data: JSON.stringify(info),
contentType: "application/json"
}).done(function (result) {
Dashboard.processServerConfigurationUpdateResult();
Dashboard.navigate('livetvguideprovider-scd.html?id=' + result.Id);
}).fail(function () {
Dashboard.alert({
message: Globalize.translate('ErrorSavingTvProvider')
});
});
}
function submitListingsForm(page) {
var selectedListingsId = $('#selectListing', page).val();
if (!selectedListingsId) {
Dashboard.alert({
message: Globalize.translate('ErrorPleaseSelectLineup')
});
return;
}
Dashboard.showLoadingMsg();
var providerId = getParameterByName('id');
var id = providerId;
ApiClient.getNamedConfiguration("livetv").done(function (config) {
var info = config.ListingProviders.filter(function (i) {
return i.Id == id;
})[0];
info.ZipCode = page.querySelector('.txtZipCode').value;
info.Country = $('#selectCountry', page).val();
info.ListingsId = selectedListingsId;
ApiClient.ajax({
type: "POST",
url: ApiClient.getUrl('LiveTv/ListingProviders', {
ValidateListings: true
}),
data: JSON.stringify(info),
contentType: "application/json"
}).done(function (result) {
Dashboard.processServerConfigurationUpdateResult();
}).fail(function () {
Dashboard.alert({
message: Globalize.translate('ErrorSavingTvProvider')
});
});
});
}
function refreshListings(page, value) {
if (!value) {
$('#selectListing', page).html('').selectmenu('refresh');
return;
}
var providerId = getParameterByName('id');
Dashboard.showModalLoadingMsg();
ApiClient.ajax({
type: "GET",
url: ApiClient.getUrl('LiveTv/ListingProviders/Lineups', {
Id: providerId,
Location: value,
Country: $('#selectCountry', page).val()
}),
dataType: 'json'
}).done(function (result) {
$('#selectListing', page).html(result.map(function (o) {
return '<option value="' + o.Id + '">' + o.Name + '</option>';
})).selectmenu('refresh');
if (listingsId) {
$('#selectListing', page).val(listingsId).selectmenu('refresh');
}
Dashboard.hideModalLoadingMsg();
}).fail(function (result) {
Dashboard.alert({
message: Globalize.translate('ErrorGettingTvLineups')
});
refreshListings(page, '');
Dashboard.hideModalLoadingMsg();
});
}
$(document).on('pageinitdepends', "#liveTvGuideProviderScdPage", function () {
var page = this;
$('.formLogin', page).on('submit', function () {
submitLoginForm(page);
return false;
});
$('.formListings', page).on('submit', function () {
submitListingsForm(page);
return false;
});
$('.txtZipCode', page).on('change', function () {
refreshListings(page, this.value);
});
$('.createAccountHelp', page).html(Globalize.translate('MessageCreateAccountAt', '<a href="http://www.schedulesdirect.org" target="_blank">http://www.schedulesdirect.org</a>'));
}).on('pageshowready', "#liveTvGuideProviderScdPage", function () {
var providerId = getParameterByName('id');
var page = this;
reload(page, providerId);
});
})(jQuery, document, window);

View file

@ -1,146 +1,43 @@
(function ($, document, window) {
var listingsId;
function init(page, type, providerId) {
function reload(page, providerId) {
var url = 'tvproviders/' + type + '.js';
Dashboard.showLoadingMsg();
require([url], function (factory) {
ApiClient.getNamedConfiguration("livetv").done(function (config) {
var instance = new factory(page, providerId, {
});
var info = config.ListingProviders.filter(function (i) {
return i.Id == providerId;
})[0];
info = info || {};
listingsId = info.ListingsId;
$('#selectListing', page).val(info.ListingsId || '').selectmenu('refresh');
page.querySelector('.txtZipCode').value = info.ZipCode || '';
setCountry(page, info);
instance.init();
});
}
function setCountry(page, info) {
$('#selectCountry', page).val(info.Country || '').selectmenu('refresh');
$(page.querySelector('.txtZipCode')).trigger('change');
Dashboard.hideLoadingMsg();
}
function submitListingsForm(page) {
var selectedListingsId = $('#selectListing', page).val();
if (!selectedListingsId) {
Dashboard.alert({
message: Globalize.translate('ErrorPleaseSelectLineup')
});
return;
}
Dashboard.showLoadingMsg();
var providerId = getParameterByName('id');
ApiClient.getNamedConfiguration("livetv").done(function (config) {
var info = config.ListingProviders.filter(function (i) {
return i.Id == providerId;
})[0] || {};
info.ZipCode = page.querySelector('.txtZipCode').value;
info.Country = $('#selectCountry', page).val();
info.ListingsId = selectedListingsId;
info.Type = 'emby';
ApiClient.ajax({
type: "POST",
url: ApiClient.getUrl('LiveTv/ListingProviders', {
}),
data: JSON.stringify(info),
contentType: "application/json"
}).done(function (result) {
Dashboard.processServerConfigurationUpdateResult();
}).fail(function () {
Dashboard.alert({
message: Globalize.translate('ErrorSavingTvProvider')
});
});
});
}
function refreshListings(page, value) {
if (!value) {
$('#selectListing', page).html('').selectmenu('refresh');
return;
}
Dashboard.showModalLoadingMsg();
function loadTemplate(page, type, providerId) {
ApiClient.ajax({
type: "GET",
url: ApiClient.getUrl('LiveTv/ListingProviders/Lineups', {
Type: 'emby',
Location: value,
Country: $('#selectCountry', page).val()
}),
dataType: 'json'
}).done(function (result) {
type: 'GET',
url: 'tvproviders/' + type + '.template.html'
$('#selectListing', page).html(result.map(function (o) {
}).done(function (html) {
return '<option value="' + o.Id + '">' + o.Name + '</option>';
})).selectmenu('refresh');
if (listingsId) {
$('#selectListing', page).val(listingsId).selectmenu('refresh');
}
Dashboard.hideModalLoadingMsg();
}).fail(function (result) {
Dashboard.alert({
message: Globalize.translate('ErrorGettingTvLineups')
});
refreshListings(page, '');
Dashboard.hideModalLoadingMsg();
var elem = page.querySelector('.providerTemplate');
elem.innerHTML = Globalize.translateDocument(html);
$(elem).trigger('create');
init(page, type, providerId);
});
}
$(document).on('pageinitdepends', "#liveTvGuideProviderPage", function () {
$(document).on('pageshowready', "#liveTvGuideProviderPage", function () {
var page = this;
$('.formListings', page).on('submit', function () {
submitListingsForm(page);
return false;
});
$('.txtZipCode', page).on('change', function () {
refreshListings(page, this.value);
});
}).on('pageshowready', "#liveTvGuideProviderPage", function () {
Dashboard.showLoadingMsg();
var providerId = getParameterByName('id');
var type = getParameterByName('type');
var page = this;
reload(page, providerId);
loadTemplate(page, type, providerId);
});
})(jQuery, document, window);

View file

@ -7,11 +7,13 @@
function getRegistration(programId) {
var deferred = DeferredBuilder.Deferred();
if (registrationInfo && lastRegId == programId) {
if (registrationInfo && (lastRegId == programId)) {
deferred.resolveWith(null, [registrationInfo]);
return deferred.promise();
}
registrationInfo = null;
lastRegId = programId;
Dashboard.showLoadingMsg();
ApiClient.getJSON(ApiClient.getUrl('LiveTv/Registration', {

View file

@ -304,7 +304,7 @@
html += '<paper-item-body two-line>';
html += '<a class="clearLink" href="' + getProviderConfigurationUrl(provider.Type) + '?id=' + provider.Id + '">';
html += '<a class="clearLink" href="' + getProviderConfigurationUrl(provider.Type) + '&id=' + provider.Id + '">';
html += '<div>';
html += getProviderName(provider.Type);
@ -390,9 +390,9 @@
switch (providerId) {
case 'schedulesdirect':
return 'livetvguideprovider-scd.html';
return 'livetvguideprovider.html?type=schedulesdirect';
case 'emby':
return 'livetvguideprovider.html';
return 'livetvguideprovider.html?type=emby';
default:
break;
}

View file

@ -0,0 +1,77 @@
(function ($, document) {
var guideController;
function init(page, type, providerId) {
var url = 'tvproviders/' + type + '.js';
require([url], function (factory) {
var instance = new factory(page, providerId, {
showCancelButton: false,
showSubmitButton: false
});
instance.init();
guideController = instance;
});
}
function loadTemplate(page, type, providerId) {
guideController = null;
ApiClient.ajax({
type: 'GET',
url: 'tvproviders/' + type + '.template.html'
}).done(function (html) {
var elem = page.querySelector('.providerTemplate');
elem.innerHTML = Globalize.translateDocument(html);
$(elem).trigger('create');
init(page, type, providerId);
});
}
function skip() {
var apiClient = ApiClient;
apiClient.getJSON(apiClient.getUrl('Startup/Info')).done(function (info) {
if (info.SupportsRunningAsService) {
Dashboard.navigate('wizardservice.html');
} else {
Dashboard.navigate('wizardagreement.html');
}
});
}
function next() {
guideController.submit();
}
$(document).on('pageinitdepends', "#wizardGuidePage", function () {
var page = this;
$('#selectType', page).on('change', function () {
loadTemplate(page, this.value);
});
$('.btnSkip', page).on('click', skip);
$('.btnNext', page).on('click', next);
}).on('pageshowready', "#wizardGuidePage", function () {
var page = this;
$('#selectType', page).trigger('change');
});
})(jQuery, document, window);

View file

@ -21,7 +21,7 @@
}).done(function () {
Dashboard.hideLoadingMsg();
navigateToNextPage();
navigateToNextPage(config);
});
});
@ -42,8 +42,13 @@
});
}
function navigateToNextPage() {
skip();
function navigateToNextPage(config) {
if (config.LiveTvTunerPath && config.LiveTvTunerType) {
Dashboard.navigate('wizardlivetvguide.html');
} else {
skip();
}
}
function skip() {