当我认为页面失去焦点时,我试图阻止页面停止。那么如何使用GM禁用网页中的功能?
我会尝试在页面上提供脚本,希望有人可以帮助我更好地解读它,大声笑。
<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 is attempting to break out of the frame.\nChoose to stay on this page otherwise you won\'t get 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 to 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 a moment<\/div><\/table>',txlw=txpb+'Please wait while<br>website is loading<\/div><\/table>',txcc='<div style=font-size:22px;line-height:20px>Click on the Cat<\/div><div class=msgx>Find below where the Cat is to continue<\/div>',txce=txet+'Your click has expired<div class=msgx>You\'ve waited too long to click<br><a href=javascript:; onclick=win.opener.reloadAds();win.close()>Close this window to try again<\/a><\/div><\/table>',txvc=txpb+'Validating your click<\/div><\/table>',txea=txet+'Unexpected error (#',txeb=')<div class=msgx><a href=javascript:; onclick=win.opener.reloadAds();win.close()>Close this window to try again<\/a><\/div><\/table>',txe1=txea+'304',txe2=txea+'305'+txeb,txe3=txea+'306'+txeb,txws='We\'re sorry but your browser<br />window is too small to view<br />this advert. Please resize.',txe4=txet+'You Are Not Signed In!<div class=msgx><a href=javascript:; onclick=win.opener.reloadAds();win.close()>Close this window to try again<\/a><\/div><\/table>',txfv=txpb+'Please wait while your<br />click is being validated<\/div><\/table>',txnf='<span style=cursor:pointer>You need to keep this advert<br />on focus to get credit<br /><a href=javascript:void(0); style=font-size:13px>Please click here to 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 this page<\/a> or <a href="/en/Helpdesk-Submit_a_Ticket?nsubject=jQuery+Not+Found+PTC+Site+%23303250" target=_blank>contact us<\/a> if this 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>
现在,我想'我想改变的部分是这个
txnf='<span style=cursor:pointer>You need to keep this advert<br />on focus to get credit<br /><a href=javascript:void(0); style=font-size:13px>Please click here to continue<\/a><\/span>';
我的想法是更改txnf varible将禁用此功能,如果页面没有关注,则会停止计时器。
这是我尝试过的没有成功的代码..
document.head.innerHTML= document.head.innerHTML.replace('txnf','');
我在错误控制台上没有错误,没有任何反应。
拜托,谢谢!
答案 0 :(得分:3)
一般情况下,要手动禁用或更改网页的javascript,请使用"How to alter this javascript with Greasemonkey?"中显示的checkForBadJavascripts
。
但是,在这种情况下,页面正在使用document.hasFocus()
,所以它应该足以劫持:
// ==UserScript==
// @name _YOUR_SCRIPT_NAME
// @include http://YOUR_SERVER.COM/YOUR_PATH/*
// @run-at document-start
// @grant none
// ==/UserScript==
document.hasFocus = function () {return true;};