|
本帖已同步发布于PW官方论坛
http://www.phpwind.net/read-htm-tid-258497.html
本论坛(碧海潮声)已启用此功能
Hack名称:快速回帖时保存内容,以防提交出错
适合版本:pw 4.3.2
安装程序:笨笨啊
安装难易:简单
hack特点:快速回复时能自动保存内容,当提交出错时可以自己选择恢复之前的数据。好处就在于是保存在cookie中,而非是保存在剪切板中,这样就不会覆盖原来剪切板中的内容了
增加表 :无
影响字段:无
增加文件:无
修改文件:
template/wind/fastpost.htm
打开template/wind/fastpost.htm
找到
- <!--<?php print <<<EOT
- -->
复制代码
在后面加上
- <script language="javascript">
- function writeCookie(name, value, hours)
- {
- var expire = "";
- if(hours != null)
- {
- expire = new Date((new Date()).getTime() + hours * 3600000);
- expire = "; expires=" + expire.toGMTString();
- }
- document.cookie = name + "=" + escape(value) + expire;
- }
- function readCookie(name)
- {
- var cookieValue = "";
- var search = name + "=";
- if(document.cookie.length > 0)
- {
- offset = document.cookie.indexOf(search);
- if (offset != -1)
- {
- offset += search.length;
- end = document.cookie.indexOf(";", offset);
- if (end == -1) end = document.cookie.length;
- cookieValue = unescape(document.cookie.substring(offset, end))
- }
- }
- return cookieValue;
- }
- </script>
复制代码
找到
- <input type=checkbox name="atc_usesign" value="1" checked>使用签名
复制代码
在其前面加上
- <a style="cursor:hand" onclick="javascript:if(confirm('您确定要恢复上次回帖记录吗?')) {document.FORM.atc_content.value=readCookie('lastcontent');alert('恢复成功');document.FORM.atc_content.focus();}">[恢复上次回帖数据]</a>
复制代码
找到
在后面加上
- writeCookie('lastcontent',document.FORM.atc_content.value,24);
复制代码
好处在于是保存在cookie而非剪切板中,不会破坏原有的剪切板内容 |
|