merge+pack Hyphenator logo

Hyphenator.js automatically loads language pattern files. This is convenient but not performant, since at minimum two http-requests are necessary.
This page provides a service to merge the script and the language patterns in one file. You may also set the configure parameters and minify the resulting script.

Since this page uses XMLHttpRequests to load the script and pattern files, it will not work if you call it with the file:// protocol. Instead put it on your server or go to http://code.google.com/p/hyphenator/.

The script loads the version of Hyphenator.js that resides in the same directory like this page.

Languages

Select the language you use on your website. The patterns of the selected languages will be included in the ouputted script for faster page loading. If you select no language, make sure that "enable remote loading" is on (see below)!

Configuration

Make the settings for Hyphenator. Leave empty textfields empty for the default value to be set. If no special configuration is made, there will be no Hyphenator.config(); function in the output.

Show-Info Button

A value lesser than 4 makes no sense. By increasing this value lesser words will be hyphenated, thus, there's a small speed gain.

Show-Info Button

By enabling remote loading Hyphenator will automatically load language patterns of supported languages when they are needed.
If you turn off remote loading Hyphenator only hyphenates texts in languages it has the patterns for. Make sure you have them selected!

Show-Info Button

Once a word is hyphenated it is cached, thus a word has only to be hyphenated once. You can turn this mechanism off – mainly for performance-measuring.

Show-Info Button

Since Javascript is executed after the page is loaded, the user may see the unhyphenated text for a short time befor it is hyphenated and redrawn. To prevent this all textblocks treated by Hyphenator are set to invisible upon hyphenation (setting: "hidden"). The result is, that only hyphenated text is displayed.
On the other hand – if there's an error in the execution of Hyphenator.js – the text may stay invisible. Turn hiding off for debugging or if you prefer to see the redrawing of the text (setting: "visible").
Element Selection

Indicate how to get the elements for hyphenation:

Show-Info Button
Show-Info Button

Using this method Hyphenator.js searches the DOM for elements with the indicated classname. Note: an element can have multiple classnames; separate them with spaces (e.g. <div class="content hyphenate">)
If you want to have more control over the element selection you may define your own selector function. It has to return an array of elements to be hyphenated. Specifially if you use a JavaScript-Framework, this may be very interesting…

Indicate a classname for elements that should NOT be hyphenated:
Show-Info Button

You can turn off hyphenation for elements with the indicated classname. (Note: The following elements are never hyphenated: script, code, pre, img, br, samp, kbd, var, abbr, acronym, sub, sup, button, option, label, textarea)
Toggle Box

Indicate how the Togglebox should be displayed:

Show-Info Button

The standard togglebox is a small button in the upper right corner of the page. By clicking on it, the user can turn off/on hyphenation. This is useful for copying or searching text on the site.
Since the standard togglebox may interfere with the design of your page, you can define it on your own.


Special Settings

Show-Info Button

This function is called, when hyphenation of a page is completed.

Show-Info Button

Most errors are catched and catched errors dipatch the onerror function. By default there's an alert with a predefined text. You can change this function.
Minify

By minifying the resulting script you can save some bandwith. This page uses the JavaScript-Version of jsmin since it's easy to run on a webpage. You may achieve better results if you pack the resulting script with other minifiers/packers such as YUI Compressor or Dean Edwards' packer.


Copy the merged and packed script from the output field as is to a new text-file give it a name (e.g. "hyphenate.js") and include it in your website (<script src="hyphenate.js" type="text/javascript"><script>).
It will run automatically.

Note: You are not allowed to remove the licensing at the beginning of the script!