Doc for JQuery events

This commit is contained in:
Maxime Besson 2022-06-16 16:31:30 +02:00
parent 9674510863
commit 23bc481c0f
3 changed files with 49 additions and 0 deletions

View File

@ -6,6 +6,7 @@ Portal configuration
portal
portalcustom
jqueryevents
portalmenu
portalservers
captcha

View File

@ -0,0 +1,42 @@
Available JQuery Events
========================
Some portal functions (such as 2FA registration) are performed by Javascript.
We offer a few custom events that let you react to certain high-level Javascript events
Second factor management
------------------------
mfaAdded
~~~~~~~~
.. versionadded:: 2.0.15
This event is triggered when a TOTP, WebAuthn or U2F device is registered
Sample code:
.. code:: javascript
$(document).on( "mfaAdded", { }, function( event, info ) {
console.log( "Added MFA of type" + info.type );
// Your code here
});
mfaDeleted
~~~~~~~~~~~
.. versionadded:: 2.0.15
This event is triggered when a TOTP, WebAuthn or U2F device is removed
Sample code:
.. code:: javascript
$(document).on( "mfaDeleted", { }, function( event, info ) {
console.log( "Removed MFA of type" + info.type );
// Your code here
});

View File

@ -220,6 +220,12 @@ To change CSS, two options:
<link href="<TMPL_VAR NAME="STATIC_PREFIX">myskin/css/myskin.css" rel="stylesheet" type="text/css" />
To add custom JS, create a new file in myskin/js/custom.js and load it in customhead.tpl ::
<script type="text/javascript" src="<TMPL_VAR NAME="STATIC_PREFIX"><TMPL_VAR NAME="SKIN">/js/custom.js"></script>
In this file, you can access JQuery functions, and hook your code to :doc:`JQuery events <jqueryevents>`
Put then all custom HTML code in the custom template files.
To configure your new skin in Manager, select the custom skin, and enter