⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 boot.js

📁 基础类将帖子提前 放进我的网摘 推荐给好友 我要提问 帖子加分 生成帖子 置顶 推荐(加单 页面风格切换标准风格老版本论坛 如何将数值型字符转换为数字
💻 JS
📖 第 1 页 / 共 2 页
字号:
/** * @author stan | chaoliang@staff.sina.com.cn *///- debug -var __dev_mode = false;		//should be falsevar __debug_mode = false;	//should be falsevar __decode_mode = false;	//should be falsevar __author = "xinyu";//- env -var $BASE = "http://blogjs.sinajs.cn/v5/";var $BASECSS = "http://blogimg.sinajs.cn/v5/";var imgPath="http://bj.static.photo.sina.com.cn/orignal/";/** 存储出错提示信息内容对象 */var $SYSMSG = {};var scope = {};//- pre process -checkAuthor();if(typeof $uid == "undefined") {	$uid = $UID || "0000000000";}uid = $uid;var $uidhex = window.parseInt($uid).toString(16);$uidhex = new Array(9-$uidhex.length).join("0") + $uidhex;  // 将不足十六进制 UID 进行补全/** * 提供$setDomain变量,用来标明是否需要设置domain * 如果不想设置domain,请在跟$pageid变量一起设置$setDomain = false; */if (typeof($setDomain) == "undefined" || $setDomain == true) {	document.domain = "blog.sina.com.cn";}//- base function -function dw(s) {  window.document.write(s);}/** * Fucking confusing name of this function.. */function dwSwf(_sName, _sSrc, _sWidth, _sHeight, _sMode, _aValue) {  var sValue = '';  var aFlashVars = [];  if (_aValue) {    for (var key in _aValue) {      aFlashVars[aFlashVars.length] = key + "=" + _aValue[key];    }    sValue = aFlashVars.join('&');  }  _sMode = _sMode ? 'wmode="transparent"' : '';  if(_sName == "calendar" || _sName =="musicFlash2" ){	return '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="' + _sWidth + '" height="' + _sHeight + '" id="' + _sName + '" align="middle" ><param name="movie" value="' + _sSrc + '?' + sValue + '" /><param name=allowScriptAccess value=always><param name=wmode value=transparent><embed name="' + _sName + '" src="' + _sSrc + '" ' + _sMode + ' quality="high" align="top" salign="lt" allowScriptAccess="always" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="' + _sWidth + '" height="' + _sHeight + '" flashVars="' + sValue + '" \/><\/object>';  }else{	return '<embed id="' + _sName + '" name="' + _sName + '" src="' + _sSrc + '" ' + _sMode + ' quality="high" align="top" salign="lt" allowScriptAccess="always" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="' + _sWidth + '" height="' + _sHeight + '" flashVars="' + sValue + '" \/>';  }}/** * @author xp * write script tag to document. Can be used only in page-loading phase. * only script text or script url can be accepted. u cant specify none or two of them or an error will be raised * * 以document.write的方式向页面中写入js * @param o { *    id : id of the created tag,  *    url : String, *    script  : String *  } */function dwScript(o){  o.id = o.id || "";  o.charset = o.charset || "utf-8";  var def = "";  if(o.defer != null){  		def = "defer='true'";   }   if (o.script && o.script != "") {  	document.write("<script id='" + o.id + "' " + def + ">" + o.script + "<\/script>");  }  else   	if (o.url && o.url != "") {  		document.write("<script id='" + o.id + "' src='" + o.url + "' charset='" + o.charset + "' " + def + "><\/script>");  	}  	else {  		throw new Error("no script content or url specified");  	}}/** * @author xp * write link tag or style tag to document. Can be used only in page-loading phase. * only script text or script url can be accepted. u cant specify none or two of them or an error will be raised * * 以document.write的方式向页面中写入css * @param o { *    id : id of the created tag,  *    url : String, *    styles  : styles text *  } */function dwCSS(o){  o.id = o.id || "";  if (o.url){    document.write('<link id="' + o.id + '" rel="stylesheet" type="text/css" href="' + o.url + '" />');  } else if (o.styles){    document.write('<style id="' + o.id + '" >'+o.styles+'<\/style>');  } }/** * @author stan | chaoliang@staff.sina.com.cn *         fangchao | fangchao@staff.sina.com.cn * @param {Object} url * @desc load the souce files *  * @modify 相同文件载入一份 */function $import(url){	if(window.scriptHash == null) {		window.scriptHash = {};	}	if (window.scriptHash[url] != true) {		window.scriptHash[String(url)] = true;		var pk = __decode_mode && __dev_mode ? ".packed" : "";		url = 'http://blogjs.sinajs.cn/v5dev/js/' + __author + '/' + url + pk;		var o = {};		o.url = url + "?" + new Date().valueOf();		dwScript(o);	}}/** * @author xp | yanbo@staff.sina.com.cn * @desc determine which page it is in */function $getPageId(win){  return $pageid;}/**   * @author stan | chaoliang@staff.sina.com.cn  * @desc get cookie by name   */function getCookie(name) {  var arr = document.cookie.match(new RegExp("(^| )"+name+"=([^;]*)(;|$)"));  if (arr != null) {  	return unescape(arr[2]);  }   return null;}/**  * check user status by cookie  * @author stan  * return Boolean true if the author is visiting its own blog  */function checkAuthor(){	var AuthorInfo = getCookie("nick");	scope.AuthorUID = AuthorInfo ? AuthorInfo.match(/\(\d{5,10}\)/g)[0].replace(/\(|\)/g, "") : null;	$UID = scope.AuthorUID || null;	$isLogin = !!($UID);	if(typeof $uid == "undefined") {		$isAdmin = false;	}	else {		$isAdmin = $uid == $UID;	}}var cssReapetConf = {	"none" : "no-repeat",	"default":"repeat",	"h":"repeat-x",	"v":"repeat-y"};var cssPositionXConf = {	"default" : "center",	"left":"left",	"center":"center",	"right":"right"};var cssPositionYConf = {	"default" : "top",	"top":"top",	"center":"center",	"bottom":"bottom"};/** * 加载前端页面全部css */function loadCss(){	fixConfig();	var cfg = config;	var cssVer = cfg.v.c+".css";	var templateNum,tempArray=cfg.s.t.split("_");	if(cfg.s.r==1 && tempArray[0]!=9){		templateNum=randomTheme(tempArray[0]);	}else{		templateNum=tempArray;	}	var dev = __dev_mode ? ".dev" : "";	dwCSS({url : $BASECSS + 'css/' + 'v5' + dev + '.css?'+cssVer});	dwCSS({url : $BASECSS + 'css/' + templateNum[0] + "_" + templateNum[1] + '/t.css?'+cssVer,id:"themeLink"});	writeDiyCss();}function writeDiyCss(){		//writer diy css	//var path=$isAdmin?imgPath:"http://static.photo.sina.com.cn/orignal/";原有头图方式			if(config.s.head && config.s.head.usepic == "1"){		//修改访问头图方式		var num=parseInt(config.s.head.currpic.substring(config.s.head.currpic.length-2,config.s.head.currpic.length),16)%16+1;		var path=$isAdmin?imgPath:"http://static"+num+".photo.sina.com.cn/orignal/";		var diycss = {id:"diy_banner"};		diycss.styles = '.bannerLayout{background:url('+path+config.s.head.currpic+') '+		cssReapetConf[config.s.head.tiled]+' '+cssPositionXConf[config.s.head.align_h]+' '+cssPositionYConf[config.s.head.align_v]+';height:'+config.s.head.height+'px}';		dwCSS(diycss);	}	if(config.s.bg && config.s.bg.usepic == "1"){		//修改头图访问方式		var num=parseInt(config.s.bg.currpic.substring(config.s.bg.currpic.length-2,config.s.bg.currpic.length),16)%16+1;		var path=$isAdmin?imgPath:"http://static"+num+".photo.sina.com.cn/orignal/";		var diycss = {id:"diy_bg"};		diycss.styles = 'body{background-image:url('+path+config.s.bg.currpic+');background-repeat: '+		cssReapetConf[config.s.bg.tiled]+'; background-position:'+cssPositionXConf[config.s.bg.align_h]+' '+cssPositionYConf[config.s.bg.align_v]+'} .sinaBottom {background:transparent url()}';		dwCSS(diycss);	}}/** * 加载后端页面css * 1.不加载模板css * 2.只配置较少的css * 3.不加载自定义css */function loadMiniCss(){	fixConfig();	var cfg = config;	var cssVer = cfg.v.c+".css";	var dev = __dev_mode ? ".dev" : "";	dwCSS({url : $BASECSS + 'css/' + 'v5' + dev + '.css?'+cssVer});}/** *	模板各个分类的length */var themeLength=[30,30,30,20,20,20,22,30];/** * 随即模板(首页每次刷新都随即,其页面根据cookie随机) * @param {Object} themeNum */function randomTheme(themeNum){	var num,length=themeLength[themeNum-1],cookieTheme=getCookie("sina_blog_random_theme");	if(/index/.test($pageid)||cookieTheme==null){		num=getRandomNum(1,length-1);		setCookie("sina_blog_random_theme",num,2,"/","blog.sina.com.cn",false);	}else{		num=cookieTheme;	}	//避免因为cookie存储了超过范围的num而引起的乱码问题	if (num > themeLength[themeNum - 1]) {		num = themeLength[themeNum - 1] -1;	}	return [themeNum,num];}/** * 取得随即数,>=min,<=max * @param {Object} min * @param {Object} max */getRandomNum=function(min,max){	 return min+Math.floor(Math.random()*(max-min+1));  };/** * 保存cookie */function setCookie(sName,sValue,objHours,sPath,sDomain,bSecure){	var sCookie = sName + "=" + encodeURIComponent(sValue);    if (objHours) {		var date = new Date();		var ms = objHours * 3600 * 1000;		date.setTime(date.getTime() + ms);		sCookie += ";expires=" + date.toGMTString();	}    if (sPath) {		sCookie += ";path=" + sPath;	}    if (sDomain) {		sCookie += ";domain=" + sDomain;	}    if (bSecure) {		sCookie += ";secure";	}	document.cookie=sCookie;}/** * @author stan | chaoliang@staff.sina.com.cn * @desc load the js file base the usr login status & page */function loadResource(){	fixConfig();	if (__debug_mode) {		$import('Sina/Sina.js');		$import('Sina/debug.js');	}	if(__dev_mode) {		$import('Sina/Sina.js');		$import('Sina/io/io.js')		$import('Sina/system.base.js');

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -