Jump to content

User:Pilaf~enwiki/Live Preview

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Pilaf~enwiki (talk | contribs) at 19:33, 7 February 2005 (How does it work?). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

Please help me pick a new name for this utility.

A screenshot illustrating Live Preview

Live Preview, as I chose to call it, is a nifty extension to Wikipedia's edit page which allows you to generate instant previews of the page you're editing. You might think this is silly as Wikipedia already has a preview feature, but this is unlike Wikipedia's preview in that it gets generated into your browser on the fly, without needing a page reload, in fact with no delay at all (except for very long pages).

If you grasped the idea already and can't wait to give it a try, just skip to the install instructions. Otherwise keep reading.

Benefits

The regular Wikipedia preview works by sending the wiki text to the servers, which in turn processes it and sends the resulting page back. Although this is generally not too demanding for the servers, it does have a small hit which contributes to some extent to the general slowdown of the site. Conversely, Live Preview runs 100% on your computer, avoiding those (unnecessary) hits, thus giving some relief to the servers. The effectiveness of this, of course, depends on how many people actually stop using the regular preview when not needed.

Appart from caressing the servers, Live Preview has the much more direct advantage of faster previews, often meaning gains in time and faster editing, as you would no longer have to wait for a page reload to see the results of your edits. This is perhaps Live Previews' largest appeal, or the most visible one at least.

Requirements

All you need to use Live Preview is a web browser with modern JavaScript support and have it enabled when editing a page. These are the browsers in which I've tested it and know that work:

  • Mozilla, Firefox, K-Meleon or any other Gecko-based browser
  • Opera 6/7/8
  • Konqueror 3.3 (and probably Safari too)
  • Internet Explorer 6

On the following browsers it does not work:

  • Internet Explorer 5

If you've tested it on any other browsers, please feel free to add them to the corresponding list.

In terms of computer power, any modern computer should suffice. You may notice some delays when processing very long pages on old computers though.

How do I install it?

Please check the requirements before installing Live Preview.

To install Live Preview simply copy/paste the full contents of User:Pilaf/monobook.js into your own monobook.js page (User:YOUR_USER_NAME_HERE/monobook.js) (in case you haven't guessed yet, you need to use the MonoBook skin in your preferences). Once you've done it refresh your browser as indicated at the top of your monobook.js' page. Note that you need to be a registered user in order for this to work.

You may want to configure a few parameters, such as your user name (for signatures). To achieve this simply edit the following line in your monobook.js:

wpUserName = 'Your user name here';

If you're already using some other sort of extension that uses monobook.js you might not want to replace it with mine, but have them combined instead. In that case you may message me for help, I'll be glad to help you as long as I have the time to do it.

How do I use it?

If you've already installed it, all you need to do to start using it is to edit any page. You should now notice a new button labeled "Live Preview" below the regular "Save page" and "Show preview" buttons. Once you've made your edits just click on the Live Preview button to see the resulting page appear instantly before your eyes. You may click it any number of times to see further changes, you never need to reload the page.

If you've installed it and still can't see it, please check you fulfill the requirements. If that doesn't seem to be the problem, try messaging me.

Limitations

Live Preview is a work in progress and as such it has its limitations. Some are due to its state of incompleteness, some will most likely never happen as there are certain things that are just not possible to do without running on the servers. In any case you should be aware of what Live Preview can and can't do, and never expect more, you can still use the regular preview for those cases where Live Preview fails.

Here's a mantained list of the current limitations of Live Preview (i.e. what it still can't do):

  • <nowiki></nowiki> tags
  • <math></math> tags
  • <hiero></hiero> tags
  • Templates and MediaWiki messages
  • Undesired HTML stripping
  • Table of contents
  • Red links (to unexisting pages)
  • Time tables
  • Image galleries

In addition to the above list, it should be noted that Live Preview is meaned to be an approximation to the real results and should not be considered accurate. If in doubt use the regular preview.

In contrast, here is what Live Preview currently can do:

  • Headings (all levels)
  • Regular paragraphs
  • Horizontal bars
  • Inline formatting (bold and italics)
  • Wikilinks
  • External links
  • Numbered and unordered lists
  • Definition lists
  • Tables
  • Preformatted text (whitespace at line start)
  • Signatures
  • Invisibile links (interwiki and categories)
  • Images

How does it work?

Note: This is a technical explanation of how Live Preview does its trick, if you're not into programming you'll probably not be interested in this.

Yet to be written.

You make take a look at the full source code with comments here: User:Pilaf/sources.js (may be outdated, message me for current version)

Disclaimer

I (Pilaf) will not be held responsible for any damage this may produce you. By using it you agree to take full responsability and accept that I have no idea of how to write a disclaimer notice at all.

Name change

Brion Vibber made me note that MediaWiki 1.5 has a feature called 'Live Preview' already, seemingly unrelated (I don't know what it does). Therefore I need to seek a new name for my Live Preview, so here's a few proposals, you can add suggestions or vote on the one you like best if you want to help. Thanks.

  • Quick Preview
  • Instant Preview/InstaView

Testimonials

Are you a happy user of Live Preview? You can leave your testimonial here and let the world know how good it is :)

Very impressive work, Pilaf!--Eloquence* 06:53, Feb 7, 2005 (UTC)

I agree. I'm promoting it at Wikicities as well. :) Angela. 07:34, Feb 7, 2005 (UTC)