javascript Tampermonkey图书馆

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了javascript Tampermonkey图书馆相关的知识,希望对你有一定的参考价值。

// ==UserScript==
// @name         Safaribooksonline
// @namespace    https://zhangt.ai
// @version      0.1
// @description  Safaribooksonline
// @author       Zhang Tai
// @require      https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js
// @match        https://www.safaribooksonline.com/library/*
// ==/UserScript==

$('head').append('<link href="https://fonts.googleapis.com/css?family=Exo" rel="stylesheet">');
$('head').append('<link href="https://fonts.googleapis.com/css?family=Source+Code+Pro" rel="stylesheet">');
$('head').append('<link href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/styles/atelier-dune-light.min.css" rel="stylesheet">');
$('head').append(`<style>
    div#sbo-rt-content * {
        font-family: 'Exo', sans-serif;
        font-size: 2rem;
    }
#sbo-rt-content kbd, #sbo-rt-content .packt_action {
    font-family: font-family: 'Source Code Pro', monospace;
    font-size: 100%;
    font-weight: normal;
}
#sbo-rt-content a,
#sbo-rt-content .packt_url {
    font-family: inherit;
    font-size: inherit;
}
#lesson-fragment .pre,
#lesson-fragment .pre-ex,
#lesson-fragment .pre1,
#lesson-fragment .pre_w,
#lesson-fragment p.pre,
#lesson-fragment pre,
#sbo-rt-content .pre,
#sbo-rt-content .pre-ex,
#sbo-rt-content .pre1,
#sbo-rt-content .pre_w,
#sbo-rt-content p.pre,
#sbo-rt-content pre {
    font-family: 'Source Code Pro', monospace;
/*
    margin-left: -38% !important;
    margin-right: -38% important;
*/
    border: 0 !important;
    box-shadow: 0 2px 6px 0 hsla(0, 0%, 0%, 0.2);
    }
</style>`);

$.getScript("https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/highlight.min.js").done(function() {

    $.getScript( "https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/languages/javascript.min.js" )
        .done(function() {
        $(document).ready(function() {
            $('pre').each(function(i, block) {
                hljs.highlightBlock(block);
            });
        });
    });

});

以上是关于javascript Tampermonkey图书馆的主要内容,如果未能解决你的问题,请参考以下文章

javascript tampermonkey脚本

javascript Tampermonkey扩展

javascript tampermonkey-spider1

在 Tampermonkey 中使用 javascript 进行页面搜索和文本框自动填充

使用 Tampermonkey/javascript 控制 Netflix (HTML5) 播放

JavaScript(JS)逆向工具Tampermonkey用法 (JS Hook代码逆向破解)