📄 boot.js
字号:
$import('Sina/Class.js'); $import('Sina/events.js'); $import('Jobs.js'); } var page = $getPageId(); var cfg = config; var jsVer = cfg.v.j+".js"; var url = __dev_mode ? $BASE + "js/"+ __author + "/conf/" + page + ".dev.js" : $BASE + "js/" + page + ".js"; dwScript({url : url + "?" + jsVer});}function fixConfig (){ if (scope.fixed) { return; } scope.fixed = true; function fix(o, name, value){ if (o[name] == null || o[name] == -1) { o[name] = value; } } if(typeof config == 'undefined'){ config = { info : "cnf5 error!" }; config.s = typeof $conf == 'undefined' ? {} : $conf; } fix(config.s, "t", "1_1"); fix(config.s, "r", "0"); fix(config, "ad", "0"); fix(config, "v", {}); fix(config.v, "c", -1); fix(config.v, "j", -1); fix(config, "src", {x:{a:0,b:0,c:0,d:0},y:{a:0,b:0,c:0,d:0}});}function loadSource(){ loadCss(); loadResource();}function $E(id) { return typeof(id) == 'string' ? document.getElementById(id) : id;}/** * * @param {Object} elm * @param {Object} func * @param {Object} evType * @param {Object} useCapture */function $addEvent2(elm, func, evType, useCapture) { elm = $E(elm); 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; }};function $removeEvent2 (oElement, fHandler, sName) { var elm = $E(oElement); if ("function" != typeof fHandler) return; if (oElement.addEventListener) { oElement.removeEventListener(sName, fHandler, false); } else if (oElement.attachEvent) { oElement.detachEvent("on" + sName, fHandler); } fHandler[sName] = null;}/** * @desc add DOM onload Event */function addDOMLoadEvent(func) { if (!window.__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 (window.__load_timer) { clearInterval(window.__load_timer); window.__load_timer = null; } // execute each function in the stack in the order they were added for (var i=0;i < window.__load_events.length;i++) { window.__load_events[i](); } window.__load_events = null; }; // for Mozilla/Opera9 if (document.addEventListener) { document.addEventListener("DOMContentLoaded", init, false); } // for Internet Explorer /*@cc_on @*/ /*@if (@_win32) document.write("<scr"+"ipt id=__ie_onload defer src=javascript:void(0)><\/scr"+"ipt>"); var script = document.getElementById("__ie_onload"); script.onreadystatechange = function() { if (this.readyState == "complete") { init(); // call the onload handler } }; /*@end @*/ // for Safari if (/WebKit/i.test(navigator.userAgent)) { // sniff window.__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 window.__load_events = []; } // add function to event stack window.__load_events.push(func);}/** * */function $debug(){ if (__debug_mode) { Sina.debug.Trace.init(true, false); trace("author : " + __author); trace("dev_mode : " + __dev_mode); trace("----------------------------") }else{ window.traceMSGList = new Array(); window.trace = function (sMSG, sColor, sBGColor) { traceMSGList[traceMSGList.length] = { msg: sMSG, color: sColor, bcolor: sBGColor }; } traceError = function (){}; }}/** * */function loadCnf() { dwScript({ url : "http://blogcnfv5.sinajs.cn/cnf5?uid="+$uid+"&varname=config&.js", charset : "utf-8" }); // 如果是小页面,就不加载 Conf 数据了 if($uid != "0000000000"){ dwScript({ url : "http://uic.sinajs.cn/uic?type=nick&uids=" + $uid + "&varname=nick", charset : "UTF-8" }); } // 如果页面没定义 loadPromote 或者 loadPromote 设置为 true,载入推广位 JS; // 如果页面特别定义 loadPromote 为 false,则不载入,主要是针对小页面 if(typeof loadPromote == "undefined" || loadPromote == true){ dwScript({ url : "http://blogjs.sinajs.cn/v5js/blogPromote.conf.js?" + Math.random(), charset : "UTF-8" }); }}function renderBlog() { addDOMLoadEvent(function(){ $debug(); var mainInit = false; var runMain = function () { if(mainInit == false) { mainInit = true; $removeEvent2(window, runMain, "focus"); $removeEvent2(document, runMain, "mousemove"); $removeEvent2(document, runMain, "mouseover"); main(); } } if($pageid == "index" || $pageid == "indexM" || $pageid == "article" || $pageid == "articleM") { if (document.addEventListener || /msie/.test(navigator.userAgent.toLowerCase())) { $addEvent2(window, runMain, "focus"); $addEvent2(document, runMain, "mousemove"); $addEvent2(document, runMain, "mouseover"); } else { runMain(); } } else { runMain(); } });}/** * 返回相应的提示文案内容 * @method showError * @param {String} msgline 文案所在索引 * @param {String} ico 图标索引, 具体见windwoDialog * @param {Array} btn 按钮集合 * [ * //按钮1设置 * { * label: "xxxx", 按钮1文本,默认值“确定” * func: "xxxxx", 按钮1函数,默认为空 * focus: true, 按钮1为默认聚焦,默认第一个按钮聚焦 * css: "" 按钮1样式,默认样式为 * } * //如果有多个按钮,就用逗号分隔多个按钮对象的定义 * ] * @param {String} target 调用哪个窗口的showError 可选值 * @exception * showError("提示信息", "01"); * showError("提示信息", null, [{label: "确定按钮"}], "parent"); */function showError(msgline, ico, btn, target) { 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; } // 新的调用方法 if (typeof ico == "object" && ico != null) { ico.target = ico.target || window; ico.type = ico.type || 0; ico.ico = ico.ico || "03"; // 新增关闭按钮的显示与否 //ico.close = ico.close == null? true: ico.close; var str = ""; if(ico.type == 1) { str = msgline; } else { str = $SYSMSG[msgline || "00001"]; } ico.target.windowDialog.msgbox(str, { width: 300, user_btn: ico.btn, icon: ico.ico || "03", close: ico.close }); } // 兼容老调用方法 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.msgbox(msgline, { icon: ico || "03", width: 300, user_btn: btn }); } if (target == null) { showError(msgStr, ico, btn, "window") } }}/** * 用于整合作序systemMsg; */function $ExtendSystemMsg(info, override){ for(var i in info) $SYSMSG[i] = !!override == false ? info[i] : $SYSMSG[i];}//- start -loadCnf();function trace(){}try { document.execCommand("BackgroundImageCache", false, true);} catch (e) {}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -