Initial commit

Esse commit está contido em:
ajaximrpg
2013-12-11 12:26:49 -08:00
commit b2bc222a31
283 arquivos alterados com 14256 adições e 3 exclusões
+457
Ver Arquivo
@@ -0,0 +1,457 @@
///////////////////////////////////
// ajax im 3.41 //
// AJAX Instant Messenger //
// Copyright (c) 2006-2008 //
// http://www.ajaxim.com/ //
// Do not remove this notice //
///////////////////////////////////
/**
* Object to hold all Admin Windows as variables
*
* @author Joshua Gross
**/
var AdminWindows = {
/**
* Display window to allow admin to search for users
*
* @author Joshua Gross
**/
userSearch: function() {
var userSearchWin;
if($('admin-userSearch')) {
Windows.getWindow('admin-userSearch').toFront();
return;
}
userSearchWin = new Window({id: 'admin-userSearch', className: "dialog", width: 250, height: 110, resizable: true,
title: Languages.get('admin-admin') + ' - ' + Languages.get('admin-userSearch'), draggable: true, closable: true, maximizable: false, minimizable: true, detachable: false,
minWidth: 250, minHeight: 110, showEffectOptions: {duration: 0}, hideEffectOptions: {duration: 0}});
userSearchWin.setConstraint(true, {left: 0, right: 0, top: 0, bottom: 0});
userSearchWin.getContent().innerHTML = '<div class="dialog_info" style="padding:3px;">' + Languages.get('admin-chooseByAndSearch') + '</div> \
<div id="admin-userSearchBox"> \
<div style="display:block;float:left;margin-right:24px;padding:4px 0 0 5px;">' + Languages.get('admin-searchType') + ':</div> \
<select id="admin-searchType" name="adminSearchType" style="font-family:Tahoma,Verdana,Arial,sans-serif;"> \
<option selected="selected" value="username">' + Languages.get('username') + '</option> \
<option value="email">' + Languages.get('email') + '</option> \
</select><br /> \
<div style="display:block;float:left;margin-right:46px;padding:4px 0 0 5px;">' + Languages.get('search') + ':</div> \
<input type="text" id="admin-search" name="adminSearch" style="width:110px;" onkeypress="handleInput(event, function() { Admin.findUser($(\'admin-searchType\').value, $(\'admin-search\').value); })" /> \
<div id="admin-searchButtons">' +
ButtonCtl.create(Languages.get('search'), 'Admin.findUser($(\'admin-searchType\').value, $(\'admin-search\').value);') +
ButtonCtl.create(Languages.get('cancel'), 'Windows.close(\'admin-userSearch\');') +
'</div>';
$('admin-searchButtons').setStyle({position: 'absolute',
top: '105px',
left: '32px'});
userSearchWin.setDestroyOnClose();
userSearchWin.showCenter();
},
/**
* On admin window resize, fix elements within window
*
* @arguments
* win - window to be resized
*
* @author Joshua Gross
**/
handleResize: function(win) {
switch(win.getId().replace(/admin-/, '')) {
case 'userSearch':
if($('admin-userSearchResults')) {
$('admin-userSearchResults').setStyle({'width': win.getSize()['width'] + 'px'});
$('admin-userSearchResults').parentNode.setStyle({'width': win.getSize()['width'] + 'px'});
$('admin-userExecFunctions').setStyle({'left': ((win.getSize()['width'] - $('admin-userExecFunctions').getWidth()) / 2) + 'px'});
}
$('admin-searchButtons').setStyle({'left': ((win.getSize()['width'] - $('admin-searchButtons').getWidth()) / 2) + 'px'});
break;
}
}
}
/**
* Handle all Admin requests
*
* @author Joshua Gross
**/
var Admin = {
// current selected user from the user-search-results list
selectedUser: null,
/**
* Finds and displays users searched for by the admin
*
* @author Joshua Gross
* @update Benjamin Hutchins
* - User's email be displayed.
**/
findUser: function(searchType, search) {
var xhConn = new XHConn();
xhConn.connect(adminPingTo, "POST", "call=search&by="+searchType+"&for="+search, function(xh) {
if(xh.responseText == 'access_denied') return Admin.noAccess();
if($('admin-userSearchResults'))
$('admin-userSearchResults').parentNode.parentNode.removeChild($('admin-userSearchResults').parentNode);
var results = xh.responseText.parseJSON();
var resultsTable = '<table id="admin-userSearchResults" style="text-align:center;" class="listNotSelected">';
resultsTable += '<thead><tr style="cursor:pointer;"><th>' + Languages.get('username') + '</th><th>' + Languages.get('email') + '</th><th>' + Languages.get('admin-lastKnownIP') + '</th><th>' + Languages.get('admin-lastActive') + '</th><th>' + Languages.get('admin-status') + '</th><th>' + Languages.get('admin-banned') + '</th><th>' + Languages.get('admin-admin') + '</th></tr></thead><tbody>';
for(var i=0; i<results.length; i++) {
var lastActiveObj = new Date(results[i].lastActive*1000);
var lastActive = lastActiveObj.getMonth() + '/' + lastActiveObj.getDate() + '/' + lastActiveObj.getFullYear() + ' @ ' + lastActiveObj.getHours() + ':' + lastActiveObj.getMinutes();
resultsTable += '<tr style="cursor:pointer;" onmouseover="Admin.findUserListHover(this);" onmouseout="Admin.findUserListDefault(this);" onclick="Admin.findUserListSelect(this);">' +
'<td>' + results[i].username + '</td><td>' + results[i].email + '</td><td>' + results[i].lastKnownIP + '</td>' +
'<td>' + lastActive + '</td>' + '<td>' + results[i].currentStatus + '</td><td>' + results[i].banned + '</td>' +
'<td>' + results[i].admin + '</td></tr>';
}
resultsTable += '</tbody></table>';
var userSearch = Windows.getWindow('admin-userSearch')
userSearch.setSize(500, 232);
userSearch.options.minWidth = 500;
userSearch.options.minHeight = 232;
userSearch.showCenter(false);
userSearch.getContent().innerHTML += resultsTable;
if(!$('admin-userExecFunctions')) {
userSearch.getContent().innerHTML += '<div id="admin-userExecFunctions">' +
ButtonCtl.create(Languages.get('admin-kick'), 'Admin.kickUser(Admin.selectedUser.getElementsByTagName(\'td\')[0].innerHTML);') +
ButtonCtl.create(Languages.get('admin-ban'), 'Admin.banUser(Admin.selectedUser.getElementsByTagName(\'td\')[0].innerHTML);', 'admin-banButton') +
ButtonCtl.create(Languages.get('admin-makeAdmin'), 'Admin.toggleAdmin(Admin.selectedUser.getElementsByTagName(\'td\')[0].innerHTML);', 'admin-makeAdminButton') +
'</div>';
$('admin-userExecFunctions').setStyle({position: 'absolute',
top: '195px',
left: '83px'});
}
$('admin-searchButtons').innerHTML = ButtonCtl.create(Languages.get('searchAgain'), 'Admin.findUser($(\'admin-searchType\').value, $(\'admin-search\').value);') +
ButtonCtl.create(Languages.get('cancel'), 'Windows.close(\'admin-userSearch\');');
$('admin-searchButtons').setStyle({position: 'absolute',
top: '225px',
left: '130px'});
var t = new ScrollableTable($('admin-userSearchResults'), 100, 500);
t = new SortableTable($('admin-userSearchResults'));
$('admin-searchType').value = searchType;
$('admin-search').value = search;
});
},
/**
* Sends request to server to ban user
*
* @arguments
* user - user to be banned
*
* @author Joshua Gross
**/
banUser: function(user) {
var xhConn = new XHConn();
xhConn.connect(adminPingTo, "POST", "call=ban&user="+user, function(xh) {
if(xh.responseText == 'access_denied') return Admin.noAccess();
Admin.selectedUser.getElementsByTagName('td')[4].innerHTML = xh.responseText;
$('admin-banButton').innerHTML = (xh.responseText=='true'?Languages.get('admin-unban'):Languages.get('admin-ban'));
});
},
/**
* Sends request to server to kick a user offline
*
* @arguments
* user - user to be kicked
*
* @author Joshua Gross
**/
kickUser: function(user) {
var xhConn = new XHConn();
xhConn.connect(adminPingTo, "POST", "call=kick&user="+user, function(xh) {
if(xh.responseText == 'access_denied') return Admin.noAccess();
Admin.selectedUser.getElementsByTagName('td')[3].innerHTML = '0';
});
},
/**
* Toggles a user's admin rights
*
* @arguments
* user - user to be toggled
*
* @author Joshua Gross
**/
toggleAdmin: function(user) {
var xhConn = new XHConn();
xhConn.connect(adminPingTo, "POST", "call=admin&user="+user, function(xh) {
if(xh.responseText == 'access_denied') return Admin.noAccess();
Admin.selectedUser.getElementsByTagName('td')[5].innerHTML = xh.responseText;
$('admin-makeAdminButton').innerHTML = (xh.responseText=='true'?Languages.get('admin-removeAdmin'):Languages.get('admin-makeAdmin'));
});
},
/**
* Add hover effect to an element
*
* @arguments
* el - element to have effect added
*
* @author Joshua Gross
**/
findUserListHover: function(el) {
Element.addClassName(el, 'listHover').removeClassName('listSelected').removeClassName('listNotSelected');
},
/**
* Remove hover effect added by Admin.findUserListHover
*
* @arguments
* el - element to have effect removed
*
* @author Joshua Gross
**/
findUserListDefault: function(el) {
if(el != Admin.selectedUser) Element.addClassName(el, 'listNotSelected').removeClassName('listSelected').removeClassName('listHover');
else Element.addClassName(el, 'listSelected').removeClassName('listNotSelected').removeClassName('listHover');
},
/**
* Change Admin.selectedUser to the user clicked by the admin
*
* @arguments
* el - list element to turn into selected
*
* @author Joshua Gross
**/
findUserListSelect: function(el) {
if(Admin.selectedUser) Element.addClassName(Admin.selectedUser, 'listNotSelected').removeClassName('listSelected').removeClassName('listHover');
Element.addClassName(el, 'listSelected').removeClassName('listNotSelected').removeClassName('listHover');
Admin.selectedUser = el;
if(el.getElementsByTagName('td')[4].innerHTML == 'true')
$('admin-banButton').innerHTML = Languages.get('admin-unban');
else
$('admin-banButton').innerHTML = Languages.get('admin-ban');
if(el.getElementsByTagName('td')[5].innerHTML == 'true')
$('admin-makeAdminButton').innerHTML = Languages.get('admin-removeAdmin');
else
$('admin-makeAdminButton').innerHTML = Languages.get('admin-makeAdmin');
}
};
/**
*
* Scrollable HTML table
* http://www.webtoolkit.info/
*
**/
function ScrollableTable (tableEl, tableHeight, tableWidth) {
this.initIEengine = function () {
this.containerEl.style.overflowY = 'auto';
if (this.tableEl.parentElement.clientHeight - this.tableEl.offsetHeight < 0) {
this.tableEl.style.width = this.newWidth - this.scrollWidth +'px';
} else {
this.containerEl.style.overflowY = 'hidden';
this.tableEl.style.width = this.newWidth +'px';
}
if (this.thead) {
var trs = this.thead.getElementsByTagName('tr');
for (x=0; x<trs.length; x++) {
trs[x].style.position ='relative';
trs[x].style.setExpression("top", "this.parentElement.parentElement.parentElement.scrollTop + 'px'");
}
}
if (this.tfoot) {
var trs = this.tfoot.getElementsByTagName('tr');
for (x=0; x<trs.length; x++) {
trs[x].style.position ='relative';
trs[x].style.setExpression("bottom", "(this.parentElement.parentElement.offsetHeight - this.parentElement.parentElement.parentElement.clientHeight - this.parentElement.parentElement.parentElement.scrollTop) + 'px'");
}
}
eval("window.attachEvent('onresize', function () { document.getElementById('" + this.tableEl.id + "').style.visibility = 'hidden'; document.getElementById('" + this.tableEl.id + "').style.visibility = 'visible'; } )");
};
this.initFFengine = function () {
this.containerEl.style.overflow = 'hidden';
this.tableEl.style.width = this.newWidth + 'px';
var headHeight = (this.thead) ? this.thead.clientHeight : 0;
var footHeight = (this.tfoot) ? this.tfoot.clientHeight : 0;
var bodyHeight = this.tbody.clientHeight;
var trs = this.tbody.getElementsByTagName('tr');
if (bodyHeight >= (this.newHeight - (headHeight + footHeight))) {
this.tbody.style.overflow = '-moz-scrollbars-vertical';
for (x=0; x<trs.length; x++) {
var tds = trs[x].getElementsByTagName('td');
tds[tds.length-1].style.paddingRight += this.scrollWidth + 'px';
}
} else {
this.tbody.style.overflow = '-moz-scrollbars-none';
}
var cellSpacing = (this.tableEl.offsetHeight - (this.tbody.clientHeight + headHeight + footHeight)) / 4;
this.tbody.style.height = (this.newHeight - (headHeight + cellSpacing * 2) - (footHeight + cellSpacing * 2)) + 'px';
};
this.tableEl = tableEl;
this.scrollWidth = 16;
this.originalHeight = this.tableEl.clientHeight;
this.originalWidth = this.tableEl.clientWidth;
this.newHeight = parseInt(tableHeight);
this.newWidth = tableWidth ? parseInt(tableWidth) : this.originalWidth;
this.tableEl.style.height = 'auto';
this.tableEl.removeAttribute('height');
this.containerEl = this.tableEl.parentNode.insertBefore(document.createElement('div'), this.tableEl);
this.containerEl.appendChild(this.tableEl);
this.containerEl.style.height = this.newHeight + 'px';
this.containerEl.style.width = this.newWidth + 'px';
var thead = this.tableEl.getElementsByTagName('thead');
this.thead = (thead[0]) ? thead[0] : null;
var tfoot = this.tableEl.getElementsByTagName('tfoot');
this.tfoot = (tfoot[0]) ? tfoot[0] : null;
var tbody = this.tableEl.getElementsByTagName('tbody');
this.tbody = (tbody[0]) ? tbody[0] : null;
if (!this.tbody) return;
if (document.all && document.getElementById && !window.opera) this.initIEengine();
if (!document.all && document.getElementById && !window.opera) this.initFFengine();
}
/**
*
* Sortable HTML table
* http://www.webtoolkit.info/
*
**/
function SortableTable (tableEl) {
this.tbody = tableEl.getElementsByTagName('tbody');
this.thead = tableEl.getElementsByTagName('thead');
this.tfoot = tableEl.getElementsByTagName('tfoot');
this.getInnerText = function (el) {
if (typeof(el.textContent) != 'undefined') return el.textContent;
if (typeof(el.innerText) != 'undefined') return el.innerText;
if (typeof(el.innerHTML) == 'string') return el.innerHTML.replace(/<[^<>]+>/g,'');
}
this.getParent = function (el, pTagName) {
if (el == null) return null;
else if (el.nodeType == 1 && el.tagName.toLowerCase() == pTagName.toLowerCase())
return el;
else
return this.getParent(el.parentNode, pTagName);
}
this.sort = function (cell) {
var column = cell.cellIndex;
var itm = this.getInnerText(this.tbody[0].rows[1].cells[column]);
var sortfn = this.sortCaseInsensitive;
if (itm.match(/\d\d[-]+\d\d[-]+\d\d\d\d/)) sortfn = this.sortDate; // date format mm-dd-yyyy
if (itm.replace(/^\s+|\s+$/g,"").match(/^[\d\.]+$/)) sortfn = this.sortNumeric;
this.sortColumnIndex = column;
var newRows = new Array();
for (j = 0; j < this.tbody[0].rows.length; j++) {
newRows[j] = this.tbody[0].rows[j];
}
newRows.sort(sortfn);
if (cell.getAttribute("sortdir") == 'down') {
newRows.reverse();
cell.setAttribute('sortdir','up');
} else {
cell.setAttribute('sortdir','down');
}
for (i=0;i<newRows.length;i++) {
this.tbody[0].appendChild(newRows[i]);
}
}
this.sortCaseInsensitive = function(a,b) {
aa = thisObject.getInnerText(a.cells[thisObject.sortColumnIndex]).toLowerCase();
bb = thisObject.getInnerText(b.cells[thisObject.sortColumnIndex]).toLowerCase();
if (aa==bb) return 0;
if (aa<bb) return -1;
return 1;
}
this.sortDate = function(a,b) {
aa = thisObject.getInnerText(a.cells[thisObject.sortColumnIndex]);
bb = thisObject.getInnerText(b.cells[thisObject.sortColumnIndex]);
date1 = aa.substr(6,4)+aa.substr(3,2)+aa.substr(0,2);
date2 = bb.substr(6,4)+bb.substr(3,2)+bb.substr(0,2);
if (date1==date2) return 0;
if (date1<date2) return -1;
return 1;
}
this.sortNumeric = function(a,b) {
aa = parseFloat(thisObject.getInnerText(a.cells[thisObject.sortColumnIndex]));
if (isNaN(aa)) aa = 0;
bb = parseFloat(thisObject.getInnerText(b.cells[thisObject.sortColumnIndex]));
if (isNaN(bb)) bb = 0;
return aa-bb;
}
// define variables
var thisObject = this;
var sortSection = this.thead;
// constructor actions
if (!(this.tbody && this.tbody[0].rows && this.tbody[0].rows.length > 0)) return;
if (sortSection && sortSection[0].rows && sortSection[0].rows.length > 0) {
var sortRow = sortSection[0].rows[0];
} else {
return;
}
for (var i=0; i<sortRow.cells.length; i++) {
sortRow.cells[i].sTable = this;
sortRow.cells[i].onclick = function () {
this.sTable.sort(this);
return false;
}
}
}
+479
Ver Arquivo
@@ -0,0 +1,479 @@
///////////////////////////////////
// ajax im 3.41 //
// AJAX Instant Messenger //
// Copyright (c) 2006-2008 //
// http://www.ajaxim.com/ //
// Do not remove this notice //
///////////////////////////////////
// See config.js for configuration options //
/**
* Global variables used through the script
**/
var user='';
var pass='';
var curSelected='';
var loggedIn=false;
var titlebarBlinker=false;
var defaultTitle = document.title=(siteName.length>0?siteName:document.title);
var blinkerTimer;
var pingTimer;
var newWin, newWinRcvd;
var windowButtons;
var smilies = [];
var soundManager;
/**
* Before the window is 'unloaded', confirm the user wants to leave
*
* @author Joshua Gross
**/
window.onbeforeunload = function(event) {
event = event || window.event;
if(event && loggedIn) {
var text = Languages.get('onunload');
event.returnValue = text;
window.onbeforeunload = function() { };
return text;
}
}
/**
* After all content and images for the web page is loaded,
* run some functions
*
* @author Joshua Gross
**/
window.onload = function() {
Windows.addObserver({ onResize: IM.handleResize });
Windows.addObserver({ onClose: IM.handleClose });
Windows.addObserver({ onMaximize: IM.handleResize });
Windows.addObserver({ onMinimize: IM.handleMinimize });
// initialize the sound manager
soundManager = new SoundManager();
soundManager.onload = function() {
soundManager.createSound({id: 'msg_in', url: './sounds/msg_in.mp3', autoLoad: true});
soundManager.createSound({id: 'msg_out', url: './sounds/msg_out.mp3', autoLoad: true});
soundManager.play('msg_out');
};
soundManager.beginDelayedInit();
// attach event
// before window is unloaded, remove sound manager
Element.observe(window, 'beforeunload', soundManager.destruct);
// center modal
setTimeout(function() { recenterModal(null); }, 1000);
// on window resize, recenter modal
Event.observe(window, 'resize', recenterModal);
// on window unload, logout the user
Event.observe(window, 'unload', function() { if(loggedIn) System.logout(); });
// clear all inputs
clearInputs();
// replace status images with theme-based images
$('statusList').getElementsBySelector('img').each(function(el) {
el.src = el.src.replace(/images/g, 'themes/' + theme);
});
// initialize Context Menus
Context.loaded();
// hook mousedown for status list
var dOMD = (document.onmousedown ? document.onmousedown : new Function());
document.onmousedown = window.onmousedown = function(e) {
showHide(e);
dOMD(e);
}
// if the user wants to disable register, hide the button
if (!allowNewUsers) {
$$('.registerObject').each(function(el) {
el.remove();
});
// then fix the buttons for login
$('login_dialog_links').setStyle({width:'190px'});
}
// show login
Dialogs.login();
};
/**
* After all content for the web page is loaded,
* load some more stuff.
*
* @author Joshua Gross
**/
Event.onReady(function() {
var getEmoteHTML = new XHConn();
getEmoteHTML.connect('themes/' + theme +'/emoticons/emoticons.html', 'GET', '', function(xh) {
document.body.innerHTML += xh.responseText;
var getEmoteJS = new XHConn();
getEmoteJS.connect('themes/' + theme +'/emoticons/emoticons.js', 'GET', '', function(xh) {
window.smilies = xh.responseText.parseJSON();
});
});
// load language file
var s = document.createElement('script');
s.src = 'languages/' + languageOptions[0][0] + '/lang.js?' + (new Date()).getTime();
s.type = 'text/javascript';
document.getElementsByTagName('head').item(0).appendChild(s);
// if lingo is enabled
if (useLingo) {
// load the lingo file
var l = document.createElement('script');
l.src = 'languages/' + languageOptions[0][0] + '/lingo.js?' + (new Date()).getTime();
l.type = 'text/javascript';
document.getElementsByTagName('head').item(0).appendChild(l);
}
// if there is more than one language installed on the server, show them as options
if(languageOptions.length > 1) {
for(var i=0; i<languageOptions.length; i++)
$('languageList').innerHTML += '<a href="#" onclick="Languages.load(\'' + languageOptions[i][0] + '\');return false;">' + languageOptions[i][1] + '</a> | ';
$('languageList').innerHTML = $('languageList').innerHTML.substring(0, $('languageList').innerHTML.length - 3);
}
});
/**
* Clear the value of input elements
*
* @author Joshua Gross
**/
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 = '';
}
/**
* Centers the login/register/forgot password modal
*
* @arguments
* event - passed by browser
*
* @author Joshua Gross
**/
function recenterModal(event) {
var windowScroll = WindowUtilities.getWindowScroll();
var pageSize = WindowUtilities.getPageSize();
var top = (pageSize.windowHeight - $('modal').getHeight())/2;
top += windowScroll.top;
var left = (pageSize.windowWidth - $('modal').getWidth())/2;
left += windowScroll.left;
$('modal').setStyle({top: top + 'px', left: left + 'px', display: 'block'});
}
/**
* This function is ran everytime the mouse is clicked
*
* @arguments
* event - passed by browser
*
* @author Joshua Gross
* @update Benjamin Hutchins
**/
function showHide(event) {
var target;
event = event || window.event;
if (document.all) {
target = event.srcElement;
} else {
target = event.target;
}
if (!target) {return;}
if (loggedIn &&
target.id != 'statusList' &&
target.id != 'fontsList' &&
target.id != 'statusSettings' &&
target.id != 'curStatus' &&
target.parentNode.id != 'statusList' &&
target.parentNode.id != 'fontsList' &&
target.id != 'customMessage' &&
target.parentNode.id != 'customMessage' &&
target.id != 'emoticonList' &&
target.className != 'emotIcon' &&
target.id != 'fontSizeList' &&
target.parentNode.id != 'fontSizeList' &&
target.id != 'fontColorList' &&
target.className != 'colorItem' &&
target.className != 'tTable'
) // to put it simply, if you did not click on a list
{
Element.setStyle($('statusList'), {'display': 'none'});
Element.setStyle($('emoticonList'), {'display': 'none'});
Element.setStyle($('fontsList'), {'display': 'none'});
Element.setStyle($('fontSizeList'), {'display': 'none'});
Element.setStyle($('fontColorList'), {'display': 'none'});
return;
}
}
/**
* Will check for the press of the 'Return'/'Enter' key,
* if found, func() is ran. If it is not, then func2, if supplied,
* and if it is a function, is ran.
*
* @arguments
* event - supplied by browser
* func - (function) run if Enter is pressed
* func2 - (function) run if Enter is not pressed
*
* @author Benjamin Hutchins
**/
function handleInput(event, func, func2) {
event = event || event.window;
var asc = document.all ? event.keyCode : event.which;
if(asc == 13) {
func();
return false;
}
if (typeof func2 == 'function')
func2();
return true;
}
/**
* Will run through passed variable 'text' and fix
* it's regExpression faults.
*
* @author Joshua Gross
* @return fromatted 'text'
**/
function regExpEscape(text) {
if (!arguments.callee.sRE) {
var specials = [
'/', '.', '*', '+', '?', '|',
'(', ')', '[', ']', '{', '}', '\\'
];
arguments.callee.sRE = new RegExp(
'(\\' + specials.join('|\\') + ')', 'g'
);
}
return text.replace(arguments.callee.sRE, '\\$1');
}
/**
* Wrapper to scroll down within an element
*
* @arguments
* id - element to scroll down within
*
* @author Joshua Gross
**/
function scrollToBottom(id) {
$(id).scrollTop = $(id).scrollHeight - $(id).clientHeight;
}
/**
* Strip out whitespace on then sides of 'text'
*
* @author Joshua Gross
* @return trimmed 'text'
**/
function trim(text) {
if(text == null) return null;
return text.replace(/^[ \t]+|[ \t]+$/g, "");
}
/**
* Toggle audio on and off
*
* @author Joshua Gross
**/
function toggleAudio() {
if(audioNotify == true) {
audioNotify = false;
$('toggleaudio').src = 'themes/'+theme+'/window/audio_off.png';
} else {
audioNotify = true;
$('toggleaudio').src = 'themes/'+theme+'/window/audio_on.png';
}
}
/**
* Make a window title and the web page "blink"
*
* @arguments
* name - username to retrieve IM Window
* message - message to show 'nlinking'
* alter - which step of blinking are we in
* chatroom - is this a chatroom
*
* @author Joshua Gross
**/
function titlebarBlink(name, message, alter, chatroom) {
if(titlebarBlinker == false) {
document.title = defaultTitle;
return;
}
if(chatroom == 0 && IM.windows[name].detached) {
IM.windows[name].popup.titlebarBlink(name, message, alter);
return;
}
if(alter == 0) {
document.title = name + '!';
blinkerTimer = setTimeout("titlebarBlink('"+name+"', '"+message+"', 1, "+chatroom+")", 1000);
} else if(alter == 1) {
document.title = '"' + message.substring(0, 10) + (message.length > 10 ? '...' : '') + '"';
blinkerTimer = setTimeout("titlebarBlink('"+name+"', '"+message+"', 2, "+chatroom+")", 1000);
} else if(alter == 2) {
document.title = defaultTitle;
blinkerTimer = setTimeout("titlebarBlink('"+name+"', '"+message+"', 0, "+chatroom+")", 1000);
}
}
/**
* Toggle the variable 'titlebarBlinker' to true/false
*
* @author Joshua Gross
* @update Benjamin Hutchins
**/
function blinkerOn(onoff) {
titlebarBlinker = (onoff == true ? true : false);
}
/**
* Button effects for browsers without ":" support
*
* @arguments
* el - element to affect
*
* @author Joshua Gross
**/
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');
}
/**
* Check to see is an email is valid
*
* @arguments
* email - email to check
*
* @author Joshua Gross
* @updated Benjamin Hutchins
* @return true if email is valid, false otherwise
**/
function checkEmailAddr(email) {
var filter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
return filter.test(email);
}
/**
* Generates a random string
*
* @arguments
* length - length of string to be created
*
* @author Joshua Gross
* @return random string
**/
function randomString(length) {
var chars = "abcdefghijklmnopqrstuvwxyz1234567890";
var pass = "";
var charLength = chars.length;
for(x=0;x<length;x++) {
i = Math.floor(Math.random() * charLength);
pass += chars.charAt(i);
}
return pass;
}
/**
* in_array for javascript
*
* @arguments
* arr - array to be searched
* value - item to search for
*
* @author Joshua Gross
* @return true if 'value' is found in 'arr', false if it is not.
**/
function inArray(arr, value) {
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;
};
Array.prototype.inArray = function(search_term) { // Adds inArray to all arrays
var i = this.length;
if (i > 0) {
do {
if (this[i] === search_term) {
return true;
}
} while (i--);
}
return false;
}
/**
* Checks to see if a string is alphanumeric (only letters and numbers)
*
* @author Joshua Gross
* @return true if string is alphanumeric, false otherwise
**/
String.prototype.isAlphaNumeric = function() {return /^[A-Za-z0-9_\d]+$/.test (this)};
/**
* Load the theme stylesheet
**/
var loadCSS = document.createElement("link");
loadCSS.setAttribute("rel", "stylesheet")
loadCSS.setAttribute("type", "text/css")
loadCSS.setAttribute("href", 'themes/' + theme + '/style.css')
if (typeof loadCSS != "undefined")
document.getElementsByTagName("head")[0].appendChild(loadCSS);
+47
Ver Arquivo
@@ -0,0 +1,47 @@
///////////////////////////////////
// ajax im 3.41 //
// AJAX Instant Messenger //
// Copyright (c) 2006-2008 //
// http://www.ajaxim.com/ //
// Do not remove this notice //
///////////////////////////////////
/**
* Class to handle browser requests
**/
var Browser = {
/**
* Get the width of the client browser
*
* @author Joshua Gross
* @return Document Width
**/
width: function() {
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;
},
/**
* Get the height of the client browser
*
* @author Joshua Gross
* @return Document Height
**/
height: function() {
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;
}
};
+428
Ver Arquivo
@@ -0,0 +1,428 @@
///////////////////////////////////
// ajax im 3.41 //
// AJAX Instant Messenger //
// Copyright (c) 2006-2008 //
// http://www.ajaxim.com/ //
// Do not remove this notice //
///////////////////////////////////
/**
* Class to handle buddylist events
*
* @author Joshua Gross
**/
var Buddylist = {
buddyListWin: null, // buddy list window
/**
* Process the creation of the buddy list window
*
* @author Joshua Gross
**/
create: function() {
Event.observe(window, 'resize', Buddylist.fixBuddyList);
if(!$('bl')) {
this.buddyListWin = new Window({id: 'bl', className: "dialog", width: 210, height: (Browser.height() - 60), zIndex: 100, resizable: true, title: Languages.get('buddyList'), draggable: true, closable: false, maximizable: false, detachable: false, minWidth: 205, minHeight: 150, showEffectOptions: {duration: 0}, hideEffectOptions: {duration: 0}});
this.buddyListWin.setConstraint(true, {left: 0, right: 0, top: 0, bottom: 0});
}
this.buddyListWin.getContent().innerHTML = '<div id="blTopToolbar"><span class="toolbarButton">' +
'<img id="addbuddy" src="themes/'+theme+'/window/addbuddy.png" class="toolbarButton" onclick="Dialogs.newBuddy();" alt="' + Languages.get('addBuddyButton') + '" title="' + Languages.get('addBuddyButton') + '" onmouseover="buttonHover(this);" onmouseout="buttonNormal(this);" onmousedown="buttonDown(this);" onmouseup="buttonNormal(this);" /></span>' +
'<span class="toolbarButton toolbarSpacer"><img id="removebuddy" src="themes/'+theme+'/window/removebuddy.png" class="toolbarButton" onclick="Dialogs.removeBuddy();" alt="' + Languages.get('removeBuddyButton') + '" title="' + Languages.get('removeBuddyButton') + '" onmouseover="buttonHover(this);" onmouseout="buttonNormal(this);" onmousedown="buttonDown(this);" onmouseup="buttonNormal(this);" /></span>' +
'<span class="toolbarButton"><img id="imanyone" src="themes/'+theme+'/window/imanyone.png" class="toolbarButton" onclick="Dialogs.newIM();" alt="' + Languages.get('IMAnyoneButton') + '" title="' + Languages.get('IMAnyoneButton') + '" onmouseover="buttonHover(this);" onmouseout="buttonNormal(this);" onmousedown="buttonDown(this);" onmouseup="buttonNormal(this);" /></span>' +
'<span class="toolbarButton toolbarSpacer"><img id="joinroom" src="themes/'+theme+'/window/joinroom.png" class="toolbarButton" onclick="Dialogs.newRoom();" alt="' + Languages.get('joinChatroomButton') + '" title="' + Languages.get('joinChatroomButton') + '" onmouseover="buttonHover(this);" onmouseout="buttonNormal(this);" onmousedown="buttonDown(this);" onmouseup="buttonNormal(this);"/></span>' +
'<span class="toolbarButton"><img id="changepassword" src="themes/'+theme+'/window/changepassword.png" class="toolbarButton" onclick="Dialogs.changeSettings();" alt="' + Languages.get('changeSettingsButton') + '" title="' + Languages.get('changeSettingsButton') + '" onmouseover="buttonHover(this);" onmouseout="buttonNormal(this);" onmousedown="buttonDown(this);" onmouseup="buttonNormal(this);" /></span>' +
'<span class="toolbarButton"><img id="toggleaudio" src="themes/'+theme+'/window/audio_'+(audioNotify ? 'on' : 'off')+'.png" onclick="toggleAudio();" alt="' + Languages.get('toggleSoundButton') + '" title="' + Languages.get('toggleSoundButton') + '" /></span>' +
(typeof(Status) != 'undefined' ? '<div id="statusSettings"><input type="text" id="customStatus" onkeypress="Status.processCustomAway(event);" style="display:none" onblur="if($(\'customStatus\').style.display != \'none\') { $(\'customStatus\').style.display = \'none\'; $(\'curStatus\').style.display = \'block\'; }" /><a href="#" id="curStatus" onclick="Status.toggleStatusList();return false;">' + Languages.get('available') + '</a></div>' : '') +
'</div><div id="blContainer"><ul id="buddylist" class="sortable box"><li style="display:none"></li></ul></div><div id="blBottomToolbar"><a href="#" style="-moz-outline-style: none;" onclick="System.logout();return false;"><img src="themes/'+theme+'/window/signoff.png" style="border:0;" alt="' + Languages.get('signOff') + '" onmouseover="buttonHover(this);" onmouseout="buttonNormal(this);" onmousedown="buttonDown(this);" onmouseup="buttonNormal(this);" /></a></div>';
Event.observe(this.buddyListWin.getContent(), 'contextmenu', function() { return false; });
$('bl_minimize').setStyle({left: (this.buddyListWin.getSize()['width'] - 21) + 'px'});
this.sizeBuddyList();
this.buddyListWin.showCenter(false, (((Browser.height()-40) / 2) - (this.buddyListWin.getSize()['height'] / 2)), (buddyListLoc == 0 ? 10 : (Browser.width() - this.buddyListWin.getSize()['width'] - 10)));
this.buddyListWin.toFront();
this.list = {};
this.listObjects = {};
this.blocked = {};
},
/**
* Destroy the buddy list window
*
* @author Joshua Gross
**/
destroy: function() {
this.buddyListWin.destroy();
},
/**
* Reposition buddylist
*
* @author Joshua Gross
**/
fixBuddyList: function() {
if(Buddylist.buddyListWin.isVisible()) {
Buddylist.buddyListWin.setSize(210, (Browser.height() - 60));
Buddylist.buddyListWin.setLocation((((Browser.height()-40) / 2) - (Buddylist.buddyListWin.getSize()['height'] / 2)), (buddyListLoc == 0 ? 10 : (Browser.width() - Buddylist.buddyListWin.getSize()['width'] - 10)));
Buddylist.sizeBuddyList();
}
},
/**
* Resize buddylist
*
* @author Joshua Gross
**/
sizeBuddyList: function() {
$('blContainer').setStyle({width: (this.buddyListWin.getSize()['width'] - 8) + 'px',
height: (this.buddyListWin.getSize()['height'] - 95) + 'px'});
$('blBottomToolbar').setStyle({width: (this.buddyListWin.getSize()['width'] - 8) + 'px',
top: (this.buddyListWin.getSize()['height'] - 7) + 'px'});
$('bl_minimize').setStyle({left: (this.buddyListWin.getSize()['width'] - 21) + 'px'});
},
/**
* Add new buddy to the list
*
* @arguments
* username - user's username
* groupname - group the user is in
*
* @author Joshua Gross
**/
addNewBuddy: function(username, groupname) {
username = username.toLowerCase();
if(!inArray(Buddylist.list, username) && (!Buddylist.listObjects[username] || !$(Buddylist.listObjects[username].obj))) {
var xhConn = new XHConn();
xhConn.connect(pingTo, "POST", "call=isuser&username="+username, function(xh) {
if(xh.responseText == 'not_exists') {
$('newbuddy_error_msg').innerHTML = Languages.get('noSuchUser');
} else {
if(!$(groupname.replace(/\s/, '_') + '_group')) {
Buddylist.addGroup(groupname);
Buddylist.list[groupname] = [];
}
Buddylist.addBuddy(username, 'Offline', 'none');
if(parseInt(xh.responseText) == 0) {
Buddylist.moveBuddy(username, 'Offline');
$(Buddylist.listObjects[username].img).src = 'themes/' + theme + '/offline.png';
} else if(parseInt(xh.responseText) == 2) {
Buddylist.moveBuddy(username, groupname);
$(Buddylist.listObjects[username].img).src = 'themes/' + theme + '/away.png';
} else {
Buddylist.moveBuddy(username, groupname);
$(Buddylist.listObjects[username].img).src = 'themes/' + theme + '/online.png';
}
Buddylist.list[groupname][username] = {'username': username, 'blocked': false, 'status': parseInt(xh.responseText)};
var xhConn = new XHConn();
xhConn.connect(pingTo, "POST", "call=addbuddy&username="+username+'&group='+groupname, null);
Windows.close('newBuddy');
}
});
} else {
$('newbuddy_error_msg').innerHTML = Languages.get('alreadyOnBuddylist');
}
},
/**
* Add buddy to the list
*
* @arguments
* username - username of the buddy we're adding
* groupname - the group the buddy is in
* buddyicon - the buddy's buddyiocn
*
* @author Joshua Gross
* update Benjamin Hutchins
**/
addBuddy: function(username, groupname, buddyicon) {
if(!$(groupname.replace(/\s/, '_') + '_group')) this.addGroup(groupname);
var groupList = $(groupname.replace(/\s/, '_') + '_group');
var iconsrc = (buddyicon=='none'?defaultIcon:pathToIcons+username+'.'+buddyicon);
var randId = Math.floor(Math.random()*1000000000);
while($(randId + '_blItem'))
randId = Math.floor(Math.random()*1000000000);
groupList.innerHTML += '<li id="'+randId+'_blItem" class="buddy'+(useIcons && showInList ? " buddyicon" : "")+'" onmousedown="Buddylist.clickBuddy(event, \''+username+'\');return false;" onselectstart="return false;" onmouseover="Buddylist.selectBuddy(this, \''+username+'\', true);" onmouseout="Buddylist.selectBuddy(this, \''+username+'\', false);" ondblclick="Buddylist.onBuddyDblClick();">' + (useIcons&&showInList?(defaultIcon==""&&buddyicon=='none'?'':'<img class="blIcon" src="'+iconsrc+'" alt="" id="'+randId+'_blIcon" />'):'') + '&nbsp;&nbsp;&nbsp;&nbsp;<img src="themes/' + theme + '/online.png" alt="" id="'+randId+'_blImg" />&nbsp;'+username+'</li>';
Buddylist.listObjects[username] = {};
Buddylist.listObjects[username].obj = randId + '_blItem';
Buddylist.listObjects[username].img = randId + '_blImg';
Buddylist.listObjects[username].icon = buddyicon;
Buddylist.listObjects[username].group = groupname;
$(Buddylist.listObjects[username].obj).setStyle({listStyleType: 'none'});
},
/**
* Move a buddy from one group to another
*
* @arguments
* username - username of the buddy we're moving
* groupname - new group name
*
* @author Joshua Gross
**/
moveBuddy: function(username, groupname) {
if(groupname == null) return;
if($(Buddylist.listObjects[username].obj).parentNode == $(groupname.replace(/\s/, '_') + '_group')) return;
if(!$(groupname.replace(/\s/, '_') + '_group')) this.addGroup(groupname);
var group = $(groupname.replace(/\s/, '_') + '_group')
group.insertBefore($(Buddylist.listObjects[username].obj), null);
},
/**
* Add a new group the buddylist window
*
* @arguments
* groupname - group to add
*
* @author Joshua Gross
**/
addGroup: function(groupname) {
var bList = $('buddylist');
bList.innerHTML = (groupname=='Offline' ? bList.innerHTML : '') + '<li id="' + groupname.replace(/\s/, '_') + '_groupTop" class="groupTop" onmousedown="return false;" onselectstart="return false;" onclick="Buddylist.toggleGroup(\'' + groupname + '\');"><img id="' + groupname.replace(/\s/, '_') + '_groupArrow" src="themes/' + theme + '/window/arrow.png" />&nbsp;&nbsp;' + groupname +
(groupname!='Offline' ? ' <a href="#" class="delLink" onclick="Dialogs.removeGroup(\'' + groupname + '\');return false;"><img src="themes/' + theme + '/window/smallx.png" style="border:0;" onmouseover="buttonHover(this);" onmouseout="buttonNormal(this);" /></a>' : '') + '</li>' + "\n" + '<ul id="' + groupname.replace(/\s/, '_') + '_group" class="group"></ul>' + (groupname!='Offline' ? bList.innerHTML : '');
},
/**
* Remove buddy from the buddylist permanently
*
* @arguments
* username - buddy we're removin
*
* @author Joshua Gross
**/
deleteBuddy: function(username) {
if(username.indexOf('_group') != -1) {
this.deleteGroup(username.substring(0, username.length - 6));
return;
}
var usernam = username;
var ingroup = null;
for (var group in this.list) {
if(typeof(this.list[group][username]) !== 'undefined' && this.list[group][username].username == username) {
ingroup = group;
break;
}
}
var buddyToRmv = $(Buddylist.listObjects[username].obj);
if(typeof(buddyToRmv) !== 'undefined') {
buddyToRmv.parentNode.removeChild(buddyToRmv);
if(this.list[ingroup]) {
this.list[ingroup][username] = null;
var xhConn = new XHConn();
xhConn.connect(pingTo, "POST", "call=removebuddy&username="+username, null);
}
Dialog.closeInfo();
}
},
/**
* Process the blocking of a buddy
*
* @arguments
* username - the buddy to be blocked
*
* @author Joshua Gross
* @update Benjamin Hutchins
**/
blockBuddy: function(username) {
var isBlocked = this.blocked.inArray(username);
if(isBlocked) {
for(var i=0; i<this.blocked.length; i++) {
if(this.blocked[i] == username) this.blocked.splice(i, 1);
break;
}
} else {
this.blocked[this.blocked.length] = username;
}
var xhConn = new XHConn();
xhConn.connect(pingTo, "POST", "call=blockbuddy&username="+username+(isBlocked ? '&status=' + (Status.state + 1) : ''), null);
for (var group in this.list) {
if(typeof(this.list[group][username]) !== 'undefined' && this.list[group][username].username == username) {
this.list[group][username].blocked = (isBlocked ? false : true);
$(Buddylist.listObjects[username].img).src = (!isBlocked ? 'themes/' + theme + '/blocked.png' : (Buddylist.list[group][username].status == 1 ? 'themes/' + theme + '/online.png' : (Buddylist.list[group][username].status >= 2 ? 'themes/' + theme + '/away.png' : 'themes/' + theme + '/offline.png')));
if(!blockedBuddyStatus && isBlocked) {
Buddylist.moveBuddy(username, Languages.get('offline'));
}
break;
}
}
},
/**
* Remove a group from the buddylist permanently
*
* @arguments
* groupname - group to be removes
*
* @author Joshua Gross
**/
deleteGroup: function(groupname) {
var groupNoSpaces = groupname.replace(/\s/, '_');
var groupToRmv = $(groupNoSpaces+"_group");
var groupTop = $(groupNoSpaces+"_groupTop");
if(typeof(groupToRmv) !== 'undefined') {
groupToRmv.parentNode.removeChild(groupToRmv);
groupTop.parentNode.removeChild(groupTop);
for(var i=0;i<this.list[groupname].length;i++) {
var buddyItem = $(Buddylist.listObjects[this.list[groupname][i].username].obj);
if(typeof(buddyItem) !== 'undefined') buddyItem.parentNode.removeChild(buddyItem);
}
delete this.list[groupname];
var xhConn = new XHConn();
xhConn.connect(pingTo, "POST", "call=removegroup&group="+groupname, null);
Dialog.closeInfo();
} else {
$('deletebuddy_error_msg').innerHTML = Languages.get('noSuchGroup');
$('deletebuddy_error_msg').show();
Dialog.win.updateHeight();
}
},
/**
* Toggle whether a group is collapsed or not.
*
* @arguments
* groupname - group to toggle
*
* @author Joshua Gross
**/
toggleGroup: function(groupname) {
var groupList = $(groupname.replace(/\s/, '_') + '_group');
var groupArrow = $(groupname.replace(/\s/, '_') + '_groupArrow');
if(groupList.style.display != 'none') {
groupList.hide();
groupArrow.src = 'themes/' + theme + '/window/arrow_up.png';
} else {
groupList.show();
groupArrow.src = 'themes/' + theme + '/window/arrow.png';
}
},
/**
* Proccess mouseover ad mouseout for list items
*
* @arguments
* sel - list element
* username - user being messed with
* selected - is the mouse over or out
**/
selectBuddy: function(sel, username, selected) {
if(selected === false) {
if(curSelected != username) {
try {
Element.addClassName(sel, 'listNotSelected');
Element.removeClassName(sel, 'listSelected');
Element.removeClassName(sel, 'listHover');
} catch(e) { }
} else {
Element.addClassName(sel, 'listSelected');
Element.removeClassName(sel, 'listNotSelected');
Element.removeClassName(sel, 'listHover');
}
} else {
Element.addClassName(sel, 'listHover');
Element.removeClassName(sel, 'listSelected');
Element.removeClassName(sel, 'listNotSelected');
}
},
/**
* Handle mouse clicks on a buddy in the buddylist
*
* @arguments
* event - passed by the browser
* username - the user that was clicked
*
* @author Joshua Gross
* @update Benjamin Hutchins
**/
clickBuddy: function(event, username) {
event = event || window.event;
if (event.button == 2) {
Context.lastClicked = username;
} else {
Context.lastClicked = null;
if(curSelected.length > 0) {
try {
var el = $(Buddylist.listObjects[curSelected].obj);
Element.addClassName(el, 'listNotSelected');
Element.removeClassName(el, 'listSelected');
Element.removeClassName(el, 'listHover');
} catch(e) { }
}
curSelected = username;
var oel = $(Buddylist.listObjects[curSelected].obj);
Element.addClassName(oel, 'listSelected');
Element.removeClassName(oel, 'listNotSelected');
Element.removeClassName(oel, 'listHover');
}
return false;
},
/**
* Process double clicks, open the IM window
*
* @author Joshua Gross
**/
onBuddyDblClick: function() {
if(curSelected.length > 0) {
if(typeof(IM.windows[curSelected]) == 'undefined') {
IM.create(curSelected, curSelected);
} else {
if(IM.windows[curSelected].detached) {
if(IM.windows[curSelected].popup.closed) {
IM.windows[curSelected] = IM.windows[curSelected].old;
IM.windows[curSelected].show();
} else {
IM.windows[curSelected].popup.focus();
}
} else if(!IM.windows[curSelected].isVisible()) {
IM.windows[curSelected].show();
IM.windows[curSelected].toFront();
setTimeout("scrollToBottom('" + IM.windows[curSelected].getId() + "_rcvd')", 125);
setTimeout("$('" + IM.windows[curSelected].getId() + "_sendBox').focus();", 250);
} else {
IM.windows[curSelected].toFront();
setTimeout("$('" + IM.windows[curSelected].getId() + "_sendBox').focus();", 250);
}
}
}
}
};
+76
Ver Arquivo
@@ -0,0 +1,76 @@
///////////////////////////////////
// ajax im 3.41 //
// AJAX Instant Messenger //
// Copyright (c) 2006-2008 //
// http://www.ajaxim.com/ //
// Do not remove this notice //
///////////////////////////////////
/**
* Button control class
*/
var ButtonCtl = {
/**
* Create a button/link wrapper
*
* @arguments
* text - innerHTML for link
* action - onClick action
* id - element ID to apply (if none is supplied, none is set)
*
* @author Joshua Gross
**/
create: function(text, action, id) {
return '<a href="#" ' + (id!=null ? 'id="' + id + '" ' : '') + 'class="stdButton" onclick="' + action + 'return false;" onmouseover="ButtonCtl.hover(this);" onmousedown="ButtonCtl.down(this);" onmouseup="ButtonCtl.normal(this);" onmouseout="ButtonCtl.normal(this);">' + text + '</a>';
},
/**
* Create a submit input button wrapper
*
* @arguments
* text - value for input
* id - element ID to apply (if none is supplied, none is set)
*
* @authro Benjamin Hutchins
**/
createSubmit: function(text, id) {
return '<input type="submit" ' + (id!=null ? 'id="' + id + '" ' : '') + 'class="stdButton" onmouseover="ButtonCtl.hover(this);" onmousedown="ButtonCtl.down(this);" onmouseup="ButtonCtl.normal(this);" onmouseout="ButtonCtl.normal(this);" value="' + text + '"" />';
},
/**
* Effect to apply to 'el' (element) on mouseover
*
* @arguments
* el - element to affect
*
* @author Joshua Gross
**/
hover: function(el) {
el.className = 'stdButton btnHover';
},
/**
* Effect to apply to 'el' (element) on mousedown
*
* @arguments
* el - element to affect
*
* @author Joshua Gross
**/
down: function(el) {
el.className = 'stdButton btnDown';
},
/**
* Restore 'el' (element) to normal on mouseout
*
* @arguments
* el - element to affect
*
* @author Joshua Gross
**/
normal: function(el) {
el.className = 'stdButton';
}
};
+362
Ver Arquivo
@@ -0,0 +1,362 @@
///////////////////////////////////
// ajax im 3.41 //
// AJAX Instant Messenger //
// Copyright (c) 2006-2008 //
// http://www.ajaxim.com/ //
// Do not remove this notice //
///////////////////////////////////
/**
* Chatroom Class
**/
var Chatroom = {
windows: {}, // JavaScript object to store all chatroom windows
/**
* Create a new chatroom
*
* @arguments
* name - chatroom name
* imTitle - window title, default is chatroom name
*
* @author Joshua Gross
**/
create: function(name, imTitle) {
var imLeft = Math.round(Math.random()*(Browser.width()-360))+'px';
var imTop = Math.round(Math.random()*(Browser.height()-400))+'px';
var winId = randomString(32) + '_chat';
this.windows[name] = new ChatWindow({id: winId, className: "dialog", width: 475, height: 340, top: imTop, left: imLeft, resizable: true, title: imTitle, draggable: true, detachable: false, minWidth: 475, minHeight: 150, showEffectOptions: {duration: 0}, hideEffectOptions: {duration: 0}});
this.windows[name].setConstraint(true, {left: 0, right: 0, top: 0, bottom: 0});
this.windows[name].getContent().innerHTML = '<div class="rcvdMessages" id="' + winId + '_rcvd"></div>' + "\n" +
'<div class="chatUserList" id="' + winId + '_userlist"><ul id="' + winId + '_ul" class="sortable box"><li style="display:none"></li></ul></div>' + "\n" +
'<div class="imToolbar" id="' + winId + '_toolbar" onmousemove="return false;" onselectstart="return false;"><img src="themes/'+theme+'/window/bold_off.png" onmouseover="buttonHover(this);" onmouseout="buttonNormal(this);" onclick="Chatroom.windows[\'' + name + '\'].toggleBold();" onmousedown="return false;" alt="' + Languages.get('bold') + '" id="' + winId + '_bold" /> ' +
'<img src="themes/'+theme+'/window/italic_off.png" onmouseover="buttonHover(this);" onmouseout="buttonNormal(this);" onclick="Chatroom.windows[\'' + name + '\'].toggleItalic();" onmousedown="return false;" alt="' + Languages.get('italic') + '" id="' + winId + '_italic" /> '+
'<img src="themes/'+theme+'/window/underline_off.png" onmouseover="buttonHover(this);" onmouseout="buttonNormal(this);" onclick="Chatroom.windows[\'' + name + '\'].toggleUnderline();" onmousedown="return false;" alt="' + Languages.get('underline') + '" id="' + winId + '_underline" /></div>' +
' <a href="#" class="setFontLink" id="' + winId + '_setFont" onclick="Chatroom.windows[\'' + name + '\'].toggleFontList();return false;" onselectstart="return false;">Tahoma</a>' +
' <a href="#" class="setFontSizeLink" id="' + winId + '_setFontSize" onclick="Chatroom.windows[\'' + name + '\'].toggleFontSizeList();return false;" onselectstart="return false;">12</a>' +
' <a href="#" class="setFontColorLink" id="' + winId + '_setFontColor" onclick="Chatroom.windows[\'' + name + '\'].toggleFontColorList();return false;" onselectstart="return false;"><div id="' + winId + '_setFontColorColor" style="width:14px;height:14px;display:block;"></div></a>' +
' <a href="#" class="insertEmoticonLink" id="' + winId + '_insertEmoticon" onclick="Chatroom.windows[\'' + name + '\'].toggleEmoticonList();return false;" onselectstart="return false;"><img src="themes/' + theme + '/emoticons/mini_smile.gif" width="14" height="14" style="border:0;" /></a>' +
"\n" + '<div style="overflow:auto;"><textarea class="inputText" id="' + winId + '_sendBox" onfocus="blinkerOn(false);" onkeypress="return Chatroom.windows[\'' + name + '\'].keyHandler(event);"></textarea></div>';
this.windows[name].setRoom(name);
$(winId + '_userlist').setStyle({left: (this.windows[name].getSize().width - 155) + 'px', height: (this.windows[name].getSize().height - 12) + 'px'});
$(winId + '_rcvd').setStyle({marginTop: '5px', height: (this.windows[name].getSize().height - 103) + 'px', width: (this.windows[name].getSize().width - 170) + 'px'});
$(winId + '_toolbar').setStyle({top: (this.windows[name].getSize().height - 73) + 'px', width: (this.windows[name].getSize().width - 170) + 'px'});
$(winId + '_setFont').setStyle({top: (this.windows[name].getSize().height - 65) + 'px'});
$(winId + '_setFontSize').setStyle({top: (this.windows[name].getSize().height - 65) + 'px'});
$(winId + '_setFontColor').setStyle({top: (this.windows[name].getSize().height - 65) + 'px'});
$(winId + '_setFontColorColor').setStyle({backgroundColor: '#000'});
$(winId + '_insertEmoticon').setStyle({top: (this.windows[name].getSize().height - 65) + 'px'});
var sendBox = $(winId + '_sendBox');
sendBox.setStyle({top: (this.windows[name].getSize().height - 45) + 'px',
left: '2px',
width: (this.windows[name].getSize().width - 175) + 'px',
fontWeight: '400',
fontStyle: 'normal',
textDecoration: 'none'});
this.windows[name].show();
this.windows[name].toFront();
Windows.focusedWindow = this.windows[name];
setTimeout("$('"+winId+"_sendBox').focus();", 250);
},
/**
* Process chatroom window resize
*
* @arguments
* name - chatroom name
*
* @author Joshua Gross
**/
handleResize: function(name) {
var winId = this.windows[name].getId();
$(winId + '_userlist').setStyle({left: (this.windows[name].getSize().width - 155) + 'px', height: (this.windows[name].getSize().height - 12) + 'px'});
$(winId + '_rcvd').setStyle({height: (this.windows[name].getSize().height - 103) + 'px', width: (this.windows[name].getSize().width - 170) + 'px'});
$(winId + '_toolbar').setStyle({top: (this.windows[name].getSize().height - 73) + 'px', width: (this.windows[name].getSize().width - 170) + 'px'});
$(winId + '_setFont').setStyle({top: (this.windows[name].getSize().height - 65) + 'px'});
$(winId + '_setFontSize').setStyle({top: (this.windows[name].getSize().height - 65) + 'px'});
$(winId + '_setFontColor').setStyle({top: (this.windows[name].getSize().height - 65) + 'px'});
$(winId + '_setFontColorColor').setStyle({backgroundColor: '#000'});
$(winId + '_insertEmoticon').setStyle({top: (this.windows[name].getSize().height - 65) + 'px'});
$(winId + '_sendBox').setStyle({top: (this.windows[name].getSize().height - 45) + 'px', left: '2px', width: (this.windows[name].getSize().width - 175) + 'px'});
},
/**
* Send request to server to enter a chatroom
*
* @argument
* room - room name user is entering
*
* @author Joshua Gross
**/
join: function(room) {
room = room.toLowerCase();
var xhConn = new XHConn();
xhConn.connect(pingTo, "POST", "call=joinroom&room="+room,
function(xh) {
if(xh.responseText.indexOf('"') == -1) {
switch(xh.responseText) {
case 'already_joined':
$('newroom_error_msg').innerHTML = Languages.get('alreadyInRoom').replace('%1', room);
break;
case 'room_is_user':
$('newroom_error_msg').innerHTML = Languages.get('invalidRoom');
break;
case 'invalid_chars':
$('newroom_error_msg').innerHTML = Languages.get('invalidRoomChars');
break;
}
} else {
if(!$(room + '_im')) {
Chatroom.create(room, room);
} else {
if(!Chatroom.windows[room].isVisible()) {
Chatroom.windows[room].show();
setTimeout("scrollToBottom('" + room + "_rcvd')", 125);
}
}
var users = xh.responseText.parseJSON().users;
for(var i=0; i<users.length; i++)
if(!$(users[i]+'_'+name+'_chatUser')) Chatroom.windows[room].addUser(users[i]);
Windows.close('newRoom');
Chatroom.windows[room].toFront();
setTimeout("$('"+Chatroom.windows[room].getId()+"_sendBox').focus()", 125);
}
});
},
/**
* Proccess the leaving of a chatroom
*
* @arguments
* room - room name the user is leaving
*
* @author Joshua Gross
**/
leave: function(room) {
var xhConn = new XHConn();
xhConn.connect(pingTo, "POST", "call=leaveroom&room="+room, null);
}
};
/**
* Chatroom Window Class
**/
var ChatWindow = Class.create();
Object.extend(ChatWindow.prototype, IMWindow.prototype);
Object.extend(ChatWindow.prototype, {
curSelected: '', // currnet user selected from the chatroom user list
/**
* Set the class' room name variable
*
* @author Joshua Gross
**/
setRoom: function(name) {
this.room = name;
},
/**
* Add a user to the chatroom user list
*
* @arguments
* username - user to add
*
* @author Joshua Gross
**/
addUser: function(username) {
$(this.getId() + '_ul').innerHTML += '<li id="'+username+'_'+this.room+'_chatUser" class="buddy" onmousedown="Chatroom.windows[\'' + this.room + '\'].clickUser(\''+username+'\');return false;" onselectstart="return false;" onmouseover="Chatroom.windows[\'' + this.room + '\'].selectUser(this, \''+username+'\', true);" onmouseout="Chatroom.windows[\'' + this.room + '\'].selectUser(this, \''+username+'\', false);" ondblclick="Chatroom.windows[\'' + this.room + '\'].onUserDblClick();" style="padding:0px;"><img src="themes/' + theme + '/online.png" alt="" id="'+username+'_'+this.room+'_chatImg" />&nbsp;'+username+'</li>';
$(username+'_'+this.room+'_chatUser').setStyle({listStyleType: 'none'});
},
/**
* Remove a user from the chatroom user list
*
* @arguments
* username - user to remove
*
* @author Joshua Gross
**/
deleteUser: function(username) {
var toDelete = $(username + '_' + this.room + '_chatUser');
if(typeof(toDelete) !== 'undefined')
toDelete.parentNode.removeChild(toDelete);
},
/**
* Process mouseover and mousout calls for the user list
*
* @arguments
* sel - element
* username - user's username
* selected - is mouse over or did it go out
*
* @author Joshua Gross
**/
selectUser: function(sel, username, selected) {
if(selected === false) {
if(this.curSelected != username) {
try {
Element.addClassName(sel, 'listNotSelected');
Element.removeClassName(sel, 'listSelected');
Element.removeClassName(sel, 'listHover');
} catch(e) { }
} else {
Element.addClassName(sel, 'listSelected');
Element.removeClassName(sel, 'listNotSelected');
Element.removeClassName(sel, 'listHover');
}
} else {
Element.addClassName(sel, 'listHover');
Element.removeClassName(sel, 'listSelected');
Element.removeClassName(sel, 'listNotSelected');
}
},
/**
* Process event when a user is clicked
*
* @arguments
* username - the username of the user clicked
*
* @author Josh Gross
**/
clickUser: function(username) {
if(this.curSelected.length > 0) {
try {
var el = $(this.curSelected + '_' + this.room + '_chatUser');
Element.addClassName(el, 'listNotSelected');
Element.removeClassName(el, 'listSelected');
Element.removeClassName(el, 'listHover');
} catch(e) { }
}
this.curSelected = username;
var oel = $(this.curSelected + '_' + this.room + '_chatUser');
Element.addClassName(oel, 'listSelected');
Element.removeClassName(oel, 'listNotSelected');
Element.removeClassName(oel, 'listHover');
},
/**
* On DoubleClick of a user from the chatroom user
* list, start a private IM with him/her.
*
* @author Joshua Gross
**/
onUserDblClick: function() {
if(this.curSelected.length > 0) {
if(typeof(IM.windows[this.curSelected]) == 'undefined') {
IM.create(this.curSelected, this.curSelected);
} else {
if(!IM.windows[this.curSelected].isVisible()) {
IM.windows[this.curSelected].show();
IM.windows[this.curSelected].toFront();
setTimeout("scrollToBottom('" + IM.windows[this.curSelected].getId() + "_rcvd')", 125);
setTimeout("$('" + IM.windows[this.curSelected].getId() + "_sendBox').focus();", 250);
} else {
IM.windows[this.curSelected].toFront();
setTimeout("$('" + IM.windows[this.curSelected].getId() + "_sendBox').focus();", 250);
}
}
}
}
});
/**
* Class to handle the window of the chat rooms
**/
var ChatroomList = {
curSelected: '', // current selected chat room
/**
* Get list of chat rooms that exist
*
* @author Joshua Gross
**/
get: function(applyTo) {
var xhConn = new XHConn();
xhConn.connect(pingTo, "POST", "call=roomlist", function(xh) {
var rooms = xh.responseText.parseJSON();
applyTo.innerHTML = '<ul id="join_room_ul" class="sortable box" style="padding: 0px; margin: 0px;"><li style="display:none;"></li>';
if(rooms.length > 0 || predefRooms.length > 0) {
for(var i=0; i<rooms.length; i++) {
var hexmd5 = hex_md5(rooms[i]);
if (!$('chatroom_list_' + hexmd5)) {
applyTo.innerHTML += '<li id="chatroom_list_' + hexmd5 + '" class="buddy" style="padding-left:1%;" onmousedown="ChatroomList.clickRoom(\'' + rooms[i] + '\');return false;" onmouseover="ChatroomList.selectRoom(this, \'' + rooms[i] + '\', true);" onmouseout="ChatroomList.selectRoom(this, \'' + rooms[i] + '\', false);">' + rooms[i] + '</li>';
}
}
for(var i=0; i<predefRooms.length; i++) {
var hexmd5 = hex_md5(predefRooms[i]);
if (!$('chatroom_list_' + hexmd5)) {
applyTo.innerHTML += '<li id="chatroom_list_' + hexmd5 + '" class="buddy" style="padding-left:1%;" onmousedown="ChatroomList.clickRoom(\'' + predefRooms[i] + '\');return false;" onmouseover="ChatroomList.selectRoom(this, \'' + predefRooms[i] + '\', true);" onmouseout="ChatroomList.selectRoom(this, \'' + predefRooms[i] + '\', false);">' + predefRooms[i] + '</li>';
}
}
} else {
applyTo.innerHTML += '<li class="buddy" style="margin: 2px 0px 0px 0px; padding: 0px; text-align: center;">' + Languages.get('noRoomsExist') + '</li>';
}
applyTo.innerHTML += '</ul>';
});
},
/**
* Proccess mouseover and mouseout of list items
*
* @arguments
* sel - list element
* roomname - chatroom name
* selected - did mouse go over or out
*
* @author Joshua Gross
**/
selectRoom: function(sel, roomname, selected) {
if(selected === false) {
if(this.curSelected != roomname) {
try {
Element.addClassName(sel, 'listNotSelected').removeClassName('listSelected').removeClassName('listHover');
} catch(e) { }
} else {
Element.addClassName(sel, 'listSelected').removeClassName('listNotSelected').removeClassName('listHover');
}
} else {
Element.addClassName(sel, 'listHover').removeClassName('listSelected').removeClassName('listNotSelected');
}
},
/**
* Process the clicking of a room
*
* @arguments
* roomname - room that was clicked
*
* @author Joshua Gross
**/
clickRoom: function(roomname) {
if(this.curSelected.length > 0) {
try {
Element.addClassName($('chatroom_list_' + hex_md5(this.curSelected)), 'listNotSelected').removeClassName('listSelected').removeClassName('listHover');
} catch(e) { }
}
this.curSelected = roomname;
$('roomname').value = roomname;
Element.addClassName($('chatroom_list_' + hex_md5(roomname)), 'listSelected').removeClassName('listNotSelected').removeClassName('listHover');
}
};
+110
Ver Arquivo
@@ -0,0 +1,110 @@
///////////////////////////////////
// ajax im 3.41 //
// AJAX Instant Messenger //
// Copyright (c) 2006-2008 //
// http://www.ajaxim.com/ //
// Do not remove this notice //
///////////////////////////////////
// Configuration //
// Title //
var siteName = 'ajax im'; // Name of your site (appears as the page title).
// If '', then the title will be used from the index file.
// Registration //
var allowNewUsers = true; // Enable/Disable open registration
// Languages //
// Format: [
// ['folderName', 'properName'],
// ['language2Folder', 'Language 2 Proper Name'],
// ...
// ]
// Note: The first language will be used as the default language.
var languageOptions = [
['english', 'English']
];
// Theme Settings //
var theme = 'dark'; // ajax im theme
var alertWidth = 400; // alert window width
// Notification //
var useBlinker = true; // Show new message in titlebar when window isn't active.
var blinkSpeed = 1000; // How fast to change between the titles when "blinking" (in milliseconds).
var pulsateTitles = true; // Pulsate (blink) IM window titles on new IM when they are not the active window.
var audioNotify = true; // By default, play sounds upon getting an IM?
// Server //
var pingFrequency = 2500; // How often to ping the server (in milliseconds). Best range between 2500 and 3500 ms.
var pingTo = 'ajax_im.php'; // The file that is the "server".
var adminPingTo = 'admin.php'; // The "server" script for admin functions.
var blockedBuddyStatus = false; // Show blocked buddies' status.
// Windows //
var imWidth = 310; // Default IM window width
var imHeight = 335; // Default IM window height
var imDetachable = true; // Enable/Disable ability to detach IM windows from the application
var buddyListLoc = 1; // Default buddylist location: 0=left, 1=right (of window)
// Timeouts //
var idleTime = 15; // How long until a user goes idle from now sending any messages (in minutes).
// If 0, feature not used.
// Lingo Text-Replacement //
var useLingo = true; // Automated text replacement for messaging. Will replace typos and shorthand,
// as defined in the current language's lingo.js file, with the proper replacement
// text.
var lingoPunction = [ // Punction the can be placed at the end of a word/setence.
[" ", " "], // Format: [RegularExpression, Real]
["\\.\\.", ".."],
["\\.\\.\\.", "..."],
["\\.\\.\\.\\.", "...."],
["\\.\\.\\.\\.\\.", "....."],
["\\.", "."],
[",", ","],
[";", ";"],
["\\!", "!"],
["\\?", "?"]
];
// Buddy Icons //
var useIcons = true; // Enable/Disable use of buddy icons
var pathToIcons = './buddyicons/';// Path to buddy icons, include trailing slash.
var showInList = false; // Enable/Disable showing of buddy icons in the buddy list
var vanishingIcons = true; // Enable/Disable the hiding of the buddy icons in a chat
var vanishingSpeed = 10000; // Show the buddy icon for X amount until it is hidden (in milliseconds).
var defaultIcon = ''; // Location of image to use when no buddy icon is availible
// If blank, no default icon is used
// Messaging History //
var imHistory = true; // Retain conversations with buddies throughout the session?
// How it works: If an IM window is closed an imHistory is true,
// next time that IM window is opened (during the same session!),
// the old chat text will be there
// Chatrooms //
var predefRooms = []; // Define preset rooms that will always exist when a user views the "Join Room" list.
// Format: ['room1', 'room2', ...]
// Timestamp Format //
// This is the timestamp format used to note when an IM was received.
/* M = month, Jan - Dec
* m = month, 01 - 12, with prepended 0 (01, 02, ...)
* u = month, 1 - 12, without prepended 0 (1, 2, ...)
* d = day, 01 - 31, with prepended 0 (01, 02, ...)
* x = day, 1 - 31, without prepended 0 (1, 2, ...)
* Y = year, 4 digits (eg: 2008)
* y = year, 2 digits (eg: 08)
* H = hours, 24-hour format with prepended 0 (01, 02, ...)
* h = hours, 12-hour format without prepended 0 (1, 2, ...)
* Q = hours, 24-hour format without prepended 0 (1, 2, ...)
* q = hours, 12-hour format with prepended 0 (01, 02, ...)
* i = minutes
* s = seconds
* a = am/pm
* A = AM/PM
*/
var timestamp = '[h:i:s a]';
+146
Ver Arquivo
@@ -0,0 +1,146 @@
///////////////////////////////////
// ajax im 3.41 //
// AJAX Instant Messenger //
// Copyright (c) 2006-2008 //
// http://www.ajaxim.com/ //
// Do not remove this notice //
///////////////////////////////////
/**
* Handle all right-click menus for buddy list
*
* @author Benjamin Hutchins
**/
var Context = {
currentUser: null, // current user that the menu is being shown for
lastClicked: null, // last user that was right-clicked
/**
* On window load, apply new observes
*
* @author Benjamin Hutchins
**/
loaded: function() {
if (typeof document.oncontextmenu != 'undefined') {
document.oncontextmenu = Context.oncontextmenu;
} else {
window.oncontextmenu = Context.oncontextmenu;
}
document.onmousedown = window.onmousedown = Context.onmousedown;
},
/**
* onClick of 'Get Info', open the users' profile.
*
* @author Benjamin Hutchins
**/
profile: function() {
$('divContext').style.display = 'none';
if(typeof(Profile.windows[Context.currentUser]) == 'undefined') {
Profile.create(Context.currentUser, Context.currentUser);
} else {
if(!Profile.windows[Context.currentUser].isVisible()) {
Profile.windows[Context.currentUser].show();
Profile.windows[Context.currentUser].toFront();
} else {
Profile.windows[Context.currentUser].toFront();
}
}
},
/**
* onClick of 'IM', open the conversation window with the user.
*
* @author Benjamin Hutchins
**/
createIM: function() {
$('divContext').style.display = 'none';
if(typeof(IM.windows[Context.currentUser]) == 'undefined') {
IM.create(Context.currentUser, Context.currentUser);
} else {
if(IM.windows[Context.currentUser].detached) {
if(IM.windows[Context.currentUser].popup.closed) {
IM.windows[Context.currentUser] = IM.windows[Context.currentUser].old;
IM.windows[Context.currentUser].show();
} else {
IM.windows[Context.currentUser].popup.focus();
}
} else if(!IM.windows[Context.currentUser].isVisible()) {
IM.windows[Context.currentUser].show();
IM.windows[Context.currentUser].toFront();
setTimeout("scrollToBottom('" + IM.windows[Context.currentUser].getId() + "_rcvd')", 125);
setTimeout("$('" + IM.windows[Context.currentUser].getId() + "_sendBox').focus();", 250);
} else {
IM.windows[Context.currentUser].toFront();
setTimeout("$('" + IM.windows[Context.currentUser].getId() + "_sendBox').focus();", 250);
}
}
},
/**
* onClick of 'Block' or 'Unblock', toggle the user's blocked status.
*
* @author Benjamin Hutchins
**/
blockBuddy: function() {
$('divContext').style.display = 'none';
Dialogs.blockBuddy(Context.currentUser);
},
/**
* onClick of 'Remove', remove the user from the friend's list.
*
* @author Benjamin Hutchins
**/
removeBuddy: function() {
$('divContext').style.display = 'none';
Dialogs.removeBuddy(Context.currentUser);
},
/**
* Global onContextMenu handler
*
* @author Benjamin Hutchins
**/
oncontextmenu: function (event) {
if (loggedIn && Context.lastClicked != null) {
event = event || window.event;
Context.currentUser = Context.lastClicked;
var scrollTop = document.body.scrollTop ? document.body.scrollTop : document.documentElement.scrollTop;
var scrollLeft = document.body.scrollLeft ? document.body.scrollLeft : document.documentElement.scrollLeft;
$('divContext').style.display = 'none';
var group = Buddylist.listObjects[Context.currentUser].group;
$('contextBlock').innerHTML = (typeof Buddylist.list[group] != 'undefined' && Buddylist.list[group][Context.currentUser].blocked == true ? Languages.get('contextUnblock') : Languages.get('contextBlock'));
Element.setStyle($('divContext'), {
left: (event.clientX + scrollLeft - 5) + 'px',
top: (event.clientY + scrollTop - 5) + 'px',
zIndex: Windows.maxZIndex + 20,
display: 'block'
});
Context.lastClicked = null;
return false;
} else if ($('divContext')) {
$('divContext').style.display = 'none';
}
},
/**
* Global onMouseDown handler, hide right-click menu,
* as long as it wasn't a right click.
*
* @author Benjamin Hutchins
**/
onmousedown: function (event) {
if (loggedIn) {
event = event || window.event;
if (event.button != 2 && event.button != 3) {
setTimeout("$('divContext').style.display='none';", 100);
}
}
}
};
+405
Ver Arquivo
@@ -0,0 +1,405 @@
///////////////////////////////////
// ajax im 3.41 //
// AJAX Instant Messenger //
// Copyright (c) 2006-2008 //
// http://www.ajaxim.com/ //
// Do not remove this notice //
///////////////////////////////////
/**
* Dialog and windows class
*
* @author Joshua Gross
**/
var Dialogs = {
/**
* Display login modal
*
* @author Joshua Gross
**/
login: function() {
clearInputs();
$('login_error_msg').innerHTML = '';
this.mainDialogShow('login');
this.currentMainDialog = 'login';
setTimeout("try { $('username').focus(); } catch(e) { }", 1125);
},
/**
* Display register modal
*
* @author Joshua Gross
**/
register: function() {
clearInputs();
$('register_error_msg').innerHTML = '';
Dialogs.mainDialogShow('register');
this.currentMainDialog = 'register';
setTimeout("try { $('newusername').focus(); } catch(e) { }", 505);
},
/**
* Display forgot password modal
*
* @author Joshua Gross
**/
forgotPass: function() {
clearInputs();
$('forgotpass_error_msg').innerHTML = '';
Dialogs.mainDialogShow('forgotPass');
this.currentMainDialog = 'forgotPass';
setTimeout("try { $('resetto').focus(); } catch(e) { }", 505);
},
/**
* Display main dialog
*
* @author Joshua Gross
**/
mainDialogShow: function(dialog) {
if(this.currentMainDialog) Element.setStyle(this.currentMainDialog + 'Dialog', {'display': 'none'});
Element.setStyle(dialog + 'Dialog', {'display': 'block'});
},
/**
* New IM window, or IM Anyone. Displays a window to enter a
* username in attempt to message a new friend.
*
* @author Joshua Gross
**/
newIM: function() {
var newIMWin;
if($('newIM')) {
Windows.getWindow('newIM').toFront();
return;
}
newIMWin = new Window({id: 'newIM', className: "dialog", width: 240, height: 120, resizable: false, title: Languages.get('newIM'), draggable: true, closable: true, maximizable: false, minimizable: false, detachable: false, minWidth: 240, minHeight: 120, showEffectOptions: {duration: 0}, hideEffectOptions: {duration: 0}});
newIMWin.setConstraint(true, {left: 0, right: 0, top: 0, bottom: 0});
newIMWin.getContent().innerHTML = '<div class="dialog_info lang-newIMPlease langinsert-clear" style="padding:3px;">' + Languages.get('newIMPlease') + '</div> \
<span id="newim_error_msg" class="errorMsg">&nbsp;</span> \
<div id="newim_box" style="padding-left:30px;width:100%;"> \
<div style="display:block;float:left;margin-right:5px;padding-top:4px;">' + Languages.get('username') + ':</div><input type="text" style="width:120px;" id="sendto" name="sendto" onkeypress="handleInput(event, function() { IM.newIMWindow(); })" /> \
</div> \
<div id="newim_buttons">' +
ButtonCtl.create(Languages.get('openIM'), 'IM.newIMWindow();') +
ButtonCtl.create(Languages.get('cancel'), 'Windows.close(\'newIM\');') +
'</div>';
$('newim_buttons').setStyle({position: 'absolute', top: '110px', left: '25px'});
newIMWin.setDestroyOnClose();
newIMWin.showCenter();
setTimeout("$('sendto').focus();", 125);
},
/**
* Display a window that will allow the user
* to enter a name for a chat room to be created.
*
* @author Joshua Gross
**/
newRoom: function() {
var newRoomWin;
if($('newRoom')) {
Windows.getWindow('newRoom').toFront();
return;
}
newRoomWin = new Window({id: 'newRoom', className: "dialog", width: 240, height: 300, resizable: false, title: Languages.get('newRoom'), draggable: true, closable: true, maximizable: false, minimizable: false, detachable: false, minWidth: 240, minHeight: 120, showEffectOptions: {duration: 0}, hideEffectOptions: {duration: 0}});
newRoomWin.setConstraint(true, {left: 0, right: 0, top: 0, bottom: 0});
newRoomWin.getContent().innerHTML = '<div class="dialog_info lang-newRoomPlease langinsert-clear" style="padding:3px;">' + Languages.get('newRoomPlease') + '</div> \
<span id="newroom_error_msg" class="errorMsg">&nbsp;</span> \
<div id="newroom_box" style="padding-left:25px;width:100%;"> \
<div style="display:block;margin-right:5px;padding-top:4px;" class="lang-roomname langinsert-replace">' + Languages.get('roomname') + ':</div><input type="text" style="width:187px;margin-left:0px;" id="roomname" name="roomname" onkeypress="handleInput(event, function() {Chatroom.join($(\'roomname\').value); }, function(){$(\'roomname\').value = $(\'roomname\').value.toLowerCase();})" /> \
<div id="newroom_room_list"></div> \
</div> \
<div id="newroom_buttons">' +
ButtonCtl.create(Languages.get('joinRoom'), 'Chatroom.join($(\'roomname\').value);') +
ButtonCtl.create(Languages.get('cancel'), 'Windows.close(\'newRoom\');') +
'</div>';
$('newroom_buttons').setStyle({position: 'absolute', top: '290px', left: '25px'});
ChatroomList.get($('newroom_room_list'));
newRoomWin.setDestroyOnClose();
newRoomWin.showCenter();
setTimeout("$('roomname').focus();", 125);
},
/**
* Display a window to allow the user to enter another
* buddy's username and a group name to have the user added
* to the user's buddylist.
*
* @author Joshua Gross
**/
newBuddy: function() {
var newBuddyWin;
if($('newBuddy')) {
Windows.getWindow('newBuddy').toFront();
return;
}
newBuddyWin = new Window({id: 'newBuddy', className: "dialog", width: 240, height: 160, resizable: false, title: Languages.get('newBuddy'), draggable: true, closable: true, maximizable: false, minimizable: false, detachable: false, minWidth: 240, minHeight: 120, showEffectOptions: {duration: 0}, hideEffectOptions: {duration: 0}});
newBuddyWin.setConstraint(true, {left: 0, right: 0, top: 0, bottom: 0});
newBuddyWin.getContent().innerHTML = '<div class="dialog_info" style="padding:3px;">' + Languages.get('newBuddyPlease') + '</div> \
<span id="newbuddy_error_msg" class="errorMsg">&nbsp;</span> \
<div id="newbuddy_box" style="padding-left:22px;width:100%;"> \
<div style="display:block;float:left;margin-right:24px;padding-top:4px;">' + Languages.get('username') + ':</div><input type="text" style="width:110px;" id="newBuddyUsername" name="newBuddyUsername" onkeypress="handleInput(event, function() { Buddylist.addNewBuddy($(\'newBuddyUsername\').value, $(\'newBuddyGroup\').value); })" /><br /> \
<div style="display:block;float:left;margin-right:5px;padding-top:4px;">' + Languages.get('addtogroup') + ':</div><input type="text" style="width:110px;" id="newBuddyGroup" name="newBuddyGroup" value="Friends" onfocus="this.select();" onkeypress="handleInput(event, function() { Buddylist.addNewBuddy($(\'newBuddyUsername\').value, $(\'newBuddyGroup\').value); })" /> \
</div> \
<div id="newbuddy_buttons">' +
ButtonCtl.create(Languages.get('add'), 'Buddylist.addNewBuddy($(\'newBuddyUsername\').value, $(\'newBuddyGroup\').value);') +
ButtonCtl.create(Languages.get('cancel'), 'Windows.close(\'newBuddy\');') +
'</div>';
$('newbuddy_buttons').setStyle({position: 'absolute', top: '150px', left: '25px'});
newBuddyWin.setDestroyOnClose();
newBuddyWin.showCenter();
setTimeout("$('newBuddyUsername').focus();", 125);
},
/**
* Display a window to confirm the removal of a buddy.
*
* @author Joshua Gross
* @update Benjamin Hutchins
**/
removeBuddy: function(username) {
var delBuddyWin;
if (typeof username == 'undefined')
var username = curSelected;
if(username == '' || username.length == 0)
return;
if($('delBuddy')) {
Windows.getWindow('delBuddy').toFront();
return;
}
delBuddyWin = new Window({id: 'delBuddy', className: "dialog", width: 240, height: 70, resizable: false, title: Languages.get('removeBuddy'), draggable: true, closable: true, maximizable: false, minimizable: false, detachable: false, minWidth: 240, minHeight:70, showEffectOptions: {duration: 0}, hideEffectOptions: {duration: 0}});
delBuddyWin.setConstraint(true, {left: 0, right: 0, top: 0, bottom: 0});
delBuddyWin.getContent().innerHTML = '<div class="dialog_info" style="padding:3px;">' + Languages.get('removeBuddyAreYouSure').replace('%1', username) + '</div> \
<div id="delbuddy_buttons">' +
ButtonCtl.create(Languages.get('ok'), 'Buddylist.deleteBuddy(\'' + username + '\');Windows.close(\'delBuddy\');') +
ButtonCtl.create(Languages.get('cancel'), 'Windows.close(\'delBuddy\');') +
'</div>';
$('delbuddy_buttons').setStyle({position: 'absolute', top: '60px', left: '25px'});
delBuddyWin.setDestroyOnClose();
delBuddyWin.showCenter();
},
/**
* Display a window to confirm the blocking/unblocking
* of a buddy.
*
* @author Joshua Gross
**/
blockBuddy: function(buddy) {
var blockBuddyWin;
if($('blockBuddy')) {
Windows.getWindow('blockBuddy').toFront();
return;
}
blockBuddyWin = new Window({id: 'blockBuddy', className: "dialog", width: 240, height: 70, resizable: false, title: Languages.get('blockBuddy'), draggable: true, closable: true, maximizable: false, minimizable: false, detachable: false, minWidth: 240, minHeight:70, showEffectOptions: {duration: 0}, hideEffectOptions: {duration: 0}});
blockBuddyWin.setConstraint(true, {left: 0, right: 0, top: 0, bottom: 0});
blockBuddyWin.getContent().innerHTML = '<div class="dialog_info" style="padding:3px;">' + (Buddylist.blocked.inArray(buddy) ? Languages.get('unblockBuddyAreYouSure').replace('%1', buddy) : Languages.get('blockBuddyAreYouSure').replace('%1', buddy)) + '</div> \
<div id="blockbuddy_buttons">' +
ButtonCtl.create(Languages.get('ok'), 'Buddylist.blockBuddy(\'' + buddy + '\');Windows.close(\'blockBuddy\');') +
ButtonCtl.create(Languages.get('cancel'), 'Windows.close(\'blockBuddy\');') +
'</div>';
$('blockbuddy_buttons').setStyle({position: 'absolute', top: '60px', left: '25px'});
blockBuddyWin.setDestroyOnClose();
blockBuddyWin.showCenter();
},
/**
* Display a window to confirm the removal of an
* entire buddy group.
*
* @author Joshua Gross
**/
removeGroup: function(group) {
var delGroupWin;
if($('delGroup')) {
Windows.getWindow('delGroup').toFront();
return;
}
delGroupWin = new Window({id: 'delGroup', className: "dialog", width: 240, height: 70, resizable: false, title: Languages.get('removeGroup'), draggable: true, closable: true, maximizable: false, minimizable: false, detachable: false, minWidth: 240, minHeight:70, showEffectOptions: {duration: 0}, hideEffectOptions: {duration: 0}});
delGroupWin.setConstraint(true, {left: 0, right: 0, top: 0, bottom: 0});
delGroupWin.getContent().innerHTML = '<div class="dialog_info" style="padding:3px;">' + Languages.get('removeGroupAreYouSure').replace('%1', group) + '</div> \
<div id="delgroup_buttons">' +
ButtonCtl.create(Languages.get('ok'), 'Buddylist.deleteGroup(\'' + group + '\');Windows.close(\'delGroup\');') +
ButtonCtl.create(Languages.get('cancel'), 'Windows.close(\'delGroup\');') +
'</div>';
$('delgroup_buttons').setStyle({position: 'absolute', top: '60px', left: '25px'});
delGroupWin.setDestroyOnClose();
delGroupWin.showCenter();
},
/**
* Display a window to show the available settings
* that the user can change.
*
* @author Benjamin Hutchins
**/
changeSettings: function() {
var changeSettings;
if($('changeSettings')) {
Windows.getWindow('changeSettings').toFront();
return;
}
changeSettings = new Window({id: 'changeSettings', className: "dialog", width: 300, height: 160, resizable: false, title: Languages.get('changeSettings'), draggable: true, closable: true, maximizable: false, minimizable: false, detachable: false, minWidth: 240, minHeight: 150, showEffectOptions: {duration: 0}, hideEffectOptions: {duration: 0}});
changeSettings.setConstraint(true, {left: 0, right: 0, top: 0, bottom: 0});
changeSettings.getContent().innerHTML = '<div class="dialog_info lang-changeSettingsInstructions langinsert-clear" style="padding:3px;">' + Languages.get('changeSettingsInstructions') + '</div> \
<div id="changesettings_buttons">' +
ButtonCtl.create(Languages.get('changeSettingsPassword'), 'Dialogs.changePass();if($(\'changeSettings\')){Windows.close(\'changeSettings\');}') +
ButtonCtl.create(Languages.get('changeSettingsProfile'), 'Dialogs.changeProfile();if($(\'changeSettings\')){Windows.close(\'changeSettings\');}') +
(useIcons ? ButtonCtl.create(Languages.get('changeSettingsBuddyicon'), 'Dialogs.changeIcon();if($(\'changeSettings\')){Windows.close(\'changeSettings\');}') : '') +
ButtonCtl.create(Languages.get('cancel'), 'Windows.close(\'changeSettings\');') +
'</div>';
$('changesettings_buttons').setStyle({position: 'absolute', top: '60px', left: '85px'});
changeSettings.setDestroyOnClose();
changeSettings.showCenter();
},
/**
* Display a window to allow the user to change
* their buddy profile.
*
* @author Benjamin Hutchins
**/
changeProfile: function() {
var changeProfileWin;
if($('changeProfile')) {
Windows.getWindow('changeProfile').toFront();
return;
}
changeProfileWin = new Window({id: 'changeProfile', className: "dialog", width: 300, height: 250, resizable: false, title: Languages.get('changeProfile'), draggable: true, closable: true, maximizable: false, minimizable: false, detachable: false, minWidth: 240, minHeight: 240, showEffectOptions: {duration: 0}, hideEffectOptions: {duration: 0}});
changeProfileWin.setConstraint(true, {left: 0, right: 0, top: 0, bottom: 0});
changeProfileWin.getContent().innerHTML = '<div class="dialog_info lang-changeProfileInstructions langinsert-clear" style="padding:3px;">' + Languages.get('changeProfileInstructions') + '</div> \
<span id="changeprofile_error_msg" class="errorMsg">&nbsp;</span> \
<textarea style="width:97%;height:150px;" id="changeprofile_textarea"></textarea> \
<div id="changeprofile_buttons">' +
ButtonCtl.create(Languages.get('change'), 'System.changeProfile();') +
ButtonCtl.create(Languages.get('cancel'), 'Windows.close(\'changeProfile\');') +
'</div>';
$('changeprofile_buttons').setStyle({position: 'absolute', top: '245px', left: '55px'});
var xhConn = new XHConn();
xhConn.connect(pingTo, "POST", "call=getprofile&user="+user,
function(xh) {
$('changeprofile_textarea').value = xh.responseText;
}
);
changeProfileWin.setDestroyOnClose();
changeProfileWin.showCenter();
},
/**
* Display a window to allow the user to upload
* a new buddy icon.
*
* @author Benjamin Hutchins
**/
changeIcon: function () {
if(!useIcons) return;
var changeIconWin;
if($('changeIcon')) {
Windows.getWindow('changeIcon').toFront();
return;
}
changeIconWin = new Window({id: 'changeIcon', className: "dialog", width: 300, height: 160, resizable: false, title: Languages.get('changeBuddyicon'), draggable: true, closable: true, maximizable: false, minimizable: false, detachable: false, minWidth: 240, minHeight: 120, showEffectOptions: {duration: 0}, hideEffectOptions: {duration: 0}});
changeIconWin.setConstraint(true, {left: 0, right: 0, top: 0, bottom: 0});
changeIconWin.getContent().innerHTML = '<div class="dialog_info lang-changeBuddyiconInstructions langinsert-clear" style="padding:3px;">' + Languages.get('changeBuddyiconInstructions') + '</div> \
<span id="changeicon_error_msg" class="errorMsg">&nbsp;</span> \
<form target="changeicon_iframe" id="changeicon_form" enctype="multipart/form-data" method="post" action="' + pingTo + '"> \
<input type="hidden" name="call" value="changeicon" style="display:none;" /> \
<input id="changeicon_input_file" type="file" name="icon" /> \
<div id="changeicon_buttons">' +
ButtonCtl.createSubmit(Languages.get('change')) +
ButtonCtl.create(Languages.get('cancel'), 'Windows.close(\'changeIcon\');') +
'</form>' +
'<iframe src="about:blank" onload="System.changeIcon()" style="display:none" id="changeicon_iframe" name="changeicon_iframe"></iframe>' +
'</div>';
$('changeicon_buttons').setStyle({position: 'absolute', top: '150px', left: '55px'});
changeIconWin.setDestroyOnClose();
changeIconWin.showCenter();
},
/**
* Display a window to allow the user to change
* their password.
*
* @author Joshua Gross
**/
changePass: function() {
var changePassWin;
if($('changePass')) {
Windows.getWindow('changePass').toFront();
return;
}
changePassWin = new Window({id: 'changePass', className: "dialog", width: 300, height: 160, resizable: false, title: Languages.get('changePassword'), draggable: true, closable: true, maximizable: false, minimizable: false, detachable: false, minWidth: 240, minHeight: 120, showEffectOptions: {duration: 0}, hideEffectOptions: {duration: 0}});
changePassWin.setConstraint(true, {left: 0, right: 0, top: 0, bottom: 0});
changePassWin.getContent().innerHTML = '<div class="dialog_info lang-changePasswordInstructions langinsert-clear" style="padding:3px;">' + Languages.get('changePasswordInstructions') + '</div> \
<span id="changepass_error_msg" class="errorMsg">&nbsp;</span> \
<div id="changepass_box" style="padding-left:12px;width:100%;"> \
<div style="display:block;float:left;margin-right:5px;padding-top:4px;" class="lang-currentPassword langinsert-replace">' + Languages.get('currentPassword') + ':</div><input type="password" style="width:110px;" id="currentpw" name="currentpw" onkeypress="handleInput(event, function() { System.changePass(); })" /><br /> \
<div style="display:block;float:left;margin-right:20px;padding-top:4px;" class="lang-currentPassword langinsert-replace">' + Languages.get('newPassword') + ':</div><input type="password" style="width:110px;" id="newpw" name="newpw" onkeypress="handleInput(event, function() { changePass(); })" /> \
<div style="display:block;float:left;margin-right:4px;padding-top:4px;" class="lang-currentPassword langinsert-replace">' + Languages.get('confirmPassword') + ':</div><input type="password" style="width:110px;" id="confirmpw" name="confirmpw" onkeypress="handleInput(event, function() { System.changePass(); })" /> \
</div> \
<div id="changepass_buttons">' +
ButtonCtl.create(Languages.get('change'), 'System.changePass();') +
ButtonCtl.create(Languages.get('cancel'), 'Windows.close(\'changePass\');') +
'</div>';
$('changepass_buttons').setStyle({position: 'absolute', top: '150px', left: '55px'});
changePassWin.setDestroyOnClose();
changePassWin.showCenter();
setTimeout("$('currentpw').focus();", 125);
}
};
+11
Ver Arquivo
Diff do arquivo suprimido porque uma ou mais linhas são muito longas
+584
Ver Arquivo
@@ -0,0 +1,584 @@
///////////////////////////////////
// ajax im 3.41 //
// AJAX Instant Messenger //
// Copyright (c) 2006-2008 //
// http://www.ajaxim.com/ //
// Do not remove this notice //
///////////////////////////////////
/**
* AjaxIM Class
*
* @author Joshua Gross
**/
var AjaxIM = {
windows: {}, // JavaScript object to hold all IM windows
sendBoxWithFocus: null, // current box that has focus
/**
* Create new IM window
*
* @author Joshua Gross
* @update Benjamin Hutchins
**/
create: function(name, imTitle) {
var buddyicon = typeof Buddylist.listObjects[name] == 'undefined' ? 'none' : Buddylist.listObjects[name].icon;
var iconsrc = (buddyicon=='none'?defaultIcon:pathToIcons+name+'.'+buddyicon);
var imLeft = Math.round(Math.random()*(Browser.width()-360))+'px';
var imTop = Math.round(Math.random()*(Browser.height()-400))+'px';
var winId = randomString(32) + '_im';
this.windows[name] = new IMWindow({id: winId, className: "dialog", width: 320, height: 335, top: imTop, left: imLeft, resizable: true, title: imTitle, draggable: true, detachable: imDetachable, minWidth: 320, minHeight: 150, showEffectOptions: {duration: 0}, hideEffectOptions: {duration: 0}});
this.windows[name].setConstraint(true, {left: 0, right: 0, top: 0, bottom: 0});
this.windows[name].getContent().innerHTML = '<div class="userToolbar" id="' + winId + '_userFuncs">' +
'<img src="themes/'+theme+'/window/addbuddy.png" class="toolbarButton" onclick="Dialogs.newBuddy();$(\'newBuddyUsername\').value=\'' + name + '\'" alt="' + Languages.get('addBuddyButton') + '" title="' + Languages.get('addBuddyButton') + '" onmouseover="buttonHover(this);" onmouseout="buttonNormal(this);" onmousedown="buttonDown(this);" onmouseup="buttonNormal(this);" /> ' +
'<img src="themes/'+theme+'/window/block.png" class="toolbarButton" onclick="Dialogs.blockBuddy(\'' + name + '\');" alt="" title="" onmouseover="buttonHover(this);" onmouseout="buttonNormal(this);" onmousedown="buttonDown(this);" onmouseup="buttonNormal(this);" />' +
'</div>' +
(useIcons?(defaultIcon==""&&buddyicon=="none"?'':'<img src="'+iconsrc+'" id="buddyIcon_'+name+'" alt="Buddy Icon" class="buddyIcon" onmouseover="IM.buddyIconHover(this);" onmouseout="IM.buddyIconNormal(this);" />'):'') +
'<div class="rcvdMessages" id="' + winId + '_rcvd"></div>' + "\n" +
'<div class="imToolbar" id="' + winId + '_toolbar" onmousemove="return false;" onselectstart="return false;"><img src="themes/'+theme+'/window/bold_off.png" onmouseover="buttonHover(this);" onmouseout="buttonNormal(this);" onclick="IM.windows[\'' + name + '\'].toggleBold();" onmousedown="return false;" alt="' + Languages.get('bold') + '" id="' + winId + '_bold" /> ' +
'<img src="themes/'+theme+'/window/italic_off.png" onmouseover="buttonHover(this);" onmouseout="buttonNormal(this);" onclick="IM.windows[\'' + name + '\'].toggleItalic();" onmousedown="return false;" alt="' + Languages.get('italic') + '" id="' + winId + '_italic" /> '+
'<img src="themes/'+theme+'/window/underline_off.png" onmouseover="buttonHover(this);" onmouseout="buttonNormal(this);" onclick="IM.windows[\'' + name + '\'].toggleUnderline();" onmousedown="return false;" alt="' + Languages.get('underline') + '" id="' + winId + '_underline" /></div>' +
' <a href="#" class="setFontLink" id="' + winId + '_setFont" onclick="IM.windows[\'' + name + '\'].toggleFontList();return false;" onselectstart="return false;">Tahoma</a>' +
' <a href="#" class="setFontSizeLink" id="' + winId + '_setFontSize" onclick="IM.windows[\'' + name + '\'].toggleFontSizeList();return false;" onselectstart="return false;">12</a>' +
' <a href="#" class="setFontColorLink" id="' + winId + '_setFontColor" onclick="IM.windows[\'' + name + '\'].toggleFontColorList();return false;" onselectstart="return false;"><div id="' + winId + '_setFontColorColor" style="width:14px;height:14px;display:block;"></div></a>' +
' <a href="#" class="insertEmoticonLink" id="' + winId + '_insertEmoticon" onclick="IM.windows[\'' + name + '\'].toggleEmoticonList();return false;" onselectstart="return false;"><img src="themes/' + theme + '/emoticons/mini_smile.gif" width="14" height="14" style="border:0;" /></a>' +
"\n" + '<div style="overflow:auto;"><textarea class="inputText" id="' + winId + '_sendBox" onfocus="blinkerOn(false);IM.sendBoxWithFocus=this;" onblur="IM.sendBoxWithFocus=null;" onkeypress="return IM.windows[\'' + name + '\'].keyHandler(event);"></textarea></div>';
this.windows[name].setUsername(name);
$(winId + '_rcvd').setStyle({height: (this.windows[name].getSize().height - 135) + 'px', width: (this.windows[name].getSize().width - 10) + 'px'});
$(winId + '_toolbar').setStyle({top: (this.windows[name].getSize().height - 73) + 'px', width: (this.windows[name].getSize().width - 10) + 'px'});
$(winId + '_setFont').setStyle({top: (this.windows[name].getSize().height - 65) + 'px'});
$(winId + '_setFontSize').setStyle({top: (this.windows[name].getSize().height - 65) + 'px'});
$(winId + '_setFontColor').setStyle({top: (this.windows[name].getSize().height - 65) + 'px'});
$(winId + '_setFontColorColor').setStyle({backgroundColor: '#000'});
$(winId + '_insertEmoticon').setStyle({top: (this.windows[name].getSize().height - 65) + 'px'});
$(winId + '_sendBox').setStyle({top: (this.windows[name].getSize().height - 45) + 'px', left: '2px', width: (this.windows[name].getSize().width - 16) + 'px', fontWeight: '400', fontStyle: 'normal', textDecoration: 'none'});
this.windows[name].show();
this.windows[name].toFront();
Windows.focusedWindow = this.windows[name];
setTimeout("$('"+winId+"_sendBox').focus();", 250);
if (vanishingIcons){setTimeout("if($('buddyIcon_"+name+"')){$('buddyIcon_"+name+"').hide();}", vanishingSpeed);}
},
/**
* Sends a message to the server
*
* @arguments
* username - who the message is being sent to
* message - the message to send
* chatroom - (bool) is this a chatroom
* isBold - (bool) is the message bolded
* isItalic - (bool) is the message italicized
* isUnderline - (bool) is the message underlined
* fontName - font family for the message
* fontSize - font size for the message
* fontColor - font color for the message
*
* @author Joshua Gross
**/
sendMessage: function(username, message, chatroom, isBold, isItalic, isUnderline, fontName, fontSize, fontColor) {
var xhConn = new XHConn();
xhConn.connect(pingTo, "POST", "call=send&recipient="+username+"&chatroom="+chatroom+"&bold="+isBold+"&italic="+isItalic+"&underline="+isUnderline+"&font="+fontName+"&fontsize="+fontSize+"&fontcolor="+fontColor+"&message="+encodeURIComponent(message),
function(xh) {
var error = null;
switch(xh.responseText) {
case 'sent':
// do nothing
break;
case 'sent_offline':
error = Languages.get('notifySentButOffline');
break;
case 'not_online':
error = Languages.get('errorNotLoggedIn');
break;
case 'too_long':
error = Languages.get('errorMsgTooLong');
break;
case 'not_logged_in':
if (typeof System != 'undefined') {
System.logout();
} else {
self.opener.System.logout();
}
break;
default:
error = Languages.get('errorUnknown');
break;
}
if(chatroom == 'true')
Chatroom.windows[username].sendResult(message, isBold, isItalic, isUnderline, fontName, fontSize, fontColor, error);
else
IM.windows[username].sendResult(message, isBold, isItalic, isUnderline, fontName, fontSize, fontColor, error);
}
);
if(audioNotify == true) soundManager.play('msg_out');
},
/**
* Replaces emotes with images
*
* @arguments
* str - the message to run replaces on
* itemsList - array of emotes
**/
emoteReplace: function(str, itemsList) {
var r;
for(var s in itemsList) {
if(str.indexOf(s) > -1)
str = str.replace(new RegExp(regExpEscape(s), 'g'), '<img src="themes/' + theme + '/emoticons/' + itemsList[s] + '" alt="' + itemsList[s] + '" title="' + s + '" />');
}
return str;
},
/**
* Start a new message with a user that might not be in your buddy list,
* ran via Dialogs.newIM()
*
* @author Joshua Gross
**/
newIMWindow: function() {
if($('sendto').value.replace(/^\s*|\s*$/g,"").length > 0) {
var toWhom = $('sendto').value;
if(typeof(this.windows[toWhom]) == 'undefined') {
this.create(toWhom, toWhom);
} else {
if(!this.windows[toWhom].isVisible()) {
this.windows[toWhom].show();
setTimeout("scrollToBottom('" + this.windows[toWhom].getId() + "_rcvd')", 125);
}
}
Windows.close('newIM');
this.windows[toWhom].toFront();
setTimeout("$('" + this.windows[toWhom].getId() + "_sendBox').focus()", 125);
} else {
$('newim_error_msg').innerHTML = Languages.get('newIMProper');
}
},
/**
* @author Joshua Gross
**/
handleClose: function(eventName, win) {
if(win.getId().indexOf('_im') == -1 && win.getId().indexOf('_chat') == -1) return;
if(typeof(win.room) !== 'undefined') Chatroom.leave(win.room);
var rcvdBox = $(win.getId() + '_rcvd');
if(imHistory == true) {
rcvdBox.innerHTML = '<span class="imHistory">' +
rcvdBox.innerHTML.replace(new RegExp('\(' + Languages.get('autoreply') + ':\)/g'), Languages.get('autoreply') + ':').replace(/<(?![Bb][Rr] ?\/?)([^>]+)>/ig, '') +
"</span>\n";
} else {
rcvdBox.innerHTML = '';
}
},
/**
* @author Joshua Gross
**/
handleMinimize: function(eventName, win) {
if(win.getId().indexOf('_im') == -1) return;
var curIM = $(win.getId() + '_rcvd');
curIM.scrollTop = curIM.scrollHeight - curIM.clientHeight + 6;
},
/**
* Create a timestamp to use in a chat window based off the
* configuration variable 'timestamp'
*
* @author Joshua Gross
**/
createTimestamp: function() {
Stamp = new Date();
var tH = String(Stamp.getHours()); var ti = String(Stamp.getMinutes()); var ts = String(Stamp.getSeconds());
var th = tH > 12 ? tH - 12 : tH; var ta = tH > 12 ? 'pm' : 'am'; var tA = tH > 12 ? 'PM' : 'AM';
var td = String(Stamp.getDate()); var tm = String(Stamp.getMonth() + 1);
var tM = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'July', 'Aug', 'Sep', 'Nov', 'Dec'][tm - 1];
var tY = String(Stamp.getFullYear()); var ty = tY.substring(2);
tu = tm; tx = td; tQ = tH;
tH = (tH.length > 1) ? tH : "0"+tH; ti = (ti.length > 1) ? ti : "0"+ti;
tq = (th.length > 1) ? th : "0"+th; ts = (ts.length > 1) ? ts : "0"+ts;
td = (td.length > 1) ? td : "0"+td; tm = (tm.length > 1) ? tm : "0"+tm;
if(typeof timestamp == 'undefined') {
timestamp = self.opener.timestamp;
}
return timestamp.replace(/H/, tH).replace(/h/, th).replace(/i/, ti).replace(/s/, ts)
.replace(/d/, td).replace(/Y/, tY).replace(/y/, ty).replace(/m/, tm)
.replace(/u/, tu).replace(/x/, tx).replace(/Q/, tQ).replace(/q/, tq)
.replace(/a/, ta).replace(/A/, tA).replace(/M/, tM);
},
/**
* Append status changes to chat window
*
* @author Benjamin Hutchins
**/
notifyUser: function(username, error) {
if(typeof(IM.windows[username]) != 'undefined') {
if(IM.windows[username].isVisible()) {
IM.windows[username].sendResult('', '', '', '', '', '', '', error);
}
}
},
/**
* Add effects to a buddy icon.
*
* @arguments
* el - buddy icon element
*
* @author Benjamin Hutchins
**/
buddyIconHover: function(el) {
/*var clone = new Element('img', {
'src': $(el).src,
// 'id': $(el).id + '_clone',
// 'class': 'buddyIconClone',
// 'alt': '' // valid XHTML
}).insert(Element.getOffsetParent(el), 'content'); //.setStyle({'position': 'absolute', 'top': el.offsetTop, 'left': el.offsetLeft});
//clonePosition(clone, el, {setLeft:true, setTop:true});*/
},
/**
* Restore effects set by IM.buddyIconHover back to 'Normal'
*
* @arguments
* el - buddy icon element
*
* @author Benjamin Hutchins
**/
buddyIconNormal: function(el) {
if ($(el.id + '_clone')) {
$(el.id + '_clone').remove();
}
}
};
/**
* A class to mantain an IM Window's guts.
*
* @author Joshua Gross
**/
var AjaxIMWindow = Class.create();
Object.extend(AjaxIMWindow.prototype, Window.prototype);
Object.extend(AjaxIMWindow.prototype, {
/**
* Set the class' username variable
*
* @author Joshua Gross
**/
setUsername: function(username) {
this.username = username;
},
send: function() {
// do nothing here.
},
/**
* After a message is sent to the server via IM.sendMessage(),
* this function is ran to append the message to the user's window
*
* @arguments
* message - the message to send
* isBold - (bool) is the message bolded
* isItalic - (bool) is the message italicized
* isUnderline - (bool) is the message underlined
* fontName - font family for the message
* fontSize - font size for the message
* fontColor - font color for the message
*
* @author Joshua Gross
* @update Benjamin Hutchins
**/
sendResult: function(message, isBold, isItalic, isUnderline, fontName, fontSize, fontColor, result) {
var winId = this.getId();
var sendBox = $(winId + '_sendBox');
var rcvdBox = $(winId + '_rcvd');
if(result != null) {
rcvdBox.innerHTML = rcvdBox.innerHTML + '<span class="imError">' + result + '</span><br>';
}
if(trim(message).length > 0) {
message = message.replace(/<br\/>/g, '\n').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/<([^>]+)>/ig, '').replace(/\n/g, '<br/>').replace(/(\s|\n|>|^)(\w+:\/\/[^<\s\n]+)/, '$1<a href="$2" target="_blank">$2</a>');
message = IM.emoteReplace(message, smilies);
if(message.replace(/<([^>]+)>/ig, '').indexOf('/me') == 0)
rcvdBox.innerHTML = rcvdBox.innerHTML + "<b class=\"userA\">" + IM.createTimestamp() + " <i>" + user + ' ' + message.replace(/<([^>]+)>/ig, '').replace(/\/me/, '') + "</i></b><br>\n";
else
rcvdBox.innerHTML = rcvdBox.innerHTML + "<b class=\"userA\">" + IM.createTimestamp() + " " + user + ":</b> <span style=\"font-family:" + fontName + ",sans-serif;font-size:" + fontSize + "px;color:" + fontColor + ";\">" + (isBold == 'true' ? "<b>" : "") + (isItalic == 'true' ? "<i>" : "") + (isUnderline == 'true' ? "<u>" : "") + message + (isBold == 'true' ? "</b>" : "") + (isItalic == 'true' ? "</i>" : "") + (isUnderline == 'true' ? "</u>" : "") + "</span><br>\n";
}
scrollToBottom(winId + '_rcvd');
},
/**
* @author Joshua Gross
**/
toggleBold: function() {
var winId = this.getId();
var sendBox = $(winId + '_sendBox');
sendBox.hide(); // horrah weird Opera 9 input refresh!
if(sendBox.style.fontWeight == '400') {
$(winId + '_bold').src = 'themes/' + theme + '/window/bold_on.png';
sendBox.setStyle({fontWeight: '700'});
} else {
sendBox.setStyle({fontWeight: '400'});
$(winId + '_bold').src = 'themes/' + theme + '/window/bold_off.png';
}
sendBox.show(); // horrah weird Opera 9 input refresh!
setTimeout("$('" + winId + "_sendBox').focus();", 125);
},
/**
* @author Joshua Gross
**/
toggleItalic: function() {
var winId = this.getId();
var sendBox = $(winId + '_sendBox');
sendBox.hide(); // horrah weird Opera 9 input refresh!
if(sendBox.style.fontStyle == 'normal') {
sendBox.setStyle({fontStyle: 'italic'});
$(winId + '_italic').src = 'themes/' + theme + '/window/italic_on.png';
} else {
sendBox.setStyle({fontStyle: 'normal'});
$(winId + '_italic').src = 'themes/' + theme + '/window/italic_off.png';
}
sendBox.show(); // horrah weird Opera 9 input refresh!
setTimeout("$('" + winId + "_sendBox').focus();", 125);
},
/**
* @author Joshua Gross
**/
toggleUnderline: function() {
var winId = this.getId();
var sendBox = $(winId + '_sendBox');
sendBox.hide(); // horrah weird Opera 9 input refresh!
if(sendBox.style.textDecoration == 'none') {
sendBox.setStyle({textDecoration: 'underline'});
$(winId + '_underline').src = 'themes/' + theme + '/window/underline_on.png';
} else {
sendBox.setStyle({textDecoration: 'none'});
$(winId + '_underline').src = 'themes/' + theme + '/window/underline_off.png';
}
sendBox.show(); // horrah weird Opera 9 input refresh!
setTimeout("$('" + winId + "_sendBox').focus();", 125);
},
/**
* @author Joshua Gross
**/
toggleFontList: function() {
var fL = $('fontsList');
var fLBtn = $(this.getId() + '_setFont');
$('emoticonList', 'fontColorList', 'fontSizeList').invoke('hide');
if($('fontsList').style.display == 'block') {
fL.hide();
} else {
fL.setStyle({left: Position.cumulativeOffset(fLBtn)[0] + 'px',
top: (Position.cumulativeOffset(fLBtn)[1] + Element.getHeight(fLBtn) - 1) + 'px',
zIndex: Windows.maxZIndex + 20,
display: 'block'});
IM.active = this;
}
},
/**
* @author Joshua Gross
**/
toggleFontSizeList: function() {
var fsL = $('fontSizeList');
var fsLBtn = $(this.getId() + '_setFontSize');
$('emoticonList', 'fontsList', 'fontColorList').invoke('hide');
if($('fontSizeList').style.display == 'block') {
$('fontSizeList').setStyle({display: 'none'});
} else {
fsL.setStyle({left: Position.cumulativeOffset(fsLBtn)[0] + 'px',
top: (Position.cumulativeOffset(fsLBtn)[1] + Element.getHeight(fsLBtn) - 1) + 'px',
zIndex: Windows.maxZIndex + 20,
display: 'block'});
IM.active = this;
}
},
/**
* @author Joshua Gross
**/
toggleEmoticonList: function() {
var eL = $('emoticonList');
var eLBtn = $(this.getId() + '_insertEmoticon');
$('fontsList', 'fontSizeList', 'fontColorList').invoke('hide');
if($('emoticonList').style.display == 'block') {
$('emoticonList').setStyle({display: 'none'});
} else {
eL.setStyle({left: Position.cumulativeOffset(eLBtn)[0] + 'px',
top: (Position.cumulativeOffset(eLBtn)[1] + Element.getHeight(eLBtn) - 1) + 'px',
zIndex: Windows.maxZIndex + 20,
display: 'block'});
IM.active = this;
}
},
/**
* @author Joshua Gross
**/
toggleFontColorList: function() {
var fcL = $('fontColorList');
var fcLBtn = $(this.getId() + '_setFontColor');
$('fontsList', 'fontSizeList', 'emoticonList').invoke('hide');
if($('fontColorList').style.display == 'block') {
$('fontColorList').setStyle({display: 'none'});
} else {
fcL.setStyle({left: Position.cumulativeOffset(fcLBtn)[0] + 'px',
top: (Position.cumulativeOffset(fcLBtn)[1] + Element.getHeight(fcLBtn) - 1) + 'px',
zIndex: Windows.maxZIndex + 20,
display: 'block'});
IM.active = this;
}
},
/**
* @author Joshua Gross
**/
setFont: function(fontname) {
var winId = this.getId();
var sendBox = $(winId + '_sendBox');
sendBox.hide();
sendBox.setStyle({fontFamily: fontname + ', sans-serif'});
sendBox.show();
$(winId + '_setFont').innerHTML = fontname;
setTimeout("$('" + winId + "_sendBox').focus();", 125);
this.toggleFontList('');
},
/**
* @author Joshua Gross
**/
setFontSize: function(size) {
var winId = this.getId();
var sendBox = $(winId + '_sendBox');
sendBox.hide();
sendBox.setStyle({fontSize: size + 'px'});
sendBox.show();
$(winId + '_setFontSize').innerHTML = size;
setTimeout("$('" + winId + "_sendBox').focus();", 125);
this.toggleFontSizeList('');
},
/**
* @author Joshua Gross
**/
setFontColor: function(color) {
var winId = this.getId();
var sendBox = $(winId + '_sendBox');
sendBox.setStyle({color: color});
$(winId + '_setFontColorColor').setStyle({backgroundColor: color});
setTimeout("$('" + winId + "_sendBox').focus();", 125);
this.toggleFontColorList('');
},
/**
* Adds text to a windows' message box
*
* @author Joshua Gross
**/
insertText: function(tti) {
var winId = this.getId();
var sendBox = $(winId + '_sendBox');
sendBox.value += tti;
setTimeout("$('" + winId + "_sendBox').focus();", 125);
this.toggleEmoticonList();
return false;
},
/**
* Checks for pressing on 'Return' or 'Enter'
*
* @author Joshua Gross
* @update Benjamin Hutchins
**/
keyHandler: function(event) {
event = event || window.event;
var asc = document.all ? event.keyCode : event.which;
var shift = event.shiftKey;
if(useLingo) {
var message = $(this.getId() + '_sendBox').value;
if(trim(message).length > 0) {
for(var i=0; i<lingoPunction.length; i++) {
if(RegExp(lingoPunction[i][0]+"$").test(message)) {
$(this.getId() + '_sendBox').value = Languages.lingoReplace(message, lingoPunction[i]);
if(asc == 13 && !shift){}else{return true;}
}
}
}
}
if(asc == 13 && !shift) {
this.send();
return false;
}
return true;
},
/**
* Detaches an IM window to a new window
*
* @author Joshua Gross
* @update Benjamin Hutchins
**/
detach: function() {
var winId = this.getId();
newWin = this.username;
newWinRcvd = $(winId + '_rcvd').innerHTML;
this.hide();
this.popup = window.open('./popup.html', winId + '_im', 'left='+this.getLocation()['left']+',top='+this.getLocation()['top']+',width=320,height=335,toolbar=0,location=1,status=0,menubar=0,resizable=1,scrollbars=0');
this.detached = true;
}
});
+90
Ver Arquivo
@@ -0,0 +1,90 @@
///////////////////////////////////
// ajax im 3.41 //
// AJAX Instant Messenger //
// Copyright (c) 2006-2008 //
// http://www.ajaxim.com/ //
// Do not remove this notice //
///////////////////////////////////
/**
* IM Class
*
* @author Joshua Gross
**/
var IM = {
/**
* Handle resize of windows
*
* @author Joshua Gross
* @update Benjamin Hutchins
**/
handleResize: function(eventName, win, detached) {
if(win.getId() == 'bl') {
Buddylist.sizeBuddyList();
} else if(win.getId().indexOf('_im') != -1) {
var name = win.getId();
var curIM = $(name + '_rcvd');
curIM.setStyle({height: (win.getSize()['height'] - 135) + 'px', width: (win.getSize()['width'] - 10) + 'px'});
$(name + '_toolbar').setStyle({top: (win.getSize()['height'] - 73) + 'px', width: (win.getSize()['width'] - 10) + 'px'});
$(name + '_setFont').setStyle({top: (win.getSize()['height'] - 65) + 'px'});
$(name + '_setFontSize').setStyle({top: (win.getSize()['height'] - 65) + 'px'});
$(name + '_setFontColor').setStyle({top: (win.getSize()['height'] - 65) + 'px'});
$(name + '_insertEmoticon').setStyle({top: (win.getSize()['height'] - 65) + 'px'});
$(name + '_sendBox').setStyle({top: (win.getSize()['height'] - 45) + 'px', width: (win.getSize()['width'] - 16) + 'px'});
curIM.scrollTop = curIM.scrollHeight - curIM.clientHeight + 6;
} else if(win.getId().indexOf('_chat') != -1) {
Chatroom.handleResize(win.room);
} else if(win.getId().indexOf('admin-') != -1) {
AdminWindows.handleResize(win);
}
}
};
Object.extend(IM, AjaxIM);
/**
* A class to mantain an IM Window's guts.
*
* @author Joshua Gross
**/
var IMWindow = Class.create(AjaxIMWindow);
IMWindow.addMethods({
/**
* Checks to see if there is a message, if there is,
* send it to the server.
*
* @author Joshua Gross
* @update Benjamin Hitchins
**/
send: function($super) {
$super();
var winId = this.getId();
var sendBox = $(winId + '_sendBox');
var isBold = (sendBox.style.fontWeight == '400' ? 'false' : 'true');
var isItalic = (sendBox.style.fontStyle == 'normal' ? 'false' : 'true');
var isUnderline = (sendBox.style.textDecoration == 'none' ? 'false' : 'true');
var fontName = $(winId + '_setFont').innerHTML;
var fontSize = $(winId + '_setFontSize').innerHTML;
var fontColor = $(winId + '_setFontColorColor').style.backgroundColor;
var chatroom = (typeof(this.room) !== 'undefined' ? 'true' : 'false');
if(trim(sendBox.value).length > 0) {
var message = sendBox.value;
sendBox.value = '';
IM.sendMessage((chatroom == 'true' ? this.room : this.username), message.replace(/&/g, "&amp;").replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/\n/g, "<br/>"), chatroom, isBold, isItalic, isUnderline, fontName, fontSize, fontColor);
Status.lastIM = new Date().getTime();
if (typeof(Status) != 'undefined' && Status.wasSetAutoAway) {
Status.set(1, Languages.get('available'));
}
}
scrollToBottom(winId + '_rcvd');
sendBox.focus();
}
});
+196
Ver Arquivo
@@ -0,0 +1,196 @@
///////////////////////////////////
// ajax im 3.41 //
// AJAX Instant Messenger //
// Copyright (c) 2006-2008 //
// http://www.ajaxim.com/ //
// Do not remove this notice //
///////////////////////////////////
/**
* Language class
*
* @author Joshua Gross
* @update Benjamin Hutchins
* - Added to popup
* - Added lingo-replacement
**/
var Languages = {
current: '', // current language being used
previous: '', // previous language used
available: languageOptions, // list of available languages
loaded: [], // list of languages loaded
dictionary: {}, // dictionary of languages
lingodict: {}, // dictionary of lingo-replacements
/**
* Load a new language
*
* @arguments
* language - the language to be loaded
*
* @author Joshua Gross
* @update Benjamin Hutchins
* - Loads lingo dictionary for language as well
**/
load: function(language) {
for(var i=0; i<Languages.loaded.length; i++) {
if(Languages.loaded[i][0] == language)
return Languages.set(language);
}
var s = document.createElement('script');
s.src = 'languages/' + language + '/lang.js?' + (new Date()).getTime();
s.type = 'text/javascript';
document.getElementsByTagName('head').item(0).appendChild(s);
if (useLingo) {
var l = document.createElement('script');
l.src = 'languages/' + language + '/lingo.js?' + (new Date()).getTime();
l.type = 'text/javascript';
document.getElementsByTagName('head').item(0).appendChild(l);
}
},
/**
* Adds a language to Language.dictionary
*
* @arguments
* language - the name of the language
* dict - the language dictionary
*
* @author Joshua Gross
**/
onLoad: function(language, dict) {
for(var i=0; i<Languages.available.length; i++) {
if(Languages.available[i][0] == language) {
Languages.loaded[Languages.loaded.length] = Languages.available[i];
break;
}
}
Languages.dictionary[language] = dict;
Languages.set(language);
},
/**
* Adds a lingo-dictionary to Language.lingodict
*
* @arguments
* language - the language of the dictionary
* dict - the dictionary itself
*
* @author Benjamin Hutchins
**/
onLingoLoad: function(language, dict) {
Languages.lingodict[language] = dict;
},
/**
* Goes through and changes any items with the class lang-TEXT,
* where TEXT is the language dictionary key, to the actual text.
*
* @arguments
* language - the language to use
*
* @author Joshua Gross
**/
set: function(language) {
Languages.previous = Languages.current;
Languages.current = language;
var langObjs = $$('[class*="lang-"]');
langObjs.each(function(el) {
var langItem = el.className.split(' ');
var i;
for(i=0; i<langItem.length; i++)
if(langItem[i].indexOf('lang-') > -1) break;
langItem = langItem[i].substring(5);
var langText = Languages.get(langItem);
var oldLangText = Languages.get(langItem, Languages.previous);
var preprocessEl = $(document.createElement('div'));
preprocessEl.setStyle({display: 'none'});
preprocessEl.innerHTML = oldLangText + '';
document.body.appendChild(preprocessEl);
oldLangText = preprocessEl.innerHTML;
if(el.className.indexOf('langinsert-post') > -1 && el.innerHTML.indexOf(oldLangText) == -1)
el.innerHTML += Languages.get(langItem);
else if(el.className.indexOf('langinsert-clear') > -1)
el.innerHTML = Languages.get(langItem);
else if(el.className.indexOf('langinsert-pre') > -1 && el.innerHTML.indexOf(oldLangText) == -1)
el.innerHTML = Languages.get(langItem) + el.innerHTML;
else {
if(el.innerHTML.length == 0) {
el.innerHTML = langText;
return;
}
if(langText.indexOf('%1') > -1) {
langText = langText.split(/%1/);
oldLangText = preprocessEl.innerHTML.split(/%1/);
el.innerHTML = el.innerHTML.replace(oldLangText[0], langText[0]).replace(oldLangText[1], langText[1]);
} else
el.innerHTML = el.innerHTML.replace(oldLangText, langText);
}
document.body.removeChild(preprocessEl);
});
},
/**
* Get the text to show for a language
**/
get: function(text, language) {
if(language != null && language.length == 0)
return -1;
return Languages.dictionary[language != null ? language : Languages.current][text];
},
/**
* Removed lingo-text from a message
*
* @arguments
* message - the message entered by the user
* last - last punction character
*
* @author Benjamin Hutchins
* @return none-lingo message
**/
lingoReplace: function(message, last) {
var exp = RegExp(last[0]+"$");
var mostof = message.replace(exp,"");
var word = trim(mostof.substring(mostof.lastIndexOf(" "), mostof.length)).replace(exp,"");
mostof = mostof.substring(0, mostof.length-word.length);
return mostof + Languages.lingo(word) + last[1];
},
/**
* Runs a single word through the lingo-dictionary
*
* @arguments
* text - word to try and replace
*
* @author Benjamin Hutchins
* @return none-lingo text if availible, else returns text
**/
lingo: function(text, language) {
if(language != null && language.length == 0)
return text;
language = language != null ? language : Languages.current;
if (typeof Languages.lingodict[language] != 'undefined') {
if (typeof Languages.lingodict[language][text.toLowerCase()] != 'undefined') {
return Languages.lingodict[language][text.toLowerCase()];
}
}
return text;
}
};
+79
Ver Arquivo
@@ -0,0 +1,79 @@
///////////////////////////////////
// ajax im 3.41 //
// AJAX Instant Messenger //
// Copyright (c) 2006-2008 //
// http://www.ajaxim.com/ //
// Do not remove this notice //
///////////////////////////////////
/**
* IM Class
*
* @author Joshua Gross
**/
var IM = {
/**
* Handle resize of window
*
* @author Joshua Gross
**/
handleResize: function(e) {
var rcvdBox = $(winName + '_rcvd');
rcvdBox.style.height = (browserHeight() - 133) + 'px';
rcvdBox.style.width = (browserWidth() - 15) + 'px';
$(winName + '_toolbar').style.top = (browserHeight() - 93) + 'px';
$(winName + '_toolbar').style.width = (browserWidth() - 10) + 'px';
$(winName + '_setFont').style.top = (browserHeight() - 85) + 'px';
$(winName + '_setFontSize').style.top = (browserHeight() - 85) + 'px';
$(winName + '_setFontColor').style.top = (browserHeight() - 85) + 'px';
$(winName + '_insertEmoticon').style.top = (browserHeight() - 85) + 'px';
$(winName + '_sendBox').style.top = (browserHeight() - 65) + 'px';
$(winName + '_sendBox').style.width = (browserWidth() - 16) + 'px';
rcvdBox.scrollTop = rcvdBox.scrollHeight - rcvdBox.clientHeight + 6;
}
};
Object.extend(IM, AjaxIM);
/**
* A class to mantain an IM Window's guts.
*
* @author Joshua Gross
**/
var IMWindow = Class.create(AjaxIMWindow);
IMWindow.addMethods({
/**
* Checks to see if there is a message, if there is,
* send it to the server.
*
* @author Joshua Gross
* @update Benjamin Hitchins
**/
send: function($super) {
$super();
var winId = this.getId();
var sendBox = $(winId + '_sendBox');
var isBold = (sendBox.style.fontWeight == '400' ? 'false' : 'true');
var isItalic = (sendBox.style.fontStyle == 'normal' ? 'false' : 'true');
var isUnderline = (sendBox.style.textDecoration == 'none' ? 'false' : 'true');
var fontName = $(winId + '_setFont').innerHTML;
var fontSize = $(winId + '_setFontSize').innerHTML;
var fontColor = $(winId + '_setFontColorColor').style.backgroundColor;
if(trim(sendBox.value).length > 0) {
var message = sendBox.value;
sendBox.value = '';
IM.sendMessage(this.username, message.replace(/&/g, "&amp;").replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/\n/g, "<br/>"), '', isBold, isItalic, isUnderline, fontName, fontSize, fontColor);
self.opener.Status.lastIM = new Date().getTime();
if (typeof(Status) != 'undefined' && self.opener.Status.wasSetAutoAway) {
self.opener.Status.set(1, Languages.get('available'));
}
}
scrollToBottom(winId + '_rcvd');
sendBox.focus();
}
});
+71
Ver Arquivo
@@ -0,0 +1,71 @@
///////////////////////////////////
// ajax im 3.41 //
// AJAX Instant Messenger //
// Copyright (c) 2006-2008 //
// http://www.ajaxim.com/ //
// Do not remove this notice //
///////////////////////////////////
/**
* Handle all requests that deal with a users' profile
*
* @author Benjamin Hutchins
**/
var Profile = {
windows: {}, // store all existent windows
/**
* Create new window for a user's profile,
* load the user profile and append it inside the window
*
* @arguments
* name - username of user we're getting the profile of
* title - title for window, default is the user's username
*
* @author Benjamin Hutchins
**/
create: function(name, title) {
var winLeft = Math.round(Math.random()*(Browser.width()-360))+'px';
var winTop = Math.round(Math.random()*(Browser.height()-400))+'px';
var winId = randomString(32) + '_profile';
this.windows[name] = new Window({id: winId, className: "dialog", width: 320, height: 335, top: winTop, left: winLeft, resizable: true, title: title, draggable: true, detachable: false, minWidth: 320, minHeight: 150, showEffectOptions: {duration: 0}, hideEffectOptions: {duration: 0}});
this.windows[name].setConstraint(true, {left: 0, right: 0, top: 0, bottom: 0});
var xhConn = new XHConn();
xhConn.connect(pingTo, "POST", "call=getprofile&user="+name,
function(xh) {
Profile.windows[name].getContent().innerHTML = '<div class="userProfile" id="'+name+'_userProfile">' +
(xh.responseText == "" ? Languages.get('hasNoProfile') : xh.responseText) + '</div>' +
'<div class="updateProfile">' +
ButtonCtl.create(Languages.get('update'), 'Profile.update(\''+name+'\');') +
'</div>';
}.bind(name)
);
//this.windows[name].setDestroyOnClose();
this.windows[name].show();
this.windows[name].toFront();
Windows.focusedWindow = this.windows[name];
},
/**
* Force-update a user's profile
*
* @arguments
* name - user's username
*
* @author Benjamin Hutchins
**/
update: function(name) {
if ($(name+'_userProfile')) {
var xhConn = new XHConn();
xhConn.connect(pingTo, "POST", "call=getprofile&user="+name,
function(xh) {
$(name+'_userProfile').innerHTML = (xh.responseText == "" ? Languages.get('hasNoProfile') : xh.responseText);
}
);
}
}
};
+8
Ver Arquivo
Diff do arquivo suprimido porque uma ou mais linhas são muito longas
+12
Ver Arquivo
Diff do arquivo suprimido porque uma ou mais linhas são muito longas
+91
Ver Arquivo
@@ -0,0 +1,91 @@
///////////////////////////////////
// ajax im 3.41 //
// AJAX Instant Messenger //
// Copyright (c) 2006-2008 //
// http://www.ajaxim.com/ //
// Do not remove this notice //
///////////////////////////////////
/**
* Handles user status changes
**/
var Status = {
state: 0, // current status
awayMessage: '', // away message
wasSetAutoAway: false, // did you get set as away because you were being antisocial?
lastIM: null, // timestamp of the last IM you sent
/**
* Change your status
*
* @arguments
* status - status [0=online, 1=away, 99=friends only, 49=invisible]
* away_msg - away message to use
*
* @author Joshua Gross
**/
set: function(status, away_msg) {
lastIM = new Date().getTime();
if(status == 1) { // away
this.state = 1;
this.awayMessage = away_msg;
$('curStatus').innerHTML = this.awayMessage.substring(0, 30) + (this.awayMessage.length > 30 ? '...' : '');
} else { // back
this.state = status; // 0 for avail, 99 for "friends only", 49 for "invisible"
this.awayMessage = '';
$('curStatus').innerHTML = away_msg;
}
$('statusList').hide();
},
/**
* Display entry box to allow the user to enter
* a custom away message.
*
* @author Joshua Gross
**/
customAway: function() {
$('curStatus').hide();
$('customStatus').show().focus();
},
/**
* Handle keyboard entires on customStatus.
*
* @arguments
* event - sent by browser
*
* @author Joshua Gross
**/
processCustomAway: function(event) {
event = event || event.window;
var asc = document.all ? event.keyCode : event.which;
if(asc == 13) {
awayMessage = $('customStatus').value;
$('curStatus').innerHTML = awayMessage.substring(0, 30) + (awayMessage.length > 30 ? '...' : '');
$('curStatus').show();
$('customStatus').hide();
Status.set(1, awayMessage);
}
return asc != 13;
},
/**
* Display/Hide the status drop down list
*
* @author Joshua Gross
**/
toggleStatusList: function() {
var sL = $('statusList');
if(sL.style.display == 'block') {
sL.hide();
if(sL.style.zIndex > Windows.maxZIndex) Windows.maxZIndex = sL.style.zIndex;
} else {
Element.setStyle(sL, {left: parseInt(Buddylist.buddyListWin.getLocation()['left']) + $('statusSettings').offsetLeft + $('blTopToolbar').offsetLeft + 'px', top: parseInt(Buddylist.buddyListWin.getLocation()['top']) + $('statusSettings').offsetTop + $('blTopToolbar').offsetTop + $('statusSettings').offsetHeight + 'px', zIndex: Windows.maxZIndex + 20, display: 'block'});
}
}
};
+611
Ver Arquivo
@@ -0,0 +1,611 @@
///////////////////////////////////
// ajax im 3.41 //
// AJAX Instant Messenger //
// Copyright (c) 2006-2008 //
// http://www.ajaxim.com/ //
// Do not remove this notice //
///////////////////////////////////
/**
* Handles session and most requests to the server
*
**/
var System = {
/**
* Checks to see if a login is valid and,
* if so logs the user in, else it shows an error.
*
* @author Joshua Gross
* @update Benjamin Hutchins
**/
login: function(u, p) {
var username = (u ? u : $('username').value);
var password = (p ? p : $('password').value);
var xhConn = new XHConn();
xhConn.connect(pingTo, "POST", "call=login&username="+username+"&password="+hex_md5(password),
function(xh) {
if(xh.responseText == 'invalid' || xh.responseText == 'banned') {
$('login_error_msg').innerHTML = (xh.responseText == 'invalid' ? Languages.get('incorrectInfo') : Languages.get('userBanned'));
$('login_error_msg').show();
new Effect.Shake('modal');
} else {
loggedIn = true;
user = username;
pass = hex_md5(password);
defaultTitle = document.title = document.title + ': ' + user;
$('languageList').hide();
if(typeof(Buddylist) != 'undefined') {
Buddylist.create();
if(trim(xh.responseText).length == 0) System.logout();
var response = xh.responseText.parseJSON();
pingTimer = setInterval('System.ping()', pingFrequency);
$('modal').hide();
if(response.blocked && response.blocked.length > 0) {
var blockList = response.blocked.parseJSON();
Buddylist.blocked = blockList;
} else {
Buddylist.blocked = {};
}
var buddy;
if(response.buddy && response.buddy.length > 0) {
var budList = response.buddy.parseJSON();
for(var group in budList) {
if(!$(group.replace(/\s/, '_')+'_group') && group != 'toJSONString') Buddylist.addGroup(group);
if(!Buddylist.list[group]) Buddylist.list[group] = {};
for(i=0; i<budList[group].length; i++) {
buddy = budList[group][i];
Buddylist.list[group][buddy.username] = {'username': buddy.username, 'blocked': (Buddylist.blocked.inArray(buddy.username) ? true : false), 'status': buddy.is_online, 'icon': buddy.icon}
if(typeof(Buddylist.listObjects[buddy.username]) == 'undefined') Buddylist.addBuddy(buddy.username, group, buddy.icon);
$(Buddylist.listObjects[buddy.username].obj).setStyle({display: 'block'});
if(!blockedBuddyStatus && Buddylist.list[group][buddy.username].blocked) {
Buddylist.moveBuddy(buddy.username, Languages.get('offline'));
$(Buddylist.listObjects[buddy.username].img).src = 'themes/' + theme + '/blocked.png';
} else {
if(buddy.is_online == 0 || buddy.is_online == 50) {
Buddylist.moveBuddy(buddy.username, Languages.get('offline'));
$(Buddylist.listObjects[buddy.username].img).src = 'themes/' + theme + '/offline.png';
} else if(buddy.is_online == 2) {
Buddylist.moveBuddy(buddy.username, group);
$(Buddylist.listObjects[buddy.username].img).src = 'themes/' + theme + '/away.png';
} else {
Buddylist.moveBuddy(buddy.username, group);
$(Buddylist.listObjects[buddy.username].img).src = 'themes/' + theme + '/online.png';
}
if(Buddylist.list[group][buddy.username].blocked == true) $(Buddylist.listObjects[buddy.username].img).src = 'themes/' + theme + '/blocked.png';
}
}
}
}
}
if(response.admin == 1) {
var s = document.createElement('script');
s.src = 'js/admin.js?' + (new Date()).getTime();
s.type = 'text/javascript';
document.getElementsByTagName('head').item(0).appendChild(s);
$('blBottomToolbar').innerHTML += '<a id="admin-button" href="#" onclick="AdminWindows.userSearch();return false;" title="Admin"><img src="themes/' + theme + '/window/admin.png" alt="Admin" style="border:0;" /></a>';
$('admin-button').setStyle({'position':'absolute', 'left': '0', 'top': '0'});
}
Event.observe(document, 'focus', function() { blinkerOn(false); });
Event.observe(window, 'focus', function() { blinkerOn(false); });
Event.observe(document, 'blur', function() { blinkerOn(true); });
Event.observe(window, 'blur', function() { blinkerOn(true); });
Event.observe(document, 'keypress',
function(event) {
event = event || window.event;
if(Windows.focusedWindow.getId().indexOf('_im') != -1 && IM.sendBoxWithFocus == null) {
var sB = $(Windows.focusedWindow.getId() + '_sendBox');
sB.focus(); sB.value += String.fromCharCode(event.charCode);
}
}
);
Event.stopObserving(window, 'resize', recenterModal);
Status.lastIM = new Date().getTime();
System.ping();
}
}
);
},
/**
* Check for press of 'return' or 'enter' and run 'func'
*
* @author Benjamin Hutchins
**/
keyHandler: function(event, func) {
event = event || window.event;
var asc = document.all ? event.keyCode : event.which;
if(asc == 13 && typeof func == 'function') func();
return asc != 13;
},
/**
* Log out the user
*
* @author Joshua Gross
**/
logout: function() {
if(user == '' || pass == '') return;
var xmlhttp=false;
/*@cc_on @*/
/*@if (@_jscript_version >= 5)
try {
xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
} catch (E) {
xmlhttp = false;
}
}
@end @*/
if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
xmlhttp = new XMLHttpRequest();
}
xmlhttp.open('POST', pingTo, false);
xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xmlhttp.send('call=logout');
clearTimeout(pingTimer);
defaultTitle = document.title = document.title.replace(': ' + user, '');
user = '';
pass = '';
loggedIn = false;
if(typeof(Status) != 'undefined') {
Status.state = 0;
Status.awayMessage = '';
}
Element.stopObserving(window, 'resize', recenterModal);
if(typeof(Buddylist) != 'undefined') Buddylist.destroy();
for(var name in IM.windows) {
if(typeof(IM.windows[name].getId) != 'undefined' && typeof($(IM.windows[name].getId())) != 'undefined') {
try {
if(IM.windows[name].detached)
IM.windows[name].popup.close();
else
IM.windows[name].destroy();
} catch(e) { }
}
}
for(var name in Chatroom.windows) {
if(typeof(Chatroom.windows[name].getId) != 'undefined' && typeof($(Chatroom.windows[name].getId())) != 'undefined') {
try {
Chatroom.windows[name].destroy();
} catch(e) { }
}
}
if($('admin-userSearch'))
Windows.getWindow('admin-userSearch').destroy();
Dialog.alert('<span class="dialog_long_label">' + Languages.get('signedOff') + '</span>',
{ windowParameters: {className:'alert', width:alertWidth, height: 85},
okLabel: Languages.get('reconnect'),
ok:function(win) {
try {
window.location.reload();
} catch(e) { }
}
}
);
},
/**
* Processes register requests
*
* @author Jostua Gross
**/
register: function() {
// if registration is disabled, don't do anything
if (!allowNewUsers) {
return;
}
var error = '';
var registerButton = $('register_button');
Event.stopObserving(registerButton, 'click', System.register);
if(($('newpassword').value == $('newpassword2').value)) {
if(checkEmailAddr($('newemail').value)) {
if($('newpassword').value.length >= 6 && $('newpassword').value.length <= 20) {
if($('newusername').value.isAlphaNumeric() && $('newusername').value.length >= 3 && $('newusername').value.length <= 16) {
var xhConn = new XHConn();
var username = $('newusername').value.toLowerCase();
var password = $('newpassword').value;
var email = $('newemail').value;
xhConn.connect(pingTo, "POST", "call=register&username="+username+"&password="+password+"&email="+email,
function(xh) {
switch(xh.responseText) {
case 'user_registered':
Dialog.alert('<span class="dialog_long_label">' + Languages.get('registerSuccess') + '</span><div style="clear:both"></div>',
{windowParameters: {className:'alert', width:alertWidth},
ok:function(win) { clearInputs(); Dialog.closeInfo(); Dialogs.login(); }});
Event.observe(registerButton, 'click', System.register);
return;
case 'username_taken':
error = Languages.get('registerUsernameTaken');
break;
case 'username_bad':
error = Languages.get('registerUsernameBad');
break;
case 'password_bad_length':
error = Languages.get('registerPasswordShort');
break;
case 'invalid_email':
error = Languages.get('registerInvalidEmail');
break;
case 'email_already_used':
error = Languages.get('registerEmailTaken');
break;
default:
error = Languages.get('registerFailed');
}
$('register_error_msg').innerHTML = error;
$('register_error_msg').setStyle({display: 'block'});
new Effect.Shake('modal');
Event.observe(registerButton, 'click', System.register);
});
return;
} else {
error = Languages.get('registerUsernameBad');
}
} else {
error = Languages.get('registerPasswordShort');
}
} else {
error = Languages.get('registerInvalidEmail');
}
} else {
error = Languages.get('registerPasswordsMatch');
}
$('register_error_msg').innerHTML = error;
$('register_error_msg').setStyle({display: 'block'});
new Effect.Shake('modal');
Event.observe(registerButton, 'click', System.register);
},
/**
* Check how long a user has been idle,
* if they've been idle more than idleTime allows,
* set them as away.
*
* @author Benjamin Hutchins
**/
idle: function() {
var timeStamp = new Date().getTime() - (idleTime * 60 * 1000);
if (Status.lastIM < timeStamp && typeof(Status) != 'undefined' && Status.state == 0) {
Status.set(1, Languages.get('away'));
Status.wasSetAutoAway = true;
}
},
/**
* The heart of this script,
* ping the server for new events and messages
*
* @author Joshua Gross
**/
ping: function(initial) {
// if auto-away is enabled, check the idle timer
if (idleTime > 0)
System.idle();
var xhConn = new XHConn();
xhConn.connect(pingTo, "POST", "call=ping&away="+(typeof(Status) != 'undefined' ? Status.state : 0)+(initial == true ? '&initial=true' : ''),
function(xh) {
var i;
if((typeof xh.status != 'undefined' && xh.status!=200) || xh.responseText == 'not_logged_in') {
System.logout();
return;
}
if(trim(xh.responseText).length == 0) return;
var response = xh.responseText.parseJSON();
var from, data, chatroom;
var messageCount = (typeof(response.messages) !== 'undefined' ? response.messages.length : 0);
for(i=0; i<messageCount; i++) {
chatroom = response.messages[i].chatroom;
if(!chatroom) {
from = response.messages[i].sender;
who = from;
} else {
var fromx = response.messages[i].sender.split('\.');
from = fromx[1];
who = fromx[0];
}
data = response.messages[i].message;
var winId = null;
try { winId = window[chatroom ? 'Chatroom' : 'IM'].windows[who].getId(); } catch(e) { };
if(!$(winId)) {
window[chatroom ? 'Chatroom' : 'IM'].create(who, who);
} else {
if(!window[chatroom ? 'Chatroom' : 'IM'].windows[who].detached && !window[chatroom ? 'Chatroom' : 'IM'].windows[who].isVisible()) {
window[chatroom ? 'Chatroom' : 'IM'].windows[who].show();
setTimeout("scrollToBottom('" + window[chatroom ? 'Chatroom' : 'IM'].windows[who].getId() + "_rcvd')", 125);
}
}
var curIM = (!window[chatroom ? 'Chatroom' : 'IM'].windows[who].detached ? $(window[chatroom ? 'Chatroom' : 'IM'].windows[who].getId()+"_rcvd") : window[chatroom ? 'Chatroom' : 'IM'].windows[who].popup.$(window[chatroom ? 'Chatroom' : 'IM'].windows[who].getId()+"_rcvd"));
data = data.replace(/(\s|\n|>|^)(\w+:\/\/[^<\s\n]+)/, '$1<a href="$2" target="_blank">$2</a>');
data = IM.emoteReplace(data, smilies);
if(data.replace(/<([^>]+)>/ig, '').indexOf('/me') == 0)
curIM.innerHTML += "<b class=\"user" + (from == user && chatroom ? 'A' : 'B') + "\">" + IM.createTimestamp() + " <i>" + from + ' ' + data.replace(/<([^>]+)>/ig, '').replace(/\/me/, '') + "</i></b><br>\n";
else
curIM.innerHTML += "<b class=\"user" + (from == user && chatroom ? 'A' : 'B') + "\">" + IM.createTimestamp() + " " + from + ":</b> " + data + "<br>\n";
curIM.scrollTop = curIM.scrollHeight - curIM.clientHeight + 6;
if(!initial) {
if(curIM.innerHTML.toLowerCase().replace(/<\S[^>]*>/g, '').indexOf(user.toLowerCase()+': (' + Languages.get('autoreply').toLowerCase() + ')') == -1 && typeof(Status) != 'undefined' && Status.state == 1 && who == from) {
var fontName = $(winId + '_setFont').innerHTML;
var fontSize = $(winId + '_setFontSize').innerHTML;
var fontColor = $(winId + '_setFontColorColor').style.backgroundColor;
window[chatroom ? 'Chatroom' : 'IM'].sendMessage(from, '(' + Languages.get('autoreply') + ') ' + Status.awayMessage, false, false, false, fontName, fontSize, fontColor);
}
if(Windows.getFocusedWindow().getId() != window[chatroom ? 'Chatroom' : 'IM'].windows[who].getId() && pulsateTitles == true) {
new Effect.Pulsate(window[chatroom ? 'Chatroom' : 'IM'].windows[who].getId() + '_top');
}
if(titlebarBlinker == true && useBlinker == true) {
clearTimeout(blinkerTimer);
blinkerTimer = setTimeout("titlebarBlink('"+who+"', \""+data.replace(/\"/, '\"').replace(/<([^>]+)>/ig, '')+"\", 0, "+chatroom+")", blinkSpeed);
}
}
curIM = null;
}
if(messageCount > 0 && audioNotify == true) soundManager.play('msg_in');
from = null; data = null;
var group = '', buddy = '', event = '';
var eventCount = (typeof(response.events) !== 'undefined' ? response.events.length : 0);
for(i=0; i<eventCount; i++) {
from = response.events[i].sender;
data = response.events[i].event;
who = (response.events[i].recipient == user ? from : response.events[i].recipient);
event = data.split(',');
switch(event[0]) {
case 'status':
if(typeof(Buddylist) != 'undefined') {
group = response.events[i].group;
if(group && !$(group.replace(/\s/, '_')+'_group') && group != 'toJSONString') Buddylist.addGroup(group);
if(typeof(Buddylist.listObjects[from]) == 'undefined') {
Buddylist.addBuddy(from, group, 'none');
Buddylist.list[group][from] = {'username': from, 'blocked': false, 'status': event[1]};
$(Buddylist.listObjects[from].obj).setStyle({display: 'block'});
} else if (group == null) {
group = Buddylist.listObjects[from].group;
}
Buddylist.list[group][from].status = event[1];
if(!blockedBuddyStatus && typeof(Buddylist.list[group][from]) !== 'undefined' && Buddylist.list[group][from].blocked) {
Buddylist.moveBuddy(from, Languages.get('offline'));
$(Buddylist.listObjects[from].img).src = 'themes/' + theme + '/blocked.png';
} else {
if(event[1] == 0 || event[1] == 50) {
Buddylist.moveBuddy(from, Languages.get('offline'));
IM.notifyUser(from, Languages.get('signedoff').replace('%1', from));
$(Buddylist.listObjects[from].img).src = (typeof(Buddylist.list[group][from]) !== 'undefined' && Buddylist.list[group][from].blocked ? 'themes/' + theme + '/blocked.png' : 'themes/' + theme + '/offline.png');
} else if(event[1] == 2) {
Buddylist.moveBuddy(from, group);
IM.notifyUser(from, Languages.get('wentaway').replace('%1', from));
$(Buddylist.listObjects[from].img).src = (typeof(Buddylist.list[group][from]) !== 'undefined' && Buddylist.list[group][from].blocked ? 'themes/' + theme + '/blocked.png' : 'themes/' + theme + '/away.png');
} else {
Buddylist.moveBuddy(from, group);
IM.notifyUser(from, Languages.get('cameback').replace('%1', from));
$(Buddylist.listObjects[from].img).src = (typeof(Buddylist.list[group][from]) !== 'undefined' && Buddylist.list[group][from].blocked ? 'themes/' + theme + '/blocked.png' : 'themes/' + theme + '/online.png');
}
}
}
break;
case 'chat':
var rcvdBox = $(Chatroom.windows[event[2]].getId()+"_rcvd");
if(event[1] == 'join') {
if(!$(from+'_'+event[2]+'_chatUser') && typeof(Chatroom.windows[event[2]]) != 'undefined') Chatroom.windows[event[2]].addUser(from);
rcvdBox.innerHTML = rcvdBox.innerHTML + "<b class=\"userB\">" + IM.createTimestamp() + " <i>"+from+" " + Languages.get('hasJoined') + "</i></b><br>";
scrollToBottom(Chatroom.windows[event[2]].getId()+"_rcvd");
} else if(event[1] == 'left') {
if(typeof(Chatroom.windows[event[2]]) != 'undefined') Chatroom.windows[event[2]].deleteUser(from);
rcvdBox.innerHTML = rcvdBox.innerHTML + "<b class=\"userB\">" + IM.createTimestamp() + " <i>"+from+" " + Languages.get('hasLeft') + "</i></b><br>";
scrollToBottom(Chatroom.windows[event[2]].getId()+"_rcvd");
}
break;
}
event = null;
}
from = null; data = null; who = null;
}
);
xhConn = null;
},
/**
* Update a user's budddy profile
*
* @author Benjamin Hutchins
**/
changeProfile: function() {
var profile = $('changeprofile_textarea').value, error = '';
if(profile.replace(/\s/g, "") != "") {
var xhConn = new XHConn();
xhConn.connect(pingTo, "POST", "call=changeprofile&profile="+encodeURIComponent(profile),
function(xh) {
if(xh.responseText == 'success') {
Dialog.closeInfo();
Dialog.alert('<span class="dialog_long_label lang-changeProfileSuccess">' + Languages.get('changeProfileSuccess') + '</span><div style="clear:both"></div>',
{windowParameters: {className:'alert', width:alertWidth, height:85},
ok: function(win) { Dialog.closeInfo(); Windows.close('changeProfile'); } });
} else {
error = Languages.get('changeProfileFailed');
}
if(error.length > 0) {
$('changeprofile_error_msg').innerHTML = error;
}
}
);
} else {
error = Languages.get('changeProfileEmpty');
}
if(error.length > 0) {
$('changeprofile_error_msg').innerHTML = error;
}
},
/**
* Update a users's buddy icon
*
* @author Benjamin Hutchins
**/
changeIcon: function() {
// get the iframe as a variable
var i = $('changeicon_iframe');
if (i.contentDocument) {
var d = i.contentDocument;
} else if (i.contentWindow) {
var d = i.contentWindow.document;
} else {
var d = window.frames['changeicon_iframe'].document;
}
// if the iframe was never processed, then return empty
if (d.location.href == "about:blank") {
return;
}
// handle returns from the server
var error = '', response = d.body.innerHTML;
if(response == 'success'){
Dialog.closeInfo();
Dialog.alert('<span class="dialog_long_label lang-changeBuddyiconSuccess">'+Languages.get('changeBuddyiconSuccess')+'</span><div style="clear:both"></div>',{windowParameters:{className:'alert',width:alertWidth,height:85},ok:function(win){Dialog.closeInfo();Windows.close('changeIcon');}});
} else if (response == 'nofile') {
error = Languages.get('changeIconSelectFile');
} else if (response == 'size') {
error = Languages.get('changeIconSize');
} else if (response == 'bad_type') {
error = Languages.get('changeIconBadType');
} else if (response == 'bad_extension') {
error = Languages.get('changeIconBadExtension');
} else {
error = Languages.get('changeIconFailed');
}
// if there was an error, show it
if(error.length > 0) {
$('changeicon_error_msg').innerHTML = error;
}
},
/**
* Change a user's password
*
* @author Joshua Gross
* @update Benjamin Hutchins
**/
changePass: function() {
var currentPw = $('currentpw').value, newPw = $('newpw').value, error = '';
if(hex_md5(currentPw) == pass) {
if(newPw == $('confirmpw').value) {
var xhConn = new XHConn();
xhConn.connect(pingTo, "POST", "call=pwdchange&username="+user+"&password="+hex_md5(currentPw)+"&newpwd="+newPw,
function(xh) {
if(xh.responseText == 'pw_changed') {
Dialog.closeInfo();
Dialog.alert('<span class="dialog_long_label lang-changeSuccess">' + Languages.get('changeSuccess') + '</span><div style="clear:both"></div>', {windowParameters: {className:'alert', width:alertWidth, height:85}, ok: function(win) { Dialog.closeInfo(); Windows.close('changePass'); setTimeout('System.logout();', 250); } });
} else if(xh.responseText == 'invalid_pw') {
error = Languages.get('currentPassInvalid');
$('currentpw').value = '';
} else if(xh.responseText == 'password_bad_length') {
error = Languages.get('changePasswordShort');
$('newpw').value = '';
$('confirmpw').value = '';
} else {
error = Languages.get('changeFailed');
}
if(error.length > 0) {
$('changepass_error_msg').innerHTML = error;
}
}
);
} else {
error = Languages.get('changeNoMatch');
}
} else {
error = Languages.get('currentPassInvalid');
}
if(error.length > 0) {
$('changepass_error_msg').innerHTML = error;
}
},
/**
* Reset a user's password to something new because they forgot it
*
* @author Joshua Gross
* @update Benjamin Hutchins
**/
resetPass: function() {
var xhConn = new XHConn();
xhConn.connect(pingTo, "POST", "call=reset&email="+encodeURIComponent($('resetto').value),
function(xh) {
var error = '';
if(xh.responseText == 'pw_reset') {
Dialog.alert('<span class="dialog_long_label lang-newPasswordEmailed langinsert-clear">' + Languages.get('newPasswordEmailed').replace('%1', $('resetto').value) + '</span><div style="clear:both"></div>', {windowParameters: {className:'alert', width:alertWidth}, ok:function(win) { clearInputs(); Dialog.closeInfo(); Dialogs.login(); }});
} else if(xh.responseText == 'no_email_on_record') {
error = Languages.get('noEmailOnRecord');
} else {
error = Languages.get('problemResetting');
}
if (error.length > 0) {
$('forgotpass_error_msg').innerHTML = error;
$('forgotpass_error_msg').setStyle({display: 'block'});
new Effect.Shake('modal');
}
}
);
}
};
+309
Ver Arquivo
@@ -0,0 +1,309 @@
/*
* A JavaScript implementation of the RSA Data Security, Inc. MD5 Message
* Digest Algorithm, as defined in RFC 1321.
* Version 2.1 Copyright (C) Paul Johnston 1999 - 2002.
* Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet
* Distributed under the BSD License
* See http://pajhome.org.uk/crypt/md5 for more info.
*/
var hexcase=0;var b64pad="";var chrsz=8;function hex_md5(s){return binl2hex(core_md5(str2binl(s),s.length*chrsz));}
function b64_md5(s){return binl2b64(core_md5(str2binl(s),s.length*chrsz));}
function str_md5(s){return binl2str(core_md5(str2binl(s),s.length*chrsz));}
function hex_hmac_md5(key,data){return binl2hex(core_hmac_md5(key,data));}
function b64_hmac_md5(key,data){return binl2b64(core_hmac_md5(key,data));}
function str_hmac_md5(key,data){return binl2str(core_hmac_md5(key,data));}
function md5_vm_test()
{return hex_md5("abc")=="900150983cd24fb0d6963f7d28e17f72";}
function core_md5(x,len)
{x[len>>5]|=0x80<<((len)%32);x[(((len+64)>>>9)<<4)+14]=len;var a=1732584193;var b=-271733879;var c=-1732584194;var d=271733878;for(var i=0;i<x.length;i+=16)
{var olda=a;var oldb=b;var oldc=c;var oldd=d;a=md5_ff(a,b,c,d,x[i+0],7,-680876936);d=md5_ff(d,a,b,c,x[i+1],12,-389564586);c=md5_ff(c,d,a,b,x[i+2],17,606105819);b=md5_ff(b,c,d,a,x[i+3],22,-1044525330);a=md5_ff(a,b,c,d,x[i+4],7,-176418897);d=md5_ff(d,a,b,c,x[i+5],12,1200080426);c=md5_ff(c,d,a,b,x[i+6],17,-1473231341);b=md5_ff(b,c,d,a,x[i+7],22,-45705983);a=md5_ff(a,b,c,d,x[i+8],7,1770035416);d=md5_ff(d,a,b,c,x[i+9],12,-1958414417);c=md5_ff(c,d,a,b,x[i+10],17,-42063);b=md5_ff(b,c,d,a,x[i+11],22,-1990404162);a=md5_ff(a,b,c,d,x[i+12],7,1804603682);d=md5_ff(d,a,b,c,x[i+13],12,-40341101);c=md5_ff(c,d,a,b,x[i+14],17,-1502002290);b=md5_ff(b,c,d,a,x[i+15],22,1236535329);a=md5_gg(a,b,c,d,x[i+1],5,-165796510);d=md5_gg(d,a,b,c,x[i+6],9,-1069501632);c=md5_gg(c,d,a,b,x[i+11],14,643717713);b=md5_gg(b,c,d,a,x[i+0],20,-373897302);a=md5_gg(a,b,c,d,x[i+5],5,-701558691);d=md5_gg(d,a,b,c,x[i+10],9,38016083);c=md5_gg(c,d,a,b,x[i+15],14,-660478335);b=md5_gg(b,c,d,a,x[i+4],20,-405537848);a=md5_gg(a,b,c,d,x[i+9],5,568446438);d=md5_gg(d,a,b,c,x[i+14],9,-1019803690);c=md5_gg(c,d,a,b,x[i+3],14,-187363961);b=md5_gg(b,c,d,a,x[i+8],20,1163531501);a=md5_gg(a,b,c,d,x[i+13],5,-1444681467);d=md5_gg(d,a,b,c,x[i+2],9,-51403784);c=md5_gg(c,d,a,b,x[i+7],14,1735328473);b=md5_gg(b,c,d,a,x[i+12],20,-1926607734);a=md5_hh(a,b,c,d,x[i+5],4,-378558);d=md5_hh(d,a,b,c,x[i+8],11,-2022574463);c=md5_hh(c,d,a,b,x[i+11],16,1839030562);b=md5_hh(b,c,d,a,x[i+14],23,-35309556);a=md5_hh(a,b,c,d,x[i+1],4,-1530992060);d=md5_hh(d,a,b,c,x[i+4],11,1272893353);c=md5_hh(c,d,a,b,x[i+7],16,-155497632);b=md5_hh(b,c,d,a,x[i+10],23,-1094730640);a=md5_hh(a,b,c,d,x[i+13],4,681279174);d=md5_hh(d,a,b,c,x[i+0],11,-358537222);c=md5_hh(c,d,a,b,x[i+3],16,-722521979);b=md5_hh(b,c,d,a,x[i+6],23,76029189);a=md5_hh(a,b,c,d,x[i+9],4,-640364487);d=md5_hh(d,a,b,c,x[i+12],11,-421815835);c=md5_hh(c,d,a,b,x[i+15],16,530742520);b=md5_hh(b,c,d,a,x[i+2],23,-995338651);a=md5_ii(a,b,c,d,x[i+0],6,-198630844);d=md5_ii(d,a,b,c,x[i+7],10,1126891415);c=md5_ii(c,d,a,b,x[i+14],15,-1416354905);b=md5_ii(b,c,d,a,x[i+5],21,-57434055);a=md5_ii(a,b,c,d,x[i+12],6,1700485571);d=md5_ii(d,a,b,c,x[i+3],10,-1894986606);c=md5_ii(c,d,a,b,x[i+10],15,-1051523);b=md5_ii(b,c,d,a,x[i+1],21,-2054922799);a=md5_ii(a,b,c,d,x[i+8],6,1873313359);d=md5_ii(d,a,b,c,x[i+15],10,-30611744);c=md5_ii(c,d,a,b,x[i+6],15,-1560198380);b=md5_ii(b,c,d,a,x[i+13],21,1309151649);a=md5_ii(a,b,c,d,x[i+4],6,-145523070);d=md5_ii(d,a,b,c,x[i+11],10,-1120210379);c=md5_ii(c,d,a,b,x[i+2],15,718787259);b=md5_ii(b,c,d,a,x[i+9],21,-343485551);a=safe_add(a,olda);b=safe_add(b,oldb);c=safe_add(c,oldc);d=safe_add(d,oldd);}
return Array(a,b,c,d);}
function md5_cmn(q,a,b,x,s,t)
{return safe_add(bit_rol(safe_add(safe_add(a,q),safe_add(x,t)),s),b);}
function md5_ff(a,b,c,d,x,s,t)
{return md5_cmn((b&c)|((~b)&d),a,b,x,s,t);}
function md5_gg(a,b,c,d,x,s,t)
{return md5_cmn((b&d)|(c&(~d)),a,b,x,s,t);}
function md5_hh(a,b,c,d,x,s,t)
{return md5_cmn(b^c^d,a,b,x,s,t);}
function md5_ii(a,b,c,d,x,s,t)
{return md5_cmn(c^(b|(~d)),a,b,x,s,t);}
function core_hmac_md5(key,data)
{var bkey=str2binl(key);if(bkey.length>16)bkey=core_md5(bkey,key.length*chrsz);var ipad=Array(16),opad=Array(16);for(var i=0;i<16;i++)
{ipad[i]=bkey[i]^0x36363636;opad[i]=bkey[i]^0x5C5C5C5C;}
var hash=core_md5(ipad.concat(str2binl(data)),512+data.length*chrsz);return core_md5(opad.concat(hash),512+128);}
function safe_add(x,y)
{var lsw=(x&0xFFFF)+(y&0xFFFF);var msw=(x>>16)+(y>>16)+(lsw>>16);return(msw<<16)|(lsw&0xFFFF);}
function bit_rol(num,cnt)
{return(num<<cnt)|(num>>>(32-cnt));}
function str2binl(str)
{var bin=Array();var mask=(1<<chrsz)-1;for(var i=0;i<str.length*chrsz;i+=chrsz)
bin[i>>5]|=(str.charCodeAt(i/chrsz)&mask)<<(i%32);return bin;}
function binl2str(bin)
{var str="";var mask=(1<<chrsz)-1;for(var i=0;i<bin.length*32;i+=chrsz)
str+=String.fromCharCode((bin[i>>5]>>>(i%32))&mask);return str;}
function binl2hex(binarray)
{var hex_tab=hexcase?"0123456789ABCDEF":"0123456789abcdef";var str="";for(var i=0;i<binarray.length*4;i++)
{str+=hex_tab.charAt((binarray[i>>2]>>((i%4)*8+4))&0xF)+
hex_tab.charAt((binarray[i>>2]>>((i%4)*8))&0xF);}
return str;}
function binl2b64(binarray)
{var tab="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";var str="";for(var i=0;i<binarray.length*4;i+=3)
{var triplet=(((binarray[i>>2]>>8*(i%4))&0xFF)<<16)|(((binarray[i+1>>2]>>8*((i+1)%4))&0xFF)<<8)|((binarray[i+2>>2]>>8*((i+2)%4))&0xFF);for(var j=0;j<4;j++)
{if(i*8+j*6>binarray.length*32)str+=b64pad;else str+=tab.charAt((triplet>>6*(3-j))&0x3F);}}
return str;}
/*
json
2006-04-28
This file adds these methods to JavaScript:
object.toJSONString()
This method produces a JSON text from an object. The
object must not contain any cyclical references.
array.toJSONString()
This method produces a JSON text from an array. The
array must not contain any cyclical references.
string.parseJSON()
This method parses a JSON text to produce an object or
array. It will return false if there is an error.
*/
(function () {
var m = {
'\b': '\\b',
'\t': '\\t',
'\n': '\\n',
'\f': '\\f',
'\r': '\\r',
'"' : '\\"',
'\\': '\\\\'
},
s = {
array: function (x) {
var a = ['['], b, f, i, l = x.length, v;
for (i = 0; i < l; i += 1) {
v = x[i];
f = s[typeof v];
if (f) {
v = f(v);
if (typeof v == 'string') {
if (b) {
a[a.length] = ',';
}
a[a.length] = v;
b = true;
}
}
}
a[a.length] = ']';
return a.join('');
},
'boolean': function (x) {
return String(x);
},
'null': function (x) {
return "null";
},
number: function (x) {
return isFinite(x) ? String(x) : 'null';
},
object: function (x) {
if (x) {
if (x instanceof Array) {
return s.array(x);
}
var a = ['{'], b, f, i, v;
for (i in x) {
v = x[i];
f = s[typeof v];
if (f) {
v = f(v);
if (typeof v == 'string') {
if (b) {
a[a.length] = ',';
}
a.push(s.string(i), ':', v);
b = true;
}
}
}
a[a.length] = '}';
return a.join('');
}
return 'null';
},
string: function (x) {
if (/["\\\x00-\x1f]/.test(x)) {
x = x.replace(/([\x00-\x1f\\"])/g, function(a, b) {
var c = m[b];
if (c) {
return c;
}
c = b.charCodeAt();
return '\\u00' +
Math.floor(c / 16).toString(16) +
(c % 16).toString(16);
});
}
return '"' + x + '"';
}
};
Object.prototype.toJSONString = function () {
return s.object(this);
};
Array.prototype.toJSONString = function () {
return s.array(this);
};
})();
String.prototype.parseJSON = function () {
try {
return !(/[^,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]/.test(
this.replace(/"(\\.|[^"\\])*"/g, ''))) &&
eval('(' + this + ')');
} catch (e) {
return false;
}
};
/** XHConn - Simple XMLHTTP Interface - bfults@gmail.com - 2005-04-08 **
** Code licensed under Creative Commons Attribution-ShareAlike License **
** http://creativecommons.org/licenses/by-sa/2.0/ **/
function XHConn()
{
var xmlhttp, bComplete = false;
xmlhttp = XHRFactory.getInstance();
if (!xmlhttp) return null;
this.connect = function(sURL, sMethod, sVars, fnDone)
{
if (!xmlhttp) return false;
bComplete = false;
sMethod = sMethod.toUpperCase();
try {
if (sMethod == "GET")
{
xmlhttp.open(sMethod, sURL+"?"+sVars, true);
sVars = "";
}
else
{
xmlhttp.open(sMethod, sURL, true);
xmlhttp.setRequestHeader("Method", "POST "+sURL+" HTTP/1.1");
xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
}
xmlhttp.onreadystatechange = function(){
if (xmlhttp.readyState == 4 && !bComplete)
{
bComplete = true;
if(fnDone != null) fnDone(xmlhttp);
XHRFactory.release(xmlhttp);
}};
xmlhttp.send(sVars);
}
catch(z) { return false; }
return true;
};
return this;
}
/** XHRFactory **
** This class from: http://blogs.pathf.com/agileajax/2006/08/object_pooling_.html **/
var XHRFactory = (function(){
// static private member
var stack = new Array();
var poolSize = 10;
var nullFunction = function() {}; // for nuking the onreadystatechange
// private static methods
function createXHR() {
if (window.XMLHttpRequest) {
return new XMLHttpRequest();
} else if (window.ActiveXObject) {
return new ActiveXObject('Microsoft.XMLHTTP')
}
}
// cache a few for use
for (var i = 0; i < poolSize; i++) {
stack.push(createXHR());
}
// shared instance methods
return ({
release:function(xhr){
xhr.onreadystatechange = nullFunction;
stack.push(xhr);
},
getInstance:function(){
if (stack.length < 1) {
return createXHR();
} else {
return stack.pop();
}
},
toString:function(){
return "stack size = " + stack.length;
}
});
})();
// Adapted from DOM Ready extension by Dan Webb
// http://www.vivabit.com/bollocks/2006/06/21/a-dom-ready-extension-for-prototype
// which was based on work by Matthias Miller, Dean Edwards and John Resig
//
// Usage:
//
// Event.onReady(callbackFunction);
Object.extend(Event, {
_domReady : function() {
if (arguments.callee.done) return;
arguments.callee.done = true;
if (Event._timer) clearInterval(Event._timer);
Event._readyCallbacks.each(function(f) { f() });
Event._readyCallbacks = null;
},
onReady : function(f) {
if (!this._readyCallbacks) {
var domReady = this._domReady;
if (domReady.done) return f();
if (document.addEventListener)
document.addEventListener("DOMContentLoaded", domReady, false);
/*@cc_on @*/
/*@if (@_win32)
var dummy = location.protocol == "https:" ? "https://javascript:void(0)" : "javascript:void(0)";
document.write("<script id=__ie_onload defer src='" + dummy + "'><\/script>");
document.getElementById("__ie_onload").onreadystatechange = function() {
if (this.readyState == "complete") { domReady(); }
};
/*@end @*/
if (/WebKit/i.test(navigator.userAgent)) {
this._timer = setInterval(function() {
if (/loaded|complete/.test(document.readyState)) domReady();
}, 10);
}
Event.observe(window, 'load', domReady);
Event._readyCallbacks = [];
}
Event._readyCallbacks.push(f);
}
});
+1805
Ver Arquivo
Diferenças do arquivo suprimidas por serem muito extensas Carregar Diff