效果图:
原插件来自 http://www.discuz.net/thread-1624289-1-1.html
原插件是 For Discuz 7.2 的, 我进行了一些修改使得它在 Discuz X1.5 下正常工作.
注: 本插件用到的 js/图片 资源请到上面的地址下载.
下面就是安装步骤了 很抱歉这个插件仍然一点都不GREEN 🙁
1, 编辑 source/function/function_discuzcode.php 找到这几行:
1 2 3 4 5 |
if($allowbbcode) { if(strpos($msglower, 'ed2k://') !== FALSE) { $message = preg_replace("/ed2k:\/\/(.+?)\//e", "parseed2k('\\1')", $message); } } |
修改为:
1 2 3 4 5 |
if($allowbbcode) { if(strpos($msglower, 'ed2k://') !== FALSE) { $message = preg_replace("/\s*\[emule\](.+?)\[\/emule\]\s*/ies", "emu('\\1')", $message); } } |
2, 在这个文件末尾 ?> 之前增加下面的函数:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
function emu($code) { $code = htmlspecialchars(str_replace('\\"', '"', preg_replace("/^[\n\r]*(.+?)[\n\r]*$/is", "\\1", $code))); $view = '';$total = 0; $searcharray = explode("\n",$code); $view = "<div class=\"emulejuse\"><center><h5>eMule专用下载链接,您必须<a href='http://emulefans.com/news/emule/xtreme/' target='_blank'>安装eMule-Xtreme-正规驴</a>才能点击下载</h5></center><table align=center id=\"emuletable\">"; foreach($searcharray as $emule) { if($emule!='' && eregi("^ed2k:\/\/",$emule)){ $emule = dhtmlspecialchars(trim($emule)); $emule_array = explode("|",$emule); $total += $emule_array[3]; $totalper = esizecount($emule_array[3]); $view.="<tr><td width=\"80%\"><input type=\"checkbox\" name=\"em$codecount\" value=\"$emule\" onclick=\"em_size('em$codecount');\" checked=\"checked\"><span class=\"smalltextjuse\"><a href=\"$emule\"><script language=\"javascript\">document.write(unescape(decodeURIComponent(\"$emule_array[2]\")));</script></a></span></td><td align=\"right\"><span class=\"smalltextjuse\">$totalper</span></td></tr>"; } else { $view.="<tr><td colspan=\"2\" class=\"smalltxt\" align=\"center\">下载地址连接错误</td></tr>"; } } $total=esizecount($total); $view.="<tr><td align=\"left\" width=\"80%\"><input type=\"checkbox\" id=\"checkall_em$codecount\" onclick=\"echeckAll('em$codecount',this.checked)\" checked=\"checked\"/> <label for=\"checkall_em$codecount\">全选</label> <input type=\"button\" value=\"下载选中的文件\" onclick=\"download('em$codecount',0,1)\"> <input type=\"button\" value=\"复制选中的链接\" onclick=\"ed2kcopy('em$codecount')\"><div id=\"ed2kcopy_em$codecount\" style=\"position:absolute;height:0px;width:0px;overflow:hidden;\"></div></td><td class=\"smalltxt\" align=\"right\" id=\"size_em$codecount\"><font color=\"red\"><b>$total</b></font></td></tr></table></div><script language=\"javascript\" type=\"text/javascript\" src=\"static/js/emulejs.js\"></script>"; return $view; } function esizecount($filesize) { if($filesize >= 1099511627776) { $filesize = round($filesize / 1099511627776 * 100) / 100 . ' TB'; } elseif($filesize >= 1073741824) { $filesize = round($filesize / 1073741824 * 100) / 100 . ' GB'; } elseif($filesize >= 1048576) { $filesize = round($filesize / 1048576 * 100) / 100 . ' MB'; } elseif($filesize >= 1024) { $filesize = round($filesize / 1024 * 100) / 100 . ' KB'; } else { $filesize = $filesize . ' Bytes'; } return $filesize; } |
3, 修改模版增加CSS定义. 默认模版的主CSS文件在: template/default/common/common.css 在模版文件尾部增加下面的行:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
/********* emule ********/ .emulejuse { color: #333; background-color: #e4eaf2; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 3px; border-top-style: dashed; border-right-style: dashed; border-bottom-style: dashed; border-left-style: solid; border-top-color: #000; border-right-color: #000; border-bottom-color: #000; border-left-color: #8394B2; font-size: 11.5px;padding: 1px; line-height: 1.4em; width: 746px; margin-top: 6px; margin-right: auto; margin-bottom: 6px; margin-left: auto; } .emulejuse h5 { font-size: 14px; font-weight: bold; color: #000; display: block; line-height: 1.6em; margin: 0px; padding-top: 3px; padding-right: 0px; padding-bottom: 3px; padding-left: 0px; } .smalltextjuse { font-size: 11.5px; line-height: 1.4em; } #emuletable { width: 100%; background-color: #EEF2F7;line-height: 1.8em; border-top: #F4F4F4 1px solid; border-left: #F4F4F4 1px solid; } #emuletable td { border-right: #F4F4F4 1px solid; border-bottom: #F4F4F4 1px solid; } |
4, 上传emulejs.js到 static/js/ , 上传bb_emule.gif到static/image/common/
5, 进入后台添加编辑器按钮:
后台–>界面–>编辑器设置–>Discuz! 代码
新增标签:emule
图标文件:bb_emule.gif
例 子:[emule][/emule]
解 释:电驴下载
参数个数:1
参数提示语:
请输入eMule[电骡]的链接地址:
嵌套次数:1
至此, 大功告成 🙂
post not working in firefox
it works properly here under a firefox 4.0b9,
maybe u should consider upgrading your firefox 🙂
Discuz!这个平台还是不错的
路过……
罚款!
罚……罚款…?
你! 涉嫌非法路过! 扣鞋, 罚款一万美刀…
不玩论坛,纯顶纯抢板凳沙发!
杀你个发!!!
OM这明显是不知道用神马词来占沙发的表现…
没办法,我不玩论坛,我无话可说,不如来点客套话吧:
博主您太厉害了,您是我的呕像!您是我的粉丝!好葱白!
额滴个神…..