JQueryPlugin

jQuery JavaScript library for Foswiki

Description

"jQuery is a fast, concise, JavaScript Library that simplifies how you traverse HTML documents, handle events, perform animations, and add Ajax interactions to your web pages."

Besides jQuery itself, JQueryPlugin comes with a selection of third party plugins that are thought to be essential for modern web applications. These are integrated into Foswiki either by means of a special macro, by "minimal markup", or custom javascript initializer. "Minimal markup" is a way to avoid the need to write javascript code to initialize the interface. Instead, a special css class is added to an html element that triggers its initialization. See JQueryMetadata for an example.

Use JQREQUIRE to make use of a specific jQuery plugin on a page. This will prepare the page by loading the required javascript and css components. If you need to make a feature available on each and every page of your site, you may add this plugin to the list of default plugins loaded automatically. See configure.

Those plugins coming with their own macro will take care of loading their javascript and css by themselves. So you won't need to call JQREQUIRE explicitly for those listed below.

Adding new plugins

The JQuery ecosystem has a huge number of plugins - more than can be included by default by this plugin. If you want to add new plugins, then you will find instructions for adding them at Foswiki:Development.UsingJQueryWithFoswiki#adding_plugins.

Writing your own Javascript

Whether writing your own plugins or writing Javascript code in topics, you should observe the Foswiki JQueryCodingStandards.

jQuery References and tutorials

Macros

BUTTON -- renders a nice button

Parameters

Parameter Description Default
"text" text to be put on this button  
value text to be put on this button  
accesskey access key used for this button  
class e.g. use simple for a non-3D button  
data_... add html5 data attributes  
align left, right, center
href url of the click target #
icon icon to be put on the left; note, this can be any icon attached to the {IconSearchPath}; see also VarJQICON  
id html id for this button  
onclick javascript event triggered when clicking the button  
target topic to open when clicking on the button  
title popup title displayed when hovering over the button  
type type of action to be performed; available actions are
  • button - normal click button, target specified in target or href parameter
  • clear - clears all input fields in the form that contains the button
  • reset - resets all input fields in a form to their initial value
  • submit - submits the form that contains the button
  • save - same as submit but takes care of extra validation steps when saving a wiki topic
button

Examples

%BUTTON{
    "%MAKETEXT{"Submit"}%"
    icon="tick"
    onclick="confirm('Are your sure?')"
  }%
  %BUTTON{
    "%MAKETEXT{"Cancel"}%"
    icon="cross"
    target="%WEB%.%TOPIC%"
  }% %CLEAR%
Note: BUTTONS are floating to the left by default. Take care to add a %CLEAR% after the %BUTTON{...}% so that further content does not overlap with the button.

TABPANE -- tabpane widget

This macro starts the tabpane, containing a series of TAB...ENDTABs and ends with ENDTABPANE. A complete tabpane normally looks like this:
%TABPANE%
 %TAB{"tab 1"}%
   ...
 %ENDTAB%
 %TAB{"tab 2"}%
   ...
 %ENDTAB%
%ENDTABPANE%
Multiple tabpanes can be nested using the following scheme:
%TABPANE%
 %TAB{"tab 1"}%
   %TABPANE%
     %TAB{"tab 1.1"}%
       ...
     %ENDTAB%
     %TAB{"tab1.2"}%
       ...
     %ENDTAB%
   %ENDTABPANE%
 %ENDTAB%
 %TAB{"tab 2"}%
   ...
 %ENDTAB%
%ENDTABPANE%

Parameters

Parameter Description Default
select number or id of tab to select 1
automaxexpand resizes the tabpane to the maximum height to fit into the window off
minheight when automaxexpand is enabled, this is the minimum size a tab is allowed to be resized 230
class extra class: use simple for a non-3D tabpane; use=plain= for a no-frame look&feel  
animate enables/disables animation of switching tabs off
remember enables/disables recording the current tab into the url anchor, as well as initialize the currently selected tab reading the anchor off

Examples

see JQueryTabpane for more examples

ENDTABPANE -- ending tag for tabpane widget

This closes a previously opened TABPANE.

TAB -- tab inside a tabpane widget

Defines a tab inside a TABPANE area; must be closed using ENDTAB.

Parameters

Parameter Description Default
"text" label of the tab Tab
before when switching tabs, this is the javascript fragment to be executed just before the tab is displayed  
after this javascript handler is to be executed after the tab has been made visible  
afterload this javascript handler will be called when content loaded asynchronously (using the url parameter, below) has finished loading; depending on the network latency, this can be significantly later than execution of the after handler above  
id id of this tab; this id can be used in the TABPANEs select parameter to display this tab; this id is also added to the class attribute of the html element representing the tab button  
url link from where to load the content of the tab asynchronously when selecting this tab; the result of the addressed handler will replace the content area; if no url is set the content of the TAB ... ENDTAB area will be shown when the tab is selected  
width width of the tab area auto
height height of the tab area auto
container element where ajax content will be loaded; this is only used together with url  

ENDTAB -- ending marker for a tab of a tabpane

This closes a previously opened TAB.

JQICON -- render an image

Renders an icon made availabe by the IconService.

Parameters

Parameter Description Default
"name" name of the icon to display  
class additional css class for the img tag  
animate can be one of bounce, burst, flash, float, horizontal, passing, pulse, ring, shake, spin, tada, vertical, wrench
alt alt attribute  
title title attribute  
style css style format to be added to the image element  
format format string used to render the icon; known variables to be used in the format string are:
  • $iconName: name as given to the name parameter
  • $iconPath: url path
  • $iconClass: css class as specified by the class parameter
  • $iconStyle: css styles as specified by the style parameter
  • $iconAlt: alt attribute-value; if the alt parameter to JQICON is set, this expands to alt='...'
  • $iconTitle: title attribute-value; if the title parameter to JQICON is set, this expands to title='...'
for image icons: <img src='$iconPath' class='$iconClass $iconName' $iconStyle $iconAlt$iconTitle/>; for font icons: <i class='$iconClass' $iconStyle $iconTitle></i>

Example for famfamfam icons:

%JQICON{"tick" alt="alternative content" title="this is a tick icon"}%
%JQICON{"cross"}%
%JQICON{"disk"}%
%JQICON{"star"}%
%JQICON{"lightbulb"}%
%JQICON{"camera"}%
%JQICON{"date"}%
%JQICON{"heart" animate="bounce"}%

Produces:

alternative content cross disk star lightbulb camera date heart

Example for font-awesome icons:

%JQICON{"fa-pagelines" style="font-size:1em;color:#00BF00"}%
%JQICON{"fa-pagelines" style="font-size:2em;color:#0FAF0F"}%
%JQICON{"fa-pagelines" style="font-size:3em;color:#1F9C1F"}%
%JQICON{"fa-pagelines" style="font-size:4em;color:#2D812D"}%
%JQICON{"fa-pagelines" style="font-size:5em;color:#315C31"}%

Produces:

JQICONPATH -- render the url path to an image icon

This is a shortcut for:

%JQICON{"name" format="$iconPath"}%

Note that this macro only makes sense for image icons, those that refer to a single image file. It does not work for font icons such as those defined in JQueryFontAwesome. This web font holds all icons in one large font file and as such cannot be refered to individually by means of their url path the same way as images can.

Examples

%JQICONPATH{"tick"}% expands to /foswiki/pub/System/FamFamFamSilkIcons/tick.png

JQPLUGINS -- display a summary of available plugins

Parameters

Parameter Description Default
"plugins" this is a regular expression that the plugin identifier must match to be displayed  
format format string to render information for each matching plugin; known variables to be used in the format string are:
  • $active state of the plugin: displays (active) when this plugin is loaded on the current page
  • $author author of the plugin
  • $documentation plugin documentation topic defaults to %SYSTEMWEB%.JQuery$name
  • $homepage link to the hompeage of this third party plugin
  • $index the current index in the list of all plugins being displayed
  • $name name of the plugin as can be used in JQREQUIRE
  • $summary short description what this plugin does; most plugins provide this piece of information in the summary section of the documentation topic
  • $tags list of TML macros this plugin implements
  • $version version of the plugin as provided by the author of this plugin
   1 <a href="$homepage">$name</a> $active $version $author
header header string prepended to the output; empty when no plugin matches  
footer footer string appended to the output; empty when no plugin matches  
separator separator put between each plugin rendered in a row $n
tagformat format string to render a link to any tag documentation a plugin implements [[%SYSTEMWEB%.Var$tag][$tag]]

Examples

 %JQPLUGINS{
   "treeview|slimbox"
   header="   * JQuery Plugins:$n"
   format="      * [[$documentation][$name]] v$version was developed by [[$homepage][$author]]"
 }%
Produces:

JQREQUIRE -- enable a plugin on the current page

This macro will load a list of plugins to be added to the current page. Use JQPLUGINS to display the list of available and active plugins. While loading a plugin, additional plugins it may depend on are loaded as well. Information about these dependencies is stored within the plugins themselves and can't be changed. Dependencies also make sure the javascript code is added to the html page in the right order. It uses ADDTOZONE to aggregate javascript and css at the right place on the html page.
HELP in case of an error JQREQUIRE will produce an inline HTML error message.

Parameters

Parameter Description Default
"plugin,plugin,plugin" comma-separated list of plugins to be loaded  
warn (on/off) allows you to switch off warnings when a plugin was not found on

Examples

  • %JQREQUIRE{"easing,sliding,falling"}%

JQTHEME -- switch jQuery UI theme

Foswiki's default UI theme is configured in $Foswiki::cfg{JQueryPlugin}{JQueryTheme} and defaults to foswiki. Use configure to change this site wide. Use JQTHEME if you decide to use a different theme on the current page.

Some Foswiki skins may come with their own jQuery UI matching the overall user experience of the web design.
HELP in case of an error JQTHEME will produce an inline HTML error message.

Parameters

Parameter Description Default
"name" name of theme: JQueryPlugin knows the following themes base, lightness, redmod, smoothness; additional themes maybe created using the themeroller and installed to /foswiki/pub/System/JQueryPlugin/$name foswiki
warn (on/off) allows you to switch off warnings when a theme was not found on

POPUPWINDOW -- opens a topic or url in a new window

Parameters

Parameter Description Default
"topic"
topic="topic"
topic="web.topic"
Topic to open  
url URL to open (if topic is not used)  
label Link label the topic or the url
template View template to call when viewing a topic; not used for URLs "viewplain"
width Width of window "600"
height Height of window "480"
toolbar Show toolbars? "0"
scrollbars Show scrollbars? "1"
status Show status? "1"
location Show location bar? "0"
resizable Is the window resizable? "1"
left Left position "0"
top Top position "0"
center Center the window? "0"
menubar Show menubar? "0"
createnew Create a new window for each popup? "1"

Examples

  • Example with topic link:
    %POPUPWINDOW{"JQueryPlugin" label="Open this topic in a new window"}%
    Generates: Open this topic in a new window
  • Example with URL:
    %POPUPWINDOW{url="https://foswiki.org"}%
    Generates: https://foswiki.org
  • Enable POPUPWINDOW by writing %JQREQUIRE{"popupwindow"}% on the page

Available jQuery plugins

1. Animate

A cross-browser library of CSS animations.

2. blockUI

The jQuery BlockUI Plugin lets you simulate synchronous behavior when using AJAX, without locking the browser. When activated, it will prevent user activity with the page (or part of the page) until it is deactivated. BlockUI adds elements to the DOM to give it both the appearance and behavior of blocking user interaction.

3. Button (active)

This is a simple way to render nice buttons in Foswiki. It can be used to replace submit and reset buttons of html forms as well. FamFamFamContrib is recommended to display nice icons on buttons. Note, that this widget does not participate on the jquery theme roller. This is independent.

4. Comment

5. Configure

Easy cookie handling using jQuery.

7. Cycle

The jQuery Cycle Plugin is a lightweight slideshow plugin. Its implementation is based on the JQueryInnerFade Plugin by Torsten Baldes, the Slideshow Plugin by Matt Oakes, and the jqShuffle Plugin by Benjamin Sterling. It supports pause-on-hover, auto-stop, auto-fit, before/after callbacks, click triggers and many transition effects. It also supports, but does not require, the Metadata Plugin and the Easing Plugin.

