⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 index.js

📁 国内开发的javascript框架应用。龙博javascript。
💻 JS
📖 第 1 页 / 共 3 页
字号:
        },        hideFrm:function(){            delete SPA.$frmBg;            delete SPA.$frmId;            SPA.iBGFrm.setValue('#FFFFFF',true)            _.resetRun('$imgvisible',function(){SPA.imgBig.setDisplay('')});            if(SPA.frm) SPA.frm.hide();        },        showCrop:function(){            var crop;            if(!(crop=SPA.crop)){                crop=SPA.crop=linb.create('div').css({zIndex:1001,left:0,top:0,width:'100px',height:'100px',position:'absolute',border:'solid 1px #00ff00'});                crop.addResizer({                    forceVisible : true,                    forceMovable : true,                    minHeight : 10,                    minWidth : 10,                    maxWidth : 800,                    maxHeight : 800,                    handlerSize : 6                },function(profile,target,size,pos){                    profile.box.onUpdate(profile,target,size,pos);                });                linb('panePic').append(crop);            }            crop.cssRegion({left:0,top:0,width:100,height:100});        },        hideCrop:function(){            if(SPA.crop) SPA.crop.hide();        },        showText:function(){            var AddText;            if(!(AddText=SPA.AddText)){                AddText=SPA.AddText=new linb.UI.Input({                    multiLines:true,                    resizer:true                }).setCustomStyle({                    BORDER:'background:transparent',                    INPUT:'background:transparent'                })                linb('panePic').append(AddText);                _.asyRun(function(){                    var resizer = AddText.getSubNode('BORDER').$getResizer();                    _.merge(resizer.get(0).properties,{                        forceVisible : true,                        forceMovable : true,                        minHeight : 10,                        singleDir: true,                        minWidth : 10,                        maxWidth : 800,                        maxHeight : 800,                        handlerSize : 8                    },'all');                    resizer.refreshDom();                },100);                SPA.AddText.getSubNode('INPUT').css({fontSize:'32px',color:'#FFFF00',fontFamily:SPA.$fontFamily||''});            }            AddText.setLeft(0).setTop(0).setWidth(300).setHeight(100).setValue('freedom');        },        hideText:function(){            if(SPA.AddText) SPA.AddText.hide();        },        _btnsave_click:function(){            var id='ifr_for_download';            if(!linb.Dom.byId(id))                linb('body').append(linb.create('<iframe id="'+id+'" name="'+id+'" style="display:none;"/>'));            var hash=_.copy(SPA.paras);            hash.action='download';            linb.Dom.submit(CONF.service, {key:'ImgProcess',para:hash}, 'get', id);        },        _btnupload_click:function (profile, e, src) {            linb.ComFactory.getCom('uploader',function(){                if(!SPA.com_uploader){                    var o=SPA.com_uploader=this.getUIComponents();                    linb('body').append(o);                }                var callback=function(rsp){                    SPA.stack.setValue('files',true);                    SPA.ilPhoto.insertItems([rsp.data],null,false);                    SPA.ilPhoto.fireItemClickEvent(rsp.data.id);                    SPA.ilHistory.clearItems().setTag(rsp.data.filename);                    SPA.popMsg(linb.getRes('app.message.uploadOK'));                };                this.onUpload=function(file){                    var hash={action:"upload", sessionname:SPA.paras.sessionname};                    SPA.request1(hash,callback, file);                    SPA.com_uploader.hide();                };                this.onOpenWeb=function(url){                    var hash={action:"openweb", sessionname:SPA.paras.sessionname,url:url};                    SPA.request1(hash,callback);                    SPA.com_uploader.hide();                };                var root=SPA.com_uploader.getRoot(),                    s1=root.cssSize(),                    s2=linb(src).cssSize();                root                .popToTop(src,4)                .setBlurTrigger(_(), function(){                    SPA.com_uploader.hide();                })            });        },        base:[],        required:["linb.UI.Pane", "linb.UI.Link", "linb.UI.Div", "linb.UI.ComboInput", "linb.UI.Tabs", "linb.UI.Button", "linb.UI.Image", "linb.UI.Dialog", "linb.UI.IconList", "linb.UI.Panel", "linb.UI.Range", "linb.UI.Stacks"],        _showpopmenu:function(src,type,id){            var aysid='__'+id, key='com_'+id;            if(type=='mouseover'){                _.resetRun(aysid,null);                if(!SPA[key]){                    var items=[],                        set=linb.getRes('app.'+id);                    _.each(set,function(o,i){                        items.push({id:i,caption:'$app.'+id+'.'+i});                    });                    var o=SPA[key]=new linb.UI.PopMenu({                        autoHide:true,                        items:items                    }).render(true);                    o.getRoot().onMouseover(function(){                        _.resetRun(aysid,null);                    })                    .onMouseout(function(){                        _.resetRun(aysid,function(){                            SPA[key].hide();                        });                    });                    o.onMenuSelected(function (profile, item, src) {                        var hash=_.copy(SPA.paras);                        hash.action=item.id;                        SPA.request2(hash);                    });                }                SPA[key].pop(src);            }else{                if(SPA[key])                    _.resetRun(aysid,function(){                        SPA[key].hide();                    });            }        },        _btnrot_beforehovereffect:function (profile, item, e, src, type) {            this._showpopmenu(src,type,'rotation');        },        _btnmir_beforehovereffect:function (profile, item, e, src, type) {            this._showpopmenu(src,type,'mirror');        },        _btnfilter_beforehovereffect:function (profile, item, e, src, type) {            this._showpopmenu(src,type,'filter');        },        _btnone_beforehovereffect:function (profile, item, e, src, type) {            this._showpopmenu(src,type,'onecolor');        },        _showFontFamily:function(src,type,id){            var aysid='__'+id, key='com_'+id;            if(type=='mouseover'){                _.resetRun(aysid,null);                if(!SPA[key]){                    var o=SPA[key]=new linb.UI.List({                        items:SPA.$fontFamilies,                        width:'480'                    }).render(true);                    o.getRoot().onMouseover(function(){                        _.resetRun(aysid,null);                    })                    .onMouseout(function(){                        _.resetRun(aysid,function(){                            SPA[key].hide();                        });                    });                    o.onItemSelected(function(profile, item, src) {                        SPA[key].hide();                        SPA.$fontFamily=item.caption;                        SPA.AddText.getSubNode('INPUT').css('fontFamily',SPA.$fontFamily);                        SPA.divFont.setHtml('<img style="border:solid 1px #ccc;cursor:pointer;" src='+item.path+' alt='+item.caption + '/>');                    });                }                SPA[key].getRoot().popToTop(src);            }else{                if(SPA[key])                    _.resetRun(aysid,function(){                        SPA[key].hide();                    });            }        },        _divfont_mover:function(profile, e, src){            SPA._showFontFamily(src,'mouseover','fontfamily');        },        _divfont_mout:function(profile, e, src){            SPA._showFontFamily(src,'mouseout','fontfamily');        },        _fontsize_us:function (profile, o, v) {            if(SPA.AddText)SPA.AddText.getSubNode('INPUT').css('fontSize',v+'px');        },        _cifontcolor_beforeuivalueset:function (profile, oldValue, newValue) {            if(SPA.AddText)SPA.AddText.getSubNode('INPUT').css('color',newValue);        },        _btnaddtext_onclick:function(profile){            var  hash=_.copy(SPA.paras);            hash.action='writetext';            hash.text=SPA.AddText.getUIValue();            hash.fontcolor=linb.UI.ColorPicker.hex2rgb(SPA.ciFontColor.getUIValue()).join(',');            hash.x=SPA.AddText.getLeft();            hash.fontsize=SPA.ciFontSize.getUIValue();            hash.fontfile=SPA.$fontFamily;            hash.y=SPA.AddText.getTop() + Number(hash.fontsize);            SPA.hideText();            SPA.request2(hash,function(){                SPA.AddText.getSubNode('INPUT').css({fontSize:'32px',color:'#FFFF00'});                SPA.AddText.setLeft(0).setTop(0).setWidth(300).setHeight(100);                SPA.ciFontSize.setValue('32',true);                SPA.ciFontColor.setValue('#FFFF00',true);                SPA.showText();            });        },        _crop_onclick:function(profile){            var img=SPA.imgBig.getRoot(),                hash=_.copy(SPA.paras);            hash.action='cut';            var o=SPA.crop;                reg=o.cssRegion();            _.merge(hash, reg);            SPA.hideCrop();            SPA.request2(hash,function(){                SPA.showCrop();            });        },        _resize_onclick:function(profile){            var img=SPA.imgBig.getRoot(),                w=img.attr('width'),                h=img.attr('height'),                hash=_.copy(SPA.paras);            if(w!==SPA.$width||h!=SPA.$height){                hash.action='resize';                hash.width=w;                hash.height=h;                SPA.request2(hash);            }        },        popMsg:function(msg){            var dlg=linb.UI.Dialog.pop(msg);            _.asyRun(function(){                if(dlg.getRoot())dlg.destroy();                dlg=null;            },3000);        },        request1:function(hash, callback, file){            linb.Thread.observableRun(function(threadid){                var data={key:'ImgProcess',para:hash}, options;                if(file){                    data.file=file;                    options={method:'post'};                }                linb.request(CONF.service, data, function(rsp){                    var obj;                    if(typeof rsp=='string')                        obj=_.unserialize(rsp);                    else obj=rsp;                    if(obj){                        if(!obj.error)                            _.tryF(callback,[obj]);                        else                            SPA.popMsg(_.serialize(obj.error));                    }else                        SPA.popMsg(_.serialize(rsp));                },function(rsp){                    SPA.popMsg(_.serialize(rsp));                }, threadid,options)            });        },        request2:function(hash, callback){            linb.Thread.observableRun(function(threadid){                linb.request(CONF.service, {key:'ImgProcess',para:hash}, function(rsp){                    if(typeof rsp=='string')rsp=_.unserialize(rsp);                    if(rsp.error)                        SPA.popMsg(_.serialize(rsp.error));                    else{                        //another file                        var tag=SPA.ilHistory.getTag();                        if(SPA.paras.filename != tag){                            SPA.ilHistory                            .clearItems()                            .setTag(SPA.paras.filename);                        }                        //removes the history first                        var il=SPA.ilHistory,                            items=il.getItems(),                            b=false,arr=[];                        _.each(items, function(o,i){                            if(b)arr.push(o.id)                            if(o.id==SPA.paras.tag)b=true;                        });                        il.removeItems(arr);                        //add first for origin                        if(SPA.paras.origin){                            var obj=_.copy(SPA.paras);                            obj.origin=obj.tag=SPA.paras.origin;                            if(SPA.ilHistory.getItems().length===0)                                SPA.ilHistory.setItems([{id:obj.tag, image: SPA.imgBig.getSrc(),  _obj:obj}]);                            delete SPA.paras.origin;                        }                        //set momery paras                        SPA.paras.logindate=rsp.data.logindate;                        SPA.paras.tag=rsp.data.tag;                        SPA.imgBig.setSrc(rsp.data.url);                        //add to history                        il.insertItems([{id:SPA.paras.tag, image: rsp.data.url, _obj:_.copy(SPA.paras)}], null, false);                        //clear dirty mark                        il.setValue(null,true);                        _.tryF(callback,[rsp]);                    }                },function(rsp){                    linb.message(rsp);                }, threadid);            });        },        _rangecon_afteruivalueset:function (profile, oldValue, newValue) {           var hash=_.copy(SPA.paras);           hash.action='filter_contrast';           hash.value=Number(newValue.split(':')[1]);           SPA.request2(hash,function(){profile.boxing().setValue('-100:0',true)});        },        _rangebri_afteruivalueset:function (profile, oldValue, newValue) {           var hash=_.copy(SPA.paras);           hash.action='filter_brightness';           hash.value=Number(newValue.split(':')[1]);           SPA.request2(hash,function(){profile.boxing().setValue('-100:0',true)});        },        _button12_onclick:function (profile, e, src, value) {            if(!SPA.$iconId)return;            var hash=_.copy(SPA.paras);            hash.action="avatar";            hash.value=SPA.$iconId;            var reg=SPA.icon.cssRegion();            hash.x=reg.left;            hash.y=reg.top;            hash.width=reg.width;            hash.height=reg.height;            SPA.request2(hash,function(){SPA.hideIcon()});        },        _button13_onclick:function (profile, e, src, value) {            if(!SPA.$frmId)return;            var hash=_.copy(SPA.paras);            hash.action="modern_frame";            hash.value=SPA.$frmId;            hash.background=SPA.$frmBg;            hash.x=SPA.frm.$left;            hash.y=SPA.frm.$top;            hash.width=linb('imgBig').width();            hash.height=linb('imgBig').height();            SPA.request2(hash, function(){SPA.hideFrm()});        }    }});

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -