找回密码

碧海潮声大学生网

查看: 828|回复: 0
打印 上一主题 下一主题

〖原创〗〖PW_hack增强〗——关于使用mop式帖图时发帖或编辑帖时 的改进

[复制链接]
跳转到指定楼层
1#
发表于 2005-10-22 03:26 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
原hack请见
http://www.phpwind.net/read.php?tid=109855&keyword=mop
[3.0.1小HACK]让PHPwind像MOP一样使用包子表情[附包子表情下载]

昨天将此hack安装到我站点上(http://www.zjoubbs.com)
发现,当发帖(post.php)的时候,按快捷键ctrl+enter或点击 提交时,均无法正常添加mop图片。
还有,其里面写到的调用地址要写上绝对路径,这样对一些有镜像站点,或是有多域名的时候,将造成访问速度的降低,故有以下和点小改进

为了使post的时候,也能支持按快捷键和点提交时自动添加图片,可以这样做

一,打开data\wind_editor.js,使得发帖时也能支持快捷键
找到
  1. function quickpost()
  2. {
  3.      if((event.ctrlKey && window.event.keyCode == 13)||(event.altKey && window.event.keyCode == 83))
  4.      {
  5.           this.document.FORM.submit();
  6.      }
  7. }
复制代码

在this.document.FORM.submit();前面加上AddBaoZi();
即,此段代码替换为
  1. function quickpost()
  2. {
  3.      if((event.ctrlKey && window.event.keyCode == 13)||(event.altKey && window.event.keyCode == 83))
  4.      {
  5.           AddBaoZi();
  6.           this.document.FORM.submit();
  7.      }
  8. }
复制代码

二,改进post.htm,使得发帖时按提交也能自动添加图片
打开template\wind\post.htm
找到
  1. <input type=&#39;button&#39; value=&#39;提 交&#39; name=&#39;Submit&#39; onclick=&#39;_submit();&#39; accesskey=&#39;s&#39;>
复制代码


将其替换成
  1. <input type=&#39;button&#39; value=&#39;提 交&#39; name=&#39;Submit&#39; onclick=&#39;AddBaoZi();_submit();&#39; accesskey=&#39;s&#39;>
复制代码


三、改进bbscode.php,使得其不再[img]标签前自动添加http,以免使得写相对路径的时候不会被自动加上http而出错
打开require/bbscode.php
找到
  1. function cvpic($url,$type=&#39;&#39;)
复制代码

在这个函数里有一句
  1. if(strtolower(substr($url,0,4))!=&#39;http&#39; && !$type)$url=&#39;http&#39;.$url;
复制代码
将其注释掉,即替换为
  1. //if(strtolower(substr($url,0,4))!=&#39;http&#39; && !$type)$url=&#39;http&#39;.$url;
复制代码

即可
然后,在Looki大侠提到的
  1. imgpath = "[url]http://img.mop.com/images/face/[/url]"; //下载包子到本地后请更换为您的地址
复制代码

这里,将路径改成相对路径,就不会出错了
如我,就改成了
  1. imgpath = "image/mop/";
复制代码



演示请见
http://www.zjoubbs.com
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享分享 顶 踩
您需要登录后才可以回帖 登录 | 注册

本版积分规则

Archiver|小黑屋| 碧海潮声大学生网  

Copyright © 2001-2013 Comsenz Inc.   All Rights Reserved.

Powered by Discuz! X3.2( 浙ICP备11026473号 )

快速回复 返回顶部 返回列表