Created
February 28, 2020 19:42
-
-
Save tobybot/59d76fb461800a9d8b61c53b1a16bfcb to your computer and use it in GitHub Desktop.
Automatically superscript special marks
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
// superscript all reg, copy, and dagger symbols and add "regmark" class | |
jQuery(document).ready(function ($) { | |
// Find symbols & replace if they aren't inside a sup tag or a .nosup classed element | |
$('body :not(script,sup,.nosup)').contents().filter(function () { | |
return this.nodeType === 3; | |
}).replaceWith(function () { | |
return this.nodeValue.replace(/([®©†™])/gi, '<sup class="regmark">$&</sup>'); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment