@@ -53,9 +53,26 @@ function init(list) {
53
53
54
54
var hreftagname = header . firstElementChild . hash ;
55
55
var level = parseInt ( header . tagName . replace ( 'H' , '' ) , 10 ) ;
56
+
56
57
if ( ! isGetFisrtLevel ) {
57
58
firstLevel = level ;
58
59
isGetFisrtLevel = true ;
60
+
61
+ var header_p = document . createElement ( "li" ) ;
62
+ header_p . textContent = "Article TOC for GitHub" ;
63
+ addStyle ( header_p , { "listStyle" : "none" , "font-size" :"20px" , "margin-bottom" :"10px" } ) ;
64
+
65
+ var gotop_li = document . createElement ( "li" ) ;
66
+ var gotop_li = document . createElement ( "li" ) ;
67
+ addStyle ( gotop_li , { "listStyle" : "none" } ) ;
68
+ var gotop_a = document . createElement ( "a" ) ;
69
+ addStyle ( gotop_a , { "color" : "#0366d6" , "textOverflow " : "ellipsis" , "font-weight" :"bold" } ) ;
70
+ gotop_a . innerHTML = "▲ GO TOP" ;
71
+ gotop_a . setAttribute ( "href" , "#" ) ;
72
+ div_toc . appendChild ( header_p ) ;
73
+
74
+ div_toc . appendChild ( gotop_li ) ;
75
+ div_toc . lastChild . appendChild ( gotop_a ) ;
59
76
}
60
77
61
78
var li = document . createElement ( "li" ) ;
@@ -65,11 +82,9 @@ function init(list) {
65
82
addStyle ( a , { "color" : "#0366d6" , "textOverflow " : "ellipsis" } ) ;
66
83
67
84
// a.innerHTML = level + header.textContent;
68
-
69
- console . log ( "firstLevel " + firstLevel ) ;
70
- console . log ( "level " + level ) ;
71
85
if ( level == firstLevel ) {
72
86
a . innerHTML = header . textContent ;
87
+ addStyle ( a , { "font-weight" :"bold" } ) ;
73
88
}
74
89
else {
75
90
a . innerHTML = new Array ( level * 2 ) . join ( ' ' ) + header . textContent ;
0 commit comments