How can my script change a Specific Font (for a specific class)?
Several things:
First and foremost, for simple CSS changes use Stylus. It's faster and simpler.
In this case, the equivalent Stylus script would be:
@namespace url(http://www.w3.org/1999/xhtml); @-moz-document domain("apps.bloomboard.com") { .text { font-family: Helvetica, sans-serif !important; } }
or possibly:
@namespace url(http://www.w3.org/1999/xhtml); @-moz-document domain("apps.bloomboard.com") { * { font-family: Helvetica, sans-serif !important; } }
although setting a universal style with
*
should be done sparingly.Don't reinvent the wheel. Most userscript engines support GM_addStyle(). Use that. Your script would become:
// ==UserScript== // @name Change annoying fonts // @namespace http://use.i.E.your.homepage/ // @version 0.1 // @description change annoying FaracoHandRegular font to a more readable one // @match https://apps.bloomboard.com/* // @copyright 2012+, You // @grant GM_addStyle // ==/UserScript== GM_addStyle ( ` .text { font-family: Helvetica, sans-serif !important; } ` );
See and read also: