Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- __d("DOMDimensions", ["DOMQuery", "Style"], function (a, b, c, d, e, f) {
- var g = b('DOMQuery'),
- h = b('Style'),
- i = {
- getElementDimensions: function (j) {
- return {
- width: j.offsetWidth || 0,
- height: j.offsetHeight || 0
- };
- },
- getViewportDimensions: function () {
- var j = (window && window.innerWidth) || (document && document.documentElement && document.documentElement.clientWidth) || (document && document.body && document.body.clientWidth) || 0,
- k = (window && window.innerHeight) || (document && document.documentElement && document.documentElement.clientHeight) || (document && document.body && document.body.clientHeight) || 0;
- return {
- width: j,
- height: k
- };
- },
- getViewportWithoutScrollbarDimensions: function () {
- var j = (document && document.documentElement && document.documentElement.clientWidth) || (document && document.body && document.body.clientWidth) || 0,
- k = (document && document.documentElement && document.documentElement.clientHeight) || (document && document.body && document.body.clientHeight) || 0;
- return {
- width: j,
- height: k
- };
- },
- getDocumentDimensions: function (j) {
- j = j || document;
- var k = g.getDocumentScrollElement(j),
- l = k.scrollWidth || 0,
- m = k.scrollHeight || 0;
- return {
- width: l,
- height: m
- };
- },
- measureElementBox: function (j, k, l, m, n) {
- var o;
- switch (k) {
- case 'left':
- case 'right':
- case 'top':
- case 'bottom':
- o = [k];
- break;
- case 'width':
- o = ['left', 'right'];
- break;
- case 'height':
- o = ['top', 'bottom'];
- break;
- default:
- throw Error('Invalid plane: ' + k);
- }
- var p = function (q, r) {
- var s = 0;
- for (var t = 0; t < o.length; t++) s += parseInt(h.get(j, q + '-' + o[t] + r), 10) || 0;
- return s;
- };
- return (l ? p('padding', '') : 0) + (m ? p('border', '-width') : 0) + (n ? p('margin', '') : 0);
- }
- };
- e.exports = i;
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement