Skip to content Skip to sidebar Skip to footer

Use Greasemonkey To Change Row Format Based On One Cell's Contents?

I have a table full of cells that look like this: someAction The key is understanding jQuery selectors and then using jQuery's .css() function.

Assuming the page doesn't use AJAX, here's a complete script that works on the HTML you provided:

// ==UserScript==
// @name     _Format the "not checked" rows
// @include  http://YOUR_SERVER.COM/YOUR_PATH/*
// @require  http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js
// @grant    GM_addStyle
// ==/UserScript==
/*- The @grant directive is needed to work around a design change
    introduced in GM 1.0.   It restores the sandbox.
*/
//--- The 'Not Checked' is case-sensitive
var notChkdRows = $(
    "tr.dataRow:has(th.booleanColumn img[title='Not Checked'])"
);

//--- Use whatever CSS you wish
notChkdRows.css ( {
    "background":   "lime",
    "font-size":    "3ex"
} );

//--- But some styles do not effect rows, must use on cells
notChkdRows.children ("td,th").css ( {
    "border":       "5px solid pink"
} );


You can play with a live demo of the code at jsFiddle.


Post a Comment for "Use Greasemonkey To Change Row Format Based On One Cell's Contents?"