Merge remote-tracking branch 'upstream/master'

This commit is contained in:
Michael Vogel 2013-10-29 08:14:26 +01:00
commit 3dd4677da9
2 changed files with 63 additions and 15 deletions

View file

@ -58,6 +58,22 @@
}); });
} }
// Get offset adding all offsets, slow fall-back method
var getOffsetSlow = function(el){
var top = 0, left = 0;
do {
top += el.offsetTop || 0;
left += el.offsetLeft || 0;
el = el.offsetParent;
} while (el);
return {
left: left,
top: top
};
};
// Needs more testing, will be rewriten for next version // Needs more testing, will be rewriten for next version
// getOffset function copied from jQuery lib (http://jquery.com/) // getOffset function copied from jQuery lib (http://jquery.com/)
if (document.documentElement.getBoundingClientRect){ if (document.documentElement.getBoundingClientRect){
@ -79,6 +95,11 @@
zoom = (bound.right - bound.left) / body.clientWidth; zoom = (bound.right - bound.left) / body.clientWidth;
} }
// some CSS layouts gives 0 width and/or bounding boxes
// in this case we fall back to the slow method
if (zoom == 0 || body.clientWidth == 0)
return getOffsetSlow(el);
if (zoom > 1) { if (zoom > 1) {
clientTop = 0; clientTop = 0;
clientLeft = 0; clientLeft = 0;
@ -92,20 +113,7 @@
}; };
}; };
} else { } else {
// Get offset adding all offsets var getOffset = getOffsetSlow;
var getOffset = function(el){
var top = 0, left = 0;
do {
top += el.offsetTop || 0;
left += el.offsetLeft || 0;
el = el.offsetParent;
} while (el);
return {
left: left,
top: top
};
};
} }
/** /**

42
js/ajaxupload.min.js vendored

File diff suppressed because one or more lines are too long