Plugin Directory

Changeset 1498422


Ignore:
Timestamp:
09/19/2016 09:10:32 PM (9 years ago)
Author:
bostonu
Message:

Pulling in 2.3.8 changeset from GitHub

Location:
bu-slideshow/trunk
Files:
12 added
8 deleted
13 edited

Legend:

Unmodified
Added
Removed
  • bu-slideshow/trunk/README.md

    r1349245 r1498422  
    11# BU Slideshow #
    2 _Wordpress Plugin_
    3 
    4 [![Build Status](https://travis-ci.org/bu-ist/bu-slideshow.svg)](https://travis-ci.org/bu-ist/bu-slideshow)
    5 
    6 **Contributors:** awbauer, clrux, mgburns, bgannonBU
    7 
    8 **Tags:** slideshow, images, boston university, bu
    9 
    10 **Requires at least:** 3.5
    11 
    12 **Tested up to:** 4.4.2
    13 
    14 **Stable tag:** 2.3.6
    15 
    16 **License:** GPLv2 or later
    17 
    18 **License URI:** http://www.gnu.org/licenses/gpl-2.0.html
     2**Contributors:** inderpreet99, awbauer, clrux, mgburns, gannondigital 
     3**Tags:** slideshow, images, boston university, bu 
     4**Requires at least:** 3.5 
     5**Tested up to:** 4.6.1 
     6**Stable tag:** 2.3.8 
     7**License:** GPLv2 or later 
     8**License URI:** http://www.gnu.org/licenses/gpl-2.0.html 
    199
    2010
    2111## Description ##
    22 BU Slideshow is a plugin for creating and managing image-based slideshows. It is designed to be simple enough for any site admin to use, and powerful enough to meet the needs of designers. The plugin has many optional functions that make it flexible enough for a variety of uses: slideshows, photo rotations, feature card decks in the sidebar, etc.
    23 [View full documentation on BU.edu](http://www.bu.edu/tech/services/comm/websites/www/wordpress/how-to/create-slideshows/)
     12BU Slideshow is a plugin for creating and managing image-based slideshows. It is designed to be simple enough for any site admin to use, and powerful enough to meet the needs of designers. The plugin has many optional functions that make it flexible enough for a variety of uses: slideshows, photo rotations, feature card decks in the sidebar, etc.
    2413
    25 ## Features ##
     14[View full documentation on BU.edu](https://www.bu.edu/tech/services/comm/websites/www/wordpress/how-to/create-slideshows/)
     15
     16### Features ###
    2617* Drag-and-drop re-ordering of slides
    2718* Optional titles and captions on a per-slide basis
     
    3223* Integrated with WordPress Media Library for image upload/selection, size options, and image cropping/editing
    3324
     25### Developers ###
     26
     27For developer documentation, feature roadmaps and more visit the [plugin repository on Github](https://github.com/bu-ist/bu-slideshow/).
     28
     29[![Build Status](https://travis-ci.org/bu-ist/bu-slideshow.svg)](https://travis-ci.org/bu-ist/bu-slideshow)
     30
     31## Installation ##
     32This plugin can be installed automatically through the WordPress admin interface, or by clicking the download link on this page and installing manually.
     33
     34Once installed, slideshows can be created by accessing the "Slideshows" menu in the admin panel. Slideshows can be dropped into any page by using the "Add Slideshow" button on the post/page edit screen.
     35
     36### Manual Installation ###
     371. Upload the bu-slideshow plugin folder to the /wp-content/plugins/ directory
     382. Activate 'BU Slideshow' through the 'Plugins' menu in WordPress
     39
    3440## Screenshots ##
    35 !['Edit Slideshow' Interface](http://developer.bu.edu/bu-slideshow/files/2014/08/slideshow-screencap-ui.png)
    36 !['Edit Slide' UI](http://developer.bu.edu/bu-slideshow/files/2014/08/slideshow-screencap-edit.png)
    37 ![Image Selector](http://developer.bu.edu/bu-slideshow/files/2014/08/slideshow-screencap-selectimage.png)
     41
     42###1. An intuitive, compact user interface allows drag-and-drop reordering of slides, easy addition of new slides, and expand/collapse toggles to edit details of individual slides.###
     43![An intuitive, compact user interface allows drag-and-drop reordering of slides, easy addition of new slides, and expand/collapse toggles to edit details of individual slides.](https://ps.w.org/bu-slideshow/assets/screenshot-1.png)
     44
     45###2. Select/remove images, edit titles, captions, links, and specify caption positioning and custom CSS classes all within a single location.###
     46![Select/remove images, edit titles, captions, links, and specify caption positioning and custom CSS classes all within a single location.](https://ps.w.org/bu-slideshow/assets/screenshot-2.png)
     47
     48###3. Full integration with the WordPress Media Library allows you to bulk-upload your images and select them from the Media Library, or upload individually as you build slides. Easily remove and/or select a different image using the WordPress tools you are familiar with.###
     49![Full integration with the WordPress Media Library allows you to bulk-upload your images and select them from the Media Library, or upload individually as you build slides. Easily remove and/or select a different image using the WordPress tools you are familiar with.](https://ps.w.org/bu-slideshow/assets/screenshot-3.png)
     50
    3851
    3952## Changelog ##
     53### 2.3.8 ###
     54* Fix UI issues since WP 4.4
     55* Use minified CSS on the frontend. Fixes #31.
     56* Switch to min filenames: https://core.trac.wordpress.org/ticket/21633
     57
     58### 2.3.7 ###
     59* Adds error checking to `bu-slideshow-thumb` image size handling
     60
    4061### 2.3.6 ###
    4162* Allow custom fields to use HTML (GH #28)
    42 * Add `bu_slideshow_slide_admin` filter, allowing custom templates to change slide admin 
     63* Add `bu_slideshow_slide_admin` filter, allowing custom templates to change slide admin
    4364* Adds "shuffle" attribute when shortcode is inserted in the Editor (GH #25)
    4465
    45 ### 2.3.5 ### 
     66### 2.3.5 ###
    4667* Fixes issue with "Add Slideshow" modal in Editor
    4768
     
    5879
    5980### 2.3.1 ###
    60 * Fix PHP notice 
     81* Fix PHP notice
    6182
    6283### 2.3 ###
    6384* Migrating slideshows to custom post type
    64 * [Support for custom slide templates](https://github.com/bu-ist/bu-slideshow/wiki/Actions-&-Filters#bu_slideshow_slide_templates), including custom fields
     85* Support for custom slide templates: https://github.com/bu-ist/bu-slideshow/wiki/Actions-&-Filters#bu_slideshow_slide_templates
     86* Support for custom fields
    6587
    6688### 2.2.1 ###
     
    82104### 2.0 ###
    83105* Improved “Add Slideshow” flow (3 screens -> 1). Now similar flow to creating new posts/pages.
    84 ** Abstracted “edit slideshow” form to a separate template file
     106* Abstracted “edit slideshow” form to a separate template file
    85107* Added option to set default height (Avoids “jump” while calculating height on page load)
    86108* Added option to set transition delay
     
    92114* Removed old back compatibility with WP < 3.3
    93115* Minor UI tweaks
    94 ** On slideshow edit screen, expand edit container for first slide by default (previously: all collapsed)
    95 ** Hide navigation elements until slideshow is fully loaded
    96 ** Image details / “edit” link on slideshow admin page
     116* - On slideshow edit screen, expand edit container for first slide by default (previously: all collapsed)
     117* - Hide navigation elements until slideshow is fully loaded
     118* - Image details / “edit” link on slideshow admin page
  • bu-slideshow/trunk/bu-slideshow.php

    r1349245 r1498422  
    11<?php
    22/*
    3  Plugin Name: BU Slideshow
    4  Description: Allows for the creation and display of animated slideshows. Uses sequence.js.
    5  
    6  Version: 2.3.6
    7  Author: Boston University (IS&T)
    8  Author URI: http://www.bu.edu/tech/
    9  *
    10  * Currently supports WP 3.5+
    11  * Tested to WP 4.4.2
    12  *
     3Plugin Name: BU Slideshow
     4Plugin URI: http://developer.bu.edu/bu-slideshow/
     5Description: Allows for the creation and display of animated slideshows. Uses sequence.js.
     6Version: 2.3.8
     7Author: Boston University (IS&T)
     8Author URI: http://www.bu.edu/tech/
     9Requires at least: 3.5
     10Tested up to: 4.6.1
    1311*/
    1412
    15 define('BU_SLIDESHOW_VERSION', '2.3.6');
     13define('BU_SLIDESHOW_VERSION', '2.3.8');
    1614define('BU_SLIDESHOW_BASEDIR', plugin_dir_path(__FILE__));
    1715define('BU_SLIDESHOW_BASEURL', plugin_dir_url(__FILE__));
     
    2321
    2422if (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) {
    25     define('BU_SSHOW_SUFFIX', '.dev');
     23    define('BU_SSHOW_MIN', '');
    2624} else {
    27     define('BU_SSHOW_SUFFIX', '');
     25    define('BU_SSHOW_MIN', '.min');
    2826}
    2927
     
    3735    static $meta_key = 'bu_slideshows';
    3836    static $show_id_meta_key = 'bu_slideshow_last_id';
     37    static $custom_thumb_size = 'bu-slideshow-thumb';
    3938    static $post_support_slug = 'bu_slideshow';
    4039    static $supported_post_types = array('page', 'post'); // post types to support Add Slideshow button
     
    192191
    193192        if (in_array($current_screen->id, $admin_pages) || self::using_editor()) {
    194             wp_enqueue_script('bu-modal', $js_url . 'bu-modal/bu-modal' . BU_SSHOW_SUFFIX . '.js', array('jquery'), BU_SLIDESHOW_VERSION, false);
     193            wp_enqueue_script('bu-modal', $js_url . 'bu-modal/bu-modal' . BU_SSHOW_MIN . '.js', array('jquery'), BU_SLIDESHOW_VERSION, false);
    195194            wp_enqueue_style('bu-modal', $js_url . 'bu-modal/css/bu-modal.css');
    196             wp_register_script('bu-slideshow-admin', $js_url . 'bu-slideshow-admin' . BU_SSHOW_SUFFIX . '.js', array('jquery', 'bu-modal'), BU_SLIDESHOW_VERSION, true);
     195            wp_register_script('bu-slideshow-admin', $js_url . 'bu-slideshow-admin' . BU_SSHOW_MIN . '.js', array('jquery', 'bu-modal'), BU_SLIDESHOW_VERSION, true);
    197196
    198197            wp_enqueue_script('media-upload');
     
    203202            self::localize('bu-slideshow-admin');
    204203
    205             wp_register_style('bu-slideshow-admin', BU_SLIDESHOW_BASEURL . 'interface/css/bu-slideshow-admin.css', array(), BU_SLIDESHOW_VERSION);
     204            wp_register_style('bu-slideshow-admin', BU_SLIDESHOW_BASEURL . 'interface/css/bu-slideshow-admin' . BU_SSHOW_MIN . '.css', array(), BU_SLIDESHOW_VERSION);
    206205            wp_enqueue_style('bu-slideshow-admin');
    207206            wp_enqueue_style('thickbox');
     
    223222     */
    224223    static public function public_scripts_styles() {
    225         // wp_register_script('modernizr', BU_SLIDESHOW_BASEURL . 'interface/js/vendor/modernizr' . BU_SSHOW_SUFFIX . '.js', array(), BU_SLIDESHOW_VERSION, true);
    226224
    227225        self::public_scripts();
    228226
    229227        if (!defined('BU_SLIDESHOW_CUSTOM_CSS') || !BU_SLIDESHOW_CUSTOM_CSS) {
    230             wp_register_style('bu-slideshow', BU_SLIDESHOW_BASEURL . 'interface/css/bu-slideshow.css', array(), BU_SLIDESHOW_VERSION);
     228            wp_register_style('bu-slideshow', BU_SLIDESHOW_BASEURL . 'interface/css/bu-slideshow' . BU_SSHOW_MIN . '.css', array(), BU_SLIDESHOW_VERSION);
    231229            wp_enqueue_style('bu-slideshow');
    232230        }
     
    235233        global $current_screen;
    236234        if ($current_screen && $current_screen->id === 'admin_page_bu-preview-slideshow') {
    237             wp_register_style('bu-slideshow', BU_SLIDESHOW_BASEURL . 'interface/css/bu-slideshow.css', array(), BU_SLIDESHOW_VERSION);
     235            wp_register_style('bu-slideshow', BU_SLIDESHOW_BASEURL . 'interface/css/bu-slideshow' . BU_SSHOW_MIN . '.css', array(), BU_SLIDESHOW_VERSION);
    238236            wp_enqueue_style('bu-slideshow');
    239237        }
     
    249247        $slideshow_deps = array('jquery','jquery-sequence');
    250248
    251         wp_register_script('jquery-sequence', BU_SLIDESHOW_BASEURL . 'interface/js/vendor/sequence/sequence.jquery' . BU_SSHOW_SUFFIX . '.js', $seq_deps, BU_SLIDESHOW_VERSION, true);
    252         wp_register_script('bu-slideshow', $js_url . 'bu-slideshow' . BU_SSHOW_SUFFIX . '.js', $slideshow_deps, BU_SLIDESHOW_VERSION, true);
     249        wp_register_script('jquery-sequence', BU_SLIDESHOW_BASEURL . 'interface/js/vendor/sequence/sequence.jquery' . BU_SSHOW_MIN . '.js', $seq_deps, BU_SLIDESHOW_VERSION, true);
     250        wp_register_script('bu-slideshow', $js_url . 'bu-slideshow' . BU_SSHOW_MIN . '.js', $slideshow_deps, BU_SLIDESHOW_VERSION, true);
    253251    }
    254252
     
    257255     */
    258256    static public function selector_scripts_styles() {
    259         wp_register_script('bu-slideshow-selector', BU_SLIDESHOW_BASEURL . 'interface/js/bu-slideshow-selector' . BU_SSHOW_SUFFIX . '.js', array('jquery'), BU_SLIDESHOW_VERSION, true);
     257        wp_register_script('bu-slideshow-selector', BU_SLIDESHOW_BASEURL . 'interface/js/bu-slideshow-selector' . BU_SSHOW_MIN . '.js', array('jquery'), BU_SLIDESHOW_VERSION, true);
    260258
    261259        wp_enqueue_script('bu-slideshow-selector');
    262260
    263         wp_register_style('bu-slideshow-selector', BU_SLIDESHOW_BASEURL . 'interface/css/bu-slideshow-selector.css', array(), BU_SLIDESHOW_VERSION);
     261        wp_register_style('bu-slideshow-selector', BU_SLIDESHOW_BASEURL . 'interface/css/bu-slideshow-selector' . BU_SSHOW_MIN . '.css', array(), BU_SLIDESHOW_VERSION);
    264262        wp_enqueue_style('bu-slideshow-selector');
    265263
     
    284282                    'emptyNameError'     => __('The name field for the slideshow cannot be empty.', BU_SSHOW_LOCAL),
    285283                    'thumbFailError'     => __('Could not load image thumbnail.', BU_SSHOW_LOCAL),
    286                     'thumbAltText'       => __('thumbnail for this slide\'s image', BU_SSHOW_LOCAL),
    287284                    'addSlideFailError'  => __('Could not create new slide.', BU_SSHOW_LOCAL),
    288285                    'mediaUploadTitle'   => __('Select Image', BU_SSHOW_LOCAL),
     
    350347     */
    351348    static public function custom_thumb_size() {
    352         add_image_size('bu-slideshow-thumb', 100, 100, true);
     349        add_image_size(static::$custom_thumb_size, 100, 100, true);
    353350    }
    354351
     
    910907        $img_info = self::get_slide_image_thumb(intval($_POST['image_id']));
    911908
    912         echo json_encode($img_info);
     909        echo $img_info;
    913910        exit;
    914911    }
    915912
    916913    /**
    917      * Gets thumbnail for custom size; generates that thumbnail if it doesn't yet exist
    918      * in order to support images uploaded before plugin was activated
    919      * @return array
    920      */
    921     static public function get_slide_image_thumb($img_id) {
    922         $img_arr = wp_get_attachment_image_src($img_id, 'bu-slideshow-thumb');
     914     * Generates thumbnail if it doesn't yet exist.
     915     * Supports images uploaded before plugin was activated.
     916     *
     917     * @param  int  $img_id
     918     * @return bool
     919     */
     920    static public function generate_slideshow_thumb( $img_id ) {
     921        $img_arr = wp_get_attachment_image_src($img_id, static::$custom_thumb_size);
    923922
    924923        /* if the regular img url is returned it means we don't have an existing thumb of correct size */
     
    926925            $img_path = get_attached_file($img_id);
    927926            $success = wp_update_attachment_metadata($img_id, wp_generate_attachment_metadata($img_id, $img_path));
    928             if ($success) {
    929                 $img_arr = wp_get_attachment_image_src($img_id, 'bu-slideshow-thumb');
    930             }
    931         }
    932 
    933         return $img_arr;
     927            return false !== $success;
     928        }
     929
     930        return true;
     931    }
     932
     933    /**
     934     * Gets thumbnail for custom size. Generates thumbnail if it doesn't exist.
     935     * @return array
     936     */
     937    static public function get_slide_image_thumb( $img_id ) {
     938        if ( ! static::generate_slideshow_thumb( $img_id ) ) {
     939            error_log( sprintf( '%s: Failed generating thumbnail for image (%s).', __METHOD__, $img_id ) );
     940        }
     941
     942        return wp_get_attachment_image( $img_id, static::$custom_thumb_size );
    934943    }
    935944
     
    954963            $bu_slideshow_loadscripts = 1;
    955964        } else {
    956             // wp_enqueue_script('modernizr');
    957965            wp_enqueue_script('jquery-sequence');
    958966            wp_enqueue_script('bu-slideshow');
  • bu-slideshow/trunk/class-bu-slide.php

    r1349245 r1498422  
    8989
    9090                if ($this->image_id) {
    91                     $img_thumb = wp_get_attachment_image($this->image_id, 'bu-slideshow-thumb');
     91                    $img_thumb = wp_get_attachment_image($this->image_id, BU_Slideshow::$custom_thumb_size);
    9292                    if( !empty( $img_thumb ) ){
    9393                        $img_meta = wp_get_attachment_metadata($this->image_id);
    94                         unset($img_meta['sizes']['bu-slideshow-thumb']);
     94
     95                        if( array_key_exists( 'bu-slideshow-thumb', $img_meta['sizes'] ) ){
     96                            unset($img_meta['sizes'][BU_Slideshow::$custom_thumb_size]);
     97                        }
     98
    9599                        $img_meta['sizes']['full'] = array("width"=>$img_meta['width'],"height"=>$img_meta['height']);
    96100                        $edit_url = admin_url( 'post.php?post=' . $this->image_id . '&action=edit');
  • bu-slideshow/trunk/gruntfile.js

    r1106150 r1498422  
    1 var app_path = "interface/";
     1/* jshint node:true */
     2module.exports = function( grunt ) {
    23
    3 module.exports = function(grunt) {
     4    // Load tasks.
     5    require('matchdep').filterDev(['grunt-*']).forEach( grunt.loadNpmTasks );
    46
    5     //All configuration goes here 
     7    //All configuration goes here
    68    grunt.initConfig({
    79        pkg: grunt.file.readJSON('package.json'),
    810
    9         concat: {   
    10             options: {
    11                 // the banner is inserted at the top of the output
    12                 banner: '/*! COMPILED BY GRUNT. DO NOT MODIFY. <%= pkg.name %> */\n'
    13             },
    14             slideshow_frontend: {
    15                 src: [
    16                     app_path + 'js/bu-slideshow-frontend.js'
    17                 ],
    18                 dest: app_path + 'js/bu-slideshow.dev.js',
    19             },
    20         },
    21 
    2211        uglify: {
    23             options: {
    24                 // the banner is inserted at the top of the output
    25                 banner: '/*! Compiled by Grunt <%= pkg.name %> */\n'
    26             },
    2712            slideshow_frontend:{
    28                 src: app_path + 'js/bu-slideshow.dev.js',
    29                 dest: app_path + 'js/bu-slideshow.js'
     13                src: 'interface/js/bu-slideshow.js',
     14                dest: 'interface/js/bu-slideshow.min.js'
    3015            },
    3116            slideshow_admin:{
    32                 src: app_path + 'js/bu-slideshow-admin.dev.js',
    33                 dest: app_path + 'js/bu-slideshow-admin.js'
     17                src: 'interface/js/bu-slideshow-admin.js',
     18                dest: 'interface/js/bu-slideshow-admin.min.js'
    3419            },
    3520            slideshow_selector:{
    36                 src: app_path + 'js/bu-slideshow-selector.dev.js',
    37                 dest: app_path + 'js/bu-slideshow-selector.js'
     21                src: 'interface/js/bu-slideshow-selector.js',
     22                dest: 'interface/js/bu-slideshow-selector.min.js'
    3823            }
    3924        },
     
    4126        less: {
    4227            slideshow:{
    43                 src: app_path + 'css/bu-slideshow.less',
    44                 dest: app_path + 'css/bu-slideshow.css',
     28                src: 'interface/css/bu-slideshow.less',
     29                dest: 'interface/css/bu-slideshow.css',
    4530                // options:{   compress: true  }
     31            }
     32        },
     33
     34        cssmin: {
     35            core: {
     36                expand: true,
     37                cwd: 'interface/css',
     38                src: [ '*.css', '!*.min.css' ],
     39                dest: 'interface/css',
     40                ext: '.min.css'
     41            }
     42        },
     43
     44        phplint: {
     45            options : {
     46                phpArgs : {
     47                    '-lf': null
     48                }
     49            },
     50            all : {
     51                src : '**/*.php'
    4652            }
    4753        },
     
    5056            scripts: {
    5157                files: [
    52                     app_path + 'js/*.dev.js'
     58                    'interface/js/*.js',
     59                    '!interface/js/*.min.js'
    5360                ],
    54                 tasks: ['concat', 'uglify'],
     61                tasks: ['uglify'],
    5562                options: {  spawn: false, },
    56             } ,
     63            },
    5764            less: {
    5865                files: [
    59                     app_path + 'css/bu-slideshow.less'
     66                    'interface/css/bu-slideshow.less',
    6067                ],
    61                 tasks: ['less'],
     68                tasks: ['styles'],
    6269                options: {  spawn: false, },
    63             }
     70            },
     71            styles: {
     72                files: [
     73                    'interface/css/*.css',
     74                    '!interface/css/*.min.css',
     75                    '!interface/css/bu-slideshow.css'
     76                ],
     77                tasks: ['cssmin'],
     78                options: {  spawn: false, },
     79            },
     80            phplint : {
     81                files : [ '**/*.php' ],
     82                tasks : [ 'phplint' ],
     83                options : {
     84                    spawn : false
     85                }
     86            }
    6487        }
    6588    });
    6689
    67     //the packages we plan on using.
    68     grunt.loadNpmTasks('grunt-contrib-concat');
    69     grunt.loadNpmTasks('grunt-contrib-uglify');
    70     grunt.loadNpmTasks('grunt-contrib-less');
    71     grunt.loadNpmTasks('grunt-contrib-watch');
     90    // Build task.
     91    grunt.registerTask( 'scripts', [ 'uglify' ] );
     92    grunt.registerTask( 'styles', [ 'less', 'cssmin' ] );
     93    grunt.registerTask( 'build', [ 'styles', 'scripts', 'phplint' ] );
    7294
    73     //sequence of events to run when grunt is run.
    74     grunt.registerTask('default', ['concat','uglify',"less"]);
     95    // Default task.
     96    grunt.registerTask( 'default', [ 'build' ] );
    7597
    7698};
  • bu-slideshow/trunk/interface/css/bu-slideshow.less

    r1000635 r1498422  
    1 @semi-opaque-fallback:      #464646; 
     1@semi-opaque-fallback:      #464646;
    22@semi-opaque:               rgba(0,0,0,0.75);
    33@semi-opaque-fallback-fade: #686868;
     
    66@white:                     rgba(255,255,255,1);
    77@white-fallback-fade:       #cdcdcd;
    8 @white-fade:                rgba(255,255,255,0.7); 
     8@white-fade:                rgba(255,255,255,0.7);
    99
    1010.mediumTransition {
     
    2626    position:relative;
    2727    min-height: 100px;
    28    
     28
    2929    .slideshow-loader{
    3030
     
    9393        }
    9494    }
    95        
     95
    9696    .arrowBgStyles {
    9797        background-color:transparent;
    98        
     98
    9999        cursor:pointer;
    100100        display:block;
     
    219219                        list-style:none;
    220220                        margin:0;
    221                         padding: 1%; 
     221                        padding: 1%;
    222222                        position:absolute;
    223223                        right: 6%;
     
    492492
    493493    }
    494    
     494
    495495}
    496496
    497497// make left/right arrows obvious on touchscreens
    498 html.touch .bu-slideshow-arrow-left, 
     498html.touch .bu-slideshow-arrow-left,
    499499html.touch .bu-slideshow-arrow-right {
    500500    background-color:@semi-opaque-fallback;
     
    579579
    580580    .bu-slideshow-arrow-right {
    581        
     581
    582582        background: url("../img/arrows.png") no-repeat scroll 0 6px transparent;
    583583
  • bu-slideshow/trunk/interface/js/bu-modal/bu-modal.js

    r1349245 r1498422  
    1 window.Modernizr=function(c,d,b){var a={},e=d.documentElement;d=d.createElement("modernizr");var f=d.style;d={};c=[];var k=c.slice,g,l={}.hasOwnProperty,h;"undefined"!==typeof l&&"undefined"!==typeof l.call?h=function(a,b){return l.call(a,b)}:h=function(a,b){return b in a&&"undefined"===typeof a.constructor.prototype[b]};Function.prototype.bind||(Function.prototype.bind=function(a){var b=this;if("function"!=typeof b)throw new TypeError;var c=k.call(arguments,1),e=function(){if(this instanceof e){var d=
    2 function(){};d.prototype=b.prototype;var d=new d,f=b.apply(d,c.concat(k.call(arguments)));return Object(f)===f?f:d}return b.apply(a,c.concat(k.call(arguments)))};return e});d.rgba=function(){f.cssText="background-color:rgba(150,255,150,.5)";return!!~(""+f.backgroundColor).indexOf("rgba")};for(var m in d)h(d,m)&&(g=m.toLowerCase(),a[g]=d[m](),c.push((a[g]?"":"no-")+g));a.addTest=function(c,d){if("object"==typeof c)for(var f in c)h(c,f)&&a.addTest(f,c[f]);else{c=c.toLowerCase();if(a[c]!==b)return a;
    3 d="function"==typeof d?d():d;e.className+=" "+(d?"":"no-")+c;a[c]=d}return a};f.cssText="";return d=null,a._version="2.6.2",e.className=e.className.replace(/(^|\s)no-js(\s|$)/,"$1$2")+(" js "+c.join(" ")),a}(this,this.document);
    4 jQuery(document).ready(function(c){window.BuModal=function b(a){if(!(this instanceof b))return new b(a);this.beforeOpen=a.beforeOpen?a.beforeOpen:function(){};this.afterOpen=a.afterOpen?a.afterOpen:function(){};this.beforeLoad=a.beforeLoad?a.beforeLoad:function(){};this.afterLoad=a.afterLoad?a.afterLoad:function(){};this.beforeClose=a.beforeClose?a.beforeClose:function(){};this.afterClose=a.afterClose?a.afterClose:function(){};this.buttons=a.buttons?c(a.buttons):c();this.background=a.background?a.background:
    5 "#ffffff";this.el=a.el?c(a.el):c("<div>").appendTo(document.body);this.content_url=a.content_url?a.content_url:"";this.width=a.width?a.width:"fit-content";this.height=a.height?a.height:"fit-content";this.ui=this.el.parents(".bu_modal");this.ui.length||(this.el.wrap('<div class="bu_modal" style="display:none;"></div>'),this.el.before('<div class="postboxheader"><a class="close_btn" href="">X</a></div>'),this.ui=this.el.parents(".bu_modal"));this.background&&this.ui.css("background",this.background);
    6 this.init();this.bindHandlers()};BuModal.version="2.0.6";BuModal.bg=c('<div class="bu_modal_bg"></div>').prependTo(document.getElementsByTagName("body")[0]).hide();BuModal.active_modal=!1;BuModal.close=function(){BuModal.active_modal&&BuModal.active_modal.close()};BuModal.prototype.init=function(){var b=this;b.closeButton=this.ui.find(".close_btn");b.ui.bg=BuModal.bg;b.ui.hide();b.buttons.each(function(){c(this).click(function(){b.open()})})};BuModal.prototype.isOpen=!1;BuModal.prototype.bindHandlers=
    7 function(){var b=this;c(document).bind("keyup",function(a){b.isOpen&&27===a.which&&b.close()});b.ui.bg.bind("click",function(){b.close();return!1});b.closeButton.bind("click",function(){b.close();return!1})};BuModal.prototype.open=function(){var b,a,e=this;this.ui.css({width:this.width,height:this.height});this.beforeOpen();this.el.show();this.ui.bg.show();this.ui.addClass("active").show();b=this.ui.outerWidth();a=this.ui.outerHeight();b=parseInt(b/2);parseInt(a/2);this.ui.css({marginLeft:"-"+b+"px",
    8 marginRight:b+"px"});this.isOpen=!0;BuModal.active_modal=this;this.afterOpen();this.content_url&&(this.beforeLoad(),this.ui.addClass("loading_content"),this.xhr=c.get(this.content_url,function(a){var b=e.xhr.getResponseHeader("Content-Type");e.xhr=!1;"text/html"==b.split(";")[0]?e.el.html(a):e.el.text(a);e.ui.removeClass("loading_content");e.afterLoad()}))};BuModal.prototype.close=function(){this.beforeClose();this.xhr&&(this.xhr.abort(),this.xhr=!1);this.ui.removeClass("active").hide();this.ui.bg.hide();
    9 this.isOpen=!1;BuModal.active_modal=!1;this.afterClose()}});
     1/* modernizr, just for rgba */
     2;window.Modernizr=function(a,b,c){function u(a){j.cssText=a}function v(a,b){return u(prefixes.join(a+";")+(b||""))}function w(a,b){return typeof a===b}function x(a,b){return!!~(""+a).indexOf(b)}function y(a,b,d){for(var e in a){var f=b[a[e]];if(f!==c)return d===!1?a[e]:w(f,"function")?f.bind(d||b):f}return!1}var d="2.6.2",e={},f=!0,g=b.documentElement,h="modernizr",i=b.createElement(h),j=i.style,k,l={}.toString,m={},n={},o={},p=[],q=p.slice,r,s={}.hasOwnProperty,t;!w(s,"undefined")&&!w(s.call,"undefined")?t=function(a,b){return s.call(a,b)}:t=function(a,b){return b in a&&w(a.constructor.prototype[b],"undefined")},Function.prototype.bind||(Function.prototype.bind=function(b){var c=this;if(typeof c!="function")throw new TypeError;var d=q.call(arguments,1),e=function(){if(this instanceof e){var a=function(){};a.prototype=c.prototype;var f=new a,g=c.apply(f,d.concat(q.call(arguments)));return Object(g)===g?g:f}return c.apply(b,d.concat(q.call(arguments)))};return e}),m.rgba=function(){return u("background-color:rgba(150,255,150,.5)"),x(j.backgroundColor,"rgba")};for(var z in m)t(m,z)&&(r=z.toLowerCase(),e[r]=m[z](),p.push((e[r]?"":"no-")+r));return e.addTest=function(a,b){if(typeof a=="object")for(var d in a)t(a,d)&&e.addTest(d,a[d]);else{a=a.toLowerCase();if(e[a]!==c)return e;b=typeof b=="function"?b():b,typeof f!="undefined"&&f&&(g.className+=" "+(b?"":"no-")+a),e[a]=b}return e},u(""),i=k=null,e._version=d,g.className=g.className.replace(/(^|\s)no-js(\s|$)/,"$1$2")+(f?" js "+p.join(" "):""),e}(this,this.document);
     3
     4jQuery(document).ready(function($) {
     5   
     6    window.BuModal = function BuModal(args) {
     7       
     8        if ( !(this instanceof BuModal)) {
     9            return new BuModal(args);
     10        }
     11       
     12        this.beforeOpen = args['beforeOpen'] ? args['beforeOpen'] : function() {};
     13        this.afterOpen = args['afterOpen'] ? args['afterOpen'] : function() {};
     14        this.beforeLoad = args['beforeLoad'] ? args['beforeLoad'] : function() {};
     15        this.afterLoad = args['afterLoad'] ? args['afterLoad'] : function() {};
     16        this.beforeClose = args['beforeClose'] ? args['beforeClose'] : function() {};
     17        this.afterClose = args['afterClose'] ? args['afterClose'] : function() {};
     18        this.buttons = args['buttons'] ? $(args['buttons']) : $();
     19        this.background = args['background'] ? args['background'] : '#ffffff';
     20        this.el = args['el'] ? $(args['el']) : $('<div>').appendTo(document.body);
     21        this.content_url = args['content_url'] ? args['content_url'] : '';
     22        this.width = args['width'] ? args['width'] : 'fit-content';
     23        this.height = args['height'] ? args['height'] : 'fit-content';
     24       
     25        // An element can have multiple modals bound to it, we re-use the bu_modal container.
     26        this.ui = this.el.parents('.bu_modal');
     27        if (!this.ui.length) {
     28            this.el.wrap('<div class="bu_modal" style="display:none;"></div>');
     29            this.el.before('<div class="postboxheader"><a class="close_btn" href="">X</a></div>');
     30            this.ui = this.el.parents('.bu_modal');
     31        }
     32       
     33        if (this.background) {
     34            this.ui.css('background', this.background);
     35        }
     36
     37        this.init();
     38        this.bindHandlers();
     39    };
     40
     41    BuModal.version = '2.0.6';
     42
     43    BuModal.bg = $('<div class="bu_modal_bg"></div>').prependTo(document.getElementsByTagName('body')[0]).hide();   
     44    BuModal.active_modal = false;
     45   
     46    BuModal.close = function() {
     47        if (BuModal.active_modal) {
     48            BuModal.active_modal.close();
     49        }
     50    };
     51   
     52    BuModal.prototype.init = function() {
     53        var modal = this;
     54        modal.closeButton = this.ui.find('.close_btn');
     55        modal.ui.bg = BuModal.bg;
     56        modal.ui.hide();
     57        modal.buttons.each(function() {
     58            $(this).click(function() {
     59                modal.open();
     60            });
     61        });
     62    };
     63   
     64    BuModal.prototype.isOpen = false;
     65   
     66    BuModal.prototype.bindHandlers = function() {
     67           
     68        var that = this;
     69
     70        // ESC to close
     71        $(document).bind('keyup', function(e) {
     72            if (that.isOpen && e.which === 27) {
     73                that.close();
     74            }
     75        });
     76
     77        // click overlay to close
     78        that.ui.bg.bind('click', function() {
     79            that.close();
     80            return false;
     81        });
     82
     83        that.closeButton.bind('click', function() {
     84            that.close();
     85            return false;
     86        });
     87    };
     88   
     89    BuModal.prototype.open = function() {
     90        var w, h, halfW, halfH, modal = this;
     91
     92        this.ui.css({
     93            'width': this.width,
     94            'height': this.height
     95        });
     96
     97        this.beforeOpen();
     98
     99        this.el.show();
     100        this.ui.bg.show();
     101        this.ui.addClass('active').show();
     102
     103        w = this.ui.outerWidth();
     104        h = this.ui.outerHeight();
     105
     106        halfW = parseInt(w / 2);
     107        halfH = parseInt(h / 2);
     108
     109        this.ui.css({
     110            'marginLeft' : '-' + halfW + 'px',
     111            'marginRight': halfW + 'px'
     112        });
     113        this.isOpen = true;
     114        BuModal.active_modal = this;
     115
     116        this.afterOpen();
     117
     118        if (this.content_url) {
     119            this.beforeLoad();
     120            this.ui.addClass('loading_content');
     121            this.xhr = $.get(this.content_url, function(response) {
     122                var content_type = modal.xhr.getResponseHeader('Content-Type');
     123                modal.xhr = false;
     124
     125                if (content_type.split(';')[0] == 'text/html') {
     126                    modal.el.html(response);
     127                } else {
     128                    modal.el.text(response);
     129                }
     130               
     131                modal.ui.removeClass('loading_content');
     132                modal.afterLoad();
     133            });
     134        }
     135    };
     136   
     137    BuModal.prototype.close = function() {
     138        this.beforeClose();
     139
     140        if (this.xhr) {
     141            this.xhr.abort();
     142            this.xhr = false;
     143        }
     144        this.ui.removeClass('active').hide();
     145        this.ui.bg.hide();
     146        this.isOpen = false;
     147        BuModal.active_modal = false;
     148
     149        this.afterClose();
     150    };
     151   
     152});
  • bu-slideshow/trunk/interface/js/bu-slideshow-admin.js

    r1349245 r1498422  
    1 (function(a){function l(c,f){a("#bu-slideshow-editform-submit").prop("disabled","disabled");window.reindexingSlides=!0;var e=/bu_slides\[([0-9]*)\](.*)/,g="";a(".bu-slideshow-slide").each(function(c,f){a(f).find("input, textarea, select").each(function(d,b){var n=a(b);g=n.attr("name");g=g.replace(e,"bu_slides["+c+"]$2");n.attr("name",g)})});a("#bu-slideshow-editform-submit").prop("disabled",!1);window.reindexingSlides=!1}function q(c,f){var e=f.item.height(),g=f.item.width();a(".sortable-placeholder").outerHeight(e).width(g)}
    2 function r(c){a.post(ajaxurl,{action:"bu_add_slide",order:c},function(c){c?(c=a(c),c.appendTo("#bu-slideshow-slidelist ul"),p(c.find(".bu-slideshow-add-img")),a("#bu-slideshow-slidelist ul li:last-child .bu-slide-edit-container").slideDown()):h(buSlideshowLocalAdmin.addSlideFailError,a("#bu-slideshow-slidelist"))})}function p(c){imgHref=c.attr("href")+"&width=640&height="+.9*a(window).height();c.attr("href",imgHref)}function h(c,f,e){"undefined"===typeof e&&(e=!1);a(".error").remove();c='<div class="error"><p>'+
    3 c+"</p></div>";e?f.prepend(c):f.append(c);setTimeout(function(){a(".error").fadeOut(500)},1E3)}a(function(){var c=a("#bu-slideshow-newform"),f=a("#bu-slideshow-manage"),e=a("#bu-slideshow-slides"),g=a("#bu-slideshow-edit");if(c.length)c.on("submit",function(){return a("#bu-new-slideshow-name").val().length?!0:(h("You must enter a name.",c),!1)});f.length&&e.length&&function(d){var b={};b.container=e;b.list=a(d.list);if(!b.list.length)throw TypeError("Invalid element supplied to slideshow manager.");
    4 b.nonce=a("#bu_slideshow_nonce").val();b.numShows=function(){return b.list.find("li").length};b.addEmptyMsg=function(){b.getUrl("add_url",function(a){b.list.append("<li><p>"+buSlideshowLocalAdmin.noSlideshowsMsg+'</p><p><a class="button" href="'+a+'">'+buSlideshowLocalAdmin.addButtonText+"</a></p></li>")})};b.getUrl=function(d,b){a.post(ajaxurl,{action:"bu_slideshow_get_url",url:d},function(a){b(a)})};b.list.on("click",".bu-slideshow-delete",function(){if(confirm(buSlideshowLocalAdmin.deleteConfirm)){var d=
    5 a(this),c;c={action:"bu_delete_slideshow",id:d.attr("data-slideshow-id"),bu_slideshow_nonce:b.nonce};a.post(ajaxurl,c,function(a){b.deleteResponse(d,a)})}return!1});b.deleteResponse=function(a,d){if(d&&"0"!==d)a.parent().parent("li").remove(),b.container.find(".error").remove(),b.numShows()||b.addEmptyMsg();else return h(buSlideshowLocalAdmin.deleteError,b.container),!1}}({list:"#bu-slideshow-manage"});if(a("#bu_slideshow_modal_button").length&&"function"===typeof BuModal&&"function"===typeof SlideshowSelector){var m=
    6 new BuModal({el:"#bu_slideshow_modal_wrap",height:"80%"}),k=new SlideshowSelector("#bu_slideshow_modal_wrap .bu-slideshow-selector");a("#bu_slideshow_modal_button").on("click",function(){m.open()});a("#bu_slideshow_modal_wrap").on("click","#bu_insert_slideshow",function(a){k.ui.parent().find(".error").remove();a=k.getOptions();if(!parseInt(a.show_id))return h(buSlideshowLocalAdmin.noneSelectedError,k.ui.parent()),!1;window.send_to_editor("<br />"+('[bu_slideshow show_id="'+a.show_id+'" show_nav="'+
    7 a.show_nav+'" transition="'+a.transition+'" nav_style="'+a.nav_style+'" autoplay="'+a.autoplay+'" transition_delay="'+a.transition_delay+'" width="'+a.width+' shuffle="'+a.shuffle+'"]')+"<br />");k.reset();m.close();return!1})}g.length&&(a(".bu-slideshow-slide:first-child").addClass("open"),a("#bu-slideshow-slidelist").on("click",".bu-slide-expand",function(){var d=a(this).parents(".bu-slideshow-slide").first(),b=d.find(".bu-slide-edit-container");d.hasClass("open")?(d.removeClass("open"),b.slideUp(300)):
    8 (d.addClass("open"),b.slideDown(300));return!1}),a("#bu-slideshow-slidelist").on("keyup",".bu-slideshow-title-input",function(){var d=a(this);d.parents(".bu-slideshow-slide").find(".bu-slide-title").text(d.val())}),a("#bu-slideshow-editform").on("submit",function(){return a("#bu_slideshow_name").val().replace(" ","")?!window.reindexingSlides:(h(buSlideshowLocalAdmin.emptyNameError,a(this)),!1)}),a("#bu-slideshow-slidelist ul").sortable({stop:l,placeholder:"sortable-placeholder",start:q}),a("#bu-slideshow-add-slide").on("click",
    9 function(){var a=g.find("#bu-slideshow-slidelist li").length;r(a);return!1}),a("#bu-slideshow-slidelist").on("click",".bu-slide-delete-button",function(){confirm(buSlideshowLocalAdmin.deleteConfirmSlide)&&(a(this).parents().parent(".bu-slideshow-slide").remove(),l());return!1}),window.buUploaders={init:function(d){d=a(d);if(!d.length)throw new TypeError("No valid button identified.");this.slide=d.parents(".bu-slideshow-slide");this.populateFields()},populateFields:function(){this.addButton=this.slide.find(".bu-slideshow-add-img");
    10 this.removeButton=this.slide.find(".bu-slideshow-remove-img");this.imgIdField=this.slide.find(".bu-slideshow-img-id");this.imgSizeField=this.slide.find(".bu-slideshow-img-size");this.imgMeta=this.slide.find(".bu-slide-meta");this.thumbContainers=this.slide.find(".bu-slide-thumb, .bu-slide-header-thumb")},select:function(){this.newHandleImageSelect()},remove:function(){this.thumbContainers.each(function(d,b){a(b).find("img").remove()});this.imgIdField.val("");this.imgSizeField.val("");this.imgMeta.hide();
    11 this.removeButton.hide()},handleImgThumbResponse:function(d){var b,c;(d=a.parseJSON(d))&&"0"!==d?(this.thumbContainers.each(function(f,e){c=a(e);b=c.find("img");b.length?b.attr("src",d[0]):c.append('<img src="'+d[0]+'" alt="'+buSlideshowLocalAdmin.thumbAltText+'" />')}),this.removeButton.show()):h(buSlideshowLocalAdmin.thumbFailError,this.slide.find(".bu-slide-edit-container"),!0)},newHandleImageSelect:function(){var a=this;"object"!==typeof buUploadFrame&&(a.modifyWPSelectFrame(),buUploadFrame=wp.media.frames.bu_slideshow_frame=
    12 wp.media({frame:"select",state:"bu-slideshow-image",states:[new wp.media.controller.BuSlideshowImage],button:{text:buSlideshowLocalAdmin.mediaUploadButton},library:{type:"image"}}),buUploadFrame.state("bu-slideshow-image").on("select",function(){var b,c;b=this.get("selection").first();c=this.display(b).attributes;b=b.toJSON().id;a.getImgThumb(b);a.setImageDetails(b,c.size);a.slide.find(".bu-slide-meta").hide()}));buUploadFrame.open()},modifyWPSelectFrame:function(){wp.media.controller.BuSlideshowImage=
    13 wp.media.controller.Library.extend({defaults:_.defaults({id:"bu-slideshow-image",library:wp.media.query({type:"image"}),multiple:!1,priority:60,displaySettings:!0,displayUserSettings:!0,title:buSlideshowLocalAdmin.mediaUploadTitle},wp.media.controller.Library.prototype.defaults)})},getImgThumb:function(d){var b=this;a.post(ajaxurl,{action:"bu_get_slide_thumb",image_id:d},function(a){b.handleImgThumbResponse(a)})},setImageDetails:function(a,b){this.imgIdField.val(a);this.imgSizeField.val(b)}},a("#bu-slideshow-slidelist").on("click",
    14 ".bu-slideshow-add-img",function(a){window.buUploaders.init(this);window.buUploaders.select();return!1}),a("#bu-slideshow-slidelist").on("click",".bu-slideshow-remove-img",function(){window.buUploaders.init(this);window.buUploaders.remove();return!1}),a("#bu-slideshow-slidelist .bu-slideshow-add-img").each(function(){p(a(this))}));a("#bu_slideshow_show_nav").on("click",function(){a(".bu_slideshow_nav_style").toggle()})})})(jQuery);
     1(function($){
     2    /* update slide input names so that new order is saved */
     3    function reindexSlides(event, ui) {
     4        $('#bu-slideshow-editform-submit').prop('disabled', 'disabled');
     5        window.reindexingSlides = true;
     6
     7        var regEx = /bu_slides\[([0-9]*)\](.*)/;
     8        var name = '';
     9
     10        $('.bu-slideshow-slide').each(function(index, el) {
     11            $(el).find('input, textarea, select').each(function(i, e) {
     12                var $e = $(e);
     13                name = $e.attr('name');
     14                name = name.replace(regEx, "bu_slides[" + index + "]$2");
     15                $e.attr('name', name);
     16            });
     17        });
     18
     19        $('#bu-slideshow-editform-submit').prop('disabled', false);
     20        window.reindexingSlides = false;
     21
     22    }
     23
     24    /* Make slides sortable */
     25    function createPlaceholder(event, ui) {
     26
     27        var h = ui.item.height();
     28        var w = ui.item.width();
     29        $('.sortable-placeholder').outerHeight(h).width(w);
     30
     31    }
     32
     33    function addSlide(order) {
     34
     35        var data = {
     36            "action": "bu_add_slide",
     37            "order": order
     38        };
     39
     40        $.post(ajaxurl, data, function(response) {
     41            if (!response) {
     42                displayError(buSlideshowLocalAdmin.addSlideFailError, $('#bu-slideshow-slidelist'));
     43                return;
     44            }
     45
     46            var r = $(response);
     47            r.appendTo('#bu-slideshow-slidelist ul');
     48            setModalHeight( r.find('.bu-slideshow-add-img') );
     49            $("#bu-slideshow-slidelist ul li:last-child .bu-slide-edit-container").slideDown();
     50        });
     51
     52    }
     53
     54    function setModalHeight($link) {
     55
     56        imgHref = $link.attr('href') + '&width=640&height=' + ($(window).height() * 0.9);
     57        $link.attr('href', imgHref);
     58
     59    }
     60
     61    /**
     62     * Removes any existing errors and displays new one.
     63     */
     64    function displayError(msg, target, pre) {
     65        if ( typeof pre === 'undefined') {
     66            pre = false; //append error
     67        }
     68
     69        $('.error').remove();
     70        var html = '<div class="error"><p>' + msg + '</p></div>';
     71
     72        if (pre) {
     73            target.prepend(html);
     74        } else {
     75            target.append(html);
     76        }
     77
     78        setTimeout(function() {
     79            $('.error').fadeOut(500);
     80        }, 1000);
     81    }
     82
     83    $(function(){
     84        var newSlideshowForm = $('#bu-slideshow-newform'), slideShowList = $('#bu-slideshow-manage'),
     85            slidesContainer = $('#bu-slideshow-slides'), slideEditor = $('#bu-slideshow-edit'),
     86            manageUrl = 'admin.php?page=bu-slideshow',
     87            imgHref;
     88
     89        /** New slideshow page */
     90        if (newSlideshowForm.length) {
     91            newSlideshowForm.on('submit', function() {
     92                var name = $('#bu-new-slideshow-name').val();
     93
     94                if (!name.length) {
     95                    displayError('You must enter a name.', newSlideshowForm);
     96                    return false;
     97                }
     98
     99                return true;
     100            });
     101        }
     102
     103        /**
     104         * Manage slideshows page
     105         */
     106        if (slideShowList.length && slidesContainer.length) {
     107
     108            var slideShowMgr = function(args) {
     109                var that = {};
     110
     111                that.container = slidesContainer;
     112
     113                that.list = $(args.list);
     114                if (!that.list.length) {
     115                    throw TypeError('Invalid element supplied to slideshow manager.');
     116                }
     117
     118                that.nonce = $('#bu_slideshow_nonce').val();
     119
     120                that.numShows = function() {
     121                    return that.list.find('li').length;
     122                };
     123
     124                that.addEmptyMsg = function() {
     125                    that.getUrl('add_url', function(addUrl) {
     126                        var html = '<li><p>' + buSlideshowLocalAdmin.noSlideshowsMsg + '</p>' +
     127                            '<p><a class="button" href="' + addUrl + '">' + buSlideshowLocalAdmin.addButtonText + '</a></p></li>';
     128                        that.list.append(html);
     129                    });
     130
     131                };
     132
     133                that.getUrl = function(url, cb) {
     134                    var data = {
     135                        "action" : "bu_slideshow_get_url",
     136                        "url" : url
     137                    };
     138                    $.post(ajaxurl, data, function(response) {
     139                        cb(response);
     140                    });
     141                };
     142
     143                that.list.on('click', '.bu-slideshow-delete', function() {
     144                    var result = confirm(buSlideshowLocalAdmin.deleteConfirm);
     145
     146                    if (result) {
     147                        var $this = $(this), showId, data;
     148                        showId = $this.attr('data-slideshow-id');
     149
     150                        data = {
     151                            "action": 'bu_delete_slideshow',
     152                            "id": showId,
     153                            "bu_slideshow_nonce": that.nonce
     154                        };
     155
     156                        $.post(ajaxurl, data, function(response) {
     157                            that.deleteResponse($this, response);
     158                        });
     159                    }
     160
     161                    return false;
     162                });
     163
     164                that.deleteResponse = function(el, r) {
     165                    if (r && r !== '0') {
     166                        el.parent().parent('li').remove();
     167                        that.container.find('.error').remove();
     168
     169                        if (!that.numShows()) {
     170                            that.addEmptyMsg();
     171                        }
     172                    } else {
     173                        displayError(buSlideshowLocalAdmin.deleteError, that.container);
     174                        return false;
     175                    }
     176                };
     177            };
     178
     179            slideShowMgr({'list': '#bu-slideshow-manage'});
     180
     181        }
     182
     183        /* Add Slideshow button and Inserting shortcode into editor */
     184        if ($('#bu_slideshow_modal_button').length && typeof BuModal === 'function' && typeof SlideshowSelector === 'function') {
     185
     186            var modal = new BuModal({ 'el' : '#bu_slideshow_modal_wrap', 'height' : '80%' }),
     187                selector = new SlideshowSelector('#bu_slideshow_modal_wrap .bu-slideshow-selector');
     188
     189            $('#bu_slideshow_modal_button').on('click', function() {
     190                modal.open();
     191            });
     192
     193            $('#bu_slideshow_modal_wrap').on('click', '#bu_insert_slideshow', function(e) {
     194                var options, html;
     195                selector.ui.parent().find('.error').remove();
     196                options = selector.getOptions();
     197
     198                if (!parseInt(options.show_id)) {
     199                    displayError(buSlideshowLocalAdmin.noneSelectedError, selector.ui.parent());
     200                    return false;
     201                }
     202
     203                html = '[bu_slideshow show_id="' + options.show_id + '" show_nav="' + options.show_nav + '" transition="' + options.transition + '" nav_style="' + options.nav_style + '" autoplay="' + options.autoplay  + '" transition_delay="' + options.transition_delay  + '" width="' + options.width + ' shuffle="'+options.shuffle +'"]';
     204
     205                window.send_to_editor("<br />" + html + "<br />");
     206                selector.reset();
     207                modal.close();
     208                return false;
     209            });
     210        }
     211
     212
     213
     214        /* Edit Slideshow page */
     215        if (slideEditor.length) {
     216
     217            $('.bu-slideshow-slide:first-child').addClass('open');
     218
     219            /* slide toggle */
     220            $('#bu-slideshow-slidelist').on('click', '.bu-slide-expand', function() {
     221                var $slideContainer = $(this).parents('.bu-slideshow-slide').first(),
     222                    $editor = $slideContainer.find('.bu-slide-edit-container');
     223
     224                if ($slideContainer.hasClass('open')) {
     225                    $slideContainer.removeClass('open');
     226                    $editor.slideUp(300);
     227                } else {
     228                    $slideContainer.addClass('open');
     229                    $editor.slideDown(300);
     230                }
     231
     232                return false;
     233            });
     234
     235            /* replace slide title as user types */
     236            $('#bu-slideshow-slidelist').on('keyup', '.bu-slideshow-title-input', function() {
     237                var input = $(this);
     238                input.parents('.bu-slideshow-slide').find('.bu-slide-title').text(input.val());
     239            });
     240
     241            /* don't allow saving until slide reindexing is complete */
     242            $('#bu-slideshow-editform').on('submit', function() {
     243
     244                var name = $('#bu_slideshow_name').val().replace(' ', '');
     245                if (!name) {
     246
     247                    displayError(buSlideshowLocalAdmin.emptyNameError, $(this));
     248                    return false;
     249                }
     250
     251                return (!window.reindexingSlides);
     252            });
     253
     254            $('#bu-slideshow-slidelist ul').sortable({
     255                stop: reindexSlides,
     256                placeholder: "sortable-placeholder",
     257                start: createPlaceholder
     258            });
     259
     260            // Add new slide button
     261            $('#bu-slideshow-add-slide').on('click', function() {
     262                var order = slideEditor.find('#bu-slideshow-slidelist li').length;
     263                addSlide(order);
     264                return false;
     265            });
     266
     267            // Delete slide button
     268            $('#bu-slideshow-slidelist').on('click', '.bu-slide-delete-button', function() {
     269
     270                if (confirm(buSlideshowLocalAdmin.deleteConfirmSlide)) {
     271                    $(this).parents().parent('.bu-slideshow-slide').remove();
     272                    reindexSlides();
     273                }
     274
     275                return false;
     276            });
     277
     278            // Media upload management
     279            window.buUploaders = {
     280
     281                init : function(button) {
     282                    var $button = $(button);
     283
     284                    if (!$button.length) {
     285                        throw new TypeError('No valid button identified.');
     286                    }
     287
     288                    this.slide = $button.parents('.bu-slideshow-slide');
     289                    this.populateFields();
     290                },
     291
     292                populateFields : function() {
     293
     294                    this.addButton = this.slide.find('.bu-slideshow-add-img');
     295                    this.removeButton = this.slide.find('.bu-slideshow-remove-img');
     296                    this.imgIdField = this.slide.find('.bu-slideshow-img-id');
     297                    this.imgSizeField = this.slide.find('.bu-slideshow-img-size');
     298                    this.imgMeta = this.slide.find('.bu-slide-meta');
     299                    this.thumbContainers = this.slide.find('.bu-slide-thumb, .bu-slide-header-thumb');
     300                },
     301
     302                // trigger appropriate media upload UI/handling
     303                select : function() {
     304                    this.newHandleImageSelect();
     305                },
     306
     307                // remove image
     308                remove : function() {
     309
     310                    this.thumbContainers.each(function(index, el) {
     311                        $(el).find('img').remove();
     312                    });
     313
     314                    this.imgIdField.val('');
     315                    this.imgSizeField.val('');
     316                    this.imgMeta.hide();
     317                    this.removeButton.hide();
     318                },
     319
     320                handleImgThumbResponse : function(response) {
     321                    var thumb, $el;
     322
     323                    if (!response || response === '0') {
     324                        displayError(buSlideshowLocalAdmin.thumbFailError, this.slide.find('.bu-slide-edit-container'), true);
     325                    } else {
     326                        this.thumbContainers.each(function(index, el) {
     327                            $el = $(el);
     328                            thumb = $el.find('img');
     329
     330                            if (thumb.length) {
     331                                thumb.replaceWith(response);
     332                            } else {
     333                                $el.append(response);
     334                            }
     335                        });
     336
     337                        this.removeButton.show();
     338                    }
     339                },
     340
     341                /**
     342                 * Media uploader for WP 3.5+
     343                 */
     344                newHandleImageSelect : function() {
     345                    var that = this;
     346
     347                    if (typeof buUploadFrame !== 'object') {
     348
     349                        that.modifyWPSelectFrame();
     350
     351                        buUploadFrame = wp.media.frames.bu_slideshow_frame = wp.media({
     352                            frame: 'select',
     353                            state: 'bu-slideshow-image',
     354                            states: [
     355                                new wp.media.controller.BuSlideshowImage()
     356                            ],
     357                            'button' : { 'text' : buSlideshowLocalAdmin.mediaUploadButton },
     358                            'library' : {
     359                                'type' : 'image'
     360                            }
     361                        });
     362
     363                        buUploadFrame.state('bu-slideshow-image').on('select', function() {
     364                            var img, props, state, imgId;
     365
     366                            img = this.get('selection').first();
     367                            props = this.display(img).attributes;
     368                            imgId = img.toJSON().id;
     369
     370                            that.getImgThumb(imgId);
     371                            that.setImageDetails(imgId, props.size);
     372                            that.slide.find('.bu-slide-meta').hide();
     373                        });
     374                    }
     375
     376                    buUploadFrame.open();
     377                },
     378
     379                /**
     380                 * Patches the Select media frame to add the attachment details in the sidebar.
     381                 * Allows image size to be selected when attached to slide.
     382                 */
     383                modifyWPSelectFrame : function() {
     384                    wp.media.controller.BuSlideshowImage = wp.media.controller.Library.extend({
     385                            defaults: _.defaults({
     386                                id: 'bu-slideshow-image',
     387                                library: wp.media.query({ type: 'image' }),
     388                                multiple: false,
     389                                priority: 60,
     390                                displaySettings: true,
     391                                displayUserSettings: true,
     392                                title : buSlideshowLocalAdmin.mediaUploadTitle
     393                            }, wp.media.controller.Library.prototype.defaults )
     394                        });
     395                },
     396
     397                getImgThumb : function(imgId) {
     398                    var that = this, data;
     399
     400                    data = {
     401                        "action": 'bu_get_slide_thumb',
     402                        "image_id": imgId
     403                    };
     404                    $.post(ajaxurl, data, function(response) {
     405                        that.handleImgThumbResponse(response);
     406                    });
     407                },
     408
     409                setImageDetails : function(id, size) {
     410                    this.imgIdField.val(id);
     411                    this.imgSizeField.val(size);
     412                }
     413
     414            };
     415
     416            $('#bu-slideshow-slidelist').on('click', '.bu-slideshow-add-img', function(e) {
     417                window.buUploaders.init(this);
     418                window.buUploaders.select();
     419                return false;
     420            });
     421
     422            $('#bu-slideshow-slidelist').on('click', '.bu-slideshow-remove-img', function() {
     423                window.buUploaders.init(this);
     424                window.buUploaders.remove();
     425                return false;
     426            });
     427
     428            $('#bu-slideshow-slidelist .bu-slideshow-add-img').each(function() {
     429                setModalHeight($(this));
     430            });
     431
     432        }
     433
     434        $("#bu_slideshow_show_nav").on("click",function(){
     435            $(".bu_slideshow_nav_style").toggle();
     436        });
     437
     438    });
     439}(jQuery));
  • bu-slideshow/trunk/interface/js/bu-slideshow-selector.js

    r1349245 r1498422  
    1 jQuery(document).ready(function(d){window.SlideshowSelector=function a(b){if(!(this instanceof a))return new a(b);this.ui=d(b);if(!this.ui.length)return new TypeError("No selector element found.");this.init()};SlideshowSelector.prototype.init=function(){this.advancedToggle=this.ui.find(".bu-slideshow-advanced-toggle");this.advanced=this.ui.find(".bu-slideshow-selector-advanced");this.advanced.hide();this.addHandlers()};SlideshowSelector.prototype.addHandlers=function(){var a=this;a.ui.on("click",
    2 ".bu-slideshow-advanced-toggle",function(b){a.advanced.is(":hidden")?(a.advanced.slideDown(200),a.advancedToggle.text(buSlideshowLocalSelector.toggleTextHide),d(".bu-slideshow-selector-advanced input").first().focus()):(a.advanced.slideUp(200),a.advancedToggle.text(buSlideshowLocalSelector.toggleTextShow));return!1})};SlideshowSelector.prototype.getOptions=function(){var a={};a.show_id=this.ui.find("#bu_slideshow_selected").val();a.show_nav=this.ui.find("#bu_slideshow_show_nav").is(":checked")?1:
    3 0;a.transition=this.ui.find("#bu_slideshow_select_transition").val();a.custom_transition=this.ui.find("#bu_slideshow_custom_trans").val().replace(" ","");a.nav_style=this.ui.find("#bu_slideshow_nav_style").val();a.autoplay=this.ui.find("#bu_slideshow_autoplay").is(":checked")?1:0;a.shuffle=this.ui.find("#bu_slideshow_shuffle").is(":checked")?1:0;a.transition_delay=this.ui.find("#bu_slideshow_transition_delay").val();a.width=this.ui.find("#bu_slideshow_width").val();if(0<a.custom_transition.length){a.transition=
    4 a.custom_transition;var b={"[":"","]":"",'"':""},c;for(c in b)a.transition=a.transition.replace(c,b[c])}0===a.width.length&&(a.width="auto");return a};SlideshowSelector.prototype.reset=function(){var a;a=this.ui.find("#bu_slideshow_selected");a.val(a.find("option:first").val());a=this.ui.find("#bu_slideshow_select_transition");a.val(a.find("option:first").val());a=this.ui.find("#bu_slideshow_nav_style");a.val(a.find("option:first").val());this.ui.find("#bu_slideshow_width").val("");this.ui.find("#bu_slideshow_custom_trans").val("");
    5 this.ui.find("#bu_slideshow_custom_trans").val("");this.ui.find("#bu_slideshow_show_nav").prop("checked",!0);this.ui.find("#bu_slideshow_custom_transition").val("");this.ui.find("#bu_slideshow_autoplay").prop("checked",!0)}});
     1jQuery(document).ready(function($){
     2   
     3    window.SlideshowSelector = function SlideshowSelector(el) {
     4       
     5        if ( !(this instanceof SlideshowSelector)) {
     6            return new SlideshowSelector(el);
     7        }
     8       
     9        this.ui = $(el);
     10        if (!this.ui.length) {
     11            return new TypeError('No selector element found.');
     12        }
     13       
     14        this.init();
     15    };
     16   
     17    SlideshowSelector.prototype.init = function() {
     18        this.advancedToggle = this.ui.find('.bu-slideshow-advanced-toggle');
     19        this.advanced = this.ui.find('.bu-slideshow-selector-advanced');
     20       
     21        this.advanced.hide();
     22        this.addHandlers();
     23    };
     24   
     25    SlideshowSelector.prototype.addHandlers = function() {
     26        var that = this;
     27       
     28        that.ui.on('click', '.bu-slideshow-advanced-toggle', function(e) {
     29            if (that.advanced.is(':hidden')) {
     30                that.advanced.slideDown(200);
     31                that.advancedToggle.text(buSlideshowLocalSelector.toggleTextHide);
     32                $('.bu-slideshow-selector-advanced input').first().focus();
     33            } else {
     34                that.advanced.slideUp(200);
     35                that.advancedToggle.text(buSlideshowLocalSelector.toggleTextShow);
     36            }
     37
     38            return false;
     39        });
     40    };
     41   
     42    SlideshowSelector.prototype.getOptions = function() {
     43        var options = {};
     44
     45        options.show_id = this.ui.find('#bu_slideshow_selected').val();
     46        options.show_nav = this.ui.find('#bu_slideshow_show_nav').is(':checked') ? 1 : 0;
     47        options.transition = this.ui.find('#bu_slideshow_select_transition').val();
     48        options.custom_transition = this.ui.find('#bu_slideshow_custom_trans').val().replace(' ', '');
     49        options.nav_style = this.ui.find('#bu_slideshow_nav_style').val();
     50        options.autoplay = this.ui.find('#bu_slideshow_autoplay').is(':checked') ? 1 : 0;
     51        options.shuffle = this.ui.find('#bu_slideshow_shuffle').is(':checked') ? 1 : 0;
     52        options.transition_delay = this.ui.find('#bu_slideshow_transition_delay').val();
     53        options.width = this.ui.find('#bu_slideshow_width').val();
     54        // options.align = this.ui.find('#bu_slideshow_alignment input[type="radio"]:checked').val();
     55        // options.align = this.ui.each('.bu_slideshow_alignment_loop input[name="bu_slideshow_alignment"]:checked').val());
     56
     57        // override transition with custom transition if provided
     58        if (options.custom_transition.length > 0) {
     59            options.transition = options.custom_transition;
     60            var rplcd = {
     61                '[' : '',
     62                ']' : '',
     63                '"' : ''
     64            };
     65            for (var r in rplcd) {
     66                options.transition = options.transition.replace(r, rplcd[r]);
     67            }
     68        }
     69       
     70        if (options.width.length === 0) {
     71            options.width = 'auto';
     72        }
     73       
     74        // if (options.align.legnth || options.align !== 'undefined' || options.align.length === 0) {
     75        // options.align = 'center';
     76        // }
     77
     78        return options;
     79    };
     80   
     81    SlideshowSelector.prototype.reset = function() {
     82        var slideSel, transSel, navSel;
     83
     84        slideSel = this.ui.find('#bu_slideshow_selected');
     85        slideSel.val(slideSel.find('option:first').val());
     86        transSel = this.ui.find('#bu_slideshow_select_transition');
     87        transSel.val(transSel.find('option:first').val());
     88        navSel = this.ui.find('#bu_slideshow_nav_style');
     89        navSel.val(navSel.find('option:first').val());
     90       
     91        this.ui.find('#bu_slideshow_width').val('');
     92        // this.ui.find('#bu_slideshow_alignment input[type="radio"]:checked').val('');
     93        this.ui.find('#bu_slideshow_custom_trans').val('');
     94        this.ui.find('#bu_slideshow_custom_trans').val('');
     95
     96        this.ui.find('#bu_slideshow_show_nav').prop('checked', true);
     97        this.ui.find('#bu_slideshow_custom_transition').val('');
     98        this.ui.find('#bu_slideshow_autoplay').prop('checked', true);
     99    };
     100   
     101});
  • bu-slideshow/trunk/interface/js/bu-slideshow.js

    r1000635 r1498422  
    1 /*! Compiled by Grunt bu-slideshow */
    2 !function(a){function b(){a(".bu-slideshow-container").each(function(){var b,c=a(this).find("li .bu-slide-container"),d=0,e=0;c.find("*").each(function(c,f){b=a(f),e=b.height(),e>d&&(d=e)}),c.each(function(b,c){a(c).height(d)}),a(this).height(d),a(this).find("ul.bu-slideshow").height(d)})}function c(a){if(!(this instanceof c))throw new ReferenceError('Invoked constructor as regular function. Use the "new" operator.');if(!a.show)throw new TypeError("Did not pass a valid Sequence object.");if(!a.container)throw new ReferenceError("Did not pass a valid container element.");this.sequence=a.show,this.container=a.container,this.init(a)}var d=jQuery(window).height(),e=jQuery(window).width(),f={};window.BuSlideshow=c,c.prototype.init=function(c){var d=this;c||(c={}),this.sequence.afterLoaded=function(){var a=d.container.parent("div.bu-slideshow-container");a.find(".slideshow-loader.active").removeClass("active"),a.find(".bu-slideshow-navigation-container").css("display","inline-block"),b()},this.sequence.beforeNextFrameAnimatesIn=function(){d.pager&&d.pager.setActive()},this.pager=a("#"+c.pager).length?a("#"+c.pager):!1,this.pager&&this.initPager(),this.arrows=a("#"+c.arrows).length?a("#"+c.arrows):!1,this.arrows&&this.initArrows()},c.prototype.initPager=function(){var b=this;this.pager.find("li a").bind("click",function(){var c=a(this).attr("id").replace("pager-","");return b.sequence.nextFrameID=c,b.sequence.goTo(c),!1}),this.pager.setActive=function(a){a=b.sequence.nextFrameID,this.find("a").removeClass("active"),this.find("a#pager-"+a).addClass("active")}},c.prototype.initArrows=function(){var a=this;this.arrows.find(".bu-slideshow-arrow-left").bind("click",function(){return a.sequence.prev(),!1}).end().find(".bu-slideshow-arrow-right").bind("click",function(){return a.sequence.next(),!1})},jQuery(document).ready(function(a){a(".bu-slideshow-container").each(function(b){var d,e,g,h,i,j,k,l=a(this),m=!1;d=l.find(".bu-slideshow-slides"),e=l.find("ul.bu-slideshow-navigation").attr("id"),g=l.find("div.bu-slideshow-arrows").attr("id"),j=l.attr("data-slideshow-name")?l.attr("data-slideshow-name"):b,k=l.attr("data-slideshow-delay")?l.attr("data-slideshow-delay"):5e3,l.hasClass("autoplay")&&(m=!0),h={autoPlay:m,autoPlayDelay:k,fallback:{theme:"slide"},swipeEvents:{left:"next",right:"prev"}},i={show:d.sequence(h).data("sequence"),container:d,pager:e,arrows:g};try{f[j]=new c(i)}catch(n){}}),a(window).resize(function(){var c,f;c=a(window).height(),f=a(window).width(),(c!==d||f!==e)&&(d=c,e=f,b())})})}(jQuery);
     1(function($){
     2    /* IE triggers resize all over the place, so we check actual window dimensions */
     3    var windowHeight = jQuery(window).height(),
     4        windowWidth = jQuery(window).width(),
     5        buSlideshows = {},
     6        rotator, imgHeight;
     7
     8        /**
     9         * Resizes slideshow and all slides to height of highest slide
     10         *
     11         * I hate iterating through everything in the slides here, but we should allow
     12         * for markup other than what the plugin currently produces (e.g. video, custom HTML).
     13         */
     14        function bu_resize_slideshow() {
     15
     16            $('.bu-slideshow-container').each(function(){
     17                var slides = $(this).find('li .bu-slide-container'),
     18                    $el, height = 0, currentHeight = 0;
     19
     20                slides.find('*').each(function(i, el) {
     21                    $el = $(el);
     22                   
     23                    currentHeight = $el.height();
     24                    if (currentHeight > height) {
     25                        height = currentHeight;
     26                    }
     27                });
     28
     29                slides.each(function(i, el) {
     30                    $(el).height(height);
     31                });
     32
     33                $(this).height(height);
     34                $(this).find('ul.bu-slideshow').height(height);
     35           
     36            });
     37           
     38        }
     39
     40        function BuSlideshow(args) {
     41           
     42            if ( !(this instanceof BuSlideshow)) {
     43                throw new ReferenceError('Invoked constructor as regular function. Use the "new" operator.');
     44            }
     45           
     46            if (!args.show) {
     47                throw new TypeError('Did not pass a valid Sequence object.');
     48            }
     49           
     50            if (!args.container) {
     51                throw new ReferenceError('Did not pass a valid container element.');
     52            }
     53           
     54            this.sequence = args.show;
     55            this.container = args.container;
     56           
     57           
     58            this.init(args);
     59        }
     60       
     61        window.BuSlideshow = BuSlideshow;
     62
     63        BuSlideshow.prototype.init = function(args) {
     64            var that = this;
     65           
     66            if (!args) {
     67                args = {};
     68            }
     69
     70           
     71            this.sequence.afterLoaded = function(){
     72                var outer = that.container.parent('div.bu-slideshow-container');
     73                outer.find('.slideshow-loader.active').removeClass('active');
     74                outer.find('.bu-slideshow-navigation-container').css('display', 'inline-block');
     75                bu_resize_slideshow();
     76            };
     77           
     78            this.sequence.beforeNextFrameAnimatesIn = function() {
     79                if (that.pager) {
     80                    that.pager.setActive();
     81                }
     82            };
     83
     84            this.pager = $('#' + args.pager).length ? $('#' + args.pager) : false;
     85            if (this.pager) {
     86                this.initPager();
     87            }
     88
     89            this.arrows = $('#' + args.arrows).length ? $('#' + args.arrows) : false;
     90            if (this.arrows) {
     91                this.initArrows();
     92            }
     93        };
     94       
     95        BuSlideshow.prototype.initPager = function() {
     96            var that = this;
     97
     98            this.pager.find('li a').bind('click', function() {
     99                var id = $(this).attr('id').replace('pager-', '');
     100                that.sequence.nextFrameID = id;
     101                that.sequence.goTo(id);
     102                return false;
     103            });
     104
     105            this.pager.setActive = function(nextId) {
     106                nextId = that.sequence.nextFrameID;
     107                this.find('a').removeClass('active');
     108                this.find('a#pager-' + nextId).addClass('active');
     109            };
     110        };
     111       
     112        BuSlideshow.prototype.initArrows = function() {
     113            var that = this;
     114           
     115            this.arrows.find('.bu-slideshow-arrow-left').bind('click', function() {
     116                that.sequence.prev();
     117                return false;
     118            }).end().find('.bu-slideshow-arrow-right').bind('click', function() {
     119                that.sequence.next();
     120                return false;
     121            });
     122        };
     123
     124    jQuery(document).ready(function($) {
     125       
     126        $('.bu-slideshow-container').each(function(index, el){
     127            var $this = $(this), autoplay = false, container, pagerId, arrowId,
     128                options, args, name, transition_delay;
     129           
     130            container = $this.find('.bu-slideshow-slides');
     131            pagerId = $this.find('ul.bu-slideshow-navigation').attr('id');
     132            arrowId = $this.find('div.bu-slideshow-arrows').attr('id');
     133           
     134            name = $this.attr('data-slideshow-name') ? $this.attr('data-slideshow-name') : index;
     135            transition_delay = $this.attr('data-slideshow-delay') ? $this.attr('data-slideshow-delay') : 5000;
     136
     137            if ($this.hasClass('autoplay')) {
     138                autoplay = true;
     139            }
     140           
     141            options = {
     142                autoPlay: autoplay,
     143                autoPlayDelay: transition_delay,
     144                fallback: {
     145                    theme : 'slide'
     146                },
     147                swipeEvents: {
     148                    left: "next",
     149                    right: "prev"
     150                }
     151            };
     152            args = {
     153                'show' : container.sequence(options).data('sequence'),
     154                'container' : container,
     155                'pager' : pagerId,
     156                'arrows' : arrowId
     157            };
     158           
     159            try {
     160                buSlideshows[name] = new BuSlideshow(args);
     161            }
     162            catch (e){
     163            }   
     164        });
     165
     166       
     167        /**
     168         * Dear IE: is this really a resize event?
     169         */
     170        $(window).resize(function() {
     171           
     172            var currentHeight, currentWidth;
     173           
     174            currentHeight = $(window).height();
     175            currentWidth = $(window).width();
     176           
     177            if (currentHeight !== windowHeight || currentWidth !== windowWidth) {
     178               
     179                windowHeight = currentHeight;
     180                windowWidth = currentWidth;
     181                bu_resize_slideshow();
     182           
     183            }
     184
     185        });
     186       
     187    });
     188}(jQuery));
  • bu-slideshow/trunk/interface/js/vendor/sequence/sequence.jquery.js

    r1000635 r1498422  
    1 (function(e){function m(c,d,b,g){function h(){a.afterLoaded();a.settings.hideFramesUntilPreloaded&&a.settings.preloader&&a.sequence.children("li").show();a.settings.preloader?a.settings.hidePreloaderUsingCSS&&a.transitionsSupported?(a.prependPreloadingCompleteTo=!0==a.settings.prependPreloadingComplete?a.settings.preloader:e(a.settings.prependPreloadingComplete),a.prependPreloadingCompleteTo.addClass("preloading-complete"),setTimeout(k,a.settings.hidePreloaderDelay)):a.settings.preloader.fadeOut(a.settings.hidePreloaderDelay,
    2 function(){clearInterval(a.defaultPreloader);k()}):k()}function f(a,b){function c(){var a=e(s),d=e(n);g&&(n.length?g.reject(l,a,d):g.resolve(l));e.isFunction(b)&&b.call(f,l,a,d)}function d(a,b){a.src!==BLANK&&-1===e.inArray(a,u)&&(u.push(a),b?n.push(a):s.push(a),e.data(a,"imagesLoaded",{isBroken:b,src:a.src}),h&&g.notifyWith(e(a),[b,l,e(s),e(n)]),l.length===u.length&&(setTimeout(c),l.unbind(".imagesLoaded")))}BLANK="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw==";var f=a,g=
    3 e.isFunction(e.Deferred)?e.Deferred():0,h=e.isFunction(g.notify),l=f.find("img").add(f.filter("img")),u=[],s=[],n=[];e.isPlainObject(b)&&e.each(b,function(a,l){if("callback"===a)b=l;else if(g)g[a](l)});l.length?l.bind("load.imagesLoaded error.imagesLoaded",function(a){d(a.target,"error"===a.type)}).each(function(a,b){var l=b.src,c=e.data(b,"imagesLoaded");if(c&&c.src===l)d(b,c.isBroken);else if(b.complete&&void 0!==b.naturalWidth)d(b,0===b.naturalWidth||0===b.naturalHeight);else if(b.readyState||
    4 b.complete)b.src=BLANK,b.src=l}):c()}function k(){e(a.settings.preloader).remove();a.nextButton=a.init.uiElements(a.settings.nextButton,".next");a.prevButton=a.init.uiElements(a.settings.prevButton,".prev");a.pauseButton=a.init.uiElements(a.settings.pauseButton,".pause");void 0!==a.nextButton&&!1!==a.nextButton&&a.settings.showNextButtonOnInit&&a.nextButton.show();void 0!==a.prevButton&&!1!==a.prevButton&&a.settings.showPrevButtonOnInit&&a.prevButton.show();void 0!==a.pauseButton&&!1!==a.pauseButton&&
    5 a.pauseButton.show();!1!==a.settings.pauseIcon?(a.pauseIcon=a.init.uiElements(a.settings.pauseIcon,".pause-icon"),void 0!==a.pauseIcon&&a.pauseIcon.hide()):a.pauseIcon=void 0;a.nextFrameID=a.settings.startingFrameID;a.settings.hashTags&&(a.sequence.children("li").each(function(){a.frameHashID.push(e(this).attr(a.getHashTagFrom))}),a.currentHashTag=location.hash.replace("#",""),void 0===a.currentHashTag||""===a.currentHashTag?a.nextFrameID=a.settings.startingFrameID:(a.frameHashIndex=e.inArray(a.currentHashTag,
    6 a.frameHashID),a.nextFrameID=-1!==a.frameHashIndex?a.frameHashIndex+1:a.settings.startingFrameID));a.nextFrame=a.sequence.children("li:nth-child("+a.nextFrameID+")");a.nextFrameChildren=a.nextFrame.children();a.sequence.css({width:"100%",height:"100%",position:"relative"});a.sequence.children("li").css({width:"100%",height:"100%",position:"absolute","z-index":1});a.transitionsSupported?a.settings.animateStartingFrameIn?a.settings.reverseAnimationsWhenNavigatingBackwards&&a.settings.autoPlayDirection-
    7 1&&a.settings.animateStartingFrameIn?(a.modifyElements(a.nextFrameChildren,"0s"),a.nextFrame.addClass("animate-out"),a.goTo(a.nextFrameID,-1)):a.goTo(a.nextFrameID,1):(a.currentFrameID=a.nextFrameID,a.settings.moveActiveFrameToTop&&a.nextFrame.css("z-index",a.numberOfFrames),a.modifyElements(a.nextFrameChildren,"0s"),a.nextFrame.addClass("animate-in"),a.settings.hashTags&&a.settings.hashChangesOnFirstFrame&&(a.currentHashTag=a.nextFrame.attr(a.getHashTagFrom),document.location.hash="#"+a.currentHashTag),
    8 setTimeout(function(){a.modifyElements(a.nextFrameChildren,"")},100),a.resetAutoPlay(!0,a.settings.autoPlayDelay)):(a.container.addClass("sequence-fallback"),a.currentFrameID=a.nextFrameID,a.settings.hashTags&&a.settings.hashChangesOnFirstFrame&&(a.currentHashTag=a.nextFrame.attr(a.getHashTagFrom),document.location.hash="#"+a.currentHashTag),a.sequence.children("li").addClass("animate-in"),a.sequence.children(":not(li:nth-child("+a.nextFrameID+"))").css({display:"none",opacity:0}),a.resetAutoPlay(!0,
    9 a.settings.autoPlayDelay));void 0!==a.nextButton&&a.nextButton.click(function(){a.next()});void 0!==a.prevButton&&a.prevButton.click(function(){a.prev()});void 0!==a.pauseButton&&a.pauseButton.click(function(){a.pause(!0)});if(a.settings.keyNavigation){var b={left:37,right:39},c=function(l,c){var d;for(keyCodes in c)d="left"===keyCodes||"right"===keyCodes?b[keyCodes]:keyCodes,l===parseFloat(d)&&a.initCustomKeyEvent(c[keyCodes])};e(document).keydown(function(b){var d=String.fromCharCode(b.keyCode);
    10 0<d&&d<=a.numberOfFrames&&a.settings.numericKeysGoToFrames&&(a.nextFrameID=d,a.goTo(a.nextFrameID));c(b.keyCode,a.settings.keyEvents);c(b.keyCode,a.settings.customKeyEvents)})}if(a.settings.pauseOnHover&&a.settings.autoPlay&&!a.hasTouch)a.sequence.on({mouseenter:function(){a.mouseover=!0;a.isHardPaused||a.pause()},mouseleave:function(){a.mouseover=!1;a.isHardPaused||a.unpause()}});a.settings.hashTags&&e(window).hashchange(function(){newTag=location.hash.replace("#","");a.currentHashTag!==newTag&&
    11 (a.currentHashTag=newTag,a.frameHashIndex=e.inArray(a.currentHashTag,a.frameHashID),-1!==a.frameHashIndex&&(a.nextFrameID=a.frameHashIndex+1,a.goTo(a.nextFrameID)))});if(a.settings.swipeNavigation&&a.hasTouch){var d,g,f=!1,h=function(){a.sequence.on("touchmove",k);d=null;f=!1},k=function(b){a.settings.swipePreventsDefault&&b.preventDefault();if(f){var c=d-b.originalEvent.touches[0].pageX;b=g-b.originalEvent.touches[0].pageY;Math.abs(c)>=a.settings.swipeThreshold?(h(),0<c?(a.initCustomKeyEvent(a.settings.swipeEvents.left)):(a.initCustomKeyEvent(a.settings.swipeEvents.right))):Math.abs(b)>=a.settings.swipeThreshold&&(h(),0<b?a.initCustomKeyEvent(a.settings.swipeEvents.down):a.initCustomKeyEvent(a.settings.swipeEvents.up))}};a.sequence.on("touchstart",function(b){1==b.originalEvent.touches.length&&(d=b.originalEvent.touches[0].pageX,g=b.originalEvent.touches[0].pageY,f=!0,a.sequence.on("touchmove",k))})}}var a=this;a.container=e(c);a.sequence=a.container.children("ul");
    12 try{if(Modernizr.prefixed,void 0===Modernizr.prefixed)throw"undefined";}catch(w){g.modernizr()}a.prefix={WebkitTransition:"-webkit-",MozTransition:"-moz-",OTransition:"-o-",msTransition:"-ms-",transition:""}[Modernizr.prefixed("transition")];a.transitionEnd={WebkitTransition:"webkitTransitionEnd webkitAnimationEnd",MozTransition:"transitionend animationend",OTransition:"otransitionend oanimationend",msTransition:"MSTransitionEnd MSAnimationEnd",transition:"transitionend animationend"}[Modernizr.prefixed("transition")];
    13 a.transitionProperties={};a.numberOfFrames=a.sequence.children("li").length;a.transitionsSupported=void 0!==a.prefix?!0:!1;a.hasTouch="ontouchstart"in window?!0:!1;a.active;a.navigationSkipThresholdActive=!1;a.autoPlayTimer;a.isPaused=!1;a.isHardPaused=!1;a.mouseover=!1;a.defaultPreloader;a.nextButton;a.prevButton;a.pauseButton;a.pauseIcon;a.delayUnpause;a.init={uiElements:function(b,c){switch(b){case !1:break;case !0:return".sequence-preloader"===c&&g.defaultPreloader(a.container,a.transitionsSupported,
    14 a.prefix),e(c);default:return e(b)}}};a.paused=function(){};a.unpaused=function(){};a.beforeNextFrameAnimatesIn=function(){};a.afterNextFrameAnimatesIn=function(){};a.beforeCurrentFrameAnimatesOut=function(){};a.afterCurrentFrameAnimatesOut=function(){};a.afterLoaded=function(){};a.settings=e.extend({},b,d);a.settings.preloader=a.init.uiElements(a.settings.preloader,".sequence-preloader");a.firstFrame=a.settings.animateStartingFrameIn?!0:!1;a.settings.unpauseDelay=null===a.settings.unpauseDelay?a.settings.autoPlayDelay:
    15 a.settings.unpauseDelay;a.currentHashTag;a.getHashTagFrom=a.settings.hashDataAttribute?"data-sequence-hashtag":"id";a.frameHashID=[];a.direction=a.settings.autoPlayDirection;a.settings.hideFramesUntilPreloaded&&a.settings.preloader&&a.sequence.children("li").hide();"-o-"===a.prefix&&(a.transitionsSupported=g.operaTest());a.modifyElements(a.sequence.children("li"),"0s");a.sequence.children("li").removeClass("animate-in");b=a.settings.preloadTheseFrames.length;c=a.settings.preloadTheseImages.length;
    16 !a.settings.preloader||0===b&&0===c?e(window).bind("load",function(){h();e(this).unbind("load")}):(d=function(b,c){var d=[];if(c)for(g=b;0<g;g--)d.push(e("body").find('img[src="'+a.settings.preloadTheseImages[g-1]+'"]')[0]);else for(var g=b;0<g;g--)a.sequence.children("li:nth-child("+a.settings.preloadTheseFrames[g-1]+")").find("img").each(function(){d.push(e(this)[0])});return d},b=d(b),c=d(c,!0),c=e(b.concat(c)),f(c,h))}m.prototype={initCustomKeyEvent:function(c){switch(c){case "next":this.next();
    17 break;case "prev":this.prev();break;case "pause":this.pause(!0)}},modifyElements:function(c,d){c.css(this.prefixCSS(this.prefix,{"transition-duration":d,"transition-delay":d}))},prefixCSS:function(c,d){var b={};for(property in d)b[c+property]=d[property];return b},setTransitionProperties:function(c){var d=this;c.each(function(){d.transitionProperties["transition-duration"]=e(this).css(d.prefix+"transition-duration");d.transitionProperties["transition-delay"]=e(this).css(d.prefix+"transition-delay");
    18 e(this).css(d.prefixCSS(d.prefix,d.transitionProperties))})},startAutoPlay:function(c){var d=this;c=void 0===c?d.settings.autoPlayDelay:c;d.unpause();d.resetAutoPlay();d.autoPlayTimer=setTimeout(function(){1===d.settings.autoPlayDirection?d.next():d.prev()},c)},stopAutoPlay:function(){this.pause(!0);clearTimeout(this.autoPlayTimer)},resetAutoPlay:function(c,d){var b=this;!0===c?b.settings.autoPlay&&!b.isPaused&&(clearTimeout(b.autoPlayTimer),b.autoPlayTimer=setTimeout(function(){1===b.settings.autoPlayDirection?
    19 b.next():b.prev()},d)):clearTimeout(b.autoPlayTimer)},pause:function(c){this.isPaused?this.unpause():(void 0!==this.pauseButton&&(this.pauseButton.addClass("paused"),void 0!==this.pauseIcon&&this.pauseIcon.show()),this.paused(),this.isPaused=!0,this.isHardPaused=c?!0:!1,this.resetAutoPlay())},unpause:function(c){void 0!==this.pauseButton&&(this.pauseButton.removeClass("paused"),void 0!==this.pauseIcon&&this.pauseIcon.hide());this.isHardPaused=this.isPaused=!1;this.active?this.delayUnpause=!0:(!1!==
    20 c&&this.unpaused(),this.resetAutoPlay(!0,this.settings.unpauseDelay))},next:function(){this.nextFrameID=this.currentFrameID!==this.numberOfFrames?this.currentFrameID+1:1;this.goTo(this.nextFrameID,1)},prev:function(){this.nextFrameID=1===this.currentFrameID?this.numberOfFrames:this.currentFrameID-1;this.goTo(this.nextFrameID,-1)},goTo:function(c,d){var b=this;c=parseFloat(c);if(c===b.currentFrameID||b.settings.navigationSkip&&b.navigationSkipThresholdActive||!b.settings.navigationSkip&&b.active||
    21 !b.transitionsSupported&&b.active||!b.settings.cycle&&1===d&&b.currentFrameID===b.numberOfFrames||!b.settings.cycle&&-1===d&&1===b.currentFrameID||b.settings.preventReverseSkipping&&b.direction!==d&&b.active)return!1;b.settings.navigationSkip&&b.active&&(b.navigationSkipThresholdActive=!0,b.settings.fadeFrameWhenSkipped&&b.nextFrame.stop().animate({opacity:0},b.settings.fadeFrameTime),navigationSkipThresholdTimer=setTimeout(function(){b.navigationSkipThresholdActive=!1},b.settings.navigationSkipThreshold));
    22 if(!b.active||b.settings.navigationSkip){b.active=!0;b.resetAutoPlay();b.direction=void 0===d?c>b.currentFrameID?1:-1:d;b.currentFrame=b.sequence.children(".animate-in");b.nextFrame=b.sequence.children("li:nth-child("+c+")");b.frameChildren=b.currentFrame.children();b.nextFrameChildren=b.nextFrame.children();if(b.transitionsSupported)void 0!==b.currentFrame.length?(b.beforeCurrentFrameAnimatesOut(),b.settings.moveActiveFrameToTop&&b.currentFrame.css("z-index",1),b.modifyElements(b.nextFrameChildren,
    23 "0s"),b.settings.reverseAnimationsWhenNavigatingBackwards&&1!==b.direction)?b.settings.reverseAnimationsWhenNavigatingBackwards&&-1===b.direction&&(b.nextFrame.addClass("animate-out"),b.setTransitionProperties(b.frameChildren)):(b.nextFrame.removeClass("animate-out"),b.modifyElements(b.frameChildren,"")):b.firstFrame=!1,b.active=!0,b.currentFrame.unbind(b.transitionEnd),b.nextFrame.unbind(b.transitionEnd),b.settings.fadeFrameWhenSkipped&&b.nextFrame.css("opacity",1),b.beforeNextFrameAnimatesIn(),
    24 b.settings.moveActiveFrameToTop&&b.nextFrame.css({"z-index":b.numberOfFrames}),b.settings.reverseAnimationsWhenNavigatingBackwards&&1!==b.direction?b.settings.reverseAnimationsWhenNavigatingBackwards&&-1===b.direction&&setTimeout(function(){b.modifyElements(b.nextFrameChildren,"");b.setTransitionProperties(b.frameChildren);b.waitForAnimationsToComplete(b.nextFrame,b.nextFrameChildren,"in");"function () {}"!=b.afterCurrentFrameAnimatesOut&&b.waitForAnimationsToComplete(b.currentFrame,b.frameChildren,
    25 "out")},50):setTimeout(function(){b.modifyElements(b.nextFrameChildren,"");b.waitForAnimationsToComplete(b.nextFrame,b.nextFrameChildren,"in");"function () {}"!==b.afterCurrentFrameAnimatesOut&&b.waitForAnimationsToComplete(b.currentFrame,b.frameChildren,"out")},50),b.settings.reverseAnimationsWhenNavigatingBackwards&&1!==b.direction?b.settings.reverseAnimationsWhenNavigatingBackwards&&-1===b.direction&&setTimeout(function(){b.nextFrame.toggleClass("animate-out animate-in");b.currentFrame.removeClass("animate-in")},
    26 50):setTimeout(function(){b.currentFrame.toggleClass("animate-out animate-in");b.nextFrame.addClass("animate-in")},50);else{var e=function(){b.setHashTag();b.active=!1;b.resetAutoPlay(!0,b.settings.autoPlayDelay)};switch(b.settings.fallback.theme){case "fade":b.sequence.children("li").css({position:"relative"});b.beforeCurrentFrameAnimatesOut();b.currentFrame=b.sequence.children("li:nth-child("+b.currentFrameID+")");b.currentFrame.animate({opacity:0},b.settings.fallback.speed,function(){b.currentFrame.css({display:"none",
    27 "z-index":"1"});b.afterCurrentFrameAnimatesOut();b.beforeNextFrameAnimatesIn();b.nextFrame.css({display:"block","z-index":b.numberOfFrames}).animate({opacity:1},500,function(){b.afterNextFrameAnimatesIn()});e()});b.sequence.children("li").css({position:"relative"});break;default:var h={},f={},k={};1===b.direction?(h.left="-100%",f.left="100%"):(h.left="100%",f.left="-100%");k.left="0";k.opacity=1;b.currentFrame=b.sequence.children("li:nth-child("+b.currentFrameID+")");b.beforeCurrentFrameAnimatesOut();
    28 b.currentFrame.animate(h,b.settings.fallback.speed,function(){b.afterCurrentFrameAnimatesOut()});b.beforeNextFrameAnimatesIn();b.nextFrame.show().css(f);b.nextFrame.animate(k,b.settings.fallback.speed,function(){e();b.afterNextFrameAnimatesIn()})}}b.currentFrameID=c}},waitForAnimationsToComplete:function(c,d,b){var g=this;if("out"===b)var h=function(){g.afterCurrentFrameAnimatesOut()};else"in"===b&&(h=function(){g.afterNextFrameAnimatesIn();g.setHashTag();g.active=!1;g.isHardPaused||g.mouseover||
    29 (g.delayUnpause?(g.delayUnpause=!1,g.unpause()):g.unpause(!1))});d.data("animationEnded",!1);c.bind(g.transitionEnd,function(b){e(b.target).data("animationEnded",!0);var k=!0;d.each(function(){if(!1===e(this).data("animationEnded"))return k=!1});k&&(c.unbind(g.transitionEnd),h())})},setHashTag:function(){this.settings.hashTags&&(this.currentHashTag=this.nextFrame.attr(this.getHashTagFrom),this.frameHashIndex=e.inArray(this.currentHashTag,this.frameHashID),-1===this.frameHashIndex||!this.settings.hashChangesOnFirstFrame&&
    30 this.firstFrame&&this.transitionsSupported?(this.nextFrameID=this.settings.startingFrameID,this.firstFrame=!1):(this.nextFrameID=this.frameHashIndex+1,document.location.hash="#"+this.currentHashTag))}};e.fn.sequence=function(c){return this.each(function(){var d=new m(e(this),c,y,z);e(this).data("sequence",d)})};var z={modernizr:function(){window.Modernizr=function(c,d,b){function e(c,d){for(var g in c){var f=c[g];if(!~(""+f).indexOf("-")&&a[f]!==b)return"pfx"==d?f:!0}return!1}function h(a,c,d){var f=
    31 a.charAt(0).toUpperCase()+a.slice(1),h=(a+" "+w.join(f+" ")+f).split(" ");if("string"===typeof c||"undefined"===typeof c)c=e(h,c);else a:{h=(a+" "+m.join(f+" ")+f).split(" "),a=h;for(var k in a)if(f=c[a[k]],f!==b){c=!1===d?a[k]:"function"===typeof f?f.bind(d||c):f;break a}c=!1}return c}var f={},k=d.documentElement;c=d.createElement("modernizr");var a=c.style,w=["Webkit","Moz","O","ms"],m=["webkit","moz","o","ms"];c={};var x=[],r=x.slice,q,t={}.hasOwnProperty,p;"undefined"===typeof t||"undefined"===
    32 typeof t.call?p=function(a,b){return b in a&&"undefined"===typeof a.constructor.prototype[b]}:p=function(a,b){return t.call(a,b)};Function.prototype.bind||(Function.prototype.bind=function(a){var b=self;if("function"!=typeof b)throw new TypeError;var c=r.call(arguments,1),d=function(){if(self instanceof d){var e=function(){};e.prototype=b.prototype;var e=new e,f=b.apply(e,c.concat(r.call(arguments)));return Object(f)===f?f:e}return b.apply(a,c.concat(r.call(arguments)))};return d});c.svg=function(){return!!d.createElementNS&&
    33 !!d.createElementNS("http://www.w3.org/2000/svg","svg").createSVGRect};for(var v in c)p(c,v)&&(q=v.toLowerCase(),f[q]=c[v](),x.push((f[q]?"":"no-")+q));f.addTest=function(a,c){if("object"==typeof a)for(var d in a)p(a,d)&&f.addTest(d,a[d]);else{a=a.toLowerCase();if(f[a]!==b)return f;c="function"==typeof c?c():c;enableClasses&&(k.className+=" "+(c?"":"no-")+a);f[a]=c}return f};a.cssText="";return c=null,f._version="2.6.1",f._domPrefixes=m,f._cssomPrefixes=w,f.testProp=function(a){return e([a])},f.testAllProps=
    34 h,f.prefixed=function(a,b,c){return b?h(a,b,c):h(a,"pfx")},f}(self,self.document)},defaultPreloader:function(c,d,b){e("head").append("<style>.sequence-preloader{height: 100%;position: absolute;width: 100%;z-index: 999999;}@"+b+"keyframes preload{0%{opacity: 1;}50%{opacity: 0;}100%{opacity: 1;}}.sequence-preloader .preloading .circle{fill: #ff9442;display: inline-block;height: 12px;position: relative;top: -50%;width: 12px;"+b+"animation: preload 1s infinite; animation: preload 1s infinite;}.preloading{display:block;height: 12px;margin: 0 auto;top: 50%;margin-top:-6px;position: relative;width: 48px;}.sequence-preloader .preloading .circle:nth-child(2){"+
    35 b+"animation-delay: .15s; animation-delay: .15s;}.sequence-preloader .preloading .circle:nth-child(3){"+b+"animation-delay: .3s; animation-delay: .3s;}.preloading-complete{opacity: 0;visibility: hidden;"+b+"transition-duration: 1s; transition-duration: 1s;}div.inline{background-color: #ff9442; margin-right: 4px; float: left;}</style>");c.prepend('<div class="sequence-preloader"><svg class="preloading" xmlns="http://www.w3.org/2000/svg"><circle class="circle" cx="6" cy="6" r="6" /><circle class="circle" cx="22" cy="6" r="6" /><circle class="circle" cx="38" cy="6" r="6" /></svg></div>');
    36 Modernizr.svg||d?d||setInterval(function(){e(".sequence-preloader").fadeToggle(500)},500):(e(".sequence-preloader").prepend('<div class="preloading"><div class="circle inline"></div><div class="circle inline"></div><div class="circle inline"></div></div>'),setInterval(function(){e(".sequence-preloader .circle").fadeToggle(500)},500))},operaTest:function(){e("body").append('<span id="sequence-opera-test"></span>');var c=e("#sequence-opera-test");c.css("-o-transition","1s");return"1s"!=c.css("-o-transition")?
    37 !1:!0}},y={startingFrameID:1,cycle:!0,animateStartingFrameIn:!1,reverseAnimationsWhenNavigatingBackwards:!0,moveActiveFrameToTop:!0,autoPlay:!0,autoPlayDirection:1,autoPlayDelay:5E3,navigationSkip:!0,navigationSkipThreshold:250,fadeFrameWhenSkipped:!0,fadeFrameTime:150,preventReverseSkipping:!1,nextButton:!1,showNextButtonOnInit:!0,prevButton:!1,showPrevButtonOnInit:!0,pauseButton:!1,unpauseDelay:null,pauseOnHover:!0,pauseIcon:!1,preloader:!1,preloadTheseFrames:[1],preloadTheseImages:[],hideFramesUntilPreloaded:!0,
    38 prependPreloadingComplete:!0,hidePreloaderUsingCSS:!0,hidePreloaderDelay:0,keyNavigation:!0,numericKeysGoToFrames:!0,keyEvents:{left:"prev",right:"next"},customKeyEvents:{},swipeNavigation:!0,swipeThreshold:20,swipePreventsDefault:!1,swipeEvents:{left:"prev",right:"next",up:!1,down:!1},hashTags:!1,hashDataAttribute:!1,hashChangesOnFirstFrame:!1,fallback:{theme:"slide",speed:500}}})(jQuery);
     1/*
     2Sequence.js (http://www.sequencejs.com)
     3Version: 0.8.3 Beta
     4Author: Ian Lunn @IanLunn
     5Author URL: http://www.ianlunn.co.uk/
     6Github: https://github.com/IanLunn/Sequence
     7
     8This is a FREE script and is available under a MIT License:
     9http://www.opensource.org/licenses/mit-license.php
     10
     11Sequence.js and its dependencies are (c) Ian Lunn Design 2012 unless otherwise stated.
     12
     13Sequence also relies on the following open source scripts:
     14
     15-   jQuery imagesLoaded 2.1.0 (http://github.com/desandro/imagesloaded)
     16    Paul Irish et al
     17    Available under a MIT License: http://www.opensource.org/licenses/mit-license.php
     18
     19-   jQuery TouchWipe 1.1.1 (http://www.netcu.de/jquery-touchwipe-iphone-ipad-library)
     20    Andreas Waltl, netCU Internetagentur (http://www.netcu.de)
     21    Available under a MIT License: http://www.opensource.org/licenses/mit-license.php
     22
     23-   Modernizr 2.6.1 Custom Build (http://modernizr.com/)
     24    Copyright (c) Faruk Ates, Paul Irish, Alex Sexton
     25    Available under the BSD and MIT licenses: www.modernizr.com/license/
     26
     27*/
     28
     29(function($) {
     30    function Sequence(element, options, defaults, get) {
     31        var self = this;
     32        self.container = $(element),
     33        self.sequence = self.container.children("ul");
     34       
     35        try { //is Modernizr.prefixed installed?
     36            Modernizr.prefixed;
     37            if(Modernizr.prefixed === undefined){
     38                throw "undefined";
     39            }
     40        }
     41        catch(err) { //if not...get the custom build necessary for Sequence
     42            get.modernizr();
     43        }
     44       
     45        var prefixes = { //convert JS transition names to CSS names
     46            'WebkitTransition' : '-webkit-',
     47            'MozTransition'    : '-moz-',
     48            'OTransition'      : '-o-',
     49            'msTransition'     : '-ms-',
     50            'transition'       : ''
     51        },
     52        transitions = { //convert JS transition names to JS transition end and animation end event names
     53            'WebkitTransition' : 'webkitTransitionEnd webkitAnimationEnd',
     54            'MozTransition'    : 'transitionend animationend',
     55            'OTransition'      : 'otransitionend oanimationend',
     56            'msTransition'     : 'MSTransitionEnd MSAnimationEnd',
     57            'transition'       : 'transitionend animationend'
     58        };
     59       
     60        self.prefix = prefixes[Modernizr.prefixed('transition')], //work out the CSS prefix for the browser being used (-webkit- for example)
     61        self.transitionEnd = transitions[Modernizr.prefixed('transition')], //work out the JS transitionEnd name for the browser being used (webkitTransitionEnd webkitAnimationEnd for example)
     62        self.transitionProperties = {},
     63        self.numberOfFrames = self.sequence.children("li").length, //number of frames (<li>) Sequence consists of
     64
     65        self.transitionsSupported = (self.prefix !== undefined) ? true : false, //determine if transitions are supported
     66        self.hasTouch = ("ontouchstart" in window) ? true : false, //determine if this is a touch enabled device
     67        self.active, //determines whether Sequence is animating
     68        self.navigationSkipThresholdActive = false, //when active, navigation is prevented (used to stop very fast navigation)
     69        self.autoPlayTimer, //the timer used for the autoPlay feature
     70        self.isPaused = false, //whether Sequence is paused via being hovered over
     71        self.isHardPaused = false, //whether Sequence is paused via a pause button
     72        self.mouseover = false,
     73        self.defaultPreloader,
     74        self.nextButton,
     75        self.prevButton,
     76        self.pauseButton,
     77        self.pauseIcon,
     78        self.delayUnpause,
     79        self.init = {
     80            /*functionality to initiate the preloader, next/previous buttons and so on
     81           
     82            devOption: true = the developer wants to use the default selector. false = don't use a uiElement. string = the developer defined selector to use for the UI element
     83            defaultOption: the default selector to use for the UI element, when the developer specifies false for devOption
     84            */
     85            uiElements: function(devOption, defaultOption) {
     86                switch(devOption) {
     87                    case false: //don't set up a uiElement
     88                        return undefined;
     89
     90                    case true: //use the default uiElement
     91                        if(defaultOption === ".sequence-preloader") { //if setting up the preloader...
     92                            get.defaultPreloader(self.container, self.transitionsSupported, self.prefix); //get the default preloader
     93                        };
     94                        return $(defaultOption); //return the default element
     95
     96                    default: //if using a developer defined selector...
     97                        return $(devOption); //return the developer defined element
     98                }
     99            }
     100        };
     101
     102        //Callbacks
     103        self.paused = function() {},                        //executes when Sequence is paused
     104        self.unpaused = function() {},                      //executes when Sequence is unpaused
     105       
     106        self.beforeNextFrameAnimatesIn = function() {},     //executes before the next frame animates in
     107        self.afterNextFrameAnimatesIn = function() {},      //executes after the next frame animates in
     108        self.beforeCurrentFrameAnimatesOut = function() {}, //executes before the current frame animates out
     109        self.afterCurrentFrameAnimatesOut = function() {},  //executes after the current frame animates out
     110
     111        self.afterLoaded = function() {};                   //executes after Sequence is initiated
     112       
     113        //INIT
     114        self.settings = $.extend({}, defaults, options); //combine default options with developer defined ones
     115        self.settings.preloader = self.init.uiElements(self.settings.preloader, ".sequence-preloader"); //set up the preloader and save it
     116        self.firstFrame = (self.settings.animateStartingFrameIn) ? true : false; //determine if the first frame should animate in
     117        self.settings.unpauseDelay = (self.settings.unpauseDelay === null) ? self.settings.autoPlayDelay : self.settings.unpauseDelay; //if the unpauseDelay is not specified, make it the same as the autoPlayDelay speed
     118        self.currentHashTag; //the current hash tag taken from the URL
     119        self.getHashTagFrom = (self.settings.hashDataAttribute) ? "data-sequence-hashtag": "id"; //get the hashtag from the ID or data attribute? 
     120        self.frameHashID = []; //array that matches frames with has IDs
     121        self.direction = self.settings.autoPlayDirection;
     122       
     123        if(self.settings.hideFramesUntilPreloaded && self.settings.preloader) { //if using a preloader and hiding frames until preloading has completed...
     124            self.sequence.children("li").hide(); //hide Sequence's frames
     125        }
     126       
     127        if(self.prefix === "-o-") { //if Opera prefixes are required...
     128            self.transitionsSupported = get.operaTest(); //run a test to see if Opera correctly supports transitions (Opera 11 has bugs relating to transitions)
     129        }
     130       
     131        self.modifyElements(self.sequence.children("li"), "0s"); //reset transition time to 0s
     132        self.sequence.children("li").removeClass("animate-in"); //remove any instance of "animate-in", which should be used incase JS is disabled
     133       
     134        //functionality to run once Sequence has preloaded
     135        function oncePreloaded() {
     136            self.afterLoaded(); //callback
     137            if(self.settings.hideFramesUntilPreloaded && self.settings.preloader) {
     138                self.sequence.children("li").show();
     139            }
     140            if(self.settings.preloader){
     141                if(self.settings.hidePreloaderUsingCSS && self.transitionsSupported) {
     142                    self.prependPreloadingCompleteTo = (self.settings.prependPreloadingComplete == true) ? self.settings.preloader : $(self.settings.prependPreloadingComplete);
     143                    self.prependPreloadingCompleteTo.addClass("preloading-complete");
     144                    setTimeout(init, self.settings.hidePreloaderDelay);
     145                }else{
     146
     147                    self.settings.preloader.fadeOut(self.settings.hidePreloaderDelay, function() {
     148                        clearInterval(self.defaultPreloader);
     149                        init();
     150                    });
     151                }
     152            }else{
     153                init();
     154            }
     155        }
     156
     157        var preloadTheseFramesLength = self.settings.preloadTheseFrames.length; //how many frames to preload?
     158        var preloadTheseImagesLength = self.settings.preloadTheseImages.length; //how many single images to load?
     159
     160        if(self.settings.preloader && (preloadTheseFramesLength !== 0 || preloadTheseImagesLength !== 0)) { //if using the preloader and the dev has specified some images should preload...
     161            function saveImagesToArray(length, srcOnly) {
     162                var imagesToPreload = []; //saves the images that are to be preloaded
     163                    if(!srcOnly){
     164                        for(var i = length; i > 0; i--){ //for each frame to be preloaded...
     165                            self.sequence.children("li:nth-child("+self.settings.preloadTheseFrames[i-1]+")").find("img").each(function() { //find <img>'s in specific frames, and for each found...
     166                                imagesToPreload.push($(this)[0]); //add it to the array of images to be preloaded
     167                            });
     168                        }
     169                    }else{
     170                        for(var i = length; i > 0; i--) { //for each frame to be preloaded...
     171                            imagesToPreload.push($("body").find('img[src="'+self.settings.preloadTheseImages[i-1]+'"]')[0]); //find any <img> with the given source and add it to the array of images to be preloaded
     172                        }
     173                    }               
     174                return imagesToPreload;
     175            }
     176   
     177            var frameImagesToPreload = saveImagesToArray(preloadTheseFramesLength); //get images from particular Sequence frames to be preloaded
     178            var individualImagesToPreload = saveImagesToArray(preloadTheseImagesLength, true); //get images with specific source values to be preloaded
     179            var imagesToPreload = $(frameImagesToPreload.concat(individualImagesToPreload)); //combine frame images and individual images
     180            var imagesToPreloadLength = imagesToPreload.length;
     181
     182            imagesLoaded(imagesToPreload, oncePreloaded);
     183        }else{ //if not using the preloader...
     184            $(window).bind("load", function() { //when the window loads...
     185                oncePreloaded(); //run the init functionality when the preloader has finished
     186                $(this).unbind("load"); //unbind the load event as it's no longer needed
     187            });
     188        }
     189
     190        //jQuery imagesLoaded plugin v2.1.0 (http://github.com/desandro/imagesloaded)
     191        function imagesLoaded(imagesToPreload, callback) {
     192            BLANK = "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw==";
     193            var $this = imagesToPreload,
     194                deferred = $.isFunction($.Deferred) ? $.Deferred() : 0,
     195                hasNotify = $.isFunction(deferred.notify),
     196                $images = $this.find('img').add( $this.filter('img') ),
     197                loaded = [],
     198                proper = [],
     199                broken = [];
     200
     201            //Register deferred callbacks
     202            if($.isPlainObject(callback)) {
     203                $.each(callback, function(key, value) {
     204                    if(key === 'callback') {
     205                        callback = value;
     206                    }else if(deferred) {
     207                        deferred[key](value);
     208                    }
     209                });
     210            }
     211
     212            function doneLoading() {
     213                var $proper = $(proper),
     214                    $broken = $(broken);
     215
     216                if(deferred) {
     217                    if(broken.length) {
     218                        deferred.reject($images, $proper, $broken);
     219                    }else{
     220                        deferred.resolve($images);
     221                    }
     222                }
     223
     224                if($.isFunction(callback)) {
     225                    callback.call($this, $images, $proper, $broken);
     226                }
     227            }
     228
     229            function imgLoaded( img, isBroken ) {   
     230                if(img.src === BLANK || $.inArray(img, loaded) !== -1) { // don't proceed if BLANK image, or image is already loaded
     231                    return;
     232                }
     233               
     234                loaded.push(img); // store element in loaded images array
     235
     236                if(isBroken) { // keep track of broken and properly loaded images
     237                    broken.push(img);
     238                }else{
     239                    proper.push(img);
     240                }
     241
     242                $.data(img, 'imagesLoaded', {isBroken: isBroken, src: img.src }); // cache image and its state for future calls
     243
     244                if(hasNotify) { // trigger deferred progress method if present
     245                    deferred.notifyWith($(img), [isBroken, $images, $(proper), $(broken)]);
     246                }
     247
     248                if($images.length === loaded.length) { // call doneLoading and clean listeners if all images are loaded
     249                    setTimeout(doneLoading);
     250                    $images.unbind('.imagesLoaded');
     251                }
     252            }
     253
     254            if(!$images.length) { // if no images, trigger immediately
     255                doneLoading();
     256            }else{
     257                $images.bind('load.imagesLoaded error.imagesLoaded', function(event) {
     258                    imgLoaded(event.target, event.type === 'error'); // trigger imgLoaded
     259                }).each(function(i, el) {
     260                    var src = el.src;
     261                    var cached = $.data(el, 'imagesLoaded'); // find out if this image has been already checked for status if it was, and src has not changed, call imgLoaded on it
     262                    if(cached && cached.src === src) {
     263                        imgLoaded(el, cached.isBroken);
     264                        return;
     265                    }
     266
     267                    if(el.complete && el.naturalWidth !== undefined) { // if complete is true and browser supports natural sizes, try to check for image status manually
     268                        imgLoaded(el, el.naturalWidth === 0 || el.naturalHeight === 0);
     269                        return;
     270                    }
     271
     272                    // cached images don't fire load sometimes, so we reset src, but only when dealing with IE, or image is complete (loaded) and failed manual check webkit hack from http://groups.google.com/group/jquery-dev/browse_thread/thread/eee6ab7b2da50e1f
     273                    if(el.readyState || el.complete) {
     274                        el.src = BLANK;
     275                        el.src = src;
     276                    }
     277                });
     278            }
     279        };     
     280       
     281        function init() {
     282            $(self.settings.preloader).remove(); //remove the preloader element
     283           
     284            self.nextButton = self.init.uiElements(self.settings.nextButton, ".next"); //set up the next button
     285            self.prevButton = self.init.uiElements(self.settings.prevButton, ".prev"); //set up the previous button
     286            self.pauseButton = self.init.uiElements(self.settings.pauseButton, ".pause"); //set up the pause button
     287           
     288            if((self.nextButton !== undefined && self.nextButton !== false) && self.settings.showNextButtonOnInit){self.nextButton.show();} //if using a next button, show it
     289            if((self.prevButton !== undefined && self.prevButton !== false) && self.settings.showPrevButtonOnInit){self.prevButton.show();} //if using a previous button, show it           
     290            if((self.pauseButton !== undefined && self.pauseButton !== false)){self.pauseButton.show();} //if using a pause button, show it
     291                       
     292            if(self.settings.pauseIcon !== false) {
     293                self.pauseIcon = self.init.uiElements(self.settings.pauseIcon, ".pause-icon");
     294                if(self.pauseIcon !== undefined) {
     295                    self.pauseIcon.hide();
     296                }
     297            }else{
     298                self.pauseIcon = undefined;
     299            }
     300
     301            self.nextFrameID = self.settings.startingFrameID;
     302                       
     303            if(self.settings.hashTags) { //if using hashtags...
     304                self.sequence.children("li").each(function() { //for each frame...
     305                    self.frameHashID.push($(this).attr(self.getHashTagFrom)); //add the hashtag to an array
     306                });
     307                               
     308                self.currentHashTag = location.hash.replace("#", ""); //get the current hashtag
     309                if(self.currentHashTag === undefined || self.currentHashTag === "") { //if there is no hashtag...
     310                    self.nextFrameID = self.settings.startingFrameID; //use the startingFrameID
     311                }else{                 
     312                    self.frameHashIndex = $.inArray(self.currentHashTag, self.frameHashID); //get the index of the frame that matches the hashtag
     313                    if(self.frameHashIndex !== -1){  //if the hashtag matches a Sequence frame ID...
     314                        self.nextFrameID = self.frameHashIndex + 1; //use the frame associated to the hashtag
     315                    }else{                     
     316                        self.nextFrameID = self.settings.startingFrameID; //use the startingFrameID
     317                    }
     318                }
     319            }
     320
     321            self.nextFrame = self.sequence.children("li:nth-child("+self.nextFrameID+")");
     322            self.nextFrameChildren = self.nextFrame.children();
     323           
     324            self.sequence.css({"width": "100%", "height": "100%", "position": "relative"}); //set the sequence list to 100% width/height just incase it hasn't been specified in the CSS
     325            self.sequence.children("li").css({"width": "100%", "height": "100%", "position": "absolute", "z-index": 1}); //do the same for the frames and make them absolute
     326
     327            if(self.transitionsSupported) { //initiate the full featured Sequence if transitions are supported...
     328                if(!self.settings.animateStartingFrameIn) { //start first frame in animated in position
     329                    self.currentFrameID = self.nextFrameID;
     330
     331                    if(self.settings.moveActiveFrameToTop) {
     332                        self.nextFrame.css("z-index", self.numberOfFrames);
     333                    }
     334                    self.modifyElements(self.nextFrameChildren, "0s");
     335                    self.nextFrame.addClass("animate-in");
     336                    if(self.settings.hashTags && self.settings.hashChangesOnFirstFrame) {
     337                        self.currentHashTag = self.nextFrame.attr(self.getHashTagFrom);
     338                        document.location.hash = "#"+self.currentHashTag;
     339                    }
     340                   
     341                    setTimeout(function() {
     342                        self.modifyElements(self.nextFrameChildren, "");
     343                    }, 100);
     344                   
     345                    self.resetAutoPlay(true, self.settings.autoPlayDelay);
     346                }else if(self.settings.reverseAnimationsWhenNavigatingBackwards && self.settings.autoPlayDirection -1 && self.settings.animateStartingFrameIn) { //animate in backwards
     347                    self.modifyElements(self.nextFrameChildren, "0s");
     348                    self.nextFrame.addClass("animate-out");
     349                    self.goTo(self.nextFrameID, -1);
     350                }else{ //animate in forwards
     351                    self.goTo(self.nextFrameID, 1);
     352                }
     353            }else{ //initiate a basic slider for browsers that don't support CSS3 transitions
     354                self.container.addClass("sequence-fallback");
     355                self.currentFrameID = self.nextFrameID;
     356                if(self.settings.hashTags && self.settings.hashChangesOnFirstFrame){
     357                    self.currentHashTag = self.nextFrame.attr(self.getHashTagFrom);
     358                    document.location.hash = "#"+self.currentHashTag;
     359                }
     360
     361          self.sequence.children("li").addClass("animate-in");
     362          self.sequence.children(":not(li:nth-child("+self.nextFrameID+"))").css({"display": "none", "opacity": 0});
     363          self.resetAutoPlay(true, self.settings.autoPlayDelay);
     364            }
     365            //END INIT
     366            //EVENTS
     367            if(self.nextButton !== undefined) { //if a next button is defined...
     368                self.nextButton.click(function() { //when the next button is clicked...
     369                    self.next(); //go to the next frame
     370                });
     371            }
     372                                   
     373            if(self.prevButton !== undefined) { //if a previous button is defined...
     374                self.prevButton.click(function() { //when the previous button is clicked...
     375                    self.prev(); //go to the previous frame
     376                });
     377            }
     378                       
     379            if(self.pauseButton !== undefined) { //if a pause button is defined...
     380                self.pauseButton.click(function() { //when the pause button is clicked...
     381                    self.pause(true); //pause Sequence and set hardPause to true
     382                });
     383            }
     384           
     385            if(self.settings.keyNavigation) {
     386                var defaultKeys = {
     387                    'left'  : 37,
     388                    'right' : 39
     389                };
     390
     391                function keyEvents(keyPressed, keyDirections) {
     392                        var keyCode;
     393
     394                        for(keyCodes in keyDirections) {
     395                            if(keyCodes === "left" || keyCodes === "right") {
     396                                keyCode = defaultKeys[keyCodes];
     397                            }else{
     398                                keyCode = keyCodes;
     399                            }
     400
     401                            if(keyPressed === parseFloat(keyCode)) { //if the key pressed is associated with a function...
     402                                self.initCustomKeyEvent(keyDirections[keyCodes]); //initiate the function
     403                            }
     404                        }
     405                    }
     406               
     407                $(document).keydown(function(e) { //when a key is pressed...                   
     408                    var keyCodeChar = String.fromCharCode(e.keyCode);
     409                    if((keyCodeChar > 0 && keyCodeChar <= self.numberOfFrames) && (self.settings.numericKeysGoToFrames)) {
     410                        self.nextFrameID = keyCodeChar;
     411                        self.goTo(self.nextFrameID); //go to specified frame
     412                    }
     413                   
     414                    keyEvents(e.keyCode, self.settings.keyEvents); //run default keyevents
     415                    keyEvents(e.keyCode, self.settings.customKeyEvents); //run custom keyevents
     416                });
     417            }
     418
     419            if(self.settings.pauseOnHover && self.settings.autoPlay && !self.hasTouch) { //if using pauseOnHover and autoPlay on non touch devices
     420                self.sequence.on({
     421                    mouseenter: function() { //when the mouse enter the Sequence element...
     422                        self.mouseover = true;
     423                        if(!self.isHardPaused) { //if Sequence is hard paused (via a pause button)...
     424                            self.pause(); //pause autoPlay
     425                        }
     426                    },
     427                    mouseleave: function() { //when the mouse leaves the Sequence element...
     428                        self.mouseover = false;
     429                        if(!self.isHardPaused) { //if Sequence is not hard paused (via a pause button)...
     430                            self.unpause(); //unpause autoPlay
     431                        }
     432                    }
     433                });
     434            }
     435           
     436            if(self.settings.hashTags) { //if hashchange is enabled in the settings...
     437                $(window).hashchange(function() { //when the hashtag changes...
     438                    newTag = location.hash.replace("#", ""); //grab the new hashtag
     439                   
     440                    if(self.currentHashTag !== newTag) { //if the last hashtag is not the same as the current one...
     441                        self.currentHashTag = newTag; //save the new tag
     442                        self.frameHashIndex = $.inArray(self.currentHashTag, self.frameHashID); //get the index of the frame that matches the hashtag
     443                        if(self.frameHashIndex !== -1) { //if the hashtag matches a Sequence frame ID...
     444                            self.nextFrameID = self.frameHashIndex + 1; //set that frame as the next one
     445                            self.goTo(self.nextFrameID); //go to the next frame
     446                        }
     447                    }
     448                });
     449            }
     450
     451            if(self.settings.swipeNavigation && self.hasTouch) { //if using swipeNavigation and the device has touch capabilities...
     452                //jQuery TouchWipe v1.1.1 (http://www.netcu.de/jquery-touchwipe-iphone-ipad-library)
     453                var startX;
     454                var startY;
     455                var isMoving = false;
     456
     457                function cancelTouch() {
     458                    self.sequence.on("touchmove", onTouchMove);
     459                    startX = null;
     460                    isMoving = false;
     461                }   
     462
     463                function onTouchMove(e) {
     464                    if(self.settings.swipePreventsDefault) {
     465                        e.preventDefault();
     466                    }
     467                    if(isMoving) {
     468                        var x = e.originalEvent.touches[0].pageX;
     469                        var y = e.originalEvent.touches[0].pageY;
     470                        var dx = startX - x;
     471                        var dy = startY - y;
     472                        if(Math.abs(dx) >= self.settings.swipeThreshold) {
     473                            cancelTouch();
     474                            if(dx > 0) {
     475                                self.initCustomKeyEvent(self.settings.swipeEvents.left);
     476                            }else{
     477                                self.initCustomKeyEvent(self.settings.swipeEvents.right);
     478                            }
     479                        }else if(Math.abs(dy) >= self.settings.swipeThreshold) {
     480                            cancelTouch();
     481                            if(dy > 0) {
     482                                self.initCustomKeyEvent(self.settings.swipeEvents.down);
     483                            }else{
     484                                self.initCustomKeyEvent(self.settings.swipeEvents.up);
     485                            }
     486                        }
     487                    }
     488                }
     489
     490                function onTouchStart(e) {
     491                    if(e.originalEvent.touches.length == 1) {
     492                        startX = e.originalEvent.touches[0].pageX;
     493                        startY = e.originalEvent.touches[0].pageY;
     494                        isMoving = true;
     495                        self.sequence.on("touchmove", onTouchMove);
     496                    }
     497                }
     498
     499                self.sequence.on("touchstart", onTouchStart);
     500            }
     501            //END EVENTS
     502        }
     503    } //END CONSTRUCTOR
     504   
     505    Sequence.prototype = {
     506        //trigger keyEvents, customKeyEvents and swipeEvents
     507        initCustomKeyEvent: function(event) {
     508            var self = this;
     509            switch(event) {
     510                case "next":
     511                    self.next();
     512                    break;
     513                case "prev":
     514                    self.prev();
     515                    break;
     516                case "pause":
     517                    self.pause(true);
     518                    break;
     519            }
     520        },
     521       
     522        /*
     523        modify the transition-duration and transition-delay properties of an element
     524       
     525        elementToReset = the element that is to have it's properties modified
     526        cssValue = the value to be given to the transition-duration and transition-delay properties
     527        */
     528        modifyElements: function(elementToReset, cssValue) {
     529            var self = this;
     530                elementToReset.css(
     531                self.prefixCSS(self.prefix, {
     532                    "transition-duration": cssValue,
     533                    "transition-delay": cssValue
     534                })
     535            );
     536        },
     537       
     538        /*
     539        adds the browser vendors prefix onto multiple CSS properties
     540       
     541        prefix = the prefix for the browser Sequence is being viewed in (-webkit- for example)
     542        properties = the properties to be prefixed (transition-duration for example)
     543        */
     544        prefixCSS: function(prefix, properties) {
     545            var css = {};
     546            for(property in properties) { //for each property to be modified...
     547                css[prefix + property] = properties[property]; //add the prefix to the property name
     548            }
     549            return css; //return the prefixed CSS
     550        },
     551       
     552        setTransitionProperties: function(frameChildren) {
     553            var self = this;
     554            frameChildren.each(function() {
     555                self.transitionProperties["transition-duration"] = $(this).css(self.prefix + "transition-duration");
     556                self.transitionProperties["transition-delay"] = $(this).css(self.prefix + "transition-delay");
     557
     558                $(this).css(
     559                    self.prefixCSS(self.prefix, self.transitionProperties)
     560                );
     561            });
     562        },
     563
     564        /*
     565        start autoPlay -- causing Sequence to automatically change frame every x amount of milliseconds
     566       
     567        delay: a time in ms before starting the autoPlay feature (if unspecified, the default will be used)
     568        */
     569        startAutoPlay: function(delay) {
     570            var self = this;
     571            var delay = (delay === undefined) ? self.settings.autoPlayDelay : delay; //if a delay isn't specified, use the default
     572            self.unpause();
     573
     574            self.resetAutoPlay(); //stop autoPlay before starting it again
     575            self.autoPlayTimer = setTimeout(function() { //start a new autoPlay timer and...
     576                self.settings.autoPlayDirection === 1 ? self.next(): self.prev(); //go to either the next or previous frame
     577            }, delay); //after a specified delay
     578        },
     579       
     580        //stop causing Sequence to automatically change frame every x amount of seconds
     581        stopAutoPlay: function() {
     582            var self = this;
     583            self.pause(true);
     584            clearTimeout(self.autoPlayTimer); //stop the autoPlay timer
     585        },
     586
     587        /*
     588        internal function used to start and stop autoPlay
     589        start: if true, autoPlay will be started, else it'll be stopped
     590        delay: a time in ms before starting the autoPlay feature (if unspecified, the default will be used)
     591        */
     592        resetAutoPlay: function(start, delay) {
     593            var self = this;
     594            if(start === true) { //if starting autoPlay
     595                if(self.settings.autoPlay && !self.isPaused) { //if using autoPlay and Sequence isn't paused...
     596                    clearTimeout(self.autoPlayTimer); //stop the autoPlay timer
     597                    self.autoPlayTimer = setTimeout(function() { //start a new autoPlay timer and...
     598                        self.settings.autoPlayDirection === 1 ? self.next(): self.prev(); //go to either the next or previous frame
     599                    }, delay); //after a specified delay
     600                }
     601            }else{ //if stopping autoPlay
     602                clearTimeout(self.autoPlayTimer); //stop the autoPlay timer
     603            }
     604        },
     605
     606        /*
     607        Toggle startAutoPlay (unpausing autoPlay) and stopAutoPlay (pausing autoPlay)
     608
     609        hardPause: if true, Sequence's pauseOnHover will not execute. Useful for pause buttons.
     610
     611        Note: Sequence 0.7.3 and below didn't have an .unpause() function -- .pause() would pause/unpause
     612        based on the current state. .unpause() is now included for clarity but the .pause() function will
     613        still toggle between paused and unpaused states.
     614        */
     615        pause: function(hardPause) {
     616            var self = this;
     617            if(!self.isPaused) { //if pausing Sequence...
     618                if(self.pauseButton !== undefined) { //if a pause button is defined...
     619                    self.pauseButton.addClass("paused"); //add the class of "paused" to the pause button
     620                    if(self.pauseIcon !== undefined) { //if a pause icon is defined...
     621                        self.pauseIcon.show(); //show the pause icon
     622                    }
     623                }
     624                self.paused(); //callback when Sequence is paused
     625                self.isPaused = true;
     626                self.isHardPaused = (hardPause) ? true : false; //if hardPausing, set hardPause to true
     627                self.resetAutoPlay(); //stop autoPlay
     628            }else{ //if unpausing Sequence...
     629                self.unpause();
     630            }
     631        },
     632
     633        /*
     634        Start the autoPlay feature, as well as deal with any changes to pauseButtons, pauseIcons and public variables etc
     635       
     636        callback: if false, the unpause callback will not be initiated (this is because unpause is used internally during the stop and start of each frame)
     637        */
     638        unpause: function(callback) {
     639            var self = this;
     640            if(self.pauseButton !== undefined) { //if a pause button is defined...
     641                self.pauseButton.removeClass("paused"); //remove the class of "paused" from the pause button
     642                if(self.pauseIcon !== undefined) { //if a pause icon is defined...
     643                    self.pauseIcon.hide(); //hide the pause icon
     644                }
     645            }
     646
     647            self.isPaused = false;
     648            self.isHardPaused = false;
     649
     650            if(!self.active) {
     651                if(callback !== false) {
     652                    self.unpaused(); //callback when Sequence is unpaused
     653                }
     654                self.resetAutoPlay(true, self.settings.unpauseDelay); //start autoPlay after a delay specified via the unpauseDelay setting
     655            }else{
     656                self.delayUnpause = true; //Sequence is animating so delay the unpause event until the animation completes
     657            }
     658        },
     659       
     660        //Go to the frame ahead of the current one
     661        next: function() {
     662            var self = this;
     663            self.nextFrameID = (self.currentFrameID !== self.numberOfFrames) ? self.currentFrameID + 1 : 1; //work out the next frame
     664            self.goTo(self.nextFrameID, 1); //go to the next frame
     665        },
     666       
     667        //Go to the frame prior to the current one
     668        prev: function() {
     669            var self = this;
     670            self.nextFrameID = (self.currentFrameID === 1) ? self.numberOfFrames : self.currentFrameID - 1; //work out the prev frame
     671            self.goTo(self.nextFrameID, -1); //go to the prev frame
     672        },
     673       
     674        /*
     675        Go to a specific frame
     676       
     677        id: number of the frame to go to
     678        direction: direction to get to that frame (1 = forward, -1 = reverse)
     679        */
     680        goTo: function(id, direction) {
     681            var self = this;
     682            var id = parseFloat(id); //convert the id to a number just in case
     683
     684            if((id === self.currentFrameID) //if the id of the frame the user is trying to go to is the same as the currently active one...
     685            || (self.settings.navigationSkip && self.navigationSkipThresholdActive) //or navigationSkip is enabled and the navigationSkipThreshold is active (which prevents frame from being navigated too fast)...
     686            || (!self.settings.navigationSkip && self.active) //or navigationSkip is disbaled but Sequence is animating...
     687            || (!self.transitionsSupported && self.active) //or Sequence is in fallback mode and Sequence is animating...
     688            || (!self.settings.cycle && direction === 1 && self.currentFrameID === self.numberOfFrames) //or cycling is disabled, the user is navigating forward and this is the last frame...
     689            || (!self.settings.cycle && direction === -1 && self.currentFrameID === 1) //or cycling is disabled, the user is navigating backwards and this is the first frame...
     690            || (self.settings.preventReverseSkipping && self.direction !== direction && self.active)) { //or Sequence is animating and the user is trying to change the direction of navigation...
     691                return false; //don't go to another frame
     692            }else if(self.settings.navigationSkip && self.active) { //if navigationSkip is enabled and Sequence is animating (a frame is being skipped before it has finished animating)...
     693                self.navigationSkipThresholdActive = true; //the navigationSkipThreshold is now active
     694                if(self.settings.fadeFrameWhenSkipped) { //if a frame should fade when skipped...
     695                    self.nextFrame.stop().animate({"opacity": 0}, self.settings.fadeFrameTime); //fade
     696                }
     697
     698                navigationSkipThresholdTimer = setTimeout(function() { //start the navigationSkipThreshold timer to prevent being able to navigate too quickly
     699                    self.navigationSkipThresholdActive = false; //once the timer is complete, navigationSkip can occur again
     700                }, self.settings.navigationSkipThreshold);
     701            }
     702
     703            if(!self.active || self.settings.navigationSkip) { //if there are no animations running or navigationSkip is enabled...
     704                self.active = true; //Sequence is now animating
     705                self.resetAutoPlay(); //stop any autoPlay timer that may be running
     706
     707                if(direction === undefined) { //if no direction to navigate was defined...
     708                    self.direction = (id > self.currentFrameID) ? 1 : -1; //work out which way to go based on what frame is currently active
     709                }else{
     710                    self.direction = direction; //go to the developer defined frame
     711                }
     712               
     713                self.currentFrame = self.sequence.children(".animate-in"); //find which frame is active -- the frame currently being viewed (and about to be animated out)
     714                self.nextFrame = self.sequence.children("li:nth-child("+id+")"); //grab the next frame
     715                self.frameChildren = self.currentFrame.children();  //save the child elements of the current frame
     716                self.nextFrameChildren = self.nextFrame.children(); //save the child elements of the next frame
     717               
     718                if(self.transitionsSupported) { //if the browser supports CSS3 transitions...                           
     719                    if(self.currentFrame.length !== undefined) { //if there is a current frame (one that is in it's animate-in position)...
     720                        self.beforeCurrentFrameAnimatesOut(); //callback
     721                        if(self.settings.moveActiveFrameToTop) { //if the active frame should move to the top...
     722                            self.currentFrame.css("z-index", 1); //move this frame to the bottom as it is now inactive
     723                        }
     724                        self.modifyElements(self.nextFrameChildren, "0s"); //give the next frame elements a transition-duration and transition-delay of 0s so they don't transition to their reset position
     725                        if(!self.settings.reverseAnimationsWhenNavigatingBackwards || self.direction === 1) { //if user hit next button...
     726                            self.nextFrame.removeClass("animate-out"); //reset the next frame back to its starting position
     727                            self.modifyElements(self.frameChildren, "");  //remove any inline styles from the elements to be animated so styles via the "animate-out" class can take full effect       
     728                        }else if(self.settings.reverseAnimationsWhenNavigatingBackwards && self.direction === -1) { //if the user hit prev button
     729                            self.nextFrame.addClass("animate-out"); //reset the next frame back to its animate-out position
     730                            self.setTransitionProperties(self.frameChildren);
     731                        }
     732                    }else{
     733                        self.firstFrame = false; //no longer the first frame
     734                    }
     735
     736                    self.active = true; //Sequence is now animating
     737                    self.currentFrame.unbind(self.transitionEnd); //remove the animation end event
     738                    self.nextFrame.unbind(self.transitionEnd); //remove the animation end event
     739
     740                    if(self.settings.fadeFrameWhenSkipped) { //if a frame may have faded out when it was previously skipped...
     741                        self.nextFrame.css("opacity", 1); //show it again
     742                    }
     743                   
     744                    self.beforeNextFrameAnimatesIn(); //callback
     745                    if(self.settings.moveActiveFrameToTop) { //if an active frame should be moved to the top...
     746                        self.nextFrame.css({"z-index": self.numberOfFrames}); //move to the top of the z-index
     747                    }
     748
     749                    //modifications to the current and next frame's elements to get them ready to animate
     750                    if(!self.settings.reverseAnimationsWhenNavigatingBackwards || self.direction === 1) { //if user hit next button...
     751                        setTimeout(function() { //50ms timeout to give the browser a chance to modify the DOM sequentially
     752                            self.modifyElements(self.nextFrameChildren, ""); //remove any inline styles from the elements to be animated so styles via the "animate-in" class can take full effect
     753                            self.waitForAnimationsToComplete(self.nextFrame, self.nextFrameChildren, "in"); //wait for the next frame to animate in
     754                            if(self.afterCurrentFrameAnimatesOut !== "function () {}") { //if the afterCurrentFrameAnimatesOut is being used...
     755                                self.waitForAnimationsToComplete(self.currentFrame, self.frameChildren, "out"); //wait for the current frame to animate out as well
     756                            }
     757                        }, 50);
     758                    }else if(self.settings.reverseAnimationsWhenNavigatingBackwards && self.direction === -1) { //if the user hit prev button
     759                        setTimeout(function() { //50ms timeout to give the browser a chance to modify the DOM sequentially
     760                            self.modifyElements(self.nextFrameChildren, ""); //remove any inline styles from the elements to be animated so styles via the "animate-in" class can take full effect
     761                            self.setTransitionProperties(self.frameChildren);
     762                            self.waitForAnimationsToComplete(self.nextFrame, self.nextFrameChildren, "in"); //wait for the next frame to animate in
     763                            if(self.afterCurrentFrameAnimatesOut != "function () {}") { //if the afterCurrentFrameAnimatesOut is being used...
     764                                self.waitForAnimationsToComplete(self.currentFrame, self.frameChildren, "out"); //wait for the current frame to animate out as well
     765                            }
     766                        }, 50);
     767                    }
     768
     769                    //final class changes to make animations happen
     770                    if(!self.settings.reverseAnimationsWhenNavigatingBackwards || self.direction === 1) { //if user hit next button...         
     771                        setTimeout(function() { //50ms timeout to give the browser a chance to modify the DOM sequentially
     772                            self.currentFrame.toggleClass("animate-out animate-in");
     773                            self.nextFrame.addClass("animate-in"); //add the "animate-in" class
     774                        }, 50);
     775                    }else if(self.settings.reverseAnimationsWhenNavigatingBackwards && self.direction === -1) { //if the user hit prev button
     776                        setTimeout(function() { //50ms timeout to give the browser a chance to modify the DOM sequentially
     777                            self.nextFrame.toggleClass("animate-out animate-in"); //add the "animate-in" class and remove the "animate-out" class
     778                            self.currentFrame.removeClass("animate-in");
     779                        }, 50);
     780                    }
     781                }else{ //if the browser doesn't support CSS3 transitions...
     782                    function animationComplete() {
     783                        self.setHashTag();                 
     784                        self.active = false;
     785                        self.resetAutoPlay(true, self.settings.autoPlayDelay);
     786                    }
     787
     788                    switch(self.settings.fallback.theme) {
     789                        case "fade": //if using the fade fallback theme...
     790                            self.sequence.children("li").css({"position": "relative"}); //this allows for fadein/out in IE
     791                            self.beforeCurrentFrameAnimatesOut();
     792                            self.currentFrame = self.sequence.children("li:nth-child("+self.currentFrameID+")");
     793                            self.currentFrame.animate({"opacity": 0}, self.settings.fallback.speed, function() { //hide the current frame
     794                                self.currentFrame.css({"display": "none", "z-index": "1"});
     795                                self.afterCurrentFrameAnimatesOut();
     796                                self.beforeNextFrameAnimatesIn();
     797                                self.nextFrame.css({"display": "block", "z-index": self.numberOfFrames}).animate({"opacity": 1}, 500, function() {
     798                                    self.afterNextFrameAnimatesIn();
     799                                }); //make the next frame the current one and show it
     800                                animationComplete();
     801                            });
     802                           
     803                            self.sequence.children("li").css({"position": "relative"}); //this allows for fadein/out in IE
     804                        break;
     805
     806                        case "slide": //if using the slide fallback theme...
     807                        default:
     808                    //create objects which will save the .css() and .animation() objects
     809                            var animateOut = {};
     810                            var animateIn = {};
     811                            var moveIn = {};
     812
     813                            //construct the .css() and .animation() objects
     814                            if(self.direction === 1) {
     815                                animateOut["left"] = "-100%";
     816                                animateIn["left"] = "100%";
     817                            }else{
     818                                animateOut["left"] = "100%";
     819                                animateIn["left"] = "-100%";
     820                            }
     821
     822                            moveIn["left"] = "0";
     823                            moveIn["opacity"] = 1;
     824
     825
     826                            self.currentFrame = self.sequence.children("li:nth-child("+self.currentFrameID+")");
     827                            self.beforeCurrentFrameAnimatesOut();
     828                            self.currentFrame.animate(animateOut, self.settings.fallback.speed, function() {
     829                                self.afterCurrentFrameAnimatesOut();
     830                            }); //cause the current frame to animate out
     831                            self.beforeNextFrameAnimatesIn(); //callback
     832                            self.nextFrame.show().css(animateIn);
     833                            self.nextFrame.animate(moveIn, self.settings.fallback.speed, function() { //cause the next frame to animate in
     834                                animationComplete();
     835                                self.afterNextFrameAnimatesIn(); //callback
     836                            });
     837                        break;
     838                    }
     839                }
     840                self.currentFrameID = id; //make the currentFrameID the same as the one that is to animate in               
     841            }
     842        },
     843       
     844        /*
     845            prevents the next frame from animating until the current frame has finished animating
     846
     847            frame: the frame <li> which is animating
     848            frameChildren: the animated direct child elements of the frame
     849            direction: whether the elements are animating "in" to an active position or "out" of an active position
     850        */
     851        waitForAnimationsToComplete: function(frame, frameChildren, direction) {
     852            var self = this;
     853
     854            if(direction === "out") { //if waiting on a frame's element to animate out...
     855                var onceComplete = function() {
     856                    self.afterCurrentFrameAnimatesOut(); //callback
     857                };
     858            }else if(direction === "in") { //if waiting on a frame's element to animate in...
     859                var onceComplete = function() {
     860                    self.afterNextFrameAnimatesIn(); //callback
     861                    self.setHashTag(); //set the hashtag to represent the newly active frame
     862
     863                    self.active = false; //Sequence is not animating
     864
     865                    if(!self.isHardPaused && !self.mouseover) { //if Sequence isn't hard paused (via a pause button for example) or being hovered over...
     866                        if(!self.delayUnpause) { //if unpausing isn't delayed (Sequence wasn't animating when unpause was invoked)...
     867                            self.unpause(false); //unpause Sequence but don't run the unpause callback
     868                        }else{ //if unpausing was delay because Sequence was animating when unpause was invoked...
     869                            self.delayUnpause = false;
     870                            self.unpause(); //unpause Sequence
     871                        }
     872                    }
     873                };
     874            }
     875
     876            frameChildren.data('animationEnded', false); // set the data attribute of each animated element to indicate that the animation has not yet ended
     877            frame.bind(self.transitionEnd, function(e) { //when an element finishes animating...
     878                $(e.target).data('animationEnded', true); // set the data attrbiute to indicate that the element has finished it's animation
     879           
     880                // now check if all elements have finished animating
     881                var allAnimationsEnded = true;
     882                frameChildren.each(function() { //for each element being animated within a frame...
     883                    if($(this).data('animationEnded') === false) { //if the animation hasn't ended...
     884                        allAnimationsEnded = false; //not all animations have ended yet
     885                        return false; //break out of the animationEnded check early
     886                    }
     887                });
     888           
     889                if(allAnimationsEnded) { //if all animations have ended...
     890                    frame.unbind(self.transitionEnd); //stop waiting for animations to end
     891                    onceComplete();
     892                }
     893            });
     894        },
     895
     896        setHashTag: function() {
     897            var self = this;
     898            if(self.settings.hashTags) { //if hashTags is enabled...
     899                self.currentHashTag = self.nextFrame.attr(self.getHashTagFrom); //get the hashtag name
     900                self.frameHashIndex = $.inArray(self.currentHashTag, self.frameHashID); //get the index of the frame that matches the hashtag
     901                if(self.frameHashIndex !== -1 && (self.settings.hashChangesOnFirstFrame || (!self.firstFrame || !self.transitionsSupported))) { //if the hashtag matches a Sequence frame ID...
     902                    self.nextFrameID = self.frameHashIndex + 1;
     903                    document.location.hash = "#"+self.currentHashTag;
     904                }else{
     905                    self.nextFrameID = self.settings.startingFrameID;
     906                    self.firstFrame = false;
     907                }                       
     908            }
     909        }
     910    }; //END PROTOTYPE
     911
     912    $.fn.sequence = function(options) {
     913        var self = this;
     914        return self.each(function() {
     915            var sequence = new Sequence($(this), options, defaults, get);
     916            $(this).data("sequence", sequence);
     917        });
     918    };
     919   
     920    //some external functions
     921    var get = {
     922        /* Modernizr 2.6.1 (Custom Build) | MIT & BSD
     923         * Build: http://modernizr.com/download/#-svg-prefixed-testprop-testallprops-domprefixes
     924         */
     925        modernizr: function() {
     926            ;window.Modernizr=function(a,b,c){function x(a){i.cssText=a}function y(a,b){return x(prefixes.join(a+";")+(b||""))}function z(a,b){return typeof a===b}function A(a,b){return!!~(""+a).indexOf(b)}function B(a,b){for(var d in a){var e=a[d];if(!A(e,"-")&&i[e]!==c)return b=="pfx"?e:!0}return!1}function C(a,b,d){for(var e in a){var f=b[a[e]];if(f!==c)return d===!1?a[e]:z(f,"function")?f.bind(d||b):f}return!1}function D(a,b,c){var d=a.charAt(0).toUpperCase()+a.slice(1),e=(a+" "+m.join(d+" ")+d).split(" ");return z(b,"string")||z(b,"undefined")?B(e,b):(e=(a+" "+n.join(d+" ")+d).split(" "),C(e,b,c))}var d="2.6.1",e={},f=b.documentElement,g="modernizr",h=b.createElement(g),i=h.style,j,k={}.toString,l="Webkit Moz O ms",m=l.split(" "),n=l.toLowerCase().split(" "),o={svg:"http://www.w3.org/2000/svg"},p={},q={},r={},s=[],t=s.slice,u,v={}.hasOwnProperty,w;!z(v,"undefined")&&!z(v.call,"undefined")?w=function(a,b){return v.call(a,b)}:w=function(a,b){return b in a&&z(a.constructor.prototype[b],"undefined")},Function.prototype.bind||(Function.prototype.bind=function(b){var c=self;if(typeof c!="function")throw new TypeError;var d=t.call(arguments,1),e=function(){if(self instanceof e){var a=function(){};a.prototype=c.prototype;var f=new a,g=c.apply(f,d.concat(t.call(arguments)));return Object(g)===g?g:f}return c.apply(b,d.concat(t.call(arguments)))};return e}),p.svg=function(){return!!b.createElementNS&&!!b.createElementNS(o.svg,"svg").createSVGRect};for(var E in p)w(p,E)&&(u=E.toLowerCase(),e[u]=p[E](),s.push((e[u]?"":"no-")+u));return e.addTest=function(a,b){if(typeof a=="object")for(var d in a)w(a,d)&&e.addTest(d,a[d]);else{a=a.toLowerCase();if(e[a]!==c)return e;b=typeof b=="function"?b():b,enableClasses&&(f.className+=" "+(b?"":"no-")+a),e[a]=b}return e},x(""),h=j=null,e._version=d,e._domPrefixes=n,e._cssomPrefixes=m,e.testProp=function(a){return B([a])},e.testAllProps=D,e.prefixed=function(a,b,c){return b?D(a,b,c):D(a,"pfx")},e}(self,self.document);
     927        },
     928       
     929        defaultPreloader: function(prependTo, transitions, prefix) {
     930            var icon = '<div class="sequence-preloader"><svg class="preloading" xmlns="http://www.w3.org/2000/svg"><circle class="circle" cx="6" cy="6" r="6" /><circle class="circle" cx="22" cy="6" r="6" /><circle class="circle" cx="38" cy="6" r="6" /></svg></div>';
     931           
     932            $("head").append("<style>.sequence-preloader{height: 100%;position: absolute;width: 100%;z-index: 999999;}@"+prefix+"keyframes preload{0%{opacity: 1;}50%{opacity: 0;}100%{opacity: 1;}}.sequence-preloader .preloading .circle{fill: #ff9442;display: inline-block;height: 12px;position: relative;top: -50%;width: 12px;"+prefix+"animation: preload 1s infinite; animation: preload 1s infinite;}.preloading{display:block;height: 12px;margin: 0 auto;top: 50%;margin-top:-6px;position: relative;width: 48px;}.sequence-preloader .preloading .circle:nth-child(2){"+prefix+"animation-delay: .15s; animation-delay: .15s;}.sequence-preloader .preloading .circle:nth-child(3){"+prefix+"animation-delay: .3s; animation-delay: .3s;}.preloading-complete{opacity: 0;visibility: hidden;"+prefix+"transition-duration: 1s; transition-duration: 1s;}div.inline{background-color: #ff9442; margin-right: 4px; float: left;}</style>");
     933            prependTo.prepend(icon);
     934            if(!Modernizr.svg && !transitions) { //if SVG isn't supported, remain calm and add this fallback instead...
     935                $(".sequence-preloader").prepend('<div class="preloading"><div class="circle inline"></div><div class="circle inline"></div><div class="circle inline"></div></div>');
     936                setInterval(function(){
     937                    $(".sequence-preloader .circle").fadeToggle(500);
     938                }, 500);
     939            }else if(!transitions){ //if transitions aren't supported, toggle the opacity instead 
     940                setInterval(function(){
     941                    $(".sequence-preloader").fadeToggle(500);
     942                }, 500);
     943            }
     944        },
     945       
     946        //a quick test to work out if Opera supports transitions properly (to work around the fact that Opera 11 supports transitions but doesn't return a transition value properly)
     947        operaTest: function() {
     948            $("body").append('<span id="sequence-opera-test"></span>');
     949            var $operaTest = $("#sequence-opera-test");
     950            $operaTest.css("-o-transition", "1s");
     951            //if the expected value isn't returned...
     952            if($operaTest.css("-o-transition") != "1s") {
     953                //cause Opera to go into the fallback theme
     954                return false;
     955            }else{
     956                return true;
     957            }
     958            $operaTest.remove();
     959        }
     960    };
     961   
     962    var defaults = {
     963        //General Settings
     964        startingFrameID: 1, //The frame (the list item `<li>`) that should first be displayed when Sequence loads
     965        cycle: true, //Whether Sequence should navigate to the first frame after the last frame and vice versa
     966        animateStartingFrameIn: false, //Whether the first frame should animate in to its active position
     967        reverseAnimationsWhenNavigatingBackwards: true, //Whether animations should be reversed when a user navigates backwards by clicking a previous button/swiping/pressing the left key
     968        moveActiveFrameToTop: true, //Whether a frame should be given a higher `z-index` than other frames whilst it is active, to bring it above the others
     969
     970        //Autoplay Settings
     971        autoPlay: true,
     972        autoPlayDirection: 1,
     973        autoPlayDelay: 5000,
     974
     975        //Frame Skipping Settings
     976        navigationSkip: true, //Whether the user can navigate through frames before each frame has finished animating
     977        navigationSkipThreshold: 250, //Amount of time that must pass before the next frame can be navigated to
     978        fadeFrameWhenSkipped: true, //If a frame is skipped before it finishes animating, it will quickly fade out
     979        fadeFrameTime: 150, //If fadeFrameWhenSkipped is true, how quickly a frame should fade out when skipped (in milliseconds)
     980        preventReverseSkipping: false, //Whether the user can change the direction of navigation during frames animating (if navigating forward, the user can only skip forwards when other frames are animating).
     981
     982        //Next/Prev Button Settings
     983        nextButton: false, //if dev settings are true, the nextButton will be ".next"
     984        showNextButtonOnInit: true,
     985        prevButton: false, //if dev settings are true, the prevButton will be ".prev"
     986        showPrevButtonOnInit: true,
     987       
     988        //Pause Settings
     989        pauseButton: false, //if dev settings are true, the pauseButton will be ".pause"
     990        unpauseDelay: null, //the time to wait before navigating to the next frame when Sequence is unpaused. Note that if an unpauseDelay is not specified, the default is the same as the autoPlayDelay setting
     991        pauseOnHover: true,
     992        pauseIcon: false, //this is an indicator to show Sequence is paused
     993       
     994        //Preloader Settings
     995        preloader: false,
     996        preloadTheseFrames: [1], //all images in these frames will load before Sequence initiates
     997        preloadTheseImages: [ //specify particular images to load before Sequence initiates
     998            /* Example usage
     999            "images/catEatingSalad.jpg",
     1000            "images/meDressedAsBatman.png"
     1001            */
     1002        ],
     1003        /*Note: You can use preloadTheseFrames and preloadTheseImages together. You might want to load all images in frame 1 and just one big image from frame 2 for example*/
     1004        hideFramesUntilPreloaded: true,
     1005        prependPreloadingComplete: true,
     1006        hidePreloaderUsingCSS: true,
     1007        hidePreloaderDelay: 0,
     1008       
     1009        //Keyboard settings
     1010        keyNavigation: true, //false prevents the following keyboard settings
     1011        numericKeysGoToFrames: true,
     1012        keyEvents: {
     1013            left: "prev",
     1014            right: "next"
     1015        },
     1016        customKeyEvents: {
     1017            /* Example usage
     1018            65: "prev", //a
     1019            68: "next", //d
     1020            83: "prev", //s
     1021            87: "next"  //w
     1022            */
     1023        },
     1024       
     1025        //Touch Swipe Settings
     1026        swipeNavigation: true,
     1027        swipeThreshold: 20,
     1028        swipePreventsDefault: false, //be careful if setting this to true
     1029        swipeEvents: {
     1030            left: "prev",
     1031            right: "next",
     1032            up: false,
     1033            down: false
     1034        },
     1035       
     1036        //hashTags Settings
     1037        //when using hashTags, please include a reference to Ben Alman's jQuery HashChange plugin above your reference to Sequence.js
     1038       
     1039        //info: http://benalman.com/projects/jquery-hashchange-plugin/
     1040        //plugin: https://raw.github.com/cowboy/jquery-hashchange/v1.3/jquery.ba-hashchange.min.js
     1041        //GitHub: https://github.com/cowboy/jquery-hashchange
     1042        hashTags: false, //when a frame is navigated to, change the hashtag to the frames ID
     1043        hashDataAttribute: false, //false = the hashTag is taken from a frames ID attribute | true = the hashTag is taken from the data attribute "data-sequence-hash" 
     1044        hashChangesOnFirstFrame: false,
     1045               
     1046        //Fallback Theme Settings (For browsers that don't support CSS3 transitions)
     1047        fallback: {
     1048            theme: "slide",
     1049            speed: 500
     1050        }
     1051    };
     1052})(jQuery);
  • bu-slideshow/trunk/interface/single-slide-admin.php

    r1257669 r1498422  
    1010        <a class="bu-slide-delete-button" href="#"><?php _e('delete slide', BU_SSHOW_LOCAL); ?></a>
    1111        <div class="bu-slide-thumb-container">
    12             <a class="button thickbox bu-slideshow-add-img" href="media-upload.php?referer=bu_slideshow&type=bu_slideshow&post_id=0&TB_iframe=true"><?php _e('Select Image', BU_SSHOW_LOCAL); ?></a>
     12            <a class="button thickbox bu-slideshow-add-img" href="media-upload.php?referer=bu_slideshow&amp;type=bu_slideshow&amp;post_id=0&amp;TB_iframe=true"><?php _e('Select Image', BU_SSHOW_LOCAL); ?></a>
    1313            <a class="button bu-slideshow-remove-img" href="#"<?php echo $img_thumb ? '' : ' style="display:none;"'; ?>><?php _e('Remove Image', BU_SSHOW_LOCAL); ?></a>
    1414            <input type="hidden" class="bu-slideshow-img-id" name="bu_slides[<?php echo esc_attr($this->order); ?>][image_id]" id="bu_slides[<?php echo esc_attr($this->order); ?>][image_id]" value="<?php echo esc_attr($this->image_id); ?>" />
    15        
     15
    1616            <span class="bu-slide-thumb"><?php echo $img_thumb; ?></span>
    1717            <div class="bu-slide-meta">
    1818                <?php
    19                 // print_r($img_meta);
    2019                    if($img_thumb){
    21                    
     20
    2221                        printf("%s &middot; <a href='%s' target='_blank'>Edit</a> <br />",$img_meta['file'], $edit_url);
    2322
     
    5049            </p>
    5150            <p>
    52                 <label for="bu_slides[<?php echo esc_attr($this->order); ?>][caption][link]"><?php _e('Link', BU_SSHOW_LOCAL); ?></label> 
     51                <label for="bu_slides[<?php echo esc_attr($this->order); ?>][caption][link]"><?php _e('Link', BU_SSHOW_LOCAL); ?></label>
    5352                <input type="text" id="bu_slides[<?php echo esc_attr($this->order); ?>][caption][link]" name="bu_slides[<?php echo esc_attr($this->order); ?>][caption][link]" value="<?php echo esc_url($this->caption["link"]); ?>" />
    5453            </p>
     
    5958            <p><label><?php _e('Caption Position', BU_SSHOW_LOCAL); ?></label>
    6059            <select id="bu_slides[<?php echo esc_attr($this->order); ?>][caption][position]" name="bu_slides[<?php echo esc_attr($this->order); ?>][caption][position]" >
    61                 <?php 
     60                <?php
    6261                foreach($caption_positions as $l=>$v){
    6362                    $maybe_selected = ($v === $this->caption["position"]) ? "selected" : "";
     
    7271            </p>
    7372
    74             <?php 
     73            <?php
    7574                foreach( $allowed_fields as $id => $field ){
    7675                    if( !is_array( $field ) || !isset( $field['label'] ) ){
     
    8584                    switch ( $type ) {
    8685                        case 'text':
    87                             printf('<input type="text" id="bu_slides[%s][custom_fields][%s]" name="bu_slides[%s][custom_fields][%s]" value="%s" />', 
     86                            printf('<input type="text" id="bu_slides[%s][custom_fields][%s]" name="bu_slides[%s][custom_fields][%s]" value="%s" />',
    8887                                $this->order, $id, $this->order, $id, $value);
    8988                            break;
  • bu-slideshow/trunk/package.json

    r1000635 r1498422  
    77        "grunt-contrib-uglify": "~0.4.0",
    88        "grunt-contrib-watch": "~0.6.0",
    9         "grunt-contrib-less": "~0.10.0"
     9        "grunt-contrib-less": "~0.10.0",
     10        "grunt-contrib-cssmin": "^0.12.2",
     11        "grunt-phplint": "^0.0.8",
     12        "matchdep": "^0.3.0"
     13    },
     14    "repository": {
     15        "type": "git",
     16        "url": "git://github.com/bu-ist/bu-slideshow.git"
    1017    }
    1118}
  • bu-slideshow/trunk/readme.txt

    r1349245 r1498422  
    11=== BU Slideshow ===
    2 Contributors: awbauer, clrux, mgburns, gannondigital
     2Contributors: inderpreet99, awbauer, clrux, mgburns, gannondigital
    33Tags: slideshow, images, boston university, bu
    44Requires at least: 3.5
    5 Tested up to: 4.4.2
    6 Stable tag: 2.3.6
     5Tested up to: 4.6.1
     6Stable tag: 2.3.8
    77License: GPLv2 or later
    88License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    1010
    1111== Description ==
    12 BU Slideshow is a plugin for creating and managing image-based slideshows. It is designed to be simple enough for any site admin to use, and powerful enough to meet the needs of designers. The plugin has many optional functions that make it flexible enough for a variety of uses: slideshows, photo rotations, feature card decks in the sidebar, etc.
    13 [View full documentation on BU.edu](http://www.bu.edu/tech/services/comm/websites/www/wordpress/how-to/create-slideshows/)
     12BU Slideshow is a plugin for creating and managing image-based slideshows. It is designed to be simple enough for any site admin to use, and powerful enough to meet the needs of designers. The plugin has many optional functions that make it flexible enough for a variety of uses: slideshows, photo rotations, feature card decks in the sidebar, etc.
     13
     14[View full documentation on BU.edu](https://www.bu.edu/tech/services/comm/websites/www/wordpress/how-to/create-slideshows/)
    1415
    1516= Features =
     
    2223* Integrated with WordPress Media Library for image upload/selection, size options, and image cropping/editing
    2324
     25= Developers =
     26
     27For developer documentation, feature roadmaps and more visit the [plugin repository on Github](https://github.com/bu-ist/bu-slideshow/).
     28
     29[Build Status](https://travis-ci.org/bu-ist/bu-slideshow)
     30
    2431== Installation ==
    25 This plugin can be installed automatically through the WordPress admin interface, or by clicking the downlaod link on this page and installing manually.
     32This plugin can be installed automatically through the WordPress admin interface, or by clicking the download link on this page and installing manually.
    2633
    2734Once installed, slideshows can be created by accessing the "Slideshows" menu in the admin panel. Slideshows can be dropped into any page by using the "Add Slideshow" button on the post/page edit screen.
     
    3845
    3946== Changelog ==
     47= 2.3.8 =
     48* Fix UI issues since WP 4.4
     49* Use minified CSS on the frontend. Fixes #31.
     50* Switch to min filenames: https://core.trac.wordpress.org/ticket/21633
     51
     52= 2.3.7 =
     53* Adds error checking to `bu-slideshow-thumb` image size handling
     54
    4055= 2.3.6 =
    4156* Allow custom fields to use HTML (GH #28)
    42 * Add `bu_slideshow_slide_admin` filter, allowing custom templates to change slide admin 
     57* Add `bu_slideshow_slide_admin` filter, allowing custom templates to change slide admin
    4358* Adds "shuffle" attribute when shortcode is inserted in the Editor (GH #25)
    4459
    45 = 2.3.5 = 
     60= 2.3.5 =
    4661* Fixes issue with "Add Slideshow" modal in Editor
    4762
     
    5873
    5974= 2.3.1 =
    60 * Fix PHP notice 
     75* Fix PHP notice
    6176
    6277= 2.3 =
    6378* Migrating slideshows to custom post type
    64 * Support for custom slide templates, including custom fields
     79* Support for custom slide templates: https://github.com/bu-ist/bu-slideshow/wiki/Actions-&-Filters#bu_slideshow_slide_templates
     80* Support for custom fields
    6581
    6682= 2.2.1 =
     
    91107* Added option to update image size (full/large/medium/etc) used in slide
    92108* Removed old back compatibility with WP < 3.3
    93 
     109* Minor UI tweaks
     110* - On slideshow edit screen, expand edit container for first slide by default (previously: all collapsed)
     111* - Hide navigation elements until slideshow is fully loaded
     112* - Image details / “edit” link on slideshow admin page
Note: See TracChangeset for help on using the changeset viewer.