javascript - Disabling a page's focus-checking function using GM -


this question has answer here:

i'm trying stop page stopping when thinks it's lost focus. how disabling function within webpage using gm?

i'll try giving script on page, can me decipher better, lol.

<script> var nmn=0,isa=0,pr=1,wc=1,clkt='ptc',clki=303250,clkc=634089,capt=1367698325,stimg='http://something.com/img/',fxp=0,timer=30,tfrac=188,wmw=640,wmh=320,txbop='******************************\nthis website attempting break out of frame.\nchoose stay on page otherwise won\'t paid.\n******************************',txtt='<table cellpadding=0 cellspacing=0><tr><td>',txet=txtt+'<img src="'+stimg+'error48.png" class=icon /><td>',txpb=txtt+'<img src="'+stimg+'clock48.png" class=icon /><td><div class=progressbar style=width:175px><div id=progress style=width:100%><\/div><\/div><div>',txtp='please take time visit<br />our sponsor\'s site below',txtp='<table cellpadding=0 cellspacing=0 id=pb><tr><td><img src="'+stimg+'clock48.png" class=icon /><td><div class=progressbar><div id=progress><\/div><\/div><div id=secs>30<\/div><div>'+txtp+'<\/div><\/table><table cellpadding=0 cellspacing=0 id=pe style=display:none><tr><td><img src="'+stimg+'error48.png" class=icon /><td id=ped><\/table>',txwm=txpb+'please wait moment<\/div><\/table>',txlw=txpb+'please wait while<br>website loading<\/div><\/table>',txcc='<div style=font-size:22px;line-height:20px>click on cat<\/div><div class=msgx>find below cat continue<\/div>',txce=txet+'your click has expired<div class=msgx>you\'ve waited long click<br><a href=javascript:; onclick=win.opener.reloadads();win.close()>close window try again<\/a><\/div><\/table>',txvc=txpb+'validating click<\/div><\/table>',txea=txet+'unexpected error (#',txeb=')<div class=msgx><a href=javascript:; onclick=win.opener.reloadads();win.close()>close window try again<\/a><\/div><\/table>',txe1=txea+'304',txe2=txea+'305'+txeb,txe3=txea+'306'+txeb,txws='we\'re sorry browser<br />window small view<br />this advert. please resize.',txe4=txet+'you not signed in!<div class=msgx><a href=javascript:; onclick=win.opener.reloadads();win.close()>close window try again<\/a><\/div><\/table>',txfv=txpb+'please wait while your<br />click being validated<\/div><\/table>',txnf='<span style=cursor:pointer>you need keep advert<br />on focus credit<br /><a href=javascript:void(0); style=font-size:13px>please click here continue<\/a><\/span>'; var win=window,doc=document,sb=1,cx=0,xps=60,xpst=0,xpsi=0,xpsy=0,plc=0,ww=0,wh=0,wf=1,lwf=1,sw=0,sh=0,px=0,py=0,pg=0,pgid=0,lt=0,fc=0,st=0,lx=0,ld=0 </script>  <script> if(typeof jquery=='undefined')function il(){$('#msg').html(txet+'jquery javascript library missing/blocked<div class=msgx><a href=javascript:; onclick=doc.location.reload(true)>refresh page<\/a> or <a href="/en/helpdesk-submit_a_ticket?nsubject=jquery+not+found+ptc+site+%23303250" target=_blank>contact us<\/a> if error persists<\/a><\/div><\/table>')}else{$(win).bind('beforeunload',function(){upp();if(sb)return txbop});$(win).focus(function(){wf=1}).blur(function(){wf=0});function rstc(){upp();if(sb)$.post('/ajax_clicks.php',{type:clkt,a:clki,b:clkc,c:2,d:0,w:ww,h:wh,f:lwf,sw:sw,sh:sh,px:px,py:py})}win.onunload=rstc;function il(){lx=1;win.cleartimeout(stt);ia()}function ia(){if(ld||pr)return;ld=1;$('#msg').html(txtp);pg=(new date()).gettime();lt=pg;pgid=setinterval(ib,tfrac)} function upp(){px=(typeof win.screenleft!='undefined'?win.screenleft:win.screenx)-(typeof win.screen.left!='undefined'?win.screen.left:0),py=(typeof win.screentop!='undefined'?win.screentop:win.screeny);lwf=((typeof doc.hasfocus!='undefined'?doc.hasfocus():wf)?1:0);ww=$(win).width();wh=$(win).height();sw=win.screen.width,sh=win.screen.height}function ib(){if(fc)return;fc=1;var t=(new date()).gettime();upp();if(!nmn){if(!isa&&(!lwf||px<=-32000)){pg=pg+(t-math.min(t,lt));lt=t;if(st!=1){$('#pb').hide();$('#ped').html(txnf);$('#pe').show()}st=1}else if((ww<wmw||wh<wmh)){pg=pg+(t-math.min(t,lt));lt=t;if(st!=2){$('#pb').hide();$('#ped').html(txws);$('#pe').show()}st=2}else{lt=t;if(st!=0){$('#pe').hide();$('#pb').show()}st=0}}t=(t-pg)/1000; var p=(t/timer*100).tofixed(2);if(p>=100){win.clearinterval(pgid);p=100}$('.progressbar #progress').css('width',p+'%');$('#secs').text(timer-math.round(t));if(p==100){sb=0;$('#msg').html(txfv);ic(0)}fc=0}function ip(){pr=0;if(lx)ia();else{$('#msg').html(txlw);stt=win.settimeout(ia,10000)}}function ic(v){upp();$.post('/ajax_clicks.php',{type:clkt,a:clki,b:clkc,c:1,d:cx,w:ww,h:wh,f:lwf,sw:sw,sh:sh,px:px,py:py,fxp:fxp},function(d){$('#msg').html(d);win.opener.reloadads();win.focus();sb=0;$('#pnlnk').fadein();$('#clslnk').fadein()}).error(function(e){if(v==0)ic(1);else $('#msg').html(e.status==401?txe4:txe3)})}function rc(){win.cleartimeout(xpsy);win.clearinterval(xpsi);$('.xps').parent().hide()}function sc(){wc=1;$('#msg').html(txwm);rc();if(plc>=5){$('#msg').html(txtt+'<img src="'+stimg+'help48.png" class=icon /><td>'+txcc+'<\/table>');$('.capt').show().next().css('top','230px');xpsy=win.settimeout(plx,30000)}else $('.capt').hide().next().css('top','100px')} function hc(){rc();wc=0;$('.capt').hide().next().css('top','100px')}function ix(){xps=math.round(60-(((new date()).gettime()-xpst)/1000));if(xps<=0){hc();$('#msg').html(txce);rstc();sb=0}else $('.xps').html(xps)}function pl(){plc++;if(plc<5)return;if(wc)sc()}function plx(){$('.xps').html('60').parent().show();xpst=(new date()).gettime();xpsi=win.setinterval(ix,1000)}function cc(b,v){$('#msg').html(txvc);hc();$.post('/ajax_clicks.php',{type:'captcha_click',a:clkc,b:b,c:capt},function(d){if(d.done)ip();else if(d.err){$('#msg').html(txet+d.err+'<\/table>');if(d.nc){capt=d.capt;plc=0;$('#cpics').html(d.nc)}else sb=0}},'json').error(function(e){if(e.status!=401&&v!=1)cc(b,1);else{if(e.status!=401)rstc();sb=0;$('#msg').html(e.status==401?txe4:txe1+'/'+e.status+txeb)}})} function lc(v){plc=0;wc=0;sc();$.post('/ajax_clicks.php',{type:'captcha_reload',a:clkc},function(d){if(d.err)$('#msg').html(txet+d.err+'<\/table>');else{wc=1;capt=d.capt;$('#cpics').html(d.nc)}},'json').error(function(e){if(e.status!=401&&v!=1)lc(1);else{if(e.status!=401)rstc();sb=0;rc();$('#msg').html(e.status==401?txe4:txe2)}})}function fxd(){fxp=1}var stt=0} </script> <script type="text/javascript"> var _qevents=_qevents||[];(function(){var elem=document.createelement('script');elem.src=(document.location.protocol=="https:"?"https://secure":"http://edge")+".quantserve.com/quant.js";elem.async=true;elem.type="text/javascript";var scpt=document.getelementsbytagname('script')[0];scpt.parentnode.insertbefore(elem,scpt);})();_qevents.push({qacct:"p-ebyiu3buivzko"}); </script> 

now part 'think' want change this

txnf='<span style=cursor:pointer>you need keep advert<br />on focus credit<br /><a href=javascript:void(0); style=font-size:13px>please click here continue<\/a><\/span>'; 

my thinking changing txnf varible disable function stops timer if page isnt focused upon.

here's code tried no sucess..

document.head.innerhtml= document.head.innerhtml.replace('txnf',''); 

i no error on error console , nothing happens.

please , thank you!

in general, surgically disable or alter page's javascript, use checkforbadjavascripts shown in "how alter javascript greasemonkey?".

however, in case, page using document.hasfocus(), should enough hijack that:

// ==userscript== // @name     _your_script_name // @include  http://your_server.com/your_path/* // @run-at   document-start // @grant    none // ==/userscript==  document.hasfocus = function () {return true;}; 

Comments

Popular posts from this blog

Perl - how to grep a block of text from a file -

delphi - How to remove all the grips on a coolbar if I have several coolbands? -

javascript - Animating array of divs; only the final element is modified -