<commit_before># Lectric Slider

Lectric is a JavaScript slider that is touch-enabled and takes advantage of hardware acceleration. It looks awesome on Apple touch devices. You can see an early version of this software implemented on [mckinney.com](http://mckinney.com).

It's Electric!

**Requires:** [jQuery](http://github.com/jquery/jquery)

## Installation

Put this in your `<head>`:
    
    <link href="/path/to/css/lectric.css" rel="stylesheet" type="text/css" media="screen">

    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js" type="text/javascript"></script>
    <script src="/path/to/js/lectric.js" type="text/javascript"></script>

## Usage

HTML:

    <div id="slider">
      <div class="item">Hello world</div>
      <div class="item">Hello world</div>
      <div class="item">Hello world</div>
      <div class="item">Hello world</div>
    </div>

JavaScript:

    var slider = new Lectric.Slider();
    slider.init('#slider');

## Optional Parameters

You can specify a few extra parameters when you call the `init` method. Those include:

- `next` *(selector)*: Next button
- `previous` *(selector)*: Previous button
- `limitLeft` *(boolean)*: Prohibits the slider from moving left
- `limitRight` *(boolean)*: Prohibits the slider from moving right
- `itemClassName` *(string)*: Class name of the individual pages of the slider
- `itemWrapperClassName` *(string)*: Class name of the container that wraps all items
- `animateEasing` *(string)*: A string indicating which easing function to use for the transition (non-mobile only).
- `animateDuration` *(integer or string)*: A string (e.g. "fast" or "slow") or number (in milliseconds) determining how long a slide animation will run.
- `hooks` *(map)*: Map of callback functions that should be subscribed to the various hooks (see next section for more about hooks)
- `tossFunction` *(function)*: A function to use for calculating the distance (from the touchend point) the slider should be tossed.

For example, let's provide a slider with next/previous buttons:

    var slider = new Lectric.Slider();
    slider.init('#slider', {next: '.next', previous: '.previous'});

## Hook System

Lectric is designed to give you a great deal of visibility of its insides. To help you extend Lectric, we've provided a simple hook system for you to tap into. Hooks have specific names and are invoked at specific times in the execution of the slider's timeline. 

Subscribing to a hook looks something like this:

    slider.subscribe('move', function(s, event) {
      console.log('We just moved! Our current position is:' + s.position.x);
    });

Unsubscribing from a hook looks like this:


    var handler = slider.subscribe('move', function(s, event) {
      console.log('We just moved! Our current position is:' + s.position.x);
    });
    slider.unsubscribe('move', handler); // Unsubscribe handler from slider

The hooks available to you are:
<commit_msg>linebreak<commit_after># Lectric Slider

Lectric is a JavaScript slider that is touch-enabled and takes advantage of hardware acceleration. It looks awesome on Apple touch devices. You can see an early version of this software implemented on [mckinney.com](http://mckinney.com).

It's Electric!

**Requires:** [jQuery](http://github.com/jquery/jquery)

## Installation

Put this in your `<head>`:
    
    <link href="/path/to/css/lectric.css" rel="stylesheet" type="text/css" media="screen">

    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js" type="text/javascript"></script>
    <script src="/path/to/js/lectric.js" type="text/javascript"></script>

## Usage

HTML:

    <div id="slider">
      <div class="item">Hello world</div>
      <div class="item">Hello world</div>
      <div class="item">Hello world</div>
      <div class="item">Hello world</div>
    </div>

JavaScript:

    var slider = new Lectric.Slider();
    slider.init('#slider');

## Optional Parameters

You can specify a few extra parameters when you call the `init` method. Those include:

- `next` *(selector)*: Next button
- `previous` *(selector)*: Previous button
- `limitLeft` *(boolean)*: Prohibits the slider from moving left
- `limitRight` *(boolean)*: Prohibits the slider from moving right
- `itemClassName` *(string)*: Class name of the individual pages of the slider
- `itemWrapperClassName` *(string)*: Class name of the container that wraps all items
- `animateEasing` *(string)*: A string indicating which easing function to use for the transition (non-mobile only).
- `animateDuration` *(integer or string)*: A string (e.g. "fast" or "slow") or number (in milliseconds) determining how long a slide animation will run.
- `hooks` *(map)*: Map of callback functions that should be subscribed to the various hooks (see next section for more about hooks)
- `tossFunction` *(function)*: A function to use for calculating the distance (from the touchend point) the slider should be tossed.

For example, let's provide a slider with next/previous buttons:

    var slider = new Lectric.Slider();
    slider.init('#slider', {next: '.next', previous: '.previous'});

## Hook System

Lectric is designed to give you a great deal of visibility of its insides. To help you extend Lectric, we've provided a simple hook system for you to tap into. Hooks have specific names and are invoked at specific times in the execution of the slider's timeline. 

Subscribing to a hook looks something like this:

    slider.subscribe('move', function(s, event) {
      console.log('We just moved! Our current position is:' + s.position.x);
    });

Unsubscribing from a hook looks like this:

    var handler = slider.subscribe('move', function(s, event) {
      console.log('We just moved! Our current position is:' + s.position.x);
    });
    slider.unsubscribe('move', handler); // Unsubscribe handler from slider

The hooks available to you are:

{'fraction_non_alphanumeric': 0.12231068947992546, 'fraction_numerical': 0.001016432322547857, 'mean_word_length': 4.197183098591549, 'pattern_counts': {'":': 0, '<': 35, '<?xml version=': 0, '>': 35, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1479230', 'n_tokens_mistral': 1713, 'n_tokens_neox': 1625, 'n_words': 676}