DZ原生代码交流学习,买插件不如自己动手解决
 
发新帖
楼主: 天启
查看: 3041|回复: 1

[教程] Discuz X3.4去掉帖子图片弹出“下载附件”并保留“设置封面”

[复制链接]
天启VIP6 发表于 2019-10-9 18:28:57 | 显示全部楼层
本帖最后由 天启 于 2019-11-14 16:20 编辑

用编辑器打开template/default/forum/discuzcode.htm文件
修改第258行,源码如下:
  1. <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&#172;humb=yes{else}$attach[attachment]{/if}" file="{if $attach[refcheck]}forum.php?mod=attachment{$is_archive}&aid=$aidencode{else}$attachthumb{/if}" inpost="1"{if $_GET['from'] != 'preview'} onmouseover="showMenu({'ctrlid':this.id,'pos':'12'})"{/if} />
复制代码
修改为:
  1. <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[attachment]{/if}" file="{if $attach[refcheck]}forum.php?mod=attachment{$is_archive}&aid=$aidencode{else}$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行,源码如下:
  1. <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&#172;humb=yes{else}$attach[attachment]{/if}" file="{if $attach[refcheck]}forum.php?mod=attachment{$is_archive}&aid=$aidencode&noupdate=yes{else}$attach[attachment]{/if}" $widthcode id="aimg_$attach[aid]" inpost="1"{if $_GET['from'] != 'preview'} onmouseover="showMenu({'ctrlid':this.id,'pos':'12'})"{/if} />
复制代码
修改为:
  1. <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&#172;humb=yes{else}$attach[attachment]{/if}" file="{if $attach[refcheck]}forum.php?mod=attachment{$is_archive}&aid=$aidencode&noupdate=yes{else}$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行,源码如下:
  1. <a href="forum.php?mod=attachment{$is_archive}&aid=$aidencode&#172;humb=yes" target="_blank">{lang download}</a>
复制代码
修改后,如果后台->版块->编辑->扩展设置,没有开启图片列表模式,则鼠标移动到图片上时不会有任何提示。如果开启了图片列表模式,则鼠标移动到图片上时会显示“设为封面”。

如果任何时候鼠标移动到图片上时都不想有提示,只需删除258和260行中的即可
  1. onmouseover="showMenu({'ctrlid':this.id,'pos':'12'})"
复制代码


佛泫 发表于 2019-10-11 14:25:27 | 显示全部楼层
本帖最后由 天启 于 2019-10-12 15:05 编辑

支持了呀
快速回复 返回顶部 返回列表