User:Lupin/popupOptions

Advanced customization
You can define custom filters for articles. These are javascript functions which are run after the page statistics are generated, and their output is appended (as HTML) to that part of the popup. (Note that if simplePopups is true or popupSummaryData is false, then nothing will be displayed).

The way this works is to write a filter function which accepts a string (the wikitext of the article) as input, and returns a fragment of HTML. Repeat for as many filters as you want, and then create an array extraPopupFilters which contains all of the functions, in the order in which you want them to be run.

For example, let's say I want to be told whenever the wikitext of an article contains a table written using HTML tags rather than wiki markup. One way to do this is to add the following to your user javascript file:

// initialize the array extraPopupFilters=new Array;

// define the function function popupFilterHtmlTable (wikiText) { if (/<table/i.test(wikiText)) return '&lt;table&gt;'; else return ''; };

// add the function to the array extraPopupFilters.push(popupFilterHtmlTable);

Then when a popup is generated for a page containing an HTML table, you should see &lt;table&gt; in the popup. (It may match also appear for other pages, such as this page. Correcting this defect is left as an exercise for the reader).