File tree Expand file tree Collapse file tree 1 file changed +15
-4
lines changed
Expand file tree Collapse file tree 1 file changed +15
-4
lines changed Original file line number Diff line number Diff line change @@ -696,13 +696,24 @@ window.copyBadgeMarkdown = async function(format) {
696696
697697// Show copy notification for badge modal
698698function showBadgeCopyNotification ( format ) {
699- const btn = document . querySelector ( `.badge-format-section:nth-child(${ format === 'svg' ? 2 : 3 } ) .badge-copy-btn` ) ;
699+ // Find the correct button by format
700+ const sections = document . querySelectorAll ( '.badge-format-section' ) ;
701+ const sectionIndex = format === 'svg' ? 0 : 1 ;
702+ const btn = sections [ sectionIndex ] ?. querySelector ( '.badge-copy-btn' ) ;
703+
700704 if ( btn ) {
701- const originalText = btn . querySelector ( '.copy-text' ) . textContent ;
702- btn . querySelector ( '.copy-text' ) . textContent = 'Скопировано!' ;
705+ const copyIcon = btn . querySelector ( '.copy-icon' ) ;
706+ const copyText = btn . querySelector ( '.copy-text' ) ;
707+ const originalIcon = copyIcon . textContent ;
708+ const originalText = copyText . textContent ;
709+
710+ copyIcon . textContent = '✓' ;
711+ copyText . textContent = 'Скопировано!' ;
703712 btn . classList . add ( 'copied' ) ;
713+
704714 setTimeout ( ( ) => {
705- btn . querySelector ( '.copy-text' ) . textContent = originalText ;
715+ copyIcon . textContent = originalIcon ;
716+ copyText . textContent = originalText ;
706717 btn . classList . remove ( 'copied' ) ;
707718 } , 2000 ) ;
708719 }
You can’t perform that action at this time.
0 commit comments