Need help with a Stylish/Greasemonkey script

Hey guys, I was wondering if someone could help me with creating a Stylish script. Nothing extravagant, I just want a script to replace font A with font B universally on all websites. Does anyone know how to code that? Thanks.

:)

47,101 views 7 replies
Reply #1 Top

try this forTahoma or change the font name and size as you like

 

body, td, input, textarea, select, a, h, span, div {
font-size: 8pt !important;
font-family: Tahoma !important;
}

hope this helps ! ;)

body, td, input, textarea, select, a, h, span, div {
font-size: 8pt !important;
font-family: Tahoma !important;
}
body, td, input, textarea, select, a, h, span, div {
font-size: 8pt !important;
font-family: Tahoma !important;
}
body, td, input, textarea, select, a, h, span, div {
font-size: 8pt !important;
font-family: Tahoma !important;
}
Reply #2 Top

well the first Stylish style is a "Global" style and will replace all the A, C, D, E ... fonts  to B on all websites

but if you want to replace only that specific font A to B go on with the following "Site" style just adding the sites that use the font A:

 

@namespace url(http://www.w3.org/1999/xhtml);

@-moz-document url-prefix('https://www.wincustomize.com')
{
body, td, input, textarea, select, a, h, span, div {
font-size: 8pt !important;
font-family: Tahoma !important;
}
}

@-moz-document url-prefix('https://forums.wincustomize.com')
{
body, td, input, textarea, select, a, h, span, div {
font-size: 8pt !important;
font-family: Tahoma !important;
}
}

@namespace url(http://www.w3.org/1999/xhtml);

@-moz-document url-prefix('https://www.wincustomize.com')


{
body, td, input, textarea, select, a, h, span, div {
font-size: 8pt !important;
font-family: Tahoma !important;
}
}

@-moz-document url-prefix('https://forums.wincustomize.com')

{
body, td, input, textarea, select, a, h, span, div {
font-size: 8pt !important;
font-family: Tahoma !important;
}
}
@namespace url(http://www.w3.org/1999/xhtml);

@-moz-document url-prefix('https://www.wincustomize.com')


{
body, td, input, textarea, select, a, h, span, div {
font-size: 8pt !important;
font-family: Tahoma !important;
}
}

@-moz-document url-prefix('https://forums.wincustomize.com')

{
body, td, input, textarea, select, a, h, span, div {
font-size: 8pt !important;
font-family: Tahoma !important;
}
}
@namespace url(http://www.w3.org/1999/xhtml);

@-moz-document url-prefix('https://www.wincustomize.com')


{
body, td, input, textarea, select, a, h, span, div {
font-size: 8pt !important;
font-family: Tahoma !important;
}
}

@-moz-document url-prefix('https://forums.wincustomize.com')

{
body, td, input, textarea, select, a, h, span, div {
font-size: 8pt !important;
font-family: Tahoma !important;
}
}
@namespace url(http://www.w3.org/1999/xhtml);

@-moz-document url-prefix('https://www.wincustomize.com')


{
body, td, input, textarea, select, a, h, span, div {
font-size: 8pt !important;
font-family: Tahoma !important;
}
}

@-moz-document url-prefix('https://forums.wincustomize.com')

{
body, td, input, textarea, select, a, h, span, div {
font-size: 8pt !important;
font-family: Tahoma !important;
}
}
@namespace url(http://www.w3.org/1999/xhtml);

@-moz-document url-prefix('https://www.wincustomize.com')


{
body, td, input, textarea, select, a, h, span, div {
font-size: 8pt !important;
font-family: Tahoma !important;
}
}

@-moz-document url-prefix('https://forums.wincustomize.com')

{
body, td, input, textarea, select, a, h, span, div {
font-size: 8pt !important;
font-family: Tahoma !important;
}
}
@namespace url(http://www.w3.org/1999/xhtml);

@-moz-document url-prefix('https://www.wincustomize.com')


{
body, td, input, textarea, select, a, h, span, div {
font-size: 8pt !important;
font-family: Tahoma !important;
}
}

@-moz-document url-prefix('https://forums.wincustomize.com')

{
body, td, input, textarea, select, a, h, span, div {
font-size: 8pt !important;
font-family: Tahoma !important;
}
}


@namespace url(http://www.w3.org/1999/xhtml);

@-moz-document url-prefix('https://www.wincustomize.com')


{
body, td, input, textarea, select, a, h, span, div {
font-size: 8pt !important;
font-family: Tahoma !important;
}
}

@-moz-document url-prefix('https://forums.wincustomize.com')

{
body, td, input, textarea, select, a, h, span, div {
font-size: 8pt !important;
font-family: Tahoma !important;
}
}
@namespace url(http://www.w3.org/1999/xhtml);
@-moz-document url-prefix('https://www.wincustomize.com')

{
body, td, input, textarea, select, a, h, span, div {
font-size: 10pt !important;
font-family: Tahoma !important;
}
}
@namespace url(http://www.w3.org/1999/xhtml);
@-moz-document url-prefix('https://www.wincustomize.com')

{
body, td, input, textarea, select, a, h, span, div {
font-size: 10pt !important;
font-family: Tahoma !important;
}
}
@namespace url(http://www.w3.org/1999/xhtml);
@-moz-document url-prefix('https://www.wincustomize.com')

{
body, td, input, textarea, select, a, h, span, div {
font-size: 10pt !important;
font-family: Tahoma !important;
}
}
@namespace url(http://www.w3.org/1999/xhtml);
@-moz-document url-prefix('https://www.wincustomize.com')

{
body, td, input, textarea, select, a, h, span, div {
font-size: 10pt !important;
font-family: Tahoma !important;
}
}
@namespace url(http://www.w3.org/1999/xhtml);
@-moz-document url-prefix('https://www.wincustomize.com')

{
body, td, input, textarea, select, a, h, span, div {
font-size: 10pt !important;
font-family: Tahoma !important;
}
}
Reply #3 Top

Hmm, it looks like that will just replace ALL fonts. I'm specifically looking to replace only one font with another one.

 

Example: internet is using Comic Sans and Verdana. I want to replace Comic Sans with Segoe and leave Verdana as it is.

 

Maybe Stylish isn't capable of this, perhaps Greasemonkey? I don't care which, whatever works.

Reply #4 Top

The best fit solution would be a product that replaces all other people's fonts with the ones you desire. Stardock, get on this and make millions.

Reply #5 Top

I don't use greasemonkey  but as

The HTML Body ( <body> ) element represents the main content of an HTML document. There is only one <body> element in a document.

The input ( <input> ) element is used to create interactive controls ... and so on

try to identify the element or elements that use Comic Sans and keep only them on the script so the other elements will not be replaced, for example

 

body, td, input, textarea, select, a, h, span, div {

{
font-family: Segoe !important;
}

and I use  Stylish (mainly the "App" styles)  to customize the Firefox appearence for example

 

Reply #6 Top

ok I started to use greasemonkey as I was curious to find a solution and here I am

first I found this script " http://userscripts.org/scripts/review/29876

then I modded the script for your needs 

 

// ==UserScript==
// @name          Comic Sans to Segoe font
// @namespace     for bb
// @include     *
// ==/UserScript==

var elementList = document.getElementsByTagName('*');
    for (var i = elementList.length - 1; i >= 0; i--) {
        var elementItem = elementList[i];
        var style = getComputedStyle(elementItem, '');
                elementItem.style.fontFamily = style.fontFamily.replace(/Comic Sans MS/i, 'segoe');

}

  |-)

Reply #7 Top

Ah now there we go.....if only I could get it to work, hmmm.

Nvm, got it! Didn't have the font name properly. I wonder if it changed the font here too, all of a sudden the text box font is tiny, even though I only have it set to replace awful comic sans, weird.