自动解析播放所有的多媒体链接[改进增加图标]
各位对不起,我根本就不懂PHP,我只是根据别人的稍微整理了下,我的是这样安装成功了,有别的问题还请哪位大大帮忙好么!!
难易度:简单
修改数据库:无
演示:http://www.myspar.net/viewthread.php?tid=764&extra=page%3D1
适合版本:D4.0 4.1
原帖子:https://discuz.dismall.com/thread-273475-1-3.html
根据:https://discuz.dismall.com/thread-203346-1-8.html
修改成为发帖时候插入图标按妞
1.打开include/bbcode.js
查找:
在上面添加:
- function mv() {
- if (helpmode){
- alert(mv_help);
- } else if (advmode) {
- AddTxt="[mv] [/mv]";
- AddText(AddTxt);
- } else {
- txt=prompt(mv_normal,"http://");
- if(txt!=null) {
- AddTxt="\r[mv]"+txt;
- AddText(AddTxt);
- AddText("[/mv]");
- }
- }
- }
复制代码
2.打开post_bbinsert.htm模板
查找:
- var underline_normal = "{lang post_discuzcode_underline_normal}";
复制代码
在下面加入:
- var mv_normal = "{lang post_mv}";
- var mv_help = "{lang post_discuzcode_mv}\n\n{lang post_discuzcode_mv_comment}";
复制代码
再查找:
- <a href="javascript:list()"><img src="{IMGDIR}/bb_list.gif" border="0" alt="{lang post_discuzcode_list}"></a>
复制代码
在下面加入:
- <a hidefocus=true href="javascript:mv()"><img src="{IMGDIR}/bb_mv.gif" border="0" alt="{lang post_discuzcode_mv}"></a>
复制代码
3.打开语言包templates.lang.php
查找:
- 'post_discuzcode_insert_color' => '- 颜色 -',
复制代码
在下面加入:
- 'post_discuzcode_mv' => '插入多媒体',
复制代码
4.去后台设置Discuz! 代码
系统设置------->Discuz! 代码------->开始设置---!
新增标签:mv
编辑 Discuz! 代码 - mv
标签:
替换内容:
- <script language="javascript">
- var LINK = new Array("{1}","P2P之家资源链接");
- var linkType = new Array();
- linkType['WMA'] = 'WMP';
- linkType['MP3'] = 'WMP';
- linkType['WMV'] = 'WMP';
- linkType['ASF'] = 'WMP';
- linkType['MPG'] = 'WMP';
- linkType['MPEG'] = 'WMP';
- linkType['AVI'] = 'WMP';
- linkType['ASX'] = 'WMP';
- linkType['RM'] = 'Real';
- linkType['RMVB'] = 'Real';
- linkType['RAM'] = 'Real';
- linkType['RA'] = 'Real';
- linkType['SWF'] = 'Flash';
- var sufFix = LINK[0].substring(LINK[0].lastIndexOf(".")+1,LINK[0].length).toUpperCase();
- if(sufFix.indexOf("#")) sufFix = sufFix.split("#")[0];
- if(sufFix.indexOf("?")) sufFix = sufFix.split("?")[0];
- function WMP(){
- document.writeln("<object id='mediaplayer' width='480' height="+((sufFix=="MP3"||sufFix=="WMA")?"64":"424")+" classid='CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6' align='center' border='0' type='application/x-oleobject' standby='Loading Windows Media Player components...'>");
- document.writeln("<param name='url' value='"+LINK[0]+"'>");
- document.writeln("<param name='AutoStart' value='1'><param name='Balance' value='0'><param name='enabled' value='-1'><param name='EnableContextMenu' value='0'><param name='PlayCount' value='1'><param name='rate' value='1'><param name='currentPosition' value='0'><param name='currentMarker' value='0'><param name='defaultFrame' value=''><param name='invokeURLs' value='-1'><param name='baseURL' value=''><param name='stretchToFit' value='0'><param name='volume' value='100'><param name='mute' value='0'><param name='uiMode' value='full'><param name='windowlessVideo' value='0'><param name='fullScreen' value='0'><param name='enableErrorDialogs' value='0'><param name='SAMIStyle' value=''><param name='SAMILang' value=''><param name='SAMIFilename' value=''><param name='captioningID' value=''>");
- document.writeln("</object>");
- document.close();
- }
- function Real(){
- document.writeln("<object classid='clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA' width='400' height='300' id='amourReal'>");
- document.writeln(" <param name='src' value='"+LINK[0]+"'>");
- document.writeln(" <param name='autostart' value='true'>");
- document.writeln(" <param name='controls' value='imagewindow'>");
- document.writeln(" <param name='console' value='clip1'>");
- document.writeln(" <embed src='"+LINK[0]+"' width='400' height='300' type='audio/x-pn-realaudio-plugin' autostart='true' controls='imagewindow' console='video'>");
- document.writeln(" </embed>");
- document.writeln("</object>");
- document.writeln("<br />");
- document.writeln("<object classid='clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA' width='400' height='50' id='amourReal'>");
- document.writeln(" <param name='src' value='"+LINK[0]+"'>");
- document.writeln(" <param name='autostart' value='true'>");
- document.writeln(" <param name='controls' value='all'>");
- document.writeln(" <param name='console' value='clip1'>");
- document.writeln(" <embed type='audio/x-pn-realaudio-plugin' src='"+LINK[0]+"' width='400' height='50' autostart='true' controls='all' console='video'>");
- document.writeln(" </embed>");
- document.writeln("</object>");
- document.close();
- }
- function Flash(){
- document.write("<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0' width='600' height='480'>");
- document.write("<param name='movie' value='"+LINK[0]+"'>");
- document.write("<param name='quality' value='high'>");
- document.write("<embed src='"+LINK[0]+"' quality='high' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' width='480' height='330'></embed>");
- document.write("</object>");
- document.close();
- }
- function Default(){
- document.writeln("<a href='"+ LINK[0] +"' target='_blank'>" + LINK[1] + "</a>");
- document.close();
- }
- if(linkType[sufFix]){
- eval(linkType[sufFix]+"()");
- }else{
- Default();
- }
- </script>
复制代码
例子:- [mv]http://your.com/abc.wmv[/mv]
复制代码
解释: 多媒体播放
参数个数: 1
嵌套次数: 1
安装好后,记得要启用才能使用。
上传 bb_mv.gif
更新缓存 OK
[ 本帖最后由 shenstef 于 2006-4-20 22:01 编辑 ] |