Nana Dada
Regular Member
- Jul 5, 2018
- 281
- 92
Hi guys,
I have been reading BHW for quite a while (lurking for more than a year now) and all that time I felt that it is somewhat hard to read, especially on large and wide desktop monitors. And I know there are some people just like me out there who find it hard too. And that's really a shame, because the amount of valuable content and knowledge on this forum is just incredible, it's like a money making machine if used correctly.
Recently I finally found some spare time and wrote a little userscript to fix it that I'd like to share with you. It's not ideal (far from ideal, actually), but it makes it much easier to read.
It does 3 things:
1) Limits the page width
2) Centers the content
3) Sets custom background color (shades of grey)
Here are before/after screenshots:
Here is the code:
To make it work do the following:
1) Install any userscript extension supported by your browser (Greasemonkey, Tampermonkey, etc.)
2) Log into the forum
3) Set your forum theme to BlackHatWorld-2015-WhiteVersion (go to Preferences -> Style)
4) Copy the code and enable the script in the settings of your extension
Hope it will be easier for your eyes now, just like it is for mine
Cheers
I have been reading BHW for quite a while (lurking for more than a year now) and all that time I felt that it is somewhat hard to read, especially on large and wide desktop monitors. And I know there are some people just like me out there who find it hard too. And that's really a shame, because the amount of valuable content and knowledge on this forum is just incredible, it's like a money making machine if used correctly.
Recently I finally found some spare time and wrote a little userscript to fix it that I'd like to share with you. It's not ideal (far from ideal, actually), but it makes it much easier to read.
It does 3 things:
1) Limits the page width
2) Centers the content
3) Sets custom background color (shades of grey)
Here are before/after screenshots:
Here is the code:
Code:
// ==UserScript==
// @name Blackhatworld - Narrow page and change background color
// @namespace blackhatworld.com
// @include https://www.blackhatworld.com/*
// @include https://blackhatworld.com/*
// @include http://www.blackhatworld.com/*
// @include http://blackhatworld.com/*
// @include www.blackhatworld.com/*
// @include blackhatworld.com/*
// @version 1
// ==/UserScript==
// a function that loads jQuery and calls a callback function when jQuery has finished loading
function addJQuery(callback) {
var script = document.createElement("script");
script.setAttribute("src", "https://code.jquery.com/jquery-3.4.1.min.js");
script.addEventListener('load', function() {
var script = document.createElement("script");
script.textContent = "window.jQ=jQuery.noConflict(true);(" + callback.toString() + ")();";
document.body.appendChild(script);
}, false);
document.body.appendChild(script);
}
// the guts of this userscript
function main() {
var mainElementsTargetColor = '#bbb'; // Any regular HTML code color
var quotationsTargetColor = '#e3e3e3'; // Any regular HTML code color
var targetWidth = '60%';
// Note, jQ replaces $ to avoid conflicts, for example:
// alert("There are " + jQ('a').length + " links on this page.");
jQ('body').width(targetWidth);
jQ('body').css('margin', '0 auto 0 auto');
var mainElements = jQ('*').filter(function() {
return (jQ(this).css('backgroundColor') == 'rgb(236, 236, 236)');
})
var quotations = jQ('*').filter(function() {
return (jQ(this).css('backgroundColor') == 'rgb(255, 255, 255)');
})
jQ(mainElements).css('background-color', mainElementsTargetColor);
jQ(quotations).css('background-color', quotationsTargetColor);
}
// load jQuery and execute the main function
addJQuery(main);
To make it work do the following:
1) Install any userscript extension supported by your browser (Greasemonkey, Tampermonkey, etc.)
2) Log into the forum
3) Set your forum theme to BlackHatWorld-2015-WhiteVersion (go to Preferences -> Style)
4) Copy the code and enable the script in the settings of your extension
Hope it will be easier for your eyes now, just like it is for mine
Cheers
Last edited by a moderator: