@@ -22,6 +22,7 @@ import {initMarkupAnchors} from './markup/anchors.js';
2222import { initNotificationsTable , initNotificationCount } from './features/notification.js' ;
2323import { initStopwatch } from './features/stopwatch.js' ;
2424import { renderMarkupContent } from './markup/content.js' ;
25+ import { showLineButton } from './code/linebutton.js' ;
2526import { stripTags , mqBinarySearch } from './utils.js' ;
2627import { svg , svgs } from './svg.js' ;
2728
@@ -2213,49 +2214,6 @@ function searchRepositories() {
22132214 } ) ;
22142215}
22152216
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-
22592217function initCodeView ( ) {
22602218 if ( $ ( '.code-view .lines-num' ) . length > 0 ) {
22612219 $ ( document ) . on ( 'click' , '.lines-num span' , function ( e ) {
@@ -2268,9 +2226,7 @@ function initCodeView() {
22682226 }
22692227 selectRange ( $list , $list . filter ( `[rel=${ $select . attr ( 'id' ) } ]` ) , ( e . shiftKey ? $list . filter ( '.active' ) . eq ( 0 ) : null ) ) ;
22702228 deSelect ( ) ;
2271-
2272- // show code view menu marker
2273- showCodeViewMenu ( ) ;
2229+ showLineButton ( ) ;
22742230 } ) ;
22752231
22762232 $ ( window ) . on ( 'hashchange' , ( ) => {
@@ -2285,21 +2241,15 @@ function initCodeView() {
22852241 if ( m ) {
22862242 $first = $list . filter ( `[rel=${ m [ 1 ] } ]` ) ;
22872243 selectRange ( $list , $first , $list . filter ( `[rel=${ m [ 2 ] } ]` ) ) ;
2288-
2289- // show code view menu marker
2290- showCodeViewMenu ( ) ;
2291-
2244+ showLineButton ( ) ;
22922245 $ ( 'html, body' ) . scrollTop ( $first . offset ( ) . top - 200 ) ;
22932246 return ;
22942247 }
22952248 m = window . location . hash . match ( / ^ # ( L | n ) ( \d + ) $ / ) ;
22962249 if ( m ) {
22972250 $first = $list . filter ( `[rel=L${ m [ 2 ] } ]` ) ;
22982251 selectRange ( $list , $first ) ;
2299-
2300- // show code view menu marker
2301- showCodeViewMenu ( ) ;
2302-
2252+ showLineButton ( ) ;
23032253 $ ( 'html, body' ) . scrollTop ( $first . offset ( ) . top - 200 ) ;
23042254 }
23052255 } ) . trigger ( 'hashchange' ) ;
0 commit comments