Posts tagged javascript

Wikipedia Instant –> Chrome Extension

In the last month a new trend appeared on the internet, instant (ne Google Instant, iTunes Instant, AppOfTheDay Instant).  It wasn’t just good enough to have an AJAX-y interface (where contents of the page are loaded asynchronously) but now they had to be loaded on every keystroke.  However I’m late to the game I have my own contribution, Wikipedia Instant for Chrome.

Rationale.

I’m often at websites reading about a topic and think, “Hey, it would be great to be able to have Wikipedia right here without leaving this page!”  And so, as a Chrome extension, it works as advertised.

Use.

Once installed (Mac, Windows, and Linux versions of Chrome; this is written in Javascript and is portable) you just click the ‘W’ icon, between the omni-box and the wrench icon, and Wikipedia pops-up.  When you type a phrase it will check to see that an article exists and offer suggestions, then loads the article you select.  All internal Wikilinks (to other articles) will load inside itself.

Features.

  • This extension offers 1-click access to Wikipedia
  • Instant-ized access to Wikipedia and OpenSearch suggestions
  • Uses the mobile version of Wikipedia as it’s already formatted for a small window.
  • Is cross-platform, written in Javascript and CSS.
  • Preserves Wiki-formatting, layout, and section links (#ash links)

Future.

As of now, version 0.5, Wikipedia Instant:

  • …doesn’t open external links.  These links when clicked don’t do anything.
  • …doesn’t have a 404 for not finding articles or suggestions from Wikipedia.  This isn’t a huge issue if you’re close to a spelling or topic, but could cause some problems.
  • …doesn’t remember your history, state (currently open page), or offer any options.
  • …is semi-slow.  The algorithm I’m using to convert Wikilinks isn’t very efficient (it’s a giant nested loop = gross).  Additionally there is a lot of loaded code every time you open it (click the ‘W’ icon) — the whole jQuery library, and for the suggestions where the box is auto-filled on mouse-over is a nasty ‘onMouseOver’ event which could perform poorly on slow systems.
  • …doesn’t show progress for loading articles.
  • …doesn’t sanitize input.
  • …uses not-so-elegant links (anchored Javascript); this shouldn’t be a problem as Chrome is the only target for this (duh) but it could work better.
  • …doesn’t preserve the collapsable sub-headings found on the Wikipedia mobile site.  This makes for a lot of scrolling.
  • …has a bug where some pages will scroll on the x-axis (although only an issue if this is enabled on your computer)

As logic follows, these shortcomings will be morphed into features. Additionally, functionality will be added to chose to use Wikipedia Simple and other languages.

Installation.

I thought you’d never ask.  You can click this link and it will download (49KB) and prompt you to install.  If you wish to disable or uninstall this, you go under the wrench menu > Tools > Extensions and click uninstall on this extension.

Download here (49KB)

Bookmarklets I Frequently Use

The iPhone Safari browser is amazingly limited — no “find in page” function, no extensions, and no other search providers available (either Google or Yahoo). However the iPhone’s been gifted an amazing rendering engine and Javascript library, which is why I recommend the following Javascript bookmarklets.

If you aren’t sure how a bookmark differs from a bookmarklet, take a look at Wikipedia, or read my simple explaination: a bookmarklet is a saved line of Javascript code which provides some functionality and has all of the capabilities of Javascript on the currently displayed page, including navigating to a new page and modifying the page itself. A bookmarklet is activated when you open the bookmark (click it). On the iPhone there’s only one native way to get bookmarklets onto the phone — by bookmarking them on Safari on your computer then syncing them to Safari on the iPhone (done through iPhone). There are some bookmarklet providers which provide helper install pages to get around this limitation.

The iPhone bookmarklet installer bookmarklet: Found at joemaller.com/___
When activated this bookmarklet will add text to the beginning of each link found on the page so that you can bookmark it (see the site for more information).

The 1Password bookmarklets:
If you have an iPhone and the 1Password you can use the “lookup in 1Password” bookmarklet which automatically open 1Password with the current page address and allows you to copy your password. Immediately after copying some text you’re returned to Safari where you can input it. 1Passsword can be synced in app over WiFi to the Mac OS X version of 1Password.
OR
If you don’t have the 1Password iPhone app and have the desktop version you can make a self-contained bookmarklet which does the same thing in browser. New passwords are synced to this by the 1Password app on OS X. (learn more about option # 2 at the 1Password site)

Delicious – (see this page for instructions)
This just navigates you to an iPhone friendly way to bookmark using Delicious, pretty simple, very useful.

Find in Page – (Javascript to bookmark)
This open a Javascript prompt where you enter a phrase (case-independent) to find in the page; matches are counted and highlighted in yellow and bold.

Open Links in new Window – (Javascript to bookmark)
When activated this changes all links on the current page to spawn a new tab to view them.

Dictionary – (Javascript to bookmark)
This open a prompt to enter a word and redirects you to a definition of the word.

Wikipedia – (Javascript to bookmark)
This opens a prompt where you enter a Wikipedia query.

Mobilize This! – (Javascript to bookmark)
This bookmarklet open the currently open (or loading) page to be opened using the Google mobilizer service (shows only plain text, much quicker to load).

Read It Laterlog in to your Read It Later account to find these bookmarklets
This adds the current page (or current loading page) to your Read It Late queue.