$(function(){
$('input, textarea').addClass('ui-state-default ui-corner-all').css({'padding': '1px', 'margin': '1px'}).attr('autocomplete', 'off');
/*
$('.icon_click').live('contextmenu',function(e){
if(e.pageX >= ($(document).width()-200)){
xx = e.pageX - 40;
} else {
xx = e.pageX - 10;
}
if(e.pageY >= ($(document).height()-200)){
yy = e.pageY - 90;
} else {
yy = e.pageY - 10;
}
//alert(e.pageX+' '+e.pageY);
$('body').append('
');
$('.context_menu').live('mouseout', function(){ $(this).remove(); });
return false;});
$(document).bind('contextmenu',function(e){ return false;});
*/
if($.browser.msie){
$('body').css({'font-size': '30px', 'text-align': 'center'}).html('This site is not compatible with Internet Explorer.
Please download Firefox, Google Chrome, Opera, or Safari
To view the site.');
} else {
load_desktop();
}
});
function load_update(){
$.ajax({url: "update.php?action=update", success: function(data){
if(data == 'offline'){
load_desktop(1);
} else if(data == 'force'){
load_desktop(2);
} else if(data == 'ban'){
load_desktop(3);
} else {
if(data){ data = data.split('-_-');
if(data[0] == 'mail'){show_alert('mail', data[1], data[2]); rload("mail_cont", "mail.php");
loggedin[2] = ' ';
} else if(data[0] == 'alert'){show_alert('alert', data[1], '');
} else if(data[0] == 'wind'){
if($('.mess_'+data[1]).length > 0){
a = $.window.getWindow($('.'+open['container']).attr('id'));
a.addContent(data[3]);
} else {
var wind = new Array();
wind['title'] = 'Message with: '+data[1];
wind['url'] = 'message.php?action=live_message&id='+data[2];
wind['width'] = 300;
wind['height'] = 400;
wind['footer'] = 'Cyber City Messaging system. Version 0';
wind['closable'] = true;
wind['minimizable'] = true;
wind['maximizable'] = true;
wind['draggable'] = true;
wind['container'] = 'mess_'+data[1];
open_close(wind, '');
}}}}}});
setTimeout(function(){load_update()}, 15000);
}
function show_alert(type, say, read){
bottom = 50 + ($('.pop_div').size()*30);
id = $('.pop_div').size();
if(type == 'alert'){
$('body').append('Alert: '+say+'
');
} else if(type == 'mail'){
$('body').append('New Mail From: '+say+'
');
}
$('#'+id).fadeIn(2000).delay(5000).fadeOut(4000, function() { $(this).remove();}).click(function(){ $(this).remove(); });
}
function start_menu(){
var move = 0;
$('.toolbar-start').click(function(){if($('.toolbar-start-popup').is(':hidden')){ $('.toolbar-start-popup').fadeIn(1000); } else { $('.toolbar-start-popup').fadeOut(1000);}});
$('.menu_click').live('click', function(){ $('.toolbar-start-popup').fadeOut(1000);});
$(document).dblclick(function(){ $('.toolbar-start-popup').fadeOut(1000);});
$('.button').button();
$('#cpanel').button({icons: {primary: "ui-icon-clipboard"}}).click(function(){open['title'] = 'User Control Panel';open['url'] = 'control.php';open['width'] = 400;open['height'] = 400;open['scrollable'] = true;open['resizable'] = true;open['maximizable'] = true;open['draggable'] = true;open['minimizable'] = true;open['closable'] = true;open['footer'] = 'Your control panel.';open['container'] = 'cpannel';open_close(open, ''); $('.toolbar-start-popup').fadeOut(1000); });
$('#logoff').button({ icons: {primary: "ui-icon-key"}}).click(function(){open['title'] = 'Logout';open['url'] = 'logout.php';open['width'] = 200;open['height'] = 100;open['showModal'] = true;open['scrollable'] = false;open['resizable'] = false;open['maximizable'] = false;open['minimizable'] = false;open['closable'] = false;open['footer'] = 'Logging you out, please wait.';open['container'] = 'logout';open_close(open, ''); $('.toolbar-start-popup').fadeOut(1000); });
$('#note').button().click(function(){open['title'] = 'Your Notes';open['url'] = 'note.php';open['width'] = 400;open['height'] = 400;open['resizable'] = true;open['maximizable'] = true;open['minimizable'] = true;open['closable'] = true;open['draggable'] = true;open['footer'] = 'Viewing Notes.';open['container'] = 'notepad';open_close(open, ''); $('.toolbar-start-popup').fadeOut(1000); });
$('#torrent').button().click(function(){open['title'] = 'Cyber Torrent';open['url'] = 'cybertorrent.php';open['width'] = 500;open['height'] = 400;open['scrollable'] = true;open['resizable'] = true;open['maximizable'] = true;open['minimizable'] = true;open['closable'] = true;open['footer'] = 'Download more content.';open['container'] = 'torrent';open_close(open, ''); $('.toolbar-start-popup').fadeOut(1000); });
/*
$('#download').button().click(function(){open['title'] = 'Your Downloads';open['url'] = 'download.php';open['width'] = 400;open['height'] = 200;open['minimizable'] = true;open['closable'] = true;open['draggable'] = true;open['footer'] = 'Viewing current downloads.';open['container'] = 'dwnld';open_close(open, ''); $('.toolbar-start-popup').fadeOut(1000); });
*/
/*
$('.mail_read').live('click', function(){open['title'] = 'Your Mail';open['url'] = 'mail.php';open['width'] = 500;open['height'] = 400;open['minimizable'] = true;open['closable'] = true;open['draggable'] = true;open['footer'] = 'Viewing Your Mail.';open['container'] = 'mail_cont';open_close(open, '');});
*/
$('.mail_read').live('click', function(){open['title'] = 'Read Mail';open['url'] = 'message.php?action=read_pop&id='+$(this).attr('read');open['width'] = 500;open['height'] = 400;open['closable'] = true;open['minimizable'] = true;open['draggable'] = true;open['footer'] = 'Currently reading mail.';open['container'] = 'message_read';open_close(open, '');});
$('.mail').live('click', function(){open['title'] = 'Your Mail';open['url'] = 'mail.php';open['width'] = 500;open['height'] = 400;open['minimizable'] = true;open['closable'] = true;open['draggable'] = true;open['footer'] = 'Viewing Your Mail.';open['container'] = 'mail_cont';open_close(open, '');});
$('.alert').live('click', function(){open['title'] = 'Your Alerts';open['url'] = 'alert.php';open['width'] = 500;open['height'] = 400;open['minimizable'] = true;open['closable'] = true;open['draggable'] = true;open['footer'] = 'Viewing Your Alerts.';open['container'] = 'alert_cont';open_close(open, '');});
$('.notice').live('click', function(){open['title'] = 'Game Notices';open['url'] = 'notices.php';open['width'] = 500;open['height'] = 400;open['minimizable'] = true;open['closable'] = true;open['draggable'] = true;open['footer'] = 'Viewing Game Notices.';open['container'] = 'notice_cont';open_close(open, '');});
$('#test .head').click(function(){
if(move == 0){
if($('#acc').next().is(':hidden')){
move = 1;
$('#pnl').next().fadeOut(1000, function(){ $('#acc').animate({bottom: '+=210px'}, 1000, function(){ $('#arrow').removeClass('ui-icon-triangle-1-n').addClass('ui-icon-triangle-1-s'); $('#acc').next().fadeIn(1000, function(){ move=0;});})});
return false;
} else {
move = 1;
$('#acc').next().fadeOut(1000, function(){ $('#acc').animate({bottom: '-=210px'}, 1000, function(){ $('#arrow').removeClass('ui-icon-triangle-1-s').addClass('ui-icon-triangle-1-n'); $('#pnl').next().fadeIn(1000, function(){ move=0;});})});
return false;
}
}
});
}
function prepare_window(){
$.window.prepare({dockArea: $('.toolbar')});
$('.window_pop').live('click', function(){
if($('.'+$(this).attr('container')).length > 0){
if($.window.getWindow($('.'+$(this).attr('container')).attr('id')).isMinimized()){
$.window.getWindow($('.'+$(this).attr('container')).attr('id')).restore();
} else {
$.window.getWindow($('.'+$(this).attr('container')).attr('id')).select();
}
} else {
window =
$.window({
title: $(this).attr('ti'),
url: $(this).attr('url'),
width: $(this).attr('width'),
height: $(this).attr('height'),
minWidth: $(this).attr('minWidth'),
minHeight: $(this).attr('minHeight'),
maxWidth: $(this).attr('maxWidth'),
maxHeight: $(this).attr('maxHeight'),
showModal: $(this).attr('showModal'),
footerContent: $(this).attr('footer'),
closable: $(this).attr('closable'),
minimizable: $(this).attr('minimizable'),
maximizable: $(this).attr('maximizable'),
draggable: $(this).attr('draggable'),
resizable: $(this).attr('resizable'),
scrollable: $(this).attr('scrollable'),
info: $(this).attr('info'),
containerClass: $(this).attr('container')
});
}
});
$('.trash').droppable({drop: function( event, ui ) {ui.draggable.remove();}});
$('#icons').sortable({items: "li:not(.trash)", revert: true, containment: 'document', opacity: 0.5, update: function(){ $.ajax({url: 'update.php?action=icon&data='+$('#icons').sortable('toArray')});} }).disableSelection();
$('#left_menu').sortable({items: "li:not(.header)", revert: true, containment: 'document', opacity: 0.5, update: function(){ $.ajax({url: 'update.php?action=left&data='+$('#left_menu').sortable('toArray')});} }).disableSelection();
$('#right_menu').sortable({items: "li:not(.header)", revert: true, containment: 'document', opacity: 0.5, update: function(){ $.ajax({url: 'update.php?action=right&data='+$('#right_menu').sortable('toArray')});} }).disableSelection();
}
function change_foot(say){
$.window.getSelectedWindow().setFooterContent(say);
}
function rload(id, rl){
$.window.getWindow($('.'+id).attr('id')).setUrl(rl);
}
function change_title(say){
$.window.getSelectedWindow().setTitle(say);
}
function open_close(open, close){
if(close){
killit(close);
}
function blink_it(elem){
$.window.getWindow($('.'+elem).attr('id')).blink();
}
if(open){
if($('.'+open['container']).length > 0){
if($.window.getWindow($('.'+open['container']).attr('id')).isMinimized()){
$.window.getWindow($('.'+open['container']).attr('id')).restore();
} else {
$.window.getWindow($('.'+open['container']).attr('id')).select();
}
} else {
window = $.window({
title: open['title'],
url: open['url'],
width: open['width'],
height: open['height'],
minWidth: open['minWidth'],
minHeight: open['minHeight'],
maxWidth: open['maxWidth'],
maxHeight: open['maxHeight'],
showModal: open['showModal'],
footerContent: open['footer'],
closable: open['closable'],
minimizable: open['minimizable'],
maximizable: open['maximizable'],
draggable: open['draggable'],
resizable: open['resizable'],
scrollable: open['scrollable'],
info: open['info'],
containerClass: open['container']
});
}
}
}
function killit(data){
if(!data){
$.window.getSelectedWindow().close();
} else {
data = data.split('-_-');
$.window.getWindow($('.'+data[0]).attr('id')).close();
}
}
function load_time(){
var clock = { foreground: 'white', utc: true, utc_offset: -6, format: '%I:%M %P' };
var words = { foreground: 'white', utc: true, utc_offset: -6, format: '%A %B %d, %Y' };
$('.timer').jclock(clock).mouseover(function(){ $('body').append(''); $('.toolbar-timer-popup').jclock(words);});
$('.timer').mouseout(function(){ $('.toolbar-timer-popup').remove(); });
}
function load_desktop(parm){
if(parm != 1 && parm != 2 && parm != 3){
parm = 0;
}
$('.window_panel, .toolbar-start, .toolbar-timer, .toolbar-start-popup, #test, .icon_click, .toolbar, #icons, #window_overlay').remove();
//$('.icon_click').remove();
//$('.toolbar').remove();
$.ajax({url: "load_desktop.php", success: function(data){
if(data == 'offline' || data == 'ban'){
if(data == 'ban'){
parm = 3;
}
window = $.window({
title: 'Login Form',
url: 'login.php?offline='+parm,
x: -1,
y: -1,
createRandomOffset: {x:0,y:0},
width: 550,
height: 400,
scrollable: true,
containerClass: 'login_cont'
});
} else {
data = data.split('-_-_-');
var loggedin = new Array('','','');
if(data[3] == 'update_loader'){
loggedin[0] = 'Accessories
';
loggedin[1] = '';
loggedin[2] = '';
}
$('.mail_icon_min').live('mouseover', function(){$('body').append('');
$.ajax({url: "update.php?action=mail_count", success: function(data){$('.toolbar-timer-popup').html(data);}});});
$('.mail_icon_min').live('mouseout', function(){ $('.toolbar-timer-popup').remove(); });
$('.alert_icon_min').live('mouseover', function(){$('body').append('');
$.ajax({url: "update.php?action=alert_count", success: function(data){$('.toolbar-timer-popup').html(data);}});});
$('.alert_icon_min').live('mouseout', function(){ $('.toolbar-timer-popup').remove(); });
$('.notice_icon_min').live('mouseover', function(){$('body').append('');
$.ajax({url: "update.php?action=notice_count", success: function(data){$('.toolbar-timer-popup').html(data);}});});
$('.notice_icon_min').live('mouseout', function(){ $('.toolbar-timer-popup').remove(); });
$('body').html(''+loggedin[2]+'
Start