📄 基于ajax和json从javascript中调用后台java方法的jsongateway_西风吹雨的blog_新浪博客.mht
字号:
=A2=E4=B8=AD=E5=86=99=E5=85=A5js=0A=
* @param o {=0A=
* id : id of the created tag, =0A=
* url : String,=0A=
* script : String=0A=
* }=0A=
*/=0A=
function dwScript(o){=0A=
o.id =3D o.id || "";=0A=
o.charset =3D o.charset || "utf-8";=0A=
var def =3D "";=0A=
if(o.defer !=3D null){=0A=
def =3D "defer=3D'true'"; =0A=
} =0A=
if (o.script && o.script !=3D "") {=0A=
document.write("<script id=3D'" + o.id + "' " + def + ">" + o.script =
+ "<\/script>");=0A=
}=0A=
else =0A=
if (o.url && o.url !=3D "") {=0A=
document.write("<script id=3D'" + o.id + "' src=3D'" + o.url + "' =
charset=3D'" + o.charset + "' " + def + "><\/script>");=0A=
}=0A=
else {=0A=
throw new Error("no script content or url specified");=0A=
}=0A=
}=0A=
=0A=
/**=0A=
* @author xp=0A=
* write link tag or style tag to document. Can be used only in =
page-loading phase.=0A=
* only script text or script url can be accepted. u cant specify none =
or two of them or an error will be raised=0A=
*=0A=
* =
=E4=BB=A5document.write=E7=9A=84=E6=96=B9=E5=BC=8F=E5=90=91=E9=A1=B5=E9=9D=
=A2=E4=B8=AD=E5=86=99=E5=85=A5css=0A=
* @param o {=0A=
* id : id of the created tag, =0A=
* url : String,=0A=
* styles : styles text=0A=
* }=0A=
*/=0A=
function dwCSS(o){=0A=
o.id =3D o.id || "";=0A=
if (o.url){=0A=
document.write('<link id=3D"' + o.id + '" rel=3D"stylesheet" =
type=3D"text/css" href=3D"' + o.url + '" />');=0A=
} else if (o.styles){=0A=
document.write('<style id=3D"' + o.id + '" >'+o.styles+'<\/style>');=0A=
} =0A=
}=0A=
/**=0A=
* @author stan | chaoliang@staff.sina.com.cn=0A=
* fangchao | fangchao@staff.sina.com.cn=0A=
* @param {Object} url=0A=
* @desc load the souce files=0A=
* =0A=
* @modify =
=E7=9B=B8=E5=90=8C=E6=96=87=E4=BB=B6=E8=BD=BD=E5=85=A5=E4=B8=80=E4=BB=BD=0A=
*/=0A=
function $import(url){=0A=
if(window.scriptHash =3D=3D null) {=0A=
window.scriptHash =3D {};=0A=
}=0A=
if (window.scriptHash[url] !=3D true) {=0A=
window.scriptHash[String(url)] =3D true;=0A=
var pk =3D __decode_mode && __dev_mode ? ".packed" : "";=0A=
url =3D 'http://blogjs.sinajs.cn/v5dev/js/' + __author + '/' + url + =
pk;=0A=
var o =3D {};=0A=
o.url =3D url + "?" + new Date().valueOf();=0A=
dwScript(o);=0A=
}=0A=
}=0A=
/**=0A=
* @author xp | yanbo@staff.sina.com.cn=0A=
* @desc determine which page it is in=0A=
*/=0A=
function $getPageId(win){=0A=
return $pageid;=0A=
}=0A=
/** =0A=
* @author stan | chaoliang@staff.sina.com.cn=0A=
* @desc get cookie by name =0A=
*/=0A=
function getCookie(name) {=0A=
var arr =3D document.cookie.match(new RegExp("(^| =
)"+name+"=3D([^;]*)(;|$)"));=0A=
if (arr !=3D null) {=0A=
return unescape(arr[2]);=0A=
}=0A=
return null;=0A=
}=0A=
/**=0A=
* check user status by cookie=0A=
* @author stan=0A=
* return Boolean true if the author is visiting its own blog=0A=
*/=0A=
function checkAuthor(){=0A=
var AuthorInfo =3D getCookie("nick");=0A=
scope.AuthorUID =3D AuthorInfo ? =
AuthorInfo.match(/\(\d{5,10}\)/g)[0].replace(/\(|\)/g, "") : null;=0A=
$UID =3D scope.AuthorUID || null;=0A=
$isLogin =3D !!($UID);=0A=
if(typeof $uid =3D=3D "undefined") {=0A=
$isAdmin =3D false;=0A=
}=0A=
else {=0A=
$isAdmin =3D $uid =3D=3D $UID;=0A=
}=0A=
}=0A=
var cssReapetConf =3D {=0A=
"none" : "no-repeat",=0A=
"default":"repeat",=0A=
"h":"repeat-x",=0A=
"v":"repeat-y"=0A=
};=0A=
var cssPositionXConf =3D {=0A=
"default" : "center",=0A=
"left":"left",=0A=
"center":"center",=0A=
"right":"right"=0A=
};=0A=
var cssPositionYConf =3D {=0A=
"default" : "top",=0A=
"top":"top",=0A=
"center":"center",=0A=
"bottom":"bottom"=0A=
};=0A=
/**=0A=
* =
=E5=8A=A0=E8=BD=BD=E5=89=8D=E7=AB=AF=E9=A1=B5=E9=9D=A2=E5=85=A8=E9=83=A8c=
ss=0A=
*/=0A=
function loadCss(){=0A=
fixConfig();=0A=
var cfg =3D config;=0A=
var cssVer =3D cfg.v.c+".css";=0A=
var templateNum,tempArray=3Dcfg.s.t.split("_");=0A=
if(cfg.s.r=3D=3D1 && tempArray[0]!=3D9){=0A=
templateNum=3DrandomTheme(tempArray[0]);=0A=
}else{=0A=
templateNum=3DtempArray;=0A=
}=0A=
var dev =3D __dev_mode ? ".dev" : "";=0A=
dwCSS({url : $BASECSS + 'css/' + 'v5' + dev + '.css?'+cssVer});=0A=
dwCSS({url : $BASECSS + 'css/' + templateNum[0] + "_" + templateNum[1] =
+ '/t.css?'+cssVer,id:"themeLink"});=0A=
writeDiyCss();=0A=
}=0A=
function writeDiyCss(){=0A=
//writer diy css=0A=
var path=3D$isAdmin?imgPath:"http://static.photo.sina.com.cn/orignal/";=0A=
if(config.s.head && config.s.head.usepic =3D=3D "1"){=0A=
var diycss =3D {id:"diy_banner"};=0A=
diycss.styles =3D =
'.bannerLayout{background:url('+path+config.s.head.currpic+') '+=0A=
cssReapetConf[config.s.head.tiled]+' =
'+cssPositionXConf[config.s.head.align_h]+' =
'+cssPositionYConf[config.s.head.align_v]+';height:'+config.s.head.height=
+'px}';=0A=
=0A=
//alert(diycss.styles)=0A=
dwCSS(diycss);=0A=
}=0A=
if(config.s.bg && config.s.bg.usepic =3D=3D "1"){=0A=
var diycss =3D {id:"diy_bg"};=0A=
diycss.styles =3D =
'body{background-image:url('+path+config.s.bg.currpic+');background-repea=
t: '+=0A=
cssReapetConf[config.s.bg.tiled]+'; =
background-position:'+cssPositionXConf[config.s.bg.align_h]+' =
'+cssPositionYConf[config.s.bg.align_v]+'} .sinaBottom =
{background:transparent url()}';=0A=
dwCSS(diycss);=0A=
}=0A=
}=0A=
/**=0A=
* =E5=8A=A0=E8=BD=BD=E5=90=8E=E7=AB=AF=E9=A1=B5=E9=9D=A2css=0A=
* 1.=E4=B8=8D=E5=8A=A0=E8=BD=BD=E6=A8=A1=E6=9D=BFcss=0A=
* 2.=E5=8F=AA=E9=85=8D=E7=BD=AE=E8=BE=83=E5=B0=91=E7=9A=84css=0A=
* 3.=E4=B8=8D=E5=8A=A0=E8=BD=BD=E8=87=AA=E5=AE=9A=E4=B9=89css=0A=
*/=0A=
function loadMiniCss(){=0A=
fixConfig();=0A=
var cfg =3D config;=0A=
var cssVer =3D cfg.v.c+".css";=0A=
var dev =3D __dev_mode ? ".dev" : "";=0A=
dwCSS({url : $BASECSS + 'css/' + 'v5' + dev + '.css?'+cssVer});=0A=
}=0A=
/**=0A=
* =E6=A8=A1=E6=9D=BF=E5=90=84=E4=B8=AA=E5=88=86=E7=B1=BB=E7=9A=84length=0A=
*/=0A=
var themeLength=3D[30,30,30,20,20,20,22,30];=0A=
/**=0A=
* =
=E9=9A=8F=E5=8D=B3=E6=A8=A1=E6=9D=BF=EF=BC=88=E9=A6=96=E9=A1=B5=E6=AF=8F=E6=
=AC=A1=E5=88=B7=E6=96=B0=E9=83=BD=E9=9A=8F=E5=8D=B3=EF=BC=8C=E5=85=B6=E9=A1=
=B5=E9=9D=A2=E6=A0=B9=E6=8D=AEcookie=E9=9A=8F=E6=9C=BA=EF=BC=89=0A=
* @param {Object} themeNum=0A=
*/=0A=
function randomTheme(themeNum){=0A=
var =
num,length=3DthemeLength[themeNum-1],cookieTheme=3DgetCookie("sina_blog_r=
andom_theme");=0A=
if(/index/.test($pageid)||cookieTheme=3D=3Dnull){=0A=
num=3DgetRandomNum(1,length-1);=0A=
setCookie("sina_blog_random_theme",num,2,"/","blog.sina.com.cn",false);=0A=
}else{=0A=
num=3DcookieTheme;=0A=
}=0A=
=
//=E9=81=BF=E5=85=8D=E5=9B=A0=E4=B8=BAcookie=E5=AD=98=E5=82=A8=E4=BA=86=E8=
=B6=85=E8=BF=87=E8=8C=83=E5=9B=B4=E7=9A=84num=E8=80=8C=E5=BC=95=E8=B5=B7=E7=
=9A=84=E4=B9=B1=E7=A0=81=E9=97=AE=E9=A2=98=0A=
if (num > themeLength[themeNum - 1]) {=0A=
num =3D themeLength[themeNum - 1] -1;=0A=
}=0A=
return [themeNum,num];=0A=
}=0A=
/**=0A=
* =E5=8F=96=E5=BE=97=E9=9A=8F=E5=8D=B3=E6=95=B0=EF=BC=8C>=3Dmin,<=3Dmax=0A=
* @param {Object} min=0A=
* @param {Object} max=0A=
*/=0A=
getRandomNum=3Dfunction(min,max){=0A=
return min+Math.floor(Math.random()*(max-min+1)); =0A=
};=0A=
/**=0A=
* =E4=BF=9D=E5=AD=98cookie=0A=
*/=0A=
function setCookie(sName,sValue,objHours,sPath,sDomain,bSecure){=0A=
var sCookie =3D sName + "=3D" + encodeURIComponent(sValue);=0A=
if (objHours) {=0A=
var date =3D new Date();=0A=
var ms =3D objHours * 3600 * 1000;=0A=
date.setTime(date.getTime() + ms);=0A=
sCookie +=3D ";expires=3D" + date.toGMTString();=0A=
=0A=
}=0A=
if (sPath) {=0A=
sCookie +=3D ";path=3D" + sPath;=0A=
}=0A=
if (sDomain) {=0A=
sCookie +=3D ";domain=3D" + sDomain;=0A=
}=0A=
if (bSecure) {=0A=
sCookie +=3D ";secure";=0A=
}=0A=
document.cookie=3DsCookie;=0A=
}=0A=
=0A=
/**=0A=
* @author stan | chaoliang@staff.sina.com.cn=0A=
* @desc load the js file base the usr login status & page=0A=
*/=0A=
function loadResource(){=0A=
fixConfig();=0A=
if (__debug_mode) {=0A=
$import('Sina/Sina.js');=0A=
$import('Sina/debug.js');=0A=
}=0A=
if(__dev_mode) {=0A=
$import('Sina/Sina.js');=0A=
$import('Sina/io/io.js')=0A=
$import('Sina/system.base.js');=0A=
$import('Sina/Class.js');=0A=
$import('Sina/events.js');=0A=
$import('Jobs.js');=0A=
}=0A=
var page =3D $getPageId();=0A=
var cfg =3D config;=0A=
var jsVer =3D cfg.v.j+".js";=0A=
var url =3D __dev_mode =0A=
? $BASE + "js/"+ __author + "/conf/" + page + ".dev.js"=0A=
: $BASE + "js/" + page + ".js";=0
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -