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

Merge branch 'master' of https://github.com/MediaBrowser/MediaBrowser into upstream-master

This commit is contained in:
Tim Hobbs 2014-05-18 15:45:16 -07:00
commit 704fa77349
26 changed files with 638 additions and 526 deletions

View file

@ -59,9 +59,6 @@
border-width: 0 !important;
}
.headerButtonRight:last-child {
}
.desktopHomeLink {
color: #ddd !important;
text-decoration: none;
@ -232,6 +229,7 @@
background-image: url(images/items/folders/settings.png);
background-position: 16px 8px;
}
.reportsViewMenu {
background-image: url(images/items/folders/report.png);
}

View file

@ -207,11 +207,35 @@
margin-right: 10px;
}
.subtitleViewerContent {
overflow: auto;
width: 200px;
height: 200px;
}
@media all and (min-width: 400px) {
.subtitleViewerContent {
width: 300px;
}
}
@media all and (min-width: 500px) {
.subtitleViewerContent {
width: 400px;
}
}
@media all and (min-width: 600px) {
.popupIdentify {
width: 400px;
}
.subtitleViewerContent {
width: 500px;
}
}
@media all and (min-width: 700px) {
@ -223,6 +247,10 @@
.popupIdentify {
width: 500px;
}
.subtitleViewerContent {
width: 600px;
}
}
@media all and (min-width: 800px) {
@ -344,6 +372,10 @@
.popupIdentify form, .identificationSearchResults {
height: 350px;
}
.subtitleViewerContent {
height: 400px;
}
}
@media all and (min-height: 600px) {
@ -355,6 +387,10 @@
.collectionItemSearchResults {
max-height: 70%;
}
.subtitleViewerContent {
height: 500px;
}
}
@media all and (min-height: 700px) {
@ -366,6 +402,10 @@
.collectionItemSearchResults {
max-height: 75%;
}
.subtitleViewerContent {
height: 600px;
}
}
@media all and (min-height: 800px) {

View file

@ -18,7 +18,6 @@
<br />
<div data-role="controlgroup" data-type="horizontal" class="localnav" data-mini="true">
<a href="#" data-role="button" id="btnEditMetadata">${TabMetadata}</a>
<a id="btnEditPeople" style="display: none;" href="#" data-role="button">${TabPeople}</a>
<a href="#" data-role="button" class="ui-btn-active">${TabCollectionTitles}</a>
<a id="btnEditImages" href="#" data-role="button">${TabImages}</a>
</div>

View file

@ -18,7 +18,7 @@
<br />
<div data-role="controlgroup" data-type="horizontal" class="localnav" data-mini="true">
<a href="#" data-role="button" id="btnEditMetadata">${TabMetadata}</a>
<a href="#" data-role="button" id="btnEditPeople" style="display: none;">${TabPeople}</a>
<a id="btnEditSubtitles" style="display: none;" href="#" data-role="button">${TabSubtitles}</a>
<a id="btnEditCollectionTitles" style="display: none;" href="#" data-role="button">${TabCollectionTitles}</a>
<a href="#" data-role="button" class="ui-btn-active">${TabImages}</a>
</div>

View file

@ -17,7 +17,7 @@
<br />
<div data-role="controlgroup" data-type="horizontal" class="localnav" data-mini="true">
<a href="#" data-role="button" class="ui-btn-active">${TabMetadata}</a>
<a id="btnEditPeople" style="display: none;" href="#" data-role="button">${TabPeople}</a>
<a id="btnEditSubtitles" style="display: none;" href="#" data-role="button">${TabSubtitles}</a>
<a id="btnEditCollectionTitles" style="display: none;" href="editcollectionitems.html" data-role="button">${TabCollectionTitles}</a>
<a href="#" data-role="button" id="btnEditImages">${TabImages}</a>
</div>
@ -269,6 +269,18 @@
</div>
</div>
</div>
<div data-role="collapsible" data-mini="true" id="countriesCollapsible" style="display: none; margin-top: 1em;">
<h3>Countries</h3>
<div data-role="editableListviewContainer">
<div data-role="fieldcontain">
<div style="display: inline-block; width: 80%;">
<input type="text" data-mini="true" />
</div>
<a data-role="button" data-theme="b" data-inline="true" data-mini="true" data-icon="plus" data-iconpos="notext" onclick="EditItemMetadataPage.addElementToEditableListview(this)" style="vertical-align: top;">Add</a>
</div>
<ul data-role="listview" data-inset="true" data-split-icon="delete" id="listCountries"></ul>
</div>
</div>
<div data-role="collapsible" data-mini="true" id="genresCollapsible" style="display: none; margin-top: 1em;">
<h3>Genres</h3>
<div data-role="editableListviewContainer">
@ -281,6 +293,24 @@
<ul data-role="listview" data-inset="true" data-split-icon="delete" id="listGenres"></ul>
</div>
</div>
<div data-mini="true" data-role="collapsible" id="peopleCollapsible" style="display: none; margin-top: 1em;">
<h3>People</h3>
<div>
<ul data-role="listview" data-inset="true" data-split-icon="delete" id="peopleList"></ul>
</div>
</div>
<div data-mini="true" data-role="collapsible" id="keywordsCollapsible" style="display: none; margin-top: 1em;">
<h3>Plot Keywords</h3>
<div data-role="editableListviewContainer">
<div data-role="fieldcontain">
<div style="display: inline-block; width: 80%;">
<input type="text" data-mini="true" />
</div>
<a data-role="button" data-theme="b" data-inline="true" data-mini="true" data-icon="plus" data-iconpos="notext" onclick="EditItemMetadataPage.addElementToEditableListview(this)" style="vertical-align: top;">Add</a>
</div>
<ul data-role="listview" data-inset="true" data-split-icon="delete" id="listKeywords"></ul>
</div>
</div>
<div data-role="collapsible" data-mini="true" id="studiosCollapsible" style="display: none; margin-top: 1em;">
<h3>Studios</h3>
<div data-role="editableListviewContainer">
@ -305,18 +335,6 @@
<ul data-role="listview" data-inset="true" data-split-icon="delete" id="listTags"></ul>
</div>
</div>
<div data-mini="true" data-role="collapsible" id="keywordsCollapsible" style="display: none; margin-top: 1em;">
<h3>Plot Keywords</h3>
<div data-role="editableListviewContainer">
<div data-role="fieldcontain">
<div style="display: inline-block; width: 80%;">
<input type="text" data-mini="true" />
</div>
<a data-role="button" data-theme="b" data-inline="true" data-mini="true" data-icon="plus" data-iconpos="notext" onclick="EditItemMetadataPage.addElementToEditableListview(this)" style="vertical-align: top;">Add</a>
</div>
<ul data-role="listview" data-inset="true" data-split-icon="delete" id="listKeywords"></ul>
</div>
</div>
<div data-role="collapsible" data-mini="true" id="metadataSettingsCollapsible" style="display: none; margin-top: 1em;">
<h3>Metadata Settings</h3>
<div>

View file

@ -1,32 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<title>${TitleMediaBrowser}</title>
</head>
<body>
<div id="editItemPeoplePage" data-role="page" data-theme="b" class="page libraryPage metadataEditorPage">
<div data-role="content editPageContent">
<div class="editPageSidebar">
<div class="libraryTree">
<ul>
</ul>
</div>
</div>
<div class="editPageInnerContent">
<h1 class="itemName editPageName">&nbsp;</h1>
<br />
<div data-role="controlgroup" data-type="horizontal" class="localnav" data-mini="true">
<a href="#" data-role="button" id="btnEditMetadata">${TabMetadata}</a>
<a href="#" data-role="button" class="ui-btn-active">${TabPeople}</a>
<a id="btnEditCollectionTitles" style="display: none;" href="#" data-role="button">${TabCollectionTitles}</a>
<a href="#" data-role="button" id="btnEditImages">${TabImages}</a>
</div>
<div id="divAddPerson" style="display: none;">
<button type="button" data-icon="plus" data-inline="true" data-mini="true" onclick="EditItemPeoplePage.addPerson();">${ButtonAdd}</button>
</div>
<div class="itemsContainer" id="peopleContainer" style="text-align: left;"></div>
</div>
</div>
</div>
</body>
</html>

View file

@ -0,0 +1,61 @@
<!DOCTYPE html>
<html>
<head>
<title>${TitleMediaBrowser}</title>
</head>
<body>
<div id="editItemSubtitlesPage" data-role="page" data-theme="b" class="page libraryPage metadataEditorPage">
<div data-role="content editPageContent">
<div class="editPageSidebar">
<div class="libraryTree">
<ul>
</ul>
</div>
</div>
<div class="editPageInnerContent">
<h1 class="itemName editPageName">&nbsp;</h1>
<br />
<div data-role="controlgroup" data-type="horizontal" class="localnav" data-mini="true">
<a id="btnEditMetadata" href="#" data-role="button">${TabMetadata}</a>
<a href="#" data-role="button" class="ui-btn-active">${TabSubtitles}</a>
<a id="btnEditImages" href="#" data-role="button">${TabImages}</a>
</div>
<div class="readOnlyContent" style="max-width: 700px;">
<div class="subtitleList"></div>
</div>
<br />
<h1>${HeaderSearchForSubtitles}</h1>
<form class="subtitleSearchForm">
<div style="display: inline-block; width: 85%;">
<label for="selectLanguage">${LabelLanguage}</label>
<select id="selectLanguage" required="required" data-mini="true"></select>
</div>
<button type="submit" data-icon="search" class="btnSearchSubtitles" data-inline="true" data-iconpos="notext" data-mini="true" style="vertical-align: bottom;">${ButtonSearch}</button>
</form>
<br />
<div class="readOnlyContent" style="max-width: 700px;">
<div class="subtitleResults"></div>
<div class="noSearchResults" style="display: none;">
${MessageNoSubtitleSearchResultsFound}
</div>
</div>
</div>
</div>
<div data-role="popup" class="ui-content popupSubtitleViewer" data-history="false">
<a href="#" data-rel="back" data-role="button" class="ui-btn ui-corner-all ui-shadow ui-btn-b ui-icon-delete ui-btn-icon-notext ui-btn-right">Close</a>
<div class="subtitleViewerContent">
<pre class="subtitleContent" style="margin: 0; border-radius: 0;"></pre>
</div>
</div>
<script type="text/javascript">
$('.subtitleSearchForm').off('submit', EditItemSubtitlesPage.onSearchSubmit).on('submit', EditItemSubtitlesPage.onSearchSubmit);
</script>
</div>
</body>
</html>

View file

@ -8,7 +8,7 @@
<div id="channelTabs" class="itemTabs" style="display: none;">
<div class="libraryViewNav scopedLibraryViewNav">
<a href="#" class="ui-btn-active">${TabChannels}</a>
<a href="channels.html" class="ui-btn-active">${TabChannels}</a>
</div>
</div>

View file

@ -19,7 +19,7 @@
<ul data-role="listview" class="ulForm">
<li>
<label for="selectActiveService">${LabelActiveService}</label>
<select id="selectActiveService" data-mini="true">
<select id="selectActiveService" data-mini="true" required="required">
</select>
<div class="fieldDescription">${LabelActiveServiceHelp}</div>
</li>

View file

@ -18,7 +18,7 @@
function getBackdropItemIds(userId, types, parentId) {
var key = 'backdrops_' + userId + (types || '') + (parentId || '');
var key = 'backdrops2_' + userId + (types || '') + (parentId || '');
var deferred = $.Deferred();
@ -33,7 +33,7 @@
var options = {
SortBy: "Random",
SortBy: "IsFavoriteOrLiked,Random",
Limit: 50,
Recursive: true,
IncludeItemTypes: types,

View file

@ -35,6 +35,8 @@
$('.categoryTitle', page).html(item.Name);
});
query.categoryId = categoryId;
$.getJSON(ApiClient.getUrl("Channels/" + channelId + "/Items", query)).done(function (result) {
// Scroll back up so they can see the results from the beginning
@ -51,7 +53,8 @@
shape: "auto",
context: 'channels',
showTitle: true,
centerText: true
centerText: true,
coverImage: true
});
html += LibraryBrowser.getPagingHtml(query, result.TotalRecordCount);
@ -76,6 +79,9 @@
LibraryBrowser.saveQueryValues(getSavedQueryId(), query);
}).always(function() {
hideLoadingMessage(page);
});
}

