jQuery Helpers

Last modified by Manuel Smeria on 2024/07/05 18:16

cogSome jQuery tools
TypeXAR
Category
Developed by

Nicolas Lemoine

Rating
0 Votes
LicenseGNU Lesser General Public License 2.1

Installable with the Extension Manager

Description

This extension contains 2 tools.

Back To Top button

This allows the user to go back to the top of the browser with one click. This feature is very useful when you have a long long content in your page and you want to go back to the top. Scroll is over!

To use this feature, you need to insert the following code where you want it to be used:

{{velocity}}
$xwiki.jsx.use('jQuery.jQuery', {'defer': false})
$xwiki.jsx.use('jQuery.jQueryUI')
$xwiki.ssx.use('jQuery.jQueryUI')
{{/velocity}}

The main jQuery script must be used non-deferred, since the execution order isn't always preserved in all browsers, and the second script might throw errors because jQuery is undefined.

You can test the feature at the following bundled demo page: jQuery.Demo1

Show/hide labels + Custom password type behavior

This allows the user to add the label of a field right inside the field. When you click it disappears and lets you write your real content. Plus if it's a password, the input becomes protected by itself. It works for inputs and textareas.

This feature requires some configuration every time you want to use it.

First, you must fill the document jQuery.FormLabels with the id/name of each field you want to customize.

'#Field_name' : 'Your label title'

A comma is required for each row except for the last one. The hash (#) is required.

Second, if you want some password fields, you must fill in the document jQuery.FormLabelsPwd.

'Field_name'

Each item must be separated with a comma. No hash (#) in this document.

Please add the following code to each sheet where you wish to have custom labels:

{{velocity}}
$xwiki.jsx.use("jQuery.jQuery")
$xwiki.jsx.use("jQuery.jQueryUI")
{{/velocity}}

Both features don't work with versions of Internet Explorer prior to version 9.

Prerequisites & Installation Instructions

We recommend using the Extension Manager to install this extension (Make sure that the text "Installable with the Extension Manager" is displayed at the top right location on this page to know if this extension can be installed with the Extension Manager). Note that installing Extensions when being offline is currently not supported and you'd need to use some complex manual method.

You can also use the following manual method, which is useful if this extension cannot be installed with the Extension Manager or if you're using an old version of XWiki that doesn't have the Extension Manager:

  1. Log in the wiki with a user having Administration rights
  2. Go to the Administration page and select the Import category
  3. Follow the on-screen instructions to upload the downloaded XAR
  4. Click on the uploaded XAR and follow the instructions
  5. You'll also need to install all dependent Extensions that are not already installed in your wiki

The jQuery library is included in this extension and thus you don't have to download it. Technically it's added as a JSX.

Release Notes

v1.1.1

  • Fixed bug with IE7 and lower: using console.log without checking if it exists; thanks to Jamie Maher for pointing that out

v1.1

  • Fixed extra ZERO WIDTH SPACE character at the end of the jQueryUI script which caused parsing errors in IE browsers
  • The proper way of using the jQuery script is non-defered, since otherwise the execution order isn't guaranteed in IE
  • Added some titles and parents to the documents

Get Connected