Open main menu

Extension:AutoCompleteTextArea

MediaWiki extensions manual
OOjs UI icon advanced.svg
AutoCompleteTextArea
Release status: unknown
Author(s) Joseph Tabenkin
Latest version 1.0
License No license specified
Download No link
Translate the AutoCompleteTextArea extension if it is available at translatewiki.net

OverviewEdit

I am an amateur programmer and I have no formal experience. This is an extension I wrote because I wanted to save time while writing wiki articles at work. There are some functionality improvements that could be made, but from the testing I have done so far, it seem to work well.

FunctionalityEdit

The Extension allows for an auto_complete div to be added to the edit screen. While on, the extension will monitor edits made to the textarea. When the user types '[[', the extension will turn on the searchable mode. When searchable is on, the extension will send an HTTP request to getHint.php. getHint.php will return a list of pages that match the text entered in after '[['.

The suggested search results will appear in the auto_complete div located in the main edit screen. The user can then select one of the suggested page names. Selecting a suggestion will replace the text after the open brackets ('[['). The user can select suggested names by using the arrow and enter keys, or clicking on a suggestion with their mouse.

The auto complete div will initially populate on the right hand side of the screen. Its position is absolute, but the div can be moved using the mouse in a drag and drop fashion.

This extension DOES also search for categories, and will prefix all category page names with the word "Category:".

The query uses Like, so the results will contain suggestions that include the text entered after the '[['. The results will be sorted by title and page_counts (ie pages that are visited more frequently will appear closer to the top).

I have tried my best to comment in descriptions in the code, but may have gone overboard. Feel free to email me with implementation questions. I will keep my email up as long as inquiries remain reasonable. joseph.tabenkin@gmail.com

I will upload all necessary files bellow. The only changes to the files that should need to be made are to connect.php. This is the database connection file. You will need to supply:

        $db_hostname='<<your host>>';
        $db_database='<<db_name>>';
        $db_username='<<db_username>>';
        $db_password='<<db_password>>';

You should not need to modify the other two files. The main query is located in getHint.php. If you have changed the standard wiki table names, then you may need to adjust the query.

I have not had the patience to go through my code again, so some of the variables are not intuitive. I plan on re releasing the code with neater comments and more informative variable names. Any feedback or improvements are welcome! Enjoy!

NotesEdit

Add the following to LocalSettings.php:

require_once($IP . "/extensions/auto_complete/auto_complete.php");