@@ -1490,37 +1490,42 @@ function hideThemeButtonState() {
14901490 searchState . setup ( ) ;
14911491} ( ) ) ;
14921492
1493- let reset_button_timeout ;
1493+ ( function ( ) {
1494+ var reset_button_timeout = null ;
1495+
1496+ function copy_path ( but ) {
1497+ var parent = but . parentElement ;
1498+ var path = [ ] ;
1499+
1500+ onEach ( parent . childNodes , function ( child ) {
1501+ if ( child . tagName === 'A' ) {
1502+ path . push ( child . textContent ) ;
1503+ }
1504+ } ) ;
1505+
1506+ var el = document . createElement ( 'textarea' ) ;
1507+ el . value = 'use ' + path . join ( '::' ) + ';' ;
1508+ el . setAttribute ( 'readonly' , '' ) ;
1509+ // To not make it appear on the screen.
1510+ el . style . position = 'absolute' ;
1511+ el . style . left = '-9999px' ;
14941512
1495- function copy_path ( but ) {
1496- var parent = but . parentElement ;
1497- var path = [ ] ;
1513+ document . body . appendChild ( el ) ;
1514+ el . select ( ) ;
1515+ document . execCommand ( 'copy' ) ;
1516+ document . body . removeChild ( el ) ;
14981517
1499- onEach ( parent . childNodes , function ( child ) {
1500- if ( child . tagName === 'A' ) {
1501- path . push ( child . textContent ) ;
1518+ but . textContent = '✓' ;
1519+
1520+ if ( reset_button_timeout !== null ) {
1521+ window . clearTimeout ( reset_button_timeout ) ;
1522+ }
1523+
1524+ function reset_button ( ) {
1525+ but . textContent = '⎘' ;
1526+ reset_button_timeout = null ;
15021527 }
1503- } ) ;
15041528
1505- var el = document . createElement ( 'textarea' ) ;
1506- el . value = 'use ' + path . join ( '::' ) + ';' ;
1507- el . setAttribute ( 'readonly' , '' ) ;
1508- // To not make it appear on the screen.
1509- el . style . position = 'absolute' ;
1510- el . style . left = '-9999px' ;
1511-
1512- document . body . appendChild ( el ) ;
1513- el . select ( ) ;
1514- document . execCommand ( 'copy' ) ;
1515- document . body . removeChild ( el ) ;
1516-
1517- but . textContent = '✓' ;
1518-
1519- window . clearTimeout ( reset_button_timeout ) ;
1520-
1521- function reset_button ( ) {
1522- but . textContent = '⎘' ;
1529+ reset_button_timeout = window . setTimeout ( reset_button , 1000 ) ;
15231530 }
1524-
1525- reset_button_timeout = window . setTimeout ( reset_button , 1000 ) ;
1526- }
1531+ } ( ) ) ;
0 commit comments