📄 function.js
字号:
function GetImgSize(img,MaxWidth,MaxHeight){
// if(img.readyState!="complete"){//没有加载完毕
// img.width=MaxWidth;
// img.height=MaxHeight;
// }else{
if(img.offsetWidth<=MaxWidth && img.offsetHeight<=MaxHeight){
return;
}else{
if(MaxHeight*img.offsetWidth/img.offsetHeight>=MaxWidth){
img.width=MaxWidth;
img.height=MaxWidth*img.offsetHeight/img.offsetWidth;
}else{
img.height=MaxHeight;
img.width=MaxHeight*img.offsetWidth/img.offsetHeight;
}
}
// }
}
function MediaPlay(Type,Obj,strURL,intWidth,intHeight){
if(Obj.innerHTML!='单击播放媒体文件'){
Obj.innerHTML = '单击播放媒体文件';
}else{
switch(Type){
case "swf":
tmpstr='关闭媒体播放<object codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="'+intWidth+'" height="'+intHeight+'"><param name="movie" value="'+strURL+'" /><param name="quality" value="high" /><param name="AllowScriptAccess" value="never" /><embed src="'+strURL+'" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="'+intWidth+'" height="'+intHeight+'" /></object><br />[<a target=_blank href='+strURL+'>Full Screen</a>]';
break;
case "wmv":
tmpstr='关闭媒体播放<object classid="clsid:22D6F312-B0F6-11D0-94AB-0080C74C7E95" codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,0,02,902" type="application/x-oleobject" standby="Loading..." width="'+intWidth+'" height="'+intHeight+'"><param name="FileName" VALUE="'+strURL+'" /><param name="ShowStatusBar" value="-1" /><param name="AutoStart" value="true" /><embed type="application/x-mplayer2" pluginspage="http://www.microsoft.com/Windows/MediaPlayer/" src="'+strURL+'" autostart="true" width="'+intWidth+'" height="'+intHeight+'" /></object>';
break;
case "rm":
tmpstr='关闭媒体播放<object classid="clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA" width="'+intWidth+'" height="'+intHeight+'"><param name="SRC" value="'+strURL+'" /><param name="CONTROLS" VALUE="ImageWindow" /><param name="CONSOLE" value="one" /><param name="AUTOSTART" value="true" /><embed src="'+strURL+'" nojava="true" controls="ImageWindow" console="one" width="'+intWidth+'" height="'+intHeight+'" /></object>'+
'<br/><object classid="clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA" width="'+intWidth+'" height="32" /><param name="CONTROLS" value="StatusBar" /><param name="AUTOSTART" value="true" /><param name="CONSOLE" value="one" /><embed src="'+strURL+'" nojava="true" controls="StatusBar" console="one" width="'+intWidth+'" height="24" /></object>'+'<br /><object classid="clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA" width="'+intWidth+'" height="32" /><param name="CONTROLS" value="ControlPanel" /><param name="AUTOSTART" value="true" /><param name="CONSOLE" value="one" /><embed src="'+strURL+'" nojava="true" controls="ControlPanel" console="one" width="'+intWidth+'" height="24" autostart="true" loop="false" /></object>';
break;
case "qt":
tmpstr='关闭媒体播放<embed src="'+strURL+'" autoplay="true" loop="false" controller="true" playeveryframe="false" cache="false" scale="TOFIT" bgcolor="#000000" kioskmode="false" targetcache="false" pluginspage="http://www.apple.com/quicktime/" />';
}
Obj.innerHTML = tmpstr;
}
}
function CopyCode(obj){
var js = document.body.createTextRange();
js.moveToElementText(obj);
js.select();
js.execCommand("Copy");
}
function delblog(id){
if(confirm('您确认要删除此篇文章?')){
var url=ajxurl+"/blogcp.php?action=delblog&selid="+id;
itemid=id;
send_request(url,del_blog);
}
}
function del_blog(){
if(http_request.responseText==2){
GE(itemid).style.display='none';
}else{
alert(http_request.responseText);
}
}
function delcmt(id){
if(confirm('您确认要删除此篇回复?')){
var url=ajxurl+"/blogcp.php?action=delcmt&id="+id;
itemid=id;
send_request(url,del_cmt);
}
}
function del_cmt(){
if(http_request.responseText==2){
GE(itemid).style.display='none';
GE("sum").innerHTML=GE("sum").innerHTML-1;
}else{
alert("你没有权限!");
}
}
function delconfirm(){
if(confirm('确定删除?')) {
return true;
}else{
return false;
}
}
function addtoclt(id,type){
if(id){
var url=ajxurl+"/ajax.php?action=addtoclt&itemid="+id+"&type="+type;
send_request(url,addto_clt);
}
}
function addto_clt(){
var msg='';
switch(http_request.responseText){
case '2':msg="请先登录";
break;
case '1':msg="添加成功";
break;
case '4':msg="您已经收藏了此内容,请不要重复添加";
break;
case '3':msg="类型错误或文章不存在!";
break;
}
alert(msg);
}
//gbook function
function postmsg(){
msg = GE("msg_box").value;
username = GE("username").value;
if(msg){
var url = ajxurl + "/postmsg.php?action=new";
var param = "uid=" + uid + "&msg=" + ajax_convert(msg) + "&username=" + ajax_convert(username);
send_request(url,post_response,param);
}else{
alert('留言内容不能为空!');
}
}
function post_response(){
GE("msg_box").value='';
GE("msgbox").innerHTML=http_request.responseText + GE("msgbox").innerHTML;
scroll(0,0);
}
function showreplybox(id){
if(GE("reply_" + id).style.display=="none"){
GE("reply_" + id).style.display="";
GE("r_div_" + id).style.display="none";
}else{
GE("reply_" + id).style.display="none";
GE("r_div_" + id).style.display="";
promsg = GE("r_content_" + id) ? GE("r_content_" + id).innerText : '';
GE("r_div_" + id).innerHTML =
"<div id=\"g_reply\">" +
"<div style=\"padding:1px;margin-bottom:5px;\">" +
"<textarea id=\"r_box_" + id +"\" style=\"width:346px;height:80px;\">" + promsg + "</textarea> " +
"</div>" +
"<div style=\"text-align:right;width:350px;\">" +
"<input type=\"button\" value=\"回复\" style=\"background-color:#EEEEEE;border:1px solid #333333;\" onclick=\"replymsg(" + id + ")\"> " +
"</div>" +
"</div><br>";
}
}
function replymsg(id){
msg = GE("r_box_" + id).value;
if(msg){
GE("tmpid").value=id;
var url = ajxurl + "/postmsg.php?action=reply&uid=" + uid;
var param = "id=" + id + "&msg=" + ajax_convert(msg);
send_request(url,reply_response,param);
}else{
alert('回复的内容不能为空!');
}
}
function reply_response(){
id=GE("tmpid").value;
GE("reply_" + id).innerHTML=http_request.responseText;
GE("reply_" + id).style.display="";
GE("r_div_" + id).style.display="none";
}
function delmsg(id){
if(confirm('您确认要删除此条留言!')){
var url=ajxurl + "/postmsg.php?action=del&uid=$uid&id=" + id;
send_request(url,del_response);
}
}
function del_response(){
GE("msg_"+http_request.responseText).style.display='none';
}
function getcate(type){
if(type){
var url=ajxurl + "/ajax.php?action=getcate&type="+type;
send_request(url,get_cate);
}else{
GE("scid").innerHTML="";
}
}
function get_cate(){
GE("scid").innerHTML=http_request.responseText;
}
function advck(id){
if(id){
var url=ajxurl + "/adv.php?id="+id;
send_request(url);
}
}
function commentcheck()
{
if(document.form1.content.value == "")
{
alert("评论内容为空!");
document.form1.content.focus();
return false;
}
}
function replaceimg(url){
GE('img_container').src=url;
}
function addfootprint(id){
if(id){
var url=ajxurl + "/ajax.php?action=footprint&itemid="+id;
send_request(url,add_footprint);
}
}
function add_footprint(){
var msg='';
switch(http_request.responseText){
case '2':msg="错误的文章id";
break;
case '1':msg="您成功的推荐了此篇文章";
break;
case '4':msg="您已经推荐过了!";
break;
case '3':msg="未登陆不能推荐!";
break;
}
alert(msg);
}
function commendtomenu(){
var url=ajxurl + "/commendto.php?action=commendtomenu";
send_request(url,commendto_menu);
}
function commendto_menu(){
if(http_request.responseText==2){
alert('请先登陆');
}else{
GE('commendtomenu').innerHTML=http_request.responseText+'<input type="button" value="推 荐" class="btn" onclick="commendto();" />';
}
}
function commendto(){
var touid=GE('fuid').value;
var url=ajxurl + "/commendto.php?action=commendto&itemid="+itemid+"&touid="+touid;
send_request(url,commend_to);
}
function commend_to(){
if(http_request.responseText==2){
alert('请先登陆');
}else if(http_request.responseText==3){
alert('没有此位好友');
}else if(http_request.responseText==4){
alert('错误的文章id');
}else{
GE('commendtomenu').innerHTML='<input type="button" value="推荐好友" onclick="commendtomenu();" class="btn" />';
alert('推荐成功');
}
}
/*
HTMLElement.prototype.__defineGetter__
(
"innerText",
function () {
var anyString = "";
var childS = this.childNodes;
for(var i=0; i<childS.length; i++) {
if(childS[i].nodeType==1) {
anyString += childS[i].tagName=="BR" ? '\n' : childS[i].innerText;
}else if(childS[i].nodeType==3) {
anyString += childS[i].nodeValue;
}
}
return anyString;
}
);
*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -