From d16a7237901b1f7c8cbaa40009bbe99e364efefc Mon Sep 17 00:00:00 2001 From: wyd621 Date: Fri, 1 Nov 2013 06:14:47 +0000 Subject: [PATCH] * adjust code for setImgSize. --- module/action/model.php | 2 +- module/file/model.php | 4 ++-- www/js/my.full.js | 18 +++--------------- 3 files changed, 6 insertions(+), 18 deletions(-) diff --git a/module/action/model.php b/module/action/model.php index 3b09235dd5..c44d27c460 100755 --- a/module/action/model.php +++ b/module/action/model.php @@ -196,7 +196,7 @@ class actionModel extends model if(strtolower($action->action) == 'svncommited' and isset($commiters[$action->actor])) $action->actor = $commiters[$action->actor]; if(strtolower($action->action) == 'gitcommited' and isset($commiters[$action->actor])) $action->actor = $commiters[$action->actor]; $action->history = isset($histories[$actionID]) ? $histories[$actionID] : array(); - $action->comment = $this->file->setImgSize($action->comment, 910, 'comment'); + $action->comment = $this->file->setImgSize($action->comment, 870); $actions[$actionID] = $action; } return $actions; diff --git a/module/file/model.php b/module/file/model.php index 0738c430ad..f80d1dc97c 100644 --- a/module/file/model.php +++ b/module/file/model.php @@ -206,9 +206,9 @@ class fileModel extends model * @access public * @return string */ - public function setImgSize($content, $maxSize = 0, $type = 'content') + public function setImgSize($content, $maxSize = 0) { - return str_replace('src="data/upload', 'onload="setImageSize(this,' . $maxSize . ', \'' . $type . '\' )" src="data/upload', $content); + return str_replace('src="data/upload', 'onload="setImageSize(this,' . $maxSize . ')" src="data/upload', $content); } /** diff --git a/www/js/my.full.js b/www/js/my.full.js index f5cb3fa7be..acf53940a6 100644 --- a/www/js/my.full.js +++ b/www/js/my.full.js @@ -515,7 +515,7 @@ function setFormAction(actionLink, hiddenwin) * @access public * @return void */ -function setImageSize(image, maxWidth, type) +function setImageSize(image, maxWidth) { /* If not set maxWidth, set it auto. */ if(!maxWidth) @@ -523,20 +523,8 @@ function setImageSize(image, maxWidth, type) bodyWidth = $('body').width(); maxWidth = bodyWidth - 470; // The side bar's width is 336, and add some margins. } - if(type == 'comment') - { - $('#actionbox img').each(function() - { - if($(this).width() > maxWidth) $(this).attr('width', maxWidth); - }); - } - else - { - $('.content img').each(function() - { - if($(this).width() > maxWidth) $(this).attr('width', maxWidth); - }); - } + + if($(image).width() > maxWidth) $(image).attr('width', maxWidth); $(image).wrap(''); }