F12 Newmenu private

自用的F12查看menu

目前為 2020-12-18 提交的版本,檢視 最新版本

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         F12 Newmenu private
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  自用的F12查看menu
// @author       白水
// @match        *
// @grant        none
// @hone-url
// ==/UserScript==

(function() {
    'use strict';
//通过 <H1> 判断是否存在目录
if (document.getElementsByTagName("h1").length !== 0) {
    var j = 0; //var j = 1; //当前的层级是多少?因为最低是1
    for (var i = 0, ilen = document.all.length; i < ilen; i++) {
        if (document.all[i].tagName.length == 2 && document.all[i].tagName.toString()[0] == "H") {
            if (j < document.all[i].tagName.toString()[1]) {
                console.group(document.all[i].textContent);
            } else if (j >= document.all[i].tagName.toString()[1]) {
                for (var k = 0; k < j - document.all[i].tagName.toString()[1] + 1; k++) { console.groupEnd(); }
                console.group(document.all[i].textContent);
            } else;
            j = document.all[i].tagName.toString()[1];
        }
    }
    for (var l = 0; l < j; l++) { console.groupEnd(); }
}
})();