?? boot.js
字號(hào):
(function () { if(domnum != domlen) { setTimeout(arguments.callee, 500); } else { setTimeout(init, 500); } domnum = domlen; })(); @end @*/ // for Safari if (/WebKit/i.test(navigator.userAgent)) { // sniff __load_timer = setInterval(function() { if (/loaded|complete/.test(document.readyState)) { init(); // call the onload handler } }, 10); } // for other browsers window.onload = init; // create event function stack __load_events = []; } // add function to event stack __load_events.push(func); }, $debug : function (){ if (__debug_mode) { //trace("dev_mode : " + __dev_mode); } }, loadCss : function(){ var cssVer = (typeof config != "undefined" ? config.product.c : "-1") + ".css"; this.dwCSS({url : scope.$BASECSS + 'common/css/default.css?' + cssVer}); this.dwCSS({url : scope.$BASECSS + scope.$PRODUCT_NAME+'/css/'+scope.$PRODUCT_NAME+'.css?' + cssVer}); if (this.fixConfig() == true) { trace(123); var cfg = config; var theme_id, tempArray = cfg.common.t.split("_"); theme_id = (cfg.common.r == 1) ?this.randomTheme(tempArray[0]) : cfg.common.t; this.dwCSS({url: scope.$BASECSS + 'tpl/' + theme_id + '/t.css?' + cssVer,id: "themeLink"}); this.writeDiyCss(); } }, loadMiniCss : function (){ var cssVer = (typeof config != "undefined" ? config.product.c : "-1") + ".css"; this.dwCSS({url : scope.$BASECSS + 'common/css/default.css?' + cssVer}); this.dwCSS({url : scope.$BASECSS + scope.$PRODUCT_NAME+'/css/'+scope.$PRODUCT_NAME+'.css?' + cssVer}); }, writeDiyCss:function (){// var path = ($isAdmin) ? scope.imgPath : "http://static.photo.sina.com.cn/orignal/", diycss = ""; var diycss = ""; if(config.common.head && config.common.head.usepic * 1 == 1 && typeof config.common.head.currpic != "undefined"){ //修改訪問(wèn)頭圖方式 var height=parseInt(config.common.head.height); var num=parseInt(config.common.head.currpic.substring(config.common.head.currpic.length-2,config.common.head.currpic.length),16)%16+1; var path=$isAdmin?scope.imgPath:"http://static"+num+".photo.sina.com.cn/orignal/";// alert("path="+path); var diycss = {id:"diy_banner"}; diycss.styles = '.headpic950{background:url('+path+config.common.head.currpic+') '+ scope.cssReapetConf[config.common.head.tiled] + ' ' + scope.cssPositionXConf[config.common.head.align_h] + ' ' + scope.cssPositionYConf[config.common.head.align_v] + ';height:' + height + 'px}.headpic100{height:' +height+ 'px}.ntoptitle{height:' + height + 'px}'; this.dwCSS(diycss); } if(config.common.bg && config.common.bg.usepic * 1 == 1 && typeof config.common.bg.currpic != "undefined"){ //背景圖向下移動(dòng)托盤高度的偏移量 var offsetY=scope.cssPositionYConf[config.common.bg.align_v]=="top"?"43px":scope.cssPositionYConf[config.common.bg.align_v]; //修改頭圖訪問(wèn)方式 var num=parseInt(config.common.bg.currpic.substring(config.common.bg.currpic.length-2,config.common.bg.currpic.length),16)%16+1; var path=$isAdmin?scope.imgPath:"http://static"+num+".photo.sina.com.cn/orignal/"; var diycss = {id:"diy_bg"}; diycss.styles = 'body{background-image:url(' + path + config.common.bg.currpic + ');background-repeat: ' + scope.cssReapetConf[config.common.bg.tiled] + '; background-position:' + scope.cssPositionXConf[config.common.bg.align_h] + ' ' + offsetY + '} .sinaBottom {background:transparent;background-image:none;}'; this.dwCSS(diycss); } }, getPageId : function (){ return scope.$pageid ; }, loadResource : function(){ this.fixConfig(); var page = this.getPageId(); var jsVer = (typeof config != "undefined" ? config.product.j : "-1") + ".js"; switch(__dev_mode){ case 1: var url = scope.$BASEJS + 'bind/import.php?url=conf/' + page + '.dev.js&product=' + scope.$PRODUCT_NAME + "&rnd=" + jsVer; break; case 2: var url = scope.$BASEJS + 'bind/import.php?url=conf/' + page + '.dev.js&product=' + scope.$PRODUCT_NAME + "&decode=1&rnd=" + jsVer; break; case 3: var url = scope.$BASEJS + "bind/index.php?dev_path=/" + scope.$PRODUCT_NAME + "/js/conf/" + page + ".dev.js&dev_prefix=/" + scope.$PRODUCT_NAME + "&" + jsVer; break; case 4: default: var url = scope.$BASEJS + scope.$PRODUCT_NAME + "/js/" + page + ".js?" + jsVer; break; } this.dwScript({url : url}); }, runMain : function () { if(this.mainInit == false) { this.mainInit = true; this.$removeEvent2(document.body, this.runMain, "focus"); this.$removeEvent2(window, this.runMain, "scroll"); this.$removeEvent2(document.body, this.runMain, "mousemove"); this.$removeEvent2(document.body, this.runMain, "mouseover"); if(typeof(exeute)=='function') exeute(); } }, start : function(){ try{ main();// this.$debug(); this.mainInit = false; if(scope.$PRODUCT_NAME == 'blog' && (scope.$pageid == "index" || scope.$pageid == "indexM" || scope.$pageid == "article" || scope.$pageid == "articleM") && ($MOZ || $IE)) { this.$addEvent2(document.body, this.runMain.bind2(this), "focus"); this.$addEvent2(window, this.runMain.bind2(this), "scroll"); this.$addEvent2(document.body, this.runMain.bind2(this), "mousemove"); this.$addEvent2(document.body, this.runMain.bind2(this), "mouseover"); } else { this.runMain(); } }catch(e){ trace(e); } }, renderPage : function () { this.addDOMLoadEvent(this.start.bind2(this)); }, randomTheme:function(themeNum){ var data = scope.theme_cnf[themeNum].data; var theme, length = data.length - 1,cookieTheme = this.getCookie("sina_blog_random_theme1"); if((/quanzi_index/.test(scope.$pageid) && scope.$PRODUCT_NAME == "icp") ||(/index/.test(scope.$pageid) && scope.$PRODUCT_NAME != "icp")|| cookieTheme == null){ theme = this.getRandomNum(0, length - 1); this.setCookie("sina_blog_random_theme1", theme, 2, "/", "sina.com.cn", false); }else{ theme = cookieTheme; } //個(gè)人中心首頁(yè)變化隨機(jī)模板,非首頁(yè)則不用變化 if (scope.$PRODUCT_NAME == "icp") { if (/wall/.test(scope.$pageid) || cookieTheme == null) { theme = this.getRandomNum(0, length - 1); this.setCookie("sina_blog_random_theme1", theme, 2, "/", "sina.com.cn", false); } else { return data[cookieTheme]; } } return data[theme]; }, getRandomNum:function(min, max){ return min + Math.floor(Math.random() * (max - min + 1)); }};Function.prototype.bind2 = function(object) { var __method = this; return function() { return __method.apply(object, arguments); };};//- navigatorscope._ua = navigator.userAgent.toLowerCase();scope.$IE = /msie/.test(scope._ua);scope.$OPERA = /opera/.test(scope._ua);scope.$MOZ = /gecko/.test(scope._ua);scope.$IE5 = /msie 5 /.test(scope._ua);scope.$IE55 = /msie 5.5/.test(scope._ua);scope.$IE6 = /msie 6/.test(scope._ua);scope.$IE7 = /msie 7/.test(scope._ua);scope.$SAFARI = /safari/.test(scope._ua);scope.$winXP=/windows nt 5.1/.test(scope._ua);scope.$winVista=/windows nt 6.0/.test(scope._ua);// 常用的判斷var $IE = scope.$IE, $MOZ = scope.$MOZ, $IE6 = scope.$IE6;// 預(yù)定義/** * 返回相應(yīng)的提示文案內(nèi)容 * @method showError * @param {String} msgline 文案所在索引 * @param {String} ico 圖標(biāo)索引, 具體見(jiàn)windwoDialog * @param {Array} btn 按鈕集合 * [ * //按鈕1設(shè)置 * { * label: "xxxx", 按鈕1文本,默認(rèn)值“確定” * func: "xxxxx", 按鈕1函數(shù),默認(rèn)為空 * focus: true, 按鈕1為默認(rèn)聚焦,默認(rèn)第一個(gè)按鈕聚焦 * css: "" 按鈕1樣式,默認(rèn)樣式為 * } * //如果有多個(gè)按鈕,就用逗號(hào)分隔多個(gè)按鈕對(duì)象的定義 * ] * @param {String} target 調(diào)用哪個(gè)窗口的showError 可選值 * @exception * showError("提示信息", "01"); * showError("提示信息", null, [{label: "確定按鈕"}], "parent"); */function showError(msgline, ico, btn, target) { // 如果是播客用戶被封殺,跳轉(zhuǎn)到播客 404 頁(yè) if(msgline == "A00008"){ if(scope.$PRODUCT_NAME == "vblog"){ window.location.href = "http:///you.video.sina.com.cn/web/notFound.php"; } } if(msgline == "00007" || msgline == "00008" || msgline == "00009" || msgline == "00010"){ var go2Url = { "00007": "http://blog.sina.com.cn/main_v5/ria/auto_signup.html?uid=" + $UID, "00008": "http://blog.sina.com.cn/main_v5/ria/auto_signup.html?uid=" + $UID, "00009": "http://control.blog.sina.com.cn/admin/reg/signup.php?pro=blog", "00010": "http://blog.sina.com.cn/main_v5/ria/notopen.html" }; window.location.href = go2Url[msgline]; return false; } // 新的調(diào)用方法 if (typeof ico == "object" && ico != null) { ico.target = ico.target || window; ico.type = ico.type || 0; ico.ico = ico.ico || "03"; // 新增關(guān)閉按鈕的顯示與否 //ico.close = ico.close == null? true: ico.close; var str = ""; if(ico.type == 1) { str = msgline; } else { str = $SYSMSG[msgline || "00001"]; } ico.target.windowDialog.alert(str,{ icon: ico.ico || "03", close: ico.close, btns : [ { text : "確定" } ] }); } // 兼容老調(diào)用方法 else { var msgStr = ""; if (target != "window") { msgStr = $SYSMSG[msgline]; msgStr = msgStr ? msgStr : $SYSMSG["00001"]; } if (target == "parent") { parent.showError(msgStr, ico, btn, "window"); } if (target == "window") { windowDialog.alert(msgline,{ icon: ico || "03", btns : [ { text : "確定" } ] }); } if (target == null) { showError(msgStr, ico, btn, "window"); } }}/** * @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){}//globleloadResource = Boot.loadResource.bind2(Boot);loadCss = Boot.loadCss.bind2(Boot);loadMiniCss = Boot.loadMiniCss.bind2(Boot);renderPage = Boot.renderPage.bind2(Boot);getCookie = Boot.getCookie.bind2(Boot);dw = Boot.dw;dwSwf = Boot.dwSwf;dwScript = Boot.dwScript;loadScript = Boot.loadScript;checkAuthor = Boot.checkAuthor.bind2(Boot);checkAuthor();if(typeof scope.$uid == "undefined") { // 如果頁(yè)面未輸出 $uid,先檢查地址中是否包含 uid 參數(shù) if (/\d+$/.test(location.href)) { var _uid = location.href.match(/(\d+)$/); uid = $uid = scope.$uid = (_uid != null) ? _uid[1] : "0000000000"; } else { uid = $uid = scope.$uid = "0000000000"; }}else{ uid = $uid = scope.$uid;}var $uidhex = window.parseInt($uid).toString(16);// 將不足8位數(shù)長(zhǎng)度的十六進(jìn)制 UID 進(jìn)行補(bǔ)全$uidhex = ($uidhex.length < 8) ? ("00000000" + $uidhex).match(/(\w{8})$/i)[1] : $uidhex; /** * 提供$setDomain變量,用來(lái)標(biāo)明是否需要設(shè)置domain * 如果不想設(shè)置domain,請(qǐng)?jiān)诟?pageid變量一起設(shè)置$setDomain = false; */if (typeof(scope.$setDomain) == "undefined" || scope.$setDomain == true) { document.domain = "sina.com.cn";}//- start -Boot.loadCnf();//config ={"common":{"t":"1_2","r":0,"head":[],"bg":[],"pageset":1,"invitationset":1},"private":{"cms":0,"blogsize":0,"ad":3,"sms":3},"component":{"c1":[901, 2,3,4, 12, 17],"c2":[],"x":2},"product":{"c":1,"j":1}, "tail":null};
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -