Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes bugs 8634 and 8831 (scripts not applied to background tabs or f…
…rames) as well as the other behavior described in http://www.mozdev.org/pipermail/greasemonkey/2005-January/000013.html Additionally, upgrades now keep your old script configuration
- Loading branch information
1 parent
ec0b488
commit 93cdf35
Showing
7 changed files
with
448 additions
and
453 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,81 +1,84 @@ | ||
<?xml version="1.0"?> | ||
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?> | ||
<?xul-overlay href="chrome://greasemonkey/content/pages-overlay.xul"?> | ||
|
||
<window | ||
id="manage-window" | ||
title="Install User Script" | ||
orient="vertical" | ||
style="max-width:400px;" | ||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> | ||
|
||
<script type="application/x-javascript" src="chrome://greasemonkey/content/greasemonkey.js" /> | ||
<script type="application/x-javascript"><![CDATA[ | ||
window.addEventListener("load", function() { | ||
var pagesControl = new PagesControl(document.getElementById("pages-control")); | ||
var script = window.arguments[0]; | ||
var file = window.arguments[1]; | ||
var result = window.arguments[2]; | ||
var status = document.getElementById("status"); | ||
var config = new Config(); | ||
var request; | ||
config.load(); | ||
document.getElementById("ctlHeader").setAttribute("title", script.name); | ||
document.getElementById("ctlDescription").textContent = script.description; | ||
if (script != null) { | ||
pagesControl.populate(script); | ||
document.getElementById("btnOK").addEventListener("command", function() { | ||
var newDir = getScriptDir(); | ||
var existingIndex = config.find(script.namespace, script.name); | ||
var existingFile = null; | ||
var oldScripts = new Array(config.scripts); | ||
if (existingIndex > -1) { | ||
existingFile = getScriptFile(config.scripts[existingIndex].id); | ||
config.scripts.splice(existingIndex, 1); | ||
} | ||
try { | ||
file.moveTo(newDir, script.id); | ||
config.scripts.push(script); | ||
config.save(); | ||
if (existingFile != null) { | ||
existingFile.remove(false); | ||
} | ||
result.value = true; | ||
window.close(); | ||
} | ||
catch (e) { | ||
config.scripts = oldScripts; | ||
alert("Could not save script. " + (e ? e : "")); | ||
} | ||
}, false); | ||
document.getElementById("btnCancel").addEventListener("command", function() { | ||
if (request) request.abort(); | ||
window.close(); | ||
}, false); | ||
} | ||
}, false); | ||
]]></script> | ||
|
||
<vbox style="margin:1em;"> | ||
<dialogheader id="ctlHeader" title="" /> | ||
<description id="ctlDescription" style="margin-top:.5em; margin-bottom:.5em; padding-left:2px; padding-right:2px;" /> | ||
<vbox id="pages-control" /> | ||
<spacer flex="1" style="min-height:2em" /> | ||
<hbox align="center" style=" height:3em;"> | ||
<description id="status" flex="1" style="font-weight:bold;">Press OK to confirm these settings and install the user script...</description> | ||
<button id="btnOK" label="OK" default="true" /> | ||
<button id="btnCancel" label="Cancel" /> | ||
</hbox> | ||
</vbox> | ||
</window> | ||
<?xml version="1.0"?> | ||
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?> | ||
<?xul-overlay href="chrome://greasemonkey/content/pages-overlay.xul"?> | ||
|
||
<window | ||
id="manage-window" | ||
title="Install User Script" | ||
orient="vertical" | ||
style="max-width:400px;" | ||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> | ||
|
||
<script type="application/x-javascript" src="chrome://greasemonkey/content/greasemonkey.js" /> | ||
<script type="application/x-javascript"><![CDATA[ | ||
window.addEventListener("load", function(ev) { | ||
var pagesControl = new PagesControl(document.getElementById("pages-control")); | ||
var script = window.arguments[0]; | ||
var file = window.arguments[1]; | ||
// alert("install.xul\n"+ev.originalTarget.location+"\n"+file); | ||
var result = window.arguments[2]; | ||
var status = document.getElementById("status"); | ||
var config = new Config(); | ||
var request; | ||
config.load(); | ||
document.getElementById("ctlHeader").setAttribute("title", script.name); | ||
document.getElementById("ctlDescription").textContent = script.description; | ||
if (script != null) { | ||
pagesControl.populate(script); | ||
document.getElementById("btnOK").addEventListener("command", function() { | ||
// alert("ok button"); | ||
var newDir = getScriptDir(); | ||
var existingIndex = config.find(script.namespace, script.name); | ||
var existingFile = null; | ||
var oldScripts = new Array(config.scripts); | ||
if (existingIndex > -1) { | ||
existingFile = getScriptFile(config.scripts[existingIndex].id); | ||
config.scripts.splice(existingIndex, 1); | ||
} | ||
try { | ||
file.moveTo(newDir, script.id); | ||
config.scripts.push(script); | ||
config.save(); | ||
if (existingFile != null) { | ||
existingFile.remove(false); | ||
} | ||
result.value = true; | ||
window.close(); | ||
} | ||
catch (e) { | ||
config.scripts = oldScripts; | ||
alert("Could not save script. " + (e ? e : "")); | ||
} | ||
}, false); | ||
document.getElementById("btnCancel").addEventListener("command", function() { | ||
// alert("cancel button"); | ||
if (request) request.abort(); | ||
window.close(); | ||
}, false); | ||
} | ||
}, false); | ||
]]></script> | ||
|
||
<vbox style="margin:1em;"> | ||
<dialogheader id="ctlHeader" title="" /> | ||
<description id="ctlDescription" style="margin-top:.5em; margin-bottom:.5em; padding-left:2px; padding-right:2px;" /> | ||
<vbox id="pages-control" /> | ||
<spacer flex="1" style="min-height:2em" /> | ||
<hbox align="center" style=" height:3em;"> | ||
<description id="status" flex="1" style="font-weight:bold;">Press OK to confirm these settings and install the user script...</description> | ||
<button id="btnOK" label="OK" default="true" /> | ||
<button id="btnCancel" label="Cancel" /> | ||
</hbox> | ||
</vbox> | ||
</window> |
Oops, something went wrong.