Skip to content
Permalink
Browse files

Add config options for all slider settings

  • Loading branch information...
mjbohn committed Jan 8, 2018
1 parent 64af627 commit 49fe32b21113cb951733843a17f43c0cab9d134e
Showing with 318 additions and 3 deletions.
  1. +90 −0 action.php
  2. +58 −1 conf/default.php
  3. +56 −0 conf/metadata.php
  4. +57 −0 lang/en/settings.php
  5. +57 −2 script.js
@@ -0,0 +1,90 @@
<?php
/**
* DokuWiki Plugin slider (Syntax Component)
*
* @license GPL 2 http://www.gnu.org/licenses/gpl-2.0.html
* @author Andreas Gohr <gohr@cosmocode.de>
* @author Michael Bohn <mjbohn@gmail.com>
*/
if(!defined('DOKU_INC')) die(); // no Dokuwiki, no go
class action_plugin_slider extends DokuWiki_Action_Plugin
{
/**
* Register the handle function in the controller
*
* @param Doku_event_handler $controller The event controller
*/
function register(Doku_Event_Handler $controller)
{
$controller->register_hook('DOKUWIKI_STARTED', 'AFTER', $this, 'addconfig2js');
}
/**
* @param $event
* @param $params
*/
function addconfig2js ($event, $params) {
global $JSINFO;
$JSINFO['plugin_slider'] = array(
// general settings
'mode' => $this->getConf('mode'),
'infiniteLoop' => $this->getConf('infiniteLoop'),
'hideControlOnEnd' => $this->getConf('hideControlOnEnd'),
'speed' => $this->getConf('speed'),
'easing' => $this->getConf('easing'),
'slideMargin' => $this->getConf('slideMargin'),
'startSlide' => $this->getConf('startSlide'),
'randomStart' => $this->getConf('randomStart'),
'captions' => $this->getConf('captions'),
'ticker' => $this->getConf('ticker'),
'tickerHover' => $this->getConf('tickerHover'),
'adaptiveHeight' => $this->getConf('adaptiveHeight'),
'adaptiveHeightSpeed' => $this->getConf('adaptiveHeightSpeed'),
'video' => $this->getConf('video'),
'useCSS' => $this->getConf('useCSS'),
'preloadImages' => $this->getConf('preloadImages'),
'responsive' => $this->getConf('responsive'),
// pager
'pager' => $this->getConf('pager'),
'pagerType' => $this->getConf('pagerType'),
'pagerShortSeparator' => $this->getConf('pagerShortSeparator'),
// controls
'controls' => $this->getConf('controls'),
'nextText' => $this->getConf('nextText'),
'prevText' => $this->getConf('prevText'),
'autoControls' => $this->getConf('autoControls'),
'startText' => $this->getConf('startText'),
'stopText' => $this->getConf('stopText'),
'autoControlsCombine' => $this->getConf('autoControlsCombine'),
// auto
'auto' => $this->getConf('auto'),
'pause' => $this->getConf('pause'),
'autoStart' => $this->getConf('autoStart'),
'autoDirection' => $this->getConf('autoDirection'),
'autoHover' => $this->getConf('autoHover'),
'autoDelay' => $this->getConf('autoDelay'),
// carousel
'minSlides' => $this->getConf('minSlides'),
'maxSlides' => $this->getConf('maxSlides'),
'moveSlides' => $this->getConf('moveSlides'),
'slideWidth' => $this->getConf('slideWidth'),
// touch
'touchEnabled' => $this->getConf('touchEnabled'),
'swipeThreshold' => $this->getConf('swipeThreshold'),
'oneToOneTouch' => $this->getConf('oneToOneTouch'),
'preventDefaultSwipeX' => $this->getConf('preventDefaultSwipeX'),
'preventDefaultSwipeY' => $this->getConf('preventDefaultSwipeY')
);
}
}
@@ -3,6 +3,63 @@
* Default settings for the slider plugin
*
* @author Andreas Gohr <gohr@cosmocode.de>
* @author Michael Bohn <mjbohn@gmail.com>
*
* Option for BxSlider v4.1.1
*/
$conf['width'] = 800;
$conf['width'] = 800;
// general settings
$conf['mode'] = 'horizontal';
$conf['infiniteLoop'] = true;
$conf['hideControlOnEnd'] = false;
$conf['speed'] = 500;
$conf['easing'] = null;
$conf['slideMargin'] = 0;
$conf['startSlide'] = 0;
$conf['randomStart'] = false;
$conf['captions'] = false;
$conf['ticker'] = false;
$conf['tickerHover'] = false;
$conf['adaptiveHeight'] = false;
$conf['adaptiveHeightSpeed'] = 500;
$conf['video'] = false;
$conf['useCSS'] = true;
$conf['preloadImages'] = 'visible';
$conf['responsive'] = true;
// pager
$conf['pager'] = true;
$conf['pagerType'] = 'full';
$conf['pagerShortSeparator'] = '/';
// controls
$conf['controls'] = true;
$conf['nextText'] = 'Next';
$conf['prevText'] = 'Prev';
$conf['autoControls'] = false;
$conf['startText'] = 'Start';
$conf['stopText'] = 'Stop';
$conf['autoControlsCombine'] = false;
// auto
$conf['auto'] = false;
$conf['pause'] = 4000;
$conf['autoStart'] = true;
$conf['autoDirection'] = 'next';
$conf['autoHover'] = false;
$conf['autoDelay'] = 0;
// carousel
$conf['minSlides'] = 1;
$conf['maxSlides'] = 1;
$conf['moveSlides'] = 0;
$conf['slideWidth'] = 0;
// touch
$conf['touchEnabled'] = true;
$conf['swipeThreshold'] = 50;
$conf['oneToOneTouch'] = true;
$conf['preventDefaultSwipeX'] = true;
$conf['preventDefaultSwipeY'] = false;
@@ -3,8 +3,64 @@
* Options for the slider plugin
*
* @author Andreas Gohr <gohr@cosmocode.de>
* @author Michael Bohn <mjbohn@gmail.com>
*/
$meta['width'] = array('numeric', '_min' => 100);
// general settings
$meta['mode'] = array('multichoice', _choices => array('horizontal', 'vertical', 'fade'));
$meta['infiniteLoop'] = array('onoff');
$meta['hideControlOnEnd'] = array('onoff');
$meta['speed'] = array('numeric');
$meta['easing'] = array('string');
$meta['slideMargin'] = array('numeric');
$meta['startSlide'] = array('numeric');
$meta['randomStart'] = array('onoff');
$meta['captions'] = array('onoff');
$meta['ticker'] = array('onoff');
$meta['tickerHover'] = array('onoff');
$meta['adaptiveHeight'] = array('onoff');
$meta['adaptiveHeightSpeed'] = array('numeric');
$meta['video'] = array('onoff');
$meta['useCSS'] = array('onoff');
$meta['preloadImages'] = array('multichoice', _choices => array('all', 'visible'));
$meta['responsive'] = array('onoff');
// pager
$meta['pager'] = array('onoff');
$meta['pagerType'] = array('multichoice', _choices => array('full','short'));
$meta['pagerShortSeparator'] = array('string');
// controls
$meta['controls'] = array('onoff');
$meta['nextText'] = array('string');
$meta['prevText'] = array('string');
$meta['autoControls'] = array('onoff');
$meta['startText'] = array('string');
$meta['stopText'] = array('string');
$meta['autoControlsCombine'] = array('onoff');
// auto
$meta['auto'] = array('onoff');
$meta['pause'] = array('numeric');
$meta['autoStart'] = array('onoff');
$meta['autoDirection'] = array('string');
$meta['autoHover'] = array('onoff');
$meta['autoDelay'] = array('numeric');
// carousel
$meta['minSlides'] = array('numeric');
$meta['maxSlides'] = array('numeric');
$meta['moveSlides'] = array('numeric');
$meta['slideWidth'] = array('numeric');
// touch
$meta['touchEnabled'] = array('onoff');
$meta['swipeThreshold'] = array('numeric');
$meta['oneToOneTouch'] = array('onoff');
$meta['preventDefaultSwipeX'] = array('onoff');
$meta['preventDefaultSwipeY'] = array('onoff');
@@ -3,11 +3,68 @@
* english language file for slider plugin
*
* @author Andreas Gohr <gohr@cosmocode.de>
* @author Michael Bohn <mjbohn@gmail.com>
*/
$lang['width'] = 'Width of loaded images. Images will be downloaded in this size and up or downscaled by the browser.';
// general settings
$lang['mode'] = 'Type of transition between slides';
$lang['infiniteLoop'] = 'If true, clicking "Next" while on the last slide will transition to the first slide and vice-versa';
$lang['hideControlOnEnd'] = 'If true, "Prev" and "Next" controls will receive a class disabled when slide is the first or the last
Note: Only used when infiniteLoop: false';
$lang['speed'] = 'Slide transition duration (in ms)';
$lang['easing'] = "The type of 'easing' to use during transitions. If using CSS transitions, include a value for the transition-timing-function property. If not using CSS transitions, you may include plugins/jquery.easing.1.3.js for many options.
See <a href='http://gsgd.co.uk/sandbox/jquery/easing/' target='_blank'>gsgd.co.uk/sandbox/jquery/easing/</a> for more info. options: if using CSS: 'linear', 'ease', 'ease-in', 'ease-out', 'ease-in-out', 'cubic-bezier(n,n,n,n)'. If not using CSS: 'swing', 'linear' ";
$lang['slideMargin'] = 'Margin between each slide';
$lang['startSlide'] = 'Starting slide index (zero-based)';
$lang['randomStart'] = 'Start slider on a random slide';
$lang['captions'] = 'Include image captions. Captions are derived from the image\'s title attribute';
$lang['ticker'] = 'Use slider in ticker mode (similar to a news ticker). Ticker-speed depends on transition duration. Set slider.speed to "slider.speed * number of pictures" ';
$lang['tickerHover'] = 'Ticker will pause when mouse hovers over slider. Note: this functionality does NOT work if using CSS transitions!';
$lang['adaptiveHeight'] = 'Dynamically adjust slider height based on each slide\'s height';
$lang['adaptiveHeightSpeed'] = 'Slide height transition duration (in ms). Note: only used if adaptiveHeight: true';
$lang['video'] = 'If any slides contain video, set this to true. Also, include plugins/jquery.fitvids.js
See http://fitvidsjs.com/ for more info';
$lang['useCSS'] = 'If true, CSS transitions will be used for horizontal and vertical slide animations (this uses native hardware acceleration). If false, jQuery animate() will be used.';
$lang['preloadImages'] = "If 'all', preloads all images before starting the slider. If 'visible', preloads only images in the initially visible slides before starting the slider (tip: use 'visible' if all slides are identical dimensions)";
$lang['responsive'] = 'Enable or disable auto resize of the slider. Useful if you need to use fixed width sliders.';
// pager
$lang['pager'] = 'If true, a pager will be added';
$lang['pagerType'] = 'If \'full\', a pager link will be generated for each slide. If \'short\', a x / y pager will be used (ex. 1 / 5)';
$lang['pagerShortSeparator'] = 'If pagerType: \'short\', pager will use this value as the separating character';
// controls
$lang['controls'] = 'If true, "Next" / "Prev" controls will be added';
$lang['nextText'] = 'Text to be used for the "Next" control';
$lang['prevText'] = 'Text to be used for the "Prev" control';
$lang['autoControls'] = 'If true, "Start" / "Stop" controls will be added';
$lang['startText'] = 'Text to be used for the "Start" control';
$lang['stopText'] = 'Text to be used for the "Stop" control';
$lang['autoControlsCombine'] = 'When slideshow is playing only "Stop" control is displayed and vice-versa';
// auto
$lang['auto'] = 'Slides will automatically transition';
$lang['pause'] = 'The amount of time (in ms) between each auto transition';
$lang['autoStart'] = 'Auto show starts playing on load. If false, slideshow will start when the "Start" control is clicked';
$lang['autoDirection'] = 'The direction of auto show slide transitions';
$lang['autoHover'] = 'Auto show will pause when mouse hovers over slider';
$lang['autoDelay'] = 'Time (in ms) auto show should wait before starting';
// carousel
$lang['minSlides'] = 'The minimum number of slides to be shown. Slides will be sized down if carousel becomes smaller than the original size.';
$lang['maxSlides'] = 'The maximum number of slides to be shown. Slides will be sized up if carousel becomes larger than the original size.';
$lang['moveSlides'] = 'The number of slides to move on transition. This value must be >= minSlides, and <= maxSlides. If zero (default), the number of fully-visible slides will be used.';
$lang['slideWidth'] = 'The width of each slide. This setting is required for all horizontal carousels!';
// touch
$lang['touchEnabled'] = 'If true, slider will allow touch swipe transitions';
$lang['swipeThreshold'] = 'Amount of pixels a touch swipe needs to exceed in order to execute a slide transition. Note: only used if touchEnabled: true';
$lang['oneToOneTouch'] = 'If true, non-fade slides follow the finger as it swipes';
$lang['preventDefaultSwipeX'] = 'If true, touch screen will not move along the x-axis as the finger swipes';
$lang['preventDefaultSwipeY'] = 'If true, touch screen will not move along the y-axis as the finger swipes';
//Setup VIM: ex: et ts=4 :
@@ -2,7 +2,62 @@

jQuery(function(){
jQuery('ul.plugin_slider').bxSlider({
auto: true,
autoHover: true

// general settings
mode : JSINFO['plugin_slider']['mode'],
infiniteLoop : JSINFO['plugin_slider']['infiniteLoop'],
hideControlOnEnd : JSINFO['plugin_slider']['hideControlOnEnd'],
speed : JSINFO['plugin_slider']['speed'],
easing : JSINFO['plugin_slider']['easing'],
slideMargin : JSINFO['plugin_slider']['slideMargin'],
startSlide : JSINFO['plugin_slider']['startSlide'],
randomStart : JSINFO['plugin_slider']['randomStart'],
captions : JSINFO['plugin_slider']['captions'],
ticker : JSINFO['plugin_slider']['ticker'],
tickerHover : JSINFO['plugin_slider']['tickerHover'],
adaptiveHeight : JSINFO['plugin_slider']['adaptiveHeight'],
adaptiveHeightSpeed : JSINFO['plugin_slider']['adaptiveHeightSpeed'],
video : JSINFO['plugin_slider']['video'],
useCSS : JSINFO['plugin_slider']['useCSS'],
preloadImages : JSINFO['plugin_slider']['preloadImages'],
responsive : JSINFO['plugin_slider']['responsive'],

// pager
pager : JSINFO['plugin_slider']['pager'],
pagerType : JSINFO['plugin_slider']['pagerType'],
pagerShortSeparator : JSINFO['plugin_slider']['pagerShortSeparator'],

// controls
controls : JSINFO['plugin_slider']['controls'],
nextText : JSINFO['plugin_slider']['nextText'],
prevText : JSINFO['plugin_slider']['prevText'],
autoControls : JSINFO['plugin_slider']['autoControls'],
startText : JSINFO['plugin_slider']['startText'],
stopText : JSINFO['plugin_slider']['stopText'],
autoControlsCombine : JSINFO['plugin_slider']['autoControlsCombine'],

// auto
auto : JSINFO['plugin_slider']['auto'],
pause : JSINFO['plugin_slider']['pause'],
autoStart : JSINFO['plugin_slider']['autoStart'],
autoDirection : JSINFO['plugin_slider']['autoDirection'],
autoHover : JSINFO['plugin_slider']['autoHover'],
autoDelay : JSINFO['plugin_slider']['autoDelay'],

// carousel
minSlides : JSINFO['plugin_slider']['minSlides'],
maxSlides : JSINFO['plugin_slider']['maxSlides'],
moveSlides : JSINFO['plugin_slider']['moveSlides'],
slideWidth : JSINFO['plugin_slider']['slideWidth'],

// touch
touchEnabled : JSINFO['plugin_slider']['touchEnabled'],
swipeThreshold : JSINFO['plugin_slider']['swipeThreshold'],
oneToOneTouch : JSINFO['plugin_slider']['oneToOneTouch'],
preventDefaultSwipeX : JSINFO['plugin_slider']['preventDefaultSwipeX'],
preventDefaultSwipeY : JSINFO['plugin_slider']['preventDefaultSwipeY']



});
});

0 comments on commit 49fe32b

Please sign in to comment.
You can’t perform that action at this time.