From e635d56a000032fcfb48e93aad58be367a3cfa8d Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Thu, 20 Mar 2008 06:34:43 +0100 Subject: pref-feeds tweaks --- functions.js | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) (limited to 'functions.js') diff --git a/functions.js b/functions.js index b41cd73ab..2857072b7 100644 --- a/functions.js +++ b/functions.js @@ -1750,3 +1750,48 @@ function displayHelpInfobox(topic_id) { return false; } + +// http://www.dynamic-tools.net/toolbox/copyToClipboard/ + +/* +function copyToClipboard(s) +{ + if( window.clipboardData && clipboardData.setData ) + { + clipboardData.setData("Text", s); + } + else + { + // You have to sign the code to enable this or allow the action in about:config by changing + user_pref("signed.applets.codebase_principal_support", true); + netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect'); + + var clip Components.classes['@mozilla.org/widget/clipboard;[[[[1]]]]'].createInstance(Components.interfaces.nsIClipboard); + if (!clip) return; + + // create a transferable + var trans = Components.classes['@mozilla.org/widget/transferable;[[[[1]]]]'].createInstance(Components.interfaces.nsITransferable); + if (!trans) return; + + // specify the data we wish to handle. Plaintext in this case. + trans.addDataFlavor('text/unicode'); + + // To get the data from the transferable we need two new objects + var str = new Object(); + var len = new Object(); + + var str = Components.classes["@mozilla.org/supports-string;[[[[1]]]]"].createInstance(Components.interfaces.nsISupportsString); + + var copytext=meintext; + + str.data=copytext; + + trans.setTransferData("text/unicode",str,copytext.length*[[[[2]]]]); + + var clipid=Components.interfaces.nsIClipboard; + + if (!clip) return false; + + clip.setData(trans,null,clipid.kGlobalClipboard); + } +} */ -- cgit v1.2.3