Skip to content

Commit

Permalink
Merge remote branch 'sizzlemctwizzle/issue-1110'
Browse files Browse the repository at this point in the history
Conflicts:
	content/addons.js
  • Loading branch information
arantius committed May 25, 2010
2 parents 7617f44 + e530c3b commit 0dae74a
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 4 deletions.
1 change: 1 addition & 0 deletions content/addons.js
Expand Up @@ -155,6 +155,7 @@ var greasemonkeyAddons = {
item.setAttribute('addonId', id);
item.setAttribute('name', script.name);
item.setAttribute('description', script.description);
item.setAttribute('version', script.version);
item.setAttribute('id', 'urn:greasemonkey:item:'+id);
item.setAttribute('isDisabled', !script.enabled);
// These hide extension-specific bits we don't want to display.
Expand Down
16 changes: 12 additions & 4 deletions content/config.js
Expand Up @@ -74,15 +74,20 @@ Config.prototype = {
script._basedir = node.getAttribute("basedir") || ".";
script._downloadURL = node.getAttribute("installurl") || null;

if (!node.getAttribute("modified") || !node.getAttribute("dependhash")) {
if (!node.getAttribute("modified")
|| !node.getAttribute("dependhash")
|| !node.getAttribute("version")
) {
script._modified = script._file.lastModifiedTime;
var rawMeta = this.parse(
GM_getContents(script._file), script._downloadURL, true)._rawMeta;
script._dependhash = GM_sha1(rawMeta);
var parsedScript = this.parse(
GM_getContents(script._file), script._downloadURL, true);
script._dependhash = GM_sha1(parsedScript._rawMeta);
script._version = parsedScript._version;
fileModified = true;
} else {
script._modified = node.getAttribute("modified");
script._dependhash = node.getAttribute("dependhash");
script._version = node.getAttribute("version");
}

for (var i = 0, childNode; childNode = node.childNodes[i]; i++) {
Expand Down Expand Up @@ -195,6 +200,7 @@ Config.prototype = {
scriptNode.setAttribute("name", scriptObj._name);
scriptNode.setAttribute("namespace", scriptObj._namespace);
scriptNode.setAttribute("description", scriptObj._description);
scriptNode.setAttribute("version", scriptObj._version);
scriptNode.setAttribute("enabled", scriptObj._enabled);
scriptNode.setAttribute("basedir", scriptObj._basedir);
scriptNode.setAttribute("modified", scriptObj._modified);
Expand Down Expand Up @@ -269,6 +275,7 @@ Config.prototype = {
case "name":
case "namespace":
case "description":
case "version":
script["_" + header] = value;
break;
case "include":
Expand Down Expand Up @@ -334,6 +341,7 @@ Config.prototype = {
if (!script._name && uri) script._name = GM_parseScriptName(uri);
if (!script._namespace && uri) script._namespace = uri.host;
if (!script._description) script._description = "";
if (!script._version) script._version = "";
if (script._includes.length == 0) script._includes.push("*");

return script;
Expand Down
3 changes: 3 additions & 0 deletions content/script.js
Expand Up @@ -12,6 +12,7 @@ function Script(config) {
this._name = null;
this._namespace = null;
this._description = null;
this._version = null;
this._enabled = true;
this._includes = [];
this._excludes = [];
Expand Down Expand Up @@ -39,6 +40,7 @@ Script.prototype = {
get prefroot() { return [
"scriptvals.", this.namespace, "/", this.name, "."].join(""); },
get description() { return this._description; },
get version() { return this._version; },
get enabled() { return this._enabled; },
set enabled(enabled) { this._enabled = enabled; this._changed("edit-enabled", enabled); },

Expand Down Expand Up @@ -151,6 +153,7 @@ Script.prototype = {
this._namespace = newScript._namespace;
this._description = newScript._description;
this._unwrap = newScript._unwrap;
this._version = newScript._version;

var dependhash = GM_sha1(newScript._rawMeta);
if (dependhash != this._dependhash && !newScript._dependFail) {
Expand Down

0 comments on commit 0dae74a

Please sign in to comment.