User talk:Alex Smotrov/qpreview.js
From Wikipedia, the free encyclopedia
[edit] Documentation
On edit pages the script adds QPreview button for quick AJAX preview without reloading the whole page.
Comparison:
| Show preview | QPreview |
|---|---|
| Browsers sends wiki code to Mediawiki server | |
Browser gets back:
Also browser makes requests for external |
Browser gets back:
|
| Browser draws the whole page and executes all the scripts | Browser redraws only the preview part |
| Editing textarea doesn't «remember» anything | You can use Ctrl-Z to undo edits |
In other words, QPreview button performs preview quicker and saves incoming traffic.
Notes:
- By default, the button is located on the edit toolbar (above textarea)
- QPreview doesn't update anything outside preview area (interwiki, categories, list of used templates, Geshi CSS rules)
- QPreview may stop working at any time if Mediawiki developers change something
- Tested in Internet Explorer 6/7, Firefox 1.5/2, Opera 9, Safari 3
Demo without installation:
- make sure you have Edit toolbar enabled
- click on the «edit this page» tab above
- copy to your browser address field
javascript:function addOnloadHook(f){f()};importScript('User:Alex_Smotrov/qpreview.js');void 0
- press Enter and QPreview button should appear on the toolbar
- change the text in textarea and press QPreview
Installation: importScript('User:Alex_Smotrov/qpreview.js'); → your monobook.js
Optional parameters: (specified with default values)
qPreviewKey = '';— accesskeyqPreviewName = 'QPreview';— name on the buttonqPreviewWait = 'Wait…'— name while doing AJAX requestqPreviewAtBottom = false;— if true, put the button below
Example:
qPreviewKey = '`'; // accesskey: ~ qPreviewName = 'Quick'; qPreviewAtBottom = true; importScript('User:Alex Smotrov/qpreview.js');
Result (under textarea): Quickly Show preview
See also
- wikEd, an in-browser editing tool (Firefox only) that uses QPreview techniques
License
| I, the copyright holder of this work, hereby release it into the public domain. This applies worldwide. In case this is not legally possible, |

