From 1570d7147003d4d074fe27e0725c815c5c08c74e Mon Sep 17 00:00:00 2001 From: fredtempez Date: Thu, 2 Nov 2023 15:07:29 +0100 Subject: [PATCH] slider 6.1 --- module/slider/changes.md | 2 ++ module/slider/enum.json | 2 +- module/slider/slider.php | 17 +++++--------- module/slider/view/index/index.js.php | 32 +++++++++++++++++---------- module/slider/view/index/index.php | 16 +++++--------- 5 files changed, 35 insertions(+), 34 deletions(-) diff --git a/module/slider/changes.md b/module/slider/changes.md index cf5d411e..a5b2c781 100644 --- a/module/slider/changes.md +++ b/module/slider/changes.md @@ -1,3 +1,5 @@ +# Version 6.1 +- Corrige le calcul de la largeur lorsque la largeur de l'écran est de 100% # Version 6.0 - Gestion des permissions intégrée dans le module # Version 5.1 diff --git a/module/slider/enum.json b/module/slider/enum.json index 6ecfd4e3..25e3b6d4 100644 --- a/module/slider/enum.json +++ b/module/slider/enum.json @@ -1 +1 @@ -{"name":"slider","realName":"Carrousel","version":"6.0","update":"0.0","delete":true,"dataDirectory":""} \ No newline at end of file +{"name":"slider","realName":"Carrousel","version":"6.1","update":"0.0","delete":true,"dataDirectory":""} \ No newline at end of file diff --git a/module/slider/slider.php b/module/slider/slider.php index 32ad63bf..f583cc1a 100644 --- a/module/slider/slider.php +++ b/module/slider/slider.php @@ -27,7 +27,7 @@ class slider extends common 'index' => self::GROUP_VISITOR ]; - const VERSION = '6.0'; + const VERSION = '6.1'; const REALNAME = 'Carrousel'; const DELETE = true; const UPDATE = '0.0'; @@ -224,13 +224,13 @@ class slider extends common $fileInfos->getFilename(), template::text('legends[' . $fileInfos->getFilename() . ']', [ 'value' => empty($this->getData(['module', $this->getUrl(0), 'legends', str_replace('.', '', $fileInfos->getFilename())])) - ? '' - : $this->getData(['module', $this->getUrl(0), 'legends', str_replace('.', '', $fileInfos->getFilename())]) + ? '' + : $this->getData(['module', $this->getUrl(0), 'legends', str_replace('.', '', $fileInfos->getFilename())]) ]), template::select('sliderHref[' . $fileInfos->getFilename() . ']', self::$pageList, [ 'selected' => empty($this->getData(['module', $this->getUrl(0), 'uri', str_replace('.', '', $fileInfos->getFilename())])) - ? '' - : $this->getData(['module', $this->getUrl(0), 'uri', str_replace('.', '', $fileInfos->getFilename())]) + ? '' + : $this->getData(['module', $this->getUrl(0), 'uri', str_replace('.', '', $fileInfos->getFilename())]) ]), '' ]; @@ -313,11 +313,6 @@ class slider extends common // Soumission du formulaire if ($this->isPost()) { - // Adapte la largeur à celle de l'écran : - $maxWidth = $this->getInput('sliderThememaxWidth', helper::FILTER_INT) === 0 - ? intval(trim($this->getData(['theme', 'site', 'width']), 'px')) - 40 - : $this->getInput('sliderThememaxWidth', helper::FILTER_INT); - // Equilibrer les durées $speed = $this->getInput('sliderThemespeed', helper::FILTER_INT); $timeout = $this->getInput('sliderThemeDiapoTime', helper::FILTER_INT); @@ -334,7 +329,7 @@ class slider extends common 'theme' => [ 'pager' => $this->getInput('sliderThemePager', helper::FILTER_BOOLEAN), 'auto' => $this->getInput('sliderThemeAuto', helper::FILTER_BOOLEAN), - 'maxWidth' => $maxWidth, + 'maxWidth' => $this->getInput('sliderThememaxWidth', helper::FILTER_INT), 'speed' => $speed, 'timeout' => $timeout, 'namespace' => $this->getInput('sliderThemeNameSpace', helper::FILTER_STRING_SHORT), diff --git a/module/slider/view/index/index.js.php b/module/slider/view/index/index.js.php index b255edfc..a4b92c90 100644 --- a/module/slider/view/index/index.js.php +++ b/module/slider/view/index/index.js.php @@ -24,7 +24,7 @@ pauseControls: true, // Boolean: Pause when hovering controls, true or false prevText: "Previous", // String: Text for the "previous" button nextText: "Next", // String: Text for the "next" button - maxwidth: "", // Integer: Max-width of the slideshow, in pixels + width: "", // Integer: Max-width of the slideshow, in pixels navContainer: "", // Selector: Where controls should be appended to, default is after the 'ul' manualControls: "", // Selector: Declare custom pager navigation namespace: "rslides", // String: Change the default namespace used @@ -33,19 +33,31 @@ */ -$(document).ready(function() { +$(document).ready(function () { - var maxWidth = "getData(['module', $this->getUrl(0),'theme', 'maxWidth']); ?>"; + var maxwidth = "getData(['module', $this->getUrl(0),'theme', 'maxWidth']); ?>"; + var screenwidth = "getData(['theme', 'site', 'width']), 'px')); ?>"; var sort = "getData(['module', $this->getUrl(0),'theme', 'sort']); ?>"; // Réduction de la taille maximale selon la largeur de la section - var screenSize = $("section").width() - 40; - maxWidth = maxWidth < screenSize ? maxWidth : screenSize; - $("#wrapper").css('width', maxWidth); - $(function() { + + // Limiter à la largeur de l'écran + if ( + screenwidth !== '100%' && + maxwidth > screenwidth + ) { + mawwidth = screenwidth - 40; + } + // Largeur 100% + maxwidth = $("#site").width(); + + + console.log(maxwidth); + $("#wrapper").css('width', "100%"); + $(function () { $("#sliders").responsiveSlides({ pager: "getData(['module', $this->getUrl(0), 'theme', 'pager']); ?>", auto: "getData(['module', $this->getUrl(0), 'theme', 'auto']); ?>", - maxwidth: maxWidth, + maxwidth: maxwidth, speed: "getData(['module', $this->getUrl(0), 'theme', 'speed']); ?>", timeout: "getData(['module', $this->getUrl(0), 'theme', 'timeout']); ?>", namespace: "getData(['module', $this->getUrl(0), 'theme', 'namespace']); ?>", @@ -54,8 +66,4 @@ $(document).ready(function() { }); }); - - - - }); \ No newline at end of file diff --git a/module/slider/view/index/index.php b/module/slider/view/index/index.php index a56014a1..a32a3250 100644 --- a/module/slider/view/index/index.php +++ b/module/slider/view/index/index.php @@ -6,21 +6,17 @@ $options): ?> - -
  • - <?php echo $options['legend']; ?> -
  • - + +
  • + <?php echo $options['legend']; ?> +
  • +
    - - -
    -
    - \ No newline at end of file + \ No newline at end of file