url2ss

解析独秀ssid

Du musst eine Erweiterung wie Tampermonkey, Greasemonkey oder Violentmonkey installieren, um dieses Skript zu installieren.

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 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.

Sie müssten eine Skript Manager Erweiterung installieren damit sie dieses Skript installieren können

(Ich habe schon ein Skript Manager, Lass mich es installieren!)

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.

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

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

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

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

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

// ==UserScript==
// @name         url2ss
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  解析独秀ssid
// @author       You
// @include        http://*.fazz.ntszzy.org:8070/*
// @include        https://*.duxiu.com/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=ntszzy.org
// @grant        none
// @license MIT
// ==/UserScript==

(function() {
    'use strict';
    let hoverEle;
    document.addEventListener('mousemove', e=>{
        hoverEle = document.elementFromPoint(e.clientX, e.clientY)
    }
    , {
        passive: true
    })

    var clipboard = {
        data: '',
        intercept: false,
        hook: function(evt) {
            if (clipboard.intercept) {
                evt.preventDefault();
                evt.clipboardData.setData('text/plain', clipboard.data);
                alert(clipboard.data + ' copy success');
                clipboard.intercept = false;
                clipboard.data = '';
            }
        }
    };

    window.addEventListener('copy', clipboard.hook);

    function copy(textContent) {
        clipboard.data = textContent;

        if (window.clipboardData) {
            window.clipboardData.setData('Text', clipboard.data);
        } else {
            clipboard.intercept = true;
            document.execCommand('copy');
        }
    }

    document.addEventListener('keypress', function(e) {
        console.log(e);
        if (e.keyCode === 99) {
            const url = document.location.href + hoverEle.closest("a").getAttribute('href')
            console.log(url);
            const ss = new URL(url).searchParams.get('qwkey').substr(0, 8);
            console.log(ss);
            copy(ss)
        }
    })
    // Your code here...
}
)();