Script Updater

By alien_scum Last update Jul 28, 2007 — Installed 38,481 times. Daily Installs: 14, 11, 9, 8, 5, 5, 15, 9, 13, 4, 10, 10, 8, 15, 11, 18, 14, 12, 7, 8, 16, 19, 10, 9, 16, 8, 27, 13, 27, 12, 10

Archived Comments (locked)

Subscribe to Archived Comments 53 posts, 27 voices

Jesse Andrews Admin

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

 
sanriver12 User

does this script work??? never seen any changes/action

 
Eyal Soha Scriptwright

Okay, I've got all the patches together in one bundle now. alien_scum needs to update his script!

--- scriptupdater.user.js.orig	2008-07-29 13:32:41.000000000 +0300
+++ scriptupdater.user.js	2008-07-29 13:32:47.000000000 +0300
@@ -29,12 +29,12 @@
 
 
 
-function xhr(uri,f,a,b,c) {GM_xmlhttpRequest({method: 'get',headers: {'User-agent': 'Mozilla/4.0 (compatible) Greasemonkey'},url: uri,onload:function(res){f(res.responseText,a,b,c)}});}
+function xhr(uri,f,a,b,c,d) {GM_xmlhttpRequest({method: 'get',headers: {'User-agent': 'Mozilla/4.0 (compatible) Greasemonkey'},url: uri,onload:function(res){f(res.responseText,a,b,c,d)}});}
 
 function iframe(src,show) {var f=document.createElement('iframe');f.style.display=show?'inline':'none';f.src=src;return f;}
 
 function hash(s){
-  s=s.replace(/&/g,'&').replace(/&\w*;/g,'').replace(/[^\w(){}=.-+]/g,'');
+  s=s.replace(/&/g,'&').replace(/&\w*;/g,'').replace(/[^-\w(){}=.+]/g,'');
   var h=0;
   for (i=0;i<s><<3>>29)^s.charCodeAt(i);
   return h 
@@ -121,6 +121,7 @@
         cnt++;
         tr.appendChild(cE('td',name=n.getAttribute('name')));
         tr.appendChild(cE('td',filename=n.getAttribute('filename')));
+        basedir=n.getAttribute('basedir');
         if(n.getAttribute('enabled')=='false'){
           tr.style.background='#EEEEEE';
           tr.appendChild(cE('td','disabled')); 
@@ -148,7 +149,7 @@
             cnt--;
           });
         },tr.appendChild(cE('td')),name,n.getAttribute('namespace'));
