url2ss

解析独秀ssid

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Greasemonkey lub Violentmonkey.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana będzie instalacja rozszerzenia Tampermonkey lub Userscripts.

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

Aby zainstalować ten skrypt, musisz zainstalować rozszerzenie menedżera skryptów użytkownika.

(Mam już menedżera skryptów użytkownika, pozwól mi to zainstalować!)

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.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Musisz zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

(Mam już menedżera stylów użytkownika, pozwól mi to zainstalować!)

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