Extra caution is recommended when installing recently uploaded/updated scripts (read more)
Be sure you trust any scripts you install

LookItUp betatest

This is a beta of the new v1.4 LookItUp script. Try it out!

LookItUp 1.3 can be found here

Changes between 1.3 and this betatest:
- Multiple search results can be displayed at once
- Added cleanup features
- Changed default site url's, so they use the new cleanup features
- Added "merge default sites into sites" feature
- Changed encoding

Notes:
  • You have to disable the LookItUp script, while running this beta test

  • I have made clean-up urls for 9 sites. They appear as the default sites when you run the script. You will not see the sites that you created for the LookItUp script, - its because its another script. Don't worry. They are not lost

  • Its still possible to use separate cleanup scripts, but beware that you dont have an old cleanup script running while using these new urls. It will fail misserably

Multiple search results can be displayed at once

- If you assign the same key to several sites, they will all be opened.
- Number keys open the first n sites in a grid

Grouping sites, by assigning the same key:
Be aware that the sites will overlap, if they use the same style. You will have to make new style definitions.

Number keys open the first n sites in a grid:
Try pressing '3' while text is selected. The first 3 search engines will open. Now, try pressing '4'. Another search engine will open, leaving the first 3. Now, press '5'. I find that moving up the numbers this way, starting from '1' is a quite effective: You can read the previous, while the new one is loading. The ordering is ofcourse important. It should match your preferences. You can order the sites by clicking the new "move up" buttons in settings.

Cleanup features

The major change from between 1.3 and 1.4 is that its no longer neccessary to build separate cleanup scripts. Cleanup instructions can be appended to the urls. Thanks to alien_scum for this idea, and his "xStripper" script. Several ways to clean up are implemented:

xcrop: 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

Notes:
  • 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 "lookitup". 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: http://www.thefreedictionary.com/dict.asp?Word=...') (note: this feature was not in the original version of this beta)

  • The actions are only triggered if the url contains "lookitup". Reason: the script runs 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.

  • I would appreciate tips on new urls. Also without cleanup.

xcrop

Deletes all content, except those nodes that are specified by the xpath. The code is taken from xStripper. The only difference is that I don't wrap each node in a div.
Example: Selecting images and inputs: http://www.google.com/webhp?lookitup&xcrop=//im...
LookItUp Example: Selecting all unordered lists in google define: http://www.google.com/search?lookitup&q=define:...

xremove

Removes all nodes that are specified by the xpath.
Example: Removing the 4'th button on google (I don't feel lucky) http://www.google.com/webhp?lookitup&xremove=//...]
LookItUp Example: Removing the footer in wictionary: http://en.wiktionary.org/w/index.php?lookitup&t...

css

Applies css to the document

Examples:
Setting the background color and input height of google. css=body{background-color:yellow}input{height:200px;margin:10px}
LookItUp Examples:
Hiding the footer in wikipedia

eval

Allows you to run any script you want.
Example: Saying hi: eval=alert('hi')
LookItUp example: Adding "Next" button to google define - such that the new page is also clean: url

replace

Replaces 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".
Examples:
Giving a new meaning to an article: replace=superman|Bill Gates&replace=DC Comics|Microsoft
Removing the "From Wikipedia, the free encyclopedia" tagline from wikipedia articles: replace=From.*pedia|

crop

Crops 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. This 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.
LookItUp Example: Getting the content between the to horizontal rulers in Chambers:
url

Other changes:

Encoding changed:
The whole url was encoded with encodeURI. Now I only encode the selected words, and its encoded using "escape" instead. encodeURI was encoding danish letters wrong. Ie: 'å' is %E5, but encodeURI encodes it as %C3%A5. I only encode the words now, because I experienced a case where the encoding had a negative effect. If you want the url encoded, simply enter the encoded url. If not, then don't. Now the choice is yours. There are online url-encoders available here and here

Added "merge default sites into sites" feature:
The default sites are examined. If you already have a site with the same name as the default site, then the url is changed to that of the default site. If you don't, then the default site will be added to your sites. The changes does not take effect until you press "save". Note: Make sure that the styles of the sites that are added exists (Note to self: Maybe nonexistant styles should be added automatically?)

Features under consideration

Feedback on these ideas will be appreciated
- Automatic update of default site urls.
- Possibility to load site definitions. (Ie danish sites)
- A way to open grouped sites one by one (for example by clicking the assigned key multiple times)
- Assign several shortcuts to one site (not sure if this is useful: If you want several shortcuts, its probably because you want it in a group - which means the style should be changed anyway)
- Splitting sites and shortcuts: Sites: (name and url), Shortcuts: ref to sitename, shortcut and ref to style
- Groups: A group could be a commaseparated list of site names, a shortcut and... maybe list of stylenames, or maybe they should be layed out using the same scheme as with the number-keys
- Separating the settings into another script that are loaded and evaluated on demand. Purpose: To make the script smaller. Not sure if its worth it, though. Should first examine if there is a performance gain at all.





1 point
login to vote
Bjørn Rosell script's author
Posted May 5, 2007

Hi megamorphg.. Thanks for thy responding.
I don't experience the problems you mention, so I decided to publish v1.4 anyway.

If anybody else is having problems, please let me know.

1 point
login to vote
megamorphg user
Posted Apr 29, 2007

I bring to you many problems oh beta friends.

1.) The script should be disabled within Gmail's typing areas... when writing a letter to my beloved... MASSIVE unneeded LookItUp-ization interferes.

2.) The defaultly available Answers.com url is the bestest thing ever for LookItUp but the clean-up version doesn't work in the LookItUp but DOES work in a new tab for some reason (for me).
Here is the faulty one:
http://www.answers.com/[words]?lookitup&css=div...}
Maybe someone can fix it.

AWESOME script despite the problems! NICE JOB!

You could comment on this script if you were logged in.