The Forums Are Now Closed!

The content will remain as a historical reference, thank you.

Need help with a Stylish/Greasemonkey script

By on March 23, 2012 11:05:46 PM from WinCustomize Forums WinCustomize Forums

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.

+220 Karma | 7 Replies
March 24, 2012 5:13:50 AM from WinCustomize Forums WinCustomize Forums

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;
}
March 24, 2012 3:10:15 PM from WinCustomize Forums WinCustomize Forums

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('http://www.wincustomize.com')
{
body, td, input, textarea, select, a, h, span, div {
font-size: 8pt !important;
font-family: Tahoma !important;
}
}

@-moz-document url-prefix('http://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('http://www.wincustomize.com')


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

@-moz-document url-prefix('http://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('http://www.wincustomize.com')


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

@-moz-document url-prefix('http://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('http://www.wincustomize.com')


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

@-moz-document url-prefix('http://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('http://www.wincustomize.com')


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

@-moz-document url-prefix('http://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('http://www.wincustomize.com')


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

@-moz-document url-prefix('http://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('http://www.wincustomize.com')


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

@-moz-document url-prefix('http://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('http://www.wincustomize.com')


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

@-moz-document url-prefix('http://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('http://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('http://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('http://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('http://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('http://www.wincustomize.com')

{
body, td, input, textarea, select, a, h, span, div {
font-size: 10pt !important;
font-family: Tahoma !important;
}
}
March 27, 2012 12:54:44 AM from WinCustomize Forums WinCustomize Forums

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.

March 27, 2012 4:04:39 AM from Elemental Forums Elemental Forums

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.

March 27, 2012 7:51:37 AM from WinCustomize Forums WinCustomize Forums

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

 

March 27, 2012 5:12:11 PM from WinCustomize Forums WinCustomize Forums

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');

}

 

March 27, 2012 9:04:24 PM from WinCustomize Forums WinCustomize Forums

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.

Stardock Forums v1.0.0.0    #108435  walnut2   Server Load Time: 00:00:00.0000656   Page Render Time:

Stardock Magazine | Register | Online Privacy Policy | Terms of Use

Copyright ?? 2012 Stardock Entertainment and Gas Powered Games. Demigod is a trademark of Gas Powered Games. All rights reserved. All other trademarks and copyrights are the properties of their respective owners. Windows, the Windows Vista Start button and Xbox 360 are trademarks of the Microsoft group of companies, and 'Games for Windows' and the Windows Vista Start button logo are used under license from Microsoft. ?? 2012 Advanced Micro Devices, Inc. All rights reserved. AMD, the AMD Arrow logo and combinations thereof are trademarks of Advanced Micro Devices, Inc.