Internal method to check if an accordion's bottom-edge is visible to the user (or about to be).

@param {Number} offset
@private
966557
function edgeCheck(offset){
			if(edgeClass){
				var box         = el.getBoundingClientRect();
				var windowEdge  = window.innerHeight;
				
				// If the bottom-edge is visible (or about to be), enable height animation
				if(box.bottom + (offset || 0) < windowEdge)
					elClasses.add(edgeClass)
				
				// If the bottom-edge isn't visible anyway, disable height animation immediately
				else if(box.bottom > windowEdge)
					elClasses.remove(edgeClass);
			}
		}
663748
function _getFunctionEndOffset(text, offsetStart) {
        var mode = CodeMirror.getMode({}, "javascript");
        var state = CodeMirror.startState(mode), stream, style, token;
        var curOffset = offsetStart, length = text.length, blockCount = 0, lineStart;
        var foundStartBrace = false;

        // Get a stream for the next line, and update curOffset and lineStart to point to the
        // beginning of that next line. Returns false if we're at the end of the text.
        function nextLine() {
            if (stream) {
                curOffset++; // account for \n
                if (curOffset >= length) {
                    return false;
                }
            }
            lineStart = curOffset;
            var lineEnd = text.indexOf("\n", lineStart);
            if (lineEnd === -1) {
                lineEnd = length;
            }
            stream = new CodeMirror.StringStream(text.slice(curOffset, lineEnd));
            return true;
        }

        // Get the next token, updating the style and token to refer to the current
        // token, and updating the curOffset to point to the end of the token (relative
        // to the start of the original text).
        function nextToken() {
            if (curOffset >= length) {
                return false;
            }
            if (stream) {
                // Set the start of the next token to the current stream position.
                stream.start = stream.pos;
            }
            while (!stream || stream.eol()) {
                if (!nextLine()) {
                    return false;
                }
            }
            style = mode.token(stream, state);
            token = stream.current();
            curOffset = lineStart + stream.pos;
            return true;
        }

        while (nextToken()) {
            if (style !== "comment" && style !== "regexp" && style !== "string" && style !== "string-2") {
                if (token === "{") {
                    foundStartBrace = true;
                    blockCount++;
                } else if (token === "}") {
                    blockCount--;
                }
            }

            // blockCount starts at 0, so we don't want to check if it hits 0
            // again until we've actually gone past the start of the function body.
            if (foundStartBrace && blockCount <= 0) {
                return curOffset;
            }
        }

        // Shouldn't get here, but if we do, return the end of the text as the offset.
        return length;
    }
176955
function(callback) {
        if ($.type(callback) !== 'function') {
            callback = function(section) {
                return section.outerHeight();
            };
        }

        this.sections.each(function() {
            var self = $(this),
                className = self.hasClass('hide') ? 'hide' : 'show',
                maxHeight = self.css('max-height');

            // Make section visible
            self.addClass('no-transition').removeClass(className).css('max-height', '');

            // Get the height
            var height = callback.call(this, self);

            // Set section back to previous state
            self.addClass(className).css('max-height', maxHeight).removeClass('no-transition');

            // Set the height
            self.data('accordion-height', height);

            if (self.hasClass('show')) {
                self.css('max-height', height);
            }
        });
    }
1371880
function offset ( elem, orientation ) {

        var rect = elem.getBoundingClientRect(),
            doc = elem.ownerDocument,
            docElem = doc.documentElement,
            pageOffset = getPageOffset();

        // getBoundingClientRect contains left scroll in Chrome on Android.
        // I haven't found a feature detection that proves this. Worst case
        // scenario on mis-match: the 'tap' feature on horizontal sliders breaks.
        if ( /webkit.*Chrome.*Mobile/i.test(navigator.userAgent) ) {
            pageOffset.x = 0;
        }

        return orientation ? (rect.top + pageOffset.y - docElem.clientTop) : (rect.left + pageOffset.x - docElem.clientLeft);
    }
1029129
function findEscapeEnd(source, offset) {
    for (var i = 0; i < 7 && offset + i < source.length; i++) {
        var code = source.charCodeAt(offset + i);

        if (i !== 6 && isHex(code)) {
            continue;
        }

        if (i > 0) {
            offset += i - 1 + getNewlineLength(source, offset + i, code);
            if (code === SPACE || code === TAB) {
                offset++;
            }
        }

        break;
    }

    return offset;
}
823427
function getFixedScrollOffset(offset, length) {
        if (offset && length + offset <= limit) {
          return Math.min(limit - length, 0);
        }
        return Math.min(offset, 0);
      }
211506
function(node) {
        // Re-adjust the offset to match the parent container
        // is() fails when checking against window
        if (container[0] !== window) {
            var conOffset = container.offset();

            left -= conOffset.left;
            top -= conOffset.top;
        }
    }
998772
function checkResize() {
        var newOffsetHeight = element.offsetHeight,
            newOffsetWidth = element.offsetWidth;

        // check if we're in a frame
        if (inIframe) {
            // firefox has an issue where styles aren't calculated in hidden iframes
            // if the iframe was hidden and is now visible, broadcast a
            // layoutchange event
            if (frameWidth === 0 && window.innerWidth !== 0) {
                frameWidth = window.innerWidth;
                // fix the element position again if necessary
                fixElementPosition();
                scope.broadcast('layoutchange');
                return;
            }
        }

        //on touch devices, the offset height is sometimes zero as content is loaded
        if (newOffsetHeight) {
            if (newOffsetHeight !== currentOffsetHeight || newOffsetWidth !== currentOffsetWidth) {
                currentOffsetHeight = newOffsetHeight;
                currentOffsetWidth = newOffsetWidth;
                currentClientHeight = element.clientHeight;
                currentClientWidth = element.clientWidth;
                broadcast();
            }
        }
    }
464306
function()
		{
			var isVisible = ( this.$.offsetHeight || this.$.offsetWidth ) && this.getComputedStyle( 'visibility' ) != 'hidden',
				elementWindow,
				elementWindowFrame;

			// Webkit and Opera report non-zero offsetHeight despite that
			// element is inside an invisible iframe. (#4542)
			if ( isVisible && ( CKEDITOR.env.webkit || CKEDITOR.env.opera ) )
			{
				elementWindow = this.getWindow();

				if ( !elementWindow.equals( CKEDITOR.document.getWindow() )
						&& ( elementWindowFrame = elementWindow.$.frameElement ) )
				{
					isVisible = new CKEDITOR.dom.element( elementWindowFrame ).isVisible();
				}
			}

			return !!isVisible;
		}
1128632
function (el) {
		var offsets = el.getPosition(); // #1496
		return {
			left: offsets.x,
			top: offsets.y
		};
	}
1316302
def last_visible_line(self, before_scroll_offset=False):
        
        if before_scroll_offset:
            return self.displayed_lines[-1 - self.applied_scroll_offsets.bottom]
        else:
            return self.displayed_lines[-1]
458783
function(e) {
			var thumbOffset = this.thumb.region().height/2;
			this.setPositionIfValid(e._e.pageY - (this.node.region().top + this.scrollbarOffset) - thumbOffset);
		}
1090200
function (element) {
    var left = 0
      , top = 0;

    do {
      left += element.offsetLeft;
      top += element.offsetTop;
    } while (element = element.offsetParent);

    return {
      left: left,
      top: top
    };
  }
1330777
function getBottomEdge(index, row) {
        return {
          index: index,
          y: editor.dom.getPos(row).y + row.offsetHeight
        };
      }
1027351
function (container) {
    var tagName = container[0].tagName.toUpperCase()
    var scrollTop 
    if (tagName === 'BODY' || tagName === 'HTML') {
      scrollTop = container.scrollTop() || $(window).scrollTop()
    } else {
      scrollTop = container.scrollTop()
    }
    var offset = container.scrollHeight() - ($(window).height() + scrollTop)
    console.log(offset)
    return offset
  }
263518
function findBoundingClientRect2(obj) {
        var offsetLeft = 0, offsetTop = 0, width = obj.offsetWidth, height = obj.offsetHeight;
        var scr = obj, fixed = false;
        while ((scr = scr.parentNode) && scr != document.body) {
            offsetLeft -= scr.scrollLeft || 0;
            offsetTop -= scr.scrollTop || 0;
            if (getStyle(scr, "position") == "fixed") fixed = true;
        }
        // You can take into account document.body.scrollLeft & document.body.scrollTop if you want to take into account global scroll of browser
        if (fixed && !window.opera) {
            var scrDist = scrollDist();
            offsetLeft += scrDist[0];
            offsetTop += scrDist[1];
        }
        do {
            offsetLeft += obj.offsetLeft;
            offsetTop += obj.offsetTop;
        } while (obj = obj.offsetParent);
        return {
            left: offsetLeft,
            top: offsetTop,
            width: width,
            height: height,
            right: offsetLeft + width - 1,
            bottom: offsetTop + height - 1
        };
    }
928902
function(element, x, y) {
    if (this.includeScrollOffsets)
      return this.withinIncludingScrolloffsets(element, x, y);
    this.xcomp = x;
    this.ycomp = y;
    this.offset = this.cumulativeOffset(element);

    return (y >= this.offset[1] &&
            y <  this.offset[1] + element.offsetHeight &&
            x >= this.offset[0] &&
            x <  this.offset[0] + element.offsetWidth);
  }