Version Description
No known upgrade issues.
Download this release
Release Info
Developer | mpwalsh8 |
Plugin | Google Forms |
Version | 0.55 |
Comparing to | |
See all releases |
Code changes from version 0.54 to 0.55
- index.php +3 -3
- js/jquery.columnizer.js +96 -97
- readme.txt +4 -1
index.php
CHANGED
@@ -4,8 +4,8 @@
|
|
4 |
* Plugin Name: WordPress Google Form
|
5 |
* Plugin URI: http://michaelwalsh.org/wordpress/wordpress-plugins/wpgform/
|
6 |
* Description: Add Google Forms to a WordPress web site. Display a Google Form directly into your posts, pages or sidebar. Style the Google Form to match your existing theme and display a custom confirmation page after form submission.
|
7 |
-
* Version: 0.
|
8 |
-
* Build: 0.
|
9 |
* Last Modified: $WCDATE$
|
10 |
* Author: Mike Walsh
|
11 |
* Author URI: http://www.michaelwalsh.org
|
@@ -25,7 +25,7 @@
|
|
25 |
*
|
26 |
*/
|
27 |
|
28 |
-
define('WPGFORM_VERSION', '0.
|
29 |
|
30 |
require_once('wpgform-core.php') ;
|
31 |
require_once('wpgform-post-type.php') ;
|
4 |
* Plugin Name: WordPress Google Form
|
5 |
* Plugin URI: http://michaelwalsh.org/wordpress/wordpress-plugins/wpgform/
|
6 |
* Description: Add Google Forms to a WordPress web site. Display a Google Form directly into your posts, pages or sidebar. Style the Google Form to match your existing theme and display a custom confirmation page after form submission.
|
7 |
+
* Version: 0.55
|
8 |
+
* Build: 0.55.$WCREV$
|
9 |
* Last Modified: $WCDATE$
|
10 |
* Author: Mike Walsh
|
11 |
* Author URI: http://www.michaelwalsh.org
|
25 |
*
|
26 |
*/
|
27 |
|
28 |
+
define('WPGFORM_VERSION', '0.55') ;
|
29 |
|
30 |
require_once('wpgform-core.php') ;
|
31 |
require_once('wpgform-post-type.php') ;
|
js/jquery.columnizer.js
CHANGED
@@ -40,17 +40,17 @@
|
|
40 |
// default to empty string for backwards compatibility
|
41 |
cssClassPrefix : ""
|
42 |
};
|
43 |
-
|
44 |
-
|
45 |
if(typeof(options.width) == "string"){
|
46 |
-
options.width = parseInt(options.width);
|
47 |
if(isNaN(options.width)){
|
48 |
options.width = defaults.width;
|
49 |
}
|
50 |
}
|
51 |
|
52 |
return this.each(function() {
|
53 |
-
|
54 |
var maxHeight = $(this).height();
|
55 |
var $cache = $('<div></div>'); // this is where we'll put the real content
|
56 |
var lastWidth = 0;
|
@@ -61,53 +61,50 @@
|
|
61 |
cssClassPrefix = options.cssClassPrefix;
|
62 |
}
|
63 |
|
64 |
-
|
65 |
var adjustment = 0;
|
66 |
-
|
67 |
$cache.append($(this).contents().clone(true));
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
|
|
92 |
$inBox.empty();
|
93 |
-
|
94 |
columnizeIt();
|
95 |
-
|
96 |
if(!options.buildOnce){
|
97 |
$(window).resize(function() {
|
98 |
-
if(!options.buildOnce
|
99 |
if($inBox.data("timeout")){
|
100 |
clearTimeout($inBox.data("timeout"));
|
101 |
}
|
102 |
$inBox.data("timeout", setTimeout(columnizeIt, 200));
|
103 |
-
}else if(!options.buildOnce){
|
104 |
-
columnizeIt();
|
105 |
-
}else{
|
106 |
-
// don't rebuild
|
107 |
}
|
108 |
});
|
109 |
}
|
110 |
-
|
111 |
function prefixTheClassName(className, withDot){
|
112 |
var dot = withDot ? "." : "";
|
113 |
if(cssClassPrefix.length){
|
@@ -115,8 +112,7 @@
|
|
115 |
}
|
116 |
return dot + className;
|
117 |
}
|
118 |
-
|
119 |
-
|
120 |
/**
|
121 |
* this fuction builds as much of a column as it can without
|
122 |
* splitting nodes in half. If the last node in the new column
|
@@ -138,8 +134,8 @@
|
|
138 |
// add as many nodes to the column as we can,
|
139 |
// but stop once our height is too tall
|
140 |
while((manualBreaks || $parentColumn.height() < targetHeight) &&
|
141 |
-
|
142 |
-
var node = $pullOutHere[0].childNodes[0]
|
143 |
//
|
144 |
// Because we're not cloning, jquery will actually move the element"
|
145 |
// http://welcome.totheinter.net/2009/03/19/the-undocumented-life-of-jquerys-append/
|
@@ -155,15 +151,14 @@
|
|
155 |
}
|
156 |
$putInHere.append(node);
|
157 |
}
|
158 |
-
if($putInHere[0].childNodes.length
|
159 |
-
|
160 |
// now we're too tall, so undo the last one
|
161 |
var kids = $putInHere[0].childNodes;
|
162 |
var lastKid = kids[kids.length-1];
|
163 |
$putInHere[0].removeChild(lastKid);
|
164 |
var $item = $(lastKid);
|
165 |
-
|
166 |
-
//
|
167 |
// now lets try to split that last node
|
168 |
// to fit as much of it as we can into this column
|
169 |
if($item[0].nodeType == 3){
|
@@ -183,14 +178,14 @@
|
|
183 |
}
|
184 |
latestTextNode = document.createTextNode(columnText);
|
185 |
$putInHere.append(latestTextNode);
|
186 |
-
|
187 |
if(oText.length > counter2 && indexOfSpace != -1){
|
188 |
oText = oText.substring(indexOfSpace);
|
189 |
}else{
|
190 |
oText = "";
|
191 |
}
|
192 |
}
|
193 |
-
if($parentColumn.height() >= targetHeight && latestTextNode
|
194 |
// too tall :(
|
195 |
$putInHere[0].removeChild(latestTextNode);
|
196 |
oText = latestTextNode.nodeValue + oText;
|
@@ -201,16 +196,16 @@
|
|
201 |
return false; // we ate the whole text node, move on to the next node
|
202 |
}
|
203 |
}
|
204 |
-
|
205 |
if($pullOutHere.contents().length){
|
206 |
$pullOutHere.prepend($item);
|
207 |
}else{
|
208 |
$pullOutHere.append($item);
|
209 |
}
|
210 |
-
|
211 |
return $item[0].nodeType == 3;
|
212 |
}
|
213 |
-
|
214 |
/**
|
215 |
* Split up an element, which is more complex than splitting text. We need to create
|
216 |
* two copies of the element with it's contents divided between each
|
@@ -231,7 +226,7 @@
|
|
231 |
//
|
232 |
// make sure we're splitting an element
|
233 |
if($cloneMe.get(0).nodeType != 1) return;
|
234 |
-
|
235 |
//
|
236 |
// clone the node with all data and events
|
237 |
var $clone = $cloneMe.clone(true);
|
@@ -248,7 +243,7 @@
|
|
248 |
// keep adding until we hit a manual break
|
249 |
$putInHere.append($clone);
|
250 |
$cloneMe.remove();
|
251 |
-
}else if($clone.get(0).nodeType == 1 && !$clone.hasClass(prefixTheClassName("dontend"))){
|
252 |
$putInHere.append($clone);
|
253 |
if($clone.is("img") && $parentColumn.height() < targetHeight + 20){
|
254 |
//
|
@@ -284,7 +279,7 @@
|
|
284 |
// split class and move on.
|
285 |
$cloneMe.addClass(prefixTheClassName("split"));
|
286 |
}
|
287 |
-
if($clone.get(0).childNodes.length
|
288 |
// it was split, but nothing is in it :(
|
289 |
$clone.remove();
|
290 |
}
|
@@ -292,21 +287,21 @@
|
|
292 |
}
|
293 |
}
|
294 |
}
|
295 |
-
|
296 |
-
|
297 |
function singleColumnizeIt() {
|
298 |
if ($inBox.data("columnized") && $inBox.children().length == 1) {
|
299 |
return;
|
300 |
}
|
301 |
$inBox.data("columnized", true);
|
302 |
$inBox.data("columnizing", true);
|
303 |
-
|
304 |
$inBox.empty();
|
305 |
$inBox.append($("<div class='"
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
$col = $inBox.children().eq($inBox.children().length-1);
|
311 |
$destroyable = $cache.clone(true);
|
312 |
if(options.overflow){
|
@@ -316,7 +311,7 @@
|
|
316 |
if(!$destroyable.contents().find(":first-child").hasClass(prefixTheClassName("dontend"))){
|
317 |
split($col, $destroyable, $col, targetHeight);
|
318 |
}
|
319 |
-
|
320 |
while($col.contents(":last").length && checkDontEndColumn($col.contents(":last").get(0))){
|
321 |
var $lastKid = $col.contents(":last");
|
322 |
$lastKid.remove();
|
@@ -329,7 +324,7 @@
|
|
329 |
var kid = $destroyable[0].childNodes[0];
|
330 |
if(kid.attributes){
|
331 |
for(var i=0;i<kid.attributes.length;i++){
|
332 |
-
if(kid.attributes[i].nodeName.indexOf("jQuery")
|
333 |
kid.removeAttribute(kid.attributes[i].nodeName);
|
334 |
}
|
335 |
}
|
@@ -345,13 +340,13 @@
|
|
345 |
$col.append($destroyable);
|
346 |
}
|
347 |
$inBox.data("columnizing", false);
|
348 |
-
|
349 |
if(options.overflow && options.overflow.doneFunc){
|
350 |
options.overflow.doneFunc();
|
351 |
}
|
352 |
-
|
353 |
}
|
354 |
-
|
355 |
/**
|
356 |
* returns true if the input dom node
|
357 |
* should not end a column.
|
@@ -363,28 +358,26 @@
|
|
363 |
// is not 100% whitespace
|
364 |
if(/^\s+$/.test(dom.nodeValue)){
|
365 |
//
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
-
|
370 |
return checkDontEndColumn(dom.previousSibling);
|
371 |
}
|
372 |
return false;
|
373 |
}
|
374 |
if(dom.nodeType != 1) return false;
|
375 |
if($(dom).hasClass(prefixTheClassName("dontend"))) return true;
|
376 |
-
if(dom.childNodes.length
|
377 |
return checkDontEndColumn(dom.childNodes[dom.childNodes.length-1]);
|
378 |
}
|
379 |
-
|
380 |
-
|
381 |
-
|
382 |
function columnizeIt() {
|
383 |
//reset adjustment var
|
384 |
adjustment = 0;
|
385 |
if(lastWidth == $inBox.width()) return;
|
386 |
lastWidth = $inBox.width();
|
387 |
-
|
388 |
var numCols = Math.round($inBox.width() / options.width);
|
389 |
var optionWidth = options.width;
|
390 |
var optionHeight = options.height;
|
@@ -393,7 +386,7 @@
|
|
393 |
numCols = $cache.find(prefixTheClassName("columnbreak", true)).length + 1;
|
394 |
optionWidth = false;
|
395 |
}
|
396 |
-
|
397 |
// if ($inBox.data("columnized") && numCols == $inBox.children().length) {
|
398 |
// return;
|
399 |
// }
|
@@ -403,14 +396,14 @@
|
|
403 |
if($inBox.data("columnizing")) return;
|
404 |
$inBox.data("columnized", true);
|
405 |
$inBox.data("columnizing", true);
|
406 |
-
|
407 |
$inBox.empty();
|
408 |
$inBox.append($("<div style='width:" + (Math.floor(100 / numCols))+ "%; float: " + options.columnFloat + ";'></div>")); //"
|
409 |
$col = $inBox.children(":last");
|
410 |
$col.append($cache.clone());
|
411 |
maxHeight = $col.height();
|
412 |
$inBox.empty();
|
413 |
-
|
414 |
var targetHeight = maxHeight / numCols;
|
415 |
var firstTime = true;
|
416 |
var maxLoops = 3;
|
@@ -423,7 +416,7 @@
|
|
423 |
targetHeight = optionHeight;
|
424 |
scrollHorizontally = true;
|
425 |
}
|
426 |
-
|
427 |
//
|
428 |
// We loop as we try and workout a good height to use. We know it initially as an average
|
429 |
// but if the last column is higher than the first ones (which can happen, depending on split
|
@@ -432,9 +425,9 @@
|
|
432 |
// also, lets hard code the max loops to 20. that's /a lot/ of loops for columnizer,
|
433 |
// and should keep run aways in check. if somehow someone has content combined with
|
434 |
// options that would cause an infinite loop, then this'll definitely stop it.
|
435 |
-
for(var loopCount=0;loopCount<maxLoops &&
|
436 |
$inBox.empty();
|
437 |
-
var $destroyable;
|
438 |
try{
|
439 |
$destroyable = $cache.clone(true);
|
440 |
}catch(e){
|
@@ -445,31 +438,34 @@
|
|
445 |
// create the columns
|
446 |
for (var i = 0; i < numCols; i++) {
|
447 |
/* create column */
|
448 |
-
|
449 |
className += " " + prefixTheClassName("column");
|
450 |
-
|
451 |
$inBox.append($("<div class='" + className + "' style='width:" + (Math.floor(100 / numCols))+ "%; float: " + options.columnFloat + ";'></div>")); //"
|
452 |
}
|
453 |
-
|
454 |
// fill all but the last column (unless overflowing)
|
455 |
-
|
456 |
while(i < numCols - (options.overflow ? 0 : 1) || scrollHorizontally && $destroyable.contents().length){
|
457 |
if($inBox.children().length <= i){
|
458 |
// we ran out of columns, make another
|
459 |
$inBox.append($("<div class='" + className + "' style='width:" + (Math.floor(100 / numCols))+ "%; float: " + options.columnFloat + ";'></div>")); //"
|
460 |
}
|
461 |
-
|
|
|
|
|
|
|
462 |
columnize($col, $destroyable, $col, targetHeight);
|
463 |
// make sure that the last item in the column isn't a "dontend"
|
464 |
split($col, $destroyable, $col, targetHeight);
|
465 |
-
|
466 |
while($col.contents(":last").length && checkDontEndColumn($col.contents(":last").get(0))){
|
467 |
-
|
468 |
$lastKid.remove();
|
469 |
$destroyable.prepend($lastKid);
|
470 |
}
|
471 |
i++;
|
472 |
-
|
473 |
//
|
474 |
// https://github.com/adamwulf/Columnizer-jQuery-Plugin/issues/47
|
475 |
//
|
@@ -480,7 +476,7 @@
|
|
480 |
//
|
481 |
// this results in empty columns being added with the dontsplit item
|
482 |
// perpetually waiting to get put into a column. lets force the issue here
|
483 |
-
if($col.contents().length
|
484 |
//
|
485 |
// ok, we're building zero content columns. this'll happen forever
|
486 |
// since nothing can ever get taken out of destroyable.
|
@@ -499,7 +495,7 @@
|
|
499 |
numCols ++;
|
500 |
}
|
501 |
}
|
502 |
-
|
503 |
}
|
504 |
if(options.overflow && !scrollHorizontally){
|
505 |
var IE6 = false /*@cc_on || @_jscript_version < 5.7 @*/;
|
@@ -509,8 +505,8 @@
|
|
509 |
var div = document.createElement('DIV');
|
510 |
while($destroyable[0].childNodes.length > 0){
|
511 |
var kid = $destroyable[0].childNodes[0];
|
512 |
-
for(
|
513 |
-
if(kid.attributes[i].nodeName.indexOf("jQuery")
|
514 |
kid.removeAttribute(kid.attributes[i].nodeName);
|
515 |
}
|
516 |
}
|
@@ -526,7 +522,9 @@
|
|
526 |
}else if(!scrollHorizontally){
|
527 |
// the last column in the series
|
528 |
$col = $inBox.children().eq($inBox.children().length-1);
|
529 |
-
|
|
|
|
|
530 |
var afterH = $col.height();
|
531 |
var diff = afterH - targetHeight;
|
532 |
var totalH = 0;
|
@@ -548,10 +546,11 @@
|
|
548 |
if(h < min) min = h;
|
549 |
numberOfColumnsThatDontEndInAColumnBreak++;
|
550 |
}
|
551 |
-
}
|
|
|
552 |
|
553 |
var avgH = totalH / numberOfColumnsThatDontEndInAColumnBreak;
|
554 |
-
if(totalH
|
555 |
//
|
556 |
// all columns end in a column break,
|
557 |
// so we're done here
|
@@ -583,7 +582,7 @@
|
|
583 |
$inBox.children().each(function(i){
|
584 |
$col = $inBox.children().eq(i);
|
585 |
$col.width(optionWidth + "px");
|
586 |
-
if(i
|
587 |
$col.addClass(prefixTheClassName("first"));
|
588 |
}else if(i==$inBox.children().length-1){
|
589 |
$col.addClass(prefixTheClassName("last"));
|
40 |
// default to empty string for backwards compatibility
|
41 |
cssClassPrefix : ""
|
42 |
};
|
43 |
+
options = $.extend(defaults, options);
|
44 |
+
|
45 |
if(typeof(options.width) == "string"){
|
46 |
+
options.width = parseInt(options.width,10);
|
47 |
if(isNaN(options.width)){
|
48 |
options.width = defaults.width;
|
49 |
}
|
50 |
}
|
51 |
|
52 |
return this.each(function() {
|
53 |
+
var $inBox = options.target ? $(options.target) : $(this);
|
54 |
var maxHeight = $(this).height();
|
55 |
var $cache = $('<div></div>'); // this is where we'll put the real content
|
56 |
var lastWidth = 0;
|
61 |
cssClassPrefix = options.cssClassPrefix;
|
62 |
}
|
63 |
|
64 |
+
|
65 |
var adjustment = 0;
|
66 |
+
|
67 |
$cache.append($(this).contents().clone(true));
|
68 |
+
|
69 |
+
// images loading after dom load
|
70 |
+
// can screw up the column heights,
|
71 |
+
// so recolumnize after images load
|
72 |
+
if(!options.ignoreImageLoading && !options.target){
|
73 |
+
if(!$inBox.data("imageLoaded")){
|
74 |
+
$inBox.data("imageLoaded", true);
|
75 |
+
if($(this).find("img").length > 0){
|
76 |
+
// only bother if there are
|
77 |
+
// actually images...
|
78 |
+
var func = function($inBox,$cache){ return function(){
|
79 |
+
if(!$inBox.data("firstImageLoaded")){
|
80 |
+
$inBox.data("firstImageLoaded", "true");
|
81 |
+
$inBox.empty().append($cache.children().clone(true));
|
82 |
+
$inBox.columnize(options);
|
83 |
+
}
|
84 |
+
};
|
85 |
+
}($(this), $cache);
|
86 |
+
$(this).find("img").one("load", func);
|
87 |
+
$(this).find("img").one("abort", func);
|
88 |
+
return;
|
89 |
+
}
|
90 |
+
}
|
91 |
+
}
|
92 |
+
|
93 |
$inBox.empty();
|
94 |
+
|
95 |
columnizeIt();
|
96 |
+
|
97 |
if(!options.buildOnce){
|
98 |
$(window).resize(function() {
|
99 |
+
if(!options.buildOnce){
|
100 |
if($inBox.data("timeout")){
|
101 |
clearTimeout($inBox.data("timeout"));
|
102 |
}
|
103 |
$inBox.data("timeout", setTimeout(columnizeIt, 200));
|
|
|
|
|
|
|
|
|
104 |
}
|
105 |
});
|
106 |
}
|
107 |
+
|
108 |
function prefixTheClassName(className, withDot){
|
109 |
var dot = withDot ? "." : "";
|
110 |
if(cssClassPrefix.length){
|
112 |
}
|
113 |
return dot + className;
|
114 |
}
|
115 |
+
|
|
|
116 |
/**
|
117 |
* this fuction builds as much of a column as it can without
|
118 |
* splitting nodes in half. If the last node in the new column
|
134 |
// add as many nodes to the column as we can,
|
135 |
// but stop once our height is too tall
|
136 |
while((manualBreaks || $parentColumn.height() < targetHeight) &&
|
137 |
+
$pullOutHere[0].childNodes.length){
|
138 |
+
var node = $pullOutHere[0].childNodes[0];
|
139 |
//
|
140 |
// Because we're not cloning, jquery will actually move the element"
|
141 |
// http://welcome.totheinter.net/2009/03/19/the-undocumented-life-of-jquerys-append/
|
151 |
}
|
152 |
$putInHere.append(node);
|
153 |
}
|
154 |
+
if($putInHere[0].childNodes.length === 0) return;
|
155 |
+
|
156 |
// now we're too tall, so undo the last one
|
157 |
var kids = $putInHere[0].childNodes;
|
158 |
var lastKid = kids[kids.length-1];
|
159 |
$putInHere[0].removeChild(lastKid);
|
160 |
var $item = $(lastKid);
|
161 |
+
|
|
|
162 |
// now lets try to split that last node
|
163 |
// to fit as much of it as we can into this column
|
164 |
if($item[0].nodeType == 3){
|
178 |
}
|
179 |
latestTextNode = document.createTextNode(columnText);
|
180 |
$putInHere.append(latestTextNode);
|
181 |
+
|
182 |
if(oText.length > counter2 && indexOfSpace != -1){
|
183 |
oText = oText.substring(indexOfSpace);
|
184 |
}else{
|
185 |
oText = "";
|
186 |
}
|
187 |
}
|
188 |
+
if($parentColumn.height() >= targetHeight && latestTextNode !== null){
|
189 |
// too tall :(
|
190 |
$putInHere[0].removeChild(latestTextNode);
|
191 |
oText = latestTextNode.nodeValue + oText;
|
196 |
return false; // we ate the whole text node, move on to the next node
|
197 |
}
|
198 |
}
|
199 |
+
|
200 |
if($pullOutHere.contents().length){
|
201 |
$pullOutHere.prepend($item);
|
202 |
}else{
|
203 |
$pullOutHere.append($item);
|
204 |
}
|
205 |
+
|
206 |
return $item[0].nodeType == 3;
|
207 |
}
|
208 |
+
|
209 |
/**
|
210 |
* Split up an element, which is more complex than splitting text. We need to create
|
211 |
* two copies of the element with it's contents divided between each
|
226 |
//
|
227 |
// make sure we're splitting an element
|
228 |
if($cloneMe.get(0).nodeType != 1) return;
|
229 |
+
|
230 |
//
|
231 |
// clone the node with all data and events
|
232 |
var $clone = $cloneMe.clone(true);
|
243 |
// keep adding until we hit a manual break
|
244 |
$putInHere.append($clone);
|
245 |
$cloneMe.remove();
|
246 |
+
}else if($clone.get(0).nodeType == 1 && !$clone.hasClass(prefixTheClassName("dontend"))){
|
247 |
$putInHere.append($clone);
|
248 |
if($clone.is("img") && $parentColumn.height() < targetHeight + 20){
|
249 |
//
|
279 |
// split class and move on.
|
280 |
$cloneMe.addClass(prefixTheClassName("split"));
|
281 |
}
|
282 |
+
if($clone.get(0).childNodes.length === 0){
|
283 |
// it was split, but nothing is in it :(
|
284 |
$clone.remove();
|
285 |
}
|
287 |
}
|
288 |
}
|
289 |
}
|
290 |
+
|
291 |
+
|
292 |
function singleColumnizeIt() {
|
293 |
if ($inBox.data("columnized") && $inBox.children().length == 1) {
|
294 |
return;
|
295 |
}
|
296 |
$inBox.data("columnized", true);
|
297 |
$inBox.data("columnizing", true);
|
298 |
+
|
299 |
$inBox.empty();
|
300 |
$inBox.append($("<div class='"
|
301 |
+
+ prefixTheClassName("first") + " "
|
302 |
+
+ prefixTheClassName("last") + " "
|
303 |
+
+ prefixTheClassName("column") + " "
|
304 |
+
+ "' style='width:100%; float: " + options.columnFloat + ";'></div>")); //"
|
305 |
$col = $inBox.children().eq($inBox.children().length-1);
|
306 |
$destroyable = $cache.clone(true);
|
307 |
if(options.overflow){
|
311 |
if(!$destroyable.contents().find(":first-child").hasClass(prefixTheClassName("dontend"))){
|
312 |
split($col, $destroyable, $col, targetHeight);
|
313 |
}
|
314 |
+
|
315 |
while($col.contents(":last").length && checkDontEndColumn($col.contents(":last").get(0))){
|
316 |
var $lastKid = $col.contents(":last");
|
317 |
$lastKid.remove();
|
324 |
var kid = $destroyable[0].childNodes[0];
|
325 |
if(kid.attributes){
|
326 |
for(var i=0;i<kid.attributes.length;i++){
|
327 |
+
if(kid.attributes[i].nodeName.indexOf("jQuery") === 0){
|
328 |
kid.removeAttribute(kid.attributes[i].nodeName);
|
329 |
}
|
330 |
}
|
340 |
$col.append($destroyable);
|
341 |
}
|
342 |
$inBox.data("columnizing", false);
|
343 |
+
|
344 |
if(options.overflow && options.overflow.doneFunc){
|
345 |
options.overflow.doneFunc();
|
346 |
}
|
347 |
+
|
348 |
}
|
349 |
+
|
350 |
/**
|
351 |
* returns true if the input dom node
|
352 |
* should not end a column.
|
358 |
// is not 100% whitespace
|
359 |
if(/^\s+$/.test(dom.nodeValue)){
|
360 |
//
|
361 |
+
// ok, it's 100% whitespace,
|
362 |
+
// so we should return checkDontEndColumn
|
363 |
+
// of the inputs previousSibling
|
364 |
+
if(!dom.previousSibling) return false;
|
365 |
return checkDontEndColumn(dom.previousSibling);
|
366 |
}
|
367 |
return false;
|
368 |
}
|
369 |
if(dom.nodeType != 1) return false;
|
370 |
if($(dom).hasClass(prefixTheClassName("dontend"))) return true;
|
371 |
+
if(dom.childNodes.length === 0) return false;
|
372 |
return checkDontEndColumn(dom.childNodes[dom.childNodes.length-1]);
|
373 |
}
|
374 |
+
|
|
|
|
|
375 |
function columnizeIt() {
|
376 |
//reset adjustment var
|
377 |
adjustment = 0;
|
378 |
if(lastWidth == $inBox.width()) return;
|
379 |
lastWidth = $inBox.width();
|
380 |
+
|
381 |
var numCols = Math.round($inBox.width() / options.width);
|
382 |
var optionWidth = options.width;
|
383 |
var optionHeight = options.height;
|
386 |
numCols = $cache.find(prefixTheClassName("columnbreak", true)).length + 1;
|
387 |
optionWidth = false;
|
388 |
}
|
389 |
+
|
390 |
// if ($inBox.data("columnized") && numCols == $inBox.children().length) {
|
391 |
// return;
|
392 |
// }
|
396 |
if($inBox.data("columnizing")) return;
|
397 |
$inBox.data("columnized", true);
|
398 |
$inBox.data("columnizing", true);
|
399 |
+
|
400 |
$inBox.empty();
|
401 |
$inBox.append($("<div style='width:" + (Math.floor(100 / numCols))+ "%; float: " + options.columnFloat + ";'></div>")); //"
|
402 |
$col = $inBox.children(":last");
|
403 |
$col.append($cache.clone());
|
404 |
maxHeight = $col.height();
|
405 |
$inBox.empty();
|
406 |
+
|
407 |
var targetHeight = maxHeight / numCols;
|
408 |
var firstTime = true;
|
409 |
var maxLoops = 3;
|
416 |
targetHeight = optionHeight;
|
417 |
scrollHorizontally = true;
|
418 |
}
|
419 |
+
|
420 |
//
|
421 |
// We loop as we try and workout a good height to use. We know it initially as an average
|
422 |
// but if the last column is higher than the first ones (which can happen, depending on split
|
425 |
// also, lets hard code the max loops to 20. that's /a lot/ of loops for columnizer,
|
426 |
// and should keep run aways in check. if somehow someone has content combined with
|
427 |
// options that would cause an infinite loop, then this'll definitely stop it.
|
428 |
+
for(var loopCount=0;loopCount<maxLoops && loopCount<20;loopCount++){
|
429 |
$inBox.empty();
|
430 |
+
var $destroyable, className, $col, $lastKid;
|
431 |
try{
|
432 |
$destroyable = $cache.clone(true);
|
433 |
}catch(e){
|
438 |
// create the columns
|
439 |
for (var i = 0; i < numCols; i++) {
|
440 |
/* create column */
|
441 |
+
className = (i === 0) ? prefixTheClassName("first") : "";
|
442 |
className += " " + prefixTheClassName("column");
|
443 |
+
className = (i == numCols - 1) ? (prefixTheClassName("last") + " " + className) : className;
|
444 |
$inBox.append($("<div class='" + className + "' style='width:" + (Math.floor(100 / numCols))+ "%; float: " + options.columnFloat + ";'></div>")); //"
|
445 |
}
|
446 |
+
|
447 |
// fill all but the last column (unless overflowing)
|
448 |
+
i = 0;
|
449 |
while(i < numCols - (options.overflow ? 0 : 1) || scrollHorizontally && $destroyable.contents().length){
|
450 |
if($inBox.children().length <= i){
|
451 |
// we ran out of columns, make another
|
452 |
$inBox.append($("<div class='" + className + "' style='width:" + (Math.floor(100 / numCols))+ "%; float: " + options.columnFloat + ";'></div>")); //"
|
453 |
}
|
454 |
+
$col = $inBox.children().eq(i);
|
455 |
+
if(scrollHorizontally){
|
456 |
+
$col.width(optionWidth + "px");
|
457 |
+
}
|
458 |
columnize($col, $destroyable, $col, targetHeight);
|
459 |
// make sure that the last item in the column isn't a "dontend"
|
460 |
split($col, $destroyable, $col, targetHeight);
|
461 |
+
|
462 |
while($col.contents(":last").length && checkDontEndColumn($col.contents(":last").get(0))){
|
463 |
+
$lastKid = $col.contents(":last");
|
464 |
$lastKid.remove();
|
465 |
$destroyable.prepend($lastKid);
|
466 |
}
|
467 |
i++;
|
468 |
+
|
469 |
//
|
470 |
// https://github.com/adamwulf/Columnizer-jQuery-Plugin/issues/47
|
471 |
//
|
476 |
//
|
477 |
// this results in empty columns being added with the dontsplit item
|
478 |
// perpetually waiting to get put into a column. lets force the issue here
|
479 |
+
if($col.contents().length === 0 && $destroyable.contents().length){
|
480 |
//
|
481 |
// ok, we're building zero content columns. this'll happen forever
|
482 |
// since nothing can ever get taken out of destroyable.
|
495 |
numCols ++;
|
496 |
}
|
497 |
}
|
498 |
+
|
499 |
}
|
500 |
if(options.overflow && !scrollHorizontally){
|
501 |
var IE6 = false /*@cc_on || @_jscript_version < 5.7 @*/;
|
505 |
var div = document.createElement('DIV');
|
506 |
while($destroyable[0].childNodes.length > 0){
|
507 |
var kid = $destroyable[0].childNodes[0];
|
508 |
+
for(i=0;i<kid.attributes.length;i++){
|
509 |
+
if(kid.attributes[i].nodeName.indexOf("jQuery") === 0){
|
510 |
kid.removeAttribute(kid.attributes[i].nodeName);
|
511 |
}
|
512 |
}
|
522 |
}else if(!scrollHorizontally){
|
523 |
// the last column in the series
|
524 |
$col = $inBox.children().eq($inBox.children().length-1);
|
525 |
+
$destroyable.contents().each( function() {
|
526 |
+
$col.append( $(this) );
|
527 |
+
});
|
528 |
var afterH = $col.height();
|
529 |
var diff = afterH - targetHeight;
|
530 |
var totalH = 0;
|
546 |
if(h < min) min = h;
|
547 |
numberOfColumnsThatDontEndInAColumnBreak++;
|
548 |
}
|
549 |
+
};
|
550 |
+
}($inBox));
|
551 |
|
552 |
var avgH = totalH / numberOfColumnsThatDontEndInAColumnBreak;
|
553 |
+
if(totalH === 0){
|
554 |
//
|
555 |
// all columns end in a column break,
|
556 |
// so we're done here
|
582 |
$inBox.children().each(function(i){
|
583 |
$col = $inBox.children().eq(i);
|
584 |
$col.width(optionWidth + "px");
|
585 |
+
if(i === 0){
|
586 |
$col.addClass(prefixTheClassName("first"));
|
587 |
}else if(i==$inBox.children().length-1){
|
588 |
$col.addClass(prefixTheClassName("last"));
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_i
|
|
4 |
Tags: Google Forms, Google Docs, Google, Spreadsheet, shortcode, forms
|
5 |
Requires at least: 3.3
|
6 |
Tested up to: 3.5.1
|
7 |
-
Stable tag: 0.
|
8 |
|
9 |
Embeds a published, public Google Form in a WordPress post, page, or widget.
|
10 |
|
@@ -316,6 +316,9 @@ No known upgrade issues.
|
|
316 |
|
317 |
== Changelog ==
|
318 |
|
|
|
|
|
|
|
319 |
= Version 0.54 =
|
320 |
* Added internationalization support for jQuery Validation messages.
|
321 |
* New language support files.
|
4 |
Tags: Google Forms, Google Docs, Google, Spreadsheet, shortcode, forms
|
5 |
Requires at least: 3.3
|
6 |
Tested up to: 3.5.1
|
7 |
+
Stable tag: 0.55
|
8 |
|
9 |
Embeds a published, public Google Form in a WordPress post, page, or widget.
|
10 |
|
316 |
|
317 |
== Changelog ==
|
318 |
|
319 |
+
= Version 0.55 =
|
320 |
+
Incporated a patch version of jQuery Columnizer to fix problem which appears in WordPress 3.6 which includes jQuery 1.10.
|
321 |
+
|
322 |
= Version 0.54 =
|
323 |
* Added internationalization support for jQuery Validation messages.
|
324 |
* New language support files.
|