Greasemonkey script to fix forum header in Google Chrome

Everythig else to do with our broadcast & website. Post comments, suggestions, questions and feedback! New members, you can say hello here :D
Post Reply
madjester
Seeking connection...
Seeking connection...
Posts: 30
Joined: Tue Mar 02, 2010 7:36 am

Greasemonkey script to fix forum header in Google Chrome

Post by madjester » Mon Jul 11, 2011 5:38 am

Here is a small snippet of code for fixing the table layout of the header in Google Chrome. You need to copy/paste this into a file called triplag-fix.user.js and open it in Google Chrome for it to work. The code itself is full of comments in case someone wants to know what it is doing, which isn't much.

Code: Select all


// ==UserScript==
// @name  Triplag 4Room Chrome Fix
// @description Fixes the header in the layout of Triplag for Chrome
// @include  http://triplag.com/4room/*
// ==/UserScript=

// This script assumes the layout remains unchanged. Since the HTML
// does not use either ID's or classes for CSS we cannot use that
// to query for the nodes.

// Get a list of all the TABLE tags since we need to fix the table
// used to create the forum header
var triplagTables = document.getElementsByTagName('TABLE');

// Check that we have enough tables so worst case scenario we just make it look
// really bad.
if ( triplagTables.length >= 3 ) {

        // Change the table layout to fixed so the widths *ALWAYS* stay put
        // if they were set explicitly
        triplagTables[0].style.tableLayout = 'fixed';

        // Find the Rows in the Third Table, pressumably where the
        // FAQ, Search, Memberlist, Usergroups, Register and Private Messages
        // buttons are.
        var tr = triplagTables[2].getElementsByTagName('TR');
        if ( tr.length >= 1 ) {
                // Create a TD element at the end and stretch it so the
                // bar lines up nice and properly.
                var td = document.createElement('TD');
                td.setAttribute('width', '100%');

                tr[0].appendChild(td);
        }
}
[/code]

User avatar
vic
Your Trip Guide
Your Trip Guide
Posts: 1964
Joined: Thu Jul 28, 2005 1:10 pm
Location: Triplag
Contact:

Post by vic » Mon Jul 11, 2011 5:40 pm

hey madjester!

thanks for the script! I did not know we had a problem.

I use Chrome and forum looks OK in it.

I PM you my email if you could send me screnshot of how it was before the fix?

thanks!

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests