window.addEventListener("load", function(){
getBrowser().addEventListener("TabSelect", checkEE, false); // When people change tabs, we need to recheck
var appcontent = document.getElementById("appcontent"); // browser
if (appcontent) appcontent.addEventListener("DOMContentLoaded", checkEE, true);
}, false);
function checkEE(){
document.getElementById("expressionengine_detector").style.display = 'none'; // Hide it
var win = getBrowser().selectedBrowser.contentWindow.wrappedJSObject; // The page
var cookies = win.document.cookie.split(';'); // All cookies
var cookieCount = 0;
// Loop through all cookies
for (var i=0;i < cookies.length; i++) {
var cookie = cookies[i];
cookie = cookie.split('=');
cookie[0] = ED_Trim(cookie[0]);
if ( cookie[0].indexOf('last_visit') > 0 ||
cookie[0].indexOf('last_activity') > 0 ||
cookie[0].indexOf('tracker') > 0 ||
cookie[0].indexOf('userhash') > 0 ||
cookie[0].indexOf('uniqueid') > 0 ||
cookie[0].indexOf('sessionid') > 0
) cookieCount++;
//Firebug.Console.log(cookie);
}
// If we have 3 strikes
if (cookieCount > 2) document.getElementById("expressionengine_detector").style.display = '';
//Firebug.Console.log(win.document.cookie);
//Firebug.Console.log(document.getElementById("expressionengine_detector"));
}
function ED_Trim (str) {
var str = str.replace(/^\s\s*/, ''),
ws = /\s/,
i = str.length;
while (ws.test(str.charAt(--i)));
return str.slice(0, i + 1);
}