WebUI/Scripts/ajaxupload.js

(开头部分) 24KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

/**
* AJAX Upload ( http://valums.com/ajax-upload/ ) 
* Copyright (c) Andrew Valums
* Licensed under the MIT license 
*/
(function() {
    /**
    * Attaches event to a dom element.
    * @param {Element} el
    * @param type event name
    * @param fn callback This refers to the passed element
    */
    function addEvent(el, type, fn) {
        if (el.addEventListener) {
            el.addEventListener(type, fn, false);
        } else if (el.attachEvent) {
            el.attachEvent('on' + type, function() {
                fn.call(el);
            });
        } else {
            throw new Error('not supported or DOM not loaded');
        }
    }

    /**
    * Attaches resize event to a window, limiting
    * number of event fired. Fires only when encounteres
    * delay of 100 after series of events.
    * 
    * Some browsers fire event multiple times when resizing
    * http://www.quirksmode.org/dom/events/resize.html
    * 
    * @param fn callback This refers to the passed element
    */
    function addResizeEvent(fn) {
        var timeout;

        addEvent(window, 'resize', function() {
            if (timeout) {
                clearTimeout(timeout);
            }
            timeout = setTimeout(fn, 100);
        });
    }

    // Needs more testing, will be rewriten for next version        
    // getOffset function copied from jQuery lib (http://jquery.com/)
    if (document.documentElement.getBoundingClientRect) {
        // Get Offset using getBoundingClientRect
        // http://ejohn.org/blog/getboundingclientrect-is-awesome/
        var getOffset = function(el) {
            var box = el.getBoundingClientRect();
            var doc = el.ownerDocument;
            var body = doc.body;
            var docElem = doc.documentElement; // for ie 
            var clientTop = docElem.clientTop || body.clientTop || 0;
            var clientLeft = docElem.clientLeft || body.clientLeft || 0;

            // In Internet Explorer 7 getBoundingClientRect property is treated as physical,
            // while others are logical. Make all logical, like in IE8.	
后面还有 627 行代码,购买后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。