Commit 1c2c606c027621ffaeb71794ef479770cc64ef9f
Implements text selection on ssb code click
romuloalves committed on 3/21/2020, 9:31:18 PMParent: ebdd10186a93b78fc7c286a7af3746e479f49e70
Files changed
index.html | changed |
index.html | ||
---|---|---|
@@ -58,9 +58,9 @@ | ||
58 | 58 … | <h1>You can find me on...</h1> |
59 | 59 … | <ul> |
60 | 60 … | <li> |
61 | 61 … | <span>Secure Scuttlebutt</span> |
62 | - <code>@xr/Q/zqaEwmmd4wg8xRU1TrMLQhc9qBqNCioCqmv1vQ=.ed25519</code> | |
62 … | + <code class="click-select">@xr/Q/zqaEwmmd4wg8xRU1TrMLQhc9qBqNCioCqmv1vQ=.ed25519</code> | |
63 | 63 … | </li> |
64 | 64 … | <li> |
65 | 65 … | <span>Twitter</span> |
66 | 66 … | <code> |
@@ -101,6 +101,26 @@ | ||
101 | 101 … | </a> |
102 | 102 … | </li> |
103 | 103 … | </ul> |
104 | 104 … | </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> | |
105 | 125 … | </body> |
106 | 126 … | </html> |
Built with git-ssb-web