kuan-url-copy

2023/12/4 09:11:30

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

ستحتاج إلى تثبيت إضافة مثل Stylus لتثبيت هذا النمط.

ستحتاج إلى تثبيت إضافة لإدارة أنماط المستخدم لتتمكن من تثبيت هذا النمط.

ستحتاج إلى تثبيت إضافة لإدارة أنماط المستخدم لتثبيت هذا النمط.

ستحتاج إلى تثبيت إضافة لإدارة أنماط المستخدم لتثبيت هذا النمط.

(لدي بالفعل مثبت أنماط للمستخدم، دعني أقم بتثبيته!)

// ==UserScript==
// @name        kuan-url-copy
// @match       https://www.coolapk.com/link?*
// @namespace   http://github.com/zhichengroup/kuanurl
// @grant       none
// @version     1.0
// @author      zcg
// @description 2023/12/4 09:11:30
// ==/UserScript==

(function () {
  'use strict';
  console.info('开启酷安自动跳转脚本');
  var url = document.getElementsByTagName('p')[0].innerText;

  var a =document.createElement('a');
  a.innerHTML = '<a href="' + url +'">open</a>';
  document.body.appendChild(a);

  var b =document.createElement('button');
  b.innerText='copy url'
  b.onclick=function(){
    var oInput = document.createElement('input');
    oInput.value = url;
    document.body.appendChild(oInput);
    oInput.select(); // 选择对象
    document.execCommand("Copy"); // 执行浏览器复制命令
    oInput.className = 'oInput';
    oInput.style.display = 'none';
    alert('复制成功');
  }
  document.body.appendChild(b);

})();