PageSourceSearch

https://www.maxxess.fr/blog/wp-content/themes/soledad/inc/elementor/assets/js/folding.js?ver=8.7.4

js maxxess.fr collected 2026-09-28 13:23:46 UTC 2,869 bytes, 85 lines download raw bytes

1(function ($) {
2    'use strict';
3
4    $(window).on('elementor/frontend/init', function () {
5
6        // Init when any widget renders
7        elementorFrontend.hooks.addAction('frontend/element_ready/widget', function ($scope) {
8            try {
9                initWidgetFoldingForElement($scope);
10            } catch (e) {
11                console.error(e);
12            }
13
14            // Grab the widget's editor model in preview
15            var modelCid = $scope.data('model-cid') || $scope.attr('data-model-cid');
16            if (!modelCid || !elementor.channels || !elementor.channels.editor) {
17                return;
18            }
19
20            var model = elementor.channels.editor.request('editor:model', modelCid);
21            if (!model) return;
22
23            // Watch only for enable_folding control changes
24            model.on('change:enable_folding', function () {
25                console.log('enable_folding changed', $scope);
26                try {
27                    initWidgetFoldingForElement($scope);
28                    console.log('enable_folding changed → re-init folding', $scope);
29                } catch (e) {
30                    console.error(e);
31                }
32            });
33        });
34
35    });
36})(jQuery);
37
38
39
40function initWidgetFoldingForElement($element) {
41    
42    if ( ! $element.hasClass( 'penci-widget-folded-yes' ) ) {
43        return;
44    }
45    
46    var $container = $element.find(".elementor-widget-container");
47    var readMoreText = readLessText = ajax_var_more.more;
48    
49    // Remove existing button if any
50    $element.find(".widget-fold-button-wrapper").remove();
51    
52    // Check if content height exceeds folded height
53    var originalHeight = $container.outerHeight();
54    var foldedHeight = $element.outerHeight();
55    
56    if ( foldedHeight >= originalHeight ) {
57        return; // No need to fold
58    }
59    
60    var buttonHtml = `<div class="widget-fold-button-wrapper">
61                        <button class="widget-fold-button" data-read-more="${readMoreText}" data-read-less="${readLessText}">
62                            ${readMoreText}
63                        </button>
64                      </div>`;
65    
66    $container.append(buttonHtml);
67    
68    // Button click handler
69    $element.find(".widget-fold-button").on("click", function(e) {
70        e.preventDefault();
71        var $button = jQuery(this);
72        var $widget = $button.closest(".elementor-element");
73        
74        if ($widget.hasClass("penci-widget-folded-yes")) {
75            // Expand
76            $widget.removeClass("penci-widget-folded-yes").addClass("widget-expanded");
77            $button.text($button.data("read-less"));
78        } else {
79            // Fold
80            $widget.removeClass("widget-expanded").addClass("penci-widget-folded-yes");
81            $button.text($button.data("read-more"));
82            
83        }
84    });
85}

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.