]> jfr.im git - irc/freenode/web-7.0.git/blame - static/js/utils.js
move standard to run only on travis as it shouldn't output to any file
[irc/freenode/web-7.0.git] / static / js / utils.js
CommitLineData
96af768f
SB
1/**
2 * Removes soft hyphens from copied text
3 * @param {Object} event
4 * @return {Undefined}
5 */
6document.addEventListener('copy', function (event) {
7 let oldText = window.getSelection().toString()
8 let newText = oldText.replace(/\u00AD/g, '')
9
10 event.clipboardData.setData('text/plain', newText)
11 event.clipboardData.setData('text/html', newText.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;'))
12 event.preventDefault()
13})