-        tr.appendChild(cE('td')).appendChild(iframe(profile+'gm_scripts/'+filename)).parentNode.style.display='none';
+        tr.appendChild(cE('td')).appendChild(iframe(profile+'gm_scripts/'+basedir+'/'+filename)).parentNode.style.display='none';
       }
       mes.innerHTML='looking on us.o for updates...';
       window.setTimeout(function (){//waits for iframe to load
@@ -181,16 +182,15 @@
   if(!/#scriptupdater/.test(location.href) && checkable()) {
     scripts=getValue('scripts');
     for(s in scripts){
-      xhr(ckref(scripts[s].num),function(res,s){
-        script=scripts[s];
-        if (hash(res)!=script.hash) {
+      xhr(ckref(scripts[s].num),function(res,s,script_name,script_hash,script_num){
+        if (hash(res)!=script_hash) {
          scpts=getValue('scripts');
          scpts[s].hash=hash(res);
          setValue('scripts',scpts);
-         if(confirm('Update found for: \n'+script.name+'\n'+res.match(/@description\s*(.*)/)[1])) 
-           GM_openInTab(upref(script.num))
+         if(confirm('Update found for: \n'+script_name+'\n'+res.match(/@description\s*(.*)/)[1])) 
+           GM_openInTab(upref(script_num))
         }
-      },s);
+      },s,scripts[s].name,scripts[s].hash,scripts[s].num);
     }
   }
 }

 
Eyal Soha Scriptwright

I fixed it. The problem was the regexp on line 37. Use this:


s=s.replace(/&/g,'&').replace(/&\w*;/g,'').replace(/[^-\w(){}=.+]/g,'');

A minus character that doesn't represent a range must be the first character in a character class except for a caret. Let me know if it works for you....

And then I found another bug. Working on it...

 
Martin Stone Scriptwright

Hi. I've tried the Line 89 and Line 128 fixes and added the patch from Eyal Soha just in case, but I get this error (before, between and after the changes):

Error: invalid range in character class

No line number, which doesn't help. Has anyone beaten this bug?

P.S. Should probably add: This error appears with no action in the browser - no new tab, and no change to about:cache#scriptupdater when accessed directly.

 
lazyttrick Scriptwright

I have a simple script updater, check my scripts.

 
Eyal Soha Scriptwright

I think that I fixed the bug that Ronen and I have seen. Looks like a race condition. Basically, the script is looking up multiple scripts for updates simultaneously and it gets confused because it is trying to access a variable that is global to the function. I read on a forum somewhere that the solution is to pass variables in to the function. Those are always copied, where as accessing a shared global isn't. Doesn't seem like it should help but it does. Anyway, the diff is below. Patch it in by hand or automatically and it should fix the bug. Worked for me in the few tests that I did. I hope that the author can incorporate this. Let me know if this works for you.

Eyal

--- C:\Documents and Settings\eyals\Desktop\scriptupdater_old.js	Mon Jun 02 16:56:57 2008
+++ C:\Documents and Settings\eyals\Desktop\scriptupdater_new.user.js	Mon Jun 02 16:58:04 2008
@@ -29,7 +29,7 @@
 
 
 
-function xhr(uri,f,a,b,c) {GM_xmlhttpRequest({method: 'get',headers: {'User-agent': 'Mozilla/4.0 (compatible) Greasemonkey'},url: uri,onload:function(res){f(res.responseText,a,b,c)}});}
+function xhr(uri,f,a,b,c,d) {GM_xmlhttpRequest({method: 'get',headers: {'User-agent': 'Mozilla/4.0 (compatible) Greasemonkey'},url: uri,onload:function(res){f(res.responseText,a,b,c,d)}});}
 
 function iframe(src,show) {var f=document.createElement('iframe');f.style.display=show?'inline':'none';f.src=src;return f;}
 
@@ -181,16 +181,15 @@
   if(!/#scriptupdater/.test(location.href) && checkable()) {
     scripts=getValue('scripts');
     for(s in scripts){
-      xhr(ckref(scripts[s].num),function(res,s){
-        script=scripts[s];
-        if (hash(res)!=script.hash) {
+      xhr(ckref(scripts[s].num),function(res,s,script_name,script_hash,script_num){
+        if (hash(res)!=script_hash) {
          scpts=getValue('scripts');
          scpts[s].hash=hash(res);
          setValue('scripts',scpts);
-         if(confirm('Update found for: \n'+script.name+'\n'+res.match(/@description\s*(.*)/)[1])) 
-           GM_openInTab(upref(script.num))
+         if(confirm('Update found for: \n'+script_name+'\n'+res.match(/@description\s*(.*)/)[1])) 
+           GM_openInTab(upref(script_num))
         }
-      },s);
+      },s,scripts[s].name,scripts[s].hash,scripts[s].num);
     }
   }
 }

 
Eyal Soha Scriptwright

Ronen, same here. The script claimed one script was old and then tried to update the other. When I used about:config#scriptupdater , it said that everything was up-to-date. Weird.

 
Volkan Scriptwright

This script doesn't work at all.

 
Black Cat Scriptwright

hi

I replaced the line 128:
} else xhr('http://userscripts.org/scripts/search?q='+name,function(res,p,s,ns){

with

} else xhr('http://userscripts.org/scripts/search?q='+name.replace(/[^a-zA-Z0-9]+| {2,}/g," "),function(res,p,s,ns){

because it didn't find any of my scripts ;)

 
Noone^^ User

cool thing. ;)

 
Ronnen User

Its a great script with some problem.
recently, there was an update to the script: "inYOf4ceBook".
The Updater found that there is a script to update, but it updated the script: "Multi-Column view of Google Search Results" instead.
meaning, the script update a wrong script.

 
ladiko User

grrrr i'm an idiot...

so again:
message box will be shown with:
##########################
function getValue(query) {
alert("hallo");
return eval(GM_getValue('cache','({})'))[query];
}
##########################
msgbox will not be shown with:
##########################
function getValue(query) {
return eval(GM_getValue('cache','({})'))[query];
alert("hallo");
}
##########################
so it seems like this function fails

 
ladiko User

aahh vise-versa. the first give no msgbox, but the second =D

 
ladiko User

this doesnt help me, but i found out, that

function getValue(query) {
alert("hallo");
return eval(GM_getValue('cache','({})'))[query];
}
makes an message box, but
function getValue(query) {
alert("hallo");
return eval(GM_getValue('cache','({})'))[query];
}
does not. so maybe there is a problem?!?

 
ChronoStriker1 User

After fixing line 89 the script works as its supposed to for me.

 
Thufir User

hi

i found a typo in line 89 of the latest version of your script ("profe" instead of "profile") this causes the problem reported by "Nyks".

 
ChronoStriker1 User

Scratch that it keeps trying to install new versions of a script I already removed.

 
ChronoStriker1 User

I copied my profile to a xp machine to see it worked. about:cache#scriptupdater did what it was supposed to, there were updates to some of my scripts but it didn't automatically update them. I copied the profile back to my vista x86 machine and about:cache#scriptupdater still didn't work but it did automatically update a script, so at least I know its partially working.

 
Nyks Scriptwright

Hello!

I installed the script (german XP with FF), and I get no errormessages.
But, the script doesnt seem to do anything.

When I call "about:cache#scriptupdater", I get a page with "Memory cache device ... List Cache Entries ... Disk cache device ... List Cache Entries".

But I doesnt figure out, how to let the script autoupdate my scripts?!?!

 
ChronoStriker1 User

I seem to have the same problem as ladiko in both vista 32 and 64

 
Gasoline- Scriptwright

any idea why it doesn't find Pagerization as a valid script on userscripts.org despite the fact that it is? other than that, script updater has been working great for me. what parameters does it use to determine if a script exists on this site? i know the problem might have something to do with the manner in which the other script is posted. i hope there's an easy solution.

 
alex. User

This script just doesn't seem to work for me.

I'm running 2.0.0.5 firefox on Ubuntu

 
Frederik Van... Scriptwright

Windows XP, Dutch version.
But I'm not using the default Firefox profile directory.
My profile directory is:
G:\Application Data\Firefox\default

 
ladiko User

tried to run ff with admin rights --> nothing

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