You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

100 lines
2.4 KiB

Add ability to search tvid:prodid as found in URLs and at other UI places. Update glide 3.3.0 to 3.4.0 (f7ff0dd). Change put real name first on person page. Add lang_ordered_akas to tv.py for cast English/non-English lists on UI. Change rearrange English before any non English person akas. Change enable tvinfo on Bulk Change. Fix prevent slidetime from one tab overwriting the slidetime from another when it should not. Change reinstate original db perf gains and remove memory savings as the two are mutually exclusive here. Change match sequence of params even though it it kv based, for readability. Fix cast transparent background image border - border was larger than width of trans image during the cast image loading process which resulted in a grey border line that was the width of the image container instead of wrapping the trans image. Change moved icons up 5px after seeing a full width cast image. Fix remove dupe id in html and escape showname string used for config object. Fix usage for upgraded Fancybox. Change flip api fields from ... `deleted unwanted` to `keep wanted` so that data is not mistakenly returned to the API if new data fields are added to get_daily_schedule(), the inclusion list was created by first running the old loop function that removed unwanted fields, and then copying the filtered list of keys into a sorted list for the new logic. Add imdb miniseries average runtime to view-show. Fix property initialisation. Change if cast image calculates to appear lower than header name text, instead align it to top. Change cleanup cast bio text. Change DRY CachedImages and better var names.
4 years ago
function getContainedSize(img){
var width, height, ratio;
try {
ratio = img.naturalWidth / img.naturalHeight;
width = height = img.height;
width *= ratio;
if (width > img.width) {
height = width = img.width;
height /= ratio;
}
} catch (error) {
width = height = 0;
}
return {w:width, h:height}
}
function removeImageBackground(oImage){
var image$ = $(oImage).load(function(){
// swap out placeholder
if (-1 !== $(this).css('background-image').indexOf('poster-person.jpg')){
$(this).css('background', 'transparent');
var sizeImage = getContainedSize(oImage);
if (0 < sizeImage.w){
if (sizeImage.w < oImage.width){
$(this).css('width', 'auto');
} else if (sizeImage.h < oImage.height){
var heightDiff = oImage.height - sizeImage.h,
marginBottom = Math.floor(heightDiff / 2),
roundError = Math.floor(oImage.height - sizeImage.h - (marginBottom * 2)),
marginTop = marginBottom + ((0 < roundError) ? roundError : 0);
/* if img is lower than header name text, align it to top */
if(35 < marginTop){
marginBottom += marginTop;
marginTop = 0;
}
$(this).css('height', 'auto')
.css('marginTop', marginTop)
.css('marginBottom', marginBottom);
}
}
}
});
// trigger the load handler if the image is already loaded
if (image$[0].complete){
image$.trigger('load');
}
}
function scaleImage(oImage) {
var image$ = $(oImage).load(function() {
var sizeImage = getContainedSize(oImage),
containerWidth = $(oImage).parent().width()
if (sizeImage.w > containerWidth) {
// image width is wider than its container so reduce image height to down scale
var ratio = (containerWidth - 4) / sizeImage.w,
height = Math.floor(oImage.height * ratio);
$(this).css('height', height);
}
});
// trigger the load handler if the image is already loaded
if (image$[0].complete){
image$.trigger('load');
}
}
var addQTip = (function(){
$(this).css('cursor', 'help');
$(this).qtip({
show: {solo:true},
position: {viewport:$(window), my:'right center', at: 'left center', adjust:{y: 0, x: 2}},
style: {tip: {corner:true, method:'polygon'}, classes:'qtip-dark qtip-rounded qtip-shadow'}
});
});
$(function() {
objectFitImages();
$('#person .cast-bg, #character .cast-bg').each(function(i, oImage){
removeImageBackground(oImage);
});
$('#display-show .cast-bg').each(function (i, oImage){
scaleImage(oImage);
});
$('.addQTip').each(addQTip);
});