Hacking Userscript to increase the font size of text in postings in the new theme

notimp

Well-Known Member
OP
Member
Joined
Sep 18, 2007
Messages
5,786
Trophies
1
XP
4,372
Country
Laos
The following can be used in Greasemonkey, Tampermonkey, or Violentmonkey (tested with Tampermonkey) to increase the posting font size.

The new fontsize is just a little too small (at least in the new theme (might be kerning, whitespace or colors)), and the one one step larger in forum settings is a little too large for my liking.. :)

Code:
// ==UserScript==
// @name gbatemp increase font size
// @namespace http://userstyles.org
// @include https://*.gbatemp.net/threads*
// @include https://gbatemp.net/threads*
// @run-at document-start
// @version 0.1
// ==/UserScript==
(function() {var css = [
"@namespace url(http://www.w3.org/1999/xhtml);",
"body {font-size: 1.38em !important; line-height: 1.5em !important;}",
" .bbCodeBlock-content {font-size: 0.97em !important;}",
" .fr-element {font-size: 1em !important;}"
].join("\n");
if (typeof GM_addStyle != "undefined") {
GM_addStyle(css);
} else {
var node = document.createElement("style");
node.type = "text/css";
node.appendChild(document.createTextNode(css));
var heads = document.getElementsByTagName("head");
if (heads.length > 0) {
heads[0].appendChild(node);
} else {
// no head yet, stick it whereever
document.documentElement.appendChild(node);
}
}
})();

edit: Also increased the quote box font size.
edit2: Added modified line-height.
edit3: Added font size increase for the reply box as well.
 
Last edited by notimp,

notimp

Well-Known Member
OP
Member
Joined
Sep 18, 2007
Messages
5,786
Trophies
1
XP
4,372
Country
Laos
The site has built-in font scaling settings in your preferences.
Yes, and it is too small on the default, and too large on the next larger step in the scaling settings.

So what do you do? You script. Well, I script. :)

Script is meant to be used with the default font scaling option in the account preferences.

Creating ebooks for close to ten years now has taught me a thing or two about reading flow. And if I choose the font size, one step larger than default in the account settings, I get too few letters per line in the new design. Which makes reading large amounts of text a flipping pain.

Also the default font size is _very_ small on screens with decent ppi (Macbooks, f.e.).

That said, I have no comparison, if it has changed from the old design, I just noticed, that readability suffered quite a bit, and then started scripting so the forum actually became usable for me again.

(Had that script going for another site already, and only modified it for it to change font sizes on gbatemp.)
 
Last edited by notimp,

notimp

Well-Known Member
OP
Member
Joined
Sep 18, 2007
Messages
5,786
Trophies
1
XP
4,372
Country
Laos
Does that really need to be a script? Can't you just make a userstyle?
Probably would work as a userstyle as well. I dont have Stylish installed as an addon on my current browser - so this was the way I chose to go with. :)

The only elements it changes are:

Code:
body {font-size: 1.38em !important; line-height: 1.5em !important;}
.bbCodeBlock-content {font-size: 0.97em !important;}
.fr-element {font-size: 1em !important;}

on urls that start with
https://*.gbatemp.net/threads*
or
https://gbatemp.net/threads*

(* = wildcard for "anything")
 
  • Like
Reactions: Seriel

Seriel

Doing her best
Member
Joined
Aug 18, 2015
Messages
3,257
Trophies
3
Age
22
Location
UK
XP
4,338
Country
United Kingdom
Probably would work as a userstyle as well. I dont have Stylish installed as an addon on my current browser - so this was the way I chose to go with. :)

The only elements it changes are:

Code:
body {font-size: 1.38em !important; line-height: 1.5em !important;}
.bbCodeBlock-content {font-size: 0.97em !important;}
.fr-element {font-size: 1em !important;}

on urls that start with
https://*.gbatemp.net/threads*
or
https://gbatemp.net/threads*

(* = wildcard for "anything")
Understood, thank you for clarifying 🙂
 

notimp

Well-Known Member
OP
Member
Joined
Sep 18, 2007
Messages
5,786
Trophies
1
XP
4,372
Country
Laos
Does that really need to be a script? Can't you just make a userstyle?
Checked the modifications with the Stylus chrome extension, code would have to be a little different:

Code:
body{
   font-size: 1.38em !important; line-height: 1.5em !important;
}

.bbCodeBlock-content{
    font-size: 0.97em !important; line-height: 1.5em !important;
}

.fr-element{
    font-size: 1em !important;
}

and

active for urls that fit the following regular expression:
Code:
https?:\/\/(www\.){0,1}gbatemp\.net\/threads\/?.*


edit: fixed font-size for the quote block. 0.97em for some reason is the equivalent to 1em in the Tampermonkey script.
 
Last edited by notimp,
  • Like
Reactions: Seriel
General chit-chat
Help Users
  • No one is chatting at the moment.
    L @ Lopt: Thanks I don’t play animal crossing :(