This is the developer page and program documentation for wikEd, a full-featured in-browser text editor that adds enhanced text processing functions to Wikipedia and other MediaWiki edit pages. Please use this talk page for discussing wikEd development issues.
wikEd replaces the classic textarea input field with an iframe in designmode. That is essentially a separate html page that can be edited. The browser's rich-text editing interface is used to manipulate the text upon clicking a wikEd button, see [1]. After pushing the Save page button the content is copied back to the hidden textarea and then submitted.
element.addEventListener('click', function(event, variable) { ... }, true); // uses the last value of variable
If possible, please use the wikEd wrapper: WikEdAddEventListener(element, 'click', WikEdGlobalFunction, true)
Custom attributes of DOM elements:
element.setAttribute('custom') = 123;
var attribString = element.getAttribute('custom'); // it is always a string!
It is NOT possible to access functions, objects, or variables from other scripts running on the page! However, it is possible to access variable values using the function wikEd.GetGlobals().
Save a Wikipedia edit page of your choice to D:\wikEd\test.html
Open the page in your text editor and change all addresses of scripts, css files, and images their respective local copies. All other relative links starting with "/ have to be preceded with "http://en.wikipedia.org".
Download the user interface images here, rename the extension to ".zip", and extract them
Set the following configuration variables in the header JavaScript of the edit page:
varwikEdAutoUpdate=false;varwikEdUseLocalImages=true;varwikEdImagePathLocal='file:///D:/wikEd/images/';// the directory were you keep all wikEd button imagesvarwikEdSkipBrowserTest=true;// this enables wikEd under IE and OperavarwikEdShowSourceButton=true;varwikEdDiffScriptSrc='file:///D:/wikEd/diff.js';// the local diff program used for 'Show current changes below'varwikEdInstaViewSrc='file:///D:/wikEd/instaview.js';// InstaView AJAX preview
For finally testing the code on Wikipedia, every developer should create a code page in his own user space ending with .js (e.g. User:YourUsername/wikEd_dev.js). These pages can only be edited by the owner for security reasons.
There is the new library IERange that provides DOM ranges for MS IE. This seems to work in general and has been added to wikEd. However, MSIE has no support for execCommand('inserthtml', code); and the workaround frameDocument.selection.createRange().pasteHTML(code); breaks the undo history!