Merge pull request #3 from typecho/master

update
This commit is contained in:
ShingChi 2014-03-21 12:15:58 +08:00
commit 6c8e81edfa
4 changed files with 33 additions and 59 deletions

View File

@ -160,7 +160,7 @@ $(document).ready(function () {
src = src.substring(0, src.length - 1);
}
return '<div style="background: #ddd; height: 40px; line-height: 40px; text-align: center; font-size: 12px; color: #777">'
return '<div style="background: #ddd; height: 40px; overflow: hidden; line-height: 40px; text-align: center; font-size: 12px; color: #777">'
+ tag + ' : ' + $.trim(src) + '</div>';
});

View File

@ -141,12 +141,18 @@
if (checked) {
$(s.rowEl, table).each(function () {
$(s.checkEl, this).prop('checked', true);
}).addClass('checked');
var t = $(this), el = $(s.checkEl, this).prop('checked', true);
if (el.length > 0) {
t.addClass('checked');
}
});
} else {
$(s.rowEl, table).each(function () {
$(s.checkEl, this).prop('checked', false);
}).removeClass('checked');
var t = $(this), el = $(s.checkEl, this).prop('checked', false);
if (el.length > 0) {
t.removeClass('checked');
}
});
}
});

View File

@ -149,26 +149,9 @@ class Widget_Abstract_Contents extends Widget_Abstract
protected function ___summary()
{
$content = $this->content;
$parts = preg_split("/<\/\s*(?:p|blockquote|q|pre|table)\s*>/i", $content, 2);
$parts = preg_split("/(<\/\s*(?:p|blockquote|q|pre|table)\s*>)/i", $content, 2, PREG_SPLIT_DELIM_CAPTURE);
if (!empty($parts)) {
preg_match("/<\s*(?:p|blockquote|q|pre|table)\s*>/i", $parts[0], $tags);
switch ($tags[0]) {
case '<pre>':
$content = $parts[0] . '</pre>';
break;
case '<blockquote>':
$content = $parts[0] . '</blockquote>';
break;
case '<q>':
$content = $parts[0] . '</q>';
break;
case '<table>':
$content = $parts[0] . '</table>';
break;
default:
$content = $parts[0] . '</p>';
break;
}
$content = $parts[0] . $parts[1];
}
return $content;
@ -940,3 +923,4 @@ class Widget_Abstract_Contents extends Widget_Abstract
echo $this->author->{$item};
}
}

View File

@ -1504,32 +1504,24 @@ class Widget_Archive extends Widget_Abstract_Contents
* 显示下一个内容的标题链接
*
* @access public
* @param string $wrod 链接文字
* @param string $class 类选择器
* @param string $format 格式
* @param string $default 如果没有下一篇,显示的默认文字
* @return void
*/
public function theNext($word = NULL, $class = NULL, $default = NULL)
public function theNext($format = '%s', $default = NULL)
{
$content = $this->db->fetchRow($this->select()->where('table.contents.created > ? AND table.contents.created < ?',
$this->created, $this->options->gmtTime)
->where('table.contents.status = ?', 'publish')
->where('table.contents.type = ?', $this->type)
->where('table.contents.password IS NULL')
->order('table.contents.created', Typecho_Db::SORT_ASC)
->limit(1));
$this->created, $this->options->gmtTime)
->where('table.contents.status = ?', 'publish')
->where('table.contents.type = ?', $this->type)
->where('table.contents.password IS NULL')
->order('table.contents.created', Typecho_Db::SORT_ASC)
->limit(1));
if ($content) {
$content = $this->filter($content);
if ($word != NULL) {
$class = $class ? ' class="' . $class . '"' : '';
$link = '<a' . $class . ' href="' . $content['permalink'] . '" title="' . $content['title'] . '">' . $word . '</a>';
echo $link;
} else {
$link = '<a href="' . $content['permalink'] . '" title="' . $content['title'] . '">' . $content['title'] . '</a>';
printf('%s', $link);
}
$link = '<a href="' . $content['permalink'] . '" title="' . $content['title'] . '">' . $content['title'] . '</a>';
printf($format, $link);
} else {
echo $default;
}
@ -1539,31 +1531,23 @@ class Widget_Archive extends Widget_Abstract_Contents
* 显示上一个内容的标题链接
*
* @access public
* @param string $wrod 链接文字
* @param string $class 类选择器
* @param string $format 格式
* @param string $default 如果没有上一篇,显示的默认文字
* @return void
*/
public function thePrev($word = NULL, $class = NULL, $default = NULL)
public function thePrev($format = '%s', $default = NULL)
{
$content = $this->db->fetchRow($this->select()->where('table.contents.created < ?', $this->created)
->where('table.contents.status = ?', 'publish')
->where('table.contents.type = ?', $this->type)
->where('table.contents.password IS NULL')
->order('table.contents.created', Typecho_Db::SORT_DESC)
->limit(1));
->where('table.contents.status = ?', 'publish')
->where('table.contents.type = ?', $this->type)
->where('table.contents.password IS NULL')
->order('table.contents.created', Typecho_Db::SORT_DESC)
->limit(1));
if ($content) {
$content = $this->filter($content);
if ($word != NULL) {
$class = $class ? ' class="' . $class . '"' : '';
$link = '<a' . $class . ' href="' . $content['permalink'] . '" title="' . $content['title'] . '">' . $word . '</a>';
echo $link;
} else {
$link = '<a href="' . $content['permalink'] . '" title="' . $content['title'] . '">' . $content['title'] . '</a>';
printf('%s', $link);
}
$link = '<a href="' . $content['permalink'] . '" title="' . $content['title'] . '">' . $content['title'] . '</a>';
printf($format, $link);
} else {
echo $default;
}