CSDN-copy-without-login

Allow copying code in CSDN posts without logging in.

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

Dovrai installare un'estensione come Tampermonkey o Violentmonkey per installare questo 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         CSDN-copy-without-login
// @namespace    lytning98_CSDN-copy-without-login
// @version      0.1
// @description  Allow copying code in CSDN posts without logging in.
// @author       lytning98
// @source       https://github.com/lytning98/CSDN-copy-without-login
// @match        https://blog.csdn.net/*/article/details/*
// @require      https://cdn.jsdelivr.net/npm/[email protected]/dist/jquery.min.js
// @grant        none
// ==/UserScript==

(function() {
    'use strict';
    var engine = hljs.copyCode ? 'hljs' : 'mdcp';
    var $bindee = engine == 'hljs' ? $('.hljs-button.signin') : $('.prettyprint > code');

    eval(engine).signin = Function();
    $bindee.attr('onclick', engine + '.copyCode(event)');
    $('.hljs-button.signin').attr('class', 'hljs-button {2}').attr('data-title', '不登录也复制');

})();