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: 2, // 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 { 47 if(i==1){ 48 jQuery(this).addClass('listCol1').wrap('<div class="listContainer'+j+'"></div>'); 49 } else if(jQuery(this).is('ul')){ // Check whether the list is ordered or unordered 50 jQuery(this).parents('.listContainer'+j).append('<ul class="listCol'+i+'"></ul>'); 51 } else{ 52 jQuery(this).parents('.listContainer'+j).append('<ol class="listCol'+i+'"></ol>'); 53 } 54 jQuery('.listContainer'+j+' > ul,.listContainer'+j+' > ol').addClass(listClass); 55 } 56 57 var listItem = 0; 58 var k = 1; 59 var l = 0; 60 61 if(settings.direction == 'vertical'){ // -------- Append List Elements to the respective listCol - Vertical ------------------------------- 62 63 jQuery(this).children('li').each(function(){ 64 listItem = listItem+1; 65 if (listItem > baseColItems*(settings.colNumber-1) ){ 66 jQuery(this).parents('.listContainer'+j).find('.listCol'+settings.colNumber).append(this); 67 } 68 else { 69 if(listItem<=(baseColItems*k)){ 70 jQuery(this).parents('.listContainer'+j).find('.listCol'+k).append(this); 71 } 72 else{ 73 jQuery(this).parents('.listContainer'+j).find('.listCol'+(k+1)).append(this); 74 k = k+1; 75 } 76 } 77 }); 78 79 jQuery('.listContainer'+j).find('ol,ul').each(function(){ 80 if(jQuery(this).children().size() == 0) { 81 jQuery(this).remove(); 82 } 83 }); 84 85 } else{ // -------- Append List Elements to the respective listCol - Horizontal ---------------------------------------------------------- 86 87 jQuery(this).children('li').each(function(){ 88 l = l+1; 89 90 if(l <= settings.colNumber){ 91 jQuery(this).parents('.listContainer'+j).find('.listCol'+l).append(this); 92 93 } else { 94 l = 1; 95 jQuery(this).parents('.listContainer'+j).find('.listCol'+l).append(this); 96 } 97 }); 98 } 99 100 jQuery('.listContainer'+j).find('ol:last,ul:last').addClass('last'); // Set class last on the last UL or OL 101 j = j+1; 102 103 }); 104 }; 105})(jQuery); 106 107 108 109//footerãªã¹ã 110jQuery(function($) { 111 $('.easyListSplitter2').easyListSplitter({ 112 colNumber: 2 113 }); 114 $('.easyListSplitter2H').easyListSplitter({ 115 colNumber: 2, 116 direction: 'horizontal' 117 }); 118 $('.easyListSplitter').easyListSplitter({ 119 colNumber: 3 120 }); 121});
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.