Skip to content
Petr Bena edited this page Jul 6, 2018 · 1 revision

Since Huggle 3.4 Python engine was replaced with Google's V8 JS engine.

Lot of documentation for this is missing now, but you can get inspiration from existing extensions here: https://www.mediawiki.org/wiki/Huggle/JS

This page serves as manual for programmers who want to create some extension.

Huggle JS vs web browser JS

Huggle's JS is pure implementation of JS, also known as ECMA script (should fully support v6, may contain some v7 and v8 features - https://en.wikipedia.org/wiki/ECMAScript) - therefore it's not a browser JS, which comes with lot of functions implemented by the browser - lot of functions like alert() etc. that typical JS developers are familiar with, are actually not standard part of ECMA - they are implemented by browser itself.

Huggle reimplements some of these "classic" functions that are expected to exist, but many of them are missing, so if you are experienced with browser JS, you may still find some things different in Huggle.

In order to alter Huggle and implement new stuff, you can work with various hooks and C++ functions that are exported to JS environment and available through various huggle prefixed classes.

Function and hook list

In order to display all hooks and functions available use Scripting -> Developer tools, the list will differ between versions of Huggle

External callbacks

It's possible to register external callbacks, which are functions that can be called by other scripts or by Huggle itself from clickable URLs on many places. The url has following format:

hgjs://script_name/function_name?parameters&of&functions

Whoever click such a link will call your function with the provided parameters, these external callbacks must be exported via huggle.register_callback(string name)