* adjust code for setImgSize.
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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
@@ -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>');
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user