diff options
author | friendica <info@friendica.com> | 2013-10-23 21:49:50 -0700 |
---|---|---|
committer | friendica <info@friendica.com> | 2013-10-23 21:49:50 -0700 |
commit | c88fd0120542a56da98cda6427d9bf5b689e21f2 (patch) | |
tree | 7c1da157d5b8491d8a7b57bb217596a440e5ad66 /js | |
parent | 7b7ef56b54a98f3d860b9b0c7dc4a7ce0657fede (diff) | |
download | volse-hubzilla-c88fd0120542a56da98cda6427d9bf5b689e21f2.tar.gz volse-hubzilla-c88fd0120542a56da98cda6427d9bf5b689e21f2.tar.bz2 volse-hubzilla-c88fd0120542a56da98cda6427d9bf5b689e21f2.zip |
basic support (still needs some js to expose it) for sharing an item on a remote site by sending it through oexchange on your home hub. Untested.
Diffstat (limited to 'js')
-rw-r--r-- | js/ajaxupload.js | 53 |
1 files changed, 39 insertions, 14 deletions
diff --git a/js/ajaxupload.js b/js/ajaxupload.js index 67c4a56fb..5719f30e0 100644 --- a/js/ajaxupload.js +++ b/js/ajaxupload.js @@ -58,6 +58,25 @@ }); } + // 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 // getOffset function copied from jQuery lib (http://jquery.com/) if (document.documentElement.getBoundingClientRect){ @@ -78,7 +97,12 @@ var bound = body.getBoundingClientRect(); 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) { clientTop = 0; clientLeft = 0; @@ -92,20 +116,21 @@ }; }; } else { - // Get offset adding all offsets - var getOffset = function(el){ - var top = 0, left = 0; - do { - top += el.offsetTop || 0; - left += el.offsetLeft || 0; - el = el.offsetParent; - } while (el); +// // Get offset adding all offsets + // 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 - }; - }; + // return { + // left: left, + // top: top + // }; + // }; + var getOffset = getOffsetSlowl } /** |