📄 webim.compressed.js
字号:
/** \u5fc5\u9009\u53c2\u6570 */
this._node = null;
this._property = [];
this._startvalue = [];
this._endingvalue = [];
this._suffixvalue = [];
this._fps = 0;
/** \u975e\u5fc5\u9009\u53c2\u6570 */
this._seconds = .5;
this._animation = transitions.simple;
this._func = {
end: function () {},
tween: function () {}
};
};
/**
* \u5bf9Tween\u7c7b\u7684\u9759\u6001\u5c01\u88c5,\u65b9\u4fbf\u8c03\u7528
* @param {Object} oNode \u9700\u8981\u52a8\u753b\u7684\u5bf9\u8c61
* @param {Array | String} oProperty \u8981\u64cd\u4f5c\u7684\u53c2\u6570
* @param {Array | String} oEndingValue \u76ee\u6807\u503c
* @param {Number} nSeconds \u8017\u65f6
* @param {String} sAnimation \u52a8\u753b\u7c7b\u578b
* @param {Object} oFunc \u56de\u8c03\u51fd\u6570
*/
function tween (oNode, oProperty, oEndingValue, nSeconds, sAnimation , oFunc) {
var instance = getInstance(oNode);
instance.start.apply(instance, arguments);
}
/**
* \u9759\u6001\u5c01\u88c5\u7684stop\u65b9\u6cd5
* @param {Object} oNode
*/
tween.stop = function (oNode) {
getInstance(oNode).stop();
};
/**
* \u9759\u6001\u5c01\u88c5\u7684isTween\u65b9\u6cd5,\u5224\u65ad\u52a8\u753b\u662f\u5426\u7ed3\u675f
* @param {Object} oNode
*/
tween.isTween = function (oNode) {
return !getInstance(oNode)._end;
};
regist("$tween", "Sina.utils.tween", tween, "FlashSoft", "\u52a8\u753b\u7c7b");
})();
/**
* \u628a\u5b57\u7b26\u4e32\u8f6c\u5316\u6210JSON\u683c\u5f0f
* @method Sina.string.toJson
* @param {String} sStr \u5b57\u7b26\u4e32
* @author FlashSoft | fangchao@staff.sina.com.cn
* @update 08.08.27
* @example
* var s = {data: 1};
* var o = Sina.string.toJson(s);
* alert(o.data);
* // \u8f93\u51fa\u7ed3\u679c\u4e3a1
*/
(function () {
var toJson;
toJson = function(sStr){
try {
var o = eval("(" + sStr + ")");
return o;
}
finally {
o = null;
}
};
regist("$toJson", "Sina.string.toJson", toJson, "FlashSoft", "\u628a\u5b57\u7b26\u4e32\u8f6c\u5316\u6210JSON\u683c\u5f0f");
})();
eval(regist.bindTo());
var node = {};
var channel = "";
var uid = "";
var click_timer = 0;
var click_uid = 0;
var getBrowser = function () {
var isOpera, isIE, isNc, isFF = false;
if(navigator.userAgent.indexOf("Opera") != -1) {
isOpera = true;
}else if(navigator.userAgent.indexOf("Firefox") != -1) {
isFF = true;
}else if(navigator.appName == "Microsoft Internet Explorer") {
isIE = true;
}else if(navigator.appName == "Netscape") {
isNc = true;
}
var browser = null;
if (isIE) {
browser = "IE";
}else if (isFF) {
browser = "FF";
}else if (isOpera) {
browser = "Opera";
}else {
browser = "Other";
}
return browser;
};
var createSwf = function (sUID) {
var browser = getBrowser();
Sina.util.Swf.Add("http://sjs.sinajs.cn/common/js/share_connect.swf", "webIM_Conn_Connect", "1", "1", "", "", "", {
allowScriptAccess: "always"
}).Init();
(function () {
node = $E("webIM_Conn_Connect");
if(node.register != null) {
node.register({
"channel_name": channel,
"type": "Client"}
);
setInterval(function () {
// console.log(check_win());
}, 1000);
}
else {
setTimeout(arguments.callee, 100);
}
})();
};
var check_win = function () {
try {
var winStatus = node.getVars(channel, "has_webim");
return winStatus;
}catch(e){
return false;
}
};
var open_webim_win = function (sUID) {
var d = new Date().valueOf();
if(click_uid == sUID) {
if(d - click_timer < 3000) {
// console.log(sUID + " \u8fd8\u5728\u51b7\u5374");
return;
}
else {
// console.log("\u5df2\u7ecf\u8fc7\u4e86\u51b7\u5374\u65f6\u95f4");
}
}
else {
// console.log("UID\u4e0d\u4e00\u6837,\u4e0d\u4f7f\u7528\u51b7\u5374\u65f6\u95f4");
}
click_uid = sUID;
click_timer = d;
var to_uid = sUID == 0? "": "&to_uid=" + sUID;
var url="http://web.uc.sina.com.cn/client/webim.html?my_uid=" + uid + to_uid;
window.open(url, "uc_win","width=600, height=425, titlebar=no, toolbar=no, menubar=no, scrollbars=no, resizable=no, location=yes, status=no, top=100, left=100");
};
var windowTitle = null;
var flashTitleFunc = function (o, s) {
var flashNum = 10;
var flashNN = 0;
function f() {
if(flashNN % 2) {
document.title = o;
}
else {
document.title = s;
}
flashNN ++;
if (flashNN > flashNum) {
document.title = s;
return;
}
setTimeout(f, 1000);
}
f();
};
var flashTitle = function () {
if(windowTitle == null) {
windowTitle = document.title;
}
flashTitleFunc("\u25cf\u6709\u804a\u5929\u4fe1\u606f\u25cf" + windowTitle, windowTitle);
};
window.flashTitle = flashTitle;
var msg_list = {};
var webIM = function (sUID) {
$E("webIM_Conn_Iframe").src = "http://web.uc.sina.com.cn/proxy/proxy.html?my_uid=" + sUID;
uid = sUID;
var browser = getBrowser();
channel = "_" + browser + sUID + "proxy";
createSwf(sUID);
};
webIM.msg = function (sUID) {
if(check_win() == false) {
open_webim_win(sUID);
webIM.hide_tip();
}
else {
var server_id = node.getServer(channel);
node.send(channel, server_id, "connect.uc_win_focus", sUID);
}
};
webIM.view_pop = function () {
if (check_win() == false) {
open_webim_win(0);
webIM.hide_tip();
}
else {
var server_id = node.getServer(channel);
node.send(channel, server_id, "connect.uc_win_focus", 0);
}
};
webIM.hide_tip = function () {
// 加上 try catch 保证节点不存在也不报错 L.Ming 2008.12.31
try {
$removeNode($E("web_im_pop_container"));
}
catch(e){}
};
/*
webIM.get_content({
type: "msg",
items: [{username:1147697897, msg:"aaa"}]
});
*/
webIM.get_content = function (oData) {
var type = oData.type;
var items = oData.items;
flashTitle();
if (type == "msg") {
for (var i = 0; i < items.length; i++) {
var sUID = items[i].username;
var sMSG = items[i].msg;
msg_list[sUID] = {
msg: sMSG
};
// \u83b7\u53d6\u6635\u79f0
node.call({
channel_name: channel,
loader_name: "get_nick",
url: "http://uic.sinajs.cn/uic?type=nick&uids=" + sUID,
callback_function: "webIM.conn_nick"
});
}
}
};
webIM.conn_nick = function (sData) {
try{
var oData = $toJson(sData);
}
catch(e){
var oData = {};
}
var sUID = 0;
var sNick = "\u65b0\u6d6a\u7f51\u53cb";
for(var key in oData) {
sUID = key;
sNick = oData[key];
}
var sMSG = msg_list[sUID].msg;
var oarg = {
uid: sUID,
nick: sNick,
content: sMSG,
callback: function(){
webIM.view_pop();
return;
}
}
webIM_Pop(oarg);
};
// webIM Pop\u90e8\u5206
/*=========================================================================================================*/
//\u914d\u7f6e\u53c2\u6570
//\u8ddd\u79bb\u5e95\u90e8\u4f4d\u7f6e\uff0c\u5355\u4f4d\u50cf\u7d20
var popBottom = 10;
var popRight = 10;
//\u6d6e\u51fa\u5c42\u663e\u793a\u65f6\u95f4\uff0c\u5355\u4f4d\u79d2
var delayTime = 10;
//\u52a8\u753b\u8fc7\u7a0b\u65f6\u95f4\uff0c\u5355\u4f4d\u79d2
var tweenTime = 1;
/*=========================================================================================================*/
/*
* \u5168\u5c40\u53d8\u91cf\u5217\u8868
*/
var IMUids = [];
var IMHtml1 = '<div class="im2Bg">\
<div class="im2"><span><a href="javascript:;" onclick="return false;">[<em>\u6253\u5f00\u804a\u5929</em>]</a></span><img src="http://sjs.sinajs.cn/common/images/im/icon.gif" /> <a href="javascript:;" onclick="return false;"><strong>\u6709{#count#}\u4e2a\u597d\u53cb\u548c\u4f60\u804a\u5929</strong></a></div>\
</div>';
var IMHtml2 = '<div class="box_bg">\
<div class="imBoxBg">\
<div class="conn">\
<div class="title">\
<a href="javascript:;" onclick="return false;" class="mar5"><img src="{#headphoto#}" /></a> <a href="#">{#nick#}</a> \u5bf9\u4f60\u8bf4\uff1a</a>\
</div>\
<div class="connBox">{#content#}</div>\
<div class="imbottom"><span><a href="javascript:;" onclick="return false;">[<em>\u6253\u5f00\u804a\u5929</em>]</a></span><img src="http://sjs.sinajs.cn/common/images/im/icon.gif" /> <a href="javascript:;" onclick="return false;"><strong>\u6709{#count#}\u4e2a\u597d\u53cb\u548c\u4f60\u804a\u5929</strong></a></div>\
</div>\
</div>\
</div>\
';
var popContainer;
var timeOut;
var lastCallBack;
var isFollowInIe6;
var isBig;
/*
* \u5168\u5c40\u53d8\u91cf\u65b0\u52a0\u5165uid
* @param {String} uid \u8f93\u5165uid
*/
function addUid(uid){
if(uid == 0){
return;
}
for (var i = 0, j = IMUids.length; i < j; i++) {
if (IMUids[i] == uid) {
return;
}
}
IMUids.push(uid);
}
/*
* \u83b7\u53d6\u76f8\u5e94\u7684html
* @param {String} nick \u5f53\u524d\u7528\u6237\u6635\u79f0
* @param {String} content \u7559\u8a00\u5185\u5bb9
*/
function getHtml(uid, nick, content){
var str = "";
if(nick){
str = IMHtml2.replace("{#content#}", content).replace("{#nick#}", nick).replace("{#count#}", IMUids.length).replace("{#headphoto#}","http://portrait"+(uid%8+1)+".sinaimg.cn/"+uid+"/blog/50");
}else{
str = IMHtml1.replace("{#count#}", IMUids.length);
}
return str;
}
//\u7531\u5927\u53d8\u5c0f
function big2small(){
var popString = getHtml();
popContainer.innerHTML = popString;
isBig = false;
}
/*
*
*/
function position4Ie6(dom){
setInterval(function(){
if(isBig){
$setStyle(popContainer, "top", $getScrollPos()[0]+$getPageSize()[3]-189-popBottom+"px");
}else{
$setStyle(popContainer, "top", $getScrollPos()[0]+$getPageSize()[3]-33-popBottom+"px");
}
},500);
}
/*
* \u7ed9\u5916\u9762\u8c03\u7528\u7684\u65b9\u6cd5
* @param {Object} opt \u7528\u6237\u7684\u4fe1\u606f
* @param {String} opt.uid \u5f53\u524d\u7528\u6237\u7684uid
* @param {String} opt.nick \u5f53\u524d\u7528\u6237\u7684\u540d\u79f0
* @param {String} opt.content \u804a\u5929\u4fe1\u606f
* @param {Function} opt.callback \u70b9\u51fb\u6d6e\u5c42\u6267\u884c\u51fd\u6570
*/
var webIM_Pop = function(opt){
if (!opt) {
return;
}
var option = {
uid: opt.uid ? opt.uid : 0,
nick: opt.nick ? opt.nick : "\u65b0\u6d6a\u7f51\u53cb",
content: opt.content ? opt.content : "",
callback: opt.callback ? opt.callback : function(){
}
};
addUid(option.uid);
var popString = getHtml(option.uid, option.nick, option.content);
if (!$E("web_im_pop_container")) {
popContainer = document.createElement("DIV");
popContainer.setAttribute("id", "web_im_pop_container");
$setStyle(popContainer, "position", "fixed");
$setStyle(popContainer, "bottom", "-60px");
$setStyle(popContainer, "right", popRight+"px");
$setStyle(popContainer, "opacity", "0");
$setStyle(popContainer, "cursor", "pointer");
document.body.appendChild(popContainer);
}
if(lastCallBack){
$removeEvent(popContainer,"click",lastCallBack);
}
$addEvent(popContainer,"click",option.callback);
lastCallBack = option.callback;
//\u706d\u4e86\u5c0f\u5e7f\u544a\uff0c\u5c45\u7136\u7528xp\u8fd9\u4e48\u5389\u5bb3\u7684id
if($E("xp")){
$removeNode($E("xp"));
}
popContainer.innerHTML = popString;
isBig = true;
if(window.navigator.userAgent.indexOf("MSIE 6.0")>-1){
$setStyle(popContainer, "position", "absolute");
}
/**
* \u5bf9Tween\u7c7b\u7684\u9759\u6001\u5c01\u88c5,\u65b9\u4fbf\u8c03\u7528
* @param {Object} oNode \u9700\u8981\u52a8\u753b\u7684\u5bf9\u8c61
* @pvaram {Array | String} oProperty \u8981\u64cd\u4f5c\u7684\u53c2\u6570
* @param {Array | String} oEndingValue \u76ee\u6807\u503c
* @param {Number} nSeconds \
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -