s4
changeset 807:f5f3f932339b before-merging-world
Always showing article No.1
author | HIROSE Yuuji <yuuji@gentei.org> |
---|---|
date | Sun, 14 Jun 2020 19:52:08 +0900 |
parents | f84cf537b5fb |
children | a842dc106ce3 70e056d2443a |
files | s4-blog.sh |
diffstat | 1 files changed, 25 insertions(+), 7 deletions(-) [+] |
line diff
1.1 --- a/s4-blog.sh Sun Jun 14 16:37:47 2020 +0900 1.2 +++ b/s4-blog.sh Sun Jun 14 19:52:08 2020 +0900 1.3 @@ -391,22 +391,29 @@ 1.4 return 1.5 fi 1.6 echo '<table class="blog_replies"> <!-- blog:blog_showentry() main table -->' 1.7 + # If, nLimit = 50 1.8 + # show article:1, hide(2, 3), show(4, ...) 1.9 + # Therefore hide 2 or more article when narts>53 1.10 narts=`wc -l < $midfile` 1.11 - if [ -n "$nlimit" -a "$narts" -gt "$nlimit" ]; then 1.12 + if [ -n "$nlimit" -a "$narts" -gt "$((nlimit+2))" ]; then 1.13 newtop=`cat -n $midfile | grep "|new|" | head -1 | cut -f1` 1.14 if [ -n "$newtop" ]; then 1.15 afternew=$((narts-newtop+1)) 1.16 - [ $afternew -gt $nlimit ] && nlimit=$((afternew+0)) 1.17 + [ $afternew -gt $((nlimit+2)) ] && nlimit=$((afternew+0)) 1.18 err Newtop=$newtop lines=$narts afternew=$afternew nlim=$nilmit 1.19 fi 1.20 fi 1.21 - if [ $nlimit -lt $narts ]; then 1.22 - CAT="tail -n $nlimit" 1.23 + if [ $nlimit -lt $((narts-2)) ]; then 1.24 + n=0 1.25 + omitline=$td/omitline 1.26 + #CAT="tail -n $nlimit" 1.27 + CAT=cat 1.28 limitedmsg="<span class=\"warn\">※最新${nlimit}件のみの表示※</span>" 1.29 showalllink="<a title=\"Show All\" href=\"?replyblog+$rowid+n:all\">全件表示</a>" 1.30 - cat<<-EOF 1.31 - <tr><td>$limitedmsg<br>($((narts-$nlimit))件省略)</td> 1.32 - <th>$showalllink</th></tr> 1.33 + cat<<-EOF > $omitline 1.34 + <tr class="warn"> 1.35 + <th>:<br>$limitedmsg<br>($((narts-$nlimit-1))件省略)<br>:</th> 1.36 + <th>$showalllink</td></th> 1.37 EOF 1.38 else 1.39 CAT=cat 1.40 @@ -416,6 +423,17 @@ 1.41 while IFS='|' read id edit notify uid author uname icon aid \ 1.42 tm reki new hte fa imgids 1.43 do 1.44 + if [ -n "$omitline" ]; then 1.45 + n=$((n+1)) 1.46 + if [ $n -eq 1 ]; then 1.47 + : 1.48 + elif [ $n -eq 2 ]; then 1.49 + cat $omitline 1.50 + continue 1.51 + elif [ $n -lt $((narts-nlimit+1)) ]; then 1.52 + continue 1.53 + fi 1.54 + fi 1.55 mf2=$tmpd/midfile2 1.56 cachefile="$td/$id.row.html" 1.57 stampfile="$td/$id.row.stamp"