PageSourceSearch

https://www.joinonelove.org/wp-content/plugins/sfwd-lms/includes/c…/templates/skins/grid/script.js?ver=5.1.10

js joinonelove.org collected 2026-09-24 08:49:44 UTC 2,335 bytes, 65 lines download raw bytes

1/**
2* Responsive design
3*/
4function learndash_course_grid_init_grid_responsive_design() {
5    const wrappers  = document.querySelectorAll( '.learndash-course-grid[data-skin="grid"]' );
6
7    wrappers.forEach( function( wrapper ) {
8        const items_wrapper = wrapper.querySelector( '.items-wrapper.grid' );
9
10        if ( ! items_wrapper ) {
11            return;
12        }
13
14        const first_item = items_wrapper.firstElementChild;
15
16        if ( ! first_item ) {
17            return;
18        }
19
20        // Set columns
21        const min_width = wrapper.dataset.min_column_width;
22
23        let columns = wrapper.dataset.columns;
24        columns = parseInt( columns );
25        let new_columns = wrapper.dataset.new_columns || columns;
26        new_columns = parseInt( new_columns );
27        
28        const wrapper_width = wrapper.offsetWidth;
29        let upper_columns = new_columns + 1;
30        upper_columns = upper_columns > columns ? columns : upper_columns;
31        const min_item_width = wrapper_width / upper_columns; 
32        
33        new_columns = Math.floor( wrapper_width / min_width );
34        
35        let item_width = first_item.offsetWidth;
36        
37        if ( item_width < min_width ) {
38            new_columns = new_columns > columns ? columns : new_columns;
39            new_columns = new_columns < 1 ? 1 : new_columns;
40            wrapper.dataset.new_columns = new_columns;
41            items_wrapper.style.gridTemplateColumns = 'repeat( ' + new_columns + ', minmax( 0, 1fr ) )';
42        } else if ( min_item_width > min_width ) {
43            new_columns = new_columns > columns ? columns : new_columns;
44            new_columns = new_columns < 1 ? 1 : new_columns;
45            wrapper.dataset.new_columns = new_columns;
46            items_wrapper.style.gridTemplateColumns = 'repeat( ' + new_columns + ', minmax( 0, 1fr ) )';
47        }
48        
49        const items = items_wrapper.querySelectorAll( '.item' );
50        items.forEach( function( item ) {
51            // Display item
52            item.style.visibility = 'visible';
53        } );
54    } );
55}
56
57( function() { 
58    window.addEventListener( 'resize', function() {
59        learndash_course_grid_init_grid_responsive_design();
60    } );
61    
62    window.addEventListener( 'load', function() {
63        learndash_course_grid_init_grid_responsive_design();
64    } );
65} )();

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.