繁體
|
簡體
Sclub交友聊天~加入聊天室當版主
(檢舉)
分享
新浪微博
QQ空间
人人网
腾讯微博
Facebook
Google+
Plurk
Twitter
Line
标题:
[插件]
提示上传头像插件
[打印本页]
作者:
無名
时间:
2020-4-26 17:52
标题:
提示上传头像插件
来源:
章鱼之家
作者:
章鱼
[attach]202[/attach]
需要安装JQ库➟➟
JQuery安装
,已经安装可以忽略。
1)打开footer模板,在最上面一个</div>的下面添加:
<!--{if ($discuz_uid>0)}-->
{eval $uid=abs(intval($discuz_uid));}
{eval $uid=sprintf("%09d", $uid);}
{eval $dir1=substr($uid,0,3);}
{eval $dir2=substr($uid,3,2);}
{eval $dir3=substr($uid,5,2);}
{eval $avadir=dirname(dirname(dirname(__FILE__)))."/uc_server/data/avatar/".$dir1."/".$dir2."/".$dir3."/".substr($uid,-2)."_avatar_small.jpg";}
<!--{if (!file_exists($avadir))}-->
<div id="zy_avatar_cover"></div>
<div id="zy_avatar_window">
<script type="text/javascript" src="{$jspath}calendar.js?{VERHASH}"></script>
<script type="text/javascript" src="{$jspath}bbcode.js?{VERHASH}"></script>
<script type="text/javascript">
var charset = '$charset';
var maxsigsize = parseInt('$maxsigsize');
var maxbiosize = parseInt('$maxbiosize');
var allowhtml = 0;
var forumallowhtml = 0;
var allowsmilies = 0;
var allowbbcode = 0;
var allowimgcode = 0;
var allowbiobbcode = parseInt('$allowbiobbcode');
var allowbioimgcode = parseInt('$allowbioimgcode');
var allowsigbbcode = parseInt('$allowsigbbcode');
var allowsigimgcode = parseInt('$allowsigimgcode');
function parseurl(str, mode) {
str = str.replace(/([^>=\]"'\/]|^)((((https?|ftp):\/\/)|www\.)([\w\-]+\.)*[\w\-\u4e00-\u9fa5]+\.([\.a-zA-Z0-9]+|\u4E2D\u56FD|\u7F51\u7EDC|\u516C\u53F8)((\?|\/|:)+[\w\.\/=\?%\-&~`@':+!]*)+\.(jpg|gif|png|bmp))/ig, mode == 'html' ? '$1<img src="$2" border="0">' : '$1[img]$2[/img]');
str = str.replace(/([^>=\]"'\/@]|^)((((https?|ftp|gopher|news|telnet|rtsp|mms|callto|bctp|ed2k):\/\/)|www\.)([\w\-]+\.)*[:\.@\-\w\u4e00-\u9fa5]+\.([\.a-zA-Z0-9]+|\u4E2D\u56FD|\u7F51\u7EDC|\u516C\u53F8)((\?|\/|:)+[\w\.\/=\?%\-&~`@':+!#]*)*)/ig, mode == 'html' ? '$1<a href="$2" target="_blank">$2</a>' : '$1[url]$2[/url]');
str = str.replace(/([^\w>=\]:"'\.\/]|^)(([\-\.\w]+@[\.\-\w]+(\.\w+)+))/ig, mode == 'html' ? '$1<a href="mailto:$2">$2</a>' : '$1[email]$2[/email]');
return str;
}
function validate(theform) {
{if $typeid == 2}
{if $maxsigsize}
if(mb_strlen(theform.signaturenew.value) > maxsigsize) {
alert('{lang memcp_profile_sig_toolong}');
return false;
}
{/if}
if(mb_strlen(theform.bionew.value) > maxbiosize) {
alert('{lang memcp_profile_bio_toolong}');
return false;
}
{if !$member[signature]}$('signaturemessage').click();{/if}
{if !$member[bio]}$('biomessage').click();{/if}
{/if}
return true;
}
function updateavatar(updatenewbietask) {
$('avatar').src='{echo discuz_uc_avatar($discuz_uid, 'middle', TRUE)}{if $avatarmethod}?{else}&{/if}random=1'+Math.random();
<!--{if $prompts['newbietask'] && $newbietaskid && $newbietasks[$newbietaskid]['scriptname'] == 'uploadavatar'}-->
if(isUndefined(updatenewbietask)) {
ajaxget('task.php?action=updatenewbietask&scriptname=uploadavatar', 'avatarctrl');
}
<!--{/if}-->
if(document.body.stat) document.body.stat('avatar_update_succeed', 'memcp.php');
<!--{echo "\$"}-->jq("#zy_avatar_window").hide(300);
<!--{echo "\$"}-->jq("#zy_avatar_cover").fadeOut(300,function (){
<!--{echo "\$"}-->jq(this).hide();
});
}
function updatetextarea(id, msg) {
$(id).updated = 0;
$(id).value = msg;
$(id).style.color = '{LIGHTTEXT}';
$(id).onclick = function(){
this.style.color = '{TABLETEXT}';
this.value = '';
$(id).onclick = null;
}
}
</script>
<form name="reg" method="post" action="memcp.php?action=profile&typeid=3" onSubmit="return validate(this)" style="zoom:1">
<input type="hidden" name="formhash" value="bfc466bc" />
<h1 class="zy_avatar_h1">你还没有头像!赶快上传一个吧!</h1>
<table summary="修改头像" cellspacing="0" cellpadding="0" class="formtable">
<tr>
<td>
<div class="avatararea">
<p><img id="avatar" src="images/common/none.gif" onerror="this.onerror=null;this.src='http://localhost:1108/dz7.2/uc_server/images/noavatar_middle.gif'" /></p>
</div>
<div class="avatararea" style="display:none;">
<p><img id="avatar" src="images/common/none.gif" onerror="this.onerror=null;this.src='{UC_API}/images/noavatar_middle.gif'" /></p>
</div>
{eval require_once DISCUZ_ROOT.'/uc_client/client.php';}
{eval $uc_avatarflash=uc_avatar($discuz_uid, '', 0);}
<div id="avatarctrl"><script type="text/javascript">updateavatar(false);document.write(AC_FL_RunContent('{echo implode("','", $uc_avatarflash);}'));</script></div>
<div><button id="uplater">五分钟后再上传</button></div>
</td>
</tr>
</table>
</form>
</div>
<script>
if (getcookie("zyava_show")!="yes"){
<!--{echo "\$"}-->jq("#zy_avatar_window").show(500);
<!--{echo "\$"}-->jq("#zy_avatar_cover").show().fadeTo(500,0.7);
}
<!--{echo "\$"}-->jq("#zy_avatar_window #uplater").click(function (e){
e.preventDefault();
<!--{echo "\$"}-->jq("#zy_avatar_window").hide(300);
<!--{echo "\$"}-->jq("#zy_avatar_cover").fadeOut(300,function (){
<!--{echo "\$"}-->jq(this).hide();
});
setcookie("zyava_show","yes",300);
});
</script>
<!--{/if}-->
<!--{/if}-->
复制代码
本帖隐藏的内容需要回复才可以浏览
欢迎光临 i-share 爱生活爱分享 (http://i-share.funbbs.me/)
Powered by Discuz! 7.2