📄 ajax_im.js
字号:
} else {
error = 'The "Current Password" you entered is invalid.';
}
if(error.length > 0) {
$('changepass_error_msg').innerHTML = error;
}
}
function insertText(tti) {
$(toWin + '_sendBox').value += tti;
setTimeout("$('" + toWin + "_sendBox').focus();", 125);
toggleEmoticonList();
return false;
}
function setFont(fontname) {
$(toWin + '_sendBox').style.display = 'none';
$(toWin + '_sendBox').style.fontFamily = fontname + ', sans-serif';
$(toWin + '_setFont').innerHTML = fontname;
$(toWin + '_sendBox').style.display = 'block';
setTimeout("$('" + toWin + "_sendBox').focus();", 125);
toggleFontList('');
}
function setFontSize(size) {
$(toWin + '_sendBox').style.display = 'none';
$(toWin + '_sendBox').style.fontSize = size + 'px';
$(toWin + '_setFontSize').innerHTML = size;
$(toWin + '_sendBox').style.display = 'block';
setTimeout("$('" + toWin + "_sendBox').focus();", 125);
toggleFontSizeList('');
}
function setFontColor(color) {
$(toWin + '_sendBox').style.color = color;
$(toWin + '_setFontColorColor').style.backgroundColor = color;
setTimeout("$('" + toWin + "_sendBox').focus();", 125);
toggleFontColorList('');
}
function setStatus(status, away_msg) {
if(status == 1) { // away
isAway = 1;
awayMessage = away_msg;
$('curStatus').innerHTML = awayMessage.substring(0, 30) + (awayMessage.length > 30 ? '...' : '');
} else { // back
isAway = status; // 0 for avail, 99 for "friends only", 49 for "invisible"
awayMessage = '';
$('curStatus').innerHTML = away_msg;
}
$('statusList').style.display = 'none';
}
function customAway() {
$('curStatus').style.display = 'none';
$('customStatus').style.display = 'block';
$('customStatus').focus();
}
function processCustomAway(e) {
var asc = document.all ? event.keyCode : e.which;
if(asc == 13) {
isAway = 1;
awayMessage = $('customStatus').value;
$('curStatus').innerHTML = awayMessage.substring(0, 30) + (awayMessage.length > 30 ? '...' : '');
$('curStatus').style.display = 'block';
$('customStatus').style.display = 'none';
}
return asc != 13;
}
function toggleAudio() {
if(audioNotify == true) {
audioNotify = false;
$('toggleaudio').src = 'images/'+windowCSS+'/audio_off.png';
} else {
audioNotify = true;
$('toggleaudio').src = 'images/'+windowCSS+'/audio_on.png';
}
}
function toggleBold(name) {
$(name + '_sendBox').style.display = 'none'; // horrah weird Opera 9 input refresh!
if($(name + '_sendBox').style.fontWeight == '400') {
$(name + '_bold').src = 'images/' + windowCSS + '/bold_on.png';
$(name + '_sendBox').style.fontWeight = '700';
} else {
$(name + '_sendBox').style.fontWeight = '400';
$(name + '_bold').src = 'images/' + windowCSS + '/bold_off.png';
}
$(name + '_sendBox').style.display = 'block'; // horrah weird Opera 9 input refresh!
setTimeout("$('" + name + "_sendBox').focus();", 125);
}
function toggleItalic(name) {
$(name + '_sendBox').style.display = 'none'; // horrah weird Opera 9 input refresh!
if($(name + '_sendBox').style.fontStyle == 'normal') {
$(name + '_sendBox').style.fontStyle = 'italic';
$(name + '_italic').src = 'images/' + windowCSS + '/italic_on.png';
} else {
$(name + '_sendBox').style.fontStyle = 'normal';
$(name + '_italic').src = 'images/' + windowCSS + '/italic_off.png';
}
$(name + '_sendBox').style.display = 'block'; // horrah weird Opera 9 input refresh!
setTimeout("$('" + name + "_sendBox').focus();", 125);
}
function toggleUnderline(name) {
$(name + '_sendBox').style.display = 'none'; // horrah weird Opera 9 input refresh!
if($(name + '_sendBox').style.textDecoration == 'none') {
$(name + '_sendBox').style.textDecoration = 'underline';
$(name + '_underline').src = 'images/' + windowCSS + '/underline_on.png';
} else {
$(name + '_sendBox').style.textDecoration = 'none';
$(name + '_underline').src = 'images/' + windowCSS + '/underline_off.png';
}
$(name + '_sendBox').style.display = 'block'; // horrah weird Opera 9 input refresh!
setTimeout("$('" + name + "_sendBox').focus();", 125);
}
function titlebarBlink(name, message, alter) {
if(titlebarBlinker == false) {
document.title = defaultTitle;
return;
}
if(IMWindows[name].popup) {
IMWindows[name].popup.titlebarBlink(name, message, alter);
return;
}
if(alter == 0) {
document.title = name + '!';
blinkerTimer = setTimeout("titlebarBlink('"+name+"', '"+message+"', 1)", 1000);
} else if(alter == 1) {
document.title = '"' + message.substring(0, 10) + (message.length > 10 ? '...' : '') + '"';
blinkerTimer = setTimeout("titlebarBlink('"+name+"', '"+message+"', 2)", 1000);
} else if(alter == 2) {
document.title = defaultTitle;
blinkerTimer = setTimeout("titlebarBlink('"+name+"', '"+message+"', 0)", 1000);
}
}
function blinkerOn(onoff) {
if(onoff == true)
titlebarBlinker = true;
else
titlebarBlinker = false;
}
function buttonHover(el) {
var newsrc = el.src;
newsrc = newsrc.replace(/_hover/, '');
el.src = newsrc.replace(/\.png/, '_hover.png');
}
function buttonDown(el) {
el.src = el.src.replace(/_hover\.png/, '_down.png');
}
function buttonNormal(el) {
el.src = el.src.replace(/\_hover.png/, '.png').replace(/\_down.png/, '.png');
}
function browserWidth() {
if (self.innerWidth) {
return self.innerWidth;
} else if (document.documentElement && document.documentElement.clientWidth) {
return document.documentElement.clientWidth;
} else if (document.body) {
return document.body.clientWidth;
}
return 630;
}
function browserHeight() {
if (self.innerWidth) {
return self.innerHeight;
} else if (document.documentElement && document.documentElement.clientWidth) {
return document.documentElement.clientHeight;
} else if (document.body) {
return document.body.clientHeight;
}
return 470;
}
function randomNumber(max) {
return Math.round(Math.random()*max);
}
function checkEmailAddr( email ) {
var filter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
if (filter.test(email)) return true;
else return false;
}
function getElementsByCondition(condition, container) {
container = container||document;
var all = container.all||container.getElementsByTagName('*');
var arr = [];
for(var k=0;k<all.length;k++) {
var elm = all[k];
if(condition(elm,k))
arr[arr.length] = elm;
}
return arr;
}
function getElementsByClass(node, searchClass, tag) {
var classElements = [];
var els = node.getElementsByTagName(tag); // use "*" for all elements
var elsLen = els.length;
var pattern = new RegEx("\\b"+searchClass+"\\b");
for (i = 0, j = 0; i < elsLen; i++) {
if ( pattern.test(els[i].className) ) {
classElements[j] = els[i];
j++;
}
}
return classElements;
}
function isDefined(variable) {
return (typeof(variable) == "undefined") ? false : true;
}
function inArray(arr, value)
// Returns true if the passed value is found in the
// array. Returns false if it is not.
{
var i;
for (var group in arr) {
// Matches identical (===), not just similar (==).
for(i=0; i<arr[group].length; i++) {
if(arr[group][i] === value)
return true;
}
}
return false;
};
function addOption(selectbox,text,value) {
if(!isIE && !window.opera) {
selectbox.innerHTML += '<option value="' + value + '">' + text + '</option>';
} else {
var optn = document.createElement("OPTION");
optn.text = text;
optn.value = value;
var res = selectbox.options.add(optn);
}
}
function removeItems(array, item) {
var i = 0;
while (i < array.length) {
if (array[i] == item) {
array.splice(i, 1);
} else {
i++;
}
}
return array;
}
function removeAllOptions(selectbox) {
var i;
for(i=selectbox.options.length-1;i>=0;i--) {
selectbox.remove(i);
}
}
function removeOptions(selectbox, val) {
var i;
for(i=selectbox.options.length-1;i>=0;i--) {
if(selectbox.options[i].value === val)
selectbox.remove(i);
}
}
String.prototype.isAlphaNumeric = function() {return /^[a-z0-9_\d]+$/.test (this)};
function Debug() {
this.create = function() {
createIMWindow('Debug', 'Debug');
}
this.write = function(text) {
$('Debug_rcvd').innerHTML += text + "<br>\n";
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -