Script Summary: Lets you clean up a page by putting instructions in url (css, xpath selecting, regexp and more)
Cleanup featuresxcrop: Selects nodes to keep, using xpath (this is what xStripper does)
xremove: Selects nodes to destroy, using xpath
css: Applies css to the document
eval: Run any script.
replace: Replace content using regexp
crop: Select content between two strings in the sourcecode (in the innerHTML)
The actions can be combined. They will be performed in the order that they appear in the url. Its possible to have the same type of action multiple times
- The actions are only triggered if the url contains "cleanitup". Reason: the script will likely run on *, so it should be able to quickly decide if it should spent time examining the parameters - and some sites might use the same parameter names, which would have unintentional effects.
- Some sites respond to extra params in a bad way (ie freedictionary: It tries to look up all words passed as params). To handle this, I expanded the syntax: the url is scanned for "cleanitup". The character that follows this string is choosen as the command separator. Usually the separator is "&", but I have given you the option to redefine this. This syntax could also come handi if need to use "&"'s in the command values. Example:
xcropSelects the specified nodes, and deletes the rest. The code is taken from xStripper. The only difference is that I don't wrap each node in a div.
Note: I can highly recommend the XPath Checker plugin for quickly testing xpath expressions on a page
- Selecting images and inputs:
xremoveRemoves all nodes that are specified by the xpath.
- Removing the 4'th button on google (I never feel lucky):
cssApplies css to the document
- Setting the background color of google:
I recommend Instant CSS for quickly testing new css
evalAllows you to run any script you want. Note: You have access to greasemonkey functions here!
replaceReplaces text, using regexp. It takes 3 arguments: Search-string, modifiers and replace-string. They are separated with this character: "|". If you skip the modifiers, they default to "gi".
- Giving a new meaning to an article:
- Removing the "From Wikipedia, the free encyclopedia" tagline from wikipedia articles:
cropCrops the document. The action takes two parameters: Text that identifies where the crop should begin, and text that identifies where it should end. The first is included, the second is not. It also takes two additional optional arguments, that allow you to adjust the positions. This "crop" feature is maybe a little dogdy. There is for example a problem: The text is taken from documen.body.innerHTML - but this is actually not the same as document source, and I think its browser dependent. Note: in most cases you can use xcrop instead, by using the "following-sibling" and/or "preceding-sibling" axis (example: here)
- Getting the content between the to horizontal rulers in Chambers:
CreditsBased on the xStripper script by alien_scum
version history24 JUN 2007 - v1.1 Fixed autoupdate
02 JUN 2007 - v1.0 Created