Added code to use the plaintext/img.title of links/images dragged &dropped on the S2P icon.

This commit is contained in:
patrick.oreilly
2010-08-04 23:48:01 +00:00
parent 28bd5be8b9
commit 26c43b0bdd

View File

@@ -112,18 +112,21 @@ sendtophone.doDrop = function(event)
var supportedTypes = ["application/x-moz-file", "text/uri-list", "text/x-moz-url", "text/plain"];
types = supportedTypes.filter(function (value) types.contains(value));
if (types.length)
var data = event.dataTransfer.getData(types[0]);
var plainText = event.dataTransfer.getData(types[0]);
var mozUrlArray = event.dataTransfer.getData(types[1]).split("\n");
var mozUrl = mozUrlArray[0];
var mozTitle = mozUrlArray[1];
event.preventDefault();
switch (types[0])
{
case "text/plain":
sendtophoneCore.send("Selection", "http://google.com", data);
sendtophoneCore.send("Selection", "http://google.com", plainText);
break;
case "text/uri-list":
case "text/x-moz-url":
sendtophoneCore.send("", data, "");
sendtophoneCore.send(mozTitle, mozUrl, "");
break;
case "application/x-moz-file":
var file = event.dataTransfer.mozGetDataAt("application/x-moz-file", 0);
if (file instanceof Components.interfaces.nsIFile && file.isFile() )