View file

@ -12,8 +12,8 @@
var query = MetadataEditor.getEditQueryString(item);
$('#btnEditPeople', page).attr('href', 'edititempeople.html?' + query);
$('#btnEditMetadata', page).attr('href', 'edititemmetadata.html?' + query);
$('#btnEditSubtitles', page).attr('href', 'edititemsubtitles.html?' + query);
$('#btnEditCollectionTitles', page).attr('href', 'editcollectionitems.html?' + query);
}
@ -269,18 +269,18 @@
updateTabs(page, item);
if (item.Type == "Person" || item.Type == "Studio" || item.Type == "MusicGenre" || item.Type == "Genre" || item.Type == "MusicArtist" || item.Type == "GameGenre" || item.Type == "TvChannel" || item.Type == "BoxSet") {
$('#btnEditPeople', page).hide();
} else {
$('#btnEditPeople', page).show();
}
if (item.Type == "BoxSet") {
$('#btnEditCollectionTitles', page).show();
} else {
$('#btnEditCollectionTitles', page).hide();
}
if (item.MediaType == "Video" && item.LocationType == "FileSystem") {
$('#btnEditSubtitles', page).show();
} else {
$('#btnEditSubtitles', page).hide();
}
ApiClient.getRemoteImageProviders(getBaseRemoteOptions()).done(function (providers) {
if (providers.length) {

View file

@ -14,8 +14,8 @@
var query = MetadataEditor.getEditQueryString(item);
$('#btnEditPeople', page).attr('href', 'edititempeople.html?' + query);
$('#btnEditImages', page).attr('href', 'edititemimages.html?' + query);
$('#btnEditSubtitles', page).attr('href', 'edititemsubtitles.html?' + query);
$('#btnEditCollectionTitles', page).attr('href', 'editcollectionitems.html?' + query);
}
@ -70,19 +70,19 @@
setFieldVisibilities(page, item);
fillItemInfo(page, item);
if (item.Type == "Person" || item.Type == "Studio" || item.Type == "MusicGenre" || item.Type == "Genre" || item.Type == "MusicArtist" || item.Type == "GameGenre" || item.Type == "TvChannel" || item.Type == "BoxSet") {
$('#btnEditPeople', page).hide();
} else {
$('#btnEditPeople', page).show();
}
if (item.Type == "BoxSet") {
$('#btnEditCollectionTitles', page).show();
} else {
$('#btnEditCollectionTitles', page).hide();
}
Dashboard.getCurrentUser().done(function(user) {
if (item.MediaType == "Video" && item.LocationType == "FileSystem") {
$('#btnEditSubtitles', page).show();
} else {
$('#btnEditSubtitles', page).hide();
}
Dashboard.getCurrentUser().done(function (user) {
if (user.Configuration.EnableContentDeletion &&
item.Type != "TvChannel" &&
@ -259,6 +259,8 @@
$('#fldCommunityRating', page).hide();
$('#fldCommunityVoteCount', page).hide();
$('#genresCollapsible', page).hide();
$('#countriesCollapsible', page).hide();
$('#peopleCollapsible', page).hide();
$('#studiosCollapsible', page).hide();
if (item.Type == "TvChannel") {
@ -271,6 +273,8 @@
$('#fldCommunityRating', page).show();
$('#fldCommunityVoteCount', page).show();
$('#genresCollapsible', page).show();
$('#peopleCollapsible', page).show();
$('#countriesCollapsible', page).show();
$('#studiosCollapsible', page).show();
$('#fldOfficialRating', page).show();
$('#fldCustomRating', page).show();
@ -424,7 +428,9 @@
}).checkboxradio('refresh');
populateListView($('#listCountries', page), item.ProductionLocations || []);
populateListView($('#listGenres', page), item.Genres);
populatePeople($('#peopleList', page), item.People || []);
populateListView($('#listStudios', page), (item.Studios || []).map(function (element) { return element.Name || ''; }));
@ -538,6 +544,47 @@
}
}
function populatePeople(elem, people) {
var lastType = '';
var html = '';
for (var i = 0, length = people.length; i < length; i++) {
var person = people[i];
var type = person.Type || 'Person';
if (type != lastType) {
html += '<li data-role="list-divider">' + type + '</li>';
lastType = type;
}
html += '<li><a href="#">';
html += '<h3>' + (person.Name || 'Unknown name') + '</h3>';
if (person.Role && person.Role != lastType) {
html += '<p>' + (person.Role) + '</p>';
}
html += '</a>';
html += '<a class="btnDeletePerson" href="#" data-icon="delete" data-index="' + i + '">Delete</a>';
html += '</li>';
}
elem.html(html).listview('refresh');
$('.btnDeletePerson', elem).on('click', function () {
var index = parseInt(this.getAttribute('data-index'));
currentItem.People.splice(index, 1);
populatePeople(elem, currentItem.People);
});
}
function convertTo24HourFormat(time) {
if (time == "")
return time;
@ -760,6 +807,7 @@
AirDays: getSelectedAirDays(form),
AirTime: convertTo12HourFormat($('#txtAirTime', form).val()),
Genres: editableListViewValues($("#listGenres", form)),
ProductionLocations: editableListViewValues($("#listCountries", form)),
Tags: editableListViewValues($("#listTags", form)),
Keywords: editableListViewValues($("#listKeywords", form)),
Studios: editableListViewValues($("#listStudios", form)).map(function (element) { return { Name: element }; }),

View file

@ -1,288 +0,0 @@
(function ($, document, window) {
var currentItem;
function updateTabs(page, item) {
var query = MetadataEditor.getEditQueryString(item);
$('#btnEditMetadata', page).attr('href', 'edititemmetadata.html?' + query);
$('#btnEditImages', page).attr('href', 'edititemimages.html?' + query);
$('#btnEditCollectionTitles', page).attr('href', 'editcollectionitems.html?' + query);
}
function reload(page) {
Dashboard.showLoadingMsg();
MetadataEditor.getItemPromise().done(function (item) {
$('#btnRefresh', page).buttonEnabled(true);
if (item.LocationType == "Offline") {
$('#divAddPerson', page).hide();
} else {
$('#divAddPerson', page).show();
}
$('#refreshLoading', page).hide();
currentItem = item;
LibraryBrowser.renderName(item, $('.itemName', page), true);
updateTabs(page, item);
fillPeopleContainer(item, item.People, $('#peopleContainer', page));
Dashboard.hideLoadingMsg();
});
}
function fillPeopleContainer(item, people, container) {
people = people || new Array();
var html = '';
for (var i = 0; i < people.length; i++) {
html += constructPerson(item, people[i]);
}
container.html(html).trigger('create');
}
function constructPerson(item, person) {
var html = '<div class="tileItem posterTileItem editorTile">';
var imgUrl;
var name = person.Name || "";
var role = person.Role || "";
var type = person.Type || "";
if (person.PrimaryImageTag) {
imgUrl = ApiClient.getPersonImageUrl(person.Name, {
width: 150,
tag: person.PrimaryImageTag,
type: "primary"
});
} else {
imgUrl = "css/images/items/list/person.png";
}
html += '<div class="tileImage" style="background-image: url(\'' + imgUrl + '\');"></div>';
html += '<div class="tileContent">';
html += '<div data-role="fieldcontain">';
html += '<input type="hidden" name="originalName" value="' + name + '">';
html += '<input type="hidden" name="originalRole" value="' + role + '">';
html += '<input type="hidden" name="originalType" value="' + type + '">';
// The floats are to prevent jquery mobile from floating it
html += '<label for="txtName" style="float:none;">Name:</label>';
html += '<span class="read"> ' + (name) + '</span><span style="display:none;" class="edit">';
html += '<input type="text" name="txtName" required="required" data-mini="true" value="' + (name) + '"/>';
html += '</span>';
html += '</div>';
html += '<div data-role="fieldcontain">';
html += '<label for="txtRole" style="float:none;">Role:</label>';
html += '<span class="read"> ' + (role) + '</span><span style="display:none;" class="edit">';
html += '<input type="text" name="txtRole" required="required" data-mini="true" value="' + (role) + '"/>';
html += '</span>';
html += '</div>';
html += '<div data-role="fieldcontain">';
html += '<label for="selectType" style="float:none;">Type:</label>';
html += '<span class="read"> ' + (type) + '</span><span style="display:none;" class="edit">';
html += '<select name="selectType" data-inline="true" data-mini="true">';
html += generateTypes(type);
html += '</select>';
html += '</span>';
html += '</div>';
html += '<p>';
if (item.LocationType !== "Offline") {
html += '<span class="read">';
html += '<button type="button" class="edit" data-mini="true" data-inline="true" data-icon="edit" onclick="EditItemPeoplePage.displayEdit(this)">Edit</button>';
html += '</span>';
}
html += '<span style="display:none;" class="edit">';
html += '<button type="button" data-mini="true" data-inline="true" onclick="EditItemPeoplePage.hideEdit(this)">Cancel</button>';
html += '<button type="button" data-icon="check" data-mini="true" data-inline="true" data-theme="b" onclick="EditItemPeoplePage.savePerson(this)">Save</button>';
html += '<button type="button" data-icon="delete" data-mini="true" data-inline="true" onclick="EditItemPeoplePage.removePerson(this)">Delete</button>';
html += '</span>';
html += '</p>';
html += '</div>';
html += '</div>';
return html;
}
function generateTypes(type) {
var types = new Array("", "Actor", "Director", "Composer", "Writer", "GuestStar", "Producer");
var html = "";
for (var i = 0; i < types.length; i++) {
html += '<option val="' + types[i] + '" ' + (types[i] == type ? 'selected="selected"' : '') + '>' + types[i] + '</option>';
}
return html;
}
function editItemPeoplePage() {
var self = this;
self.displayEdit = function (source) {
$(source).parents('.tileItem').find('span.edit').show();
$(source).parents('.tileItem').find('span.read').hide();
};
self.hideEdit = function (source) {
var item = $(source).parents('.tileItem');
item.find('span.edit').hide();
item.find('span.read').show();
item.find('input[name="txtName"]').val(item.find('input[name="originalName"]').val());
item.find('input[name="txtRole"]').val(item.find('input[name="originalRole"]').val());
item.find('select[name="selectType"]').val(item.find('input[name="originalType"]').val()).selectmenu('refresh');
};
self.removePerson = function (source) {
var page = $.mobile.activePage;
Dashboard.confirm("Are you sure you wish to delete this person?", "Delete Person", function (result) {
if (result) {
var item = $(source).parents('.tileItem');
var originalName = item.find('input[name="originalName"]').val();
var originalRole = item.find('input[name="originalRole"]').val();
var originalType = item.find('input[name="originalType"]').val();
for (var i = 0; i < currentItem.People.length; i++) {
var name = currentItem.People[i].Name || "";
var role = currentItem.People[i].Role || "";
var type = currentItem.People[i].Type || "";
if ((name + role + type) == (originalName + originalRole + originalType)) {
currentItem.People.splice(i, 1);
ApiClient.updateItem(currentItem).done(function () {
reload(page);
});
}
}
}
});
};
self.savePerson = function (source) {
var page = $.mobile.activePage;
var item = $(source).parents('.tileItem');
var originalName = item.find('input[name="originalName"]').val();
var originalRole = item.find('input[name="originalRole"]').val();
var originalType = item.find('input[name="originalType"]').val();
for (var i = 0; i < currentItem.People.length; i++) {
var name = currentItem.People[i].Name || "";
var role = currentItem.People[i].Role || "";
var type = currentItem.People[i].Type || "";
if ((name + role + type) == (originalName + originalRole + originalType)) {
currentItem.People[i].Name = item.find('input[name="txtName"]').val();
currentItem.People[i].Role = item.find('input[name="txtRole"]').val();
currentItem.People[i].Type = item.find('select[name="selectType"]').val();
ApiClient.updateItem(currentItem).done(function () {
reload(page);
});
break;
}
}
};
self.addPerson = function () {
var page = $.mobile.activePage;
var html = '<div data-role="popup" id="popupCreatePerson" class="popup" data-theme="a" style=" width: 270px;" >';
html += '<div class="ui-bar-b" style="text-align: center; padding: 0 20px;">';
html += '<h3>Add Person</h3>';
html += '</div>';
html += '<div style="padding:1em;">';
html += '<form>';
html += '<label for="txtPersonName">Name:</label>';
html += '<input type="text" id="txtPersonName" name="txtPersonName" required="required"/>';
html += '<label for="txtPersonRole">Role:</label>';
html += '<input type="text" id="txtPersonRole" name="txtPersonRole" />';
html += '<label for="selectPersonType">Type:</label>';
html += '<select id="selectPersonType" name="selectPersonType">';
html += generateTypes('');
html += '</select>';
html += '<p>';
html += '<button type="submit" data-theme="b" data-icon="check">OK</button>';
html += '<button type="button" data-icon="delete" onclick="$(this).parents(\'.popup\').popup(\'close\');">Cancel</button>';
html += '</p>';
html += '</form>';
html += '</div>';
html += '</div>';
$(page).append(html);
var popup = $('#popupCreatePerson').popup().trigger('create').on("popupafteropen", function () {
$('#popupCreatePerson input:first', this).focus();
}).popup("open").on("popupafterclose", function () {
$('form', this).off("submit");
$(this).off("click").off("popupafterclose").remove();
});
$('form', popup).on('submit', function () {
var form = $(this);
var name = $('#txtPersonName', form).val();
if (name != '') {
var role = $('#txtPersonRole', form).val();
var type = $('#selectPersonType', form).val();
currentItem.People.push({ Name: name, Role: role, Type: type });
ApiClient.updateItem(currentItem).done(function () {
reload(page);
});
popup.popup("close");
}
return false;
});
};
}
window.EditItemPeoplePage = new editItemPeoplePage();
$(document).on('pageinit', "#editItemPeoplePage", function () {
var page = this;
$('.libraryTree', page).on('itemclicked', function (event, data) {
if (data.itemType == "livetvservice") {
return;
}
if (data.id != currentItem.Id) {
MetadataEditor.currentItemId = data.id;
MetadataEditor.currentItemName = data.itemName;
MetadataEditor.currentItemType = data.itemType;
//Dashboard.navigate('edititemmetadata.html?id=' + data.id);
//$.mobile.urlHistory.ignoreNextHashChange = true;
window.location.hash = 'editItemPeoplePage?id=' + data.id;
reload(page);
}
});
}).on('pagebeforeshow', "#editItemPeoplePage", function () {
var page = this;
reload(page);
}).on('pagehide', "#editItemPeoplePage", function () {
var page = this;
currentItem = null;
});
})(jQuery, document, window);

View file

@ -0,0 +1,353 @@
(function ($, window, document) {
var currentItem;
function updateTabs(page, item) {
var query = MetadataEditor.getEditQueryString(item);
$('#btnEditMetadata', page).attr('href', 'edititemmetadata.html?' + query);
$('#btnEditImages', page).attr('href', 'edititemimages.html?' + query);
}
function showLocalSubtitles(page, index) {
Dashboard.showLoadingMsg();
var popup = $('.popupSubtitleViewer', page).popup('open');
$('.subtitleContent', page).html('');
var url = 'Videos/' + currentItem.Id + '/Subtitles/' + index;
$.get(ApiClient.getUrl(url)).done(function (result) {
$('.subtitleContent', page).html(result);
Dashboard.hideLoadingMsg();
popup.popup('reposition', {});
});
}
function showRemoteSubtitles(page, id) {
Dashboard.showLoadingMsg();
var popup = $('.popupSubtitleViewer', page).popup('open');
$('.subtitleContent', page).html('\nLoading...\n\n\n');
var url = 'Providers/Subtitles/Subtitles/' + id;
$.get(ApiClient.getUrl(url)).done(function (result) {
$('.subtitleContent', page).html(result);
Dashboard.hideLoadingMsg();
popup.popup('reposition', {});
});
}
function downloadRemoteSubtitles(page, id) {
var url = 'Items/' + currentItem.Id + '/RemoteSearch/Subtitles/' + id;
$.ajax({
type: "POST",
url: ApiClient.getUrl(url)
}).done(function () {
Dashboard.alert('The download has been queued.');
});
}
function deleteLocalSubtitle(page, index) {
var msg = "Are you sure you wish to delete this subtitle file?";
Dashboard.confirm(msg, "Confirm Deletion", function (result) {
if (result) {
Dashboard.showLoadingMsg();
var url = 'Videos/' + currentItem.Id + '/Subtitles/' + index;
$.ajax({
type: "DELETE",
url: ApiClient.getUrl(url)
}).done(function () {
reload(page);
});
}
});
}
function fillSubtitleList(page, item) {
var html = '<ul data-role="listview" data-split-icon="delete"><li data-role="list-divider">Current Subtitles</li>';
var streams = item.MediaStreams || [];
html += streams.filter(function (s) {
return s.Type == 'Subtitle';
}).map(function (s) {
var itemHtml = '<li><a class="btnViewSubtitles" href="#" data-index="' + s.Index + '">';
itemHtml += '<p>' + (s.Language || 'Unknown language') + '</p>';
if (s.IsDefault || s.IsForced) {
var atts = [];
if (s.IsDefault) {
atts.push('Default');
}
if (s.IsForced) {
atts.push('Forced');
}
itemHtml += '<p>' + atts.join(', ') + '</p>';
}
if (s.Path) {
itemHtml += '<p>' + (s.Path) + '</p>';
}
itemHtml += '</a>';
if (s.Path) {
itemHtml += '<a href="#" data-icon="delete" class="btnDelete" data-index="' + s.Index + '">Delete</a>';
} else {
itemHtml += '<a href="#" data-icon="delete" style="display:none;" class="btnDelete" data-index="' + s.Index + '">Delete</a>';
}
itemHtml += '</li>';
return itemHtml;
}).join('');
html += '</ul>';
var elem = $('.subtitleList', page).html(html).trigger('create');
$('.btnViewSubtitles', elem).on('click', function () {
var index = this.getAttribute('data-index');
showLocalSubtitles(page, index);
});
$('.btnDelete', elem).on('click', function () {
var index = this.getAttribute('data-index');
deleteLocalSubtitle(page, index);
});
}
function fillLanguages(page, languages) {
$('#selectLanguage', page).html(languages.map(function (l) {
return '<option value="' + l.ThreeLetterISOLanguageName + '">' + l.DisplayName + '</option>';
})).selectmenu('refresh');
Dashboard.getCurrentUser().done(function (user) {
var lang = user.Configuration.SubtitleLanguagePreference;
if (lang) {
$('#selectLanguage', page).val(lang).selectmenu('refresh');
}
});
}
function renderSearchResults(page, results) {
var lastProvider = '';
var html = '';
if (!results.length) {
$('.noSearchResults', page).show();
$('.subtitleResults', page).html('');
Dashboard.hideLoadingMsg();
return;
}
$('.noSearchResults', page).hide();
html += '<ul data-role="listview">';
for (var i = 0, length = results.length; i < length; i++) {
var result = results[i];
var provider = result.ProviderName;
if (provider != lastProvider) {
html += '<li data-role="list-divider">' + provider + '<span class="ui-li-count ui-body-inherit">Rating / Downloads</span></li>';
lastProvider = provider;
}
html += '<li><a class="btnViewSubtitle" href="#" data-subid="' + result.Id + '">';
html += '<h3 style="font-size:14px;">' + (result.Name) + '</h3>';
html += '<p>' + (result.Format) + '</p>';
if (result.Comment) {
html += '<p>' + (result.Comment) + '</p>';
}
html += '<div class="ui-li-count">' + (result.CommunityRating || 0) + ' / ' + (result.DownloadCount || 0) + '</div>';
html += '</a>';
html += '<a href="#" class="btnDownload" data-icon="plus" data-subid="' + result.Id + '">Download</a>';
html += '</li>';
}
html += '</ul>';
var elem = $('.subtitleResults', page).html(html).trigger('create');
$('.btnViewSubtitle', elem).on('click', function () {
var id = this.getAttribute('data-subid');
showRemoteSubtitles(page, id);
});
$('.btnDownload', elem).on('click', function () {
var id = this.getAttribute('data-subid');
downloadRemoteSubtitles(page, id);
});
Dashboard.hideLoadingMsg();
}
function searchForSubtitles(page, language) {
Dashboard.showLoadingMsg();
var url = ApiClient.getUrl('Items/' + currentItem.Id + '/RemoteSearch/Subtitles/' + language);
$.getJSON(url).done(function (results) {
renderSearchResults(page, results);
});
}
function reload(page) {
$('.noSearchResults', page).hide();
MetadataEditor.getItemPromise().done(function (item) {
currentItem = item;
LibraryBrowser.renderName(item, $('.itemName', page), true);
updateTabs(page, item);
fillSubtitleList(page, item);
Dashboard.hideLoadingMsg();
});
}
function onWebSocketMessageReceived(e, data) {
var msg = data;
if (msg.MessageType === "LibraryChanged") {
if (msg.Data.ItemsUpdated.indexOf(currentItem.Id) != -1) {
console.log('Item updated - reloading subtitles');
reload($.mobile.activePage);
}
}
}
$(document).on('pageinit', "#editItemSubtitlesPage", function () {
var page = this;
$('.libraryTree', page).on('itemclicked', function (event, data) {
if (data.itemType == "livetvservice") {
return;
}
if (data.id != currentItem.Id) {
MetadataEditor.currentItemId = data.id;
MetadataEditor.currentItemName = data.itemName;
MetadataEditor.currentItemType = data.itemType;
//Dashboard.navigate('edititemmetadata.html?id=' + data.id);
//$.mobile.urlHistory.ignoreNextHashChange = true;
window.location.hash = 'editItemSubtitlesPage?id=' + data.id;
reload(page);
}
});
}).on('pagebeforeshow', "#editItemSubtitlesPage", function () {
var page = this;
$('.subtitleResults', page).empty();
Dashboard.showLoadingMsg();
reload(page);
ApiClient.getCultures().done(function (languages) {
fillLanguages(page, languages);
});
$(ApiClient).on("websocketmessage", onWebSocketMessageReceived);
}).on('pagehide', "#editItemSubtitlesPage", function () {
var page = this;
currentItem = null;
$(ApiClient).off("websocketmessage", onWebSocketMessageReceived);
});
window.EditItemSubtitlesPage = {
onSearchSubmit: function () {
var form = this;
var lang = $('#selectLanguage', form).val();
searchForSubtitles($(form).parents('.page'), lang);
return false;
}
};
})(jQuery, window, document);

View file

@ -1,108 +1,5 @@
(function ($, document, apiClient) {
function fillSeriesSpotlight(elem, item, nextUp) {
var html = '<h1 class="spotlightTitle">' + item.Name + '</h1>';
var imgUrl = ApiClient.getImageUrl(item.Id, {
type: "Backdrop",
tag: item.BackdropImageTags[0]
});
html += '<div class="spotlight" style="background-image:url(\'' + imgUrl + '\');">';
imgUrl = ApiClient.getImageUrl(item.Id, {
type: "Primary",
tag: item.ImageTags.Primary,
EnableImageEnhancers: false
});
html += '<div class="spotlightContent">';
html += '<div class="spotlightPoster" style="background-image:url(\'' + imgUrl + '\');">';
html += '<div class="spotlightContentInner">';
html += '<p>' + LibraryBrowser.getMiscInfoHtml(item) + '</p>';
html += '<p>' + (item.Overview || '') + '</p>';
html += '</div>';
html += '</div>';
html += '</div>';
if (nextUp && nextUp.ImageTags && nextUp.ImageTags.Primary) {
html += '<div class="spotlightContent rightSpotlightContent">';
imgUrl = ApiClient.getImageUrl(nextUp.Id, {
type: "Primary",
tag: nextUp.ImageTags.Primary,
EnableImageEnhancers: false
});
html += '<div class="spotlightPoster" style="background-image:url(\'' + imgUrl + '\');">';
html += '<div class="spotlightContentInner">';
html += LibraryBrowser.getPosterViewDisplayName(nextUp);
html += '</div>';
html += '</div>';
html += '</div>';
}
html += '</div>';
html += '<div class="spotlightPlaceHolder"></div>';
$(elem).html(html);
}
function reloadSpotlight(page, allPromise) {
var options = {
SortBy: "Random",
SortOrder: "Descending",
Limit: 1,
Recursive: true,
IncludeItemTypes: "Series",
ImageTypes: "Backdrop,Primary",
Fields: "Overview"
};
ApiClient.getItems(Dashboard.getCurrentUserId(), options).done(function (result) {
allPromise.done(function () {
var index = 0;
$('.spotlightContainer', page).each(function () {
var elem = this;
var item = result.Items[index];
index++;
if (item && item.Type == 'Series') {
options = {
Limit: 1,
UserId: Dashboard.getCurrentUserId(),
SeriesId: item.Id
};
ApiClient.getNextUpEpisodes(options).done(function (nextUpResult) {
fillSeriesSpotlight(elem, item, nextUpResult.Items[0]);
});
} else {
$(this).hide();
}
});
});
});
}
$(document).on('pagebeforeshow', "#indexPage", function () {
var screenWidth = $(window).width();
@ -125,7 +22,7 @@
showTitle: true,
centerText: true
})).createPosterItemMenus();
}));
});

View file

@ -1165,7 +1165,7 @@
}
if (version.Path) {
html += '<div><span class="mediaInfoLabel">Path</span><span class="mediaInfoAttribute">' + version.Path + '</span></div>';
html += '<div style="max-width:600px;overflow:hidden;"><span class="mediaInfoLabel">Path</span><span class="mediaInfoAttribute">' + version.Path + '</span></div>';
}
if (version.Container) {

View file

@ -479,9 +479,18 @@
if (primaryImageAspectRatio && Math.abs(primaryImageAspectRatio - 1.777777778) < .3) {
options.shape = 'backdrop';
}
else if (primaryImageAspectRatio && Math.abs(primaryImageAspectRatio - 1) < .3) {
else if (primaryImageAspectRatio && Math.abs(primaryImageAspectRatio - 1) < .33) {
options.coverImage = true;
options.shape = 'square';
}
else if (primaryImageAspectRatio && Math.abs(primaryImageAspectRatio - 1.3333334) < .01) {
options.coverImage = true;
options.shape = 'square';
}
else if (primaryImageAspectRatio && primaryImageAspectRatio > 1.9) {
options.shape = 'banner';
options.coverImage = true;
}
else {
options.shape = 'portrait';
}

View file

@ -78,6 +78,14 @@
function showLibraryMenu() {
var panel = getLibraryMenu();
updateLibraryNavLinks($.mobile.activePage);
$(panel).panel('toggle');
}
function updateLibraryMenu(panel) {
var userId = Dashboard.getCurrentUserId();
ApiClient.getItems(userId, {
@ -99,14 +107,6 @@
$('.libraryMenuOptions').html(html);
});
var page = $.mobile.activePage;
var panel = getLibraryMenu();
updateLibraryNavLinks(page);
$(panel).panel('toggle');
ApiClient.getLiveTvInfo().done(function (liveTvInfo) {
var showLiveTv = liveTvInfo.EnabledUsers.indexOf(userId) != -1;
@ -163,6 +163,8 @@
$(document.body).append(html);
panel = $('#libraryPanel').panel({}).trigger('create');
updateLibraryMenu();
}
return panel;
@ -290,6 +292,7 @@
$(document).scrollTop(0);
}
});
$(function () {

View file

@ -18,7 +18,7 @@
return '<option value="' + s.Name + '">' + s.Name + '</option>';
});
$('#selectActiveService', page).html(serviceOptions).selectmenu('refresh');
$('#selectActiveService', page).html(serviceOptions).val(config.LiveTvOptions.ActiveService || '').selectmenu('refresh');
Dashboard.hideLoadingMsg();
}
@ -53,6 +53,7 @@
config.LiveTvOptions.GuideDays = $('#selectGuideDays', form).val() || null;
config.LiveTvOptions.ActiveService = $('#selectActiveService', form).val() || null;
ApiClient.updateServerConfiguration(config).done(Dashboard.processServerConfigurationUpdateResult);
});

