@@ -112,6 +112,16 @@ var initialY = null;
112112 this . vacantPruningYear . innerText = tree . pruning_year ;
113113 this . vacantReplacementSpecies . innerHTML = `<em>${ tree . replacement_species } </em>` ;
114114 this . vacantStreetSegment . innerText = tree . segment ;
115+
116+ //report link for vacant sites
117+ const report_url = "https://user.govoutreach.com/santamonica/support.php?classificationId=30642&cmd=shell"
118+ const report_link_vacant = document . getElementById ( 'report-link-vacant' )
119+ report_link_vacant . onclick = ( ) => {
120+
121+ to_clipboard ( `${ tree . address } , Vacant site, Tree ID ${ tree . tree_id } ` )
122+ //open city website
123+ window . open ( report_url )
124+ }
115125 }
116126
117127 Sidebar . prototype . populateTreePanel = function ( tree ) {
@@ -158,29 +168,14 @@ var initialY = null;
158168 this . heritageContainer . classList . remove ( 'active' ) ;
159169 }
160170
161- //report link
162- const report_link = document . getElementById ( 'report-link-tree' )
163-
164- report_link . onclick = ( ) => {
165- //create dummy input element for clipboard operations
166- const dummy = document . createElement ( 'input' )
167- dummy . setAttribute ( 'readonly' , 'readonly' )
168- //set content to be copied
169- dummy . setAttribute ( 'value' , `${ tree . address } Tree ID ${ tree . tree_id } ` )
170- document . body . appendChild ( dummy )
171- //select & copy
172- dummy . focus ( )
173- dummy . setSelectionRange ( 0 , dummy . value . length )
174- try {
175- document . execCommand ( 'copy' )
176- } catch ( error ) {
177- console . log ( error )
178- }
179- //remove dummy element
180- document . body . removeChild ( dummy )
181171
172+ //report link for trees
173+ const report_url = "https://user.govoutreach.com/santamonica/support.php?classificationId=30642&cmd=shell"
174+ const report_link_tree = document . getElementById ( 'report-link-tree' )
175+ report_link_tree . onclick = ( ) => {
176+ to_clipboard ( `${ tree . address } Tree ID ${ tree . tree_id } ` )
182177 //open city website
183- report_url = "https://user.govoutreach.com/santamonica/support.php?classificationId=30642&cmd=shell"
178+
184179 window . open ( report_url )
185180 }
186181 }
@@ -339,7 +334,7 @@ var initialY = null;
339334 window . history . pushState ( 'object' , document . title , newURL ) ;
340335 }
341336
342- const fillLastUpdate = ( ) => {
337+ const fillLastUpdate = ( ) => {
343338 //only preform fetch & update when this.lastUpdate is uninitialized
344339 if ( this . lastUpdate ) { return }
345340
@@ -381,6 +376,27 @@ var initialY = null;
381376
382377
383378 }
379+
380+ //helper function for clipboard copy
381+ const to_clipboard = ( str ) => {
382+ //create dummy input element for clipboard operations
383+ const dummy = document . createElement ( 'input' )
384+ dummy . setAttribute ( 'readonly' , 'readonly' )
385+ //set content to be copied
386+ dummy . setAttribute ( 'value' , str )
387+ document . body . appendChild ( dummy )
388+ //select & copy
389+ dummy . focus ( )
390+ dummy . setSelectionRange ( 0 , dummy . value . length )
391+ try {
392+ document . execCommand ( 'copy' )
393+ } catch ( error ) {
394+ console . log ( error )
395+ }
396+ //remove dummy element
397+ document . body . removeChild ( dummy )
398+ }
399+
384400 // Exports
385401 module . Sidebar = Sidebar ;
386402
0 commit comments