mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
fix ie hang on library setup
This commit is contained in:
parent
3d458f8076
commit
3d0d3247fd
13 changed files with 58 additions and 15 deletions
|
@ -55,7 +55,10 @@
|
|||
|
||||
html += '<paper-icon-item role="menuitem" class="lnkPath">';
|
||||
|
||||
html += '<paper-fab class="listAvatar" style="background:#52B54B;" icon="folder" item-icon></paper-fab>';
|
||||
if (!$.browser.msie) {
|
||||
// Not sure why, but this is causing the entire browser to hang
|
||||
html += '<paper-fab class="listAvatar" style="background:#52B54B;" icon="folder" item-icon></paper-fab>';
|
||||
}
|
||||
|
||||
html += '<paper-item-body>';
|
||||
html += path;
|
||||
|
|
257
dashboard-ui/components/tvproviders/schedulesdirect.js
Normal file
257
dashboard-ui/components/tvproviders/schedulesdirect.js
Normal file
|
@ -0,0 +1,257 @@
|
|||
define([], function () {
|
||||
|
||||
return function (page, providerId, options) {
|
||||
|
||||
var self = this;
|
||||
|
||||
var listingsId;
|
||||
|
||||
function reload() {
|
||||
|
||||
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 || '');
|
||||
page.querySelector('.txtUser').value = info.Username || '';
|
||||
page.querySelector('.txtPass').value = '';
|
||||
|
||||
page.querySelector('.txtZipCode').value = info.ZipCode || '';
|
||||
|
||||
if (info.Username && info.Password) {
|
||||
page.querySelector('.listingsSection').classList.remove('hide');
|
||||
} else {
|
||||
page.querySelector('.listingsSection').classList.add('hide');
|
||||
}
|
||||
|
||||
setCountry(info);
|
||||
});
|
||||
}
|
||||
|
||||
function setCountry(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 || '');
|
||||
|
||||
$(page.querySelector('.txtZipCode')).trigger('change');
|
||||
|
||||
}).fail(function () {
|
||||
|
||||
Dashboard.alert({
|
||||
message: Globalize.translate('ErrorGettingTvLineups')
|
||||
});
|
||||
});
|
||||
|
||||
Dashboard.hideLoadingMsg();
|
||||
}
|
||||
|
||||
function submitLoginForm() {
|
||||
|
||||
Dashboard.showLoadingMsg();
|
||||
|
||||
require(["cryptojs-sha1"], function () {
|
||||
|
||||
var info = {
|
||||
Type: 'SchedulesDirect',
|
||||
Username: page.querySelector('.txtUser').value,
|
||||
Password: CryptoJS.SHA1(page.querySelector('.txtPass').value).toString()
|
||||
};
|
||||
|
||||
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();
|
||||
providerId = result.Id;
|
||||
reload();
|
||||
|
||||
}).fail(function () {
|
||||
Dashboard.alert({
|
||||
message: Globalize.translate('ErrorSavingTvProvider')
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function submitListingsForm() {
|
||||
|
||||
var selectedListingsId = $('#selectListing', page).val();
|
||||
|
||||
if (!selectedListingsId) {
|
||||
Dashboard.alert({
|
||||
message: Globalize.translate('ErrorPleaseSelectLineup')
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
Dashboard.showLoadingMsg();
|
||||
|
||||
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.hideLoadingMsg();
|
||||
if (options.showConfirmation !== false) {
|
||||
Dashboard.processServerConfigurationUpdateResult();
|
||||
}
|
||||
$(self).trigger('submitted');
|
||||
|
||||
}).fail(function () {
|
||||
Dashboard.hideLoadingMsg();
|
||||
Dashboard.alert({
|
||||
message: Globalize.translate('ErrorSavingTvProvider')
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
function refreshListings(value) {
|
||||
|
||||
if (!value) {
|
||||
$('#selectListing', page).html('');
|
||||
return;
|
||||
}
|
||||
|
||||
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>';
|
||||
|
||||
}));
|
||||
|
||||
if (listingsId) {
|
||||
$('#selectListing', page).val(listingsId);
|
||||
}
|
||||
|
||||
Dashboard.hideModalLoadingMsg();
|
||||
|
||||
}).fail(function (result) {
|
||||
|
||||
Dashboard.alert({
|
||||
message: Globalize.translate('ErrorGettingTvLineups')
|
||||
});
|
||||
refreshListings('');
|
||||
Dashboard.hideModalLoadingMsg();
|
||||
});
|
||||
}
|
||||
|
||||
self.submit = function () {
|
||||
page.querySelector('.btnSubmitListingsContainer').click();
|
||||
};
|
||||
|
||||
self.init = function () {
|
||||
|
||||
options = options || {};
|
||||
|
||||
if (options.showCancelButton !== false) {
|
||||
page.querySelector('.btnCancel').classList.remove('hide');
|
||||
} else {
|
||||
page.querySelector('.btnCancel').classList.add('hide');
|
||||
}
|
||||
|
||||
if (options.showSubmitButton !== false) {
|
||||
page.querySelector('.btnSubmitListings').classList.remove('hide');
|
||||
} else {
|
||||
page.querySelector('.btnSubmitListings').classList.add('hide');
|
||||
}
|
||||
|
||||
$('.formLogin', page).on('submit', function () {
|
||||
submitLoginForm();
|
||||
return false;
|
||||
});
|
||||
|
||||
$('.formListings', page).on('submit', function () {
|
||||
submitListingsForm();
|
||||
return false;
|
||||
});
|
||||
|
||||
$('.txtZipCode', page).on('change', function () {
|
||||
refreshListings(this.value);
|
||||
});
|
||||
|
||||
$('.createAccountHelp', page).html(Globalize.translate('MessageCreateAccountAt', '<a href="http://www.schedulesdirect.org" target="_blank">http://www.schedulesdirect.org</a>'));
|
||||
|
||||
reload();
|
||||
};
|
||||
}
|
||||
});
|
|
@ -0,0 +1,63 @@
|
|||
<h1>Schedules Direct</h1>
|
||||
<p class="createAccountHelp"></p>
|
||||
<div style="font-size:16px;">
|
||||
<div style="display:inline-block;background-color:rgba(82,181,75,.8);color:#fff;padding:2px 10px;font-size:20px;border-radius:1000px;vertical-align:middle;">
|
||||
1
|
||||
</div>
|
||||
<div style="display:inline-block;vertical-align:middle;margin-left:5px;">
|
||||
${GuideProviderLogin}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<form class="formLogin">
|
||||
<div>
|
||||
<div>
|
||||
<paper-input class="txtUser" label="${LabelUsername}" required="required" autocomplete="off"></paper-input>
|
||||
</div>
|
||||
<div>
|
||||
<paper-input class="txtPass" label="${LabelPassword}" required="required" autocomplete="off" type="password"></paper-input>
|
||||
</div>
|
||||
<div>
|
||||
<button type="submit" data-role="none" class="clearButton">
|
||||
<paper-button raised class="submit block"><iron-icon icon="check"></iron-icon><span>${ButtonSave}</span></paper-button>
|
||||
</button>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<br />
|
||||
<br />
|
||||
<br />
|
||||
<div class="listingsSection hide">
|
||||
<div style="font-size:16px;">
|
||||
<div style="display:inline-block;background-color:rgba(82,181,75,.8);color:#fff;padding:2px 10px;font-size:20px;border-radius:1000px;vertical-align:middle;">
|
||||
2
|
||||
</div>
|
||||
<div style="display:inline-block;vertical-align:middle;margin-left:5px;">
|
||||
${GuideProviderSelectListings}
|
||||
</div>
|
||||
</div>
|
||||
<form class="formListings">
|
||||
<div>
|
||||
<div>
|
||||
<br />
|
||||
<label for="selectCountry">${LabelCountry}</label>
|
||||
<select id="selectCountry" data-mini="true" required="required"></select>
|
||||
</div>
|
||||
<div>
|
||||
<paper-input class="txtZipCode" label="${LabelZipCode}" required="required"></paper-input>
|
||||
</div>
|
||||
<div>
|
||||
<br />
|
||||
<label for="selectListing">${LabelLineup}</label>
|
||||
<select id="selectListing" data-mini="true" required="required"></select>
|
||||
</div>
|
||||
<div>
|
||||
<button type="submit" data-role="none" class="clearButton btnSubmitListingsContainer">
|
||||
<paper-button raised class="submit block btnSubmitListings hide"><iron-icon icon="check"></iron-icon><span>${ButtonSave}</span></paper-button>
|
||||
</button>
|
||||
<paper-button raised class="cancel block btnCancel hide" onclick="history.back();"><iron-icon icon="close"></iron-icon><span>${ButtonCancel}</span></paper-button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
Loading…
Add table
Add a link
Reference in a new issue