j88iang
小狐狸
小狐狸
  • UID51763
  • 注册日期2015-11-17
  • 最后登录2018-12-16
  • 发帖数48
  • 经验49枚
  • 威望0点
  • 贡献值4点
  • 好评度1点
  • 社区居民
  • 忠实会员
阅读:1895回复:6

求鼠标放在链接上时,复制链接文本 绑定快捷键用的

楼主#
更多 发布于:2017-05-26 12:09
if(XULBrowserWindow.overLink){ //鼠标放在链接上时,复制链接地址
Components.classes["@mozilla.org/widget/clipboardhelper;1"].getService(Components.interfaces.nsIClipboardHelper).copyString(XULBrowserWindow.overLink);
}

想改成复制链接文字
用在keysnail
liuxb
非常火狐
非常火狐
  • UID26160
  • 注册日期2008-09-05
  • 最后登录2021-12-02
  • 发帖数659
  • 经验324枚
  • 威望0点
  • 贡献值184点
  • 好评度16点
1楼#
发布于:2017-05-27 07:47
我的...
netweb
小狐狸
小狐狸
  • UID47439
  • 注册日期2014-10-01
  • 最后登录2021-08-28
  • 发帖数26
  • 经验27枚
  • 威望0点
  • 贡献值10点
  • 好评度6点
  • 社区居民
2楼#
发布于:2017-05-30 19:43
网上找到的
//复制链接文字 - 链接地址
if(XULBrowserWindow.overLink)
 for (var i = 0, links = content.document.links, l = links.length ; i < l; i++)
  if(links.href == XULBrowserWindow.overLink) {
   Components.classes["@mozilla.org/widget/clipboardhelper;1"]
   .getService(Components.interfaces.nsIClipboardHelper)
   .copyString(links.text + " - " + links.href);

   break;
  }
//只复制文本的话

if(XULBrowserWindow.overLink)
 for (var i = 0, links = content.document.links, l = links.length ; i < l; i++)
  if(links.href == XULBrowserWindow.overLink) {
   Components.classes["@mozilla.org/widget/clipboardhelper;1"]
   .getService(Components.interfaces.nsIClipboardHelper)
   .copyString(links.text);

   break;
  }
netweb
小狐狸
小狐狸
  • UID47439
  • 注册日期2014-10-01
  • 最后登录2021-08-28
  • 发帖数26
  • 经验27枚
  • 威望0点
  • 贡献值10点
  • 好评度6点
  • 社区居民
3楼#
发布于:2017-05-30 19:46
论坛把 [ i ] 给删了代码不能用
看这里
https://pastebin.mozilla.org/9023057
j88iang
小狐狸
小狐狸
  • UID51763
  • 注册日期2015-11-17
  • 最后登录2018-12-16
  • 发帖数48
  • 经验49枚
  • 威望0点
  • 贡献值4点
  • 好评度1点
  • 社区居民
  • 忠实会员
4楼#
发布于:2017-05-30 20:22
netweb:论坛把 [ i ] 给删了代码不能用
看这里
https://pastebin.mozilla.org/9023057
回到原帖
谢谢 可以用 请问为什么这个操作要遍历整个网页连接啊
j88iang
小狐狸
小狐狸
  • UID51763
  • 注册日期2015-11-17
  • 最后登录2018-12-16
  • 发帖数48
  • 经验49枚
  • 威望0点
  • 贡献值4点
  • 好评度1点
  • 社区居民
  • 忠实会员
