Skip to content

Commit

Permalink
Correctly set update URL even for old versions of US.o scripts.
Browse files Browse the repository at this point in the history
  • Loading branch information
Anthony Lieuallen committed Dec 8, 2011
1 parent ff9bd12 commit 62fed40
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions modules/script.js
Expand Up @@ -174,12 +174,13 @@ function Script_setUpdateURL(url) {

if (!url) url = this._downloadURL;

this._updateURL = url;
// US.o gets special treatment for being so large
var usoURL = url.match(/^(https?:\/\/userscripts.org\/[^?]*\.user\.js)\??/);
if (usoURL) {
this._updateURL = usoURL[1].replace(/\.user\.js$/,".meta.js");
} else {
this._updateURL = url;
var usoMatch = url.match(
/^https?:\/\/userscripts.org\/scripts\/\w+\/(\d+).*\.user\.js/);
if (usoMatch) {
this._updateURL = 'http://userscripts.org/scripts/source/'
+ usoMatch[1] + '.user.js';
}
});

Expand Down

0 comments on commit 62fed40

Please sign in to comment.