diff options
Diffstat (limited to 'docs/html/overview-summary-clipboard.js.html')
-rw-r--r-- | docs/html/overview-summary-clipboard.js.html | 327 |
1 files changed, 327 insertions, 0 deletions
diff --git a/docs/html/overview-summary-clipboard.js.html b/docs/html/overview-summary-clipboard.js.html new file mode 100644 index 0000000..3ee98b4 --- /dev/null +++ b/docs/html/overview-summary-clipboard.js.html @@ -0,0 +1,327 @@ +<!doctype html public "-//W3C//DTD HTML 4.0 Frameset//EN""http://www.w3.org/TR/REC-html40/frameset.dtd"> +<html> +<head> +<title> + Overview +</title> +<link rel ="stylesheet" type="text/css" href="stylesheet.css" title="Style"> +<script> +function asd() { + + parent.document.title="clipboard.js Overview"; + +} +</script> +</head> +<body bgcolor="white" onload="asd();"> + +<!-- ========== START OF NAVBAR ========== --> +<a name="navbar_top"><!-- --></a> +<table border="0" width="100%" cellpadding="1" cellspacing="0"> +<tr> +<td colspan=2 bgcolor="#EEEEFF" class="NavBarCell1"> +<a name="navbar_top_firstrow"><!-- --></a> +<table border="0" cellpadding="0" cellspacing="3"> + <tr align="center" valign="top"> + + + <td bgcolor="#EEEEFF" class="NavBarCell1"> <a href="overview-summary.html"><font class="NavBarFont1"><b>Overview</b></font></a> </td> + <td bgcolor="#FFFFFF" class="NavBarCell1Rev"> <font class="NavBarFont1Rev"><b>File</b></font> </td> + + + <td bgcolor="#FFFFFF" class="NavBarCell1"> <font class="NavBarFont1">Class</font> </td> + <td bgcolor="#EEEEFF" class="NavBarCell1"> <a href="overview-tree.html"><font class="NavBarFont1"><b>Tree</b></font></a> </td> + <td bgcolor="#EEEEFF" class="NavBarCell1"> <a href="index-all.html"--><font class="NavBarFont1"><b>Index</b></font></a> </td> + <td bgcolor="#EEEEFF" class="NavBarCell1"> <a href="help-doc.html"><font class="NavBarFont1"><b>Help</b></font></a> </td> + </tr> +</table> +</td> +<td bgcolor="#EEEEFF" align="right" valign="top"> +<em> +<b></b></em> +</td> +</tr> + +<tr> +<td bgcolor="white" class="NavBarCell2"><font size="-2"> + PREV + NEXT</font></td> +<td bgcolor="white" class="NavBarCell2"><font size="-2"> + <a href="index.html" target="_top"><b>FRAMES</b></a> + <a href="overview-summary.html" target="_top"><b>NO FRAMES</b></a> + +<script> + <!-- + if(window==top) { + document.writeln('<A HREF="allclasses-noframe.html" TARGET=""><B>All Classes</B></A>'); + } + //--> +</script> +<noscript> +<a href="allclasses-noframe.html" target=""><b>All Classes</b></a> +</noscript> +</font></td> +</tr> +</table> +<!-- =========== END OF NAVBAR =========== --> + +<hr> +<center> + + <h2>clipboard.js</h2> + +</center> + + + + +<h4>Summary</h4> +<p> + + No overview generated for 'clipboard.js'<BR/><BR/> + +</p> + +<hr> + + + +<!-- ========== METHOD SUMMARY =========== --> + + <a name="method_summary"><!-- --></a> + <table border="1" cellpadding="3" cellspacing="0" width="100%"> + <tr bgcolor="#CCCCFF" class="TableHeadingColor"> + <td colspan=2> + <font size="+2"> + <b>Method Summary</b> + </font> + </td> + </tr> + + + <tr bgcolor="white" class="TableRowColor"> + <td align="right" valign="top" width="1%"> + <font size="-1"> + <code>static Object</code> + </font> + </td> + <td> + <code> + <b> + <a href="GLOBALS.html#!s!createTransferable">createTransferable</a></b>() + </code> + <br> + + + </td> + </tr> + + <tr bgcolor="white" class="TableRowColor"> + <td align="right" valign="top" width="1%"> + <font size="-1"> + <code>static Object</code> + </font> + </td> + <td> + <code> + <b> + <a href="GLOBALS.html#!s!getClipboard">getClipboard</a></b>() + </code> + <br> + + returns content of the system clipboard + </td> + </tr> + + + </table> + <p> + +<!-- ========== END METHOD SUMMARY =========== --> + + + <pre class="sourceview"><span class="comment">// Released under the MIT/X11 license</span> +<span class="comment">// http://www.opensource.org/licenses/mit-license.php</span> + +<span class="comment">/** + * returns content of the system clipboard + * <span class="attrib">@return</span> string with the content of the clipboard or "" if empty. + * originally from + * https://developer.mozilla.org/en/Using_the_Clipboard + * https://wiki.mozilla.org/Labs/Jetpack/JEP/10 + */</span> + +<span class="reserved">function</span> getClipboard() { + var clip = Cc[<span class="literal">"@mozilla.org/widget/clipboard;1"</span>]. + getService(Ci.nsIClipboard); + <span class="reserved">if</span> (!clip) { + throw new Error(<span class="literal">"No access to the clipboard!"</span>); + } + <span class="reserved">return</span> clip; +} + +<span class="reserved">function</span> createTransferable() { + var trans = Cc[<span class="literal">"@mozilla.org/widget/transferable;1"</span>]. + createInstance(Ci.nsITransferable); + <span class="reserved">if</span> (!trans) { + throw new Error(<span class="literal">"No access to the transfer object during the set of clipboard!"</span>); + } + <span class="reserved">return</span> trans; +} + +var getMethod = exports.get = <span class="reserved">function</span> getMethod( flavor ) { + var pastetext = <span class="literal">""</span>, mimeType = <span class="literal">""</span>, stuff = {}; + var len = 0, clipId = 0, clip = {}, trans = {}; + + <span class="comment">// flavor argument is optional</span> + <span class="reserved">if</span> (flavor === undefined) { + flavor = <span class="literal">"plain"</span>; + } + + <span class="reserved">if</span> (flavor === <span class="literal">"plain"</span>) { + mimeType = <span class="literal">"text/unicode"</span>; + } <span class="reserved">else</span> <span class="reserved">if</span> (favor === <span class="literal">"html"</span>) { + mimeType = <span class="literal">"text/html"</span>; + } <span class="reserved">else</span> { + throw new Error(<span class="literal">"Unsupported flavor '"</span> + flavor + <span class="literal">"'!"</span>); + } + + clip = getClipboard(); + + trans = createTransferable(); + + trans.addDataFlavor(mimeType); + clip.getData(trans, clip.kGlobalClipboard); + + var str = {}; + var strLength = {}; + + trans.getTransferData(mimeType, str, strLength); + + <span class="reserved">if</span> (str) { + str = str.value.QueryInterface(Ci.nsISupportsString); + pastetext = str.data.substring(0, strLength.value / 2); + } + <span class="reserved">return</span> pastetext; +}; + +var setMethod = exports.set = <span class="reserved">function</span> setMethod(content, flavor) { + var mimeType = <span class="literal">""</span>, stuff = {}; + var len = 0, clipId = 0, clip = {}, trans = {}; + + <span class="comment">// flavor argument is optional</span> + <span class="reserved">if</span> (flavor === undefined) { + flavor = <span class="literal">"plain"</span>; + } + + <span class="reserved">if</span> (flavor === <span class="literal">"plain"</span>) { + mimeType = <span class="literal">"text/unicode"</span>; + } <span class="reserved">else</span> <span class="reserved">if</span> (favor === <span class="literal">"html"</span>) { + mimeType = <span class="literal">"text/html"</span>; + } <span class="reserved">else</span> { + throw new Error(<span class="literal">"Unsupported flavor '"</span> + flavor + <span class="literal">"'!"</span>); + } + + stuff = Cc[<span class="literal">"@mozilla.org/supports-string;1"</span>]. + createInstance(Ci.nsISupportsString); + <span class="reserved">if</span> (!stuff) { + <span class="reserved">return</span> false; + } + stuff.data = content; + len = content.length * 2; + + clip = getClipboard(); + + trans = createTransferable(); + + trans.addDataFlavor(mimeType); + trans.setTransferData(mimeType, stuff, content.length * 2); + + clip.setData(trans, null, clip.kGlobalClipboard); + <span class="reserved">return</span> true; +}; + +var flavorsMethod = exports.getCurrentFlavors = <span class="reserved">function</span> flavorsMethod(test) { + <span class="comment">// currently the only possible flavors in Jetpack-prototype are "plain" and</span> + <span class="comment">// "html", i.e., "text/plain" (or text/unicode?) and "text/html" (or</span> + <span class="comment">// application/xml+xhtml?)</span> + var possibleTypes = { + <span class="literal">"text/unicode"</span>: <span class="literal">"plain"</span>, + <span class="literal">"text/plain"</span>: <span class="literal">"plain"</span>, + <span class="literal">"text/html"</span>: <span class="literal">"html"</span> + }; + var flavorArray = []; + var clip = getClipboard(); + + <span class="reserved">for</span> (var flavor in possibleTypes) { + var presentFlavor = clip.hasDataMatchingFlavors( + [flavor], + 1, + clip.kGlobalClipboard + ); + <span class="reserved">if</span> (presentFlavor) { + flavorArray.push(possibleTypes[flavor]); + } + } + <span class="reserved">return</span> flavorArray; +};</pre> + <hr> + + + +<!-- ========== START OF NAVBAR ========== --> +<a name="navbar_top"><!-- --></a> +<table border="0" width="100%" cellpadding="1" cellspacing="0"> +<tr> +<td colspan=2 bgcolor="#EEEEFF" class="NavBarCell1"> +<a name="navbar_top_firstrow"><!-- --></a> +<table border="0" cellpadding="0" cellspacing="3"> + <tr align="center" valign="top"> + + + <td bgcolor="#EEEEFF" class="NavBarCell1"> <a href="overview-summary.html"><font class="NavBarFont1"><b>Overview</b></font></a> </td> + <td bgcolor="#FFFFFF" class="NavBarCell1Rev"> <font class="NavBarFont1Rev"><b>File</b></font> </td> + + + <td bgcolor="#FFFFFF" class="NavBarCell1"> <font class="NavBarFont1">Class</font> </td> + <td bgcolor="#EEEEFF" class="NavBarCell1"> <a href="overview-tree.html"><font class="NavBarFont1"><b>Tree</b></font></a> </td> + <td bgcolor="#EEEEFF" class="NavBarCell1"> <a href="index-all.html"--><font class="NavBarFont1"><b>Index</b></font></a> </td> + <td bgcolor="#EEEEFF" class="NavBarCell1"> <a href="help-doc.html"><font class="NavBarFont1"><b>Help</b></font></a> </td> + </tr> +</table> +</td> +<td bgcolor="#EEEEFF" align="right" valign="top"><em> +<b></b></em> +</td> +</tr> + +<tr> +<td bgcolor="white" class="NavBarCell2"><font size="-2"> + PREV + NEXT</font></td> +<td bgcolor="white" class="NavBarCell2"><font size="-2"> + <a href="index.html" target="_top"><b>FRAMES</b></a> + <a href="overview-summary.html" target="_top"><b>NO FRAMES</b></a> + +<script> + <!-- + if(window==top) { + document.writeln('<A HREF="allclasses-noframe.html" TARGET=""><B>All Classes</B></A>'); + } + //--> +</script> +<noscript> +<a href="allclasses-noframe.html" target=""><b>All Classes</b></a> +</noscript> +</font></td> +</tr> +</table> +<!-- =========== END OF NAVBAR =========== --> + +<hr> +<font size="-1"> + +</font> +<div class="jsdoc_ctime">Documentation generated by <a href="http://jsdoc.sourceforge.net/" target="_parent">JSDoc</a> on Wed Jun 23 09:33:14 2010</div> +</body> +</html> |