Here goes a possible solution to the images-saved-in-temp-folder problem (you'll have to hack it yourself into the extension):
1. Find superdrag.jar in your profile directory, extract its content and load superdrag.js in your favorite editor.
2. Add a new field to the superDrag object:
Code: Select all
onDragStart: function(aEvent, aXferData, aDragAction)
{
// prevent images of being dragged themselves (drag a link to them instead)
// make sure we're dragging an image
var target = aEvent.originalTarget;
if (!/^img$/i.test(target.localName)) throw new Error(); // fall back to default drag handler
// make sure we've actually got a link to drag
for (var obj = target.parentNode; obj && !/^a$/i.test(obj.localName); obj = obj.parentNode);
var url = ((obj)?obj.href:null) || target.src;
if (!url) throw new Error();
var caption = ((obj)?obj.title:null) || target.alt || target.title || url.replace(/^.*\//, "") || url;
aXferData.data = new TransferData();
// mark unlinked images as downloadable by onDrop ("[Image] ")
aXferData.data.addDataForFlavour("text/x-moz-url", url + "\n" + ((obj)?"":"[Image] ") + caption);
aXferData.data.addDataForFlavour("text/unicode", url);
aXferData.data.addDataForFlavour("text/html", '< a href="' + url + '">' + caption + '</a>');
aDragAction.action = Components.interfaces.nsIDragService.DRAGDROP_ACTION_COPY | Components.interfaces.nsIDragService.DRAGDROP_ACTION_MOVE | Components.interfaces.nsIDragService.DRAGDROP_ACTION_LINK;
},
3. Register this method in the onLoad function (just before
this.loaded = true):
Code: Select all
tabbrowser.addEventListener('draggesture', function(event) {nsDragAndDrop.startDrag(event, contentAreaDNDObserver);} , true);
contentAreaDNDObserver.onDragStart = superDrag.onDragStart;
4. Replace additionally the following lines:
Code: Select all
101c125
< if(aDragSession.sourceNode != null && !(/^(file\:\/\/\/)/.test(uri)) )
---
> if(/^\[Image\] /.test(xferData[1]) && !(/^(file\:\/\/\/)/.test(uri)) )
103c127
< if(!aEvent.ctrlKey && aDragSession.sourceNode.nodeName == 'IMG' )
---
> if(!aEvent.ctrlKey)
124c148
< saveURL(aDragSession.sourceNode.src, null, null, false, true);
---
> saveURL(uri, null, null, false, true);
129c153
< superDrag.saveImage(aDragSession.sourceNode.src);
---
> superDrag.saveImage(uri);
5. Optionally delete the function checkCanDrop and the reference to it in onLoad.
6. Pack all extracted files (including the modified superdrag.js) back into superdrag.jar and restart Firefox.
Now images are never saved in the temporary folder. You can still download unlinked images by dropping them anywhere inside the browser (as long as the option to do so is activated). If you also want to download linked images (instead of loading the link), replace in onDragStart
((obj)?"":"[Image] ") with
"[Image] ".
With this patch, you however won't be able to drag an image directly into any other application. Dragging an image will now result in a link to the image being dragged. Dragging images outside of Firefox without the temporary files being created won't be possible unless
bug 203307 is fixed.