@@ -109,39 +109,27 @@ $(document).ready(function () {
109109 document . getElementById ( "new_blog_count" ) . innerHTML = new_blog_count ;
110110 }
111111
112- // code for click-to-copy functionality
113- var client = new ZeroClipboard ( ) ;
114- client . on ( "ready" , function ( e ) {
115- var copyButtons = document . getElementsByClassName ( "btn-copy" ) ;
116- for ( var i = 0 ; i < copyButtons . length ; i ++ ) {
117- client . clip ( copyButtons [ i ] ) ;
118- }
119- } ) ;
120-
121- // In the case that flash is disabled, fall back to browser API
122- client . on ( "error" , function ( e ) {
123- var copyButtons = document . getElementsByClassName ( "btn-copy" ) ;
124- for ( var i = 0 ; i < copyButtons . length ; i ++ ) {
125- copyButtons [ i ] . addEventListener ( "click" , function ( clickEvent ) {
126- var id = clickEvent . target . getAttribute ( "data-clipboard-target" ) ;
127-
128- var range = document . createRange ( ) ;
129- range . selectNode ( document . getElementById ( id ) ) ;
130-
131- var select = window . getSelection ( ) ;
132- select . removeAllRanges ( ) ;
133- select . addRange ( range ) ;
134-
135- try {
136- document . execCommand ( "copy" ) ;
137- } catch ( e ) {
138- // Silently fail for now
139- }
112+ var copyButtons = document . getElementsByClassName ( "btn-copy" ) ;
113+ for ( var i = 0 ; i < copyButtons . length ; i ++ ) {
114+ copyButtons [ i ] . addEventListener ( "click" , function ( clickEvent ) {
115+ var id = clickEvent . target . getAttribute ( "data-clipboard-target" ) ;
116+
117+ var range = document . createRange ( ) ;
118+ range . selectNode ( document . getElementById ( id ) ) ;
119+
120+ var select = window . getSelection ( ) ;
121+ select . removeAllRanges ( ) ;
122+ select . addRange ( range ) ;
123+
124+ try {
125+ document . execCommand ( "copy" ) ;
126+ } catch ( e ) {
127+ // Silently fail for now
128+ }
140129
141- select . removeAllRanges ( ) ;
142- } ) ;
143- }
144- } ) ;
130+ select . removeAllRanges ( ) ;
131+ } ) ;
132+ }
145133
146134 // Smooth scroll to anchor links
147135 $ ( "a[href^='#']" ) . on ( 'click' , function ( e ) {
0 commit comments