View file

@ -1330,6 +1330,8 @@ $(ApiClient).on("websocketopen", Dashboard.onWebSocketOpened).on("websocketmessa
$(function () {
ApiClient.currentUserId(Dashboard.getCurrentUserId());
var videoPlayerHtml = '<div id="mediaPlayer" data-theme="b" class="ui-bar-b" style="display: none;">';
videoPlayerHtml += '<div id="videoBackdrop">';

View file

@ -11,9 +11,8 @@
ApiClient.getPluginSecurityInfo().done(function (info) {
$('#txtSupporterKey', page).val(info.SupporterKey);
$('#txtLegacyKey', page).val(info.LegacyKey);
if ((info.LegacyKey || info.SupporterKey) && !info.IsMBSupporter) {
if (info.SupporterKey && !info.IsMBSupporter) {
$('#txtSupporterKey', page).addClass("invalidEntry");
$('.notSupporter', page).show();
} else {
@ -31,11 +30,9 @@
var form = this;
var key = $('#txtSupporterKey', form).val();
var legacyKey = $('#txtLegacyKey', form).val();
var info = {
SupporterKey: key,
LegacyKey: legacyKey
SupporterKey: key
};
ApiClient.updatePluginSecurityInfo(info).done(function () {
@ -104,13 +101,13 @@
var email = $('#txtEmail', form).val();
var url = "http://mb3admin.com/admin/service/supporter/retrievekey?email="+email;
var url = "http://mb3admin.com/admin/service/supporter/retrievekey?email=" + email;
console.log(url);
$.post(url).done(function (res) {
var result = JSON.parse(res);
Dashboard.hideLoadingMsg();
if (result.Success) {
Dashboard.alert("Key emailed to "+email);
Dashboard.alert("Key emailed to " + email);
} else {
Dashboard.showError(result.ErrorMessage);
}

View file

@ -140,7 +140,13 @@
var deferred = $.Deferred();
deferred.resolveWith(null, [{
Configuration: { IsAdministrator: true }
Configuration: {
IsAdministrator: true,
EnableLiveTvManagement: true,
EnableLiveTvAccess: true,
EnableRemoteControlOfOtherUsers: true,
EnableMediaPlayback: true
}
}]);
promise1 = deferred.promise();

View file

@ -52,9 +52,9 @@
var id = 'mediaFolder' + i;
var checkedAttribute = user.Configuration.BlockedMediaFolders.indexOf(folder.Name) == -1 ? ' checked="checked"' : '';
var checkedAttribute = user.Configuration.BlockedMediaFolders.indexOf(folder.Id) == -1 && user.Configuration.BlockedMediaFolders.indexOf(folder.Name) == -1 ? ' checked="checked"' : '';
html += '<input class="chkMediaFolder" data-foldername="' + folder.Name + '" type="checkbox" data-mini="true" id="' + id + '"' + checkedAttribute + ' />';
html += '<input class="chkMediaFolder" data-foldername="' + folder.Id + '" type="checkbox" data-mini="true" id="' + id + '"' + checkedAttribute + ' />';
html += '<label for="' + id + '">' + folder.Name + '</label>';
}
@ -77,9 +77,9 @@
var id = 'channels' + i;
var checkedAttribute = user.Configuration.BlockedChannels.indexOf(folder.Name) == -1 ? ' checked="checked"' : '';
var checkedAttribute = user.Configuration.BlockedChannels.indexOf(folder.Id) == -1 ? ' checked="checked"' : '';
html += '<input class="chkChannel" data-foldername="' + folder.Name + '" type="checkbox" data-mini="true" id="' + id + '"' + checkedAttribute + ' />';
html += '<input class="chkChannel" data-foldername="' + folder.Id + '" type="checkbox" data-mini="true" id="' + id + '"' + checkedAttribute + ' />';
html += '<label for="' + id + '">' + folder.Name + '</label>';
}

View file

@ -33,15 +33,6 @@
</p>
</div>
</div>
<div style="margin: 2em 0;">
<label for="txtLegacyKey">MB2 Supporter Key</label>
<input type="password" id="txtLegacyKey" name="txtLegacyKey" />
<div class="fieldDescription">
Some premium plugins may give credit for registrations with previous versions in MB2.
</div>
</div>
<p>
<button type="submit" id="mbLegacyKeyBtn" data-theme="b" data-icon="check">Save</button>

View file

@ -155,11 +155,14 @@ MediaBrowser.ApiClient = function ($, navigator, JSON, WebSocket, setTimeout, wi
};
webSocket.onopen = function () {
console.log('web socket connection opened');
setTimeout(function () {
self.sendWebSocketMessage("Identity", clientName + "|" + deviceId + "|" + applicationVersion + "|" + deviceName);
$(self).trigger("websocketopen");
}, 500);
};
webSocket.onerror = function () {