Extensions Wiki » Extensions » jQuery Helpers

jQuery Helpers

Last modified by Sergiu Dumitriu on 2012/10/29 23:19
cogSome jQuery tools
TypeXAR
Developed by

Nicolas Lemoine

LicenseGNU Lesser General Public License 2.1
Installable with the Extension Manager

Download v1.1.1

Description

This extension contains 2 tools.

Back To Top button

This allows the user with one click to go back to the top of the browser. 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

  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

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

  • 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

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
Tags: jQuery
Created by Nicolas Lemoine on 2012/03/28 11:14

Download XWiki