📄 webim.compressed.js
字号:
(function () {
var __register_name_space__ = true;
var Sina = {};
if (regist == null) {
var regist = function(){};
(function(){
/**
* \u901a\u8fc7\u589e\u52a0\u4ee5\u4e0b\u4e24\u4e2a\u53d8\u91cf\u5230\u95ed\u5305\u5b9e\u73b0Sina\u7684\u79c1\u6709\u5316
* var __register_name_space__ = true;
* var Sina = {};
*/
var funList = {};
function registerNamespace(sNameSpace, oFunc, oOption){
var currentPart;
try {
if (__register_name_space__ == true) {
var rootObject = Sina;
}
else {
var rootObject = window;
}
}
catch (e) {
var rootObject = window;
}
var namespaceParts = sNameSpace.split('.');
try {
if (__register_name_space__ == true) {
if (namespaceParts[0] == "Sina") {
namespaceParts.shift();
}
}
}
catch (e) {
}
for (var i = 0; i < namespaceParts.length; i++) {
currentPart = namespaceParts[i];
if (!rootObject[currentPart]) {
rootObject[currentPart] = {};
}
rootObject = rootObject[currentPart];
}
}
function registerFuncLink(sShortName, sNameSpace, oFunc, oOption){
var currentPart;
try {
if (__register_name_space__ == true) {
var rootObject = Sina;
}
else {
var rootObject = window;
}
}
catch (e) {
var rootObject = window;
}
funList[sNameSpace] = {
name: sShortName,
space: sNameSpace,
func: oFunc,
option: oOption
};
var namespaceParts = sNameSpace.split('.');
try {
if (__register_name_space__ == true) {
if (namespaceParts[0] == "Sina") {
namespaceParts.shift();
}
}
}
catch (e) {
}
for (var i = 0; i < namespaceParts.length; i++) {
currentPart = namespaceParts[i];
if (i == namespaceParts.length - 1) {
rootObject[currentPart] = oFunc;
return;
}
rootObject = rootObject[currentPart];
}
}
function regist_proto(sShortName, sNameSpace, oFunc, oOption){
if (sShortName == null) {
alert("regist_proto[\u51fd\u6570\u7684\u77ed\u540d\u5c1a\u672a\u4f20\u5165]\n\n\u4f8b\u5982\n'$getStyle'");
return;
}
if (sNameSpace == null) {
alert("regist_proto[\u51fd\u6570\u7684\u547d\u540d\u7a7a\u95f4\u5c1a\u672a\u4f20\u5165]\n\n\u4f8b\u5982\n'Sina.dom.getStyle'");
return;
}
if (oFunc == null) {
alert("regist_proto[\u5177\u4f53\u51fd\u6570\u5c1a\u672a\u5b9e\u73b0]\n\n\u4f8b\u5982\nfunction (el) {return el.className;}");
return;
}
// \u521b\u5efa\u547d\u540d\u7a7a\u95f4
registerNamespace(sNameSpace);
// \u628a\u51fd\u6570\u7ed1\u5b9a\u5230\u76f8\u5e94\u7684\u547d\u540d\u7a7a\u95f4\u4ee5\u53ca\u5185\u90e8\u7684\u5b58\u50a8\u5806\u6808
registerFuncLink(sShortName, sNameSpace, oFunc, oOption);
}
regist_proto.bindTo = function(){
var a = [];
var o = funList;
var n, i;
for (i in o) {
n = o[i];
a[a.length] = "var " + o[i].name + "=" + o[i].space + ";";
}
return a.join("");
};
regist_proto.getFuncList = function(){
};
regist = regist_proto;
})();
}
/**
* @author {FlashSoft}
* @update {xs} 2008-8-11
*/
(function () {
var _ua = navigator.userAgent.toLowerCase();
/** \u662f\u5426\u4e3aIE\u6d4f\u89c8\u5668 */
var ie = /msie/.test(_ua);
/** \u662f\u5426\u4e3aIE6\u6d4f\u89c8\u5668 */
var ie6 = /msie 6/.test(_ua);
/** \u662f\u5426\u4e3aIE7\u6d4f\u89c8\u5668 */
var ie7 = /msie 7/.test(_ua);
/** \u662f\u5426\u4e3aFireFox\u6d4f\u89c8\u5668 */
var ff = /gecko/.test(_ua);
/** \u662f\u5426\u4e3aFireFox 3\u6d4f\u89c8\u5668 */
var ff3 = /firefox\/3/.test(_ua);
/** \u662f\u5426\u4e3aSafari\u6d4f\u89c8\u5668 */
var safari = /safari/.test(_ua);
/** \u662f\u5426\u4e3aOpera\u6d4f\u89c8\u5668 */
var opera = /opera/.test(_ua);
regist("$ie", "Sina.base.ie", ie, "FlashSoft", "\u5224\u65ad\u6d4f\u89c8\u5668\u662f\u5426\u662fIE");
regist("$ie6", "Sina.base.ie6", ie6, "FlashSoft", "\u5224\u65ad\u6d4f\u89c8\u5668\u662f\u5426\u662fIE6");
regist("$ie7", "Sina.base.ie7", ie7, "FlashSoft", "\u5224\u65ad\u6d4f\u89c8\u5668\u662f\u5426\u662fIE7");
regist("$ff", "Sina.base.ff", ff, "FlashSoft", "\u5224\u65ad\u6d4f\u89c8\u5668\u662f\u5426\u662fFireFox");
regist("$ff3", "Sina.base.ff3", ff, "xs", "\u5224\u65ad\u6d4f\u89c8\u5668\u662f\u5426\u662fFireFox3.0");
regist("$safari", "Sina.base.safari", safari, "FlashSoft", "\u5224\u65ad\u6d4f\u89c8\u5668\u662f\u5426\u662fSafari");
regist("$opera", "Sina.base.opera", opera, "FlashSoft", "\u5224\u65ad\u6d4f\u89c8\u5668\u662f\u5426\u662fOpera");
})();
/**
* \u8fd4\u56de\u6307\u5b9a\u540d\u79f0\u5bf9\u8c61
* @param {String} oID \u5bf9\u8c61\u7684\u540d\u5b57
* @return {Element} \u5bf9\u8c61\u7684DOM\u8282\u70b9
* @author FlashSoft | fangchao@staff.sina.com.cn
* @example
* Sina.base.get(document.body);
* Sina.base.get("testInput");
*/
(function () {
var get = function (oID) {
var node = typeof oID == "string"? document.getElementById(oID): oID;
if(node != null)return node;
//else console.log("\u5bf9\u8c61: " + oID + " \u4e0d\u5b58\u5728");
};
regist("$E", "Sina.base.get", get, "FlashSoft", "\u83b7\u53d6\u6307\u5b9a\u540d\u5b57\u7684\u5bf9\u8c61");
})();
/**
* \u6839\u636etagname\u521b\u5efa\u6307\u5b9a\u7c7b\u578b\u7684\u8282\u70b9\u5143\u7d20
* @param {String} tagName \u5236\u5b9a\u7684\u8282\u70b9\u7c7b\u578b
* @return {Element} \u65b0\u5efa\u7684DOM\u8282\u70b9
* @author xs | zhenhua1@staff.sina.com.cn
* @example
* Sina.base.create("div");
*/
(function () {
var create = function (sID) {
return typeof sID == "string"? document.createElement(sID): null;
};
regist("$C", "Sina.dom.create", create, "xs", "\u6839\u636etagname\u521b\u5efa\u6307\u5b9a\u7c7b\u578b\u7684\u8282\u70b9\u5143\u7d20");
})();
/**
* \u8bbe\u5b9a\u6307\u5b9a\u8282\u70b9\u7684\u6837\u5f0f
* @method Sina.dom.setStyle
* @param {HTMLElement | Document} el \u8282\u70b9\u5bf9\u8c61
* @param {String} property \u6837\u5f0f\u540d
* @param {String} val \u6837\u5f0f\u503c
* @author FlashSoft | fangchao@staff.sina.com.cn
* @update 08.02.23
* @example
* Sina.dom.setStyle(document.body, "backgroundColor", "red");
*/
(function () {
var setStyle;
if (Sina.base.ie) {
setStyle = function (el, property, val) {
switch (property) {
case "opacity":
el.style.filter = "alpha(opacity=" + (val * 100) + ")";
if (!el.currentStyle || !el.currentStyle.hasLayout) {
el.style.zoom = 1;
}
break;
case "float":
property = "styleFloat";
default:
el.style[property] = val;
}
};
}
else {
setStyle = function(el, property, val) {
if (property == "float") {
property = "cssFloat";
}
el.style[property] = val;
};
}
regist("$setStyle", "Sina.dom.setStyle", setStyle, "FlashSoft", "\u8bbe\u5b9a\u6307\u5b9a\u8282\u70b9\u7684\u6837\u5f0f");
})();
/**
* \u83b7\u53d6\u6307\u5b9a\u8282\u70b9\u7684\u6837\u5f0f
* @method Sina.dom.getStyle
* @param {HTMLElement | Document} oElement \u8282\u70b9\u5bf9\u8c61
* @param {String} sProperty \u6837\u5f0f\u540d
* @return {String} \u6307\u5b9a\u6837\u5f0f\u7684\u503c
* @author FlashSoft | fangchao@staff.sina.com.cn
* @update 08.07.29
* @example
* Sina.dom.getStyle(document.body, "left");
*/
(function () {
var getStyle;
if (Sina.base.ie) {
getStyle = function(oElement, sProperty){
var val;
try{
switch (sProperty) {
// \u900f\u660e\u5ea6
case "opacity":
val = 100;
try {
val = oElement.filters['DXImageTransform.Microsoft.Alpha'].opacity;
}
catch (e) {
try {
val = oElement.filters('alpha').opacity;
}
catch (e) {
}
}
return parseFloat(val / 100);
// \u6d6e\u52a8
case "float":
sProperty = "styleFloat";
default:
val = oElement.currentStyle ? oElement.currentStyle[sProperty] : null;
return (oElement.style[sProperty] || val);
}
}
finally {
val = null;
}
};
}
else {
getStyle = function (oElement, sProperty) {
var computed;
try {
// \u6d6e\u52a8
if(sProperty == "float") {
sProperty = "cssFloat";
}
// \u83b7\u53d6\u96c6\u5408
computed = document.defaultView.getComputedStyle(oElement, "");
return oElement.style[sProperty] || computed? computed[sProperty]: null;
}
finally {
computed = null;
}
};
}
regist("$getStyle", "Sina.dom.getStyle", getStyle, "FlashSoft", "\u83b7\u53d6\u6307\u5b9a\u8282\u70b9\u7684\u6837\u5f0f");
})();
/**
* \u5220\u9664\u6307\u5b9a\u540d\u79f0\u7684\u8282\u70b9
* @param {String | Element} oNode \u8282\u70b9\u7684\u540d\u79f0\u6216\u8005\u8282\u70b9\u5bf9\u8c61
* @author FlashSoft | fangchao@staff.sina.com.cn
* @example
* Sina.dom.removeNode("testInput");
* Sina.dom.removeNode(document.getElementsByTagName("a")[0]);
*/
(function () {
var removeNode = function (oNode) {
oNode = Sina.base.get(oNode);
oNode.parentNode.removeChild(oNode);
};
regist("$removeNode", "Sina.dom.removeNode", removeNode, "FlashSoft", "\u5220\u9664\u6307\u5b9a\u540d\u79f0\u7684\u8282\u70b9");
})();
/**
* \u53d6\u5f97\u9875\u9762\u7684\u6eda\u52a8\u6761\u4f4d\u7f6e
* @method Sina.dom.getScrollPos
* @return {Array} \u6eda\u52a8\u6761\u5c45\u9876 \u5c45\u5de6\u503c
* @author fangchao@staff.sina.com.cn
* @update 08.02.13
*/
(function () {
var getScrollPos = function(oDocument) {
oDocument = oDocument || document;
return [
Math.max(oDocument.documentElement.scrollTop, oDocument.body.scrollTop),
Math.max(oDocument.documentElement.scrollLeft, oDocument.body.scrollLeft)
];
};
regist("$getScrollPos", "Sina.dom.getScrollPos", getScrollPos, "FlashSoft", "\u53d6\u5f97\u9875\u9762\u7684\u6eda\u52a8\u6761\u4f4d\u7f6e");
})();
/**
* @author {FlashSoft}
*/
/**
* \u83b7\u53d6\u9875\u9762\u7684\u5e26\u6eda\u52a8\u6761\u7684\u9ad8\u5bbd\u4ee5\u53ca\u663e\u793a\u533a\u57df\u9ad8\u5bbd
* @private
* @return {Array} \u5206\u522b\u4e3a\u7a97\u53e3\u5e26\u6eda\u52a8\u6761\u5bbd\u9ad8\u8ddf\u663e\u793a\u533a\u57df\u5bbd\u9ad8
* @author FlashSoft | fangchao@staff.sina.com.cn
*/
(function () {
var getPageSize = function (){
var xScroll, yScroll, arrayPageSize, windowWidth, windowHeight, pageHeight, pageWidth;
if (window.innerHeight && window.scrollMaxY) {
xScroll = window.innerWidth + window.scrollMaxX;
yScroll = window.innerHeight + window.scrollMaxY;
}
else if (document.body.scrollHeight > document.body.offsetHeight) { // all but Explorer Mac
xScroll = document.body.scrollWidth;
yScroll = document.body.scrollHeight;
}
else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
xScroll = document.body.offsetWidth;
yScroll = document.body.offsetHeight;
}
var windowWidth, windowHeight;
if (self.innerHeight) { // all except Explorer
windowWidth = self.innerWidth;
windowHeight = self.innerHeight;
}
else
if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
windowWidth = document.documentElement.clientWidth;
windowHeight = document.documentElement.clientHeight;
}
else
if (document.body) { // other Explorers
windowWidth = document.body.clientWidth;
windowHeight = document.body.clientHeight;
}
// for small pages with total height less then height of the viewport
if (yScroll < windowHeight) {
pageHeight = windowHeight;
}
else {
pageHeight = yScroll;
}
// for small pages with total width less then width of the viewport
if (xScroll < windowWidth) {
pageWidth = windowWidth;
}
else {
pageWidth = xScroll;
}
arrayPageSize = new Array(pageWidth, pageHeight, windowWidth, windowHeight);
return arrayPageSize;
};
regist("$getPageSize", "Sina.dom.getPageSize", getPageSize, "FlashSoft", "\u83b7\u53d6\u9875\u9762\u7684\u5e26\u6eda\u52a8\u6761\u7684\u9ad8\u5bbd\u4ee5\u53ca\u663e\u793a\u533a\u57df\u9ad8\u5bbd");
})();
/**
* \u5728\u6307\u5b9a\u8282\u70b9\u4e0a\u7ed1\u5b9a\u76f8\u5e94\u7684\u4e8b\u4ef6
* @method Sina.events.addEvent
* @param {String} oElement \u9700\u8981\u7ed1\u5b9a\u7684\u8282\u70b9ID
* @param {String} sType \u4e8b\u4ef6\u7684\u7c7b\u578b\u5982:click, mouseover
* @param {Function} fHandler \u4e8b\u4ef6\u53d1\u751f\u65f6\u76f8\u5e94\u7684\u51fd\u6570
* @update 08.07.29
* @author Stan | chaoliang@staff.sina.com.cn
* FlashSoft | fangchao@staff.sina.com.cn
* @example
* //\u9f20\u6807\u70b9\u51fbtestEle\u5219alert "clicked"
* Sina.events.addEvent("testEle", "click", function () {
* alert("clicked");
* });
*/
(function () {
var addEvent;
if(Sina.base.ie) {
addEvent = function (oElement, sType, fHandler) {
oElement = Sina.base.get(oElement);
oElement.attachEvent("on" + sType, fHandler);
};
}
else {
addEvent = function (oElement, sType, fHandler, bUseCapture) {
oElement = Sina.base.get(oElement);
if(bUseCapture == "undefined") {
bUseCapture = false;
}
oElement.addEventListener(sType, fHandler, bUseCapture);
};
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -