📄 initialize.js
字号:
///////////////////////////////////
// ajax im v3.1 //
// AJAX Instant Messenger //
// Copyright (c) 2006-2007 //
// unwieldy studios/Joshua Gross //
// http://unwieldy.net/ajaxim/ //
// Do not remove this notice //
///////////////////////////////////
var overStatus=false;
window.onload = function() {
Windows.addObserver({ onResize: handleResize });
Windows.addObserver({ onClose: handleClose });
Windows.addObserver({ onMaximize: handleResize });
Windows.addObserver({ onMinimize: handleMinimize });
if(isDefined(window.onfocus) && isDefined(window.onblur) && isDefined(blinkerOn)) {
window.onfocus = function() { blinkerOn(false); };
window.onblur = function() { blinkerOn(true); };
} else {
document.onfocus = function() { blinkerOn(false); };
document.onblur = function() { blinkerOn(true); };
}
var windowScroll = WindowUtilities.getWindowScroll(); var pageSize = WindowUtilities.getPageSize();
var top = (pageSize.windowHeight - 529)/2; top += windowScroll.top; var left = (pageSize.windowWidth - 762)/2; left += windowScroll.left;
$('modal').style.top = top + 'px';
$('modal').style.left = left + 'px';
$('modal').style.display = 'block';
window.onresize = recenterModal;
clearInputs();
login_dialog();
};
function clearInputs() {
var formInputs = document.getElementsByTagName('input');
for (var i=0; i<formInputs.length; i++)
if(formInputs[i].type == 'text' || formInputs[i].type == 'password') formInputs[i].value = '';
}
function recenterModal(event) {
var windowScroll = WindowUtilities.getWindowScroll(); var pageSize = WindowUtilities.getPageSize();
var top = (pageSize.windowHeight - 529)/2; top += windowScroll.top; var left = (pageSize.windowWidth - 762)/2; left += windowScroll.left;
$('modal').style.top = top + 'px';
$('modal').style.left = left + 'px';
$('modal').style.display = 'block';
}
function getParent(src, tgName) {
while (src.parentNode != null) {
if (src.parentNode.tagName == tgName)
return src.parentNode;
src = src.parentNode;
}
return src;
}
function showHide(evt) {
if (!evt) { evt = window.event; }
if (document.all) { trgObj = evt.srcElement; }
else { trgObj = evt.target; }
if (!trgObj) { return; }
if (trgObj.id != 'statusList' && trgObj.id != 'fontsList' && trgObj.id != 'statusSettings'
&& trgObj.id != 'curStatus' && trgObj.parentNode.id != 'statusList' &&
trgObj.parentNode.id != 'fontsList' && trgObj.id != 'customMessage' &&
trgObj.parentNode.id != 'customMessage' && trgObj.id != 'emoticonList' &&
trgObj.className != 'emotIcon' && trgObj.id != 'fontSizeList' &&
trgObj.parentNode.id != 'fontSizeList' && trgObj.id != 'fontColorList' &&
trgObj.className != 'colorItem' &&
trgObj.className != 'tTable') {
document.getElementById('statusList').style.display = 'none';
document.getElementById('fontsList').style.display = 'none';
document.getElementById('emoticonList').style.display = 'none';
document.getElementById('fontSizeList').style.display = 'none';
document.getElementById('fontColorList').style.display = 'none';
return;
}
}
function handleResize(eventName, win) {
if(win.getId() == 'bl') {
sizeBuddyList();
} else if(win.getId().indexOf('_im') != -1) {
var mastername = win.getId().replace(/_im/, '');
$(mastername + '_rcvd').style.height = (win.getSize()['height'] - 103) + 'px';
$(mastername + '_rcvd').style.width = (win.getSize()['width'] - 10) + 'px';
$(mastername + '_toolbar').style.top = (win.getSize()['height'] - 73) + 'px';
$(mastername + '_toolbar').style.width = (win.getSize()['width'] - 10) + 'px';
$(mastername + '_setFont').style.top = (win.getSize()['height'] - 65) + 'px';
$(mastername + '_setFontSize').style.top = (win.getSize()['height'] - 65) + 'px';
$(mastername + '_setFontColor').style.top = (win.getSize()['height'] - 65) + 'px';
$(mastername + '_insertEmoticon').style.top = (win.getSize()['height'] - 65) + 'px';
$(mastername + '_sendBox').style.top = (win.getSize()['height'] - 45) + 'px';
$(mastername + '_sendBox').style.width = (win.getSize()['width'] - 16) + 'px';
var curIM = $(win.getId().replace(/_im/, '_rcvd'));
curIM.scrollTop = curIM.scrollHeight - curIM.clientHeight + 6;
}
}
function handleClose(eventName, win) {
if(win.getId().indexOf('_im') == -1) return;
leaveRoom(win.getId().replace(/_im/, ''));
var rcvdBox = $(win.getId().replace(/_im/, '') + '_rcvd');
if(imHistory == true) {
rcvdBox.innerHTML = '<span class="imHistory">' +
rcvdBox.innerHTML.replace(/\(Auto-Reply:\)/g, 'Auto-Reply:').replace(/<(?![Bb][Rr] ?\/?)([^>]+)>/ig, '') +
"</span>\n";
} else {
rcvdBox.innerHTML = '';
}
}
function handleMinimize(eventName, win) {
if(win.getId().indexOf('_im') == -1) return;
var curIM = $(win.getId().replace(/_im/, '_rcvd'));
curIM.scrollTop = curIM.scrollHeight - curIM.clientHeight + 6;
}
function sizeBuddyList() {
$('blContainer').style.height = (buddyListWin.getSize()['height'] - 95) + 'px';
$('blContainer').style.width = (buddyListWin.getSize()['width'] - 8) + 'px';
$('blBottomToolbar').style.width = (buddyListWin.getSize()['width'] - 8) + 'px';
$('blBottomToolbar').style.top = (buddyListWin.getSize()['height'] - 7) + 'px';
}
function toggleStatusList() {
if($('statusList').style.display == 'block') {
$('statusList').style.display = 'none';
if($('statusList').style.zIndex > Windows.maxZIndex) Windows.maxZIndex = $('statusList').style.zIndex;
} else {
$('statusList').style.left = parseInt(buddyListWin.getLocation()['left']) + $('statusSettings').offsetLeft + $('blTopToolbar').offsetLeft + 'px';
$('statusList').style.top = parseInt(buddyListWin.getLocation()['top']) + $('statusSettings').offsetTop + $('blTopToolbar').offsetTop + $('statusSettings').offsetHeight + 'px';
$('statusList').style.zIndex = Windows.maxZIndex + 20;
$('statusList').style.display = 'block';
}
}
function toggleFontList(win) {
$('emoticonList').style.display = 'none';
$('fontSizeList').style.display = 'none';
$('fontColorList').style.display = 'none';
if($('fontsList').style.display == 'block') {
$('fontsList').style.display = 'none';
toWin = '';
} else {
$('fontsList').style.left = (parseInt(IMWindows[win].getLocation()['left']) + parseInt($(win + '_setFont').offsetLeft)) + 'px';
$('fontsList').style.top = (parseInt(IMWindows[win].getLocation()['top']) + parseInt(IMWindows[win].getSize()['height']) - 46) + 'px';
$('fontsList').style.zIndex = Windows.maxZIndex + 20;
$('fontsList').style.display = 'block';
toWin = win;
}
}
function toggleFontSizeList(win) {
$('emoticonList').style.display = 'none';
$('fontsList').style.display = 'none';
$('fontColorList').style.display = 'none';
if($('fontSizeList').style.display == 'block') {
$('fontSizeList').style.display = 'none';
toWin = '';
} else {
$('fontSizeList').style.left = (parseInt(IMWindows[win].getLocation()['left']) + parseInt($(win + '_setFontSize').offsetLeft)) + 'px';
$('fontSizeList').style.top = (parseInt(IMWindows[win].getLocation()['top']) + parseInt(IMWindows[win].getSize()['height']) - 46) + 'px';
$('fontSizeList').style.zIndex = Windows.maxZIndex + 20;
$('fontSizeList').style.display = 'block';
toWin = win;
}
}
function toggleEmoticonList(win) {
$('fontsList').style.display = 'none';
$('fontSizeList').style.display = 'none';
$('fontColorList').style.display = 'none';
if($('emoticonList').style.display == 'block') {
$('emoticonList').style.display = 'none';
toWin = '';
} else {
$('emoticonList').style.left = (parseInt(IMWindows[win].getLocation()['left']) + parseInt($(win + '_insertEmoticon').offsetLeft)) + 'px';
$('emoticonList').style.top = (parseInt(IMWindows[win].getLocation()['top']) + parseInt(IMWindows[win].getSize()['height']) - 46) + 'px';
$('emoticonList').style.zIndex = Windows.maxZIndex + 20;
$('emoticonList').style.display = 'block';
toWin = win;
}
}
function toggleFontColorList(win) {
$('fontsList').style.display = 'none';
$('fontSizeList').style.display = 'none';
$('emoticonList').style.display = 'none';
if($('fontColorList').style.display == 'block') {
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -