Modifying OcUK

Soldato
Joined
26 Dec 2003
Posts
16,522
Location
London
Just before Christmas, I posted some CSS that Firefox users could insert into their userContent.css file in order to change the forums' colour scheme to something they preferred.

Here's some example CSS that I use to turn the forums a dark grey colour:

Code:
@-moz-document domain(forums.overclockers.co.uk) {
	/* 
	** OcUK colour scheme changer 
	** By Rob Miller
	*/
	* { color:#fff !important; }
	textarea, input, body, .page, .thead, .tfoot, .alt2, .alt2Active, .panel { background:#222 !important; }
	.alt1, .alt1Active, .panelsurround, .vbmenu_option { background:#333 !important; }
	.vbmenu_control, .vbmenu_hilite, .tcat { background-color: #444 !important; }
	.vbmenu_popup { border: 1px solid #ccc !important; }
}

You'll see I colour all the text white, give most things - including form inputs - a dark background of #222, give a few select elements a lighter background of #333, and give some headings an even lighter background of #444.

(To make these changes yourself, browse to your profile folder and open the userContent.css file in the chrome folder. Edit it, and paste the above code anywhere.)

Now the problem lies in the fact that the forums' images, particularly the buttons, are an ugly blue colour which hardly fits well with our brand spanking new colour scheme. So, if you'd like to replace the icons, simply install this extension that I wrote, et voila :)

Here's a quick screenshot of what my setup looks like:

ocuk-modified.png


If anyone else has any other customisations they've made to the forums, post them here!

Also, AFAIK these changes will work with absolutely any vBulletin forum, so simply add more domains to the include section of the Greasemonkey user script and to the CSS domain matcher to have them appear on other sites.
 
Last edited:
You just need to change the colours. It's even shorter if you want to make everything the same background color/text colour.

Anyway, here's your all-white background, all-black text:

Code:
@-moz-document domain(forums.overclockers.co.uk) {
	/* 
	** OcUK colour scheme changer 
	** By Rob Miller
	*/
	* { color:#000 !important; background:#fff !important; }
}
 
Weird, it doesn't seem to like local URLs. I presumed they'd work fine, since they're totally valid as src attributes of images.

You should have typed it as

Code:
var base = "file:///C:/buttons/";

or

Code:
var base = "file:///C:\\buttons\\";

...but even when typed properly it doesn't seem to want to work. How strange.
 
Another little modification, although it'll be of little use unless everyone uses it. This one simply makes the background colour of PHP code white, so that the syntax highlighting shows up:

ocuk-modified4.png


Make sure you've got Greasemonkey installed, then right click this link and choose "Install User Script".
 
arty said:
I don't think you need Greasemonkey to change the images - I managed to change the OcUK logo in the top left corner to the Google one purely in CSS before I formatted, using something like this:

Code:
img[src$="vBulletin_logo7.gif"] { background-image: url('http://www.google.co.uk/intl/en_uk/images/logo.gif'); width: 0px; height: 110px; overflow: hidden; padding-left: 276px; }

Obviously that's a bit of a fiddly way of doing it but for a fixed and smallish set of images (e.g. the buttons) it should be relatively straightforward to do. It's how I did it anyway :)

arty


Yep, that works, but I just thought it was a bit clunky since you have to manually specify each and every image. Neat little trick with the padding, though :)
 
Extension added to first post. I'm trying to hook the code that's currently in the Greasemonkey script into the extension, so that you just have to install the extension, but it doesn't seem to be working. I shall continue playing, but if someone call tell me why this isn't being executed:

[ocukImagesOverlay.xul]
Code:
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://browser/skin/" type="text/css"?>
<overlay id="ocukimagesOverlay"
      xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
      xmlns:nc="http://home.netscape.com/NC-rdf#"
      xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">

	<script type="application/x-javascript">
	<![CDATA[

	function ocukImages() {
		//if(window.location.href.indexOf('http://forums.overclockers.co.uk/') == -1)
		//	return;
		
		var buttons = content.document.evaluate( "//img[starts-with(@src, 'images/buttons')]", content.document, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null );
		
		var i = 0;
		
		while ( item = buttons.snapshotItem(i) ) {
			item.src = item.src.replace("http://forums.overclockers.co.uk/images/buttons/", "chrome://ocukimages/content/").replace(".gif", ".png");
			i++;
		}
	}
	
	function ocukImagesLoader() {
		window._content.addEventListener('load', ocukImages, true);
	}

	window.addEventListener('load', ocukImagesLoader, true);

	]]>
	</script>

</overlay>

[contents.rdf]
Code:
<?xml version="1.0"?>

<RDF:RDF xmlns:RDF="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:chrome="http://www.mozilla.org/rdf/chrome#">

	<RDF:Seq RDF:about="urn:mozilla:package:root">
		<RDF:li RDF:resource="urn:mozilla:extension:file:ocukimages"/>
	</RDF:Seq>
		
	<RDF:Seq RDF:about="urn:mozilla:overlays">
		<RDF:li RDF:resource="chrome://browser/content/browser.xul"/>
		<RDF:li RDF:resource="chrome://navigator/content/navigator.xul"/>
	</RDF:Seq>
	   
	<RDF:Seq RDF:about="chrome://browser/content/browser.xul">
		<RDF:li>chrome://ocukimages/content/ocukimagesOverlay.xul</RDF:li>
	</RDF:Seq>
	
	<RDF:Seq about="chrome://navigator/content/navigator.xul">
		<RDF:li>chrome://ocukimages/content/ocukimagesOverlay.xul</RDF:li>
	</RDF:Seq>	
	
	<RDF:Description RDF:about="urn:mozilla:extension:file:ocukimages"
		chrome:displayName="OcUK Images"
		chrome:author="Rob Miller"
		chrome:authorURL="http://robm.me.uk/"
		chrome:name="ocukimages"
		chrome:extension="true"
		chrome:description="Replaces the buttons on OcUK with prettier ones.">
	</RDF:Description>

</RDF:RDF>

Then I'd appreciate it. As far as I can tell, the files are in the right place (in the content directory in ocukimages.jar; the jar file is definitely being loaded, since the images work) :(
 
No idea, but I'm 99.9% of the way to getting it working without just compiling the GM script, and it'll let me do much more with it (and I've learned how to make extensions in the process) so it's cool :)
 
Nim said:
Biznatchio's going to have you shot ;)

I've only copied ideas and not code or even ways of doing things, to be fair :o The only thing I've used is his selectNodes() and selectSingleNode() functions which are copied from IE anyway :)

Very nice work, though. One thing I couldn't see in that script was how it determines what page of the thread is being viewed. Won't it highlight the page's first poster, rather than the thread's?


Yes, yes it will. I suck very muchly, thanks for pointing that out!

Edit: Almost got it working properly, but it requires an extra page-load (albeit a stealthy, AJAX one).
 
Last edited:
Back
Top Bottom