url2ss

解析独秀ssid

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

Bạn sẽ cần cài đặt một tiện ích mở rộng như Tampermonkey hoặc Violentmonkey để cài đặt kịch bản này.

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.

(Tôi đã có Trình quản lý tập lệnh người dùng, hãy cài đặt nó!)

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