谷歌翻译Qt文档代码框屏蔽

123

目前為 2021-04-11 提交的版本,檢視 最新版本

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         谷歌翻译Qt文档代码框屏蔽
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  123
// @author       海
// @match        https://doc.qt.io/*
// @grant        none
// @run-at  document-start
// @require https://code.jquery.com/jquery-2.1.4.min.js
/* globals jQuery, $, waitForKeyElements */
// ==/UserScript==

(function() {
    'use strict';
    $(function(){

        $("pre").each(function(){
            var pre = $(this).html()
            $(this).empty()
            $(this).html("<code>"+pre+"</code>")
        });
        $("b").each(function(){
            var b = $(this).html()
            $(this).empty()
            $(this).html("<code>"+b+"</code>")
        });
        var Q = ""
        $("div.context [href]").each(function(){
            var text = $(this).html()
            var font = $(this).text()
            var font1 = text
            var Q = ""
            var i = 0
            for (i = 0; i < font1.length; i++) {
                if(i!=0 ){
                    if( font1[i]<'A' || font1[i]>'Z'){
                        if( font1[i]<'0' || font1[i]>'9'){
                            Q = Q + font1[i]
                        }else{
                            Q = Q +" "+ font1[i]
                        }
                       
                    }else{
                    Q = Q +" "+ font1[i]
                    }
                }else{
                    Q = Q + font1[i]
                }

            }
            $(this).empty()
            $(this).html(Q+"<font color=\"#9D9D9D\" style=\"font-size: 5px;\">【<code>"+font+"</code>】</font>")
        });

        console.log(Q)
        
     })


})();