紀錄一下有玩社群的最佳化過程
5,113 0
早上改了一下有玩社群的標題字數限制,還專門寫了篇文章來做筆記,現在想了想,以後要改的東西還有很多,如果每改一次就寫一篇,很明顯效率不高,也不方便以後查閱。
所以決定用這篇文章來持續記錄改過的檔案,也方便給有需要的人進行參考。下面所有的修改都是基於 Discuz 3.4 版本,如果是以前的版本,可能程式碼位置不一樣,只能以本文作為參考。
因為僅僅是做個記錄,所以不會寫得很詳細,如果小夥伴看不懂的,歡迎下方留言,我會認真回覆你的。
4、線上使用者頁面樣式微調

檔案路徑 /template/default/home/space_friend.htm
205 行
HTML HTML
<div class="xg1">
改成
HTML HTML
<div class="xg1" style="white-space: nowrap;">
2019.07.31
3、取消圖片彈出下載附件
檔案路徑 /template/default/forum/discuzcode.htm
258 行
HTML HTML
<img{if $attach['price'] && $_G['forum_attachmentdown'] && $_G['uid'] != $attach['uid']} class="attprice"{/if} style="cursor:pointer" id="aimg_$attach[aid]" aid="$attach[aid]" src="{STATICURL}image/common/none.gif" onclick="zoom(this, this.getAttribute('zoomfile'), 0, 0, '{$_G[setting][showexif]}')" zoomfile="{if $attach[refcheck]}forum.php?mod=attachment{$is_archive}&aid=$aidencode&noupdate=yes¬humb=yes{else}{$attach[url]}$attach[attachment]{/if}" file="{if $attach[refcheck]}forum.php?mod=attachment{$is_archive}&aid=$aidencode{else}{$attach[url]}$attachthumb{/if}" inpost="1"{if $_GET['from'] != 'preview'} onmouseover="showMenu({'ctrlid':this.id,'pos':'12'})"{/if} />
改成
HTML HTML
<img{if $attach['price'] && $_G['forum_attachmentdown'] && $_G['uid'] != $attach['uid']} class="attprice"{/if} style="cursor:pointer" id="aimg_$attach[aid]" aid="$attach[aid]" src="{STATICURL}image/common/none.gif" onclick="zoom(this, this.getAttribute('zoomfile'), 0, 0, '{$_G[setting][showexif]}')" zoomfile="{if $attach[refcheck]}forum.php?mod=attachment{$is_archive}&aid=$aidencode&noupdate=yes¬humb=yes{else}{$attach[url]}$attach[attachment]{/if}" file="{if $attach[refcheck]}forum.php?mod=attachment{$is_archive}&aid=$aidencode{else}{$attach[url]}$attachthumb{/if}" inpost="1"{if $_GET['from'] != 'preview'} {if $firstpost && $_G['fid'] && $_G['forum']['picstyle'] && ($_G['forum']['ismoderator'] || $_G['uid'] == $attach['uid'])}onmouseover="showMenu({'ctrlid':this.id,'pos':'12'})"{/if}{/if} />
260 行
HTML HTML
<img{if $attach['price'] && $_G['forum_attachmentdown'] && $_G['uid'] != $attach['uid']} class="attprice"{/if} id="aimg_$attach[aid]" aid="$attach[aid]" src="{STATICURL}image/common/none.gif" zoomfile="{if $attach[refcheck]}forum.php?mod=attachment{$is_archive}&aid=$aidencode&noupdate=yes¬humb=yes{else}{$attach[url]}$attach[attachment]{/if}" file="{if $attach[refcheck]}forum.php?mod=attachment{$is_archive}&aid=$aidencode&noupdate=yes{else}{$attach[url]}$attach[attachment]{/if}" $widthcode id="aimg_$attach[aid]" inpost="1"{if $_GET['from'] != 'preview'} onmouseover="showMenu({'ctrlid':this.id,'pos':'12'})"{/if} />
改成
HTML HTML
<img{if $attach['price'] && $_G['forum_attachmentdown'] && $_G['uid'] != $attach['uid']} class="attprice"{/if} id="aimg_$attach[aid]" aid="$attach[aid]" src="{STATICURL}image/common/none.gif" zoomfile="{if $attach[refcheck]}forum.php?mod=attachment{$is_archive}&aid=$aidencode&noupdate=yes¬humb=yes{else}{$attach[url]}$attach[attachment]{/if}" file="{if $attach[refcheck]}forum.php?mod=attachment{$is_archive}&aid=$aidencode&noupdate=yes{else}{$attach[url]}$attach[attachment]{/if}" $widthcode id="aimg_$attach[aid]" inpost="1"{if $_GET['from'] != 'preview'} {if $firstpost && $_G['fid'] && $_G['forum']['picstyle'] && ($_G['forum']['ismoderator'] || $_G['uid'] == $attach['uid'])}onmouseover="showMenu({'ctrlid':this.id,'pos':'12'})"{/if}{/if} />
註解掉 267 行
HTML HTML
<!-- <a href="forum.php?mod=attachment{$is_archive}&aid=$aidencode¬humb=yes" target="_blank">{lang download}</a> -->
2019.07.31
2、限制發帖標題字數
檔案路徑 /static/js/forum_post.js
JavaScript JavaScript
if(($('postsubmit').name != 'replysubmit' && !($('postsubmit').name == 'editsubmit' && !isfirstpost) && theform.subject.value == "") || !sortid && !special && trim(message) == "") {
showError('抱歉,您尚未輸入標題或內容');
return false;
} else if(mb_strlen(theform.subject.value) > 80) {
showError('您的標題超過 80 個字元的限制');
return false;
}
下面插入
JavaScript JavaScript
else if(mb_strlen(theform.subject.value) < 20 && mb_strlen(theform.subject.value) > 0) {
showError('您的標題不足 20 個字元的限制');
return false;
}
2019.07.30
1、移除標題 Powered by Discuz!
檔案路徑 /template/default/common/header_common.htm
HTML HTML
<title><!--{if !empty($navtitle)}-->$navtitle - <!--{/if}--><!--{if empty($nobbname)}--> $_G['setting']['bbname'] - <!--{/if}--> Powered by Discuz!</title>
改為
HTML HTML
<title><!--{if !empty($navtitle)}-->$navtitle - <!--{/if}--><!--{if empty($nobbname)}--> $_G['setting']['bbname']<!--{/if}--></title>
2019.07.16
評論
(0)暫無評論,來說兩句吧