diff options
Diffstat (limited to 'lib/clipboard.js')
-rw-r--r-- | lib/clipboard.js | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/lib/clipboard.js b/lib/clipboard.js index 0051a55..c601649 100644 --- a/lib/clipboard.js +++ b/lib/clipboard.js @@ -35,7 +35,7 @@ var getMethod = exports.get = function getMethod( flavor ) { if (flavor === undefined) { flavor = "plain"; } - + if (flavor === "plain") { mimeType = "text/unicode"; } else if (favor === "html") { @@ -45,7 +45,7 @@ var getMethod = exports.get = function getMethod( flavor ) { } clip = getClipboard(); - + trans = createTransferable(); trans.addDataFlavor(mimeType); @@ -66,12 +66,12 @@ var getMethod = exports.get = function getMethod( flavor ) { var setMethod = exports.set = function setMethod(content, flavor) { var mimeType = "", stuff = {}; var len = 0, clipId = 0, clip = {}, trans = {}; - + // flavor argument is optional if (flavor === undefined) { flavor = "plain"; } - + if (flavor === "plain") { mimeType = "text/unicode"; } else if (favor === "html") { @@ -80,21 +80,21 @@ var setMethod = exports.set = function setMethod(content, flavor) { throw new Error("Unsupported flavor '" + flavor + "'!"); } - stuff = Cc["@mozilla.org/supports-string;1"]. + stuff = Cc["@mozilla.org/supports-string;1"]. createInstance(Ci.nsISupportsString); if (!stuff) { return false; - } + } stuff.data = content; - len = content.length * 2; + len = content.length * 2; clip = getClipboard(); - + trans = createTransferable(); trans.addDataFlavor(mimeType); trans.setTransferData(mimeType, stuff, content.length * 2); - + clip.setData(trans, null, clip.kGlobalClipboard); return true; }; |