PageSourceSearch

https://www.rueckersdorf.de/fileadmin/templates/js/jquery.easyListSplitter.js

js rueckersdorf.de collected 2026-10-02 20:37:14 UTC 4,138 bytes, 102 lines download raw bytes

1/*
2 * 	easyListSplitter 1.0.2 - jQuery Plugin
3 *	written by Andrea Cima Serniotti	
4 *	http://www.madeincima.eu
5 *
6 *	Copyright (c) 2010 Andrea Cima Serniotti (http://www.madeincima.eu)
7 *	Dual licensed under the MIT (MIT-LICENSE.txt)
8 *	and GPL (GPL-LICENSE.txt) licenses.
9 *
10 *	Built for jQuery library
11 *	http://jquery.com
12 *
13 */
14
15/*
16	To activate the plugin add the following code to your own js file:
17	
18	$('.your-list-class-name').easyListSplitter({ 
19			colNumber: 3,
20			direction: 'horizontal'
21	});
22	
23 */
24
25var j = 1;
26
27(function (jQuery) {
28    jQuery.fn.easyListSplitter = function (options) {
29
30        var defaults = {
31            colNumber: 3, // Insert here the number of columns you want. Consider that the plugin will create the number of cols requested only if there are enough items in the list.
32            direction: 'vertical'
33        };
34
35        this.each(function () {
36
37            var obj = jQuery(this);
38            var settings = jQuery.extend(defaults, options);
39            var totalListElements = jQuery(this).children('li').size();
40            var baseColItems = Math.ceil(totalListElements / settings.colNumber);
41            var listClass = jQuery(this).attr('class');
42
43            // -------- Create List Elements given colNumber ------------------------------------------------------------------------------
44
45            for (i = 1; i <= settings.colNumber; i++) {
46                if (i == 1) {
47                    jQuery(this).addClass('listCol1').wrap('<div class="menu-ul listContainer' + j + '"></div>');
48                } else if (jQuery(this).is('ul')) { // Check whether the list is ordered or unordered
49                    jQuery(this).parents('.listContainer' + j).append('<ul class="listCol' + i + '"></ul>');
50                } else {
51                    jQuery(this).parents('.listContainer' + j).append('<ol class="listCol' + i + '"></ol>');
52                }
53                jQuery('.listContainer' + j + ' > ul,.listContainer' + j + ' > ol').addClass(listClass);
54            }
55
56            var listItem = 0;
57            var k = 1;
58            var l = 0;
59
60            if (settings.direction == 'vertical') { // -------- Append List Elements to the respective listCol  - Vertical -------------------------------
61
62                jQuery(this).children('li').each(function () {
63                    listItem = listItem + 1;
64                    if (listItem > baseColItems * (settings.colNumber - 1)) {
65                        jQuery(this).parents('.listContainer' + j).find('.listCol' + settings.colNumber).append(this);
66                    } else {
67                        if (listItem <= (baseColItems * k)) {
68                            jQuery(this).parents('.listContainer' + j).find('.listCol' + k).append(this);
69                        } else {
70                            jQuery(this).parents('.listContainer' + j).find('.listCol' + (k + 1)).append(this);
71                            k = k + 1;
72                        }
73                    }
74                });
75
76                jQuery('.listContainer' + j).find('ol,ul').each(function () {
77                    if (jQuery(this).children().size() == 0) {
78                        jQuery(this).remove();
79                    }
80                });
81
82            } else { // -------- Append List Elements to the respective listCol  - Horizontal ----------------------------------------------------------
83
84                jQuery(this).children('li').each(function () {
85                    l = l + 1;
86
87                    if (l <= settings.colNumber) {
88                        jQuery(this).parents('.listContainer' + j).find('.listCol' + l).append(this);
89
90                    } else {
91                        l = 1;
92                        jQuery(this).parents('.listContainer' + j).find('.listCol' + l).append(this);
93                    }
94                });
95            }
96
97            jQuery('.listContainer' + j).find('ol:last,ul:last').addClass('last'); // Set class last on the last UL or OL	
98            j = j + 1;
99
100        });
101    };
102})(jQuery);

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.