@@ -6,88 +6,47 @@ function attachAllListeners() {
6
6
}
7
7
8
8
var scrollPosition = sessionStorage . getItem ( "scroll_value" ) ;
9
- console . log ( scrollPosition ) ;
10
9
if ( scrollPosition ) {
11
10
var sideMenu = document . querySelector ( ".side-menu" ) ;
12
11
sideMenu . scrollTo ( 0 , scrollPosition ) ;
13
12
}
14
13
15
- var elements = document . getElementsByClassName ( "documentableElement" ) ;
14
+ var elements = document . getElementsByClassName ( "documentableElement" )
16
15
if ( elements ) {
17
16
for ( i = 0 ; i < elements . length ; i ++ ) {
18
- var expanderChild = elements [ i ] . querySelector (
19
- ".documentableElement-expander" ,
20
- ) ;
21
- if (
22
- elements [ i ] . querySelector ( ".show-content" ) !== null &&
23
- expanderChild !== null
24
- ) {
17
+ var expanderChild = elements [ i ] . querySelector ( ".documentableElement-expander" )
18
+ if ( elements [ i ] . querySelector ( ".show-content" ) !== null && expanderChild !== null ) {
25
19
expanderChild . onclick = function ( e ) {
26
20
if ( ! $ ( e . target ) . is ( "a" ) && e . fromSnippet !== true ) {
27
- this . parentElement . classList . toggle ( "expand" ) ;
28
- this . querySelector ( ".show-content" ) . classList . toggle ( "expand" ) ;
21
+ this . parentElement . classList . toggle ( "expand" )
22
+ this . querySelector ( ".show-content" ) . classList . toggle ( "expand" )
29
23
}
30
- } ;
24
+ }
31
25
}
32
26
}
33
27
}
34
28
35
- var documentableLists = document . getElementsByClassName ( "documentableList" ) ;
29
+ var documentableLists = document . getElementsByClassName ( "documentableList" )
36
30
if ( documentableLists ) {
37
31
for ( i = 0 ; i < documentableLists . length ; i ++ ) {
38
32
documentableLists [ i ] . children [ 0 ] . onclick = function ( e ) {
39
33
this . classList . toggle ( "expand" ) ;
40
34
this . parentElement . classList . toggle ( "expand" ) ;
41
- } ;
35
+ }
42
36
}
43
37
}
44
38
45
- var memberLists = document . getElementsByClassName ( "tab" ) ;
39
+ var memberLists = document . getElementsByClassName ( "tab" )
46
40
if ( memberLists ) {
47
41
for ( i = 0 ; i < memberLists . length ; i ++ ) {
48
42
if ( $ ( memberLists [ i ] . children [ 0 ] ) . is ( "button" ) ) {
49
43
memberLists [ i ] . children [ 0 ] . onclick = function ( e ) {
50
44
this . classList . toggle ( "expand" ) ;
51
45
this . parentElement . classList . toggle ( "expand" ) ;
52
- } ;
46
+ }
53
47
}
54
48
}
55
49
}
56
- $ ( ".side-menu span" ) . on ( "click" , function ( ) {
57
- $ ( this ) . parent ( ) . toggleClass ( "expanded" ) ;
58
- } ) ;
59
- document . querySelectorAll ( 'a' ) . forEach ( el => {
60
- const href = el . href
61
- if ( href === "" ) { return }
62
- const url = new URL ( href )
63
- el . addEventListener ( 'click' , e => {
64
- if ( url . href . replace ( "#" , "" ) === window . location . href . replace ( "#" , "" ) ) { return }
65
- if ( url . origin !== window . location . origin ) { return }
66
- if ( e . metaKey || e . ctrlKey || e . shiftKey || e . altKey || e . button !== 0 ) { return }
67
- e . preventDefault ( )
68
- e . stopPropagation ( )
69
- $ . get ( href , function ( data ) {
70
- const html = $ . parseHTML ( data )
71
- const title = html . find ( node => node . nodeName === "TITLE" ) . innerText
72
- const bodyDiv = html . find ( node => node . nodeName === "DIV" )
73
- const { children } = document . body . firstChild
74
- if ( window . history . state === null ) {
75
- window . history . replaceState ( {
76
- leftColumn : children [ 3 ] . innerHTML ,
77
- mainDiv : children [ 6 ] . innerHTML ,
78
- title : document . title ,
79
- } , '' )
80
- }
81
- document . title = title
82
- const leftColumn = bodyDiv . children [ 3 ] . innerHTML
83
- const mainDiv = bodyDiv . children [ 6 ] . innerHTML
84
- window . history . pushState ( { leftColumn, mainDiv, title } , '' , href )
85
- children [ 3 ] . innerHTML = leftColumn
86
- children [ 6 ] . innerHTML = mainDiv
87
- attachAllListeners ( )
88
- } )
89
- } )
90
- } )
91
50
92
51
document . querySelectorAll ( 'a' ) . forEach ( el => {
93
52
const href = el . href
@@ -122,10 +81,10 @@ function attachAllListeners() {
122
81
} )
123
82
} )
124
83
125
- $ ( ".ar" ) . on ( " click" , function ( e ) {
126
- $ ( this ) . parent ( ) . parent ( ) . toggleClass ( "expanded" ) ;
127
- $ ( this ) . toggleClass ( "expanded" ) ;
128
- e . stopPropagation ( ) ;
84
+ $ ( ".ar" ) . on ( ' click' , function ( e ) {
85
+ $ ( this ) . parent ( ) . parent ( ) . toggleClass ( "expanded" )
86
+ $ ( this ) . toggleClass ( "expanded" )
87
+ e . stopPropagation ( )
129
88
} ) ;
130
89
131
90
document . querySelectorAll ( ".nh" ) . forEach ( el => el . addEventListener ( 'click' , ( ) => {
@@ -137,38 +96,24 @@ function attachAllListeners() {
137
96
}
138
97
} ) )
139
98
140
- document . querySelectorAll ( ".supertypes" ) . forEach ( ( el ) =>
141
- el . firstChild . addEventListener ( "click" , ( ) => {
142
- el . classList . toggle ( "collapsed" ) ;
143
- el . firstChild . classList . toggle ( "expand" ) ;
144
- } ) ,
145
- ) ;
146
-
147
- document . querySelectorAll ( ".subtypes" ) . forEach ( ( el ) =>
148
- el . firstChild . addEventListener ( "click" , ( ) => {
149
- el . classList . toggle ( "collapsed" ) ;
150
- el . firstChild . classList . toggle ( "expand" ) ;
151
- } ) ,
152
- ) ;
153
-
154
- document . querySelectorAll ( ".nh" ) . forEach ( ( el ) =>
155
- el . addEventListener ( "click" , ( ) => {
156
- el . lastChild . click ( ) ;
157
- el . first . addClass ( "expanded" ) ;
158
- el . parent . addClass ( "expanded" ) ;
159
- } ) ,
160
- ) ;
161
-
162
- document . querySelectorAll ( ".ni" ) . forEach ( ( link ) =>
163
- link . addEventListener ( "mouseenter" , ( e ) => {
164
- sessionStorage . setItem (
165
- "scroll_value" ,
166
- link . offsetTop - window . innerHeight / 2 ,
167
- ) ;
168
- } ) ,
169
- ) ;
170
-
171
- const observer = new IntersectionObserver ( entries => {
99
+ document . querySelectorAll ( ".supertypes" ) . forEach ( el => el . firstChild . addEventListener ( 'click' , ( ) => {
100
+ el . classList . toggle ( "collapsed" ) ;
101
+ el . firstChild . classList . toggle ( "expand" ) ;
102
+ } ) )
103
+
104
+
105
+ document . querySelectorAll ( ".subtypes" ) . forEach ( el => el . firstChild . addEventListener ( 'click' , ( ) => {
106
+ el . classList . toggle ( "collapsed" ) ;
107
+ el . firstChild . classList . toggle ( "expand" ) ;
108
+ } ) )
109
+
110
+ document . querySelectorAll ( ".ni" ) . forEach ( link =>
111
+ link . addEventListener ( "mouseenter" , _e => {
112
+ sessionStorage . setItem ( "scroll_value" , link . offsetTop - window . innerHeight / 2 )
113
+ } )
114
+ )
115
+
116
+ observer = new IntersectionObserver ( entries => {
172
117
entries . forEach ( entry => {
173
118
const id = entry . target . getAttribute ( 'id' ) ;
174
119
if ( entry . intersectionRatio > 0 ) {
0 commit comments