Am 25.02.2013 08:41, schrieb Ben:
On Sunday, February 24, 2013 6:41:48 PM UTC+1, Zulkarnain K. wrote:
On Sun, Feb 24, 2013 at 9:19 PM, Ben <[email protected] <javascript:>>
wrote:
On Tuesday, February 19, 2013 10:26:50 PM UTC+1, LWChris wrote:
GM_addStyle("table tr td:nth-child(2) { width: 320px !important; }")
However on other pages in other scenarios this trick (with the 2nd
child) could not work.
I would appreciate to have something like a replace(fromstring,tostring)
or if(attribute=fromvalue,attribute=tovalue)
statements.
Using CSS (IMHO, better):
GM_addStyle("table td[width='320px'] { width: 500px !important; }")
or using DOM method:
var rows = document.querySelectorAll("table td[width='320px']");
if (rows.length) {
for (var i = 0; i < rows.length; i++) {
rows[i].setAttribute("width", "500px");
}
}
This is great! But do I need for the latter method an additional @require
tag entry at the top?
Or are all the cmds part of core javascript?
The first one is the tidier, faster and more fail safe method; it
requires "@grant GM_addStyle" at the top.
The latter one is Firefox only because of the querySelectorAll AFAIK.
Maybe this has changed in the meantime. Everything else is definitely
core JS.
Chris
--
You received this message because you are subscribed to the Google Groups
"greasemonkey-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/greasemonkey-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.