* adjust code for setImgSize.

This commit is contained in:
wyd621
2013-11-01 06:14:47 +00:00
parent bc207117f3
commit d16a723790
3 changed files with 6 additions and 18 deletions
+1 -1
View File
@@ -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;
+2 -2
View File
@@ -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);
}
/**
+3 -15
View File
@@ -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('<a href="' + $(image).attr('src') + '" target="_blank"></a>');
}