Integration of a bookmarklet to add a web page to the link directory
Last published:17/12/2018à 15:46LoïcBouchet
Version 2.0.0 of plugin provides a helper XSLT to enable visitors to add a bookmarklet as a bookmark or favorite link in their browser.
This bookmarklet adds a visited web page to the user's personalized links. Execution of this bookmarklet will work if the user is already connected to the site. Otherwise, an error message will be displayed.
Integration
To enable site visitors to add this bookmarklet to their favorites, you can create a page in which you insert the bookmarklet link with the instruction to drag and drop the link into the favorites.
To do this, you need to import the XSLT helper:
Oops!
Copy to clipboard failed. Open the code and copy it manually.
Then call up the XSLT "add-link-bl" template. For example:
Oops!
Copy to clipboard failed. Open the code and copy it manually.
<div>
<p>Glissez-déposer le lien ci-après dans la barre des favoris : <xsl:call-template name="add-link-bl"/></p>
</div>
<div>
<p>Glissez-déposer le lien ci-après dans la barre des favoris : <xsl:call-template name="add-link-bl"/></p>
</div>
<div>
<p>Glissez-déposer le lien ci-après dans la barre des favoris : <xsl:call-template name="add-link-bl"/></p>
</div>
The bookmarklet title, confirmation and error messages are configurable. By default, the bookmarklet title is "✚ Favorites Ametys " and confirmation is requested before adding.
Example of overloading:
Oops!
Copy to clipboard failed. Open the code and copy it manually.
<div>
<xsl:call-template name="add-link-bl">
<xsl:with-param name="link-text">Le titre du bookmarklet</xsl:with-param>
<xsl:with-param name="display-confirm">true</xsl:with-param>
<xsl:with-param name="confirm-text">Message de confirmation avant ajout</xsl:with-param>
<xsl:with-param name="success-text">Message à afficher en cas de succès</xsl:with-param>
<xsl:with-param name="unauthenticated-user-text">Message d'erreur à afficher si l'utilisateur n'est pas connecté</xsl:with-param>
<xsl:with-param name="already-exists-text">Message d'erreur à afficher si la page web existe déjà dans l'annuaire</xsl:with-param>
<xsl:with-param name="unknown-error-text">Message d'erreur à afficher en cas d'erreur</xsl:with-param>
</xsl:call-template>
</div>
<div>
<xsl:call-template name="add-link-bl">
<xsl:with-param name="link-text">Le titre du bookmarklet</xsl:with-param>
<xsl:with-param name="display-confirm">true</xsl:with-param>
<xsl:with-param name="confirm-text">Message de confirmation avant ajout</xsl:with-param>
<xsl:with-param name="success-text">Message à afficher en cas de succès</xsl:with-param>
<xsl:with-param name="unauthenticated-user-text">Message d'erreur à afficher si l'utilisateur n'est pas connecté</xsl:with-param>
<xsl:with-param name="already-exists-text">Message d'erreur à afficher si la page web existe déjà dans l'annuaire</xsl:with-param>
<xsl:with-param name="unknown-error-text">Message d'erreur à afficher en cas d'erreur</xsl:with-param>
</xsl:call-template>
</div>
<div>
<xsl:call-template name="add-link-bl">
<xsl:with-param name="link-text">Le titre du bookmarklet</xsl:with-param>
<xsl:with-param name="display-confirm">true</xsl:with-param>
<xsl:with-param name="confirm-text">Message de confirmation avant ajout</xsl:with-param>
<xsl:with-param name="success-text">Message à afficher en cas de succès</xsl:with-param>
<xsl:with-param name="unauthenticated-user-text">Message d'erreur à afficher si l'utilisateur n'est pas connecté</xsl:with-param>
<xsl:with-param name="already-exists-text">Message d'erreur à afficher si la page web existe déjà dans l'annuaire</xsl:with-param>
<xsl:with-param name="unknown-error-text">Message d'erreur à afficher en cas d'erreur</xsl:with-param>
</xsl:call-template>
</div>
From version 2.6 :
There is now a new parameter:
Oops!
Copy to clipboard failed. Open the code and copy it manually.
<xsl:param name="custom-theme"></xsl:param>
<xsl:param name="custom-theme"></xsl:param>
<xsl:param name="custom-theme"></xsl:param>
It's empty by default, but you can fill it with a theme identifier (e.g. FAVORITES).
Added links will default to the chosen theme ("Favorites" in the example).
If it's empty, added links won't have a theme.
Restriction
If the bookmarklet is generated from an http site Ametys , it will not be possible to add an address in https://.
It is not possible to submit HTTP requests from an HTTPS server.