Search

Building Trusted Links Not Hard

2 min read
2 views

Comments


' /> Furl</a>
<br />
<br />
Bookmark Murdok: <a href=' /></a>                </div>
                
                <script>
                (function() {
                    function initCopyableSections() {
                        document.querySelectorAll('.article-content .copyable-section').forEach(function(section) {
                            if (section.querySelector('.copyable-section__btn')) return;
                            var btn = document.createElement('button');
                            btn.type = 'button';
                            btn.className = 'copyable-section__btn';
                            btn.setAttribute('aria-label', 'Copy to clipboard');
                            var label = section.getAttribute('data-copy-label');
                            btn.textContent = label ? 'Copy ' + label : 'Copy';
                            section.appendChild(btn);
                            btn.addEventListener('click', function() {
                                var contentEl = section.querySelector('.copyable-section__content');
                                var text;
                                if (contentEl) {
                                    text = contentEl.textContent.trim();
                                } else {
                                    var clone = section.cloneNode(true);
                                    var btnClone = clone.querySelector('.copyable-section__btn');
                                    if (btnClone) btnClone.parentNode.removeChild(btnClone);
                                    text = clone.textContent.trim();
                                }
                                if (!text) return;
                                navigator.clipboard.writeText(text).then(function() {
                                    var t = btn.textContent;
                                    btn.textContent = 'Copied!';
                                    btn.classList.add('copied');
                                    setTimeout(function() {
                                        btn.textContent = t;
                                        btn.classList.remove('copied');
                                    }, 2000);
                                });
                            });
                        });
                    }
                    if (document.readyState === 'loading') {
                        document.addEventListener('DOMContentLoaded', initCopyableSections);
                    } else {
                        initCopyableSections();
                    }
                })();
                </script>
                
                <!-- Tags -->
                                
                <!-- Correction Form -->
                <div class=

Suggest a Correction

Found an error or have a suggestion? Let us know and we'll review it.

Share this article

Comments (0)

Please sign in to leave a comment.

No comments yet. Be the first to comment!