@@ -22,6 +22,7 @@ import {initMarkupAnchors} from './markup/anchors.js';
22
22
import { initNotificationsTable , initNotificationCount } from './features/notification.js' ;
23
23
import { initStopwatch } from './features/stopwatch.js' ;
24
24
import { renderMarkupContent } from './markup/content.js' ;
25
+ import { showLineButton } from './code/linebutton.js' ;
25
26
import { stripTags , mqBinarySearch } from './utils.js' ;
26
27
import { svg , svgs } from './svg.js' ;
27
28
@@ -2213,49 +2214,6 @@ function searchRepositories() {
2213
2214
} ) ;
2214
2215
}
2215
2216
2216
- function showCodeViewMenu ( ) {
2217
- if ( $ ( '.code-view-menu-list' ) . length === 0 ) {
2218
- return ;
2219
- }
2220
-
2221
- // Get clicked tr
2222
- const $code_tr = $ ( '.code-view td.lines-code.active' ) . parent ( ) ;
2223
-
2224
- // Reset code line marker
2225
- $ ( '.code-view-menu-list' ) . appendTo ( $ ( '.code-view' ) ) ;
2226
- $ ( '.code-line-marker' ) . remove ( ) ;
2227
-
2228
- // Generate new one
2229
- const icon_wrap = $ ( '<div>' , {
2230
- class : 'code-line-marker'
2231
- } ) . prependTo ( $code_tr . find ( 'td:eq(0)' ) . get ( 0 ) ) . hide ( ) ;
2232
-
2233
- const a_wrap = $ ( '<a>' , {
2234
- class : 'code-line-link'
2235
- } ) . appendTo ( icon_wrap ) ;
2236
-
2237
- $ ( '<i>' , {
2238
- class : 'dropdown icon' ,
2239
- style : 'margin: 0px;'
2240
- } ) . appendTo ( a_wrap ) ;
2241
-
2242
- icon_wrap . css ( {
2243
- left : '-7px' ,
2244
- display : 'block' ,
2245
- } ) ;
2246
-
2247
- $ ( '.code-view-menu-list' ) . css ( {
2248
- 'min-width' : '220px' ,
2249
- } ) ;
2250
-
2251
- // Popup the menu
2252
- $ ( '.code-line-link' ) . popup ( {
2253
- popup : $ ( '.code-view-menu-list' ) ,
2254
- on : 'click' ,
2255
- lastResort : 'bottom left' ,
2256
- } ) ;
2257
- }
2258
-
2259
2217
function initCodeView ( ) {
2260
2218
if ( $ ( '.code-view .lines-num' ) . length > 0 ) {
2261
2219
$ ( document ) . on ( 'click' , '.lines-num span' , function ( e ) {
@@ -2268,9 +2226,7 @@ function initCodeView() {
2268
2226
}
2269
2227
selectRange ( $list , $list . filter ( `[rel=${ $select . attr ( 'id' ) } ]` ) , ( e . shiftKey ? $list . filter ( '.active' ) . eq ( 0 ) : null ) ) ;
2270
2228
deSelect ( ) ;
2271
-
2272
- // show code view menu marker
2273
- showCodeViewMenu ( ) ;
2229
+ showLineButton ( ) ;
2274
2230
} ) ;
2275
2231
2276
2232
$ ( window ) . on ( 'hashchange' , ( ) => {
@@ -2285,21 +2241,15 @@ function initCodeView() {
2285
2241
if ( m ) {
2286
2242
$first = $list . filter ( `[rel=${ m [ 1 ] } ]` ) ;
2287
2243
selectRange ( $list , $first , $list . filter ( `[rel=${ m [ 2 ] } ]` ) ) ;
2288
-
2289
- // show code view menu marker
2290
- showCodeViewMenu ( ) ;
2291
-
2244
+ showLineButton ( ) ;
2292
2245
$ ( 'html, body' ) . scrollTop ( $first . offset ( ) . top - 200 ) ;
2293
2246
return ;
2294
2247
}
2295
2248
m = window . location . hash . match ( / ^ # ( L | n ) ( \d + ) $ / ) ;
2296
2249
if ( m ) {
2297
2250
$first = $list . filter ( `[rel=L${ m [ 2 ] } ]` ) ;
2298
2251
selectRange ( $list , $first ) ;
2299
-
2300
- // show code view menu marker
2301
- showCodeViewMenu ( ) ;
2302
-
2252
+ showLineButton ( ) ;
2303
2253
$ ( 'html, body' ) . scrollTop ( $first . offset ( ) . top - 200 ) ;
2304
2254
}
2305
2255
} ) . trigger ( 'hashchange' ) ;
0 commit comments