前台展示增加收缩功能,防止页面过长

This commit is contained in:
2012-10-18 15:33:47 +08:00
parent 384d67a4b0
commit 1624ca1a7d
2 changed files with 12 additions and 3 deletions

View File

@@ -1,7 +1,7 @@
<?php <?php
/* /*
Plugin Name: 日志归档 Plugin Name: 日志归档
Version: 1.5 Version: 1.5.1
Plugin URL: http://xiaosong.org/share/emlog-log-archiving-plug-in-released Plugin URL: http://xiaosong.org/share/emlog-log-archiving-plug-in-released
Description: 将所有日志按照日期或分类归档显示 Description: 将所有日志按照日期或分类归档显示
ForEmlog:5.0.0 ForEmlog:5.0.0
@@ -16,7 +16,7 @@ function displayRecord(){
$record_cache = $CACHE->readCache('record'); $record_cache = $CACHE->readCache('record');
$output = ''; $output = '';
foreach($record_cache as $value){ foreach($record_cache as $value){
$output .= '<li>'.$value['record'].'('.$value['lognum'].')'.displayRecordItem($value['date']).'</li>'; $output .= '<li><h4>'.$value['record'].'('.$value['lognum'].')</h4>'.displayRecordItem($value['date']).'</li>';
} }
$output = '<ul class="archiver">'.$output.'</ul>'; $output = '<ul class="archiver">'.$output.'</ul>';
return $output; return $output;
@@ -39,7 +39,7 @@ function displaySort(){
$sort_cache = $CACHE->readCache('sort'); $sort_cache = $CACHE->readCache('sort');
$output = ''; $output = '';
foreach($sort_cache as $value){ foreach($sort_cache as $value){
$output .= '<li>'.$value['sortname'].'('.$value['lognum'].')'.displaySortItem($value['sid']).'</li>'; $output .= '<li><h4>'.$value['sortname'].'('.$value['lognum'].')</h4>'.displaySortItem($value['sid']).'</li>';
} }
$output = '<ul class="archiver">'.$output.'</ul>'; $output = '<ul class="archiver">'.$output.'</ul>';
return $output; return $output;

View File

@@ -16,6 +16,7 @@ $ckname = $ckmail = $ckurl = $verifyCode = false;
$icp = Option::get('icp'); $icp = Option::get('icp');
$footer_info = Option::get('footer_info'); $footer_info = Option::get('footer_info');
if($res['hide'] == 'y' || !function_exists('displaySort') || !function_exists('displayRecord')) emMsg('不存在的页面!'); if($res['hide'] == 'y' || !function_exists('displaySort') || !function_exists('displayRecord')) emMsg('不存在的页面!');
emLoadJQuery();
include View::getView('header'); include View::getView('header');
$log_content = '<h3><input type="radio" name="show_type" onclick="switchtype(this.value)" value="record" '; $log_content = '<h3><input type="radio" name="show_type" onclick="switchtype(this.value)" value="record" ';
@@ -39,6 +40,14 @@ ol.archiver_item li {margin-left:1em;}
function switchtype(type){ function switchtype(type){
window.location = '<?php echo BLOG_URL; ?>?plugin=archiver&show_type=' + type; window.location = '<?php echo BLOG_URL; ?>?plugin=archiver&show_type=' + type;
} }
jQuery(function($){
if ($('ul.archiver').length) {
$('ul.archiver').find('.archiver_item:gt(3)').hide();
$('ul.archiver').find('h4').on('click', function(){
$(this).next('.archiver_item').slideToggle();
})
}
})
</script> </script>
<?php <?php
include View::getView('page'); include View::getView('page');