Skip to content

Commit

Permalink
v 3.17.0
Browse files Browse the repository at this point in the history
Assets : load Swiper JS.
  • Loading branch information
Darklg committed Jul 25, 2024
1 parent 5071fce commit 39097c5
Show file tree
Hide file tree
Showing 7 changed files with 100 additions and 3 deletions.
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,14 +99,18 @@ add_filter('wputheme_display_searchform','__return_false');

#### Scripts

* **wputh_common_libraries__slickslider** : Load Slick Slider.
* **wputh_common_libraries__simplebar** : Load SimpleBar.
* **wputh_common_libraries__slickslider** : Load Slick Slider.
* **wputh_common_libraries__juxtapose** : Load Juxtapose.
* **wputh_common_libraries__clipboard** : Load Clipboard.js.
* **wputh_common_libraries__photoswipe** : Load PhotoSwipe.
* **wputh_common_libraries__swiper** : Load swiper.

## Thanks

* To @Grsmto and contributors for SimpleBar https://github.com/Grsmto/simplebar/ ( MIT )
* To @kenwheeler and contributors for Slick Slicker : https://github.com/kenwheeler/slick/ ( MIT )
* To @NUKnightLab and contributors for Juxtapose : https://github.com/NUKnightLab/juxtapose/ ( Mozilla Public License Version 2.0 )
* To @zenorocha and contributors for Clipboard.js : https://github.com/zenorocha/clipboard.js/ ( MIT )
* To @dimsemenov and contributors for PhotoSwipe : https://github.com/dimsemenov/PhotoSwipe/ ( MIT )
* To @nolimits4web and contributors for SwiperJS : https://github.com/nolimits4web/swiper/ ( MIT )
6 changes: 6 additions & 0 deletions inc/assets/scripts.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@ function wputh_common_libraries() {
wp_enqueue_script('wputh-slickslider-init-js', get_theme_file_uri('/js/libs/slick-slider-init.js'), array('jquery', 'wputh-slickslider-js'), $slick_version, true);
wp_enqueue_style('wputh-slickslider-css', get_theme_file_uri('/js/libs/slick-slider/slick/slick.min.css'), array(), $slick_version);
}
if(apply_filters('wputh_common_libraries__swiper', false)){
$swiper_version = '11.1.7';
wp_enqueue_script('wputh-swiper-js', get_theme_file_uri('/js/libs/swiper-js/swiper-bundle.min.js'), array(), $swiper_version, true);
wp_enqueue_script('wputh-swiper-init-js', get_theme_file_uri('/js/libs/swiper-init.js'), array('wputh-swiper-js'), $swiper_version, true);
wp_enqueue_style('wputh-swiper-css', get_theme_file_uri('/js/libs/swiper-js/swiper-bundle.min.css'), array(), $swiper_version);
}
if (apply_filters('wputh_common_libraries__simplebar', false)) {
wp_enqueue_script('wputh-simplebar-js', get_theme_file_uri('/js/libs/simplebar/simplebar.min.js'), array(), '5.3.6', true);
wp_enqueue_style('wputh-simplebar-css', get_theme_file_uri('/js/libs/simplebar/simplebar.css'), array(), '5.3.6');
Expand Down
60 changes: 60 additions & 0 deletions js/libs/swiper-init.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
document.addEventListener("DOMContentLoaded", function() {
'use strict';
var $swipes = document.querySelectorAll('.wputheme-swiper');
Array.prototype.forEach.call($swipes, function($swipe) {
wputheme_swiper_init($swipe, {
navigation: {
nextEl: '.swiper-button-next',
prevEl: '.swiper-button-prev',
},
pagination: {
el: '.swiper-pagination'
},
scrollbar: {
el: '.swiper-scrollbar',
},
keyboard: {
enabled: true,
},
watchSlidesProgress: true,
loop: true
});
});
});

function wputheme_swiper_init($element, _settings) {
'use strict';
/* Build wrapper */
var $swiper = document.createElement('div');
$swiper.classList.add('swiper', 'wputheme-swiper-wrapper');
$element.parentNode.insertBefore($swiper, $element.nextSibling);
$swiper.appendChild($element);

/* Add element class */
$element.classList.add('swiper-wrapper');

/* Add slides classes */
Array.prototype.forEach.call($element.children, function($slide) {
$slide.classList.add('swiper-slide');
});

/* Add utilities */
var _utilsHTML = '';
if (_settings.pagination) {
_utilsHTML += '<div class="swiper-pagination"></div>';
}
if (_settings.navigation) {
_settings.pagination.clickable = true;
_utilsHTML += '<div class="swiper-button-prev"></div>';
_utilsHTML += '<div class="swiper-button-next"></div>';
}
if (_settings.scrollbar) {
_utilsHTML += '<div class="swiper-scrollbar"></div>';
}
var $utils = document.createElement('div');
$utils.innerHTML = _utilsHTML;
$swiper.appendChild($utils);

/* Init swiper */
new Swiper($swiper, _settings);
}
13 changes: 13 additions & 0 deletions js/libs/swiper-js/swiper-bundle.min.css

Large diffs are not rendered by default.

14 changes: 14 additions & 0 deletions js/libs/swiper-js/swiper-bundle.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "wputheme",
"version": "3.16.0",
"version": "3.17.0",
"description": "WPUTheme",
"devDependencies": {
"gulp": "^4.0.2",
Expand Down
2 changes: 1 addition & 1 deletion style.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Theme Name: WP Utilities Base Theme
Theme URI: https://github.com/WordPressUtilities/WPUTheme
Update URI: https://github.com/WordPressUtilities/WPUTheme
Description: A Framework WordPress Theme
Version: 3.16.0
Version: 3.17.0
Author: Darklg
Author URI: https://darklg.me/
License: GPLv2 or later
Expand Down

0 comments on commit 39097c5

Please sign in to comment.