• easyui



    ============
    解决兼容性问题
    1、移除
    $.fn._remove = function ()
    {
    return this.each(function ()
    {
    $(this).remove();
    try
    {
    this.outerHTML = "";
    }
    catch (err)
    {}
    }
    );
    };
    $.fn._outerWidth = function(width){
    if (width == undefined){
    if (this[0] == window){
    return this.width() || document.body.clientWidth;
    }
    return this.outerWidth()||0;
    }
    return this._size('width', width);
    };

    /**
    * extend plugin to set box model height
    */
    $.fn._outerHeight = function(height){
    if (height == undefined){
    if (this[0] == window){
    return this.height() || document.body.clientHeight;
    }
    return this.outerHeight()||0;
    }
    return this._size('height', height);
    };

    $.fn._scrollLeft = function(left){
    if (left == undefined){
    return this.scrollLeft();
    } else {
    return this.each(function(){$(this).scrollLeft(left)});
    }
    };

    $.fn._propAttr = $.fn.prop || $.fn.attr;
    ---------------

    $.fn._size = function(options, parent){
    if (typeof options == 'string'){
    if (options == 'clear'){
    return this.each(function(){
    $(this).css({'',minWidth:'',maxWidth:'',height:'',minHeight:'',maxHeight:''});
    });
    } else if (options == 'fit'){
    return this.each(function(){
    _fit(this, this.tagName=='BODY' ? $('body') : $(this).parent(), true);
    });
    } else if (options == 'unfit'){
    return this.each(function(){
    _fit(this, $(this).parent(), false);
    });
    } else {
    if (parent == undefined){
    return _css(this[0], options);
    } else {
    return this.each(function(){
    _css(this, options, parent);
    });
    }
    }
    } else {
    return this.each(function(){
    parent = parent || $(this).parent();
    $.extend(options, _fit(this, parent, options.fit)||{});
    var r1 = _setSize(this, 'width', parent, options);
    var r2 = _setSize(this, 'height', parent, options);
    if (r1 || r2){
    $(this).addClass('easyui-fluid');
    } else {
    $(this).removeClass('easyui-fluid');
    }
    });
    }

    function _fit(target, parent, fit){
    if (!parent.length){return false;}
    var t = $(target)[0];
    var p = parent[0];
    var fcount = p.fcount || 0;
    if (fit){
    if (!t.fitted){
    t.fitted = true;
    p.fcount = fcount + 1;
    $(p).addClass('panel-noscroll');
    if (p.tagName == 'BODY'){
    $('html').addClass('panel-fit');
    }
    }
    return {
    ($(p).width()||1),
    height: ($(p).height()||1)
    };
    } else {
    if (t.fitted){
    t.fitted = false;
    p.fcount = fcount - 1;
    if (p.fcount == 0){
    $(p).removeClass('panel-noscroll');
    if (p.tagName == 'BODY'){
    $('html').removeClass('panel-fit');
    }
    }
    }
    return false;
    }
    }
    function _setSize(target, property, parent, options){
    var t = $(target);
    var p = property;
    var p1 = p.substr(0,1).toUpperCase() + p.substr(1);
    var min = $.parser.parseValue('min'+p1, options['min'+p1], parent);// || 0;
    var max = $.parser.parseValue('max'+p1, options['max'+p1], parent);// || 99999;
    var val = $.parser.parseValue(p, options[p], parent);
    var fluid = (String(options[p]||'').indexOf('%') >= 0 ? true : false);

    if (!isNaN(val)){
    var v = Math.min(Math.max(val, min||0), max||99999);
    if (!fluid){
    options[p] = v;
    }
    t._size('min'+p1, '');
    t._size('max'+p1, '');
    t._size(p, v);
    } else {
    t._size(p, '');
    t._size('min'+p1, min);
    t._size('max'+p1, max);
    }
    return fluid || options.fit;
    }
    function _css(target, property, value){
    var t = $(target);
    if (value == undefined){
    value = parseInt(target.style[property]);
    if (isNaN(value)){return undefined;}
    if ($._boxModel){
    value += getDeltaSize();
    }
    return value;
    } else if (value === ''){
    t.css(property, '');
    } else {
    if ($._boxModel){
    value -= getDeltaSize();
    if (value < 0){value = 0;}
    }
    t.css(property, value+'px');
    }
    function getDeltaSize(){
    if (property.toLowerCase().indexOf('width') >= 0){
    return t.outerWidth() - t.width();
    } else {
    return t.outerHeight() - t.height();
    }
    }
    }
    };

    ------------------------------------
    =============

    1、parser模块是easyloader第一个加载的模块,它的主要作用,就是扫描页面上easyui开头的class标签,然后初始化成easyui控件。

  • 相关阅读:
    Java SE 第十二,三,四,五六讲 Java基础知识回顾
    Java SE第二十一 抽象类
    Java SE 第二十讲 static与final关键字详解
    使用AspNetPager分页的范例
    AJax错误"WebForm1"没有定义的javascript错误的解决方法
    如何为自定义的控件在工具箱中自定义个性化的图标
    C#面向对象名词比较(转ttyp 的文章)
    vs2003自带的报表使用load("rpt.rpt")方式,显示不出报表工具的图片解决方案
    DropDownlist常见的小错误
    Ajax获取数据库中的字段
  • 原文地址:https://www.cnblogs.com/y896926473/p/5448250.html
Copyright © 2020-2023  润新知