您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
shift+c to copy title link
当前为
- // ==UserScript==
- // @name copy title
- // @description shift+c to copy title link
- // @name:en copy title
- // @description:en shift+c to copy title link
- // @name:ko 페이지 제목 복사
- // @description:ko shift+c로 페이지 제목 링크 복사
- // @namespace https://greasyfork.org/ko/users/713014-nanikit
- // @version 201218
- // @author nanikit
- // @match *://*/*
- // @grant none
- // ==/UserScript==
- 'use strict';
- const copyTitleHandler = (event) => {
- const titleText = document.title;
- const anchor = document.createElement('a');
- anchor.href = document.location.href;
- anchor.innerText = titleText;
- const titleHtml = anchor.outerHTML;
- event.clipboardData.setData("text/html", titleHtml);
- event.clipboardData.setData("text/plain", titleText);
- event.preventDefault();
- }
- const copyTitle = () => {
- document.addEventListener("copy", copyTitleHandler);
- document.execCommand("copy");
- document.removeEventListener("copy", copyTitleHandler);
- };
- window.addEventListener('keydown', (event) => {
- if (event.shiftKey && event.key === 'C') {
- copyTitle();
- }
- });