| 【功能说明】我感觉这个功能这里是很需要的 技术论坛的解答区,bt求种区,二手市场等很适合用哦
 就是根据主题的标题含有某些字眼,就在浏览帖子的顶部显示一个图片连接,只要点击,就可以自动
 主题前自动加上[已解决].[已成交]等字样,不需要编辑贴子,那么麻烦了.
 这个可以自己扩充.
 安装简单,基于javascript,不用修改文件,又是模板的而已.哈哈
 
 【适用版本】2.5&SP1
 【插件名称】主题前自动加上[已解决].[已成交]等字样
 【插件作者】lu5266
 【修改模板】viewthread.htm    post_editpost.htm
 【演示地址】http://free4.e-168.cn/luzhenling/bbs/forumdisplay.php?fid=9
 【技术支持】http://www.5466.ik8.com
 
 
 1.修改viewthread.htm
 
 查找:
 
 
 
 复制代码<!--{if $allowpost}--><a href="post.php?action=newthread&fid=$fid">
 (会查找到两个地方,但是前面的那个就要)
 
 在前面加上:
 
 
 
 复制代码<script language="JavaScript" defer>
var title_str="$thread[subject]"; 
function find_subject(subject_type){ if(title_str.indexOf(subject_type)!=-1) return true;else return false; }
function find_subject_str(){ 
        if(find_subject("请问")||find_subject("求助")||find_subject("帮忙")||find_subject("问题")||find_subject("如何") ||find_subject("关于") ||find_subject("能否") )  return 1;
                
        else if(find_subject("交易")||find_subject("出售") ||find_subject("求购"))    return 2;
           
        else if(find_subject("求种")||find_subject("求影片"))   return 3;
          
        else    return 0;                
}
function find_solved(){
if(find_subject("已解决")||find_subject("已成交")||find_subject("已获种子") ) return 0;
else return 1;
}
solved_type=find_subject_str();
if(solved_type&&find_solved())
 document.getElementById('solved').innerHTML="<a href="post.php?action=edit&fid=$fid&tid=$tid&pid="+solved_pid+"&page=$page&solved="+solved_type+""><img src="images/solved_"+solved_type+".gif" border="0" alt="在标题前加上这个,表示已经这个咯"></a>";
</script>
<span id=solved ></span>
 
 查找:
 
 
 复制代码$post[subject]</span><br><br>
 后面加上:
 
 
 复制代码        <!--{if $post['postcount']==1}-->
        <script language=javascript>solved_pid=$post[pid];</script>
     <!--{/if}-->
 
 2.修改 post_editpost.htm
 
 
 查找:
 
 
 
 
 在前面加上:
 
 
 复制代码<script language="JavaScript" >
function get_var(var_name)
{
        var_object= location.href;
        var_object= var_object.replace("?","?&").split("&");
        var_value = "";
        for(i=1;i<var_object.length;i++)
        {
                if(var_object[i].indexOf(var_name+"=")==0)
                {
                        var_value= var_object[i].replace(var_name+"=","");
                }
        }
        return var_value;
}
var solved_type=get_var("solved");
if(solved_type>0&&solved_type<4){
  document.input.subject.focus();
  if(solved_type==1) document.input.subject.value="[已解决]"+document.input.subject.value;
  else if(solved_type==2) document.input.subject.value="[已成交]"+document.input.subject.value;
  else if(solved_type==3) document.input.subject.value="[已获种子]"+document.input.subject.value;  
  else document.input.subject.value=document.input.subject.value; 
   if (solved_type==1||solved_type==2||solved_type==3)document.input.submit();
   else { alert("请不要直接在地址栏输入参数!因为你的输入是错误和非法的!"); window.open("index.php","_self");}
} 
if(solved_type>4) {
alert("请不要直接在地址栏输入参数!因为你的输入是错误和非法的!"); window.open("index.php","_self");}
</script>
 3:把图片放到images目录下
 
 4:顶我,嘿嘿
 
 [ 本帖最后由 lu5266 于 2005-10-16 17:09 编辑 ]
 |