阅读:5603回复:9
请问如何实现:小书签复制标题+URL到WINDOWS剪贴板
查了网上不少代码,什么copyString啊这些都不起作用,很郁闷,只能暂时用折中的方法:
javascript:window.prompt("Copy",content.document.title + " - " + content.location.href);void(0); |
|
1楼#
发布于:2013-11-16 19:49
关注下,这个能不能用pentadactyl调出来。
代码转贴到这里。谢谢hzzhaiqi com! bb -js dactyl.clipboardWrite(content.document.title + " - " + content.location.href)如果有pentadactyl,把上面代码写进配置文件就可以 :bb 复制标签页标题+地址。 |
|
2楼#
发布于:2013-11-16 20:09
Cc["@mozilla.org/widget/clipboardhelper;1"].getService(Ci.nsIClipboardHelper).copyString(content.document.title + " - " + content.location.href) |
|
3楼#
发布于:2013-11-16 20:31
hzzhaiqi:Cc["@mozilla.org/widget/clipboardhelper;1"].getService(Ci.nsIClipboardHelper).copyString(content.document.title + " - " ...回到原帖类似的也试过,脚本改成这样不行。目的是做成小书签: javascript:function(){Cc["@mozilla.org/widget/clipboardhelper;1"].getService(Ci.nsIClipboardHelper).copyString(content.document.title + " - " + content.location.href)} |
|
4楼#
发布于:2013-11-17 06:59
|
|
5楼#
发布于:2013-11-17 12:37
|
|
6楼#
发布于:2013-11-17 12:38
|
|
7楼#
发布于:2013-11-17 14:16
|
|
8楼#
发布于:2013-11-20 13:20
const AS_HTML = false; function htmlEscape(s) { s = s.replace(/&/g, "&"); s = s.replace(/>/g, ">"); s = s.replace(/</g, "<"); s = s.replace(/"/g, """); return s; } var url = window.content.location.href; var title = window.content.document.title; var txt = AS_HTML ? '<a href="' + htmlEscape(url) + '">' + htmlEscape(title) + '</a>' : title + "\n" + url; var clipboard = Cc["@mozilla.org/widget/clipboardhelper;1"] .getService(Ci.nsIClipboardHelper); clipboard.copyString(txt);这是我用的鼠标手势代码,你看看能不能参考? |
|
9楼#
发布于:2013-11-20 17:30
|
|