复制当前页面

复制当前页面标题及网址

目前為 2019-08-17 提交的版本,檢視 最新版本

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name        复制当前页面
// @namespace   http://沉冰浮水.tk
// @description 复制当前页面标题及网址
// @include     http://*
// @include     https://*
// @version     1.6
// @grant       GM_registerMenuCommand
// @grant       GM_setClipboard
// jshint       esversion:6
// ==/UserScript==

(function () {
  'use strict';
  if (window.frames.length != parent.frames.length) {
    // alert('在iframe中');
    return false;
  }
  GM_registerMenuCommand('复制', () => {
    GM_setClipboard(document.title + '\n' + document.location.href);
    alert("复制成功:\r\n" + document.title + '\n' + document.location.href);
  });
  /* jshint multistr:true */

  function $n(e) {
    return document.querySelector(e);
  }
  function $na(e) {
    return document.querySelectorAll(e);
  }
})();