Large diffs are not rendered by default.

Large diffs are not rendered by default.

BIN -2.7 KB (77%) img/icon128.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN -183 Bytes (76%) img/icon19.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN +26 Bytes (100%) img/icon19off.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@@ -1,5 +1,5 @@
function receiver(_data) {
//console.log('ca receiver: ', _data);
console.log('ca receiver: ', _data);
switch (_data.task) {
case com.task.signed:
$('#signed_request').val(_data.data);
@@ -22,6 +22,11 @@ function receiver(_data) {
break;
case com.task.alive:
break;
case com.task.caStart:
if(location.search.indexOf('needclickers=1') === -1) {
initCastleAge();
}
break;
default:
console.log(_data.task + ' unknown!');
}
@@ -8,10 +8,13 @@ function cageNews(_full) {
$('#results_main_wrapper span.result_body:first').append('<div id="cageNews"><center id="cageNewsHead">' + _hed + '</center><center id="cageNewsSubHead">' + _sub + '</center><div id="cageNewsBody"><br><b>Changelog:</b><ul id="cageNewsChanges"></ul></div><div id="cageNewsFoot"><br><a href="http://cagenhancer.blogspot.com/" target="_blank">Blog</a> <a href="http://cagenhancer.blogspot.com/p/manual.html" target="_blank">Manual</a> <form action="https://www.paypal.com/cgi-bin/webscr" target="_blank" method="post" style="display:inline-block;bottom:-8px;position:relative"><input type="hidden" name="cmd" value="_s-xclick"><input type="hidden" name="hosted_button_id" value="PC84GRGBLQ2J8"><input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_donate_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!"><img alt="" border="0" src="https://www.paypalobjects.com/de_DE/i/scr/pixel.gif" width="1" height="1"></form> <a href="http://caaplayer.freeforums.org/c-a-g-e-f29.html" target="_blank">Forum</a> <a href="https://github.com/unknowner/CAGE" target="_blank">GitHub</a><br><br><span style="font-size:12px;text-align:center;">You want to say thank you? Just visit the Blog, click an Ad or donate via PayPal.</span></div></div>');
$('#cageNewsFoot').prepend('<center>If you find bugs, just go to the blog and post them there (no signup required).<br>Logs (CTRL+SHIFT+J) are always welcome!</center>');
$.each([
'ADD: COPTER connection',
'FIX: Battle stats',
'FIX: Double scrollbars',
'FIX: General equipment not updating'
'ADD: COPTER connection',
'ADD: Enable/disable CAGE (Chrome)',
'ADD: Needclicker can disable CAGE for CTAs',
'ADD: Show stats for items in keep',
'FIX: Battle stats',
'FIX: Double scrollbars',
'FIX: General equipment not updating'
], function(_i, _e) {
$('#cageNewsChanges').append('<li><span>' + _e.split(':')[0] + '</span>' + _e.split(':')[1] + '</li>');
});
@@ -13,11 +13,14 @@ tools.Page.pages['keep.php'] = function() {
// Collapsed items/untits ...
$('div.statsTTitle').toggle(function() {
$(this).parents('div.statsT2:first').css({
'height' : '100%'
'height' : '100%',
'overflow' : ''
});
scrollTo(0, $(this).offset().top - 110);
}, function() {
$(this).parents('div.statsT2:first').css({
'height' : 30
'height' : 30,
'overflow' : 'hidden'
});
});
// Calulate devine power
@@ -118,9 +121,31 @@ tools.Page.pages['keep.php'] = function() {
$('div.keep_healer_section').prepend($('<div id="cageKeepStats">').append('<div>eAtt: ' + _data.eAt.toFixed(2) + '</div><div style="font-size:9px;">Effective Attack</div>').append('<div>eDef: ' + _data.eDe.toFixed(2) + '</div><div style="font-size:9px;">Effective Defense</div>').append('<div>BSI: ' + _data.bsi.toFixed(2) + '</div><div style="font-size:9px;">Battle Strength Index</div>').append('<div>LSI: ' + _data.lsi.toFixed(2) + '</div><div style="font-size:9px;">Levelling Speed Index</div>').append('<div>TSI: ' + _data.tsi.toFixed(2) + '</div><div style="font-size:9px;">Total Skillpoints per Level</div>').append('<div>Divine: ' + _divPow + '</div><div style="font-size:9px;">Calculated Divine Power</div>'));
}
// rearrange Items
window.setTimeout(function() {
$('.statUnit').find('img').unwrap().unwrap();
setTimeout(function() {
$('.statUnit').each(function() {
var $this = $(this), $next = $this.next(), _text = $next.text().trim();
if(_text !== '') {
_text = _text.split(/(\r\n|\n|\r)/gm);
$next.remove();
} else {
_text = [$this.find('img').attr('title')];
}
for(var i = 0; i < _text.length; i++) {
if(_text[i].trim() == '') {
_text.splice(i, 1);
i--;
} else {
_text[i] = _text[i].trim();
}
}
$this.data('info', _text.join('<br>')).find('img').hover(function() {
$this.css('zIndex', 1).prepend('<div class="cageUnitStats"><div>' + $this.data('info') + '</div></div>');
}, function() {
$this.css('zIndex', '').children('div.cageUnitStats').remove();
}).attr('title', '').unwrap().unwrap();
})
}, 50);

// Add stuff on others keep
if($('div.keep_main_section').length === 0) {
if($('#keep_battle_frm1').length === 0) {
@@ -21,9 +21,9 @@ tools.Page.pages['land.php'] = function() {
}
// ROI
$('#section_land, #section_special_land').children().each(function() {
$this = $(this);
var _income = parseInt($this.children('div:eq(1), div:eq(2):has(strong.gold)').text().trim().match(/\d+$/), 10), _price = parseInt($this.find('strong.gold').text().replace(',', '').match(/\d+/));
console.log(_income, _price);
console.log(_income / _price);
var _income = parseInt($(this).find('div > strong.gold:first').text().replace(/,/g, ''), 10);
var _price = parseInt($(this).find('div > strong.gold:last').text().replace(/,/g, ''), 10);
console.log(_income, _price, _income / _price);
});

};
@@ -1,6 +1,5 @@
// CAGE stuff working on Castle Age site
//$(document.body).hide();
$('#AjaxLoadIcon').append('<img id="cageLogo" src="' + getPath('img/icon64.png') + '">').append('<div id="cageLoadError">Loading CAGE...</div>').fadeIn('slow');

var CastleAge = {
bqh : null,
signed_request : null,
@@ -9,47 +8,54 @@ var CastleAge = {
startInterval : null,
started : false
};

com.initPort(com.port.castleAge);
var _append = '';
$.each(['css/cage.css', 'css/cage_sidebar.css', 'css/ca_cage.css', 'css/cage_stats.css', 'css/cage_general.css', 'css/ca_pages.css', 'css/ca_monster.css', 'css/ui.selectmenu.css', 'css/cage_settings.css', 'css/cage_tools.css'], function(_i, _e) {
_append += '<link rel="stylesheet" type="text/css" href="' + getPath(_e) + '?_=' + Math.random() + '" >';
});
_append += '<link id="cageTheme" rel="stylesheet" type="text/css" href="' + getPath('css/dark-hive/jquery-ui.css') + '" >';
_append += '<script type="text/javascript" language="javascript" src="' + getPath('js/jquery.js') + '"></script>';
$(document.body).append($('<input>').attr({
'id' : 'signed_request',
'type' : 'hidden'
})).append(_append);
_append = null;
// Add CAGE container / repos menu / repos chat
$('#globalContainer').append('<div id="cageSidebar"><div id="cageSidebarHeader"></div><div id="cageSidebarStats"></div><div id="cageSidebarTools"></div><div id="cageSidebarChat"></div><div id="cageSidebarBottom"><a href="http://cagenhancer.blogspot.com/" target="_blank">Blog</a> <a href="http://cagenhancer.blogspot.com/p/manual.html" target="_blank">Manual</a> <a href="http://caaplayer.freeforums.org/c-a-g-e-f29.html" target="_blank">Forum</a> <a href="https://github.com/unknowner/CAGE" target="_blank">GitHub</a></div></div><div id="cageStatsContainer"></div><div id="cageContainer"></div>').prepend($('#expandedGuildChat, #collapsedGuildChat').detach());
CastleAge.startInterval = setInterval(function() {
if(CastleAge.signed_request !== null && CastleAge.userId !== null) {
clearInterval(CastleAge.startInterval);
setInterval(function() {
com.send(com.task.alive, com.port.facebook, null);
}, 10000);
initTools();
var _startURL = $('#current_pg_url').attr('value');
if(_startURL.indexOf('?') !== -1) {
_startURL = _startURL.substring(0, _startURL.indexOf('?'));
}
console.log("URL:" + _startURL);
tools.Page.allPages();
if(tools.Page.pages[_startURL]) {
tools.Page.pages[_startURL]();
}
_startURL = null;
com.send(com.task.caStart, com.port.castleAge, null);

$('#AjaxLoadIcon').delay(3000).fadeOut(1000, function() {
$('#collapsedGuildChat').css('left', '');
$('#expandedGuildChat').css('left', '');
$('#chatGuildChat').scrollTop($('#chatGuildChat div').length * 20);
$('#cageLoadError').remove();
});
} else {
com.send(com.task.castleAgeReady, com.port.facebook);
}
}, 100);
// startup repos etc...
$('#main_ststb').html($('#main_ststb').html().replace(/more/g, ''));
function initCastleAge() {
$('#AjaxLoadIcon').append('<img id="cageLogo" src="' + getPath('img/icon64.png') + '">').append('<div id="cageLoadError">Loading CAGE...</div>').fadeIn('slow');
var _append = '';
$.each(['css/cage.css', 'css/cage_sidebar.css', 'css/ca_cage.css', 'css/cage_stats.css', 'css/cage_general.css', 'css/ca_pages.css', 'css/ca_monster.css', 'css/ui.selectmenu.css', 'css/cage_settings.css', 'css/cage_tools.css'], function(_i, _e) {
_append += '<link rel="stylesheet" type="text/css" href="' + getPath(_e) + '?_=' + Math.random() + '" >';
});
_append += '<link id="cageTheme" rel="stylesheet" type="text/css" href="' + getPath('css/dark-hive/jquery-ui.css') + '" >';
_append += '<script type="text/javascript" language="javascript" src="' + getPath('js/jquery.js') + '"></script>';
$(document.body).append($('<input>').attr({
'id' : 'signed_request',
'type' : 'hidden'
})).append(_append);
_append = null;

// Add CAGE container / repos menu / repos chat
$('#globalContainer').append('<div id="cageSidebar"><div id="cageSidebarHeader"></div><div id="cageSidebarStats"></div><div id="cageSidebarTools"></div><div id="cageSidebarChat"></div><div id="cageSidebarBottom"><a href="http://cagenhancer.blogspot.com/" target="_blank">Blog</a> <a href="http://cagenhancer.blogspot.com/p/manual.html" target="_blank">Manual</a> <a href="http://caaplayer.freeforums.org/c-a-g-e-f29.html" target="_blank">Forum</a> <a href="https://github.com/unknowner/CAGE" target="_blank">GitHub</a></div></div><div id="cageStatsContainer"></div><div id="cageContainer"></div>').prepend($('#expandedGuildChat, #collapsedGuildChat').detach());
CastleAge.startInterval = setInterval(function() {
if(CastleAge.signed_request !== null && CastleAge.userId !== null) {
clearInterval(CastleAge.startInterval);
setInterval(function() {
com.send(com.task.alive, com.port.facebook, null);
}, 10000);
initTools();
var _startURL = $('#current_pg_url').attr('value');
if(_startURL.indexOf('?') !== -1) {
_startURL = _startURL.substring(0, _startURL.indexOf('?'));
}
console.log("URL:" + _startURL);
tools.Page.allPages();
if(tools.Page.pages[_startURL]) {
tools.Page.pages[_startURL]();
}
_startURL = null;

$('#AjaxLoadIcon').delay(3000).fadeOut(1000, function() {
$('#collapsedGuildChat').css('left', '');
$('#expandedGuildChat').css('left', '');
$('#chatGuildChat').scrollTop($('#chatGuildChat div').length * 20);
$('#cageLoadError').remove();
});
} else {
com.send(com.task.castleAgeReady, com.port.facebook);
}
}, 100);
// startup repos etc...
$('#main_ststb').html($('#main_ststb').html().replace(/more/g, ''));
}
@@ -30,6 +30,8 @@ var com = {
task : {
alive : 'TASK_ALIVE',
init : 'TASK_INIT',
caStart : 'TASK_CASTART',
fbStart : 'TASK_FBSTART',
fbReady : 'TASK_FBREADY',
getGeneral : 'TASK_GETGENERAL',
general : 'TASK_GENERAL',
@@ -61,16 +63,21 @@ var com = {
// Called in background.html to setup port listeners
initBackground : function() {
chrome.extension.onConnect.addListener(function(_port) {
console.log('onconnect:', _port);
com.ports[_port.name] = _port;
_port.onMessage.addListener(function(_message) {
console.log('onMessage:', _message);
if(_message.port === com.port.background) {
note(_message.data);
} else {
com.ports[_message.port].postMessage(_message);
}
});
if(CAGE.enable === true) {
console.log('onconnect:', _port);
com.ports[_port.name] = _port;
_port.onMessage.addListener(function(_message) {
console.log('onMessage:', _message);
if(_message.port === com.port.background) {
// currently only one type, can be expanded
note(_message.data);
} else {
com.ports[_message.port].postMessage(_message);
}
});
} else {
console.log('connection refused');
}
});
},
// Send Messages to ports
@@ -1,20 +1,20 @@
// CAGE stuff working on facebook site
Facebook = {
var _window = window || this.unsafeWindow, Facebook = {
started : false,
bluebarHidden : false
};

com.initPort(com.port.facebook);
com.send(com.task.fbStart, com.port.facebook, null);

$('head').append('<style type="text/css" id="cageIFrame">')
//.append('<link id="cageTheme" rel="stylesheet" type="text/css" href="' + getPath('css/dark-hive/') + 'jquery-ui.css">')
.append('<link rel="stylesheet" type="text/css" href="' + getPath('css/fb_cage.css?x=' + Math.random() * 1000) + '">');
function initFacebook() {
$('head').append('<style type="text/css" id="cageIFrame">').append('<link rel="stylesheet" type="text/css" href="' + getPath('css/fb_cage.css?x=' + Math.random() * 1000) + '">');

var _window = window || this.unsafeWindow;
_window.onresize = function(evt) {
$('#cageIFrame').html('.cageIFrame {height:' + (_window.innerHeight - (Facebook.bluebarHidden === true ? 1 : 34)) + 'px !important;}');
};
_window.onresize = function(evt) {
$('#cageIFrame').html('.cageIFrame {height:' + (_window.innerHeight - (Facebook.bluebarHidden === true ? 1 : 34)) + 'px !important;}');
};

$('#contentArea').css('backgroundColor', '#000');
$('#cageIFrame').html('.cageIFrame {height:' + (_window.innerHeight - (Facebook.bluebarHidden === true ? 1 : 34)) + 'px !important;}');
$('#iframe_canvas').addClass('cageIFrame').attr('scrolling', 'yes');
$('#contentArea').css('backgroundColor', '#000');
$('#cageIFrame').html('.cageIFrame {height:' + (_window.innerHeight - (Facebook.bluebarHidden === true ? 1 : 34)) + 'px !important;}');
$('#iframe_canvas').addClass('cageIFrame').attr('scrolling', 'yes');
}
@@ -32,5 +32,10 @@ function receiver(_data) {
$('#fbNotificationsFlyout').removeClass('cageNotificationsFlyout');
$('#cageIFrame').html('.cageIFrame {height:' + (_window.innerHeight - (Facebook.bluebarHidden === true ? 1 : 34)) + 'px !important;}');
break;
case com.task.fbStart:
if(location.search.indexOf('needclickers=1') === -1) {
initFacebook();
}
break;
}
}