1
1
/* Table to list converter wit JQuery */
2
+
3
+ function scrollToAnchor ( hash ) {
4
+ if ( hash ) {
5
+ setTimeout ( ( ) => {
6
+ const $target = $ ( hash ) ;
7
+ if ( $target . length ) {
8
+ $ ( 'html, body' ) . scrollTop ( $target . offset ( ) . top ) ;
9
+ }
10
+ } , 0 ) ;
11
+ }
12
+ }
13
+
2
14
$ ( window ) . on ( 'load' , function ( ) {
15
+ const anchor = window . location . hash ;
3
16
let $table = $ ( '#rank-feature-table' ) ;
4
17
let $list = $ ( '<ul id="feature-list"></ul>' ) ;
5
18
@@ -39,33 +52,36 @@ $(window).on('load', function() {
39
52
} ) ;
40
53
41
54
$table . replaceWith ( $list ) ;
55
+ scrollToAnchor ( anchor ) ;
42
56
} ) ;
43
57
44
58
/* Natve Ranking Tables */
45
59
$ ( window ) . on ( 'load' , function ( ) {
46
- let $table = $ ( '#nativerank-variables-table' ) ;
47
- let $list = $ ( '<ul id="variable-list"></ul>' ) ;
48
-
49
- $table . find ( 'tbody tr' ) . each ( function ( ) {
50
- let $row = $ ( this ) ;
51
- let $tds = $row . find ( 'td' ) ;
52
-
53
- if ( $tds . length >= 2 ) {
54
- let variable = $tds . eq ( 0 ) . html ( ) . trim ( ) ; // Keep HTML (e.g., <em>, <sub>)
55
- let description = $tds . eq ( 1 ) . html ( ) . trim ( ) ; // Keep inner HTML
56
-
57
- let $li = $ ( '<li style="margin-bottom: 1em;"></li>' ) ;
58
- $li . append ( '<strong>' + variable + '</strong>' ) ;
59
- $li . append ( '<div>' + description + '</div>' ) ;
60
-
61
- $list . append ( $li ) ;
62
- }
63
- } ) ;
64
-
65
- $table . replaceWith ( $list ) ;
60
+ const anchor = window . location . hash ;
61
+ let $table = $ ( '#nativerank-variables-table' ) ;
62
+ let $list = $ ( '<ul id="variable-list"></ul>' ) ;
63
+
64
+ $table . find ( 'tbody tr' ) . each ( function ( ) {
65
+ let $row = $ ( this ) ;
66
+ let $tds = $row . find ( 'td' ) ;
67
+
68
+ if ( $tds . length >= 2 ) {
69
+ let variable = $tds . eq ( 0 ) . html ( ) . trim ( ) ; // Keep HTML (e.g., <em>, <sub>)
70
+ let description = $tds . eq ( 1 ) . html ( ) . trim ( ) ; // Keep inner HTML
71
+
72
+ let $li = $ ( '<li style="margin-bottom: 1em;"></li>' ) ;
73
+ $li . append ( '<strong>' + variable + '</strong>' ) ;
74
+ $li . append ( '<div>' + description + '</div>' ) ;
75
+
76
+ $list . append ( $li ) ;
77
+ }
78
+ } ) ;
79
+ $table . replaceWith ( $list ) ;
80
+ scrollToAnchor ( anchor ) ;
66
81
} ) ;
67
82
68
83
$ ( window ) . on ( 'load' , function ( ) {
84
+ const anchor = window . location . hash ;
69
85
let $table = $ ( '#native-rank-parameters-table' ) ;
70
86
let $list = $ ( '<ul id="native-rank-parameters-list"></ul>' ) ;
71
87
@@ -98,5 +114,6 @@ $(window).on('load', function() {
98
114
} ) ;
99
115
100
116
$table . replaceWith ( $list ) ;
117
+ scrollToAnchor ( anchor ) ;
101
118
} ) ;
102
119
0 commit comments