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

📄 timespan.js

📁 国内开发的javascript框架应用。龙博javascript。
💻 JS
📖 第 1 页 / 共 2 页
字号:
Class('linb.Com.TimeSpan', 'linb.Com',{    Instance:{        //target time span        iniFrom: '',//'2008-01-16T08:00Z',        iniTo: '',//'2008-01-16T10:00Z',        //target timezone '+0830'        timezone:'',        txtOK:'OK',        txtCancel:'Cancel',        //task caption        taskTitle:'time span',//'task title',                showCommandPanel:true,        //text information        txtInfo:'',//'info',        txtFrom:'',//'from',        txtTo:'',//'to',        txtTZ:'',//'timezone',        //small time range        timeMinUnit:'h',        timeMinCount:0,//2,        timeMaxUnit:'ww',        timeMaxCount:0,//4,        //big time range        timeStart:'',//"2008-01-16T00:00Z",        timeEnd:'',//"2008-01-18T00:00Z",                //getUIvalue actually        getValue:function(){            var ns=this,                date=linb.Date,                v=ns.timeline.getUIValue(),                tz=ns._timezone,                uv=v.split(":");            return [date.offsetTimeZone(new Date(parseInt(uv[0])),tz,true), date.offsetTimeZone(new Date(parseInt(uv[1])),tz,true)];        },        setValue:function(iniFrom, iniTo, force){            var ns=this,                timeline=ns.timeline,                tz=ns._timezone,                date=linb.Date,                aj,                key = force===false?'setUIValue':'setValue';            //set min/max time range first            if(ns.timeEnd)                ns._timeEnd = date.offsetTimeZone(date.parse(ns.timeEnd), tz);            if(ns.timeStart)                ns._timeStart = date.offsetTimeZone(date.parse(ns.timeStart), tz);            //adjust time here            aj = ns._adjustTime(iniFrom, iniTo);            iniFrom=aj[1];            iniTo=aj[2];            var a=date.offsetTimeZone(iniFrom, tz),                b=date.offsetTimeZone(iniTo, tz)            ;                if(a && b && !self.$lock){                    self.$lock=1;                    timeline[key](a.getTime()+":"+b.getTime(),true);                    if(ns._timeEnd)                        timeline.setMaxDate(ns._timeEnd);                    if(ns._timeStart)                        timeline.setMinDate(ns._timeStart);                    ns.dateFrom[key](date.getTimSpanStart(a,'d').getTime(),true);                    ns.dateTo[key](date.getTimSpanStart(b,'d').getTime(),true);                    ns.timeFrom[key](date.get(a,'h')+':'+date.get(a,'n'), true);                    ns.timeTo[key](date.get(b,'h')+':'+date.get(b,'n'), true);                    _.asyRun(function(){                        timeline.visibleTask();                    });                    self.$lock=0;                }        },        setTimezone:function(tz){            var ns=this,                date=linb.Date,                uv=ns.timeline.getUIValue(),                a,b,                old=ns._timezone;            ns._timezone=ns._getTimezone(ns.timezone=tz);            if(uv){                uv=uv.split(':');                ns.setValue(date.offsetTimeZone(new Date(parseInt(uv[0])),old,true), date.offsetTimeZone(new Date(parseInt(uv[1])),old,true), false);            }        },        required:["linb.UI.TimeLine","linb.UI.ComboInput","linb.UI.Button","linb.UI.Pane","linb.UI.PopMenu"],        events:{            onReady:"_on",            afterIniComponents:'_ai'        },        refreshUI:function(){            this._ai();            this._on();        },        _ai:function(){            _.tryF(this.onIniTimeLine,[this.timeline],this);        },        _on:function(){            var ns=this,                date=linb.Date,t,a,b,reg=/\./g,                wrap=function(s){return linb.wrapRes('date.TIMEZONE.'+s)};            ns.divFrom.setHtml(ns.txtFrom);            ns.divTo.setHtml(ns.txtTo);            if(!ns.showCommandPanel)                ns.panelCmd.setDisplay('none');            if(ns.txtInfo)                ns.divInfo.setDisplay('').setHtml(ns.txtInfo);            ns.divTZ.setHtml(ns.txtTZ);            ns.timeline.setDftTaskName(ns.taskTitle);            ns.cmdOK.setCaption(ns.txtOK);            ns.cmdCancel.setCaption(ns.txtCancel);            ns.cbiTZ.setValue(ns.timezone,true);            //ini timezone            ns._timezone=ns._getTimezone(ns.timezone);            if(ns.iniFrom && ns.iniTo)                ns.setValue(date.parse(ns.iniFrom), date.parse(ns.iniTo));            t=[];            _.arr.each(date.$TIMEZONE,function(o,i){                a=null;                if(o.sub){                    a=[];                    _.arr.each(o.sub,function(v,j){                        a[a.length]={id:j, value:v.v, caption: (v.v?v.v+' -- ':'') + wrap(v.id.replace(reg,'_'))};                    })                }                t[t.length]={id:i, caption: wrap(o.id),sub:a};            });            ns.tzpop.setItems(t);            if(!ns.timezone)                ns.timezone=(function(){                    var d=((new Date).getTimezoneOffset()/60),                        i=parseInt(d),                        v=Math.abs(i)!==i,                        j=(d-i)*60;                    i=Math.abs(i);                    return (v?'+':'-') + (i<=9?'0'+i:i) + (j<9?'0'+j:j);                })();        },        iniComponents:function(){            // [[code created by jsLinb UI Builder            var host=this, children=[], append=function(child){children.push(child.get(0))};                        append((new linb.UI.PopMenu)                .host(host,"tzpop")                .setItems([])                .onMenuSelected("_pop")            );                        append((new linb.UI.Pane)                .host(host,"panelMain")                .setWidth(410)                .setHeight('auto')                .setCustomStyle({"KEY":"padding-top:5px;"})            );                        host.panelMain.append((new linb.UI.Div)                .host(host,"divInfo")                .setWidth(390)                .setHeight(30)                .setDisplay('none')                .setPosition("relative")                .setCustomStyle({KEY:'text-align:center;font-weight:bold;'})            );                        host.panelMain.append((new linb.UI.TimeLine)                .host(host,"timeline")                .setHeight(129)                .setWidth(390)                .setItems([])                .setPosition("relative")                .setTabindex("2")                .setLeft("10")                .beforeUIValueSet("_5")            );                        host.panelMain.append((new linb.UI.Pane)                .host(host,"panel61")                .setWidth(400)                .setHeight(61)                .setTabindex("4")                .setPosition("relative")            );                        host.panel61.append((new linb.UI.ComboInput)                .host(host,"cbiTZ")                .setItems([])                .setType("popbox")                .setReadonly(true)                .setLeft(60)                .setTop(30)                .setWidth(340)                .onClickButton("_clc")            );                        host.panel61.append((new linb.UI.ComboInput)                .host(host,"timeFrom")                .setLeft(166)                .setTop(4)                .setWidth(48)                .setItems([])                .setType("timepicker")                .beforeUIValueSet("_3")            );                        host.panel61.append((new linb.UI.ComboInput)                .host(host,"dateFrom")                .setLeft(61)                .setTop(4)                .setItems([])                .setType("datepicker")                .setWidth(104)                .beforeUIValueSet("_4")            );                        host.panel61.append((new linb.UI.Div)                .host(host,"divFrom")                .setLeft(4)                .setTop(7)                .setWidth(53)

⌨️ 快捷键说明

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