On 2010-05-29 08:44, jyothi panidarapu wrote:
I have installed and tried it. There was no affect after installation.
Can somebody tell me what's wrong with it?
On Wed, May 26, 2010 at 6:23 PM, jyothi panidarapu
<[email protected] <mailto:[email protected]>> wrote:
I am including the script that I have written, please tell me if
something is wrong. I haven't installed yet, before that I have
read up how to test it.
// ==UserScript==
// @key value
// @name : Reload the page if there is any change in Ip address of
the system
// namespace
// @Description:
// @include http://*
// @include file://*
// ==/UserScript==
window.setInterval("checkIpChange()",2000); // Call the function
every 2 seconds
This line should be
window.setInterval(checkIpChange,2000); // Call the function every
2 seconds
as otherwise it will try to call an undefined function. (See
http://wiki.greasespot.net/Avoid_Common_Pitfalls_in_Greasemonkey for
more detail, specifically the Auto-Eval Strings section.)
var protocol= location.protocol;
var pattern= file:
Not sure what this line is trying to do, exactly. Maybe something got
left out in copy+paste?
function checkIpChange()
{
protocol= location.protocol;
if( protocol.match(pattern)
{
window.location.reload();
}
else
{
GM_xmlhttpRequest(
{
method: 'GET',
url: 'http://localhost/readValue.txt', // file
which contains the value
headers:
{
'User-agent': 'Mozilla/4.0 (compatible) Greasemonkey',
'Accept':
'application/atom+xml,application/xml,text/xml',
Are you really requesting Atom and XML? It seems like this would be more
likely to require text/plain.
},
onload: function(responseDetails) //My text file entry
would be either '0' or '1'
{
/*alert('Request for Atom feed returned ' +
responseDetails.status + ' ' + responseDetails.statusText + '\n\n' +
'Feed data:\n' + responseDetails.responseText);*/
change= responseDetails.responseText ;
if(change==1)
{
window.location.reload();
}
else
{
//Do Nothing
}
}
}
);
}
}
Thanks
Jyoti
On Wed, May 26, 2010 at 12:11 PM, cc <[email protected]
<mailto:[email protected]>> wrote:
Give it a go, it should work. (Also, in general: it's often
faster just to try a naive test, and if it works, you're
golden; asking the group takes longer and more of our time.)
On 2010-05-25 23:35, jyothi panidarapu wrote:
I have a small doubt.
if I load the text file on my local web server, can I read
the value of it using GM_xmlhttprequest() ?
http://localhost/myfile.txt
On Wed, May 26, 2010 at 11:28 AM, esquifit
<[email protected] <mailto:[email protected]>> wrote:
Here you can find some inspiration:
http://groups.google.com/group/greasemonkey-users/browse_thread/thread/21ad5af3c7cc4b00
--
cc | pseudonymous |<http://carlclark.mp/>
--
~ Smash forehead on keyboard to continue.... ~
http://tagzilla.mozdev.org v0.066
--
You received this message because you are subscribed to the Google Groups
"greasemonkey-users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/greasemonkey-users?hl=en.