// ==UserScript==
// @name F12 Newmenu private
// @namespace http://tampermonkey.net/
// @version 0.1
// @description 自用的F12查看menu
// @author 白水
// @match *
// @grant none
// @hone-url
// @downloadURL none
// ==/UserScript==
(function() {
'use strict';
//通过
判断是否存在目录
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(); }
}
})();