8. Debug

Simple jQuery logger / debugger using firebug's console or a div of its own of the form. Useful for JavaScript developers.

9. Easing

Uses the built in easing capabilities added In jQuery 1.1 to offer additional "easing" effects.

10. Farbtastic

Farbtastic is a jQuery plug-in that can add one or more color picker widgets into a page. Each widget is then linked to an existing element (e.g. a text field) and will update the element's value when a color is selected. Farbtastic uses layered transparent PNGs to render a saturation/luminance gradient inside of a hue circle. No Flash or pixel-sized divs are used.

There's a color formfield for easy integration into Foswiki DataForms.

11. FluidFont

Recompute the font size of an element based on its width.

12. Focus

This plugin sets the focus on a form input field or textarea of a form when the page is loaded.

13. FontAwesome (active)

This plugin adds support for the fontawesom icon font. Icons are accessible via the %JQICON macro.

14. Form

The jQuery Form Plugin allows you to easily and unobtrusively upgrade HTML forms to use AJAX. The main methods, ajaxForm and ajaxSubmit, gather information from the form element to determine how to manage the submit process. Both of these methods support numerous options which allows you to have full control over how the data is submitted. Submitting a form with AJAX doesn't get any easier than this!

15. Foswiki (active)

This is plugin takes care of loading the jQuery core and default plugins and performs any initialization steps specific to Foswiki, For instance, it reads all <meta> tags from the html head as they have been set by Foswiki and constructs the foswiki javascript object to be used by other javascript plugins.

In addition it adds some basic Foswiki tags to make life easier using jQuery plugins, most notably %JQREQUIRE{"pluginName"}% to load a subsequent jQuery plugin and all of its dependencies, taking care where and how it is added to the html page.

Curent default plugins are: jquery.easing, jquery.metadata, jquery.bgiframe, jquery.hoverIntent

16. hoverIntent

hoverIntent is similar to jQuery's built-in "hover" function except that instead of firing the onMouseOver event immediately, hoverIntent checks to see if the user's mouse has slowed down (beneath the sensitivity threshold) before firing the onMouseOver event.

17. I18N

This plugin tries to be the simplest possible solution to add internationalization to javascript. It only does message translation reading translations from the backend. It does not cover dates, numbers, gender or pluralization.

18. ImagesLoaded

19. InnerFade

InnerFade is a small plugin for the jQuery-JavaScript-Library. It's designed to fade you any element inside a container in and out. These elements could be anything you want, e.g. images, list-items, divs. Simply produce your own slideshow for your portfolio or advertisings. Create a newsticker or do an animation.

20. JEditable

The JQuery "JEditable" plugin, packaged for use in Foswiki

21. JsonRpc

22. LiveQuery

Live Query utilizes the power of jQuery selectors by firing callbacks for matched elements auto-magically, even after the page has been loaded and the DOM updated.

23. Loader

This plugin allows to reload parts of a page, either automatically or manually.

24. LocalScroll

This plugin will animate a regular anchor navigation. It will allow your visitors to navigate your site with a smooth scrolling effect.

Each time a link is clicked, the element you decide(can be the whole screen), will gradually scroll to the targeted element, instead of "jumping" as it'd normally do. JQueryScrollTo is used for the animation.

25. MaskedInput

This is a masked input plugin for the jQuery javascript library. It allows a user to more easily enter fixed width input where you would like them to enter the data in a certain format (dates,phone numbers, etc). It has been tested on Internet Explorer, Firefox, Safari, Opera, and Chrome. A mask is defined by a format made up of mask literals and mask definitions. Any character not in the definitions list below is considered a mask literal. Mask literals will be automatically entered for the user as they type and will not be able to be removed by the user.The following mask definitions are predefined:

  • a - Represents an alpha character (A-Z,a-z)
  • 9 - Represents a numeric character (0-9)
  • * - Represents an alphanumeric character (A-Z,a-z,0-9)

26. Masonry

Masonry is a JavaScript grid layout library. It works by placing elements in optimal position based on available vertical space, sort of like a mason fitting stones in a wall. You've probably seen it in use all over the Internet.

27. Metadata (active)

This plugin is capable of extracting metadata from classes, random attributes, and child elements.

28. Migrate (active)

This plugin can be used to detect and restore APIs, features or functionality that have been deprecated in jQuery and removed as of version 1.9. They include:

  • jQuery.browser docs
  • jQuery.fn.andSelf() docs
  • jQuery.sub() docs
  • jQuery.fn.toggle() docs (event click signature only)
  • "hover" pseudo-event name docs
  • jQuery.fn.error() docs
  • ajaxStart, ajaxSend, ajaxSuccess, ajaxError, ajaxComplete, ajaxStop global events on non-document targets docs
  • Use of attrChange, attrName, relatedNode, srcElement on the Event object (use Event.originalEvent.attrChange etc. instead)
  • jQuery.fn.attr() using the pass argument (undocumented)
  • jQuery.attrFn object (undocumented)
  • jQuery.fn.data() data events (undocumented)
  • jQuery.fn.data("events") to retrieve event-related data (undocumented)

See the warnings page for more information regarding messages the plugin generates.

Use %JQREQUIRE{"migrate"}% to load the plugin into the page.

The plugin can be included with versions of jQuery as old as 1.6.4 as a migration tool to identify potential upgrade issues. However, the plugin is only required for version 1.9 or higher to restore deprecated and removed functionality.

See the Upgrade guide for more information.

29. MouseWheel

30. NatEdit

The NatEdit is an wiki editor that helps in learning the TML Language by providing a GUI. By design, this is not a wysiwyg editor that tries to generate the correct TML in the background. Instead, the user is still in charge of writing correct wiki markup but with a bit more of assistance as a plain browser textarea. Therefor this editor helps to lower the learning curve but will not get in your way once you are aware of wiki markup.

31. Placeholder

Creates a 'hint' or 'example' text in a textfield that disappears when the field has focus or has custom input text.

32. PNotify

Full featured plugin to show temporary floating messages for status updates, actions and errors.

33. PopUpWindow (active)

Open a page in a new window.

34. QueryObject

This extension creates a singleton query string object for quick and readable query string modification and creation. This plugin provides a simple way of taking a page's query string and creating a modified version of this with little code.

35. Render

This plugin brings modern template based javascript apps to Foswiki based on the libraries by Boris Moore. It is intended to supersede jquery.tmpl. JsRender is a light-weight but powerful templating engine, highly extensible, and optimized for high-performance pure string-based rendering, without DOM or jQuery dependency.

36. ScrollTo

With this plugin, you will easily scroll overflowed elements, and the screen itself. It gives you access to many different options to customize and various ways to specify where to scroll.

See also JQuerySerialScroll, JQueryLocalScroll

37. SerialScroll

This plugin allows you to easily animate any series of elements, by sequentially scrolling them. It uses JQueryScrollTo to achieve the scrolling animation.

38. ShrinkUrls

Shrinks all urls in a given container whose link text exceeds a given size and have no white spaces in it, that is don't wrap around nicely. If the text is skrunk, the original text is appended to the title attribute of the anchor.

39. Slimbox

Show images in a lightbox. Slimbox 2 is a 4 KB visual clone of the popular Lightbox 2 script by Lokesh Dhakar, written using the jQuery javascript library. It was designed to be very small, efficient, standards-friendly, fully customizable, more convenient and 100% compatible with the original Lightbox 2.

40. Sprintf

41. Stars

Flexible and non-obstructive star rating. This plugin turns an HTML <input> element into a star rating widget. The design is heavily influenced by System.JQueryRating by Fyneworks.com bit requries considerably less HTML markup which is of advantage with high precision ratings.

Features:

  • arbitrary number of stars
  • arbitrary precision of star rating by splitting each star
  • mouse wheel support
  • non-obstructive integration using CSS and HTML5

42. Subscribe

43. Superfish

Superfish is an enhanced Suckerfish-style menu jQuery plugin that takes an existing pure CSS drop-down menu (so it degrades gracefully without JavaScript). Features:
  • Suckerfish-style hover support for IE6. The class added is sfHover by default but can be changed via the options object,
  • Timed delay on mouseout to be more forgiving of mouse-piloting errors. Default is 800 milliseconds but can be changed via the options object
  • Animation of sub-menu reveal. uses a fade-in by default but can be given a custom object to be used in the first argument of the animate function. The animation speed is also customisable but is set to ?normal? by default
  • Keyboard accessibility. Tab through the links and the relevant sub-menus are revealed and hidden as needed
  • Supports the hoverIntent plugin. Superfish automatically detects the presence of Brian Cherne?s hoverIntent plugin and uses its advanced hover behaviour for the mouseovers (mouseout delays are handled by Superfish regardless of the presence of hoverIntent). Using this is only an option, but a nice one. The examples on this page are using hoverIntent. If for some reason you want to use hoverIntent on your page for other plugins but do not want Superfish to use it you can set the option disableHI to true.
  • Indicates the presence of sub-menus by automatically adding arrow images to relevant anchors. Arrows are fully customisable via CSS. You can turn off auto-generation of the arrow mark-up via the ?autoArrows? option if required.
  • drop shadows for capable browsers ? degrades gracefully for Internet Explorer 6. Can disable shadows completely via options object.
  • Can show the path to your current page while the menu is idle. The easiest way to understand this is to view the nav-bar example.
  • Optional callback functions. The 'this' keyword within the handlers you attach will refer to the animated ul sub-menu. From version 1.4 there are now three other optional callbacks allowing for further enhancements and functionality to be added without needing to alter the core Superfish code.

44. Supersubs

This is a companion plugin to superfish. It resizes superfish submenus to fit their contents.

45. Tabpane

This implements an alternative tabpane widget. There is already one in jquery-ui, however as long as jquery-ui is still in flux, this alternative offers a safe substitute well integrated into Foswiki.

Individual tabs can be loaded on demand using a REST call. Installing Foswiki:Extensions/RenderPlugin is recommended for that.

Tabpanes can be nested. Tabs can be extended in height automatically. Heights can be auto-updated to follow windows resize events. Tabpanes can be established as part of reloaded content via ajax.

Note that this widget does not participate in jquery-ui themerolling. It does match JQueryButton in terms of look & feel.

46. TextboxList

Turns a text input into a list widget with autocompletion. This plugin adds a new formfield type textboxlist to DataForms.

47. TinyMCE

48. Treeview

Lightweight and flexible transformation of an unordered list into an expandable and collapsable tree, great for unobtrusive navigation enhancements. Supports both location and cookie based persistence.

Subtrees can be loaded on demand using AJAX. See the Foswiki:Extensions/RenderPlugin how to implement such REST handlers easily.

49. Twisty

50. UI

Widget collection for jQuery. This is the official user interface library.

51. UI::Accordion

52. UI::Autocomplete

Autocomplete, when added to an input field, enables users to quickly find and select from a pre-populated list of values as they type, leveraging searching and filtering.

By giving an Autocomplete field focus or entering something into it, the plugin starts searching for entries that match and displays a list of values to choose from. By entering more characters, the user can filter down the list to better matches.

53. UI::Button

54. UI::Datepicker

55. UI::Dialog

A dialog is a floating window that contains a title bar and a content area. The dialog window can be moved, resized and closed with the 'x' icon by default.

If the content length exceeds the maximum height, a scrollbar will automatically appear.

A bottom button bar and semi-transparent modal overlay layer are common options that can be added.

A call to $(foo).dialog() will initialize a dialog instance and will auto-open the dialog by default. If you want to reuse a dialog, the easiest way is to disable the "auto-open" option with: $(foo).dialog({ autoOpen: false }) and open it with $(foo).dialog('open'). To close it, use $(foo).dialog('close').

56. UI::Draggable

57. UI::Progressbar

58. UI::Resizable

59. UI::Slider

60. UI::Spinner

61. UI::Tabs

62. UI::Tooltip

63. Validate

