Last active
April 25, 2022 19:36
-
-
Save joshparkerj/c57b5d96eb5ea00886ec132424a0dc4e to your computer and use it in GitHub Desktop.
highlight the text you select
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // ==UserScript== | |
| // @name Highlightify | |
| // @namespace http://tampermonkey.net/ | |
| // @version 0.1 | |
| // @description highlight the text you select | |
| // @author Josh Parker | |
| // @source https://github.com/joshparkerj/silly-internet-tricks/blob/main/text-effect/highlightify.user.js | |
| // @downloadURL https://gist.github.com/joshparkerj/c57b5d96eb5ea00886ec132424a0dc4e/raw/highlightify.user.js | |
| // @updateURL https://gist.github.com/joshparkerj/c57b5d96eb5ea00886ec132424a0dc4e/raw/highlightify.meta.js | |
| // @match https://www.bls.gov/oes/* | |
| // ==/UserScript== |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // ==UserScript== | |
| // @name Highlightify | |
| // @namespace http://tampermonkey.net/ | |
| // @version 0.1 | |
| // @description highlight the text you select | |
| // @author Josh Parker | |
| // @source https://github.com/joshparkerj/silly-internet-tricks/blob/main/text-effect/highlightify.user.js | |
| // @downloadURL https://gist.github.com/joshparkerj/c57b5d96eb5ea00886ec132424a0dc4e/raw/highlightify.user.js | |
| // @updateURL https://gist.github.com/joshparkerj/c57b5d96eb5ea00886ec132424a0dc4e/raw/highlightify.meta.js | |
| // @match https://www.bls.gov/oes/* | |
| // ==/UserScript== | |
| (()=>{"use strict";!function(e,t,n){const o=document.querySelector("body > div.josh-text-manips"),s=o||document.createElement("div");s.className="josh-text-manips",s.appendChild(function(e,t,n){const o=document.querySelector("body"),s=document.createElement("button");s.innerText=e;const d=function e({target:d}){const i=d;o.removeEventListener("mousedown",e);const c=i.textContent.split("").map((e=>{const t=document.createElement("span");return t.textContent=e,t}));i.textContent="",c.forEach((e=>i.appendChild(e)));const r=({target:e})=>{"SPAN"===e.tagName&&e.classList.add("selected")};i.addEventListener("mouseover",r);const a=()=>{i.removeEventListener("mouseup",a),i.removeEventListener("mouseover",r);const e=i.textContent,o=[...i.childNodes].map((e=>e.className)),d=o.indexOf("selected"),c=o.lastIndexOf("selected")+1;i.innerHTML="",i.appendChild(new Text(e.slice(0,d)));const l=document.createElement("span");l.className=t,l.appendChild(new Text(e.slice(d,c))),i.appendChild(l),i.appendChild(new Text(e.slice(c))),n(i.querySelector(`span.${t}`)),s.removeAttribute("disabled")};i.addEventListener("mouseup",a)};return s.addEventListener("click",(()=>{s.setAttribute("disabled",!0),o.addEventListener("mousedown",d)})),s}(e,t,n)),o||document.querySelector("body").appendChild(s),document.styleSheets[0].insertRule(".josh-text-manips {position: fixed;background-color: lightgrey;padding: 5px 10px;top: 62px;right: 10px;border-radius: 16px;box-shadow: 2px 2px 1px black;}")}("highlightify","highlighted-text",(()=>{document.styleSheets[0].insertRule(".highlighted-text { background-color: yellow; }")}))})(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // ==UserScript== | |
| // @name Highlightify | |
| // @namespace http://tampermonkey.net/ | |
| // @version 0.1 | |
| // @description highlight the text you select | |
| // @author Josh Parker | |
| // @source https://github.com/joshparkerj/silly-internet-tricks/blob/main/text-effect/highlightify.user.js | |
| // @downloadURL https://gist.github.com/joshparkerj/c57b5d96eb5ea00886ec132424a0dc4e/raw/highlightify.user.js | |
| // @updateURL https://gist.github.com/joshparkerj/c57b5d96eb5ea00886ec132424a0dc4e/raw/highlightify.meta.js | |
| // @match https://www.bls.gov/oes/* | |
| // ==/UserScript== |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // ==UserScript== | |
| // @name Highlightify | |
| // @namespace http://tampermonkey.net/ | |
| // @version 0.1 | |
| // @description highlight the text you select | |
| // @author Josh Parker | |
| // @source https://github.com/joshparkerj/silly-internet-tricks/blob/main/text-effect/highlightify.user.js | |
| // @downloadURL https://gist.github.com/joshparkerj/c57b5d96eb5ea00886ec132424a0dc4e/raw/highlightify.user.js | |
| // @updateURL https://gist.github.com/joshparkerj/c57b5d96eb5ea00886ec132424a0dc4e/raw/highlightify.meta.js | |
| // @match https://www.bls.gov/oes/* | |
| // ==/UserScript== | |
| (()=>{"use strict";!function(e,t,n){const o=document.querySelector("body > div.josh-text-manips"),s=o||document.createElement("div");s.className="josh-text-manips",s.appendChild(function(e,t,n){const o=document.querySelector("body"),s=document.createElement("button");s.innerText=e;const d=function e({target:d}){const i=d;o.removeEventListener("mousedown",e);const c=i.textContent.split("").map((e=>{const t=document.createElement("span");return t.textContent=e,t}));i.textContent="",c.forEach((e=>i.appendChild(e)));const r=({target:e})=>{"SPAN"===e.tagName&&e.classList.add("selected")};i.addEventListener("mouseover",r);const a=()=>{i.removeEventListener("mouseup",a),i.removeEventListener("mouseover",r);const e=i.textContent,o=[...i.childNodes].map((e=>e.className)),d=o.indexOf("selected"),c=o.lastIndexOf("selected")+1;i.innerHTML="",i.appendChild(new Text(e.slice(0,d)));const l=document.createElement("span");l.className=t,l.appendChild(new Text(e.slice(d,c))),i.appendChild(l),i.appendChild(new Text(e.slice(c))),n(i.querySelector(`span.${t}`)),s.removeAttribute("disabled")};i.addEventListener("mouseup",a)};return s.addEventListener("click",(()=>{s.setAttribute("disabled",!0),o.addEventListener("mousedown",d)})),s}(e,t,n)),o||document.querySelector("body").appendChild(s),document.styleSheets[0].insertRule(".josh-text-manips {position: fixed;background-color: lightgrey;padding: 5px 10px;top: 62px;right: 10px;border-radius: 16px;box-shadow: 2px 2px 1px black;}")}("highlightify","highlighted-text",(()=>{document.styleSheets[0].insertRule(".highlighted-text { background-color: yellow; }")}))})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment