From 7cf7d282e81f5343f57cbe874adcd21b24415791 Mon Sep 17 00:00:00 2001
From: Marshsall Klickman
Date: Fri, 16 Nov 2012 11:42:22 -0500
Subject: [PATCH 01/66] Add content from wiki pages to readme
---
README.md | 131 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 131 insertions(+)
diff --git a/README.md b/README.md
index d287968..4b1e25c 100644
--- a/README.md
+++ b/README.md
@@ -1,3 +1,134 @@
+## Documentation
+
+### CSS Classes for Created Columns
+
+Columnizer will add CSS classes to the columns it creates. Each column will have a "column" classname. The first column will have "first" and last column will have "last". This lets you target specific columns in your CSS markup more easily.
+
+### Options
+
+
+
+
+
Option Name
+
Purpose
+
+
+
width
+
a rough width your columns, and Columnizer will create as many as will fit in the browser window
+
+
+
height
+
This option can only be used in conjunction with the width option. When both the width and height options are set, columns will continue to be built to those measurements to fill all of the content. This is useful for scrolling columns horizontally. See sample 5 for an example.
+
+
+
columns
+
an alternative to the width option. Sets a static number of columns to build, regardless of widget.
+
+
+
target
+
An optional CSS selector may be used here to determine where the columnized content should be placed. If a target is specified, the columnized node will remain unchanged, and the target node will contain columnized content.
+
+
+
doneFunc
+
This function will be called when columnizing is complete.
+
+
+
ignoreImageLoading
+
+
true by default. If set to false, Columnizer will try to wait until images in the content have loaded before columnizing the data.
+
+
+
float
+
default is “left”. Change to “right” for right to left languages.
+
+
+
lastNeverTallest
+
+
false by default. Set to true to ensure that the last column of the columnized content is not the tallest column.
+
+
+
buildOnce
+
if buildOnce is false, the content will be re-columnized when the window is resized. If buildOnce is false, the content will only be columnized once.
+
+
+
overflow
+
If this option is used, then a static height is set to the columnized content, and any content that does not fit within the height is put into the element specified by $(id). See demo 1 for an example.
+
+
+
height (required): the static height for the columnized content
+
+
+
id (required): The id of the element to put the remainder of the content
+
+
+
doneFunc (optional): a function to be called after the content has been columnized. This is a great place to columnize the remainder content.
+
+
+
manualBreaks
+
Defaults to false. Set to true if you only want to create columns with manual column breaks. If true, then width, height, columns options are ignored.
+
+
+
+
+
+### CSS Classes
+
+
+
+
+
Class Name
+
Purpose
+
+
+
columnbreak
+
Any node that has the CSS class “columnbreak” will act as a column break, as you'd expect in any word processor. The "columnbreak" node will always be the last node in its column. Works well with the optional "columnBreak" option.
+
+
+
dontsplit
+
Any node that has the CSS class “dontsplit” won’t be split into multiple columns. This is handy to make sure that tables, etc, aren’t chopped in half if they land at the bottom of a column.
+
+
+
dontend
+
Any node that has the CSS class “dontend” will never be put at the end of a column.
+
+
+
removeiffirst
+
Any node that has the CSS class “removeiffirst” will be removed from the content if it is the first node in a column.
+
+
+
removeiflast
+
Any node that has the CSS class “removeiflast” will be removed from the content if it is the last node in a column.
+
+
+
+
+### Helpful Hints
+
+1. You can specify a rough width your columns, and Columnizer will create as many as will fit in the browser window. Just use: $(‘selector’).columnize({width: 400 }) syntax
+2. You can specify a specific number of columns, and Columnizer will distribute your content between that many columns. Just use: $(‘selector’).columnize({columns: 2 }) syntax
+3. When using the width and height options to scroll horizontally, make sure that the .column CSS class does not specify any padding or margin or border. See CSS for sample 5 for an example on how to create buffer between columns.
+4. Make sure that you are columnizing visible content. If your content is display:none it may not columnize correctly. Try visibility:hidden and display:block instead.
+5. Columnizer does not auto-class any of your content. See the Suggested Defaults For Your Content section.
+
+
+### Suggested Defaults For Your Content
+
+Columnizer does not add default "dontsplit" or "dontend" classes to your content. If you are finding your content is breaking columns at awkward locations, try the following:
+
+ $yourContent.find('table, thead, tbody, tfoot, colgroup, caption, label, legend, script, style, textarea, button, object, embed, tr, th, td, li, h1, h2, h3, h4, h5, h6, form').addClass('dontsplit');
+ $yourContent.find('h1, h2, h3, h4, h5, h6').addClass('dontend');
+ $yourContent.find('br').addClass('removeiflast').addClass('removeiffirst');
+
+
+## Troubleshooting
+
+### Why isn't my content columnizing?
+
+Make sure that your content "has display". If the content you're columnizing has display:none, then the browser has difficulty estimating the size of some nodes, which makes columnizing impossible. instead of display:none, use visibility:hidden and keep display:block. then in the doneFunc() of columnizer, change the visibility and display to whatever your page or application needs.
+
+
+## Additional Notes
+
### Minimize
To compress into a zip file, run compress.sh
From 3d3ebf34c2e6b605fb0c09ae9cf883b94b165bc9 Mon Sep 17 00:00:00 2001
From: Marshsall Klickman
Date: Fri, 16 Nov 2012 11:47:18 -0500
Subject: [PATCH 02/66] remove link to wiki from body of readme (redundant)
---
README.md | 5 -----
1 file changed, 5 deletions(-)
diff --git a/README.md b/README.md
index 4b1e25c..0001654 100644
--- a/README.md
+++ b/README.md
@@ -132,10 +132,5 @@ Make sure that your content "has display". If the content you're columnizing has
### Minimize
To compress into a zip file, run compress.sh
-
-### Questions?
-Check out the [Wiki](https://github.com/adamwulf/Columnizer-jQuery-Plugin/wiki)
-
-
### Bug report?
Check the issues on the [GitHub page](https://github.com/adamwulf/Columnizer-jQuery-Plugin/issues)
From 101c7fc57b373fda81892101c0b0895bddd2e5c9 Mon Sep 17 00:00:00 2001
From: Adam Wulf
Date: Tue, 11 Dec 2012 15:38:24 -0600
Subject: [PATCH 03/66] fixes #72 when columns break in bad places for
horizontally scrolling columns
---
src/jquery.columnizer.js | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/jquery.columnizer.js b/src/jquery.columnizer.js
index ad75643..d7cb7b6 100644
--- a/src/jquery.columnizer.js
+++ b/src/jquery.columnizer.js
@@ -459,6 +459,9 @@
$inBox.append($("")); //"
}
var $col = $inBox.children().eq(i);
+ if(scrollHorizontally){
+ $col.width(optionWidth + "px");
+ }
columnize($col, $destroyable, $col, targetHeight);
// make sure that the last item in the column isn't a "dontend"
split($col, $destroyable, $col, targetHeight);
From 2b4d7254abd8acb12dcddda20c9db6b81c3abc3e Mon Sep 17 00:00:00 2001
From: Faiz Shukri
Date: Tue, 19 Feb 2013 12:05:49 +0800
Subject: [PATCH 04/66] fix split order list element
---
src/jquery.columnizer.js | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/src/jquery.columnizer.js b/src/jquery.columnizer.js
index d7cb7b6..39007f3 100644
--- a/src/jquery.columnizer.js
+++ b/src/jquery.columnizer.js
@@ -276,6 +276,13 @@
// this node still has non-text nodes to split
// add the split class and then recur
$cloneMe.addClass(prefixTheClassName("split"));
+
+ //if this node was ol element, the child should continue the number ordering
+ var startWith = $clone.get(0).childElementCount + $clone.get(0).start;
+ if($cloneMe.get(0).tagName == 'OL'){
+ $cloneMe.attr('start',startWith+1);
+ }
+
if($cloneMe.children().length){
split($clone, $cloneMe, $parentColumn, targetHeight);
}
From a9012e3d25abd4e6b1c5356629c1edd5d68f3f87 Mon Sep 17 00:00:00 2001
From: Faiz Shukri
Date: Tue, 19 Feb 2013 12:12:43 +0800
Subject: [PATCH 05/66] fix split order list element
---
src/jquery.columnizer.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/jquery.columnizer.js b/src/jquery.columnizer.js
index 39007f3..d762332 100644
--- a/src/jquery.columnizer.js
+++ b/src/jquery.columnizer.js
@@ -278,8 +278,8 @@
$cloneMe.addClass(prefixTheClassName("split"));
//if this node was ol element, the child should continue the number ordering
- var startWith = $clone.get(0).childElementCount + $clone.get(0).start;
if($cloneMe.get(0).tagName == 'OL'){
+ var startWith = $clone.get(0).childElementCount + $clone.get(0).start;
$cloneMe.attr('start',startWith+1);
}
From 21f890b02415d5c8bd8deb0b14e5758dfd6c5bff Mon Sep 17 00:00:00 2001
From: Max Tobias Weber
Date: Thu, 28 Feb 2013 14:12:33 +0100
Subject: [PATCH 06/66] $.browser.msie
$.browser.msie is deprecated since jquery 1.9
In my opinion the msie workaround is a good solution for all
browsers to prevent unnecessary columnizeIt function calls so
I edited it to go this way as default.
---
src/jquery.columnizer.js | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/src/jquery.columnizer.js b/src/jquery.columnizer.js
index d7cb7b6..a4bf32c 100644
--- a/src/jquery.columnizer.js
+++ b/src/jquery.columnizer.js
@@ -95,15 +95,11 @@
if(!options.buildOnce){
$(window).resize(function() {
- if(!options.buildOnce && $.browser.msie){
+ if(!options.buildOnce){
if($inBox.data("timeout")){
clearTimeout($inBox.data("timeout"));
}
$inBox.data("timeout", setTimeout(columnizeIt, 200));
- }else if(!options.buildOnce){
- columnizeIt();
- }else{
- // don't rebuild
}
});
}
From 139db2328e25d3319edc98c6d171194bf1f3456e Mon Sep 17 00:00:00 2001
From: Tom Alterman
Date: Fri, 8 Mar 2013 16:18:55 +0000
Subject: [PATCH 07/66] removed all trailing whitespace and mixture of space
and tabs
---
src/jquery.columnizer.js | 138 +++++++++++++++++++--------------------
1 file changed, 67 insertions(+), 71 deletions(-)
diff --git a/src/jquery.columnizer.js b/src/jquery.columnizer.js
index a4bf32c..60c03af 100644
--- a/src/jquery.columnizer.js
+++ b/src/jquery.columnizer.js
@@ -41,7 +41,7 @@
cssClassPrefix : ""
};
var options = $.extend(defaults, options);
-
+
if(typeof(options.width) == "string"){
options.width = parseInt(options.width);
if(isNaN(options.width)){
@@ -50,7 +50,7 @@
}
return this.each(function() {
- var $inBox = options.target ? $(options.target) : $(this);
+ var $inBox = options.target ? $(options.target) : $(this);
var maxHeight = $(this).height();
var $cache = $(''); // this is where we'll put the real content
var lastWidth = 0;
@@ -61,38 +61,38 @@
cssClassPrefix = options.cssClassPrefix;
}
-
+
var adjustment = 0;
-
+
$cache.append($(this).contents().clone(true));
-
- // images loading after dom load
- // can screw up the column heights,
- // so recolumnize after images load
- if(!options.ignoreImageLoading && !options.target){
- if(!$inBox.data("imageLoaded")){
- $inBox.data("imageLoaded", true);
- if($(this).find("img").length > 0){
- // only bother if there are
- // actually images...
- var func = function($inBox,$cache){ return function(){
- if(!$inBox.data("firstImageLoaded")){
- $inBox.data("firstImageLoaded", "true");
- $inBox.empty().append($cache.children().clone(true));
- $inBox.columnize(options);
- }
- }}($(this), $cache);
- $(this).find("img").one("load", func);
- $(this).find("img").one("abort", func);
- return;
- }
- }
- }
-
+
+ // images loading after dom load
+ // can screw up the column heights,
+ // so recolumnize after images load
+ if(!options.ignoreImageLoading && !options.target){
+ if(!$inBox.data("imageLoaded")){
+ $inBox.data("imageLoaded", true);
+ if($(this).find("img").length > 0){
+ // only bother if there are
+ // actually images...
+ var func = function($inBox,$cache){ return function(){
+ if(!$inBox.data("firstImageLoaded")){
+ $inBox.data("firstImageLoaded", "true");
+ $inBox.empty().append($cache.children().clone(true));
+ $inBox.columnize(options);
+ }
+ }}($(this), $cache);
+ $(this).find("img").one("load", func);
+ $(this).find("img").one("abort", func);
+ return;
+ }
+ }
+ }
+
$inBox.empty();
-
+
columnizeIt();
-
+
if(!options.buildOnce){
$(window).resize(function() {
if(!options.buildOnce){
@@ -103,7 +103,7 @@
}
});
}
-
+
function prefixTheClassName(className, withDot){
var dot = withDot ? "." : "";
if(cssClassPrefix.length){
@@ -111,8 +111,7 @@
}
return dot + className;
}
-
-
+
/**
* this fuction builds as much of a column as it can without
* splitting nodes in half. If the last node in the new column
@@ -134,7 +133,7 @@
// add as many nodes to the column as we can,
// but stop once our height is too tall
while((manualBreaks || $parentColumn.height() < targetHeight) &&
- $pullOutHere[0].childNodes.length){
+ $pullOutHere[0].childNodes.length){
var node = $pullOutHere[0].childNodes[0]
//
// Because we're not cloning, jquery will actually move the element"
@@ -152,14 +151,13 @@
$putInHere.append(node);
}
if($putInHere[0].childNodes.length == 0) return;
-
+
// now we're too tall, so undo the last one
var kids = $putInHere[0].childNodes;
var lastKid = kids[kids.length-1];
$putInHere[0].removeChild(lastKid);
var $item = $(lastKid);
-
- //
+
// now lets try to split that last node
// to fit as much of it as we can into this column
if($item[0].nodeType == 3){
@@ -179,7 +177,7 @@
}
latestTextNode = document.createTextNode(columnText);
$putInHere.append(latestTextNode);
-
+
if(oText.length > counter2 && indexOfSpace != -1){
oText = oText.substring(indexOfSpace);
}else{
@@ -197,16 +195,16 @@
return false; // we ate the whole text node, move on to the next node
}
}
-
+
if($pullOutHere.contents().length){
$pullOutHere.prepend($item);
}else{
$pullOutHere.append($item);
}
-
+
return $item[0].nodeType == 3;
}
-
+
/**
* Split up an element, which is more complex than splitting text. We need to create
* two copies of the element with it's contents divided between each
@@ -227,7 +225,7 @@
//
// make sure we're splitting an element
if($cloneMe.get(0).nodeType != 1) return;
-
+
//
// clone the node with all data and events
var $clone = $cloneMe.clone(true);
@@ -244,7 +242,7 @@
// keep adding until we hit a manual break
$putInHere.append($clone);
$cloneMe.remove();
- }else if($clone.get(0).nodeType == 1 && !$clone.hasClass(prefixTheClassName("dontend"))){
+ }else if($clone.get(0).nodeType == 1 && !$clone.hasClass(prefixTheClassName("dontend"))){
$putInHere.append($clone);
if($clone.is("img") && $parentColumn.height() < targetHeight + 20){
//
@@ -288,21 +286,21 @@
}
}
}
-
-
+
+
function singleColumnizeIt() {
if ($inBox.data("columnized") && $inBox.children().length == 1) {
return;
}
$inBox.data("columnized", true);
$inBox.data("columnizing", true);
-
+
$inBox.empty();
$inBox.append($("")); //"
+ + prefixTheClassName("first") + " "
+ + prefixTheClassName("last") + " "
+ + prefixTheClassName("column") + " "
+ + "' style='width:100%; float: " + options.columnFloat + ";'>")); //"
$col = $inBox.children().eq($inBox.children().length-1);
$destroyable = $cache.clone(true);
if(options.overflow){
@@ -312,7 +310,7 @@
if(!$destroyable.contents().find(":first-child").hasClass(prefixTheClassName("dontend"))){
split($col, $destroyable, $col, targetHeight);
}
-
+
while($col.contents(":last").length && checkDontEndColumn($col.contents(":last").get(0))){
var $lastKid = $col.contents(":last");
$lastKid.remove();
@@ -341,13 +339,13 @@
$col.append($destroyable);
}
$inBox.data("columnizing", false);
-
+
if(options.overflow && options.overflow.doneFunc){
options.overflow.doneFunc();
}
-
+
}
-
+
/**
* returns true if the input dom node
* should not end a column.
@@ -359,10 +357,10 @@
// is not 100% whitespace
if(/^\s+$/.test(dom.nodeValue)){
//
- // ok, it's 100% whitespace,
- // so we should return checkDontEndColumn
- // of the inputs previousSibling
- if(!dom.previousSibling) return false;
+ // ok, it's 100% whitespace,
+ // so we should return checkDontEndColumn
+ // of the inputs previousSibling
+ if(!dom.previousSibling) return false;
return checkDontEndColumn(dom.previousSibling);
}
return false;
@@ -372,15 +370,13 @@
if(dom.childNodes.length == 0) return false;
return checkDontEndColumn(dom.childNodes[dom.childNodes.length-1]);
}
-
-
-
+
function columnizeIt() {
//reset adjustment var
adjustment = 0;
if(lastWidth == $inBox.width()) return;
lastWidth = $inBox.width();
-
+
var numCols = Math.round($inBox.width() / options.width);
var optionWidth = options.width;
var optionHeight = options.height;
@@ -389,7 +385,7 @@
numCols = $cache.find(prefixTheClassName("columnbreak", true)).length + 1;
optionWidth = false;
}
-
+
// if ($inBox.data("columnized") && numCols == $inBox.children().length) {
// return;
// }
@@ -399,14 +395,14 @@
if($inBox.data("columnizing")) return;
$inBox.data("columnized", true);
$inBox.data("columnizing", true);
-
+
$inBox.empty();
$inBox.append($("")); //"
$col = $inBox.children(":last");
$col.append($cache.clone());
maxHeight = $col.height();
$inBox.empty();
-
+
var targetHeight = maxHeight / numCols;
var firstTime = true;
var maxLoops = 3;
@@ -419,7 +415,7 @@
targetHeight = optionHeight;
scrollHorizontally = true;
}
-
+
//
// We loop as we try and workout a good height to use. We know it initially as an average
// but if the last column is higher than the first ones (which can happen, depending on split
@@ -446,7 +442,7 @@
var className = (i == numCols - 1) ? (prefixTheClassName("last") + " " + className) : className;
$inBox.append($("")); //"
}
-
+
// fill all but the last column (unless overflowing)
var i = 0;
while(i < numCols - (options.overflow ? 0 : 1) || scrollHorizontally && $destroyable.contents().length){
@@ -461,14 +457,14 @@
columnize($col, $destroyable, $col, targetHeight);
// make sure that the last item in the column isn't a "dontend"
split($col, $destroyable, $col, targetHeight);
-
+
while($col.contents(":last").length && checkDontEndColumn($col.contents(":last").get(0))){
var $lastKid = $col.contents(":last");
$lastKid.remove();
$destroyable.prepend($lastKid);
}
i++;
-
+
//
// https://github.com/adamwulf/Columnizer-jQuery-Plugin/issues/47
//
@@ -498,7 +494,7 @@
numCols ++;
}
}
-
+
}
if(options.overflow && !scrollHorizontally){
var IE6 = false /*@cc_on || @_jscript_version < 5.7 @*/;
@@ -606,4 +602,4 @@
}
});
};
-})(jQuery);
+})(jQuery);
\ No newline at end of file
From 0f24a3d070f937e28299d728c12f52f7f5b2e757 Mon Sep 17 00:00:00 2001
From: Tom Alterman
Date: Fri, 8 Mar 2013 16:20:47 +0000
Subject: [PATCH 08/66] using === to compare to 0
---
src/jquery.columnizer.js | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/src/jquery.columnizer.js b/src/jquery.columnizer.js
index 60c03af..f19937e 100644
--- a/src/jquery.columnizer.js
+++ b/src/jquery.columnizer.js
@@ -150,7 +150,7 @@
}
$putInHere.append(node);
}
- if($putInHere[0].childNodes.length == 0) return;
+ if($putInHere[0].childNodes.length === 0) return;
// now we're too tall, so undo the last one
var kids = $putInHere[0].childNodes;
@@ -278,7 +278,7 @@
// split class and move on.
$cloneMe.addClass(prefixTheClassName("split"));
}
- if($clone.get(0).childNodes.length == 0){
+ if($clone.get(0).childNodes.length === 0){
// it was split, but nothing is in it :(
$clone.remove();
}
@@ -323,7 +323,7 @@
var kid = $destroyable[0].childNodes[0];
if(kid.attributes){
for(var i=0;i< numCols; i++) {
/* create column */
- var className = (i == 0) ? prefixTheClassName("first") : "";
+ var className = (i === 0) ? prefixTheClassName("first") : "";
className += " " + prefixTheClassName("column");
var className = (i == numCols - 1) ? (prefixTheClassName("last") + " " + className) : className;
$inBox.append($("")); //"
@@ -475,7 +475,7 @@
//
// this results in empty columns being added with the dontsplit item
// perpetually waiting to get put into a column. lets force the issue here
- if($col.contents().length == 0 && $destroyable.contents().length){
+ if($col.contents().length === 0 && $destroyable.contents().length){
//
// ok, we're building zero content columns. this'll happen forever
// since nothing can ever get taken out of destroyable.
@@ -505,7 +505,7 @@
while($destroyable[0].childNodes.length > 0){
var kid = $destroyable[0].childNodes[0];
for(var i=0;i
Date: Fri, 8 Mar 2013 16:22:00 +0000
Subject: [PATCH 09/66] updated another comparison to 0 to ===
---
src/jquery.columnizer.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/jquery.columnizer.js b/src/jquery.columnizer.js
index f19937e..fdfe2c6 100644
--- a/src/jquery.columnizer.js
+++ b/src/jquery.columnizer.js
@@ -578,7 +578,7 @@
$inBox.children().each(function(i){
$col = $inBox.children().eq(i);
$col.width(optionWidth + "px");
- if(i==0){
+ if(i === 0){
$col.addClass(prefixTheClassName("first"));
}else if(i==$inBox.children().length-1){
$col.addClass(prefixTheClassName("last"));
From c2822a6eee1a8779adde7cc19711a140aa3b35ce Mon Sep 17 00:00:00 2001
From: Tom Alterman
Date: Fri, 8 Mar 2013 16:25:51 +0000
Subject: [PATCH 10/66] added missing semicolons
---
src/jquery.columnizer.js | 18 ++++++++++--------
1 file changed, 10 insertions(+), 8 deletions(-)
diff --git a/src/jquery.columnizer.js b/src/jquery.columnizer.js
index fdfe2c6..9619e27 100644
--- a/src/jquery.columnizer.js
+++ b/src/jquery.columnizer.js
@@ -76,12 +76,13 @@
// only bother if there are
// actually images...
var func = function($inBox,$cache){ return function(){
- if(!$inBox.data("firstImageLoaded")){
- $inBox.data("firstImageLoaded", "true");
- $inBox.empty().append($cache.children().clone(true));
- $inBox.columnize(options);
- }
- }}($(this), $cache);
+ if(!$inBox.data("firstImageLoaded")){
+ $inBox.data("firstImageLoaded", "true");
+ $inBox.empty().append($cache.children().clone(true));
+ $inBox.columnize(options);
+ }
+ };
+ }($(this), $cache);
$(this).find("img").one("load", func);
$(this).find("img").one("abort", func);
return;
@@ -134,7 +135,7 @@
// but stop once our height is too tall
while((manualBreaks || $parentColumn.height() < targetHeight) &&
$pullOutHere[0].childNodes.length){
- var node = $pullOutHere[0].childNodes[0]
+ var node = $pullOutHere[0].childNodes[0];
//
// Because we're not cloning, jquery will actually move the element"
// http://welcome.totheinter.net/2009/03/19/the-undocumented-life-of-jquerys-append/
@@ -543,7 +544,8 @@
if(h < min) min = h;
numberOfColumnsThatDontEndInAColumnBreak++;
}
- }}($inBox));
+ };
+ }($inBox));
var avgH = totalH / numberOfColumnsThatDontEndInAColumnBreak;
if(totalH === 0){
From 625b3c664a532ce0935e6c310a39f33f6e0abad4 Mon Sep 17 00:00:00 2001
From: Tom Alterman
Date: Fri, 8 Mar 2013 16:27:53 +0000
Subject: [PATCH 11/66] removed repeated var declarations
---
src/jquery.columnizer.js | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/jquery.columnizer.js b/src/jquery.columnizer.js
index 9619e27..f10998a 100644
--- a/src/jquery.columnizer.js
+++ b/src/jquery.columnizer.js
@@ -40,7 +40,7 @@
// default to empty string for backwards compatibility
cssClassPrefix : ""
};
- var options = $.extend(defaults, options);
+ options = $.extend(defaults, options);
if(typeof(options.width) == "string"){
options.width = parseInt(options.width);
@@ -440,12 +440,12 @@
/* create column */
var className = (i === 0) ? prefixTheClassName("first") : "";
className += " " + prefixTheClassName("column");
- var className = (i == numCols - 1) ? (prefixTheClassName("last") + " " + className) : className;
+ className = (i == numCols - 1) ? (prefixTheClassName("last") + " " + className) : className;
$inBox.append($("")); //"
}
// fill all but the last column (unless overflowing)
- var i = 0;
+ i = 0;
while(i < numCols - (options.overflow ? 0 : 1) || scrollHorizontally && $destroyable.contents().length){
if($inBox.children().length <= i){
// we ran out of columns, make another
From 04b140624ad1382b1d3afe30a44029606f9da89d Mon Sep 17 00:00:00 2001
From: Tom Alterman
Date: Fri, 8 Mar 2013 16:30:24 +0000
Subject: [PATCH 12/66] using !== to compare to null and removed repeated var
declaration
---
src/jquery.columnizer.js | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/jquery.columnizer.js b/src/jquery.columnizer.js
index f10998a..c2ae633 100644
--- a/src/jquery.columnizer.js
+++ b/src/jquery.columnizer.js
@@ -185,7 +185,7 @@
oText = "";
}
}
- if($parentColumn.height() >= targetHeight && latestTextNode != null){
+ if($parentColumn.height() >= targetHeight && latestTextNode !== null){
// too tall :(
$putInHere[0].removeChild(latestTextNode);
oText = latestTextNode.nodeValue + oText;
@@ -505,7 +505,7 @@
var div = document.createElement('DIV');
while($destroyable[0].childNodes.length > 0){
var kid = $destroyable[0].childNodes[0];
- for(var i=0;i
Date: Fri, 8 Mar 2013 16:33:17 +0000
Subject: [PATCH 13/66] define radix for parseint
---
src/jquery.columnizer.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/jquery.columnizer.js b/src/jquery.columnizer.js
index c2ae633..3dfa08a 100644
--- a/src/jquery.columnizer.js
+++ b/src/jquery.columnizer.js
@@ -43,7 +43,7 @@
options = $.extend(defaults, options);
if(typeof(options.width) == "string"){
- options.width = parseInt(options.width);
+ options.width = parseInt(options.width,10);
if(isNaN(options.width)){
options.width = defaults.width;
}
From 5b161b0571f130e3493d0fcb64ac5785bc7fdbec Mon Sep 17 00:00:00 2001
From: Tom Alterman
Date: Fri, 8 Mar 2013 16:38:34 +0000
Subject: [PATCH 14/66] ensure vars are declared out of loop and are not out of
scope
---
src/jquery.columnizer.js | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/jquery.columnizer.js b/src/jquery.columnizer.js
index 3dfa08a..16ac5eb 100644
--- a/src/jquery.columnizer.js
+++ b/src/jquery.columnizer.js
@@ -427,7 +427,7 @@
// options that would cause an infinite loop, then this'll definitely stop it.
for(var loopCount=0;loopCount< 20;loopCount++){
$inBox.empty();
- var $destroyable;
+ var $destroyable, className, $col, $lastKid;
try{
$destroyable = $cache.clone(true);
}catch(e){
@@ -438,7 +438,7 @@
// create the columns
for (var i = 0; i < numCols; i++) {
/* create column */
- var className = (i === 0) ? prefixTheClassName("first") : "";
+ className = (i === 0) ? prefixTheClassName("first") : "";
className += " " + prefixTheClassName("column");
className = (i == numCols - 1) ? (prefixTheClassName("last") + " " + className) : className;
$inBox.append($("")); //"
@@ -451,7 +451,7 @@
// we ran out of columns, make another
$inBox.append($("")); //"
}
- var $col = $inBox.children().eq(i);
+ $col = $inBox.children().eq(i);
if(scrollHorizontally){
$col.width(optionWidth + "px");
}
@@ -460,7 +460,7 @@
split($col, $destroyable, $col, targetHeight);
while($col.contents(":last").length && checkDontEndColumn($col.contents(":last").get(0))){
- var $lastKid = $col.contents(":last");
+ $lastKid = $col.contents(":last");
$lastKid.remove();
$destroyable.prepend($lastKid);
}
From ee1902eb921b1139e2552c0064a595ec9d24781a Mon Sep 17 00:00:00 2001
From: Simon Stienen
Date: Mon, 25 Mar 2013 11:01:33 +0100
Subject: [PATCH 15/66] Fixed too high setting for maxLoops resulting in not
executing any loop at all.
---
src/jquery.columnizer.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/jquery.columnizer.js b/src/jquery.columnizer.js
index a4bf32c..339e31e 100644
--- a/src/jquery.columnizer.js
+++ b/src/jquery.columnizer.js
@@ -428,7 +428,7 @@
// also, lets hard code the max loops to 20. that's /a lot/ of loops for columnizer,
// and should keep run aways in check. if somehow someone has content combined with
// options that would cause an infinite loop, then this'll definitely stop it.
- for(var loopCount=0;loopCount< 20;loopCount++){
+ for(var loopCount=0;loopCount<20;loopCount++){
$inBox.empty();
var $destroyable;
try{
From 3a45a4c933c8d8838789457025f78389a8427a8f Mon Sep 17 00:00:00 2001
From: Simon Stienen
Date: Mon, 25 Mar 2013 11:09:32 +0100
Subject: [PATCH 16/66] Correcting readme for buildOnce: true.
---
README.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/README.md b/README.md
index 0001654..46a5628 100644
--- a/README.md
+++ b/README.md
@@ -48,7 +48,7 @@ Columnizer will add CSS classes to the columns it creates. Each column will have
buildOnce
-
if buildOnce is false, the content will be re-columnized when the window is resized. If buildOnce is false, the content will only be columnized once.
+
if buildOnce is false, the content will be re-columnized when the window is resized. If buildOnce is true, the content will only be columnized once.
overflow
From 6ece753caa60763ed42e283bf661a10c3d0c77f9 Mon Sep 17 00:00:00 2001
From: Vladimir Dmitriev
Date: Sat, 13 Apr 2013 15:39:43 +0400
Subject: [PATCH 17/66] Enable removeiffirst and removeiflast classes for
children in splitted elements
For markup such as 'ul > li' removeif* classes were not available for
children elements. This patch add remove() for removeif* elements
inside "split" class.
---
src/jquery.columnizer.js | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/jquery.columnizer.js b/src/jquery.columnizer.js
index 6099c4a..49156d2 100644
--- a/src/jquery.columnizer.js
+++ b/src/jquery.columnizer.js
@@ -595,6 +595,8 @@
}
$inBox.find(prefixTheClassName("column", true)).find(":first" + prefixTheClassName("removeiffirst", true)).remove();
$inBox.find(prefixTheClassName("column", true)).find(':last' + prefixTheClassName("removeiflast", true)).remove();
+ $inBox.find(prefixTheClassName("split", true)).find(":first" + prefixTheClassName("removeiffirst", true)).remove();
+ $inBox.find(prefixTheClassName("split", true)).find(':last' + prefixTheClassName("removeiflast", true)).remove();
$inBox.data("columnizing", false);
if(options.overflow){
From c928d0eb533969c16a50ab8c4c70ce6aefd5e074 Mon Sep 17 00:00:00 2001
From: Matthew Batchelder
Date: Thu, 30 May 2013 13:01:24 -0400
Subject: [PATCH 18/66] Fixes infinite loop bug with jQuery v1.10
---
src/jquery.columnizer.js | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/jquery.columnizer.js b/src/jquery.columnizer.js
index 6099c4a..75fd202 100644
--- a/src/jquery.columnizer.js
+++ b/src/jquery.columnizer.js
@@ -522,7 +522,9 @@
}else if(!scrollHorizontally){
// the last column in the series
$col = $inBox.children().eq($inBox.children().length-1);
- while($destroyable.contents().length) $col.append($destroyable.contents(":first"));
+ $destroyable.contents().each( function() {
+ $col.append( $(this) );
+ });
var afterH = $col.height();
var diff = afterH - targetHeight;
var totalH = 0;
From f21114e2047b249eba56c765a13bfaf1b37e6122 Mon Sep 17 00:00:00 2001
From: Matthew Batchelder
Date: Fri, 31 May 2013 09:12:47 -0400
Subject: [PATCH 19/66] Prevent an undefined object error when $cloneMe.get(0)
is undefined
This should address issue #116
---
src/jquery.columnizer.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/jquery.columnizer.js b/src/jquery.columnizer.js
index 6099c4a..3267254 100644
--- a/src/jquery.columnizer.js
+++ b/src/jquery.columnizer.js
@@ -225,7 +225,7 @@
var $cloneMe = $pullOutHere.contents(":first");
//
// make sure we're splitting an element
- if($cloneMe.get(0).nodeType != 1) return;
+ if( typeof $cloneMe.get(0) == 'undefined' || $cloneMe.get(0).nodeType != 1 ) return;
//
// clone the node with all data and events
From cd7d30ef479035a32181e4d1048114d4cc1db77c Mon Sep 17 00:00:00 2001
From: Adam Wulf
Date: Tue, 20 Aug 2013 15:09:21 -0500
Subject: [PATCH 20/66] updating included jquery
---
src/jquery.columnizer.js | 1 -
src/jquery.js | 38 ++++++--------------------------------
2 files changed, 6 insertions(+), 33 deletions(-)
diff --git a/src/jquery.columnizer.js b/src/jquery.columnizer.js
index 339e31e..02de656 100644
--- a/src/jquery.columnizer.js
+++ b/src/jquery.columnizer.js
@@ -498,7 +498,6 @@
numCols ++;
}
}
-
}
if(options.overflow && !scrollHorizontally){
var IE6 = false /*@cc_on || @_jscript_version < 5.7 @*/;
diff --git a/src/jquery.js b/src/jquery.js
index 82b98e1..2a40d4c 100644
--- a/src/jquery.js
+++ b/src/jquery.js
@@ -1,32 +1,6 @@
-/*
- * jQuery 1.2.6 - New Wave Javascript
- *
- * Copyright (c) 2008 John Resig (jquery.com)
- * Dual licensed under the MIT (MIT-LICENSE.txt)
- * and GPL (GPL-LICENSE.txt) licenses.
- *
- * $Date: 2008-05-24 14:22:17 -0400 (Sat, 24 May 2008) $
- * $Rev: 5685 $
- */
-(function(){var _jQuery=window.jQuery,_$=window.$;var jQuery=window.jQuery=window.$=function(selector,context){return new jQuery.fn.init(selector,context);};var quickExpr=/^[^<]*(<(.|\s)+>)[^>]*$|^#(\w+)$/,isSimple=/^.[^:#\[\.]*$/,undefined;jQuery.fn=jQuery.prototype={init:function(selector,context){selector=selector||document;if(selector.nodeType){this[0]=selector;this.length=1;return this;}if(typeof selector=="string"){var match=quickExpr.exec(selector);if(match&&(match[1]||!context)){if(match[1])selector=jQuery.clean([match[1]],context);else{var elem=document.getElementById(match[3]);if(elem){if(elem.id!=match[3])return jQuery().find(selector);return jQuery(elem);}selector=[];}}else
-return jQuery(context).find(selector);}else if(jQuery.isFunction(selector))return jQuery(document)[jQuery.fn.ready?"ready":"load"](selector);return this.setArray(jQuery.makeArray(selector));},jquery:"1.2.6",size:function(){return this.length;},length:0,get:function(num){return num==undefined?jQuery.makeArray(this):this[num];},pushStack:function(elems){var ret=jQuery(elems);ret.prevObject=this;return ret;},setArray:function(elems){this.length=0;Array.prototype.push.apply(this,elems);return this;},each:function(callback,args){return jQuery.each(this,callback,args);},index:function(elem){var ret=-1;return jQuery.inArray(elem&&elem.jquery?elem[0]:elem,this);},attr:function(name,value,type){var options=name;if(name.constructor==String)if(value===undefined)return this[0]&&jQuery[type||"attr"](this[0],name);else{options={};options[name]=value;}return this.each(function(i){for(name in options)jQuery.attr(type?this.style:this,name,jQuery.prop(this,options[name],type,i,name));});},css:function(key,value){if((key=='width'||key=='height')&&parseFloat(value)<0)value=undefined;return this.attr(key,value,"curCSS");},text:function(text){if(typeof text!="object"&&text!=null)return this.empty().append((this[0]&&this[0].ownerDocument||document).createTextNode(text));var ret="";jQuery.each(text||this,function(){jQuery.each(this.childNodes,function(){if(this.nodeType!=8)ret+=this.nodeType!=1?this.nodeValue:jQuery.fn.text([this]);});});return ret;},wrapAll:function(html){if(this[0])jQuery(html,this[0].ownerDocument).clone().insertBefore(this[0]).map(function(){var elem=this;while(elem.firstChild)elem=elem.firstChild;return elem;}).append(this);return this;},wrapInner:function(html){return this.each(function(){jQuery(this).contents().wrapAll(html);});},wrap:function(html){return this.each(function(){jQuery(this).wrapAll(html);});},append:function(){return this.domManip(arguments,true,false,function(elem){if(this.nodeType==1)this.appendChild(elem);});},prepend:function(){return this.domManip(arguments,true,true,function(elem){if(this.nodeType==1)this.insertBefore(elem,this.firstChild);});},before:function(){return this.domManip(arguments,false,false,function(elem){this.parentNode.insertBefore(elem,this);});},after:function(){return this.domManip(arguments,false,true,function(elem){this.parentNode.insertBefore(elem,this.nextSibling);});},end:function(){return this.prevObject||jQuery([]);},find:function(selector){var elems=jQuery.map(this,function(elem){return jQuery.find(selector,elem);});return this.pushStack(/[^+>] [^+>]/.test(selector)||selector.indexOf("..")>-1?jQuery.unique(elems):elems);},clone:function(events){var ret=this.map(function(){if(jQuery.browser.msie&&!jQuery.isXMLDoc(this)){var clone=this.cloneNode(true),container=document.createElement("div");container.appendChild(clone);return jQuery.clean([container.innerHTML])[0];}else
-return this.cloneNode(true);});var clone=ret.find("*").andSelf().each(function(){if(this[expando]!=undefined)this[expando]=null;});if(events===true)this.find("*").andSelf().each(function(i){if(this.nodeType==3)return;var events=jQuery.data(this,"events");for(var type in events)for(var handler in events[type])jQuery.event.add(clone[i],type,events[type][handler],events[type][handler].data);});return ret;},filter:function(selector){return this.pushStack(jQuery.isFunction(selector)&&jQuery.grep(this,function(elem,i){return selector.call(elem,i);})||jQuery.multiFilter(selector,this));},not:function(selector){if(selector.constructor==String)if(isSimple.test(selector))return this.pushStack(jQuery.multiFilter(selector,this,true));else
-selector=jQuery.multiFilter(selector,this);var isArrayLike=selector.length&&selector[selector.length-1]!==undefined&&!selector.nodeType;return this.filter(function(){return isArrayLike?jQuery.inArray(this,selector)<0:this!=selector;});},add:function(selector){return this.pushStack(jQuery.unique(jQuery.merge(this.get(),typeof selector=='string'?jQuery(selector):jQuery.makeArray(selector))));},is:function(selector){return!!selector&&jQuery.multiFilter(selector,this).length>0;},hasClass:function(selector){return this.is("."+selector);},val:function(value){if(value==undefined){if(this.length){var elem=this[0];if(jQuery.nodeName(elem,"select")){var index=elem.selectedIndex,values=[],options=elem.options,one=elem.type=="select-one";if(index<0)return null;for(var i=one?index:0,max=one?index+1:options.length;i=0||jQuery.inArray(this.name,value)>=0);else if(jQuery.nodeName(this,"select")){var values=jQuery.makeArray(value);jQuery("option",this).each(function(){this.selected=(jQuery.inArray(this.value,values)>=0||jQuery.inArray(this.text,values)>=0);});if(!values.length)this.selectedIndex=-1;}else
-this.value=value;});},html:function(value){return value==undefined?(this[0]?this[0].innerHTML:null):this.empty().append(value);},replaceWith:function(value){return this.after(value).remove();},eq:function(i){return this.slice(i,i+1);},slice:function(){return this.pushStack(Array.prototype.slice.apply(this,arguments));},map:function(callback){return this.pushStack(jQuery.map(this,function(elem,i){return callback.call(elem,i,elem);}));},andSelf:function(){return this.add(this.prevObject);},data:function(key,value){var parts=key.split(".");parts[1]=parts[1]?"."+parts[1]:"";if(value===undefined){var data=this.triggerHandler("getData"+parts[1]+"!",[parts[0]]);if(data===undefined&&this.length)data=jQuery.data(this[0],key);return data===undefined&&parts[1]?this.data(parts[0]):data;}else
-return this.trigger("setData"+parts[1]+"!",[parts[0],value]).each(function(){jQuery.data(this,key,value);});},removeData:function(key){return this.each(function(){jQuery.removeData(this,key);});},domManip:function(args,table,reverse,callback){var clone=this.length>1,elems;return this.each(function(){if(!elems){elems=jQuery.clean(args,this.ownerDocument);if(reverse)elems.reverse();}var obj=this;if(table&&jQuery.nodeName(this,"table")&&jQuery.nodeName(elems[0],"tr"))obj=this.getElementsByTagName("tbody")[0]||this.appendChild(this.ownerDocument.createElement("tbody"));var scripts=jQuery([]);jQuery.each(elems,function(){var elem=clone?jQuery(this).clone(true)[0]:this;if(jQuery.nodeName(elem,"script"))scripts=scripts.add(elem);else{if(elem.nodeType==1)scripts=scripts.add(jQuery("script",elem).remove());callback.call(obj,elem);}});scripts.each(evalScript);});}};jQuery.fn.init.prototype=jQuery.fn;function evalScript(i,elem){if(elem.src)jQuery.ajax({url:elem.src,async:false,dataType:"script"});else
-jQuery.globalEval(elem.text||elem.textContent||elem.innerHTML||"");if(elem.parentNode)elem.parentNode.removeChild(elem);}function now(){return+new Date;}jQuery.extend=jQuery.fn.extend=function(){var target=arguments[0]||{},i=1,length=arguments.length,deep=false,options;if(target.constructor==Boolean){deep=target;target=arguments[1]||{};i=2;}if(typeof target!="object"&&typeof target!="function")target={};if(length==i){target=this;--i;}for(;i-1;}},swap:function(elem,options,callback){var old={};for(var name in options){old[name]=elem.style[name];elem.style[name]=options[name];}callback.call(elem);for(var name in options)elem.style[name]=old[name];},css:function(elem,name,force){if(name=="width"||name=="height"){var val,props={position:"absolute",visibility:"hidden",display:"block"},which=name=="width"?["Left","Right"]:["Top","Bottom"];function getWH(){val=name=="width"?elem.offsetWidth:elem.offsetHeight;var padding=0,border=0;jQuery.each(which,function(){padding+=parseFloat(jQuery.curCSS(elem,"padding"+this,true))||0;border+=parseFloat(jQuery.curCSS(elem,"border"+this+"Width",true))||0;});val-=Math.round(padding+border);}if(jQuery(elem).is(":visible"))getWH();else
-jQuery.swap(elem,props,getWH);return Math.max(0,val);}return jQuery.curCSS(elem,name,force);},curCSS:function(elem,name,force){var ret,style=elem.style;function color(elem){if(!jQuery.browser.safari)return false;var ret=defaultView.getComputedStyle(elem,null);return!ret||ret.getPropertyValue("color")=="";}if(name=="opacity"&&jQuery.browser.msie){ret=jQuery.attr(style,"opacity");return ret==""?"1":ret;}if(jQuery.browser.opera&&name=="display"){var save=style.outline;style.outline="0 solid black";style.outline=save;}if(name.match(/float/i))name=styleFloat;if(!force&&style&&style[name])ret=style[name];else if(defaultView.getComputedStyle){if(name.match(/float/i))name="float";name=name.replace(/([A-Z])/g,"-$1").toLowerCase();var computedStyle=defaultView.getComputedStyle(elem,null);if(computedStyle&&!color(elem))ret=computedStyle.getPropertyValue(name);else{var swap=[],stack=[],a=elem,i=0;for(;a&&color(a);a=a.parentNode)stack.unshift(a);for(;i]*?)\/>/g,function(all,front,tag){return tag.match(/^(abbr|br|col|img|input|link|meta|param|hr|area|embed)$/i)?all:front+">"+tag+">";});var tags=jQuery.trim(elem).toLowerCase(),div=context.createElement("div");var wrap=!tags.indexOf(""]||!tags.indexOf(""]||tags.match(/^<(thead|tbody|tfoot|colg|cap)/)&&[1,"