kuan-url-copy

2023/12/4 09:11:30

Dovrai installare un'estensione come Tampermonkey, Greasemonkey o Violentmonkey per installare questo script.

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

Dovrai installare un'estensione come Tampermonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Userscripts per installare questo script.

Dovrai installare un'estensione come ad esempio Tampermonkey per installare questo script.

Dovrai installare un gestore di script utente per installare questo script.

(Ho già un gestore di script utente, lasciamelo installare!)

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

(Ho già un gestore di stile utente, lasciamelo installare!)

// ==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);

})();