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

📄 boot.js

📁 1602虽然只实现字符
💻 JS
📖 第 1 页 / 共 2 页
字号:
/** * @author stan | chaoliang@staff.sina.com.cn *///- debug -var __debug_mode = false;	//should be false//- dev -//- 1 : index.dev.js						|	引入小文件//- 2 : index.dev.js & import decode file	|	引入小文件,且讲每一个小文件压缩,现阶段只是去除空白节点//- 3 : index.php?dev_path=index.dev.js		|	引入实时合并的大文件,不做压缩//- 4 : index.js							|	引入online目录下合并好的文件,需要sh 5切换到上线状态var __dev_mode = 4;			//should be 4//- globel scopevar scope = scope ? scope : {};//- system message var $SYSMSG = {};$SYSMSG.extend = function (info, override){	for (var i in info) {		$SYSMSG[i] = !!override == false ? info[i] : $SYSMSG[i];	}};//- globalscope.$BASEJS  = "http://sjs.sinajs.cn/";scope.$BASECSS = "http://simg.sinajs.cn/";//scope.$BASECNF = "http://cnf5.sinajs.cn/";scope.$BASECNF = "http://blogcnfv5.sinajs.cn/";scope.imgPath  = "http://bj.static.photo.sina.com.cn/orignal/";//- var Boot = {	getCookie : function (name) {		var arr = document.cookie.match(new RegExp("(^| )" + name + "=([^;]*)(;|$)"));		if (arr != null) {			return unescape(arr[2]);		}		return null;	},	setCookie : function (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;	},	checkAuthor : function (){		var AuthorInfo = this.getCookie("SU");		scope.AuthorUID = AuthorInfo && AuthorInfo != "" ? AuthorInfo.match(/^([^:]*:){2}(\d{5,11})/)[2] : null;		$UID = scope.AuthorUID || null;		window.$isLogin = !!($UID);		if(typeof scope.$uid == "undefined") {			window.$isAdmin = false;		}		else {			window.$isAdmin = (scope.$uid == $UID);		}	},	dw : function (s) {		window.document.write(s);	},	dwSwf : function (_sName, _sSrc, _sWidth, _sHeight, _sMode, _aValue) {		var sValue = "", 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 + '" \/>';		}	},	dwScript : function(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 != "") {			this.dw("<script id='" + o.id + "' " + def + ">" + o.script + "<\/script>");		}		else if (o.url && o.url != "") {			this.dw("<script id='" + o.id + "' src='" + o.url + "' charset='" + o.charset + "' " + def + "><\/script>");		}		else {			throw new Error("no script content or url specified");		}	},	loadScript : function (url, callback, encode){  		var script = document.createElement('script');		script.type = 'text/javascript';		if (encode) {			script.charset = encode;		}		if (callback) {			script.onload = script.onreadystatechange = function(){				if (script.readyState && script.readyState != 'loaded' &&				script.readyState != 'complete') {					return;				}				script.onreadystatechange = script.onload = null;				callback();			};		}		script.src = url;		document.getElementsByTagName('head')[0].appendChild(script);  	},	dwCSS : function(o){		o.id = o.id || "";		if (o.url){			this.dw('<link id="' + o.id + '" rel="stylesheet" type="text/css" href="' + o.url + '" />');		}		else if (o.styles){			this.dw('<style id="' + o.id + '" >' + o.styles + '<\/style>');		}	},	$addEvent2:	function (elm, func, evType, useCapture) {		if (typeof useCapture == 'undefined') {			useCapture = false;		}		if (typeof evType == 'undefined') {			evType = 'click';		}		if (elm.addEventListener) {			elm.addEventListener(evType, func, useCapture);			return true;		}		else if (elm.attachEvent) {			var r = elm.attachEvent('on' + evType, func);			return true;		}		else {			elm['on' + evType] = func;		}	},	$removeEvent2 : function  (oElement, fHandler, sName) {		if (typeof fHandler != "function") {			return;		}		if (oElement.addEventListener) {			oElement.removeEventListener(sName, fHandler, false);		}		else if (oElement.attachEvent) {			oElement.detachEvent("on" + sName, fHandler);		}		fHandler[sName] = null;	},	loadCnf : function (){		scope.pid_map = {			"blog":   "0x00000001",			"icp" :   "0x02000002",			"photo":  "0x00000008",			"vblog":  "0x00000002",			"tiezi":  "0x00000040",			"quanzi": "0x00000004",			"music":  "0x00000400"		};		scope.cfgbak = typeof config != "undefined" ? config : {};		scope.p_key = scope.pid_map[scope.$PRODUCT_NAME];		if(scope.$loadconf && scope.$loadconf == true){			var cnf = scope.$BASECNF + "combine?uid=" + scope.$uid + "&varname=config&productid=" + scope.pid_map[scope.$PRODUCT_NAME] + "&common=1&private=1&component=1&product=1&.js";			this.dwScript({				url		: cnf,				charset : "utf-8"			});		}		// 如果是小页面,就不加载 Conf 数据了		/*		if(scope.$uid != "0000000000"){			this.dwScript({				url		: "http://uic.sinajs.cn/uic?type=nick&uids=" + scope.$uid + "&varname=nick",				charset : "UTF-8"			});		}		*/		// 如果页面没定义 loadPromote 或者 loadPromote 设置为 true,载入推广位 JS;		// 如果页面特别定义 loadPromote 为 false,则不载入,主要是针对小页面		if(typeof loadPromote == "undefined" || loadPromote == true){			this.dwScript({				url		: scope.$BASEJS  + "common/js/config.js",				charset : "UTF-8"			});		}		if (__debug_mode) {			this.dwScript({				url: scope.$BASEJS + "sina/trace.js"			});		}		else{			window.trace = function () {};		}	},	fixConfig : function(){		if(typeof config == "undefined"){			trace("conf 接口挂了", "#F00");			return false;		}		else{			if(scope.cfgbak && scope.cfgbak.common){				config.common = config.common || scope.cfgbak.common;			}			if (scope.cfgbak && scope.cfgbak.product) {				config.product = config.product || scope.cfgbak.product;			}			//2009-03-05 fix config by dongguang			if(config.common && typeof config.common.t == "undefined"){				if(config.common.head && scope.cfgbak.common.head){					if(config.common.head.constructor!=Object &&  scope.cfgbak.common.head.constructor==Object){						config.common.head=scope.cfgbak.common.head;					}				}				if(config.common.bg && scope.cfgbak.common.bg){					if(config.common.bg.constructor!=Object &&  scope.cfgbak.common.bg.constructor==Object){						config.common.bg=scope.cfgbak.common.bg;					}				}				if(typeof config.common.t == "undefined" && scope.cfgbak.common.t){					config.common.t = scope.cfgbak.common.t;				}			}			if (config.component) {				if (typeof config.component.c1 == "undefined") {					config.component = scope.cfgbak.component;				}			}			if(scope.$PRODUCT_NAME == "blog"){				if(typeof(config["private"]) != "undefined" && typeof(config["private"].adver) != "undefined"){					var _bak_adver = config["private"].adver || 0;				}				else{				}				this.fixObject(config,scope.cfgbak);				if(typeof(config["private"]) != "undefined" && typeof(config["private"].adver) != "undefined"){					config["private"].adver = _bak_adver;				}				else{				}			}			if(typeof config.common =="undefined" && typeof scope.cfgbak.common != "undefined"){				config.common = scope.cfgbak.common;				return false;			}			return true;		}	},    fixObject:function(srcObj,extendObj){		for(var name in extendObj){			if(srcObj[name]){				if(srcObj[name].constructor==Object){						if(this.objIsEmpty(srcObj[name])){							srcObj[name]=extendObj[name];						}else{							this.fixObject(srcObj[name],extendObj[name]);						}					}else{						if(srcObj[name]=="" && extendObj[name]!=""){							srcObj[name]=extendObj[name];						}						if(srcObj[name].constructor==Array && srcObj[name].length<=0){							srcObj[name]=extendObj[name];						}					}				}else{					srcObj[name]=extendObj[name];				}			}	},    objIsEmpty:function(obj){			var isTrue=true;			for(var name in obj){				isTrue=false;				break;			}			return isTrue;	},	/**	 * @desc add DOM onload Event	 */	addDOMLoadEvent : function (func) {		var __load_events;		var __load_timer;		if (!__load_events) {			var init = function () {				// quit if this function has already been called				if (arguments.callee.done) {					return;				}				// flag this function so we don't do the same thing twice				arguments.callee.done = true;				// kill the timer				if (__load_timer) {					clearInterval(__load_timer);					__load_timer = null;				}				// execute each function in the stack in the order they were added				for (var i=0;i < __load_events.length;i++) {					__load_events[i]();				}				__load_events = null;			};			// for Mozilla/Opera9			if (document.addEventListener) {				document.addEventListener("DOMContentLoaded", init, false);			}			// for Internet Explorer			/*@cc_on @*/			/*@if (@_win32)				var domlen = document.getElementsByTagName("*").length;				var domnum = 0;				(function () {

⌨️ 快捷键说明

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