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

add new fields from omdb

This commit is contained in:
Luke Pulverenti 2014-01-15 00:01:58 -05:00
parent e8dd5c816f
commit 8c99e99477
17 changed files with 314 additions and 47 deletions

View file

@ -501,7 +501,7 @@
html += '<p><strong>A new version of ' + update.name + ' is available!</strong></p>';
html += '<button type="button" data-icon="download" data-theme="b" onclick="DashboardPage.installPluginUpdate(this);" data-name="' + update.name + '" data-guid="' + update.guid + '" data-version="' + update.versionStr + '" data-classification="' + update.classification + '">Update Now</button>';
html += '<button type="button" data-icon="arrow-d" data-theme="b" onclick="DashboardPage.installPluginUpdate(this);" data-name="' + update.name + '" data-guid="' + update.guid + '" data-version="' + update.versionStr + '" data-classification="' + update.classification + '">Update Now</button>';
}
elem.html(html).trigger('create');

View file

@ -585,6 +585,18 @@
$('#fldRottenTomatoes', page).hide();
}
if (item.Type == "Movie") {
$('#fldAwardSummary', page).show();
} else {
$('#fldAwardSummary', page).hide();
}
if (item.Type == "Movie" || item.Type == "Trailer") {
$('#fldMetascore', page).show();
} else {
$('#fldMetascore', page).hide();
}
if (item.Type == "Movie" || item.Type == "Trailer" || item.Type == "Person" || item.Type == "BoxSet" || item.Type == "MusicAlbum") {
$('#fldTmdb', page).show();
} else {
@ -859,6 +871,9 @@
$('#txtCommunityVoteCount', page).val(item.VoteCount || "");
$('#txtHomePageUrl', page).val(item.HomePageUrl || "");
$('#txtAwardSummary', page).val(item.AwardSummary || "");
$('#txtMetascore', page).val(item.Metascore || "");
$('#txtBudget', page).val(item.Budget || "");
$('#txtRevenue', page).val(item.Revenue || "");
@ -1153,6 +1168,8 @@
Album: $('#txtAlbum', form).val(),
AlbumArtist: $('#txtAlbumArtist', form).val(),
Artists: $('#txtArtist', form).val().split(';'),
Metascore: $('#txtMetascore', form).val(),
AwardSummary: $('#txtAwardSummary', form).val(),
Overview: $('#txtOverview', form).val(),
Status: $('#selectStatus', form).val(),
AirDays: editableListViewValues($("#listAirDays", form)),

View file

@ -44,7 +44,7 @@
html += LibraryBrowser.getPagingHtml(query, result.TotalRecordCount);
$('#items', page).html(html).trigger('create');
$('#items', page).html(html).trigger('create').createPosterItemHoverMenu();
$('.selectPage', page).on('change', function () {
query.StartIndex = (parseInt(this.value) - 1) * query.Limit;

View file

@ -407,4 +407,57 @@ function ticks_to_human(str) {
time += ":" + seconds.substr(-2);
return time;
};
};
/******************************************************************************/
/*********************************** EASING ***********************************/
/******************************************************************************/
(function () {
// based on easing equations from Robert Penner (http://www.robertpenner.com/easing)
var baseEasings = {};
$.each(["Quad", "Cubic", "Quart", "Quint", "Expo"], function (i, name) {
baseEasings[name] = function (p) {
return Math.pow(p, i + 2);
};
});
$.extend(baseEasings, {
Sine: function (p) {
return 1 - Math.cos(p * Math.PI / 2);
},
Circ: function (p) {
return 1 - Math.sqrt(1 - p * p);
},
Elastic: function (p) {
return p === 0 || p === 1 ? p :
-Math.pow(2, 8 * (p - 1)) * Math.sin(((p - 1) * 80 - 7.5) * Math.PI / 15);
},
Back: function (p) {
return p * p * (3 * p - 2);
},
Bounce: function (p) {
var pow2,
bounce = 4;
while (p < ((pow2 = Math.pow(2, --bounce)) - 1) / 11) { }
return 1 / Math.pow(4, 3 - bounce) - 7.5625 * Math.pow((pow2 * 3 - 2) / 22 - p, 2);
}
});
$.each(baseEasings, function (name, easeIn) {
$.easing["easeIn" + name] = easeIn;
$.easing["easeOut" + name] = function (p) {
return 1 - easeIn(1 - p);
};
$.easing["easeInOut" + name] = function (p) {
return p < 0.5 ?
easeIn(p * 2) / 2 :
1 - easeIn(p * -2 + 2) / 2;
};
});
})();

View file

@ -41,7 +41,7 @@
html += LibraryBrowser.getPagingHtml(query, result.TotalRecordCount);
$('#items', page).html(html).trigger('create');
$('#items', page).html(html).trigger('create').createPosterItemHoverMenu();
$('.selectPage', page).on('change', function () {
query.StartIndex = (parseInt(this.value) - 1) * query.Limit;

View file

@ -436,7 +436,8 @@
shape: "portrait",
context: 'movies',
useAverageAspectRatio: true,
showTitle: true
showTitle: true,
centerText: true
});
}
@ -485,7 +486,7 @@
html += LibraryBrowser.getPagingHtml(query, result.TotalRecordCount);
$('#items', page).html(html).trigger('create');
$('#items', page).html(html).trigger('create').createPosterItemHoverMenu();
$('.selectPage', page).on('change', function () {

View file

@ -470,6 +470,7 @@
useAverageAspectRatio: item.MediaType != "Game",
shape: item.Type == "MusicAlbum" ? "square" : "portrait",
showParentTitle: item.Type == "MusicAlbum",
centerText: item.Type != "MusicAlbum",
showTitle: item.Type == "MusicAlbum" || item.Type == "Game",
borderless: item.Type == "Game"
});
@ -588,7 +589,8 @@
items: result.Items,
shape: "portrait",
useAverageAspectRatio: true,
showTitle: true
showTitle: true,
centerText: true
});
}
else if (item.Type == "Season") {
@ -606,7 +608,8 @@
shape: "auto",
context: 'games',
useAverageAspectRatio: false,
showTitle: true
showTitle: true,
centerText: true
});
}
else {
@ -619,7 +622,7 @@
});
}
$('#childrenContent', page).html(html);
$('#childrenContent', page).html(html).createPosterItemHoverMenu();
}
});

View file

@ -916,12 +916,12 @@
imageCssClass += " coveredPosterItemImage";
}
html += '<div class="posterItemOverlayTarget"></div>';
var progressHtml = LibraryBrowser.getItemProgressBarHtml(item);
html += '<div class="' + imageCssClass + '" style="' + style + '">';
html += '<div class="posterItemOverlayTarget"></div>';
if (item.LocationType == "Offline" || item.LocationType == "Virtual") {
if (options.showLocationTypeIndicator !== false) {
html += LibraryBrowser.getOfflineIndicatorHtml(item);
@ -1503,19 +1503,25 @@
var html = "";
if (item.CommunityRating) {
var rating = item.CommunityRating / 2;
for (var i = 1; i <= 5; i++) {
if (rating <= i - 1) {
html += "<div class='starRating emptyStarRating' title='" + item.CommunityRating + "'></div>";
}
else if (rating < i) {
html += "<div class='starRating halfStarRating' title='" + item.CommunityRating + "'></div>";
}
else {
html += "<div class='starRating' title='" + item.CommunityRating + "'></div>";
}
}
html += "<div class='starRating' title='" + item.CommunityRating + "'></div>";
html += '<div class="starRatingValue">';
html += item.CommunityRating.toFixed(1);
html += '</div>';
//var rating = item.CommunityRating / 2;
//for (var i = 1; i <= 5; i++) {
// if (rating <= i - 1) {
// html += "<div class='starRating emptyStarRating' title='" + item.CommunityRating + "'></div>";
// }
// else if (rating < i) {
// html += "<div class='starRating halfStarRating' title='" + item.CommunityRating + "'></div>";
// }
// else {
// html += "<div class='starRating' title='" + item.CommunityRating + "'></div>";
// }
//}
}
if (item.CriticRating != null) {
@ -1529,6 +1535,18 @@
html += '<div class="criticRating">' + item.CriticRating + '%</div>';
}
if (item.Metascore) {
if (item.Metascore >= 60) {
html += '<div class="metascore metascorehigh" title="Metascore">' + item.Metascore + '</div>';
}
else if (item.Metascore >= 40) {
html += '<div class="metascore metascoremid" title="Metascore">' + item.Metascore + '</div>';
} else {
html += '<div class="metascore metascorelow" title="Metascore">' + item.Metascore + '</div>';
}
}
return html;
},
@ -1536,10 +1554,10 @@
if (item.Type == "Recording" && item.CompletionPercentage) {
return '<progress class="itemProgressBar recordingProgressBar" min="0" max="100" value="' + item.CompletionPercentage + '"></progress>';
}
if (item.UserData && item.UserData.PlaybackPositionTicks && item.RunTimeTicks) {
var tooltip = Dashboard.getDisplayTime(item.UserData.PlaybackPositionTicks) + " / " + Dashboard.getDisplayTime(item.RunTimeTicks);
@ -2503,7 +2521,7 @@
var popup = $('.itemFlyout').on('mouseenter', onOverlayMouseOver).on('mouseleave', onOverlayMouseOut).popup({
positionTo: $('.posterItemOverlayTarget', elem)
}).trigger('create').popup("open").on("popupafterclose", function () {
$(this).off("popupafterclose").off("mouseenter").off("mouseleave").remove();
@ -2594,11 +2612,11 @@
onShowTimerExpired(elem);
}, 500);
}, 300);
}
// https://hacks.mozilla.org/2013/04/detecting-touch-its-the-why-not-the-how/
if (('ontouchstart' in window) || (navigator.maxTouchPoints > 0) || (navigator.msMaxTouchPoints > 0)) {
/* browser with either Touch Events of Pointer Events
running on touch-capable device */
@ -2612,3 +2630,120 @@
})(jQuery, document, window);
(function ($, document, window) {
var showOverlayTimeout;
function onHoverOut() {
if (showOverlayTimeout) {
clearTimeout(showOverlayTimeout);
showOverlayTimeout = null;
}
$('.posterItemOverlayTarget:visible', this).each(function () {
var elem = this;
$(this).animate({ "height": "0" }, function () {
$(elem).hide();
});
});
$('.posterItemOverlayTarget:visible', this).stop().animate({ "height": "0" }, function () {
$(this).hide();
});
}
function getOverlayHtml(item) {
var html = '';
html += '<div class="posterItemOverlayInner">';
html += '<div style="font-weight:bold;margin-bottom:1.5em;">';
html += LibraryBrowser.getPosterViewDisplayName(item, true);
html += '</div>';
//html += '<p class="itemMiscInfo">';
//html += LibraryBrowser.getMiscInfoHtml(item);
//html += '</p>';
//html += '<p>';
//html += '<span class="itemCommunityRating">';
//html += LibraryBrowser.getRatingHtml(item);
//html += '</span>';
//html += '</p>';
html += '<p>';
html += '<span class="userDataIcons">';
html += LibraryBrowser.getUserDataIconsHtml(item);
html += '</span>';
html += '</p>';
//html += '<p class="itemOverlayHtml">';
//html += (item.OverviewHtml || item.Overview || '');
//html += '</p>';
html += '<button type="button" data-mini="true" data-inline="true" data-icon="play" data-iconpos="notext">Play</button>';
html += '<button type="button" data-mini="true" data-inline="true" data-icon="video" data-iconpos="notext">Play</button>';
html += '<button type="button" data-mini="true" data-inline="true" data-icon="remote" data-iconpos="notext">Play</button>';
html += '<button type="button" data-mini="true" data-inline="true" data-icon="edit" data-iconpos="notext">Play</button>';
html += '</div>';
return html;
}
$.fn.createPosterItemHoverMenu = function () {
function onShowTimerExpired(elem) {
var innerElem = $('.posterItemOverlayTarget', elem);
var id = elem.getAttribute('data-itemid');
ApiClient.getItem(Dashboard.getCurrentUserId(), id).done(function (item) {
innerElem.html(getOverlayHtml(item)).trigger('create');
});
innerElem.show().each(function () {
this.style.height = 0;
}).animate({ "height": "100%" });
}
function onHoverIn() {
if (showOverlayTimeout) {
clearTimeout(showOverlayTimeout);
showOverlayTimeout = null;
}
var elem = this;
showOverlayTimeout = setTimeout(function () {
onShowTimerExpired(elem);
}, 300);
}
// https://hacks.mozilla.org/2013/04/detecting-touch-its-the-why-not-the-how/
if (('ontouchstart' in window) || (navigator.maxTouchPoints > 0) || (navigator.msMaxTouchPoints > 0)) {
/* browser with either Touch Events of Pointer Events
running on touch-capable device */
return this;
}
return this.on('mouseenter', '.posterItem', onHoverIn).on('mouseleave', '.posterItem', onHoverOut);
};
})(jQuery, document, window);

View file

@ -40,7 +40,7 @@
html += LibraryBrowser.getPagingHtml(query, result.TotalRecordCount);
$('#items', page).html(html).trigger('create');
$('#items', page).html(html).trigger('create').createPosterItemHoverMenu();
$('.selectPage', page).on('change', function () {
query.StartIndex = (parseInt(this.value) - 1) * query.Limit;

View file

@ -66,7 +66,7 @@
html += LibraryBrowser.getPagingHtml(query, result.TotalRecordCount);
$('#items', page).html(html).trigger('create');
$('#items', page).html(html).trigger('create').createPosterItemHoverMenu();
$('.selectPage', page).on('change', function () {
query.StartIndex = (parseInt(this.value) - 1) * query.Limit;

View file

@ -40,7 +40,7 @@
html += LibraryBrowser.getPagingHtml(query, result.TotalRecordCount);
$('#items', page).html(html).trigger('create');
$('#items', page).html(html).trigger('create').createPosterItemHoverMenu();
$('.selectPage', page).on('change', function () {
query.StartIndex = (parseInt(this.value) - 1) * query.Limit;

View file

@ -70,7 +70,7 @@
html += LibraryBrowser.getPagingHtml(query, result.TotalRecordCount);
$('#items', page).html(html).trigger('create');
$('#items', page).html(html).trigger('create').createPosterItemHoverMenu();
$('.selectPage', page).on('change', function () {
query.StartIndex = (parseInt(this.value) - 1) * query.Limit;

View file

@ -58,7 +58,7 @@
showPremiereDate: true,
showPremiereDateIndex: true,
preferThumb: true
}));
})).createPosterItemHoverMenu();
});
});