Very powerful client-side form validation framework (article).

64. WikiWord

This plugin allows to create a WikiWord on the base of a set of input elements. The value of these are concatenated and the result is normalized to be a valid WikiWord. For example, this can be used to derive a topic name from a free-form topic title text.

Using compressed javascript and css files

All jQuery plugins are shipped with uncompressed js and css files, as well as minified and gzip compressed. For instance the jquery.form plugin comes with the following set:

  1. /foswiki/pub/System/JQueryPlugin/plugins/form/jquery.form.uncompressed.js
  2. /foswiki/pub/System/JQueryPlugin/plugins/form/jquery.form.js
  3. /foswiki/pub/System/JQueryPlugin/plugins/form/jquery.form.js.gz

There is a Makefile in the /foswiki/pub/System/JQueryPlugin root directory that ensures all these files are up to date. By default all files in the JQueryPlugin package are up to date, so you only have to issue a make in the root directory if you wish to modify one of the files underneath. This will update all minified and gzipped files as required. Enable the {JQueryPlugin}{Debug} flag in configure, to use the uncompressed files right away to omit the make step during development of new javascript components.

Apache can be configured to automatically use the .gz files if present using mod_rewrite as follows:
  <FilesMatch ".*\.(js|css)$">
    RewriteEngine On
    RewriteCond %{HTTP:Accept-encoding} gzip
    RewriteCond %{REQUEST_FILENAME}.gz -f
    RewriteRule ^(.*)$ %{REQUEST_URI}.gz [L,QSA]
  </FilesMatch>

  <Files *.js.gz>
    AddEncoding gzip .js
    ForceType application/x-javascript
  </Files>

  <Files *.css.gz>
    AddEncoding gzip .css
    ForceType text/css
  </Files>

So whenever the browser accepts encoding the file as gzip and the file with the .gz exists in the filesystem, then there will be an internal redirect in the server while still enforcing the original mime-type. The browser on the client side will unzip the css and js files automatically. This will drastically reduce bandwidth and speed up interactive performance.

Installation Instructions

You do not need to install anything in the browser to use this extension. The following instructions are for the administrator who installs the extension on the server.

Open configure, and open the "Extensions" section. "Extensions Operation and Maintenance" Tab -> "Install, Update or Remove extensions" Tab. Click the "Search for Extensions" button. Enter part of the extension name or description and press search. Select the desired extension(s) and click install. If an extension is already installed, it will not show up in the search results.

You can also install from the shell by running the extension installer as the web server user: (Be sure to run as the webserver user, not as root!)
cd /path/to/foswiki
perl tools/extension_installer <NameOfExtension> install

If you have any problems, or if the extension isn't available in configure, then you can still install manually from the command-line. See https://foswiki.org/Support/ManuallyInstallingExtensions for more help.

ALERT! For Foswiki versions before 1.1, this plugin requires the Foswiki:Extensions.ZonePlugin to be installed. The ZonePlugin is not required for Foswiki 1.1 or later.

Dependencies

NameVersionDescription
JSON>=0Required
Foswiki::Plugins::ZonePlugin>=3.1Required. required for Foswiki < 1.1

Change History

26 Apr 2023: (10.51) - Item15190: fixed potential XSS vulnerability in jQuery-2
19 Jan 2023: (10.50) - Item15181: update to jquery-3.6.3, remove previous jquery-3.x packages
15 Jul 2022: (10.41) - Item15157: updated to jquery.validate 1.19.5 - Item15158: updated to jquery-ui 1.13.2
07 Jul 2022: (10.40) - Item15155: added foswiki.spaceOutWikiWord() to javascript API
25 Apr 2022: (10.23) - Item15081: handle hash changes for own tabpane only
05 Apr 2022: (10.22) - Item15077: fixed tabpane api to show/hide tabs
22 Feb 2022: (10.21) - Item15061: rating field is not mergeable; - Item15067: patch z-index issue in jquery-ui dialogs; - Item15068: don't bubble up jquery.loader events
21 Jan 2022: (10.20) - Item15061: upgraded to jquery-ui-1.13.1
05 Jan 2022: (10.10) - Item15058: script tags of javascrit i18n should not use src attribute; - Item15060: added validation rule for the foswikiMandatory css class
09 Jul 2021: (10.02) - Item15033: updated jquery.validate
02 Jun 2021: (10.01) - Item15027: fixed events emitted by jquery.loader; added jquery-3.6.0; prevent csso from restructuring css too much
28 Sep 2020: (10.00) - Item14918: removed support for old Internet Exporers (IE<11)
18 Nov 2019: (9.20) - Item14874: deprecate uglify-js and yuicompressor in favor of terser
- Item14875: remove type/javascript and type/css as per html5; fixes to jquery ajax helpers when no results were found; fixes for perl critiques; added html5 data support for %BUTTON; remove explicit and useless dependency on livequery; added BUILD_DIR, LIB_DIR and SRC_DIR support in Makefile system; removed babel tools from Makefile system; fixed wikiword regex; improved loader plugin to make it more usable; upgraded third party plugins images-loaded and masonry
02 May 2019: (9.10) - Item14837: updated animate.css
Item14838: added remember parameter to tabpane
Item14839: fix default value in textboxlist formfields
Item14840: fix tooltip position in draggable elements
10 Jan 2019: (9.00) - Item14767: implement a proper icon service
01 Oct 2018: (8.11) - Item14762: fixed jquery.loader not clearing timeouts properly
20 Jun 2018: (8.10) - Item14564: added jquery-3 and the matching migrate module
Item14567: added keyboard navigation to jquery.stars
Item14568: added chili recipes for autolisp and ini
Item14569: deprecated jquery.placeholder
Item14571: added manual sorting mode to textboxlist
Item14572: upgraded jquery.livequery
Item14454: added jsview in addition to jsrender
Item14721: fixed loading of language files for jquery.i18n
Item14722: added jquery.browser as a separate module
Item14723: upgraded jquery.sprintf
Item14724: enhance Makefile system to support sass and babel
Item14727: improve locale support of datepicker
Item14728: send an "opened" event to the jqUIDialogLink once the ui-dialog opened
Item14660: fixed missing tab id causing a javascript error Item14735: use animate.css for jquery.loader effects instead of jQuery's own ones
23 Feb 2018: (7.26) - Item14636: fixed javascript api for jquery.wikiword
11 Dec 2017: (7.25) - Item14565: bundle jquery.validate js files into one
Item14566: don't cache a null result in foswiki.getPreference()
Item14570: added "use strict" to farbtastic's init and fix js errors
Item14573: fixed auto-height calculation of tabpane
Item14584: jquery.wikiword changed interpretation of source parameter in a incompatible way.
8 Dec 2017: (7.24) - Released with Foswiki 2.1.5
Item14518: JQueryPlugin should warn configure if an older version of jquery is selected.
Item14555: make build work with latest uglifyjs 3.
Item14559: regression via Item13898 - broken topic selectors.
Item14560: wikiword changes don't trigger a change event on the target element.
4 May 2017: (7.23) - Item14372: JQueryPlugin ui-draggable got dropped from Config.spec.
8 Feb 2017: (7.22) - Item14312: don't destroy dialogs on close.
23 Jan 2017: (7.21) - Item14281: Cookie related changes. Inconsistent use of the domain and secure flags.
12 Dec 2016: (7.20) - Item10918: Improve javascript api to address individual tabs.
- Item14172: jquery.stars width incorrect in modal dialogs.
- Item14173: Invalid call foswiki.getScriptUrl() in foswiki.getPreference().
- Item14226: Performance improvements to $.i18n().
- Item14227: Potential use of uninitialized value in a rating formfield.
- Item14228: Upgrade JQueryPlugin to blockui 2.70.
- Item14229: Upgrade JQueryPlugin to jsrender 0.9.83.
- Item14230: jquery.maskedinput initializer does not match documentation.
- Item14250: wait for images by default in jquery.masonry.
- Item14251: Remove non-functional caching of dialogs loaded via ajax.
06 Sep 2016: (7.10) - Item14121: reimplement jquery.stars using SVGs now;
- Item14120: remove outdate compression tools;
- Item13206: upgrade to jquery-ui; added jQuery-1.12.4 / jQuery-2.2.4;
- Item14122: upgrade to fontawesome 4.6.3;
- Item14123: fixed foswiki.getPubUrlPath() using an uninitialized parameter;
- Item14124: make skin of a jquery.loader backend configurable;
- Item14171: fix encoding of error message in jquery.render
10 Apr 2016: (7.04) - Item14042: it's jquery-1.12.3 not jquey-1.12.3
06 Apr 2016: (7.03) - Item14042: added jQuery-1.12.3 / jQuery-2.2.3
04 Apr 2016: (7.02) - Item14024: fix issue with JSON::XS 3.02 in some environments
18 Mar 2016: (7.01) - added jQery-1.12.2 / jQuery-2.2.2; fixed textboxlist loosing tags with leading or trailing spaces; updated imagesLoaded
23 Feb 2016: (7.00) - modernized button module again; removed outdated jQuery versions; deprecated bgiframe and media modules; updated jquery.form, localScroll, scrollTo, sericalScroll, masonry, jquery.migrate, queryObject, jsrender, sprintf, fontawesome, jquery.stars, superfish, jquery.tabpane to latest versions; externalized imagesLoaded from masonry; do a deep merge gathering foswikiPreferences from the header; added new jquery.i18n module for client-side translations
03 Feb 2016: (6.32) - Item13898: Jumpbox example in JQueryAjaxHelper is not working
Item12560: Split NameFilter into AttachmentNameFilter
Item13854: Set ALLOWTOPICVIEW=* in critical system topics. Foswiki 1.1.x Requires compatibility patches, or Foswiki 1.1.10
06 Nov 2015: (6.31) - Item13832: Filter the "effect" URLPARAM of JQueryLoader.
24 Sep 2015: (6.30) - reworked the way how preferences are propagated from backend to javascript not to use unsafe inline scripts anymore
04 Sep 2015: (6.20) - improvements to jquery.wikiword, jquery.loader; adding html5-data capabilities to plugin initialization; added jquery-1.11.3 and jquery-2.1.4
16 Jun 2015: (6.13) - Item13460: JQICON fails to render FontAwesome icons.
30 Apr 2015: (6.11) - Item13389: datepicker initializaiton problem; datepicker z-index problem; pushy tooltips not hidden when typing into an input field; error in jquery.foswiki api getPubUrlPath
23 Feb 2015: (6.10) - Item13272: upgraded superfish and hoverintent, deprecated subpersubs
12 Jan 2015: (6.01) - Item13205: added jquery-1.11.2 and jquery-2.1.3
29 Nov 2014: (6.01) - Item13123: Add PLACEHOLDER parameter to JQueryAjaxHelper topic selector.
25 Sep 2014: (6.00) - Item13030: deprecate jquery.tmpl; added jsrender and a template loader
06 Jun 2014: (5.11) - Item12933: make filtered characters configurable in JQueryWikiWord
21 Feb 2014: (5.10) - Item12734: added jQuery-1.11, jQuery-2.10, jquery-ui-1.10.4; reverted patch to jquery.ui.tooltip; reapplied patch to jquery.ui.draggable preventing hopping modal dialogs and such; fix hopping position of hepler element in jquery.ui.sortable; now defaulting to the latest jQuery version
11 Dec 2013: (5.00) - new modules fontawesome, ui::spinner; upgraded slimbox and media module; improvements to foswiki theme for jquery-ui; modernize button module; fixed dependencies of wikiword module; new tmpl REST handler to load jquery templates asynchronously
08 Nov 2013: (4.91) - Release with Foswiki 1.1.9 Item12650: Add config error for removed Themeswitcher plugin
23 Oct 2013: (4.90) - Item12567: fix checking of version number in configure Item12577: deprecate jquery-tooltip in favour of jquery-ui-tooltip Item12596: improve documentation of jquery-ui Item12583: revert version string to simple float not to break installation on RHEL and SLES Item12599: use jQuery-1.9x (not 2.0.x) for IE9 Item12600: various minor changes to jquery components
12 Oct 2013: (4.83) - Item12567: fix version check in configure (not released)
07 Jun 2013: (4.82) - Item12528: fixed char mapping in jquery.wikiword
31 May 2013: (4.81) - Item12520: added jquery-1.10.1 and jquery-2.0.2
30 May 2013: (4.80) - Item12519: upgraded superfish, supersubs and hoverintent
29 May 2013: (4.70) - Item12345: added jquery-1.9.1, jquery-1.10.0, jquery-2.0.0, jquery-2.0.1; removed themeswitcher as it isn't supported and non-functional anymore; upgraded to jquery-ui-1.10.3; upgraded form, rating, masonry, blockui, scrollto; removed warning in configure about chilli
15 Jan 2013: (4.60) - Item12345: added jquery-1.8.3, upgraded pnotify, masonry, scrollto, form, blockui, cycle
11 Dec 2012: (4.50) - Item12229: improved transliteration of unicode characters in jquery.wikiword
28 Nov 2012: (4.45) - Release with Foswiki 1.1.6
Item12192: Fix some layout issues
Item12214: default jquery-ui theme overrides manual JQTHEME choice.
Item12215: Hide JQLoader using CSS.
26 Oct 2012: Item12195: Default jquery version is jquery-1.8.2 now
24 Oct 2012: Item12190: Chili enabled by default, warning demoted to a note.
17 Oct 2012: (4.44) - Item12048: upgraded to jquery-ui-1.8.23; added jquery-1.8.2
11 Jul 2012: (4.43) - Item11993: upgraded JQueryLiveQuery to 1.3.1 ; reworked documentation and examples;
Item11175: upgrade JQueryValidate to 1.9.0;
Item11994: upgraded JQueryUI to 1.8.21
09 Jul 2012: (4.42) - Item11742: removed all jquery prior to 1.7.1
01 Jun 2012: (4.42) - Item11917: simplemodal updated to 1.4.2. fixed upstream bug computing dialog heights
23 May 2012: (4.41) - Item11889: added means to hide the close button on textboxlist values; docu improvements to textboxlixst and pnotify
10 Apr 2012: (4.40) - Item11397, Item11742: use a JSON instead of <meta> to export preferences to javascript; added jquery-1.7.2 (new default); deprecate all jquery versions prior to 1.7.1 improve docu and integration of scrollto and serialscroll; removed deprecated foswiki.web, foswiki.topic etc properties
06 Apr 2012: (4.33) - Item11511, Item11512: Minor changes to improve JSON output and Javascript validations.
Item11685: deprecate simmplemodal, replace by jquery.ui.dialog.
Item11654: JQueryTmpl is discontinued upstream.
Item11383: Document jqUIDialogSubmit.
Item10383: JQuerySimpleModal sample window isn't displayed properly.
20 Dec 2011: (4.32) - re-release Foswiki 1.1.4 - Item11335 revert spinner changes, Item11371 - close suggestions list.
12 Dec 2011: (4.31) - Foswiki 1.1.4 Release. Item11335 JQueryAjaxHelper examples don't work reliably.
22 Nov 2011: (4.30) added jquery-1.7 and jquery-1.7.1; added jquery.loader to ease loading sections asynchronously
3 Dec 2011: (4.22) Incremented version for Foswiki 1.1.4 release. Minor code and documentation cleanup.
22 Nov 2011: (4.21) added config warnings for the deprecated JQuery plugins; and a warining for Chili highlighter corruption; fixed jquery.chili to allow other non-recipe css classes in verbatim sections; fixed jquery.cookie to return undefined instead of an empty Object when asking for an unknown cookie; fixed JQueryAjaxHelper's users backend to return users and groups improved jquery-ui-dialog integration
26 Oct 2011: fixing compatibility of jquery.media with newer jqueries; fixed placement of jquery.tooltips when viewport at right bottom; fixed jquery.superfish's index related to jquery.ui.dialog's; improved jquery.button click usability; improved and documented integration of jquery.ui.dialog; fixed jquery.ui.resizable to init array objects correctly
08 Sep 2011: (4.20) added perl api to make ui themes pluggable; upgrade to jquery-ui 1.8.16, masked-input 1.3, masonry 2.0, textboxlist 1.0, validate 1.8.1, cycle 2.9995, bgiframe 2.1.2, blockUI 2.39, corner 2.12, gradient 1.0, autocomplete 1.2.2, form 2.80; upgraded all jquery-ui themes to match the latest version; deprecated abandoned jquery.autocomplete in favor of jquery-ui's autocomplete; added modules ui::accordion, ui::autocomplete, ui::button, ui::datepicker, ui::dialog, ui::draggable, ui::progressbar, ui::resizable, ui::slider, ui::tabs; improved rating formfield to display the actual value as well, not only the stars; added initializer for jquery.validate; improved initializer for simplemodals to make them draggable and resizable; fixed css of treeview, autocomplete, tabpane, button; new foswiki jquery-ui theme; added jquery-1.6.2 and jquery-1.6.3; improved docu of jquery.cycle, jquery.masonry, jquery.validate
20 Jun 2011: (4.11) Fix "Use of uninitialized" in textboxlist
25 May 2011: (4.10) Added JQueryPlaceholder; Updated jquery.autocomplete to work around Firefox 4 problem breaking up/down arrow keys in edit fields; Added jquery.tmpl; Updated jquery.metadata to support html5 attributes; Updated jquery.validate to 1.8.0; Added jquery-1.5.[0-2] and jquery-1.6.1; Implemented history support for jquery.tabpane; Updated jquery.media and added more skins to the swf player; Fixed jquery.shake to work with elements positioned relatively; Adding context variables for all enabled jQuery modules;
11 Apr 2011: (4.03) jQuery default corrected to be 1.4.3. Fixed syntax for accessing meta variables. Improved iterating hash. Updated forms jq plugin from 2.25 to 2.43. Removed useless BOM code from blockUI. Compress using utf8 encoding by default This version is shipping with Foswiki 1.1.3
21 Feb 2011: (4.02) cleaned up and documented the process for adding new plugins
02 Feb 2011: (4.01) added pnotify, configure checker to check that configured {JQueryVersion} is sane
13 Dec 2010: (4.00) adding jquery-1.4.2/3/4 (default is 1.4.3); removing jquery-1.2.6, deprecating jquery-1.3.x (incompatible with shipped jquery-ui); upgraded to jquery-ui 1.8.5 (needs jquery-1.4+); upgraded jquery-cookie; added themeswitcher; fixed spinner in autocomplete; various fixes to jquery.tooltip; improved tooltip themes (added blackbox theme); fixed rating formfield; improved printout of tabpanes; added new jquery-ui theme flickr; updated forms plugin to 2.49 to improve jQuery 1.4 compatibility
27 Oct 2010: (3.75) fixed IE error in chili recipe for TML
19 Oct 2010: (3.74) Version included with Foswiki 1.1.0 + fix for code bug in SLIMBOX causing ImageGalleryPlugin to fail
19 Aug 2010: (3.71) JQueryLiveQuery now loads by default; removed JQueryBgiframe and JQueryEasing plugins from default plugins
02 Jul 2010: (3.70) removed outdated spinner and ifixpng plugins; improved documentation; fixed IE error in treeview; added post method to async mode of treeview; moved %CLEAR to %SYSTEM.DefaultPreferences
28 May 2010: (3.60) removed pointless TOGGLE module; reworked handling of meta tags by merging foswikilibs.js with jquery.foswiki module; fixed IE7 error with floats inside tabpanes; added ajax handler to query foswiki preferences async-ly
30 Apr 2010: (3.51) fixed initial classes of click-areas in treeviews
29 Mar 2010: (3.42) disable plugin when prerequisites are not met
28 Mar 2010: (3.41) fix ZonePlugin listed as optional dependency (not optional for Foswiki 1.0.x installations)
26 Mar 2010: (3.40) externalized grid and fullcalendar modules into plugins of their own; upgraded to jquery-ui 1.7.2; only load i18n support matching the current site language
20 Mar 2010: (3.31) Minifier CPAN libs removed from plugin. They will be in core CPAN lib in Foswiki 1.1
14 Mar 2010: (3.30) upgraded validate to v1.7; added wikiword validation method; fixed computation of line-height in fluidfont; fixed height issue in tabpane
03 Mar 2010: made ZonePlugin an optional dependency
01 Mar 2010: improved js and css compression using yuicompressor; improved simplemodal integration to foswiki to create modal dialogs with less additional javascript; added custom events to textboxlist: AddValue, DeleteValue , Reset and Clear
12 Feb 2010: added livequery and rewrote all initializers to use it; added rating formfield type; updated jqGrid to latest version; improved foswiki integration and documentation of various plugins; upgraded jwplayer coming with media plugin; using Foswiki:Extensions/ZonePlugin now to optimize page load time
08 Feb 2010: added query-object
28 Jan 2010: added jquery-1.4.1, corner, fluidfont, fullcalendar, localscroll, masonry, scrollto, serialscroll, slimbox; deprecated jquery.nifty; disabled JQSCRIPT and JQSTYLE
11 Nov 2009: added jqGrid library; reorganized documentation
07 Nov 2009: updated Superfish to 1.4.8 and added examples topic, added supersubs plugin, moved JQuery examples from Sandbox to System
29 Oct 2009: added SCRIPTSUFFIX to foswiki var set (CDot)
14 Sep 2009: added perls tubs for jquery.ui, so that you can pull it in via JQREQUIRE now; reworked plugin initialization to allow elements to be init'ed when loaded via ajax; fixed BUTTON to play nicely with TwistyPlugin; only load ui-theme if you jqrequire the ui library
20 Aug 2009: made JQueryPlugin SafeWikiPlugin compatible
02 Jul 2009: improved parsing of foswiki meta tags in html header; fixed jqTreeview initialisation for jquery-1.3.x; fixed chili initialisation; dropped support for konqueror3
23 Jun 2009: added jquery.focus, jquery.textboxlist, jquery.farbtastic; jquery.gradient; added color and textboxlist formfield types; made JQueryPlugin pluggable itself; added animation switching tabs; improved automaxexpand feature in tabs
28 Apr 2009: added jquery.media, jquery.simplemodal, shell highlightning for chilli
03 Feb 2009: fixed tabpane not being rendered using a rest handler; added id to tabs that can be used to init the first active one; added compressed version of blockUI; replaced ICONTOPIC preference variable with ICONSEARCHPATH to search for icons in multiple directories (defaults to all of FamFamFamContrib)
15 Jan 2009: fixed click target for relative urls in %BUTTON{}%; yet another jquery.wikiword fix
13 Jan 2009: fixed jquery.wikiword not to depend on outside string libraries; added foswiki alias to global javascript variables (Eugen Mayer)
08 Jan 2009: certified for foswiki/compat; fixed BUTTON target for non-wikiword topics
12 Dec 2008: fixed a series of IE6+IE7 issues
18 Nov 2008: added jquery.ifixpng; improved BUTTON tag to have submit and clear and reset buttons; ie6 fixes for BUTTONs; added missing jquery.wikiword plugin
13 Nov 2008: added automaxexpand for TABPANES ; added jquery.shake plugin; reworked BUTTON tag
15 Oct 2008: added jquery.autocomplete, jquery.cycle
20 Jul 2008: added jquery.form, jquery.maskedinput, jquery.validate
15 Jul 2008: updated to ui-1.5.2; added async treeview; added async options to tabpane
03 Jul 2008: updated to ui-1.5.1
05 Jun 2008: updated to jquery-1.2.6 and ui-1.5-RC1
30 Apr 2008: repackaged to contain jquery UI
13 Feb 2008: upgrade to jquery-1.2.3, as well as most plugins
17 Jan 2008: added jquery.metadata plugin; implemented a jquery.tabpane plugin; updated jquery.dimensions plugin; added jquery.empty plugin to ease development of new plugins
15 Nov 2007: use skin independent way to add javascript files to header
10 Oct 2007: upgraded to jQuery-1.1.4; compressed js and css
12 Jul 2007: initial package containing jQuery-1.1.3.1