@@ -39,15 +39,15 @@ if (noLeftPanel != null)
39
39
40
40
// <> Magic Text
41
41
function getRandomChar ( ) {
42
- chars = "ÂÃÉÊÐÑÙÚÛÜéêëãòóôēĔąĆćŇň1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ~!@#$%^&*()-=_+{}[" ;
43
- return chars . charAt ( Math . floor ( Math . random ( ) * chars . length ) + 1 )
42
+ chars = "ÂÃÉÊÐÑÙÚÛÜéêëãòóôēĔąĆćŇň1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ~!@#$%^&*()-=_+{}[" ;
43
+ return chars . charAt ( Math . floor ( Math . random ( ) * chars . length ) + 1 )
44
44
}
45
45
46
46
function magicTextGen ( element ) {
47
47
var msg = element . textContent ;
48
- var length = msg . length ;
48
+ var length = msg . length ;
49
49
50
- setInterval ( ( ) => {
50
+ setInterval ( ( ) => {
51
51
var newMsg = "" ;
52
52
for ( i = 0 ; i <= length ; i ++ ) {
53
53
newMsg += getRandomChar ( msg . charAt ( i ) ) ;
@@ -58,17 +58,17 @@ function magicTextGen(element) {
58
58
}
59
59
60
60
function renderMagicText ( ) {
61
- document . querySelectorAll ( '.magic-text' ) . forEach ( ( e ) => {
62
- magicTextGen ( e ) ;
63
- } )
61
+ document . querySelectorAll ( '.magic-text' ) . forEach ( ( e ) => {
62
+ magicTextGen ( e ) ;
63
+ } )
64
64
}
65
65
renderMagicText ( ) ;
66
66
67
67
// Magic Text </>
68
68
69
69
// <> Mobile anchor correction due to doubled size header)
70
70
function offsetAnchor ( event , element ) {
71
- if ( window . innerWidth <= 768 ) {
71
+ if ( window . innerWidth <= 768 ) {
72
72
event . preventDefault ( ) ;
73
73
content = document . querySelectorAll ( "#content" ) [ 0 ] ;
74
74
actualElement = document . getElementById ( element . getAttribute ( "href" ) . replace ( "#" , "" ) ) ;
@@ -82,3 +82,43 @@ document.querySelectorAll("#nav-contents a").forEach((e) => {
82
82
} ) ;
83
83
} )
84
84
// Mobile anchor correction </>
85
+
86
+ // <> Anchor click copy link
87
+ function copyToClipboard ( ) {
88
+ setTimeout ( ( ) => {
89
+ var cb = document . body . appendChild ( document . createElement ( "input" ) ) ;
90
+ cb . value = window . location . href ;
91
+ cb . focus ( ) ;
92
+ cb . select ( ) ;
93
+ document . execCommand ( 'copy' ) ;
94
+ cb . parentNode . removeChild ( cb ) ;
95
+ } , 50 )
96
+ }
97
+ function showNotification ( text , bgColor , color ) {
98
+ var noti = document . body . appendChild ( document . createElement ( "span" ) ) ;
99
+ noti . id = "notification-box" ;
100
+
101
+ setTimeout ( ( ) => {
102
+ noti . textContent = text ;
103
+ if ( bgColor )
104
+ noti . styles . backgroundColor = bgColor ;
105
+ if ( color )
106
+ noti . styles . backgroundColor = color ;
107
+ noti . classList . add ( "activate-notification" ) ;
108
+ setTimeout ( ( ) => {
109
+ noti . classList . remove ( "activate-notification" ) ;
110
+ setTimeout ( ( ) => {
111
+ noti . parentNode . removeChild ( noti ) ;
112
+ } , 200 ) ;
113
+ } , 1500 ) ;
114
+ } , 50 ) ;
115
+ }
116
+
117
+ const currentPageLink = window . location . toString ( ) . replaceAll ( / ( .+ ?.h t m l ) ( .* ) / gi, '$1' ) ;
118
+ document . querySelectorAll ( ".item-title > a" ) . forEach ( ( e ) => {
119
+ e . addEventListener ( "click" , ( event ) => {
120
+ copyToClipboard ( ) ;
121
+ showNotification ( "✅ Link copied successfully." )
122
+ } ) ;
123
+ } )
124
+ // Anchor click copy link </>
0 commit comments