lately, people have complained that the new layout is too narrow on most Computer/Laptop screens. Firefox users can make use of the Greasemonkey Addon to apply on-the-fly changes.
(Opera users can use Opera's UserScripts, which should work similarly) - // ==UserScript==
-
// @name widen Bytes.com
-
// @namespace http://bytes.com/
-
// @description widen bytes.com's too narrow main table
-
// @include http://bytes.com/*
-
// ==/UserScript==
-
-
window.bytes_new_width = function()
-
{
-
// define new size
-
var new_size = 1000;
-
-
// get the main table and reset its width
-
var tbl = document.getElementsByTagName('table');
-
var l = tbl.length;
-
for (var i=0; i<l; i++)
-
{
-
// there is only one table with a width
-
// attribute of 635
-
if (tbl[i].getAttribute("width") == 635)
-
{
-
tbl[i].setAttribute("width", new_size);
-
}
-
}
-
-
// get the code blocks and widen them too
-
var code_box = new_size - 100 + "px";
-
var code = document.getElementsByClassName('codeContent');
-
var k = code.length;
-
for (var j=0; j<k; j++)
-
{
-
// set box size (enclosed in table)
-
code[j].style.width = code_box;
-
}
-
}
-
-
window.addEventListener("load", window.bytes_new_width, false);
7 8440
if you don't like the "Popular Articles" menu, add following code in the first for-loop: - // remove Articles menu
-
if (tbl[i].getAttribute("class") == "maintable")
-
{
-
var row1 = tbl[i].rows[0];
-
// gets all <td> (even from subtable)
-
var cells = row1.getElementsByTagName("td");
-
// remove last
-
row1.removeChild(cells[cells.length-1]);
-
}
Thanks, saves me having to do it myself.
You could probably avoid the for loop by accessing the table indexes directly.
probably, though there are too many tables in the markup.
@Dormilich update: no need to loop over the tables.... (and doing some clean up, too) - // remove Articles menu
-
var main = document.getElementsByClassName("maintable")[0];
-
if (main)
-
{
-
var row1 = main.rows[0];
-
// get last table cell
-
var cell3 = row1.cells[2];
-
// remove last
-
row1.removeChild(cell3);
-
}
-
The "maintable"-classed table is also the parent of the table with width 635, so either get the first table - table.getElementsByTagName("table")[0]
or via the first td (table cell) on the first row.
after taking care of the table width, I now got annoyed by the lengthy forum descriptions in the User Control Panel… - // ==UserScript==
-
// @name bytes_overview_table
-
// @namespace http://bytes.com/
-
// @include http://bytes.com/usercp.php
-
// @description remove a good deal of the Forum description in the User Control Panel
-
// ==/UserScript==
-
-
window.bytes.overview = function ()
-
{
-
// get the table cells where the description is
-
var trs = document.getElementById("collapseobj_usercp_forums").getElementsByClassName("alt1Active");
-
-
// got this loop termination idea from Markus
-
for (var i=0; trs[i]; i++)
-
{
-
// the element that actually holds the text
-
var div = trs[i].getElementsByClassName("smallfont")[0];
-
-
// skip if there is no text inside
-
if (div.firstChild.nodeType != 3)
-
continue;
-
-
// cut the text at the first hyphen
-
var text = div.textContent;
-
div.textContent = text.substring(0, text.indexOf("-"));
-
}
-
};
-
-
window.addEventListener("load", window.bytes.overview, false);
Atli 5,058
Expert 4TB
Hey.
Your first script. Seems KUB changed the layout or something. Your script looks for a width of "635", but the table currently has "625px".
Was scratching my head there for like 10 minutes trying to figure out why it wouldn't work :)
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Csaba2000 |
last post by:
How do I detect when the font size has been changed (especially by user action: either Ctrl+Scroll wheel or View/Text
Size)?
This is just for use on IE 5.5+, but it would be great if there was a...
|
by: SarahMarsden |
last post by:
I'm new to Dreamweaver (using MX 2004). I have a 2 row 3 column table.
I have set each column to 200 pixels. The second row I have merged
into one cell. When I enter text (or anything else) into...
|
by: James Dean |
last post by:
I create a bitmap like this.
The width and height are got from the compressed file i am reading. The
width and height are in pixels.....1bpp
bitmap = new...
|
by: Mark |
last post by:
IE creates an object of every ID'd HTML tag (so it appears), and each
object sets a property for any parameter I set in the tag. For example,
my HTML might be: <td id='cell1'...
|
by: Don NJ |
last post by:
First my site name is Sinfullblisslingerie.com. I'm starting this
little business to try and make some money on the side. My kids will
be going to college in a few years... Anyway, in the past...
|
by: Alexander Paul |
last post by:
Hi!
I'm a newbie to JavaScript and Greasemonkey and just started learning
with 'Dive Into Greasemonkey'. I looked for an example on the web, but
unfortunately I'm still missing something...
I...
|
by: synergy_711 |
last post by:
I feel like this should be fairly easy but I have been struggling with
this for sometime. I have not been able to find someone who's had the
same problem as mine yet.
...
|
by: rockdale |
last post by:
Hi, all
I am change my webpage to using div and css for my layout, it was
using table before and I want to get rid of it.
Basically it draws a box around my content using background pictures,...
|
by: DolphinDB |
last post by:
Tired of spending countless mintues downsampling your data? Look no further!
In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
by: af34tf |
last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome former...
| |