5楼#
发布于:2017-05-30 20:44
netweb:论坛把 [ i ] 给删了代码不能用
看这里
https://pastebin.mozilla.org/9023057
回到原帖
测试了一下,好像对这些不起作用    data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAUgAAACXCAIAAAD4aVUqAAAUOklEQVR4nO1dTYgcxxUejI03bZOVg8MqLGSCY6nxhighMhJBYmVEWLOhFUJgo5OkEFhB8PrQ2IFYZg+ODg5SwKwOPggEQagPcg5Gc5olF/UhG8SA2TmsGYgOgoBmEZjBuszs7+RQ1fVfPT2zM9szNd/HO8xsV1e/qn7fe69e1/YU/tX+FwQCcUwKxfllCATimIDYEIiDAmJDIA4KiA2BOCggNgTioIDYEIiDAmJDIA4KiA2BOCggNgTioIDYEIiDAmJDIA4KiA2BOCggNgTioIDYEIiDAmJDIA4KiA2BOCggNgTioIDYEIiDAmIvF+fvr37Tbrefr35qOvrp18/a2fDN10vzy8Uvn7bb7Y0vl5fWnhv7vPNYaAyB9CjvXXvNK3lMZq7MLxdPzpQ8796x94qDIfbahmryz1c/ZQyx8Cdznxtf9l1hQmwdT+/YNXm2dt/cm0ZsymSGx2vF+eXip/cHQOyFFU+82V7JO3rt3HLx3Nl77PMBDIhYTB/k5IxkjgcVruHKyR47OXfsaMnzSq+dPdf9uVemvZLnlaYXDEcPNPNZRj1z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ZUtPkup5WE9btkfiCp5qOijNYuivflln11FI7ZMYPOzD1UFmURRUPK8Ai05JNGJE5veXeO8U5NNLIbPcj3048hI7KRKmXGNrbSUnl6kGNDDG1ezJeNiLVCqOsj2ZI7YYvmkWgmjpsFPJ7dB8PGM5PLdkmhcC0hSnU5scmrmiG16CKSmCcrkHEpVnBWr1BJDFJTEtEL1HWR+DhaxhboPn1t7xce2l4Gah9FHJPTRnTL3ibyxXzYQW/ls8chaTTSOokJZ0KMSeHEQ6B5LmzVpjmLJ8TRtVfGY13Ws0SM1n5QJo+PhjUxRmtwD2WuogVp+3FULPDliUw8omVHy7EHfeCCbozKTSp7cVM41a8gG4of1aliJMhKbWQZJMew87PNzbN24eW8iJ/mTAsvuEX0myVGF2LUwrGclNhtRULMn5PXQL3l+HPhGbmuD6mqrhRixaSRXUhV9+43Wh+TiyVyxLaXViu+XU/ctpLrkbK6lq4gtp2R0XZB5PZYd1vqw8KAuKeBFsZeU2YJIiNtJDUOqrsvJucAWsXaSpJHiPctMbG6RunfgJytV3PT9hVThfkZsi61Xq0r22LHgUksCj+FZgDC0clhlH8wDVIvP0qYA/e9yTTS152zEJvVOoiffXaNvGWRrB72yowzHD+vyAlnaK56eTXVD7EwbVESd+Fe7zXW4W11DjGCGw/SRklSbFXmrVKSEmpayRKTtxXpYEAcKFcXwVU0KFmmLT3kpZNrPEET8sapwVIrt3LNYriUtXO2zlOJZ0p8aWm53MlHSrdGfHcgjomlIna+YjCtzTxu1tKYVluLWihodtWFcnYhdDctC6VR7MsfbiU/UbRVyeno1LPthJZD0wT+BAICDALEBwEGA2ADgIEBsAHAQIDYAOAgQGwAcBIgNAA7i/9uN9JpkXSqbAAAAAElFTkSuQmCC
netweb
小狐狸
小狐狸
  • UID47439
  • 注册日期2014-10-01
  • 最后登录2021-08-28
  • 发帖数26
  • 经验27枚
  • 威望0点
  • 贡献值10点
  • 好评度6点
  • 社区居民
6楼#
发布于:2017-05-30 20:51
j88iang:测试了一下,好像对这些不起作用    data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAUgAAACXCAIAAAD4aVUqAAAUOklEQVR4nO1dTYgcxxUejI03bZOVg8M...回到原帖
为什么要遍历我也不知道,我不会js,代码网上找的。你需要等待懂js的人来帮你改。
游客

返回顶部