-
Notifications
You must be signed in to change notification settings - Fork 277
scripting client_plugins
Client plugins are installed by the kiwi server admin and are loaded into the client automatically when the web page loads.
Common uses for client plugins is to extend the functionality of the Kiwi client without modifying the source code directly each time. This keeps Kiwi updates cleaner in future.
A client plugin is a .html file that can be sat in your path_to_kiwiirc/client/plugins/ folder.
This file is loaded into the Kiwi client after the client has been loaded, initialized and ready
to be displayed. This file is a standard HTML file, you may use any standard web page assets in
your plugin, including <script>
tags. (If you are familiar with jQuery, at the heart of it all
it uses jQuery.load(your_plugin_url)
to load your plugin file)
To get your file loading into the client you must tell the server to include it. This is done by
adding the URL to your plugin file name into your config.js
file under the conf.client_plugins
section. You may add as many plugins as you like - but remember that each one is more that the
browser has to download. Too many can slow things down!
A config example would be:
conf.client_plugins = [
'/kiwi/plugins/your_plugin.html'
];
A common request for Kiwi is to have it automatically connect without having to click 'Start'. (Note: Whilst this is unadvised as it opens you up to potential abuse, it is still heavily requested so please be warned!)
-
Create the plugin file We will call our plugin 'auto_connect'. So lets create our empty plugin file at: path_to_kiwi/client/assets/plugins/auto_connect.html
-
Add some plugin code As a quick and dirty way around auto connecting, we will simulate somebody clicking the 'Start' button as soon as the page has loaded. We can use simple jQuery for this, so add the following to your plugin code:
<script>
// Event fired after all plugins are loaded and Kiwi is ready
kiwi.events.on('loaded', function() {
$('.server_details .start button').click();
});
</script>
-
Include the plugin into your client Now it's time to open up your config.js file (You have copied config.example.js to config.js already, haven't you?). Find the section named
conf.client_plugins
and the following:'/kiwi/assets/plugins/auto_connect.html'
-
Reload the Kiwi configuration and try it out Back in your terminal/prompt, force Kiwi to re-load its config files via
./kiwi reconfig
. If everything is in place, the Kiwi client should now be loading your new plugin on startup and automatically connecting.
Officially mirrored at https://kiwiirc.com/docs/