Custom Activation Mode
When the activationMode
is set to custom
, you have the flexibility to programmatically control the opening and closing of the plugin. This allows you to tailor the plugin’s behaviour according to the specific needs and conditions of your application.
Including the Plugin Script
You’ll receive your custom-built Script Tag from one of our team members. It will look like the example below. Ensure that you have included the plugin script in your HTML file. Add the provided <script>
just before the closing </body>
tag of your HTML:
Functions to Control the Plugin
The plugin exposes two global functions to control its visibility:
signapseMount()
: Opens the plugin.signapseUnmount()
: Closes the plugin.
These functions are attached to the window
object, so they can be called directly from your JavaScript code.
Example Usage
Here is an example of how to use these functions in your application:
JavaScript
You can also control the plugin through JavaScript based on your application logic. For example, you might want to open the plugin after a certain action or event.
Important Considerations
- Page Restrictions: The plugin will internally handle not appearing on pages that are not defined as allowed (not translated). If the
signapseMount()
orsignapseUnmount()
functions are invoked on these not allowed pages, they will silently fail and do nothing. - Session Persistence: Once the plugin is activated using
signapseMount()
, it will remain active for the duration of the session (until your web browser is closed) on all other “translated” pages untilsignapseUnmount()
is called. This ensures that when navigating between translated pages, you automatically see the translation plugin open.
By following these instructions, you can effectively manage the visibility of the plugin in your application when using the custom activation mode.
Support
If you have any issues or questions, please contact us at marcus@signapse.ai.