首頁|建站|設計|QQ|百科|范文|電商|學習
Discuz! X3.2,完美去掉帖子圖片彈出“下載附件”并保留“設為封面”提示的方法!

站長教程網   時間:2016-11-05   來源:建站知識

適用版本: Discuz! X3
語言編碼: GBK簡體 UTF8簡體 BIG5繁體 UTF8繁體
訪問帖子取消鼠標移到圖片上時彈出“下載附件”并保留“設為封面”的提示修改前如下圖:

 用編輯器打開template/default/forum/discuzcode.htm文件
修改第258行,源碼如下:

 

 <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} />

 修改為:

 <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行,源碼如下:

 <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} />

修改為:

 <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行,源碼如下:

 <a href="forum.php?mod=attachment{$is_archive}&aid=$aidencode¬humb=yes" target="_blank">{lang download}</a>

修改后,如果后臺->版塊->編輯->擴展設置,沒有開啟圖片列表模式,則鼠標移動到圖片上時不會有任何提示。
如下圖:

如果開啟了圖片列表模式,則鼠標移動到圖片上時會顯示“設為封面”。
如下圖:

如果任何時候鼠標移動到圖片上時都不想有提示,只需刪除258和260行中的

 onmouseover="showMenu({'ctrlid':this.id,'pos':'12'})"

即可 

31809铁算盘心水论坛