改动快速编辑框的按钮图标时,因为用的字体图标,所以需要找到seditor.htm文件,修改代码。
结果修改下来,发现修改附件按钮,还没那么简单。
那么今天我们就来捋一捋:
通过seditor.htm文件,我们看到,其它几个按钮是直接写的,而上传附件按钮是“$seditor[3]”变量输出。
再返回viewthread_fastpost.htm文件或列表页的快速发帖文件forumdisplay_fastpost.htm,这里讲viewthread_fastpost.htm文件,看看具体怎么实现的;
- <!--{eval $seditor = array('fastpost', array('at', 'bold', 'color', 'img', 'link', 'quote', 'code', 'smilies'), !$allowfastpost ? 1 : 0, $allowpostattach && $_GET['from'] != 'preview' && $allowfastpost ? '<span class="pipe z">|</span><span id="spanButtonPlaceholder"><font color="#ff0000">'.lang('template', 'upload').'</font></span>' : '');}-->
复制代码 直接替换掉红色的代码,依然无效。
- upload_complete_handler : uploadComplete,
- button_image_url : "{IMGDIR}/uploadbutton_small.png",
- button_placeholder_id : "spanButtonPlaceholder",
复制代码 文件的第109行加入button_text试一下依旧无效。
然后排查到用到的是webuploader.js文件,打开找到:
- $('spanButtonPlaceholder').innerHTML = 'upload';
复制代码 看到这里有个输出,替换upload(文件有三处上面代码,先不管,全部替换)然后成功。
但抱着不改底层文件的精神,研究了下其他办法。
在seditor.htm,删掉变量$seditor[3],直接用onclick事件,测试成功!
- <a href="javascript:;" id="spanButtonPlaceholder" onclick="upload" title="上传"><i class="icon font-attach weight-big"></i></a>
复制代码 浏览器检查元素发现还有输出的html,只需要改动上面a标签的id,改了这里又需要改到viewthread_fastpost.htm,
- button_placeholder_id : "spanButtonPlaceholder",
复制代码 把两个id改为一样就行,如:dz-upload- <!--{eval $seditor = array('fastpost', array('at', 'bold', 'color', 'img', 'link', 'quote', 'code', 'smilies'), !$allowfastpost ? 1 : 0, $allowpostattach && $_GET['from'] != 'preview' && $allowfastpost ? '<span class="pipe z">|</span><span id="spanButtonPlaceholder">'.lang('template', 'upload').'</span>': '');}-->
复制代码 最后删掉'<span class="pipe z">|</span><span id="spanButtonPlaceholder">'.lang('template', 'upload').'</span>'代码,更新后台缓存,就成功啦!
|