git ssb

0+

Rômulo Alves / website



Commit 1c2c606c027621ffaeb71794ef479770cc64ef9f

Implements text selection on ssb code click

romuloalves committed on 3/21/2020, 9:31:18 PM
Parent: ebdd10186a93b78fc7c286a7af3746e479f49e70

Files changed

index.htmlchanged
index.htmlView
@@ -58,9 +58,9 @@
5858 <h1>You can find me on...</h1>
5959 <ul>
6060 <li>
6161 <span>Secure Scuttlebutt</span>
62- <code>@xr/Q/zqaEwmmd4wg8xRU1TrMLQhc9qBqNCioCqmv1vQ=.ed25519</code>
62 + <code class="click-select">@xr/Q/zqaEwmmd4wg8xRU1TrMLQhc9qBqNCioCqmv1vQ=.ed25519</code>
6363 </li>
6464 <li>
6565 <span>Twitter</span>
6666 <code>
@@ -101,6 +101,26 @@
101101 </a>
102102 </li>
103103 </ul>
104104 </section>
105 + <script type="text/javascript">
106 + var itemsToSelect = document.querySelectorAll('.click-select');
107 +
108 + for (let index = 0; index < itemsToSelect.length; index++) {
109 + var element = itemsToSelect[index];
110 +
111 + element.addEventListener('click', function() {
112 + var selection = window.getSelection();
113 +
114 + if (selection.rangeCount > 0) {
115 + selection.removeAllRanges();
116 + }
117 +
118 + var range = document.createRange();
119 +
120 + range.selectNode(element);
121 + selection.addRange(range);
122 + });
123 + }
124 + </script>
105125 </body>
106126 </html>

Built with git-ssb-web