No auto-refresh

By n0nick Last update May 15, 2006 — Installed 1,772 times.

Archived Comments (locked)

in
Subscribe to Archived Comments 6 posts, 5 voices



Jesse Andrews Admin

The following is an archive of comments made before threaded discussions was implemented (November 16th, 2008)

 
Lucza Gyuri Scriptwright

http://userscripts.org/scripts/show/5506

 
n0nick Script's Author

lior z - thanks a lot for the tip ! i integrated your line to the script.
if someone knows how to do a case-insensitive search, i guess that would be the best option...
until then!

 
Lior Zur Scriptwright

Nice work, but why don't you just use the | operator inside the XPath, as follows:
//meta[@http-equiv='Refresh']|//meta[@http-equiv='refresh']|//meta[@http-equiv='REFRESH']

Look for reference:

http://www.zvon.org/xxl/XPathTutorial/Output/ex...

 
Jeff 2 User
whoops! that didn't work as well as i'd hoped. my edited copy is at

http://jeffhecker.net/noautorefresh.user.js

Thanks again / Jeff
 
Jeff 2 User

n0nick,

I took your script and just put the tests in a loop so that the code isn't repeated three times. It would be better for you to update your script rather than me adding yet another no-refresh script. Thanks in advance. Here's the bits...

var tag = new Array ( "refresh", "Refresh", "REFRESH" );
var i, r, refresh, content, stoptimer;

for (i=0; i<tag>
r = tag[i];
refresh = document.evaluate("//meta[@http-equiv='" + r + "']",
document,
null,
XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,
null);
if (refresh.snapshotItem(0) != null){
content = refresh.snapshotItem(0).getAttribute("content");
stopTimer = window.setTimeout("window.stop();",
(content-1)*1000); // in case load hasn't finished when the refresh fires
window.addEventListener ("load", function(){
try { window.clearTimeout(stopTimer); } catch(ex) {}
window.stop();
}, true);
GM_log ("stopped meta-" +r);
}
}

Cross
Presentational HTML allowed.
Use <code> for inline code and <pre> for code blocks. Use &lt; and &gt; for literal < and >.
We help break paragraphs and link your links.
or cancel