Plugin Directory

Changeset 765971


Ignore:
Timestamp:
09/02/2013 10:01:22 PM (12 years ago)
Author:
stefanboonstra
Message:

Inserting images can now be done using the WordPress 3.5 uploader.
Images can now fill up an entire slide without losing their dimensions, using the 'Zoom to fit' option.
Fixed: Descriptions came up and stayed up on fly-over.
Fixed: Image calculations failed in a few because of a 'jQuery.outerWidth()' bug.
Fixed: Control panel wasn't correctly initialized when slideshow was set to automatically slide to the next slide.

Location:
slideshow-jquery-image-gallery/trunk
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • slideshow-jquery-image-gallery/trunk/classes/SlideshowPluginInstaller.php

    r761395 r765971  
    9393        }
    9494
     95        // Update to version 2.2.16
     96        if (self::firstVersionGreaterThanSecond('2.2.16', $currentVersion) ||
     97            $currentVersion == null)
     98        {
     99            self::updateV2_2_12_to_V_2_2_16();
     100        }
     101
    95102        // Set new version
    96103        update_option(self::$versionKey, SlideshowPluginMain::$version);
     104    }
     105
     106    /**
     107     * Version 2.2.12 to 2.2.16
     108     *
     109     * The 'Fit image into slide' setting has been replaced with the 'Image behaviour' setting.
     110     *
     111     * @since 2.2.16
     112     */
     113    private static function updateV2_2_12_to_V_2_2_16()
     114    {
     115        // Check if this has already been done
     116        if (get_option('slideshow-jquery-image-gallery-updated-from-v2-2-12-to-v2-2-16') !== false)
     117        {
     118            return;
     119        }
     120
     121        // Get slideshows
     122        $slideshows = get_posts(array(
     123            'numberposts' => -1,
     124            'offset'      => 0,
     125            'post_type'   => 'slideshow'
     126        ));
     127
     128        // Loop through slideshows
     129        if (is_array($slideshows) &&
     130            count($slideshows) > 0)
     131        {
     132            foreach ($slideshows as $slideshow)
     133            {
     134                // Get settings
     135                $settings = maybe_unserialize(get_post_meta(
     136                    $slideshow->ID,
     137                    'settings',
     138                    true
     139                ));
     140
     141                if (isset($settings['stretchImages']))
     142                {
     143                    if ($settings['stretchImages'] === 'true')
     144                    {
     145                        $settings['imageBehaviour'] = 'stretch';
     146                    }
     147                    else
     148                    {
     149                        $settings['imageBehaviour'] = 'natural';
     150                    }
     151
     152                    unset($settings['stretchImages']);
     153                }
     154                else
     155                {
     156                    $settings['imageBehaviour'] = 'natural';
     157                }
     158
     159                // Update post meta
     160                update_post_meta(
     161                    $slideshow->ID,
     162                    'settings',
     163                    $settings
     164                );
     165            }
     166        }
     167
     168        update_option('slideshow-jquery-image-gallery-updated-from-v2-2-12-to-v2-2-16', 'updated');
    97169    }
    98170
     
    229301
    230302        // Loop through slideshows
    231         if (is_array($slideshows) && count($slideshows > 0))
     303        if (is_array($slideshows) &&
     304            count($slideshows) > 0)
    232305        {
    233306            foreach ($slideshows as $slideshow)
     
    291364        // Loop through slideshows
    292365        if (is_array($slideshows) &&
    293             count($slideshows > 0))
     366            count($slideshows) > 0)
    294367        {
    295368            foreach ($slideshows as $slideshow)
     
    423496
    424497        // Loop through slideshows
    425         if (is_array($slideshows) && count($slideshows > 0))
     498        if (is_array($slideshows) &&
     499            count($slideshows) > 0)
    426500        {
    427501            foreach ($slideshows as $slideshow)
  • slideshow-jquery-image-gallery/trunk/classes/SlideshowPluginSlideInserter.php

    r761395 r765971  
    314314            array(
    315315                'data' => array(),
    316                 'localization' => array('confirm' => __('Are you sure you want to delete this slide?', 'slideshow-plugin'))
     316                'localization' => array(
     317                    'confirm'       => __('Are you sure you want to delete this slide?', 'slideshow-plugin'),
     318                    'uploaderTitle' => __('Insert image slide', 'slideshow-plugin')
     319                )
    317320            )
    318321        );
  • slideshow-jquery-image-gallery/trunk/classes/SlideshowPluginSlideshowSettingsHandler.php

    r762030 r765971  
    483483            'aspectRatio' => '3:1',
    484484            'height' => '200',
    485             'stretchImages' => 'true',
     485            'imageBehaviour' => 'natural',
    486486            'showDescription' => 'true',
    487487            'hideDescription' => 'true',
     
    497497            'controlPanel' => 'false',
    498498            'hideControlPanel' => 'true',
    499             'waitUntilLoaded' => 'false',
    500             'showLoadingIcon' => 'false',
     499            'waitUntilLoaded' => 'true',
     500            'showLoadingIcon' => 'true',
    501501            'random' => 'false',
    502502            'avoidFilter' => 'true'
     
    524524                'aspectRatio'                 => sprintf('<a href="' . str_replace('%', '%%', __('http://en.wikipedia.org/wiki/Aspect_ratio_(image)', 'slideshow-plugin')) . '" title="' . __('More info', 'slideshow-plugin') . '" target="_blank">' . __('Proportional relationship%s between slideshow\'s width and height (width:height)', 'slideshow-plugin'), '</a>'),
    525525                'height'                      => __('Slideshow\'s height', 'slideshow-plugin'),
    526                 'stretchImages'               => __('Fit image into slide (Stretch image)', 'slideshow-plugin'),
     526                'imageBehaviour'              => __('Image behaviour', 'slideshow-plugin'),
    527527                'preserveSlideshowDimensions' => __('Shrink slideshow\'s height when width shrinks', 'slideshow-plugin'),
    528528                'enableResponsiveness'        => __('Enable responsiveness (Shrink slideshow\'s width when page\'s width shrinks)', 'slideshow-plugin'),
     
    553553                'aspectRatio'                 => array('type' => 'text'  , 'default' => $data['aspectRatio']                , 'description' => $descriptions['aspectRatio']                , 'group' => __('Display', 'slideshow-plugin')                                                           , 'dependsOn' => array('settings[preserveSlideshowDimensions]', 'true')),
    554554                'height'                      => array('type' => 'text'  , 'default' => $data['height']                     , 'description' => $descriptions['height']                     , 'group' => __('Display', 'slideshow-plugin')                                                           , 'dependsOn' => array('settings[preserveSlideshowDimensions]', 'false')),
    555                 'stretchImages'               => array('type' => 'radio' , 'default' => $data['stretchImages']              , 'description' => $descriptions['stretchImages']              , 'group' => __('Display', 'slideshow-plugin')      , 'options' => array('true' => $yes, 'false' => $no)),
     555                'imageBehaviour'              => array('type' => 'select', 'default' => $data['imageBehaviour']             , 'description' => $descriptions['imageBehaviour']             , 'group' => __('Display', 'slideshow-plugin')      , 'options' => array('natural' => __('Natural and centered', 'slideshow-plugin'), 'zoom' => __('Zoom to fit', 'slideshow-plugin'), 'stretch' => __('Stretch to fit', 'slideshow-plugin'))),
    556556                'preserveSlideshowDimensions' => array('type' => 'radio' , 'default' => $data['preserveSlideshowDimensions'], 'description' => $descriptions['preserveSlideshowDimensions'], 'group' => __('Display', 'slideshow-plugin')      , 'options' => array('true' => $yes, 'false' => $no) , 'dependsOn' => array('settings[enableResponsiveness]', 'true')),
    557557                'enableResponsiveness'        => array('type' => 'radio' , 'default' => $data['enableResponsiveness']       , 'description' => $descriptions['enableResponsiveness']       , 'group' => __('Display', 'slideshow-plugin')      , 'options' => array('true' => $yes, 'false' => $no)),
  • slideshow-jquery-image-gallery/trunk/js/min/all.backend.min.js

    r763883 r765971  
    1 slideshow_jquery_image_gallery_backend_script=function(){var t=jQuery,i={};return i.isBackendInitialized=!1,i.init=function(){i.isBackendInitialized||(i.isBackendInitialized=!0,t(document).trigger("slideshowBackendReady"))},t(document).ready(i.init),t(window).load(i.init),i}();slideshow_jquery_image_gallery_backend_script.generalSettings=function(){var t=jQuery,i={};return i.isCurrentPage=!1,i.init=function(){"slideshow_page_general_settings"===window.pagenow&&(i.isCurrentPage=!0,i.activateUserCapabilities())},i.activateUserCapabilities=function(){t("input").change(function(i){var e,s,n,o=t(i.currentTarget),a="slideshow-jquery-image-gallery-add-slideshows",h="slideshow-jquery-image-gallery-edit-slideshows",r="slideshow-jquery-image-gallery-delete-slideshows";"checkbox"==o.attr("type").toLowerCase()&&(e=o.attr("id").split("_"),s=e.shift(),n=e.join("_"),s!==h||o.attr("checked")?(s===a||s===r)&&t("#"+h+"_"+n).attr("checked",!0):(t("#"+a+"_"+n).attr("checked",!1),t("#"+r+"_"+n).attr("checked",!1)))})},t(document).bind("slideshowBackendReady",i.init),i}();slideshow_jquery_image_gallery_backend_script.editSlideshow=function(){var t=jQuery,i={};return i.isCurrentPage=!1,i.init=function(){"slideshow"===window.pagenow&&(i.isCurrentPage=!0,i.activateSettingsVisibilityDependency())},i.activateSettingsVisibilityDependency=function(){t(".depends-on-field-value").each(function(e,s){var n=t(s),o=n.attr("class").split(" "),a=n.closest("tr");t('input[name="'+o[1]+'"]:checked').val()==o[2]?a.show():a.hide(),t('input[name="'+o[1]+'"]').change(o,function(e){var s=t("."+o[3]).closest("tr");t(e.currentTarget).val()==o[2]?i.animateElementVisibility(s,!0):i.animateElementVisibility(s,!1)})})},i.animateElementVisibility=function(i,e){var s=t(i);void 0===e&&(s.stop(!0,!0),e=!s.is(":visible")),e?(s.show().css("background-color","#c0dd52"),setTimeout(function(){s.stop(!0,!0).animate({"background-color":"transparent"},1500)},500)):s.stop(!0,!0).hide()},t(document).bind("slideshowBackendReady",i.init),i}();slideshow_jquery_image_gallery_backend_script.shortcode=function(){var t=jQuery,i={};return i.init=function(){i.activateShortcodeInserter()},i.activateShortcodeInserter=function(){t(".insertSlideshowShortcodeSlideshowInsertButton").click(function(){var i="No slideshow selected.",e="slideshow_deploy",s=parseInt(t("#insertSlideshowShortcodeSlideshowSelect").val()),n=window.slideshow_jquery_image_gallery_backend_script_shortcode;return"object"==typeof n&&("object"==typeof n.data&&void 0!==n.data.shortcode&&n.data.shortcode.length>0&&(e=n.data.shortcode),"object"==typeof n.localization&&void 0!==n.localization.undefinedSlideshow&&n.localization.undefinedSlideshow.length>0&&(i=n.localization.undefinedSlideshow)),isNaN(s)?(alert(i),!1):(send_to_editor("["+e+" id='"+s+"']"),tb_remove(),!0)}),t(".insertSlideshowShortcodeCancelButton").click(function(){return tb_remove(),!1})},t(document).bind("slideshowBackendReady",i.init),i}();slideshow_jquery_image_gallery_backend_script.generalSettings.customStyles=function(){var t=jQuery,i={};return i.init=function(){slideshow_jquery_image_gallery_backend_script.generalSettings.isCurrentPage&&i.activateNavigation()},i.activateNavigation=function(){t(".nav-tab").click(function(i){var e,s=t(i.currentTarget),n=t(".nav-tab-active");n.removeClass("nav-tab-active"),s.addClass("nav-tab-active"),t(n.attr("href").replace("#",".")).hide(),t(s.attr("href").replace("#",".")).show(),e=t("input[name=_wp_http_referer]"),e.attr("value",e.attr("value").split("#").shift()+s.attr("href"))}),t('a[href="#'+document.URL.split("#").pop()+'"]').trigger("click")},t(document).bind("slideshowBackendReady",i.init),i}();slideshow_jquery_image_gallery_backend_script.generalSettings.customStyles=function(){var t=jQuery,i={};return i.init=function(){slideshow_jquery_image_gallery_backend_script.generalSettings.isCurrentPage&&(i.activateActionButtons(),i.activateDeleteButtons())},i.activateActionButtons=function(){t(".custom-styles-tab .styles-list .style-action.style-default").click(function(e){var s,n,o,a,h,r=t(e.currentTarget),l=r.closest("li").find(".style-title").html(),d=r.closest("li").find(".style-content").html(),c=window.slideshow_jquery_image_gallery_backend_script_generalSettings,u="slideshow-jquery-image-gallery-custom-styles";"string"!=typeof d||d.length<=0||("object"==typeof c&&("object"==typeof c.localization&&void 0!==c.localization.newCustomizationPrefix&&c.localization.newCustomizationPrefix.length>0&&(l=c.localization.newCustomizationPrefix+" - "+l),"object"==typeof c.data&&void 0!==c.data.customStylesKey&&c.data.customStylesKey.length>0&&(u=c.data.customStylesKey)),s=u+"_"+(i.getHighestCustomStyleID()+1),a=t(".custom-styles-tab .custom-style-templates"),n=a.find(".style-editor").clone(),n.addClass(s),n.find(".new-custom-style-title").attr("value",l),n.find(".new-custom-style-content").html(d),n.find(".new-custom-style-title").attr("name",u+"["+s+"][title]"),n.find(".new-custom-style-content").attr("name",u+"["+s+"][style]"),t(".custom-styles-tab .style-editors").append(n),setTimeout(function(){n.fadeIn(200)},200),o=a.find(".custom-styles-list-item").clone(!0),o.removeClass("custom-styles-list-item"),o.find(".style-title").html(l),o.find(".style-action").addClass(s),o.find(".style-delete").addClass(s),h=t(".custom-styles-tab .styles-list .custom-styles-list"),h.find(".no-custom-styles-found").remove(),h.append(o))}),t(".custom-styles-tab .styles-list .style-action, .custom-styles-tab .custom-style-templates .custom-styles-list-item .style-action").click(function(i){var e=t(i.currentTarget).attr("class").split(" ")[1];void 0!==e&&(t(".custom-styles-tab .style-editors .style-editor").each(function(i,e){t(e).fadeOut(200)}),setTimeout(function(){t(".style-editor."+e).fadeIn(200)},200))})},i.activateDeleteButtons=function(){t(".custom-styles-tab .styles-list .style-delete, .custom-styles-tab .custom-style-templates .custom-styles-list-item .style-delete").click(function(i){var e=t(i.currentTarget),s=e.attr("class").split(" ")[1],n=window.slideshow_jquery_image_gallery_backend_script_generalSettings,o="Are you sure you want to delete this custom style?";void 0!==s&&("object"==typeof n&&"object"==typeof n.localization&&void 0!==n.localization.confirmDeleteMessage&&n.localization.confirmDeleteMessage.length>0&&(o=n.localization.confirmDeleteMessage),confirm(o)&&(t(".custom-styles-tab .style-editors .style-editor."+s).remove(),e.closest("li").remove()))})},i.getHighestCustomStyleID=function(){var i=0;return t(".custom-styles-tab .style-editors .style-editor").each(function(e,s){var n=parseInt(t(s).attr("class").split("_").pop());n>i&&(i=n)}),parseInt(i)},t(document).bind("slideshowBackendReady",i.init),i}();slideshow_jquery_image_gallery_backend_script.editSlideshow.slideManager=function(){var t=jQuery,i={};return i.isCurrentPage=!1,i.init=function(){slideshow_jquery_image_gallery_backend_script.editSlideshow.isCurrentPage&&i.activate()},i.activate=function(){var e=t("#slideshow-slide-inserter-popup"),s=t("#slideshow-slide-inserter-popup-background"),n=e.find("#search");i.indexSlidesOrder(),t(".sortable-slides-list").sortable({revert:!0,placeholder:"sortable-placeholder",forcePlaceholderSize:!0,stop:function(){i.indexSlidesOrder()},cancel:"input, select, p"}),t(".wp-color-picker-field").wpColorPicker({width:234}),s.height(t(document).outerHeight(!0)),e.css({top:parseInt(t(window).height()/2-e.outerHeight(!0)/2,10),left:parseInt(t(window).width()/2-e.outerWidth(!0)/2,10)}),n.focus(),i.getSearchResults(),e.find("#close").click(i.closePopup),s.click(i.closePopup),e.find("#search-submit").click(i.getSearchResults),n.keypress(function(t){13==t.which&&(t.preventDefault(),i.getSearchResults())}),t("#slideshow-insert-image-slide").click(function(){e.css({display:"block"}),s.css({display:"block"})}),t("#slideshow-insert-text-slide").click(i.insertTextSlide),t("#slideshow-insert-video-slide").click(i.insertVideoSlide),t(".slideshow-delete-slide").click(function(e){i.deleteSlide(t(e.currentTarget).closest("li"))})},i.deleteSlide=function(t){var i="Are you sure you want to delete this slide?",e=window.slideshow_jquery_image_gallery_backend_script_editSlideshow;"object"==typeof e&&"object"==typeof e.localization&&void 0!==e.localization.confirm&&e.localization.confirm.length>0&&(i=e.localization.confirm),confirm(i)&&t.remove()},i.indexSlidesOrder=function(){t.each(t(".sortable-slides-list").find("li"),function(i,e){t.each(t(e).find("input, select, textarea"),function(e,s){var n=t(s),o=n.attr("name");void 0===o||o.length<=0||(o=o.replace(/[\[\]']+/g," ").split(" "),n.attr("name",o[0]+"["+(i+1)+"]["+o[2]+"]"))})})},i.getSearchResults=function(e){var s=t("#slideshow-slide-inserter-popup"),n=s.find("#results"),o=[];e=parseInt(e),isNaN(e)&&(e=0,n.html("")),t.each(n.find(".result-table-row"),function(i,e){o.push(parseInt(t(e).attr("data-attachment-id")))}),t.post(window.ajaxurl,{action:"slideshow_slide_inserter_search_query",search:s.find("#search").attr("value"),offset:e,attachmentIDs:o},function(e){var s;n.append(e),n.find(".insert-attachment").unbind("click").click(function(e){var s=t(e.currentTarget).closest("tr");i.insertImageSlide(s.attr("data-attachment-id"),s.find(".title").text(),s.find(".description").text(),s.find(".image img").attr("src"))}),s=t(".load-more-results"),s&&s.click(function(e){var s=t(e.currentTarget),n=s.attr("data-offset");s.closest("tr").hide(),isNaN(parseInt(n))||i.getSearchResults(n)})})},i.insertImageSlide=function(e,s,n,o){var a=t(".image-slide-template").find("li").clone();a.find(".attachment").attr("src",o),a.find(".attachment").attr("title",s),a.find(".attachment").attr("alt",s),a.find(".title").attr("value",s),a.find(".description").html(n),a.find(".postId").attr("value",e),a.find(".title").attr("name","slides[0][title]"),a.find(".description").attr("name","slides[0][description]"),a.find(".url").attr("name","slides[0][url]"),a.find(".urlTarget").attr("name","slides[0][urlTarget]"),a.find(".type").attr("name","slides[0][type]"),a.find(".postId").attr("name","slides[0][postId]"),a.find(".slideshow-delete-slide").click(function(e){i.deleteSlide(t(e.currentTarget).closest("li"))}),t(".sortable-slides-list").prepend(a),i.indexSlidesOrder()},i.insertTextSlide=function(){var e=t(".text-slide-template").find("li").clone();e.find(".title").attr("name","slides[0][title]"),e.find(".description").attr("name","slides[0][description]"),e.find(".textColor").attr("name","slides[0][textColor]"),e.find(".color").attr("name","slides[0][color]"),e.find(".url").attr("name","slides[0][url]"),e.find(".urlTarget").attr("name","slides[0][urlTarget]"),e.find(".type").attr("name","slides[0][type]"),e.find(".slideshow-delete-slide").click(function(e){i.deleteSlide(t(e.currentTarget).closest("li"))}),e.find(".color, .textColor").wpColorPicker(),t(".sortable-slides-list").prepend(e),i.indexSlidesOrder()},i.insertVideoSlide=function(){var e=t(".video-slide-template").find("li").clone();e.find(".videoId").attr("name","slides[0][videoId]"),e.find(".showRelatedVideos").attr("name","slides[0][showRelatedVideos]"),e.find(".type").attr("name","slides[0][type]"),e.find(".slideshow-delete-slide").click(function(e){i.deleteSlide(t(e.currentTarget).closest("li"))}),t(".sortable-slides-list").prepend(e),i.indexSlidesOrder()},i.closePopup=function(){t("#slideshow-slide-inserter-popup, #slideshow-slide-inserter-popup-background").css({display:"none"})},t(document).bind("slideshowBackendReady",i.init),i}();
     1/**
     2 * Slideshow backend script
     3 *
     4 * @author Stefan Boonstra
     5 * @version 2.2.12
     6 */
     7slideshow_jquery_image_gallery_backend_script = function()
     8{
     9    var $    = jQuery,
     10        self = {};
     11
     12    self.isBackendInitialized = false;
     13
     14    /**
     15     * Called by either jQuery's document ready event or JavaScript's window load event in case document ready fails to
     16     * fire.
     17     *
     18     * Triggers the slideshowBackendReady on the document to inform all backend scripts they can start.
     19     */
     20    self.init = function()
     21    {
     22        if (self.isBackendInitialized)
     23        {
     24            return;
     25        }
     26
     27        self.isBackendInitialized = true;
     28
     29        $(document).trigger('slideshowBackendReady');
     30    };
     31
     32    $(document).ready(self.init);
     33
     34    $(window).load(self.init);
     35
     36    return self;
     37}();
     38
     39// @codekit-append backend/generalSettings.js
     40// @codekit-append backend/editSlideshow.js
     41// @codekit-append backend/shortcode.js
     42
     43///**
     44// * Simple logging function for Internet Explorer
     45// *
     46// * @param message
     47// */
     48//function log(message)
     49//{
     50//  var $ = jQuery;
     51//
     52//  $('body').prepend('<p style="color: red;">' + message +  '</p>');
     53//}
     54
     55slideshow_jquery_image_gallery_backend_script.generalSettings = function()
     56{
     57    var $    = jQuery,
     58        self = { };
     59
     60    self.isCurrentPage = false;
     61
     62    /**
     63     *
     64     */
     65    self.init = function()
     66    {
     67        if (window.pagenow === 'slideshow_page_general_settings')
     68        {
     69            self.isCurrentPage = true;
     70
     71            self.activateUserCapabilities();
     72        }
     73    };
     74
     75    /**
     76     * When either the 'Add slideshows' capability or the 'Delete slideshow' capability is changed, the 'Edit slideshows'
     77     * checkbox should also be checked. Un-checking the 'Edit slideshows' checkbox needs to do the opposite.
     78     */
     79    self.activateUserCapabilities = function()
     80    {
     81        $('input').change(function(event)
     82        {
     83            var $this                      = $(event.currentTarget),
     84                addSlideshowsCapability    = 'slideshow-jquery-image-gallery-add-slideshows',
     85                editSlideshowsCapability   = 'slideshow-jquery-image-gallery-edit-slideshows',
     86                deleteSlideshowsCapability = 'slideshow-jquery-image-gallery-delete-slideshows',
     87                idArray,
     88                capability,
     89                role;
     90
     91            // Check if the type was a checkbox
     92            if ($this.attr('type').toLowerCase() != 'checkbox')
     93            {
     94                return;
     95            }
     96
     97            // Get capability and role
     98            idArray    = $this.attr('id').split('_');
     99            capability = idArray.shift();
     100            role       = idArray.join('_');
     101
     102            // When 'Edit slideshows' has been un-checked, set 'Add slideshows' and 'Delete slideshows' to un-checked as well
     103            if (capability === editSlideshowsCapability &&
     104                !$this.attr('checked'))
     105            {
     106                $('#' + addSlideshowsCapability    + '_' + role).attr('checked', false);
     107                $('#' + deleteSlideshowsCapability + '_' + role).attr('checked', false);
     108            }
     109            // When 'Add slideshows' or 'Delete slideshows' is checked, 'Edit slideshows' must be checked as well
     110            else if (capability === addSlideshowsCapability ||
     111                     capability === deleteSlideshowsCapability)
     112            {
     113                $('#' + editSlideshowsCapability + '_' + role).attr('checked', true);
     114            }
     115        });
     116    };
     117
     118    $(document).bind('slideshowBackendReady', self.init);
     119
     120    return self;
     121}();
     122
     123// @codekit-append generalSettings.navigation.js
     124// @codekit-append generalSettings.customStyles.js
     125
     126slideshow_jquery_image_gallery_backend_script.editSlideshow = function()
     127{
     128    var $    = jQuery,
     129        self = { };
     130
     131    self.isCurrentPage = false;
     132
     133    /**
     134     *
     135     */
     136    self.init = function()
     137    {
     138        if (window.pagenow === 'slideshow')
     139        {
     140            self.isCurrentPage = true;
     141
     142            self.activateSettingsVisibilityDependency();
     143        }
     144    };
     145
     146    /**
     147     * Set fields, that depend on another field being a certain value, to show when that certain field becomes a certain
     148     * value and to hide when that certain fields loses that certain value.
     149     */
     150    self.activateSettingsVisibilityDependency = function()
     151    {
     152        $('.depends-on-field-value').each(function(key, field)
     153        {
     154            var $field     = $(field),
     155                attributes = $field.attr('class').split(' '),
     156                $tr        = $field.closest('tr');
     157
     158            // Check whether or not field should be shown
     159            if ($('input[name="' + attributes[1] + '"]:checked').val() == attributes[2])
     160            {
     161                $tr.show();
     162            }
     163            else
     164            {
     165                $tr.hide();
     166            }
     167
     168            // On change of the field that the current field depends on, set field's visibility
     169            $('input[name="' + attributes[1] + '"]').change(attributes, function(event)
     170            {
     171                var $tr = $('.' + attributes[3]).closest('tr');
     172
     173                if ($(event.currentTarget).val() == attributes[2])
     174                {
     175                    self.animateElementVisibility($tr, true);
     176                }
     177                else
     178                {
     179                    self.animateElementVisibility($tr, false);
     180                }
     181            });
     182        });
     183    };
     184
     185    /**
     186     * Animate an element's visibility
     187     *
     188     * @param element
     189     * @param setVisible Optional, defaults to the current opposite when left empty.
     190     */
     191    self.animateElementVisibility = function(element, setVisible)
     192    {
     193        var $element = $(element);
     194
     195        if (setVisible === undefined)
     196        {
     197            // Finish animation before checking visibility
     198            $element.stop(true, true);
     199
     200            setVisible = !$element.is(':visible');
     201        }
     202
     203        if (setVisible)
     204        {
     205            $element.show().css('background-color', '#c0dd52')
     206
     207            setTimeout(
     208                function()
     209                {
     210                    $element.stop(true, true).animate({ 'background-color': 'transparent' }, 1500);
     211                },
     212                500
     213            );
     214        }
     215        else
     216        {
     217            $element.stop(true, true).hide();
     218        }
     219    };
     220
     221    $(document).bind('slideshowBackendReady', self.init);
     222
     223    return self;
     224}();
     225
     226// @codekit-append editSlideshow.slideManager.js
     227
     228slideshow_jquery_image_gallery_backend_script.shortcode = function()
     229{
     230    var $    = jQuery,
     231        self = { };
     232
     233    /**
     234     *
     235     */
     236    self.init = function()
     237    {
     238        self.activateShortcodeInserter();
     239    };
     240
     241    /**
     242     *
     243     */
     244    self.activateShortcodeInserter = function()
     245    {
     246        $('.insertSlideshowShortcodeSlideshowInsertButton').click(function()
     247        {
     248            var undefinedSlideshowMessage = 'No slideshow selected.',
     249                shortcode                 = 'slideshow_deploy',
     250                slideshowID               = parseInt($('#insertSlideshowShortcodeSlideshowSelect').val()),
     251                extraData                 = window.slideshow_jquery_image_gallery_backend_script_shortcode;
     252
     253            if (typeof extraData === 'object')
     254            {
     255                if (typeof extraData.data === 'object' &&
     256                    extraData.data.shortcode !== undefined &&
     257                    extraData.data.shortcode.length > 0)
     258                {
     259                    shortcode = extraData.data.shortcode;
     260                }
     261
     262                if (typeof extraData.localization === 'object' &&
     263                    extraData.localization.undefinedSlideshow !== undefined &&
     264                    extraData.localization.undefinedSlideshow.length > 0)
     265                {
     266                    undefinedSlideshowMessage = extraData.localization.undefinedSlideshow;
     267                }
     268            }
     269
     270            if (isNaN(slideshowID))
     271            {
     272                alert(undefinedSlideshowMessage);
     273
     274                return false;
     275            }
     276
     277            send_to_editor('[' + shortcode + ' id=\'' + slideshowID + '\']');
     278
     279            tb_remove();
     280
     281            return true;
     282        });
     283
     284        $('.insertSlideshowShortcodeCancelButton').click(function()
     285        {
     286            tb_remove();
     287
     288            return false;
     289        });
     290    };
     291
     292    $(document).bind('slideshowBackendReady', self.init);
     293
     294    return self;
     295}();
     296slideshow_jquery_image_gallery_backend_script.generalSettings.customStyles = function()
     297{
     298    var $    = jQuery,
     299        self = { };
     300
     301    /**
     302     *
     303     */
     304    self.init = function()
     305    {
     306        if (!slideshow_jquery_image_gallery_backend_script.generalSettings.isCurrentPage)
     307        {
     308            return;
     309        }
     310
     311        self.activateNavigation();
     312    };
     313
     314    /**
     315     * Binds functions to fire at click events on the navigation tabs
     316     */
     317    self.activateNavigation = function()
     318    {
     319        // On click of navigation tab, show different settings page.
     320        $('.nav-tab').click(function(event)
     321        {
     322            var $this      = $(event.currentTarget),
     323                $activeTab = $('.nav-tab-active'),
     324                $referrer;
     325
     326            $activeTab.removeClass('nav-tab-active');
     327            $this.addClass('nav-tab-active');
     328
     329            // Hide previously active tab's content
     330            $($activeTab.attr('href').replace('#', '.')).hide();
     331
     332            // Show newly activated tab
     333            $($this.attr('href').replace('#', '.')).show();
     334
     335            // Set referrer value to the current page to be able to return there after saving
     336            $referrer = $('input[name=_wp_http_referer]');
     337            $referrer.attr('value', $referrer.attr('value').split('#').shift() + $this.attr('href'));
     338        });
     339
     340        // Navigate to correct tab by firing a click event on it. Click event needs to have already been registered on '.nav-tab'.
     341        $('a[href="#' + document.URL.split('#').pop() + '"]').trigger('click');
     342    };
     343
     344    $(document).bind('slideshowBackendReady', self.init);
     345
     346    return self;
     347}();
     348slideshow_jquery_image_gallery_backend_script.generalSettings.customStyles = function()
     349{
     350    var $    = jQuery,
     351        self = { };
     352
     353    /**
     354     *
     355     */
     356    self.init = function()
     357    {
     358        if (!slideshow_jquery_image_gallery_backend_script.generalSettings.isCurrentPage)
     359        {
     360            return;
     361        }
     362
     363        self.activateActionButtons();
     364        self.activateDeleteButtons()
     365    };
     366
     367    /**
     368     *
     369     */
     370    self.activateActionButtons = function()
     371    {
     372        // On click of the customize default style button
     373        $('.custom-styles-tab .styles-list .style-action.style-default').click(function(event)
     374        {
     375            var $this                 = $(event.currentTarget),
     376                title                 = $this.closest('li').find('.style-title').html(),
     377                content               = $this.closest('li').find('.style-content').html(),
     378                externalData          = window.slideshow_jquery_image_gallery_backend_script_generalSettings,
     379                customStylesKey       = 'slideshow-jquery-image-gallery-custom-styles',
     380                customStyleID,
     381                $editor,
     382                $li,
     383                $customStyleTemplates,
     384                $customStylesList;
     385
     386            if (typeof content !== 'string' ||
     387                content.length <= 0)
     388            {
     389                return;
     390            }
     391
     392            if (typeof externalData === 'object')
     393            {
     394                // Prefix title with 'New'
     395                if (typeof externalData.localization === 'object' &&
     396                    externalData.localization.newCustomizationPrefix !== undefined &&
     397                    externalData.localization.newCustomizationPrefix.length > 0)
     398                {
     399                    title = externalData.localization.newCustomizationPrefix + ' - ' + title;
     400                }
     401
     402                // Get custom styles key
     403                if (typeof externalData.data === 'object' &&
     404                    externalData.data.customStylesKey !== undefined &&
     405                    externalData.data.customStylesKey.length > 0)
     406                {
     407                    customStylesKey = externalData.data.customStylesKey;
     408                }
     409            }
     410
     411            customStyleID = customStylesKey + '_' + (self.getHighestCustomStyleID() + 1);
     412
     413            $customStyleTemplates = $('.custom-styles-tab .custom-style-templates');
     414
     415            // Clone editor template
     416            $editor =  $customStyleTemplates.find('.style-editor').clone();
     417
     418            // Add class to editor
     419            $editor.addClass(customStyleID);
     420
     421            // Add value attributes
     422            $editor.find('.new-custom-style-title').attr('value', title);
     423            $editor.find('.new-custom-style-content').html(content);
     424
     425            // Add name attributes
     426            $editor.find('.new-custom-style-title').attr('name', customStylesKey + '[' + customStyleID + '][title]');
     427            $editor.find('.new-custom-style-content').attr('name', customStylesKey + '[' + customStyleID + '][style]');
     428
     429            // Add editor to DOM
     430            $('.custom-styles-tab .style-editors').append($editor);
     431
     432            // Fade editor in
     433            setTimeout(
     434                function()
     435                {
     436                    $editor.fadeIn(200);
     437                },
     438                200
     439            );
     440
     441            // Clone custom styles list item (with events)
     442            $li = $customStyleTemplates.find('.custom-styles-list-item').clone(true);
     443
     444            // Prepare
     445            $li.removeClass('custom-styles-list-item');
     446            $li.find('.style-title').html(title);
     447            $li.find('.style-action').addClass(customStyleID);
     448            $li.find('.style-delete').addClass(customStyleID);
     449
     450            $customStylesList = $('.custom-styles-tab .styles-list .custom-styles-list');
     451
     452            // Remove 'No custom stylesheets found message'
     453            $customStylesList.find('.no-custom-styles-found').remove();
     454
     455            // Add custom styles list item to DOM
     456            $customStylesList.append($li);
     457        });
     458
     459        // On click of the edit custom style button
     460        $('.custom-styles-tab .styles-list .style-action, .custom-styles-tab .custom-style-templates .custom-styles-list-item .style-action').click(function(event)
     461        {
     462            // Get custom style key
     463            var customStyleKey = $(event.currentTarget).attr('class').split(' ')[1];
     464
     465            // Return if no style key was found
     466            if (customStyleKey === undefined)
     467            {
     468                return;
     469            }
     470
     471            // Fade editors out
     472            $('.custom-styles-tab .style-editors .style-editor').each(function(key, editor)
     473            {
     474                $(editor).fadeOut(200);
     475            });
     476
     477            // Fade active editor in
     478            setTimeout(
     479                function()
     480                {
     481                    $('.style-editor.' + customStyleKey).fadeIn(200);
     482                },
     483                200
     484            );
     485        });
     486    };
     487
     488    /**
     489     *
     490     */
     491    self.activateDeleteButtons = function()
     492    {
     493        $('.custom-styles-tab .styles-list .style-delete, .custom-styles-tab .custom-style-templates .custom-styles-list-item .style-delete').click(function(event)
     494        {
     495            // Get custom style key
     496            var $this                = $(event.currentTarget),
     497                customStyleKey       = $this.attr('class').split(' ')[1],
     498                externalData         = window.slideshow_jquery_image_gallery_backend_script_generalSettings,
     499                confirmDeleteMessage = 'Are you sure you want to delete this custom style?';
     500
     501            // Return if no style key was found
     502            if(customStyleKey === undefined)
     503            {
     504                return;
     505            }
     506
     507            if (typeof externalData === 'object' &&
     508                typeof externalData.localization === 'object' &&
     509                externalData.localization.confirmDeleteMessage !== undefined &&
     510                externalData.localization.confirmDeleteMessage.length > 0)
     511            {
     512                confirmDeleteMessage = externalData.localization.confirmDeleteMessage;
     513            }
     514
     515            // Show confirm deletion message
     516            if (!confirm(confirmDeleteMessage))
     517            {
     518                return;
     519            }
     520
     521            // Delete custom style
     522            $('.custom-styles-tab .style-editors .style-editor.' + customStyleKey).remove();
     523
     524            // Delete item from list
     525            $this.closest('li').remove();
     526        });
     527    };
     528
     529    /**
     530     * Returns highest custom style id in existence
     531     *
     532     * @return int highestCustomStyleID
     533     */
     534    self.getHighestCustomStyleID = function()
     535    {
     536        var highestCustomStyleID = 0;
     537
     538        // Loop through style editors
     539        $('.custom-styles-tab .style-editors .style-editor').each(function(key, editor)
     540        {
     541            var customStyleID = parseInt($(editor).attr('class').split('_').pop());
     542
     543            // Check if the ID is higher than any previously checked
     544            if (customStyleID > highestCustomStyleID)
     545            {
     546                highestCustomStyleID = customStyleID;
     547            }
     548        });
     549
     550        // Return
     551        return parseInt(highestCustomStyleID);
     552    };
     553
     554    $(document).bind('slideshowBackendReady', self.init);
     555
     556    return self;
     557}();
     558slideshow_jquery_image_gallery_backend_script.editSlideshow.slideManager = function()
     559{
     560    var $    = jQuery,
     561        self = { };
     562
     563    self.isCurrentPage = false;
     564
     565    /**
     566     *
     567     */
     568    self.init = function()
     569    {
     570        if (slideshow_jquery_image_gallery_backend_script.editSlideshow.isCurrentPage)
     571        {
     572            self.activateUploader();
     573
     574            // TODO Remove old uploader when the new uploader has been tested well enough
     575            self.activate();
     576        }
     577    };
     578
     579    /**
     580     * Activates the WordPress 3.5 uploader.
     581     */
     582    self.activateUploader = function()
     583    {
     584        $('.upload_image_button').on('click', function(event)
     585        {
     586            event.preventDefault();
     587
     588            var oldPostID       = wp.media.model.settings.post.id,
     589                temporaryPostID = -1,
     590                uploaderTitle,
     591                externalData;
     592
     593            // Reopen file frame if it has already been created
     594            if (self.uploader)
     595            {
     596                // Set the post ID to a non-existing one, so image files won't be attached to anything
     597                self.uploader.uploader.uploader.param('post_id', temporaryPostID);
     598
     599                self.uploader.open();
     600
     601                return;
     602            }
     603
     604            wp.media.model.settings.post.id = temporaryPostID;
     605
     606            externalData = window.slideshow_jquery_image_gallery_backend_script_editSlideshow;
     607
     608            uploaderTitle = '';
     609
     610            if (typeof externalData === 'object' &&
     611                typeof externalData.localization === 'object' &&
     612                externalData.localization.uploaderTitle !== undefined &&
     613                externalData.localization.uploaderTitle.length > 0)
     614            {
     615                uploaderTitle = externalData.localization.uploaderTitle;
     616            }
     617
     618            // Create the uploader
     619            self.uploader = wp.media.frames.file_frame = wp.media({
     620                title   : uploaderTitle,
     621                multiple: true,
     622                library :
     623                {
     624                    type: 'image'
     625                }
     626            });
     627
     628            // Create image slide on select
     629            self.uploader.on('select', function()
     630            {
     631                var attachments = self.uploader.state().get('selection').toJSON(),
     632                    attachment,
     633                    attachmentID;
     634
     635                //console.log(attachments);
     636
     637                for (attachmentID in attachments)
     638                {
     639                    if (!attachments.hasOwnProperty(attachmentID))
     640                    {
     641                        continue;
     642                    }
     643
     644                    attachment = attachments[attachmentID];
     645
     646                    self.insertImageSlide(attachment.id, attachment.title, attachment.description, attachment.url, attachment.alt);
     647                }
     648
     649                // Restore the old post ID
     650                wp.media.model.settings.post.id = oldPostID;
     651            });
     652
     653            self.uploader.open();
     654        });
     655    };
     656
     657    /**
     658     *
     659     */
     660    self.activate = function()
     661    {
     662        var $popup           = $('#slideshow-slide-inserter-popup'),
     663            $popupBackground = $('#slideshow-slide-inserter-popup-background'),
     664            $searchBar       = $popup.find('#search');
     665
     666        // Index first
     667        self.indexSlidesOrder();
     668
     669        // Make list items in the sortables list sortable, exclude elements by using the cancel option
     670        $('.sortable-slides-list').sortable({
     671            revert: true,
     672            placeholder: 'sortable-placeholder',
     673            forcePlaceholderSize: true,
     674            stop: function()
     675            {
     676                self.indexSlidesOrder();
     677            },
     678            cancel: 'input, select, p'
     679        });
     680
     681        // Add the wp-color-picker plugin to the color fields
     682        $('.wp-color-picker-field').wpColorPicker({ width: 234 });
     683
     684        // Make the black background stretch all the way down the document
     685        $popupBackground.height($(document).outerHeight(true));
     686
     687        // Center the popup in the window
     688        $popup.css({
     689            'top': parseInt(($(window).height() / 2) - ($popup.outerHeight(true) / 2), 10),
     690            'left': parseInt(($(window).width() / 2) - ($popup.outerWidth(true) / 2), 10)
     691        });
     692
     693        // Focus on search bar
     694        $searchBar.focus();
     695
     696        // Preload attachments
     697        self.getSearchResults();
     698
     699        // Close popup when clicked on cross or background
     700        $popup.find('#close').click(self.closePopup);
     701        $popupBackground     .click(self.closePopup);
     702
     703        // Send ajax request on click of the search button
     704        $popup.find('#search-submit').click(self.getSearchResults);
     705
     706        // Make the 'enter' key do the same as the search button
     707        $searchBar.keypress(function(event)
     708        {
     709            if (event.which == 13)
     710            {
     711                event.preventDefault();
     712
     713                self.getSearchResults();
     714            }
     715        });
     716
     717        // Open popup by click on button
     718        $('#slideshow-insert-image-slide').click(function()
     719        {
     720            $popup          .css({ display: 'block' });
     721            $popupBackground.css({ display: 'block' });
     722        });
     723
     724        // Insert text slide into the sortable list when the Insert Text Slide button is clicked
     725        $('#slideshow-insert-text-slide').click(self.insertTextSlide);
     726
     727        // Insert video slide into the sortable list when the Insert Video Slide button is clicked
     728        $('#slideshow-insert-video-slide').click(self.insertVideoSlide);
     729
     730        // Call self.deleteSlide on click
     731        $('.slideshow-delete-slide').click(function(event)
     732        {
     733            self.deleteSlide($(event.currentTarget).closest('li'));
     734        });
     735    };
     736
     737    /**
     738     * Deletes slide from DOM
     739     *
     740     * @param $slide
     741     */
     742    self.deleteSlide = function($slide)
     743    {
     744        var confirmMessage = 'Are you sure you want to delete this slide?',
     745            extraData      = window.slideshow_jquery_image_gallery_backend_script_editSlideshow;
     746
     747        if (typeof extraData === 'object' &&
     748            typeof extraData.localization === 'object' &&
     749            extraData.localization.confirm !== undefined &&
     750            extraData.localization.confirm.length > 0)
     751        {
     752            confirmMessage = extraData.localization.confirm;
     753        }
     754
     755        if(!confirm(confirmMessage))
     756        {
     757            return;
     758        }
     759
     760        // Remove slide from DOM
     761        $slide.remove();
     762    };
     763
     764    /**
     765     * Loop through list items, setting slide orders
     766     */
     767    self.indexSlidesOrder = function()
     768    {
     769        // Loop through sortables
     770        $.each($('.sortable-slides-list').find('li'), function(slideID, slide)
     771        {
     772            // Loop through all fields to set their name attributes with the new index
     773            $.each($(slide).find('input, select, textarea'), function(key, input)
     774            {
     775                var $input = $(input),
     776                    name   = $input.attr('name');
     777
     778                if (name === undefined ||
     779                    name.length <= 0)
     780                {
     781                    return;
     782                }
     783
     784                name = name.replace(/[\[\]']+/g, ' ').split(' ');
     785
     786                // Put name with new order ID back on the page
     787                $input.attr('name', name[0] + '[' + (slideID + 1) + '][' + name[2] + ']');
     788            });
     789        });
     790    };
     791
     792    /**
     793     * Sends an ajax post request with the search query and print retrieved html to the results table.
     794     *
     795     * If offset is set, append data to data that is already there
     796     *
     797     * @param offset (optional, defaults to 0)
     798     */
     799    self.getSearchResults = function(offset)
     800    {
     801        var $popup        = $('#slideshow-slide-inserter-popup'),
     802            $resultsTable = $popup.find('#results'),
     803            attachmentIDs = [];
     804
     805        offset = parseInt(offset);
     806
     807        if (isNaN(offset))
     808        {
     809            offset = 0;
     810
     811            $resultsTable.html('');
     812        }
     813
     814        $.each($resultsTable.find('.result-table-row'), function(key, tr)
     815        {
     816            attachmentIDs.push(parseInt($(tr).attr('data-attachment-id')));
     817        });
     818
     819        $.post(
     820            window.ajaxurl,
     821            {
     822                action       : 'slideshow_slide_inserter_search_query',
     823                search       : $popup.find('#search').attr('value'),
     824                offset       : offset,
     825                attachmentIDs: attachmentIDs
     826            },
     827            function(response)
     828            {
     829                var $loadMoreResultsButton;
     830
     831                // Fill table
     832                $resultsTable.append(response);
     833
     834                // When the insert button is clicked, the function to build a slide should be called. Unbind first so old entries don't have the event twice.
     835                $resultsTable.find('.insert-attachment').unbind('click').click(function(event)
     836                {
     837                    var $tr = $(event.currentTarget).closest('tr');
     838
     839                    self.insertImageSlide(
     840                        $tr.attr('data-attachment-id'),
     841                        $tr.find('.title').text(),
     842                        $tr.find('.description').text(),
     843                        $tr.find('.image img').attr('src'),
     844                        $tr.find('.title').text()
     845                    );
     846                });
     847
     848                // Load more results on click of the 'Load more results' button
     849                $loadMoreResultsButton = $('.load-more-results');
     850                if($loadMoreResultsButton)
     851                {
     852                    $loadMoreResultsButton.click(function(event)
     853                    {
     854                        // Get offset
     855                        var $this     = $(event.currentTarget),
     856                            newOffset = $this.attr('data-offset');
     857
     858                        $this.closest('tr').hide();
     859
     860                        if (isNaN(parseInt(newOffset)))
     861                        {
     862                            return;
     863                        }
     864
     865                        self.getSearchResults(newOffset);
     866                    });
     867                }
     868            }
     869        );
     870    };
     871
     872    /**
     873     * Inserts image slide into the slides list
     874     *
     875     * @param id
     876     * @param title
     877     * @param description
     878     * @param src
     879     * @param alternativeText
     880     */
     881    self.insertImageSlide = function(id, title, description, src, alternativeText)
     882    {
     883        // Find and clone the image slide template
     884        var $imageSlide = $('.image-slide-template').find('li').clone();
     885
     886        // Fill slide with data
     887        $imageSlide.find('.attachment').attr('src', src);
     888        $imageSlide.find('.attachment').attr('title', title);
     889        $imageSlide.find('.attachment').attr('alt', alternativeText);
     890        $imageSlide.find('.title').attr('value', title);
     891        $imageSlide.find('.description').html(description);
     892        $imageSlide.find('.alternativeText').attr('value', alternativeText);
     893        $imageSlide.find('.postId').attr('value', id);
     894
     895        // Set names to be saved to the database
     896        $imageSlide.find('.title').attr('name', 'slides[0][title]');
     897        $imageSlide.find('.description').attr('name', 'slides[0][description]');
     898        $imageSlide.find('.url').attr('name', 'slides[0][url]');
     899        $imageSlide.find('.urlTarget').attr('name', 'slides[0][urlTarget]');
     900        $imageSlide.find('.alternativeText').attr('name', 'slides[0][alternativeText]');
     901        $imageSlide.find('.type').attr('name', 'slides[0][type]');
     902        $imageSlide.find('.postId').attr('name', 'slides[0][postId]');
     903
     904        // Register delete link
     905        $imageSlide.find('.slideshow-delete-slide').click(function(event)
     906        {
     907            self.deleteSlide($(event.currentTarget).closest('li'));
     908        });
     909
     910        // Put slide in the sortables list.
     911        $('.sortable-slides-list').prepend($imageSlide);
     912
     913        // Reindex
     914        self.indexSlidesOrder();
     915    };
     916
     917    /**
     918     * Inserts text slide into the slides list
     919     */
     920    self.insertTextSlide = function()
     921    {
     922        // Find and clone the text slide template
     923        var $textSlide = $('.text-slide-template').find('li').clone();
     924
     925        // Set names to be saved to the database
     926        $textSlide.find('.title').attr('name', 'slides[0][title]');
     927        $textSlide.find('.description').attr('name', 'slides[0][description]');
     928        $textSlide.find('.textColor').attr('name', 'slides[0][textColor]');
     929        $textSlide.find('.color').attr('name', 'slides[0][color]');
     930        $textSlide.find('.url').attr('name', 'slides[0][url]');
     931        $textSlide.find('.urlTarget').attr('name', 'slides[0][urlTarget]');
     932        $textSlide.find('.type').attr('name', 'slides[0][type]');
     933
     934        // Register delete link
     935        $textSlide.find('.slideshow-delete-slide').click(function(event)
     936        {
     937            self.deleteSlide($(event.currentTarget).closest('li'));
     938        });
     939
     940        // Add color picker
     941        $textSlide.find('.color, .textColor').wpColorPicker();
     942
     943        // Put slide in the sortables list.
     944        $('.sortable-slides-list').prepend($textSlide);
     945
     946        // Reindex slide orders
     947        self.indexSlidesOrder();
     948    };
     949
     950    /**
     951     * Inserts video slide into the slides list
     952     */
     953    self.insertVideoSlide = function()
     954    {
     955        // Find and clone the video slide template
     956        var $videoSlide = $('.video-slide-template').find('li').clone();
     957
     958        // Set names to be saved to the database
     959        $videoSlide.find('.videoId').attr('name', 'slides[0][videoId]');
     960        $videoSlide.find('.showRelatedVideos').attr('name', 'slides[0][showRelatedVideos]');
     961        $videoSlide.find('.type').attr('name', 'slides[0][type]');
     962
     963        // Register delete link
     964        $videoSlide.find('.slideshow-delete-slide').click(function(event)
     965        {
     966            self.deleteSlide($(event.currentTarget).closest('li'));
     967        });
     968
     969        // Put slide in the sortables list.
     970        $('.sortable-slides-list').prepend($videoSlide);
     971
     972        // Reindex slide orders
     973        self.indexSlidesOrder();
     974    };
     975
     976    /**
     977     * Closes popup
     978     */
     979    self.closePopup = function()
     980    {
     981        $('#slideshow-slide-inserter-popup, #slideshow-slide-inserter-popup-background').css({ display: 'none' });
     982    };
     983
     984    $(document).bind('slideshowBackendReady', self.init);
     985
     986    return self;
     987}();
  • slideshow-jquery-image-gallery/trunk/js/min/all.frontend.min.js

    r763883 r765971  
    1 function onYouTubeIframeAPIReady(){slideshow_jquery_image_gallery_script.youTubeAPIReady=!0}slideshow_jquery_image_gallery_script=function(){var t=jQuery,i={};return i.slideshowInstances={},i.initialized=!1,i.youTubeAPIReady=!1,i.init=function(){i.initialized||(i.initialized=!0,i.loadYouTubeAPI(),i.checkStylesheetURL(),i.activateSlideshows())},i.getSlideshowInstance=function(e){if(isNaN(parseInt(e,10))){if(e instanceof t&&e.length>0)for(var s in i.slideshowInstances)if(i.slideshowInstances.hasOwnProperty(s)){var n=i.slideshowInstances[s];if(n instanceof i.Slideshow&&n.$container.get(0)===e.get(0))return n}}else if(i.slideshowInstances[e]instanceof i.Slideshow)return i.slideshowInstances[e];return new i.Slideshow},i.activateSlideshows=function(){t.each(jQuery(".slideshow_container"),function(e,s){var n=t(s),o=n.data("sessionId");isNaN(parseInt(o,10))&&(o=n.attr("data-session-id")),i.slideshowInstances[o]instanceof i.Slideshow||(i.slideshowInstances[o]=new i.Slideshow(n))})},i.loadYouTubeAPI=function(){if(i.loadYouTubeAPICalled=!0,!(t(".slideshow_slide_video").length<=0)){var e=document.createElement("script"),s=document.getElementsByTagName("script")[0];e.src="//www.youtube.com/iframe_api",s.parentNode.insertBefore(e,s)}},i.checkStylesheetURL=function(){var i=t('[id*="slideshow-jquery-image-gallery-ajax-stylesheet_"]');i.length<=0||t.each(i,function(i,e){var s,n,o,a=t(e),h=t(e).attr("href");void 0!==h&&""!==h&&(s=a.attr("id").split("_"),n=s.splice(1,s.length-1).join("_").slice(0,-4),o=h.split("?"),(void 0===o[1]||""===o[1]||o[1].toLowerCase().indexOf("style=")<0)&&(o[1]="action=slideshow_jquery_image_gallery_load_stylesheet&style="+n+"&ver="+Math.round((new Date).getTime()/1e3),h=o.join("?"),a.attr("href",h)))})},t(document).ready(function(){i.init()}),t(window).load(function(){i.init()}),t.fn.getSlideshowInstance=function(){return i.getSlideshowInstance(this)},i}();!function(){var t=jQuery,i=slideshow_jquery_image_gallery_script;i.Slideshow=function(i){if(i instanceof t&&(this.$container=i,this.$content=this.$container.find(".slideshow_content"),this.$views=this.$container.find(".slideshow_view"),this.$slides=this.$container.find(".slideshow_slide"),this.$controlPanel=this.$container.find(".slideshow_controlPanel"),this.$togglePlayButton=this.$controlPanel.find(".slideshow_togglePlay"),this.$nextButton=this.$container.find(".slideshow_next"),this.$previousButton=this.$container.find(".slideshow_previous"),this.$pagination=this.$container.find(".slideshow_pagination"),this.$loadingIcon=this.$container.find(".slideshow_loading_icon"),this.ID=this.getID(),!isNaN(parseInt(this.ID,10)))){this.settings=window["SlideshowPluginSettings_"+this.ID],t.each(this.settings,t.proxy(function(t,i){"true"==i?this.settings[t]=!0:"false"==i&&(this.settings[t]=!1)},this)),this.$parentElement=this.$container.parent(),this.viewData=[],this.viewIDs=[],this.currentlyAnimating=!1,this.currentViewID=void 0,this.currentWidth=0,this.visibleViews=[],this.videoPlayers=[],this.PlayStates={PAUSED:-1,TEMPORARILY_PAUSED:0,PLAYING:1},this.playState=-1,this.interval=!1,this.pauseOnHoverTimer=!1,this.invisibilityTimer=!1,this.descriptionTimer=!1,this.randomNextHistoryViewIDs=[],this.randomPreviousHistoryViewIDs=[],this.randomAvailableViewIDs=[],t.each(this.$views,t.proxy(function(t){this.viewIDs.push(t)},this)),this.currentViewID=this.getNextViewID(),this.visibleViews=[this.currentViewID],this.recalculate(!1);var e=!0;t.each(this.$views,t.proxy(function(i,s){var n=t(s);i!=this.visibleViews[0]?n.css("top",this.$container.outerHeight(!0)):n.addClass("slideshow_currentView"),this.viewData[i]=[],t.each(n.find(".slideshow_slide"),t.proxy(function(s,n){var o=t(n);if(this.viewData[i][s]={},o.hasClass("slideshow_slide_image")){var a=o.find("img");a.length>0?a.get(0).complete?this.viewData[i][s].loaded=1:(i===this.currentViewID&&(e=!1),this.viewData[i][s].loaded=0,this.onImageLoad(a,t.proxy(function(t){this.viewData[i][s].loaded=t?1:2,this.settings.waitUntilLoaded&&i===this.currentViewID&&this.isViewLoaded(i)&&this.start()},this))):this.viewData[i][s].loaded=-1}else this.viewData[i][s].loaded=-1},this))},this)),t(window).load(t.proxy(function(){this.recalculateVisibleViews()},this)),parseFloat(this.settings.intervalSpeed)<parseFloat(this.settings.slideSpeed)+.1&&(this.settings.intervalSpeed=parseFloat(this.settings.slideSpeed)+.1),(!this.settings.waitUntilLoaded||this.settings.waitUntilLoaded&&e)&&this.start()}}}();!function(){var t=jQuery,i=slideshow_jquery_image_gallery_script;i.Slideshow.prototype.start=function(){this.activateDescriptions(),this.activateControlPanel(),this.activateNavigationButtons(),this.activatePagination(),this.activatePauseOnHover(),this.$loadingIcon.length>0&&this.$loadingIcon.remove(),this.$content.show(),this.recalculateViews(),this.settings.enableResponsiveness&&t(window).resize(t.proxy(function(){this.recalculate(!0)},this)),this.play()},i.Slideshow.prototype.play=function(){this.settings.play&&!this.interval&&(this.playState=this.PlayStates.PLAYING,this.$container.trigger("slideshowPlayStateChange",[this.playState]),this.interval=setInterval(t.proxy(function i(e,s){void 0===s&&(s=this),void 0===e&&(e=s.getNextViewID()),s.isViewLoaded(e)?(s.animateTo(e,1),s.play()):(s.pause(this.PlayStates.TEMPORARILY_PAUSED),setTimeout(t.proxy(function(){i(e,s)},s),100))},this),1e3*this.settings.intervalSpeed))},i.Slideshow.prototype.pause=function(t){clearInterval(this.interval),this.interval=!1,t!==this.PlayStates.PAUSED&&t!==this.PlayStates.TEMPORARILY_PAUSED&&(t=this.PlayStates.PAUSED),this.playState=t,this.$container.trigger("slideshowPlayStateChange",[this.playState])},i.Slideshow.prototype.next=function(){this.pause(this.PlayStates.TEMPORARILY_PAUSED),this.animateTo(this.getNextViewID(),1),this.play()},i.Slideshow.prototype.previous=function(){this.pause(this.PlayStates.TEMPORARILY_PAUSED),this.animateTo(this.getPreviousViewID(),-1),this.play()},i.Slideshow.prototype.isVideoPlaying=function(){for(var t in this.videoPlayers)if(this.videoPlayers.hasOwnProperty(t)){var i=this.videoPlayers[t].state;if(1==i||3==i)return!0}return!1},i.Slideshow.prototype.pauseAllVideos=function(){for(var t in this.videoPlayers)if(this.videoPlayers.hasOwnProperty(t)){var i=this.videoPlayers[t].player;null!=i&&"function"==typeof i.pauseVideo&&(this.videoPlayers[t].state=2,i.pauseVideo())}},i.Slideshow.prototype.isViewLoaded=function(i){var e=!0;return t.each(this.viewData[i],t.proxy(function(t,i){0==i.loaded&&(e=!1)},this)),e},i.Slideshow.prototype.getNaturalImageSize=function(i,e,s){return i.length<=0||!(i instanceof t)||"string"!=typeof i.attr("src")?(e(-1,-1,s),void 0):(this.onImageLoad(i,t.proxy(function(t,i){e(i.width,i.height,s)},this)),void 0)},i.Slideshow.prototype.onImageLoad=function(i,e,s){var n=new Image;return i.length<=0||!(i instanceof t)||"string"!=typeof i.attr("src")?(e(!1,n,s),void 0):(n.onload=t.proxy(function(){e(!0,n,s)},this),n.src=i.attr("src"),void 0)},i.Slideshow.prototype.getNextViewID=function(){var t=this.currentViewID;if(this.settings.random){var i=t;if(t=this.getNextRandomViewID(),t!=i)return t}return isNaN(parseInt(t,10))?0:t>=this.$views.length-1?this.settings.loop?0:this.currentViewID:t+1},i.Slideshow.prototype.getPreviousViewID=function(){var t=this.currentViewID;if(isNaN(parseInt(t,10))&&(t=0),this.settings.random){var i=t;if(t=this.getPreviousRandomViewID(),t!=i)return t}return 0>=t?this.settings.loop?t=this.$views.length-1:this.currentViewID:t-=1},i.Slideshow.prototype.getNextRandomViewID=function(){return isNaN(parseInt(this.currentViewID,10))||this.randomPreviousHistoryViewIDs.push(this.currentViewID),this.randomPreviousHistoryViewIDs.length>2*this.viewIDs.length&&this.randomPreviousHistoryViewIDs.shift(),this.randomNextHistoryViewIDs.length>0?this.randomNextHistoryViewIDs.pop():((void 0===this.randomAvailableViewIDs||this.randomAvailableViewIDs.length<=0)&&(this.randomAvailableViewIDs=t.extend(!0,[],this.viewIDs),this.randomAvailableViewIDs.splice(t.inArray(this.currentViewID,this.randomAvailableViewIDs))),this.randomAvailableViewIDs.splice(Math.floor(Math.random()*this.randomAvailableViewIDs.length),1).pop())},i.Slideshow.prototype.getPreviousRandomViewID=function(){return isNaN(parseInt(this.currentViewID,10))||this.randomNextHistoryViewIDs.push(this.currentViewID),this.randomNextHistoryViewIDs.length>2*this.viewIDs.length&&this.randomNextHistoryViewIDs.shift(),this.randomPreviousHistoryViewIDs.length>0?this.randomPreviousHistoryViewIDs.pop():this.viewIDs[Math.floor(Math.random()*this.viewIDs.length)]},i.Slideshow.prototype.getID=function(){var t=this.$container.data("sessionId");return isNaN(parseInt(t,10))&&(t=this.$container.attr("data-session-id")),t}}();!function(){var t=jQuery,i=slideshow_jquery_image_gallery_script;i.Slideshow.prototype.animateTo=function(i,e){if(!(this.isVideoPlaying()||0>i||i>=this.$views.length||i==this.currentViewID)){if(this.currentlyAnimating===!0)return this.$container.one("slideshowAnimationEnd",t.proxy(function(){this.pause(this.PlayStates.TEMPORARILY_PAUSED),this.animateTo(i,e),this.play()},this)),void 0;this.currentlyAnimating=!0,(isNaN(parseInt(e,10))||0==e)&&(e=i<this.currentViewID?-1:1),this.visibleViews=[this.currentViewID,i];var s=this.settings.animation,n=["slide","slideRight","slideUp","slideDown","fade","directFade"];"random"==s&&(s=n[Math.floor(Math.random()*n.length)]);var o={slide:"slideRight",slideRight:"slide",slideUp:"slideDown",slideDown:"slideUp",fade:"fade",directFade:"directFade"};0>e&&(s=o[s]);var a=t(this.$views[this.currentViewID]),h=t(this.$views[i]);switch(a.stop(!0,!0),h.stop(!0,!0),h.addClass("slideshow_nextView"),this.recalculateVisibleViews(),this.currentViewID=i,this.$container.trigger("slideshowAnimationStart",[i,s]),s){case"slide":h.css({top:0,left:this.$content.width()}),a.animate({left:-a.outerWidth(!0)},1e3*this.settings.slideSpeed),h.animate({left:0},1e3*this.settings.slideSpeed),setTimeout(t.proxy(function(){a.stop(!0,!0).css("top",this.$container.outerHeight(!0))},this),1e3*this.settings.slideSpeed);break;case"slideRight":h.css({top:0,left:-this.$content.width()}),a.animate({left:a.outerWidth(!0)},1e3*this.settings.slideSpeed),h.animate({left:0},1e3*this.settings.slideSpeed),setTimeout(t.proxy(function(){a.stop(!0,!0).css("top",this.$container.outerHeight(!0))},this),1e3*this.settings.slideSpeed);break;case"slideUp":h.css({top:this.$content.height(),left:0}),a.animate({top:-a.outerHeight(!0)},1e3*this.settings.slideSpeed),h.animate({top:0},1e3*this.settings.slideSpeed),setTimeout(t.proxy(function(){a.stop(!0,!0).css("top",this.$container.outerHeight(!0))},this),1e3*this.settings.slideSpeed);break;case"slideDown":h.css({top:-this.$content.height(),left:0}),a.animate({top:a.outerHeight(!0)},1e3*this.settings.slideSpeed),h.animate({top:0},1e3*this.settings.slideSpeed),setTimeout(t.proxy(function(){a.stop(!0,!0).css("top",this.$container.outerHeight(!0))},this),1e3*this.settings.slideSpeed);break;case"fade":h.css({top:0,left:0,display:"none"}),a.fadeOut(1e3*this.settings.slideSpeed/2),setTimeout(t.proxy(function(){h.fadeIn(1e3*this.settings.slideSpeed/2),a.stop(!0,!0).css({top:this.$container.outerHeight(!0),display:"block"})},this),1e3*this.settings.slideSpeed/2);break;case"directFade":h.css({top:0,left:0,"z-index":0,display:"none"}),a.css({"z-index":1}),h.stop(!0,!0).fadeIn(1e3*this.settings.slideSpeed),a.stop(!0,!0).fadeOut(1e3*this.settings.slideSpeed),setTimeout(t.proxy(function(){h.stop(!0,!0).css({"z-index":0}),a.stop(!0,!0).css({top:this.$container.outerHeight(!0),display:"block","z-index":0})},this),1e3*this.settings.slideSpeed)}setTimeout(t.proxy(function(){a.removeClass("slideshow_currentView"),h.removeClass("slideshow_nextView"),h.addClass("slideshow_currentView"),this.visibleViews=[i],this.currentlyAnimating=!1,this.$container.trigger("slideshowAnimationEnd")},this),1e3*this.settings.slideSpeed)}}}();!function(){var t=jQuery,i=slideshow_jquery_image_gallery_script;i.Slideshow.prototype.recalculate=function(i){if(!this.$container.is(":visible"))return this.invisibilityTimer=setInterval(t.proxy(function(){this.$container.is(":visible")&&(this.recalculate(i),clearInterval(this.invisibilityTimer),this.invisibilityTimer=!1)},this),500),void 0;for(var e=this.$parentElement,s=0;e.width()<=0&&(e=e.parent(),!(s>50));s++);if(this.currentWidth!=e.width()){this.currentWidth=e.width();var n=e.width()-(this.$container.outerWidth()-this.$container.width());if(parseInt(this.settings.maxWidth,10)>0&&parseInt(this.settings.maxWidth,10)<n&&(n=parseInt(this.settings.maxWidth,10)),this.$container.css("width",Math.floor(n)),this.$content.css("width",Math.floor(n)-(this.$content.outerWidth(!0)-this.$content.width())),this.settings.preserveSlideshowDimensions){var o=n*this.settings.dimensionHeight/this.settings.dimensionWidth;this.$container.css("height",Math.floor(o)),this.$content.css("height",Math.floor(o)-(this.$content.outerHeight(!0)-this.$content.height()))}else this.$container.css("height",Math.floor(this.settings.height)),this.$content.css("height",Math.floor(this.settings.height));this.$views.each(t.proxy(function(i,e){t.inArray(i,this.visibleViews)<0&&t(e).css("top",this.$container.outerHeight(!0))},this)),this.$container.trigger("slideshowResize"),(i||"boolean"!=typeof i)&&this.recalculateVisibleViews()}},i.Slideshow.prototype.recalculateViews=function(){t.each(this.$views,t.proxy(function(t){this.recalculateView(t,!1)},this))},i.Slideshow.prototype.recalculateVisibleViews=function(){t.each(this.visibleViews,t.proxy(function(t,i){this.recalculateView(i,!1)},this))},i.Slideshow.prototype.recalculateView=function(e,s){var n=t(this.$views[e]);if("boolean"==typeof s&&s||this.$content.width()!=n.outerWidth(!0)){var o=n.find(".slideshow_slide");if(!(o.length<=0)){var a=this.$content.width()-(n.outerWidth(!0)-n.width()),h=this.$content.height()-(n.outerHeight(!0)-n.height()),r=Math.floor(a/o.length),l=h,d=a%o.length,c=0;t(o[0]).css("margin-left",0),t(o[o.length-1]).css("margin-right",0),t.each(o,t.proxy(function(s,n){var a=t(n),h=a.outerWidth(!0)-a.width(),u=a.outerHeight(!0)-a.height();if(s==o.length-1?a.width(r-h+d):a.width(r-h),a.height(l-u),a.hasClass("slideshow_slide_text")){var p=a.find(".slideshow_background_anchor");if(p.length<=0)return;var w=a.width()-(p.outerWidth(!0)-p.width()),g=a.height()-(p.outerHeight(!0)-p.height());p.css({width:w,height:g})}else if(a.hasClass("slideshow_slide_image")){var f=a.find("img");if(f.length<=0)return;var y=f.outerWidth()-f.width(),v=f.outerHeight()-f.height(),m=a.width()-y,I=a.height()-v;this.settings.stretchImages?(f.css({width:m,height:I}),f.attr({width:m,height:I})):this.getNaturalImageSize(f,t.proxy(function(i,s){var n,o;return 0>=i||0>=s?(setTimeout(t.proxy(function(){this.recalculateView(e,!0)},this),500),void 0):(n=a.width()/a.height(),o=(i+y)/(s+v),o>=n?(f.css({margin:"0px",width:m,height:Math.floor(m/o)}),f.attr({width:m,height:Math.floor(m/o)})):(f.css({"margin-left":"auto","margin-right":"auto",display:"block",width:Math.floor(I*o),height:I}),f.attr({width:Math.floor(I*o),height:I})),void 0)},this))}else if(a.hasClass("slideshow_slide_video")){var $=a.find("iframe");if($.length>0)$.attr({width:a.width(),height:a.height()});else var S=setInterval(t.proxy(function(){if(i.youTubeAPIReady){clearInterval(S);var e=a.find(".slideshow_slide_video_id");e.attr("id","slideshow_slide_video_"+Math.floor(1e6*Math.random())+"_"+e.text());var s=e.attr("data-show-related-videos"),n=new YT.Player(e.attr("id"),{width:a.width(),height:a.height(),videoId:e.text(),playerVars:{wmode:"opaque",rel:s},events:{onReady:function(){},onStateChange:t.proxy(function(t){this.videoPlayers[e.attr("id")].state=t.data},this)}}),o=t("#"+e.attr("id"));o.show(),o.attr("src",o.attr("src")+"&wmode=opaque"),this.videoPlayers[e.attr("id")]={player:n,state:-1}}},this),500)}c+=a.outerWidth(!0)},this)),n.css({width:a,height:h})}}}}();!function(){var t=jQuery,i=slideshow_jquery_image_gallery_script;i.Slideshow.prototype.activateDescriptions=function(){this.settings.showDescription&&(t.each(this.$slides.find(".slideshow_description"),t.proxy(function(i,e){var s=t(e);s.show(),this.settings.hideDescription?s.css({position:"absolute",top:this.$container.outerHeight(!0)}):s.css({position:"absolute",bottom:0})},this)),this.settings.hideDescription&&(this.$container.bind("slideshowResize",t.proxy(function(){t.each(this.$container.find(".slideshow_description"),t.proxy(function(i,e){t(e).css("top",this.$container.outerHeight(!0))},this))},this)),this.$container.bind("slideshowAnimationStart",t.proxy(function(){void 0!=this.visibleViews[1]&&t.each(t(this.$views[this.visibleViews[1]]).find(".slideshow_description"),t.proxy(function(i,e){t(e).css("top",this.$container.outerHeight(!0))},this))},this)),this.$slides.mouseenter(t.proxy(function(i){var e=t(i.currentTarget).find(".slideshow_description");this.descriptionTimer=setTimeout(t.proxy(function(){this.descriptionTimer="",e.stop(!0,!1).animate({top:this.$container.outerHeight(!0)-e.outerHeight(!0)},parseInt(1e3*this.settings.descriptionSpeed,10))},this),100)},this)),this.$slides.mouseleave(t.proxy(function(i){this.descriptionTimer===!1&&(clearInterval(this.descriptionTimer),this.descriptionTimer=!1),t(i.currentTarget).find(".slideshow_description").stop(!0,!1).animate({top:this.$container.outerHeight(!0)},parseInt(1e3*this.settings.descriptionSpeed,10))},this))))},i.Slideshow.prototype.activateNavigationButtons=function(){this.settings.controllable&&(this.$nextButton.click(t.proxy(function(){this.currentlyAnimating||(this.pauseAllVideos(),this.pause(this.PlayStates.TEMPORARILY_PAUSED),this.animateTo(this.getNextViewID(),1),this.play())},this)),this.$previousButton.click(t.proxy(function(){this.currentlyAnimating||(this.pauseAllVideos(),this.pause(this.PlayStates.TEMPORARILY_PAUSED),this.animateTo(this.getPreviousViewID(),-1),this.play())},this)),this.settings.hideNavigationButtons?(this.$container.mouseenter(t.proxy(function(){this.$nextButton.stop(!0,!0).fadeIn(100)},this)),this.$container.mouseleave(t.proxy(function(){this.$nextButton.stop(!0,!0).fadeOut(500)},this)),this.$container.mouseenter(t.proxy(function(){this.$previousButton.stop(!0,!0).fadeIn(100)},this)),this.$container.mouseleave(t.proxy(function(){this.$previousButton.stop(!0,!0).fadeOut(500)},this))):(this.$nextButton.show(),this.$previousButton.show()))},i.Slideshow.prototype.activateControlPanel=function(){this.settings.controlPanel&&(this.$container.bind("slideshowPlayStateChange",t.proxy(function(t,i){i===this.PlayStates.PLAYING?this.$togglePlayButton.attr("class","slideshow_pause"):i===this.PlayStates.PAUSED&&this.$togglePlayButton.attr("class","slideshow_play")},this)),this.$togglePlayButton.click(t.proxy(function(i){this.settings.play?(this.settings.play=!1,t(i.currentTarget).attr("class","slideshow_play"),this.pause(this.PlayStates.PAUSED)):(this.settings.play=!0,t(i.currentTarget).attr("class","slideshow_pause"),this.play())},this)),this.settings.hideControlPanel?(this.$container.mouseenter(t.proxy(function(){this.$controlPanel.stop(!0,!0).fadeIn(100)},this)),this.$container.mouseleave(t.proxy(function(){this.$controlPanel.stop(!0,!0).fadeOut(500)},this))):this.$controlPanel.show())},i.Slideshow.prototype.activatePagination=function(){if(this.settings.showPagination){this.$pagination.find(".slideshow_pagination_center").html("<ul></ul>");var i=this.$pagination.find("ul");i.html(""),this.$views.each(t.proxy(function(t){var e="";t==this.currentViewID&&(e="slideshow_currentView"),i.append('<li class="slideshow_transparent '+e+'"><span style="display: none;">'+t+"</span></li>")},this)),this.$pagination.find("li").click(t.proxy(function(i){if(!this.currentlyAnimating){var e=t(i.currentTarget).find("span").text();isNaN(parseInt(e,10))||(this.pauseAllVideos(),this.pause(this.PlayStates.TEMPORARILY_PAUSED),this.animateTo(parseInt(e,10),0),this.play())}},this)),this.$container.bind("slideshowAnimationStart",t.proxy(function(){var i=this.$pagination.find("li");i.each(t.proxy(function(i,e){t(e).removeClass("slideshow_currentView")},this)),t(i[this.currentViewID]).addClass("slideshow_currentView")},this)),this.settings.hidePagination?(this.$container.mouseenter(t.proxy(function(){this.$pagination.stop(!0,!0).fadeIn(100)},this)),this.$container.mouseleave(t.proxy(function(){this.$pagination.stop(!0,!0).fadeOut(500)},this))):this.$pagination.show()}},i.Slideshow.prototype.activatePauseOnHover=function(){this.settings.pauseOnHover&&(this.$container.mouseenter(t.proxy(function(){clearTimeout(this.pauseOnHoverTimer),this.playState!==this.PlayStates.PAUSED&&(this.pauseOnHoverTimer=setTimeout(t.proxy(function(){this.pause(this.PlayStates.TEMPORARILY_PAUSED)},this),500))},this)),this.$container.mouseleave(t.proxy(function(){clearTimeout(this.pauseOnHoverTimer),this.playState!==this.PlayStates.PAUSED&&this.interval===!1&&this.play()},this)))}}();
     1function onYouTubeIframeAPIReady(){slideshow_jquery_image_gallery_script.youTubeAPIReady=!0}slideshow_jquery_image_gallery_script=function(){var t=jQuery,i={};return i.slideshowInstances={},i.initialized=!1,i.youTubeAPIReady=!1,i.init=function(){i.initialized||(i.initialized=!0,i.loadYouTubeAPI(),i.checkStylesheetURL(),i.activateSlideshows())},i.getSlideshowInstance=function(e){if(isNaN(parseInt(e,10))){if(e instanceof t&&e.length>0)for(var s in i.slideshowInstances)if(i.slideshowInstances.hasOwnProperty(s)){var n=i.slideshowInstances[s];if(n instanceof i.Slideshow&&n.$container.get(0)===e.get(0))return n}}else if(i.slideshowInstances[e]instanceof i.Slideshow)return i.slideshowInstances[e];return new i.Slideshow},i.activateSlideshows=function(){t.each(jQuery(".slideshow_container"),function(e,s){var n=t(s),o=n.data("sessionId");isNaN(parseInt(o,10))&&(o=n.attr("data-session-id")),i.slideshowInstances[o]instanceof i.Slideshow||(i.slideshowInstances[o]=new i.Slideshow(n))})},i.loadYouTubeAPI=function(){if(i.loadYouTubeAPICalled=!0,!(t(".slideshow_slide_video").length<=0)){var e=document.createElement("script"),s=document.getElementsByTagName("script")[0];e.src="//www.youtube.com/iframe_api",s.parentNode.insertBefore(e,s)}},i.checkStylesheetURL=function(){var i=t('[id*="slideshow-jquery-image-gallery-ajax-stylesheet_"]');i.length<=0||t.each(i,function(i,e){var s,n,o,a=t(e),h=t(e).attr("href");void 0!==h&&""!==h&&(s=a.attr("id").split("_"),n=s.splice(1,s.length-1).join("_").slice(0,-4),o=h.split("?"),(void 0===o[1]||""===o[1]||o[1].toLowerCase().indexOf("style=")<0)&&(o[1]="action=slideshow_jquery_image_gallery_load_stylesheet&style="+n+"&ver="+Math.round((new Date).getTime()/1e3),h=o.join("?"),a.attr("href",h)))})},t(document).ready(function(){i.init()}),t(window).load(function(){i.init()}),t.fn.getSlideshowInstance=function(){return i.getSlideshowInstance(this)},i}();
     2
     3!function(){var t=jQuery,i=slideshow_jquery_image_gallery_script;i.Slideshow=function(i){if(i instanceof t&&(this.$container=i,this.$content=this.$container.find(".slideshow_content"),this.$views=this.$container.find(".slideshow_view"),this.$slides=this.$container.find(".slideshow_slide"),this.$controlPanel=this.$container.find(".slideshow_controlPanel"),this.$togglePlayButton=this.$controlPanel.find(".slideshow_togglePlay"),this.$nextButton=this.$container.find(".slideshow_next"),this.$previousButton=this.$container.find(".slideshow_previous"),this.$pagination=this.$container.find(".slideshow_pagination"),this.$loadingIcon=this.$container.find(".slideshow_loading_icon"),this.ID=this.getID(),!isNaN(parseInt(this.ID,10)))){this.settings=window["SlideshowPluginSettings_"+this.ID],t.each(this.settings,t.proxy(function(t,i){"true"==i?this.settings[t]=!0:"false"==i&&(this.settings[t]=!1)},this)),this.$parentElement=this.$container.parent(),this.viewData=[],this.viewIDs=[],this.currentlyAnimating=!1,this.currentViewID=void 0,this.currentWidth=0,this.visibleViews=[],this.videoPlayers=[],this.PlayStates={UNSTARTED:-2,PAUSED:-1,TEMPORARILY_PAUSED:0,PLAYING:1},this.playState=this.PlayStates.UNSTARTED,this.interval=!1,this.pauseOnHoverTimer=!1,this.invisibilityTimer=!1,this.descriptionTimer=!1,this.randomNextHistoryViewIDs=[],this.randomPreviousHistoryViewIDs=[],this.randomAvailableViewIDs=[],t.each(this.$views,t.proxy(function(t){this.viewIDs.push(t)},this)),this.currentViewID=this.getNextViewID(),this.visibleViews=[this.currentViewID],this.recalculate(!1);var e=!0;t.each(this.$views,t.proxy(function(i,s){var n=t(s);i!=this.visibleViews[0]?n.css("top",this.$container.outerHeight(!0)):n.addClass("slideshow_currentView"),this.viewData[i]=[],t.each(n.find(".slideshow_slide"),t.proxy(function(s,n){var o=t(n);if(this.viewData[i][s]={},o.hasClass("slideshow_slide_image")){var a=o.find("img");a.length>0?a.get(0).complete?this.viewData[i][s].loaded=1:(i===this.currentViewID&&(e=!1),this.viewData[i][s].loaded=0,this.onImageLoad(a,t.proxy(function(t){this.viewData[i][s].loaded=t?1:2,this.settings.waitUntilLoaded&&i===this.currentViewID&&this.isViewLoaded(i)&&this.start()},this))):this.viewData[i][s].loaded=-1}else this.viewData[i][s].loaded=-1},this))},this)),t(window).load(t.proxy(function(){this.recalculateVisibleViews()},this)),parseFloat(this.settings.intervalSpeed)<parseFloat(this.settings.slideSpeed)+.1&&(this.settings.intervalSpeed=parseFloat(this.settings.slideSpeed)+.1),(!this.settings.waitUntilLoaded||this.settings.waitUntilLoaded&&e)&&this.start()}}}();
     4!function(){var t=jQuery,i=slideshow_jquery_image_gallery_script;i.Slideshow.prototype.start=function(){this.activateDescriptions(),this.activateControlPanel(),this.activateNavigationButtons(),this.activatePagination(),this.activatePauseOnHover(),this.$loadingIcon.length>0&&this.$loadingIcon.remove(),this.$content.show(),this.recalculateViews(),this.settings.enableResponsiveness&&t(window).resize(t.proxy(function(){this.recalculate(!0)},this)),this.playState=this.PlayStates.PAUSED,this.$container.trigger("slideshowPlayStateChange",[this.playState]),this.settings.play&&this.play()},i.Slideshow.prototype.play=function(){this.interval||(this.playState=this.PlayStates.PLAYING,this.$container.trigger("slideshowPlayStateChange",[this.playState]),this.interval=setInterval(t.proxy(function i(e,s){void 0===s&&(s=this),void 0===e&&(e=s.getNextViewID()),s.isViewLoaded(e)?(s.animateTo(e,1),s.play()):(s.pause(this.PlayStates.TEMPORARILY_PAUSED),setTimeout(t.proxy(function(){i(e,s)},s),100))},this),1e3*this.settings.intervalSpeed))},i.Slideshow.prototype.pause=function(t){clearInterval(this.interval),this.interval=!1,t!==this.PlayStates.PAUSED&&t!==this.PlayStates.TEMPORARILY_PAUSED&&(t=this.PlayStates.PAUSED),this.playState=t,this.$container.trigger("slideshowPlayStateChange",[this.playState])},i.Slideshow.prototype.next=function(){this.playState===this.PlayStates.PLAYING&&(this.pause(this.PlayStates.TEMPORARILY_PAUSED),this.play()),this.animateTo(this.getNextViewID(),1)},i.Slideshow.prototype.previous=function(){this.playState===this.PlayStates.PLAYING&&(this.pause(this.PlayStates.TEMPORARILY_PAUSED),this.play()),this.animateTo(this.getPreviousViewID(),-1)},i.Slideshow.prototype.isVideoPlaying=function(){for(var t in this.videoPlayers)if(this.videoPlayers.hasOwnProperty(t)){var i=this.videoPlayers[t].state;if(1==i||3==i)return!0}return!1},i.Slideshow.prototype.pauseAllVideos=function(){for(var t in this.videoPlayers)if(this.videoPlayers.hasOwnProperty(t)){var i=this.videoPlayers[t].player;null!=i&&"function"==typeof i.pauseVideo&&(this.videoPlayers[t].state=2,i.pauseVideo())}},i.Slideshow.prototype.isViewLoaded=function(i){var e=!0;return t.each(this.viewData[i],t.proxy(function(t,i){0==i.loaded&&(e=!1)},this)),e},i.Slideshow.prototype.getNaturalImageSize=function(i,e,s){return i.length<=0||!(i instanceof t)||"string"!=typeof i.attr("src")?(e(-1,-1,s),void 0):(this.onImageLoad(i,t.proxy(function(t,i){e(i.width,i.height,s)},this)),void 0)},i.Slideshow.prototype.onImageLoad=function(i,e,s){var n=new Image;return i.length<=0||!(i instanceof t)||"string"!=typeof i.attr("src")?(e(!1,n,s),void 0):(n.onload=t.proxy(function(){e(!0,n,s)},this),n.src=i.attr("src"),void 0)},i.Slideshow.prototype.getNextViewID=function(){var t=this.currentViewID;if(this.settings.random){var i=t;if(t=this.getNextRandomViewID(),t!=i)return t}return isNaN(parseInt(t,10))?0:t>=this.$views.length-1?this.settings.loop?0:this.currentViewID:t+1},i.Slideshow.prototype.getPreviousViewID=function(){var t=this.currentViewID;if(isNaN(parseInt(t,10))&&(t=0),this.settings.random){var i=t;if(t=this.getPreviousRandomViewID(),t!=i)return t}return 0>=t?this.settings.loop?t=this.$views.length-1:this.currentViewID:t-=1},i.Slideshow.prototype.getNextRandomViewID=function(){return isNaN(parseInt(this.currentViewID,10))||this.randomPreviousHistoryViewIDs.push(this.currentViewID),this.randomPreviousHistoryViewIDs.length>2*this.viewIDs.length&&this.randomPreviousHistoryViewIDs.shift(),this.randomNextHistoryViewIDs.length>0?this.randomNextHistoryViewIDs.pop():((void 0===this.randomAvailableViewIDs||this.randomAvailableViewIDs.length<=0)&&(this.randomAvailableViewIDs=t.extend(!0,[],this.viewIDs),this.randomAvailableViewIDs.splice(t.inArray(this.currentViewID,this.randomAvailableViewIDs))),this.randomAvailableViewIDs.splice(Math.floor(Math.random()*this.randomAvailableViewIDs.length),1).pop())},i.Slideshow.prototype.getPreviousRandomViewID=function(){return isNaN(parseInt(this.currentViewID,10))||this.randomNextHistoryViewIDs.push(this.currentViewID),this.randomNextHistoryViewIDs.length>2*this.viewIDs.length&&this.randomNextHistoryViewIDs.shift(),this.randomPreviousHistoryViewIDs.length>0?this.randomPreviousHistoryViewIDs.pop():this.viewIDs[Math.floor(Math.random()*this.viewIDs.length)]},i.Slideshow.prototype.getID=function(){var t=this.$container.data("sessionId");return isNaN(parseInt(t,10))&&(t=this.$container.attr("data-session-id")),t}}();
     5!function(){var t=jQuery,i=slideshow_jquery_image_gallery_script;i.Slideshow.prototype.animateTo=function(i,e){if(!(this.isVideoPlaying()||0>i||i>=this.$views.length||i==this.currentViewID)){if(this.currentlyAnimating===!0)return this.$container.one("slideshowAnimationEnd",t.proxy(function(){this.playState===this.PlayStates.PLAYING&&(this.pause(this.PlayStates.TEMPORARILY_PAUSED),this.play()),this.animateTo(i,e)},this)),void 0;this.currentlyAnimating=!0,(isNaN(parseInt(e,10))||0==e)&&(e=i<this.currentViewID?-1:1),this.visibleViews=[this.currentViewID,i];var s=this.settings.animation,n=["slide","slideRight","slideUp","slideDown","fade","directFade"];"random"==s&&(s=n[Math.floor(Math.random()*n.length)]);var o={slide:"slideRight",slideRight:"slide",slideUp:"slideDown",slideDown:"slideUp",fade:"fade",directFade:"directFade"};0>e&&(s=o[s]);var a=t(this.$views[this.currentViewID]),h=t(this.$views[i]);switch(a.stop(!0,!0),h.stop(!0,!0),h.addClass("slideshow_nextView"),this.recalculateVisibleViews(),this.currentViewID=i,this.$container.trigger("slideshowAnimationStart",[i,s]),s){case"slide":h.css({top:0,left:this.$content.width()}),a.animate({left:-a.outerWidth(!0)},1e3*this.settings.slideSpeed),h.animate({left:0},1e3*this.settings.slideSpeed),setTimeout(t.proxy(function(){a.stop(!0,!0).css("top",this.$container.outerHeight(!0))},this),1e3*this.settings.slideSpeed);break;case"slideRight":h.css({top:0,left:-this.$content.width()}),a.animate({left:a.outerWidth(!0)},1e3*this.settings.slideSpeed),h.animate({left:0},1e3*this.settings.slideSpeed),setTimeout(t.proxy(function(){a.stop(!0,!0).css("top",this.$container.outerHeight(!0))},this),1e3*this.settings.slideSpeed);break;case"slideUp":h.css({top:this.$content.height(),left:0}),a.animate({top:-a.outerHeight(!0)},1e3*this.settings.slideSpeed),h.animate({top:0},1e3*this.settings.slideSpeed),setTimeout(t.proxy(function(){a.stop(!0,!0).css("top",this.$container.outerHeight(!0))},this),1e3*this.settings.slideSpeed);break;case"slideDown":h.css({top:-this.$content.height(),left:0}),a.animate({top:a.outerHeight(!0)},1e3*this.settings.slideSpeed),h.animate({top:0},1e3*this.settings.slideSpeed),setTimeout(t.proxy(function(){a.stop(!0,!0).css("top",this.$container.outerHeight(!0))},this),1e3*this.settings.slideSpeed);break;case"fade":h.css({top:0,left:0,display:"none"}),a.fadeOut(1e3*this.settings.slideSpeed/2),setTimeout(t.proxy(function(){h.fadeIn(1e3*this.settings.slideSpeed/2),a.stop(!0,!0).css({top:this.$container.outerHeight(!0),display:"block"})},this),1e3*this.settings.slideSpeed/2);break;case"directFade":h.css({top:0,left:0,"z-index":0,display:"none"}),a.css({"z-index":1}),h.stop(!0,!0).fadeIn(1e3*this.settings.slideSpeed),a.stop(!0,!0).fadeOut(1e3*this.settings.slideSpeed),setTimeout(t.proxy(function(){h.stop(!0,!0).css({"z-index":0}),a.stop(!0,!0).css({top:this.$container.outerHeight(!0),display:"block","z-index":0})},this),1e3*this.settings.slideSpeed)}setTimeout(t.proxy(function(){a.removeClass("slideshow_currentView"),h.removeClass("slideshow_nextView"),h.addClass("slideshow_currentView"),this.visibleViews=[i],this.currentlyAnimating=!1,this.$container.trigger("slideshowAnimationEnd")},this),1e3*this.settings.slideSpeed)}}}();
     6!function(){var t=jQuery,i=slideshow_jquery_image_gallery_script;i.Slideshow.prototype.recalculate=function(i){if(!this.$container.is(":visible"))return this.invisibilityTimer=setInterval(t.proxy(function(){this.$container.is(":visible")&&(this.recalculate(i),clearInterval(this.invisibilityTimer),this.invisibilityTimer=!1)},this),500),void 0;for(var e=this.$parentElement,s=0;e.width()<=0&&(e=e.parent(),!(s>50));s++);if(this.currentWidth!=e.width()){this.currentWidth=e.width();var n=e.width()-(this.$container.outerWidth()-this.$container.width());if(parseInt(this.settings.maxWidth,10)>0&&parseInt(this.settings.maxWidth,10)<n&&(n=parseInt(this.settings.maxWidth,10)),this.$container.css("width",Math.floor(n)),this.$content.css("width",Math.floor(n)-(this.$content.outerWidth(!0)-this.$content.width())),this.settings.preserveSlideshowDimensions){var o=n*this.settings.dimensionHeight/this.settings.dimensionWidth;this.$container.css("height",Math.floor(o)),this.$content.css("height",Math.floor(o)-(this.$content.outerHeight(!0)-this.$content.height()))}else this.$container.css("height",Math.floor(this.settings.height)),this.$content.css("height",Math.floor(this.settings.height));this.$views.each(t.proxy(function(i,e){t.inArray(i,this.visibleViews)<0&&t(e).css("top",this.$container.outerHeight(!0))},this)),this.$container.trigger("slideshowResize"),(i||"boolean"!=typeof i)&&this.recalculateVisibleViews()}},i.Slideshow.prototype.recalculateViews=function(){t.each(this.$views,t.proxy(function(t){this.recalculateView(t,!1)},this))},i.Slideshow.prototype.recalculateVisibleViews=function(){t.each(this.visibleViews,t.proxy(function(t,i){this.recalculateView(i,!1)},this))},i.Slideshow.prototype.recalculateView=function(e,s){var n=t(this.$views[e]);if("boolean"==typeof s&&s||this.$content.width()!=n.outerWidth(!0)){var o=n.find(".slideshow_slide");if(!(o.length<=0)){var a=this.$content.width()-(n.outerWidth(!0)-n.width()),h=this.$content.height()-(n.outerHeight(!0)-n.height()),r=Math.floor(a/o.length),l=h,d=a%o.length,c=0;t(o[0]).css("margin-left",0),t(o[o.length-1]).css("margin-right",0),t.each(o,t.proxy(function(s,n){var a=t(n),h=a.outerWidth(!0)-a.width(),u=a.outerHeight(!0)-a.height();if(s==o.length-1?a.width(r-h+d):a.width(r-h),a.height(l-u),a.hasClass("slideshow_slide_text")){var p=a.find(".slideshow_background_anchor");if(p.length<=0)return;var w=a.width()-(p.outerWidth(!0)-p.width()),g=a.height()-(p.outerHeight(!0)-p.height());p.css({width:w,height:g})}else if(a.hasClass("slideshow_slide_image")){var y=a.find("img");if(y.length<=0)return;var f,v,m=y.outerWidth(),I=y.outerHeight();f=isNaN(parseInt(m))?0:m-y.width(),v=isNaN(parseInt(I))?0:I-y.height();var S=a.width()-f,P=a.height()-v;"stretch"===this.settings.imageBehaviour?(y.css({width:S,height:P}),y.attr({width:S,height:P})):this.getNaturalImageSize(y,t.proxy(function(i,s){var n,o;return 0>=i||0>=s?(setTimeout(t.proxy(function(){this.recalculateView(e,!0)},this),500),void 0):(n=a.width()/a.height(),o=(i+f)/(s+v),o>=n?"natural"===this.settings.imageBehaviour?(y.css({margin:"0px",width:S,height:Math.floor(S/o)}),y.attr({width:S,height:Math.floor(S/o)})):"zoom"===this.settings.imageBehaviour&&(y.css({"margin-top":"0px","margin-left":-Math.floor((P*o-S)/2),height:P,width:Math.floor(P*o)}),y.attr({width:Math.floor(P*o),height:P})):"natural"===this.settings.imageBehaviour?(y.css({"margin-left":"auto","margin-right":"auto",display:"block",width:-Math.floor(P*o),height:P}),y.attr({width:Math.floor(P*o),height:P})):"zoom"===this.settings.imageBehaviour&&(y.css({"margin-top":-Math.floor((S/o-P)/2),"margin-left":"0px",width:S,height:Math.floor(S/o)}),y.attr({width:S,height:Math.floor(S/o)})),void 0)},this))}else if(a.hasClass("slideshow_slide_video")){var $=a.find("iframe");if($.length>0)$.attr({width:a.width(),height:a.height()});else var _=setInterval(t.proxy(function(){if(i.youTubeAPIReady){clearInterval(_);var e=a.find(".slideshow_slide_video_id");e.attr("id","slideshow_slide_video_"+Math.floor(1e6*Math.random())+"_"+e.text());var s=e.attr("data-show-related-videos"),n=new YT.Player(e.attr("id"),{width:a.width(),height:a.height(),videoId:e.text(),playerVars:{wmode:"opaque",rel:s},events:{onReady:function(){},onStateChange:t.proxy(function(t){this.videoPlayers[e.attr("id")].state=t.data},this)}}),o=t("#"+e.attr("id"));o.show(),o.attr("src",o.attr("src")+"&wmode=opaque"),this.videoPlayers[e.attr("id")]={player:n,state:-1}}},this),500)}c+=a.outerWidth(!0)},this)),n.css({width:a,height:h})}}}}();
     7!function(){var t=jQuery,i=slideshow_jquery_image_gallery_script;i.Slideshow.prototype.activateDescriptions=function(){this.settings.showDescription&&(t.each(this.$slides.find(".slideshow_description"),t.proxy(function(i,e){var s=t(e);s.show(),this.settings.hideDescription?s.css({position:"absolute",top:this.$container.outerHeight(!0)}):s.css({position:"absolute",bottom:0})},this)),this.settings.hideDescription&&(this.$container.bind("slideshowResize",t.proxy(function(){t.each(this.$container.find(".slideshow_description"),t.proxy(function(i,e){t(e).css("top",this.$container.outerHeight(!0))},this))},this)),this.$container.bind("slideshowAnimationStart",t.proxy(function(){void 0!=this.visibleViews[1]&&t.each(t(this.$views[this.visibleViews[1]]).find(".slideshow_description"),t.proxy(function(i,e){t(e).css("top",this.$container.outerHeight(!0))},this))},this)),this.$slides.mouseenter(t.proxy(function(i){var e=t(i.currentTarget).find(".slideshow_description");this.descriptionTimer=setTimeout(t.proxy(function(){this.descriptionTimer="",e.stop(!0,!1).animate({top:this.$container.outerHeight(!0)-e.outerHeight(!0)},parseInt(1e3*this.settings.descriptionSpeed,10))},this),200)},this)),this.$slides.mouseleave(t.proxy(function(i){this.descriptionTimer!==!1&&(clearInterval(this.descriptionTimer),this.descriptionTimer=!1),t(i.currentTarget).find(".slideshow_description").stop(!0,!1).animate({top:this.$container.outerHeight(!0)},parseInt(1e3*this.settings.descriptionSpeed,10))},this))))},i.Slideshow.prototype.activateNavigationButtons=function(){this.settings.controllable&&(this.$nextButton.click(t.proxy(function(){this.currentlyAnimating||(this.pauseAllVideos(),this.playState===this.PlayStates.PLAYING&&(this.pause(this.PlayStates.TEMPORARILY_PAUSED),this.play()),this.animateTo(this.getNextViewID(),1))},this)),this.$previousButton.click(t.proxy(function(){this.currentlyAnimating||(this.pauseAllVideos(),this.playState===this.PlayStates.PLAYING&&(this.pause(this.PlayStates.TEMPORARILY_PAUSED),this.play()),this.animateTo(this.getPreviousViewID(),-1))},this)),this.settings.hideNavigationButtons?(this.$container.mouseenter(t.proxy(function(){this.$nextButton.stop(!0,!0).fadeIn(100)},this)),this.$container.mouseleave(t.proxy(function(){this.$nextButton.stop(!0,!0).fadeOut(500)},this)),this.$container.mouseenter(t.proxy(function(){this.$previousButton.stop(!0,!0).fadeIn(100)},this)),this.$container.mouseleave(t.proxy(function(){this.$previousButton.stop(!0,!0).fadeOut(500)},this))):(this.$nextButton.show(),this.$previousButton.show()))},i.Slideshow.prototype.activateControlPanel=function(){this.settings.controlPanel&&(this.$container.bind("slideshowPlayStateChange",t.proxy(function(t,i){i===this.PlayStates.PLAYING?this.$togglePlayButton.attr("class","slideshow_pause"):i===this.PlayStates.PAUSED&&this.$togglePlayButton.attr("class","slideshow_play")},this)),this.$togglePlayButton.click(t.proxy(function(i){var e=t(i.currentTarget);e.hasClass("slideshow_play")?this.play():this.pause(this.PlayStates.PAUSED)},this)),this.settings.hideControlPanel?(this.$container.mouseenter(t.proxy(function(){this.$controlPanel.stop(!0,!0).fadeIn(100)},this)),this.$container.mouseleave(t.proxy(function(){this.$controlPanel.stop(!0,!0).fadeOut(500)},this))):this.$controlPanel.show())},i.Slideshow.prototype.activatePagination=function(){if(this.settings.showPagination){this.$pagination.find(".slideshow_pagination_center").html("<ul></ul>");var i=this.$pagination.find("ul");i.html(""),this.$views.each(t.proxy(function(t){var e="";t==this.currentViewID&&(e="slideshow_currentView"),i.append('<li class="slideshow_transparent '+e+'"><span style="display: none;">'+t+"</span></li>")},this)),this.$pagination.find("li").click(t.proxy(function(i){if(!this.currentlyAnimating){var e=t(i.currentTarget).find("span").text();isNaN(parseInt(e,10))||(this.pauseAllVideos(),this.playState===this.PlayStates.PLAYING&&(this.pause(this.PlayStates.TEMPORARILY_PAUSED),this.play()),this.animateTo(parseInt(e,10),0))}},this)),this.$container.bind("slideshowAnimationStart",t.proxy(function(){var i=this.$pagination.find("li");i.each(t.proxy(function(i,e){t(e).removeClass("slideshow_currentView")},this)),t(i[this.currentViewID]).addClass("slideshow_currentView")},this)),this.settings.hidePagination?(this.$container.mouseenter(t.proxy(function(){this.$pagination.stop(!0,!0).fadeIn(100)},this)),this.$container.mouseleave(t.proxy(function(){this.$pagination.stop(!0,!0).fadeOut(500)},this))):this.$pagination.show()}},i.Slideshow.prototype.activatePauseOnHover=function(){this.settings.pauseOnHover&&(this.$container.mouseenter(t.proxy(function(){clearTimeout(this.pauseOnHoverTimer),this.playState!==this.PlayStates.PAUSED&&(this.pauseOnHoverTimer=setTimeout(t.proxy(function(){this.pause(this.PlayStates.TEMPORARILY_PAUSED)},this),500))},this)),this.$container.mouseleave(t.proxy(function(){clearTimeout(this.pauseOnHoverTimer),this.playState!==this.PlayStates.PAUSED&&this.interval===!1&&this.play()},this)))}}();
  • slideshow-jquery-image-gallery/trunk/readme.txt

    r763883 r765971  
    66Requires at least: 3.5
    77Tested up to: 3.6
    8 Stable tag: 2.2.15
     8Stable tag: 2.2.16
    99License: GPLv2
    1010
     
    177177
    178178== Changelog ==
     179
     180= 2.2.16 =
     181*   Inserting images can now be done using the WordPress 3.5 uploader.
     182*   Images can now fill up an entire slide without losing their dimensions, using the 'Zoom to fit' option.
     183*   Fixed: Descriptions came up and stayed up on fly-over.
     184*   Fixed: Image calculations failed in a few because of a 'jQuery.outerWidth()' bug.
     185*   Fixed: Control panel wasn't correctly initialized when slideshow was set to automatically slide to the next slide.
    179186
    180187= 2.2.15 =
     
    464471*   [Stefan Boonstra](http://stefanboonstra.com/)
    465472*   [Slideshow project board](https://trello.com/board/slideshow-plugin-wordpress/506311260cc04591010463c2)
     473*   [GitHub](https://github.com/Boonstra/Slideshow)
    466474*   [Prepros](http://alphapixels.com/prepros/)
  • slideshow-jquery-image-gallery/trunk/slideshow.php

    r763883 r765971  
    44 Plugin URI: http://wordpress.org/extend/plugins/slideshow-jquery-image-gallery/
    55 Description: The slideshow plugin is easily deployable on your website. Add any image that has already been uploaded to add to your slideshow, add text slides, or even add a video. Options and styles are customizable for every single slideshow on your website.
    6  Version: 2.2.15
     6 Version: 2.2.16
    77 Requires at least: 3.3
    88 Author: StefanBoonstra
     
    2222{
    2323    /** @var string $version */
    24     static $version = '2.2.15';
     24    static $version = '2.2.16';
    2525
    2626    /**
     
    7474    static function enqueueBackendScripts()
    7575    {
     76        wp_enqueue_media();
     77
    7678        wp_enqueue_script(
    7779            'slideshow-jquery-image-gallery-backend-script',
  • slideshow-jquery-image-gallery/trunk/views/SlideshowPluginPostType/slides.php

    r761395 r765971  
    11<p style="text-align: center;" xmlns="http://www.w3.org/1999/html" xmlns="http://www.w3.org/1999/html">
    22    <i><?php _e('Insert', 'slideshow-plugin'); ?>:</i><br/>
     3
    34    <?php echo SlideshowPluginSlideInserter::getImageSlideInsertButton(); ?>
    45    <?php echo SlideshowPluginSlideInserter::getTextSlideInsertButton(); ?>
  • slideshow-jquery-image-gallery/trunk/views/SlideshowPluginSlideInserter/insert-image-button.php

    r761395 r765971  
     1<input type="button" class="button upload_image_button" value="<?php _e('Image slide', 'slideshow-plugin'); ?> (New)" /><br /><br />
     2
    13<input type="button" id="slideshow-insert-image-slide" class="button" value="<?php _e('Image slide', 'slideshow-plugin'); ?>" />
  • slideshow-jquery-image-gallery/trunk/views/SlideshowPluginSlideshowSlide/backend_attachment.php

    r761395 r765971  
    77
    88    // Title and description
    9     $title = $description = $url = $target = '';
     9    $title = $description = $url = $target = $alternativeText = '';
    1010
    1111    if (isset($properties['title']))
     
    2323        $url = $properties['url'];
    2424    }
     25
    2526    if (isset($properties['urlTarget']))
    2627    {
    2728        $target = $properties['urlTarget'];
     29    }
     30
     31    if (isset($properties['alternativeText']))
     32    {
     33        $alternativeText = $properties['alternativeText'];
     34    }
     35    else
     36    {
     37        $alternativeText = $title;
    2838    }
    2939
     
    103113            </p>
    104114
     115            <p>
     116
     117                <i><?php _e('Alternative text', 'slideshow-plugin'); ?></i><br />
     118                <input type="text" name="<?php echo $name; ?>[alternativeText]" value="<?php echo $alternativeText; ?>" style="width: 100%;" />
     119
     120            </p>
     121
    105122            <input type="hidden" name="<?php echo $name; ?>[type]" value="attachment" />
    106123            <input type="hidden" name="<?php echo $name; ?>[postId]" value="<?php echo $attachment->ID; ?>" />
  • slideshow-jquery-image-gallery/trunk/views/SlideshowPluginSlideshowSlide/backend_templates.php

    r761395 r765971  
    9090        <p>
    9191
    92             <img width="80" height="60" src="" class="attachment attachment-80x60" alt="" title="" />
     92            <img width="80" height="60" src="" class="attachment attachment-80x60" alt="" title="" style="float: none; margin: 0; padding: 0;" />
    9393
    9494        </p>
     
    121121        </p>
    122122
     123        <p>
     124
     125            <i><?php _e('Alternative text', 'slideshow-plugin'); ?></i><br />
     126            <input type="text" class="alternativeText" style="width: 100%;" />
     127
     128        </p>
     129
    123130        <input type="hidden" class="type" value="attachment" />
    124131        <input type="hidden" class="postId" value="" />
  • slideshow-jquery-image-gallery/trunk/views/SlideshowPluginSlideshowSlide/frontend_attachment.php

    r761395 r765971  
    11<?php
    22
    3 $title = $description = $url = $urlTarget = $postId = '';
     3$title = $description = $url = $urlTarget = $alternativeText = $postId = '';
    44
    55if (isset($properties['title']))
     
    2323}
    2424
     25if (isset($properties['alternativeText']))
     26{
     27    $alternativeText = htmlspecialchars($properties['alternativeText']);
     28}
     29
    2530if (isset($properties['postId']))
    2631{
     
    3843    if (!empty($attachment)):
    3944
    40         // If no title is set, get the alt from the original image
    41         $alt = $title;
     45        // If no alternative text is set, get the alt from the original image
     46        if (empty($alternativeText))
     47        {
     48            $alternativeText = $title;
    4249
    43         if (empty($alt))
    44         {
    45             $alt = htmlspecialchars($attachment->post_title);
    46         }
     50            if (empty($alternativeText))
     51            {
     52                $alternativeText = htmlspecialchars($attachment->post_title);
     53            }
    4754
    48         if (empty($alt))
    49         {
    50             $alt = htmlspecialchars($attachment->post_content);
     55            if (empty($alternativeText))
     56            {
     57                $alternativeText = htmlspecialchars($attachment->post_content);
     58            }
    5159        }
    5260
     
    8795            <div class="slideshow_slide slideshow_slide_image">
    8896                <a <?php echo $anchorTagAttributes; ?>>
    89                     <img src="<?php echo htmlspecialchars($imageSrc); ?>" alt="<?php echo $alt; ?>" <?php echo ($imageWidth > 0) ? 'width="' . $imageWidth . '"' : ''; ?> <?php echo ($imageHeight > 0) ? 'height="' . $imageHeight . '"' : ''; ?> />
     97                    <img src="<?php echo htmlspecialchars($imageSrc); ?>" alt="<?php echo $alternativeText; ?>" <?php echo ($imageWidth > 0) ? 'width="' . $imageWidth . '"' : ''; ?> <?php echo ($imageHeight > 0) ? 'height="' . $imageHeight . '"' : ''; ?> />
    9098                </a>
    9199                <div class="slideshow_description slideshow_transparent">
Note: See TracChangeset for help on using the changeset viewer.