24 | | }, |
25 | | function() |
26 | | { |
27 | | window.netscape.security.PrivilegeManager.enablePrivilege( "UniversalXPConnect" ); |
28 | | |
29 | | var clip = window.Components.classes[ "@mozilla.org/widget/clipboard;1" ] |
30 | | .getService( window.Components.interfaces.nsIClipboard ); |
31 | | var trans = window.Components.classes[ "@mozilla.org/widget/transferable;1" ] |
32 | | .createInstance( window.Components.interfaces.nsITransferable ); |
33 | | trans.addDataFlavor( "text/unicode" ); |
34 | | clip.getData( trans, clip.kGlobalClipboard ); |
35 | | |
36 | | var str = {}, strLength = {}, clipboardText; |
37 | | trans.getTransferData( "text/unicode", str, strLength ); |
38 | | str = str.value.QueryInterface( window.Components.interfaces.nsISupportsString ); |
39 | | clipboardText = str.data.substring( 0, strLength.value / 2 ); |
40 | | return clipboardText; |