/** * Functons for clipboard share icon */ ( function() { document.addEventListener('DOMContentLoaded', function() { var button_toggle_share = document.getElementById( "toggle-share-dialog" ); var chevron = document.getElementsByClassName("share-dialog-chevron")[0]; var dialog = document.getElementsByClassName("share-dialog-content")[0]; var button_copy_title = document.getElementById( "copy-title" ); var title_text = document.getElementById( "article-title"); var button_copy_link = document.getElementById( "copy-link" ); var link_text = document.getElementById( "article-link" ); if ( 'undefined' !== typeof button_toggle_share && 'undefined' !== typeof dialog) { button_toggle_share.onclick = function() { if (dialog.style.display !== "block") { dialog.style.display = "block"; chevron.style.display = "block"; } else { dialog.style.display = "none"; chevron.style.display = "none"; } }; } if ( 'undefined' !== typeof button_copy_title && 'undefined' !== typeof title_text) { button_copy_title.onclick = function() { button_copy_title.blur(); if (!navigator.clipboard) { return; } try { navigator.clipboard.writeText(title_text.value); } catch (error) { console.error("Title copy failed", error); } }; } if ( 'undefined' !== typeof button_copy_link && 'undefined' !== typeof link_text) { button_copy_link.onclick = function() { button_copy_link.blur(); if (!navigator.clipboard) { return; } try { navigator.clipboard.writeText(link_text.value); } catch (error) { console.error("Shortlink copy failed", error); } }; } } ) } )();; function safe_report_comments_flag_comment( comment_id, nonce, result_id ) { jQuery.post( SafeCommentsAjax.ajaxurl, { comment_id : comment_id, sc_nonce : nonce, result_id : result_id, action : 'safe_report_comments_flag_comment', xhrFields: { withCredentials: true } }, function(data) { jQuery( '#'+result_id).html(data); } ); return false; } jQuery( document ).ready( function() { jQuery( '.hide-if-js' ).hide(); jQuery( '.hide-if-no-js' ).show(); }); ;