home

discuz!hack-添加MID、RM、WMV和MP3标签图标的方法

Tag:

以下只是在发表帖子了显示标签的按钮,还需要后台设置Discuz 自定义代码,

1、修改 include/bbcode.js
在最下面加:

  1. function mid() {
  2.         if (helpmode){
  3.                 alert(mid_help);
  4.         } else if (advmode) {
  5.                 AddTxt="[mid] [/mid]";
  6.                 AddText(AddTxt);
  7.         } else { 
  8.                 txt=prompt(mid_normal,"http://");   
  9.                 if(txt!=null) {           
  10.                         AddTxt="\r[mid]"+txt;
  11.                         AddText(AddTxt);
  12.                         AddText("[/mid]");
  13.                 }     
  14.         }
  15. }
  16. function rm() {
  17.         if (helpmode){
  18.                 alert(rm_help);
  19.         } else if (advmode) {
  20.                 AddTxt="[rm] [/rm]";
  21.                 AddText(AddTxt);
  22.         } else { 
  23.                 txt=prompt(rm_normal,"http://");   
  24.                 if(txt!=null) {           
  25.                         AddTxt="\r[rm]"+txt;
  26.                         AddText(AddTxt);
  27.                         AddText("[/rm]");
  28.                 }     
  29.         }
  30. }
  31. function wmv() {
  32.         if (helpmode){
  33.                 alert(wmv_help);
  34.         } else if (advmode) {
  35.                 AddTxt="[wmv] [/wmv]";
  36.                 AddText(AddTxt);
  37.         } else { 
  38.                 txt=prompt(wmv_normal,"http://");   
  39.                 if(txt!=null) {           
  40.                         AddTxt="\r[wmv]"+txt;
  41.                         AddText(AddTxt);
  42.                         AddText("[/wmv]");
  43.                 }     
  44.         }
  45. }
  46. function mp3() {
  47.         if (helpmode){
  48.                 alert(mp3_help);
  49.         } else if (advmode) {
  50.                 AddTxt="[mp3] [/mp3]";
  51.                 AddText(AddTxt);
  52.         } else { 
  53.                 txt=prompt(mp3_normal,"http://");   
  54.                 if(txt!=null) {           
  55.                         AddTxt="\r[mp3]"+txt;
  56.                         AddText(AddTxt);
  57.                         AddText("[/mp3]");
  58.                 }     
  59.         }
  60. }

2、修改模板templates/post_bbinsert
查找

  1. var center_normal = "{lang post_discuzcode_center_normal}";

在下面加:

  1. var mid_normal = "{lang post_midi}";
  2.        var mid_help = "{lang post_discuzcode_mid}\n\n{lang post_discuzcode_mid_comment}";
  3.        var wmv_normal = "{lang post_wmv}";
  4.        var wmv_help = "{lang post_discuzcode_wmv}\n\n{lang post_discuzcode_wmv_comment}";
  5.        var mp3_normal = "{lang post_mp3}";
  6.        var mp3_help = "{lang post_discuzcode_mp3}\n\n{lang post_discuzcode_mp3_comment}";
  7.        var rm_normal = "{lang post_rm}";
  8.        var rm_help = "{lang post_discuzcode_rm}\n\n{lang post_discuzcode_rm_comment}";

继续查找

  1. <a href="javascript:underline()"><img src="{IMGDIR}/bb_underline.gif" border="0" alt="{lang post_discuzcode_underline}"></a>

下面添加

  1. <a  hidefocus=true href="javascript:mid()"><img src="{IMGDIR}/bb_mid.gif" border="0" width="23" height="22" alt="{lang post_discuzcode_midi}"></a>
  2.     <a  hidefocus=true href="javascript:wmv()"><img src="{IMGDIR}/bb_wmv.gif" border="0" width="23" height="22" alt="{lang post_discuzcode_wmv}"></a>
  3.     <a  hidefocus=true href="javascript:rm()"><img src="{IMGDIR}/bb_rm.gif" border="0" width="23" height="22" alt="{lang post_discuzcode_rm}"></a>
  4.     <a href="javascript:mp3()"><img src="{IMGDIR}/bb_mp3.gif" border="0" width="23" height="22" alt="{lang post_discuzcode_mp3}"></a>

3、修改模板templates/templates.lang.php
查找

  1. 'post_imgcode' => '[img] 代码',

下面添加

  1. 'post_discuzcode_midi' => '插入 MIDI',
  2.       'post_discuzcode_wmv' => '插入 WMV 等',
  3.       'post_discuzcode_rm' => '插入 RM 等',
  4.       'post_discuzcode_mp3' => '插入 WMA , MP3 等',
  5.       'post_midi' => '插入 MIDI音乐',
  6.       'post_rm' => '插入RM',
  7.       'post_mp3' => '插入 MP3 , WMA 音乐',
  8.       'post_wmv' => '插入 wmv 等媒体',

4、将相对的图标传images/default/目录下,OK 啦!!\r
5、其他标签类似,只需更改相应参数就可以了。\r
下载

Created By: sb123

Form Page: discuz!hack-添加MID、RM、WMV和MP3标签图标的方法


留言中至少要有一个中文字

Leave a Reply