📄 boot.js
字号:
js.parentNode.removeChild(js);
js = null;
clearTimeout(loadCheck); loadCheck = null;
opt && opt.success && opt.success();
};
js.onerror = function () {
js.onload = js.onreadystatechange = js.onerror = null;
js.src = "";
js.parentNode.removeChild(js);
js = null;
clearTimeout(loadCheck); loadCheck = null;
opt && opt.failure && opt.failure(404);
};
var startTime = new Date().getTime();
document.getElementsByTagName("head")[0].appendChild(js);
var loadCheck = setTimeout(function () {
opt && opt.failure && opt.failure(-1);
clearTimeout(loadCheck); loadCheck = null;
}, opt.timeout || 30000);
};
// @desc add DOM onload Event
var __addDOMLoadEvent = function(func){
var __load_events;
var __load_timer;
// var binded = false;
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);
// binded = true;
}
// for Internet Explorer
/*@cc_on @*/
/*@if (@_win32)
var domlen = document.getElementsByTagName("*").length;
var domnum = 0;
(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
// binded = true;
}
}, 10);
}
// for other browsers
window.onload = init;
// create event function stack
__load_events = [];
}
// add function to event stack
__load_events.push(func);
};
var addEvent = function(elm, func, evType, useCapture) {
var _el = $E(elm);
if(_el == null){ return; }
useCapture = useCapture || false;
if(typeof evType == "undefined"){
evType = "click";
}
if(_el.addEventListener){
_el.addEventListener(evType, func, useCapture);
return true;
}else if(_el.attachEvent){
var r = _el.attachEvent("on" + evType, func);
return true;
}else{
_el['on' + evType] = func;
}
};
var __addFocusEvent = function(fFocusFunction){
//TODO not available during the dev
if(window.excute != null && typeof window.excute == "function"){
excute();
excute = null;
}
};
if(__debug_mode){
document.write('<s'+'cript type="text/javascript" src="' + __js_domain + 'bind2/debug/debug_base.js"></s'+'cript>');
document.write('<s'+'cript type="text/javascript" src="' + __js_domain + 'bind2/debug/debug.js"></s'+'cript>');
}
window.__load_js = function(){
var url = "";
if(__debug_mode == true){
url = __js_domain + "bind2/index.php?product=" + scope.$PRODUCT_NAME + "&pageid=" + scope.$pageid
+ "&rnd=" + new Date().getTime();
}else{
// 取得 JS 版本号
var jsver = (typeof $_GLOBAL != "undefined" && $_GLOBAL.ver != null)
? $_GLOBAL.ver[scope.$PRODUCT_NAME] || "-1"
: "-1";
url = __js_domain + scope.$PRODUCT_NAME + "/" + scope.$pageid + ".js?"
+ jsver + ".js";
}
function render_page(){
__addDOMLoadEvent(main);
addEvent(document.body, __addFocusEvent, "focus");
addEvent(window, __addFocusEvent, "scroll");
addEvent(document.body, __addFocusEvent, "mousemove");
addEvent(document.body, __addFocusEvent, "mouseover");
}
function report_error(time){
var err_log_url = "http://control.blog.sina.com.cn/admin/article/ria_debug.php?type=js_err_log&page=" + scope.$PRODUCT_NAME
+ "_" + scope.$pageid + "&code=404&desc=&usetime=" + (new Date().getTime() - startTime);
new Image().src = err_log_url;
report_error = function (){};
}
if (scope.$pageid === "articletj") {
var pfpUrl = "http://pfp.sina.com.cn/blog/js/blogad.js";
//var pfpUrl = "http://blog.sina.com.cn/blog/js/blogad.js"
addScript(pfpUrl,{
charset:"gb2312"
});
}
if(__debug_mode == true){
window.__render_page = render_page;
document.write('<s'+'cript src="' + url +'" charset="utf-8"></s'+'cript>');
} else {
addScript(url, {
success : function(){
if(typeof main != "undefined"){
render_page();
} else {
report_error();
}
},
failure : function(code){
code = code?code:0;
report_error(code);
}
});
}
};
window.__render_page = function(){};
if (typeof scope.$setDomain == "undefined" || scope.$setDomain == true) {
document.domain = "sina.com.cn";
}
if(/\((iPhone|iPad|iPod)/i.test(navigator.userAgent) == false){return;}
document.addEventListener('mouseover', function(e){
var ele = e.target;
do{
if(ele.tagName == 'A'){
ele.target = '_self';
return;
}
if(ele.tagName == 'DIV'){return;}
ele = ele.parentNode;
}while(ele);
},false);
})();
scope.testboot={};//千万别删除,此代码测试发博文页面的Boot.js是否加载
})();
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -