Пример #1
0
 callbacks[getCallbackName(instance)] = function (info) {
     switch (info.action) {
         case 'success'://登陆成功
             observer.trigger(instance, 'success');
             if (instance.get('autoReload')) {
                 window.location.reload();
             }
             instance.hide();
             break;
         case 'resize':
             instance.set('frameHeight', info.height);
             break;
         case 'close':
             instance.set('display', false);
             break;
         case 'focus':
             if (instance._dialog) {
                 instance._dialog.set('enableAutoCenter', false);
             }
             break;
         case 'blur':
             if (instance._dialog) {
                 instance._dialog.set('enableAutoCenter', true);
             }
             break;
     }
 };
Пример #2
0
    p.show = function () {
        var animateType = this.get('animateType');
        if (!animateType) {
            this._popup.set('display', true);
        } else {
            var $container = $(this._container);
            var self = this;
            if (animateType == 1) { //右滑入
                $container.css({
                    'margin-left': self._fullSize.get('size').width
                });
            } else if (animateType == 2) { //下滑入
                $container.css({
                    'margin-top': self._fullSize.get('size').height
                });
            }

            self._popup.set('display', true);
            observer.trigger(this, 'resize');

            if (animateType == 1) { //右滑入
                $container.animate({
                    'margin-left': 0
                }, 300, 'easeOutQuart');
            } else { //下滑入
                $container.animate({
                    'margin-top': 0
                }, 300, 'easeOutQuart');
            }
        }
    };
Пример #3
0
 p.title_changed = function () {
     var title = this.get('title');
     if (title) {
         $(this._titleDiv).html(title).show();
     } else {
         $(this._titleDiv).html('').hide();
     }
     observer.trigger(this, 'resize');
 };
Пример #4
0
            service.post("/hermes/sendMsg",params,function(response){
                var data = response.data || {};
                if(response.code == "0"){
                    options.data["create_time"] = Number(data.create_at)*1000;
                    options.data["lastMsgId"] = data.msg_id;
                    options["status"] = "success";

                    _self._listRemoval.set(data.msg_id);

                    done && done();
                } else {
                    options["status"] = "error";
                }

                observer.trigger(options,"statusUpdate",options.status);
            });
Пример #5
0
                    $('<img />').one('load', function () {
                        var autoShow = true;
                        observer.trigger(element, 'lazy_loaded', this, lazyOptions);
                        $element.css('visibility', 'visible');

                        if (autoShow !== false) {
                            var disableShowEffect = lazyOptions.disableShowEffect;
                            if (!disableShowEffect) {
                                $element.css('opacity', 0);
                            }
                            $element.attr('src', url);
                            if (!disableShowEffect) {
                                $element.animate({
                                    'opacity': 1
                                }, 200);
                            }
                        }
                    }).attr('src', url);
    ControlVerticalLayout.prototype.draw = function () {
        var container = this.container;
        container.style.display = "";
        var elements = this.elements;
        var maxWidth = 0;
        var maxHeight = 0;
        var elementsNum = elements.length;
        var i;
        for (i = 0; i < elementsNum; i++) {
            elements[i].width = getControlWidth(elements[i].element);
            elements[i].height = getControlHeight(elements[i].element);
            maxWidth = Math.max(elements[i].width, maxWidth);
            maxHeight = Math.max(elements[i].height, maxHeight);
        }

        var comWidth = 0;
        var comHeight = 0;
        var intervalDistance = this.distance;
        var mode = this.mode;
        var left;
        var top;

        for (i = 0; i < elementsNum; i++) {
            if (isDisplay(elements[i].element)) {
                if (i != 0) {
                    comHeight += intervalDistance;
                    comWidth += intervalDistance;
                }
                left = parseInt(mode & 8 ? comWidth : mode & 4 ? maxWidth - elements[i].width : mode & 2 ? (maxWidth - elements[i].width) / 2 : 0);
                top = parseInt(mode & 128 ? comHeight : mode & 64 ? maxHeight - elements[i].height : mode & 32 ? (maxHeight - elements[i].height) / 2 : 0);
                comHeight += elements[i].height;
                comWidth += elements[i].width;
                setLeftTop(elements[i].element, left, top);
            }
        }
        var controlWidth = mode & 8 ? comWidth : maxWidth;
        var controlHeight = mode & 128 ? comHeight : maxHeight;
        container.setAttribute("controlWidth", controlWidth);
        container.setAttribute("controlHeight", controlHeight);
        //container.style.display = (controlWidth || controlHeight) ? "" : "none";
        observer.trigger(container, "resize");
    };
Пример #7
0
    p._setAreaHeight = function(){
        var areaHeight = this._getArea()[0].scrollHeight;
        if(areaHeight == 0){
            return false;
        }
        if(areaHeight-this.height == 0){
            return false;
        }
        //相差大于15,换行
        //if(Math.abs(areaHeight-this.height) < 5){
        //    return false;
        //}
        if(areaHeight<this.maxHeight){
            this.height = areaHeight;
            $(this.element).css({
                height: areaHeight
            });

            observer.trigger(this,"heightChange");
        }
    };
Пример #8
0
 $element.one('load', function () {
     observer.trigger(element, 'lazy_loaded', element, lazyOptions);
     $element.css('visibility', 'visible');
 });
Пример #9
0
        observer.addListener(viewArrImages, 'insert_at', function (element) {
            var $element = $(element);
            var imgSrc = $element.attr('data-src');
            var isSupportOss = isSupportALiYunParams(imgSrc);
            var lazyOptions = element._lazy_options = {
                'origin_src': imgSrc,
                'support_oss': isSupportOss,
                'oss_params': {},
                'ext_name': 'src'
            };

            //生成回调计数器,用于需要异步处理图片加载的场景
            //lazyOptions.fn_num++;
            //async(function(){
            //   lazyOptions.fn_done();
            // })
            lazyOptions.fn_done = function () {
                if (counterFn) {
                    counterFn();
                } else {
                    setTimeout(function () {
                        counterFn && counterFn();
                    }, 0);
                }
            };
            lazyOptions.fn_num = 0;

            //如果支持图片服务,先走默认逻辑处理图片参数
            if (isSupportOss) {
                $.extend(lazyOptions.oss_params, defaultImageParam);
                fn_autoSize(element);
                fn_autoCut(element);
                if (gifReg.test(imgSrc)) {
                    lazyOptions['support_oss'] = false;
                }
            }

            var counterFn;

            //抛出事件,让具体业务进一步处理图片参数
            observer.trigger(exports, 'lazy_appear', element, lazyOptions);

            counterFn = util_function.counter(lazyOptions.fn_num || 0, function () {
                //生成url
                var url = imgSrc;
                if (useAliService && lazyOptions.support_oss) {
                    url += '@' + parserOssParamsUrl(lazyOptions.oss_params);
                    if (lazyOptions.ext_name) {
                        url += '.' + lazyOptions.ext_name;
                    }
                }
                //如果不使用后台加载方式就直接设置图片的src
                if (lazyOptions.no_fake_img_loader) {
                    $element.one('load', function () {
                        observer.trigger(element, 'lazy_loaded', element, lazyOptions);
                        $element.css('visibility', 'visible');
                    });
                    $element.attr('src', url);
                } else {
                    $('<img />').one('load', function () {
                        var autoShow = true;
                        observer.trigger(element, 'lazy_loaded', this, lazyOptions);
                        $element.css('visibility', 'visible');

                        if (autoShow !== false) {
                            var disableShowEffect = lazyOptions.disableShowEffect;
                            if (!disableShowEffect) {
                                $element.css('opacity', 0);
                            }
                            $element.attr('src', url);
                            if (!disableShowEffect) {
                                $element.animate({
                                    'opacity': 1
                                }, 200);
                            }
                        }
                    }).attr('src', url);
                }
            });
        });
Пример #10
0
 p.value_changed = function(){
     var value = this.get("value");
     this._getArea().val(value);
     this._setAreaHeight();
     observer.trigger(this,"value",this.element.value);
 };
Пример #11
0
 this._element.on('click', function () {
     observer.trigger(self, 'click');
 });
Пример #12
0
 self._backBtnEvt = observer.addDomListener(backButtonElement, 'click', function () {
     observer.trigger(self, 'backButtonClick');
     self.hide();
 });