From 2503a6bb1a3fe40951483df652ae0bc452463826 Mon Sep 17 00:00:00 2001 From: wangyidong Date: Wed, 7 Aug 2019 11:32:08 +0800 Subject: [PATCH] * finish task #6180. --- www/js/my.full.js | 33 +++++++++++++++++++++++++++------ www/theme/default/style.css | 14 ++++++++++++++ 2 files changed, 41 insertions(+), 6 deletions(-) diff --git a/www/js/my.full.js b/www/js/my.full.js index 3323ac1790..76914f2109 100644 --- a/www/js/my.full.js +++ b/www/js/my.full.js @@ -91,17 +91,38 @@ function setFormAction(actionLink, hiddenwin, obj) * @access public * @return void */ -function setImageSize(image, maxWidth) +function setImageSize(image, maxWidth, maxHeight) { + var $image = $(image); + if($image.parent().prop('tagName').toLowerCase() == 'a') return; + /* If not set maxWidth, set it auto. */ if(!maxWidth) { bodyWidth = $('body').width(); maxWidth = bodyWidth - 470; // The side bar's width is 336, and add some margins. } + if(!maxHeight) maxHeight = $(window).height(); - if($(image).width() > maxWidth) $(image).attr('width', maxWidth); - $(image).wrap(''); + setTimeout(function() + { + if($image.width() > maxWidth) $image.attr('width', maxWidth); + $image.wrap(''); + if($image.height() > maxHeight) $image.closest('a').append(""); + }, 50); +} + +/** + * Show more image when image is too height. + * + * @param obj $obj + * @access public + * @return void + */ +function showMoreImage(obj) +{ + $(obj).parents('a').css('max-height', 'none'); + $(obj).remove(); } /** @@ -734,10 +755,10 @@ function convertURL() $('.article-content, .article>.content').each(function() { - var aTags = []; + var aTags = []; var iframeTags = []; - var imgTags = []; - var content = $(this).html(); + var imgTags = []; + var content = $(this).html(); $(this).find('a').each(function(i) { aTags[i] = $(this).prop('outerHTML'); diff --git a/www/theme/default/style.css b/www/theme/default/style.css index f9ddf54bad..dbaa5e43ea 100644 --- a/www/theme/default/style.css +++ b/www/theme/default/style.css @@ -33,3 +33,17 @@ .modal-title{font-size: 14px;} .fixed-footer .text {color: #fff;} + +a.showMoreImage { +display: block; +height: 30px; +line-height: 30px; +background: #888; +position: absolute; +bottom: 0px; +width: 100%; +opacity: 0.7; +text-align: center; +color:red; +} +a.showMoreImage:hover{opacity: 1;}