Last active
September 10, 2015 02:30
-
-
Save ScottKaye/d174dff3dd241f4c1a74 to your computer and use it in GitHub Desktop.
Disables control-f results, text selection, and all other interaction for any bit of text.
This file contains 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
(function ($) { | |
$.fn.shadow = function () { | |
this.each(function () { | |
var text = this.innerText; | |
this.createShadowRoot() | |
.innerHTML = "<style>:host::after{content:'" + text + "'}</style>"; | |
}); | |
return this; | |
}; | |
$.extend({ | |
shadow: function (selector) { | |
return $(selector).shadow(); | |
} | |
}); | |
})(jQuery); | |
//Usage | |
$.shadow(".shadow"); | |
//or | |
$(".shadow").shadow(); |
This file contains 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
(function () { | |
var shadows = document.getElementsByClassName("shadow"); | |
Array.prototype.forEach.call(shadows, function (el) { | |
var text = el.innerText; | |
el.createShadowRoot() | |
.innerHTML = "<style>:host::after{content:'" + el.innerText + "'}</style>"; | |
}); | |
})(); |
This file contains 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
<p> | |
This is some text that has a <span class="shadow">hidden</span> word that can't be found using control-F! | |
</p> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment