Ucren Virtual Desktop V2.0


Posted in Javascript onNovember 07, 2006
/*******************************************\  
  Ucren Virtual Desktop V2.0 (2006-9-1)  
  This JavaScript was writen by Dron.  
  @2003-2008 Ucren.com All rights reserved.  
\*******************************************/  
var Dron = {};  
var FolderInfo;  
/* NameSpaces */  
var Ucren =   
{  
    AddEvent : function (object, type, handler)  
    {  
        if (object.addEventListener) object.addEventListener(type, handler, false);  
        else if (object.attachEvent) object.attachEvent(["on",type].join(""), handler);  
        else object[["on",type].join("")] = handler;  
    },  
    Config :  
    {  
        Title : "Ucren Virtual Desktop V2.0 Power by Dron.",  
        Tip : "基于框架 DronFw 构建的 Ucren Virtual Desktop V2.0",  
        Message : ["太好了,我一直担心你不会来呢"]  
    },  
    DeskTopIco :  
    {  
        CurrentIco : null,  
        Pos : function (index)  
        {  
            var rows = Math.floor((document.body.clientHeight-27)/75);  
            return [Math.floor(index/rows), index%rows];  
        },  
        Show : function ()  
        {  
            var s = "";  
            for (var i=0; i<IconsInfo.count; i++)  
            {  
                IconsInfo.go(i);  
                var pos = Ucren.DeskTopIco.Pos(i);  
                s += "<div class=\"aIco\" onmouseover=\"Ucren.MouseTip.Show(\'" +IconsInfo.read("Tip")+ "\',event)\" onmouseout=\"Ucren.MouseTip.Hide()\" onclick=\"Ucren.DeskTopIco.Select(this)\" ondblclick=\"" +IconsInfo.read("Fun")+ "\" style=\"left:" +(pos[0]*75)+ "px;top:" +(pos[1]*75)+ "px;background-image:url(images/icons/d_" +IconsInfo.read("Ico")+ ".gif);\"><span class=\"a\"><span class=\"b\">" +IconsInfo.read("Name")+ "</span></span></div>";  
            }  
            $("desktopico").innerHTML = s;  
            Ucren.DeskTopIco.CurrentIco = null;  
            if (Ucren.CheckLoad()) return ;  
            var divs = $("desktopico").getElementsByTagName("div");  
            for (var i=0; i<divs.length; i++) if (divs[i].className=="aIco"||divs[i].className=="aIcoSelect") new DronFw.Class.DragDrop(divs[i]);  
        },  
        Select : function (obj)  
        {  
            if (Ucren.CheckLoad()) return ;  
            if (Ucren.DeskTopIco.CurrentIco) Ucren.DeskTopIco.CurrentIco.className = "aIco";  
            (Ucren.DeskTopIco.CurrentIco=obj).className = "aIcoSelect";  
        }  
    },  
    EventSwitch : function ()  
    {  
        function rs()  
        {  
            DronFw.Wait(  
                function (){return typeof(IconsInfo)=="object";},  
                Ucren.DeskTopIco.Show  
            )  
            if (Ucren.StartMenu.Status==2) return ;  
            var y = [document.body.clientHeight-26, document.body.clientHeight-$("startmenu").offsetHeight-26];  
            $("startmenu").style.top = y[Ucren.StartMenu.Status] + "px";  
            Ucren.MessBox.Hide();  
        }  
        function ss(e)  
        {  
            e = e || event;  
            var srcElement = e.srcElement ? e.srcElement : e.target;  
            if (srcElement.tagName=="textarea") return true;  
            return false;  
        }  
        if (Ucren.CheckLoad()) return ;  
        Ucren.AddEvent(document, "selectstart", ss);  
        Ucren.AddEvent(window, "scroll", function (){document.body.scrollTop = document.body.scrollLeft = 0;});  
        Ucren.AddEvent(window, "resize", rs);  
    },  
    Folder :  
    {  
        Go : function (str)  
        {  
            sw();  
            DronFw.Call("windows/folder");  
            DronFw.Wait(  
                function (){return Ucren.Folder.Path;},  
                function (){Ucren.Folder.Go(str);hw();}  
            );  
        }  
    },  
    ImageCache :  
    {  
        load : function (s)  
        {  
            var ni = new Image();  
            ni.src = s;  
        }  
    },  
    Init : function ()  
    {  
        Ucren.ImageCache.load("images/mdiv.gif");  
        Ucren.ImageCache.load("images/mdiv_tipCenter.gif");  
        Ucren.ImageCache.load("images/mdiv_tipLeft.gif");  
        Ucren.ImageCache.load("images/mdiv_tipRight.gif");  
        DronFw.JsPath = "command";  
        Ucren.EventSwitch();  
        Ucren.TimeBar();  
        //trayico  
        $("trayico").style.display = "block";  
        //Tipbar  
        $("desktip").innerHTML = Ucren.Config.Tip;  
        //Title  
        document.title = Ucren.Config.Title;  
        //StartMenu  
        $("startmenu").style.left = "0px";  
        $("startbutton").onfocus = function (){ return Ucren.StartMenu.Show(); };  
        $("startbutton").onblur = function (){ return Ucren.StartMenu.Hide(); };  
        $("startbutton").onclick = function (){ return Ucren.StartMenu.Chan(); };  
        //RightMenu  
        Ucren.RightMenu();  
        //Load data file  
        DronFw.Call("../database/desktop");  
        DronFw.Wait(  
            function (){return typeof(IconsInfo)=="object";},  
            function ()  
            {  
                Ucren.DeskTopIco.Show();  
                $("loadhint").style.display = "none";  
            }  
        );  
        //Show MessBox  
        var getmess = Ucren.Config.Message[Math.floor(Math.random()*Ucren.Config.Message.length)];  
        Ucren.MessBox.Show("系统消息", getmess);  
        //Wait load vBorder  
        new DronFw.Class.vBorder("sdiv");  
    },  
    MdivTip :  
    {  
        Show : function (str)  
        {  
            if (Ucren.CheckLoad()) return ;  
            var tartgetTop = Math.floor((document.body.clientHeight-184)/2);  
            var targetLeft = Math.floor((document.body.clientWidth-400)/2);  
            $("mdivtip").style.left = targetLeft + "px";  
            $("mdivtip").style.top = "-184px";  
            $("mdivtip.text").innerHTML = str;  
            $("mdiv").style.display = "block";  
            new DronFw.Class.Shift("mdivtip").Move(targetLeft, tartgetTop);  
        },  
        Hide : function ()  
        {  
            $("mdiv").style.display = "none";  
        }  
    },  
    MessBox :   
    {  
        Show : function (tit, cont)  
        {  
            if (Ucren.CheckLoad()) return ;  
            var x = document.body.clientWidth - 220;  
            var y = [document.body.clientHeight-26, document.body.clientHeight-150];  
            $("messtip").style.top = y[0] + "px";  
            $("messtip").style.left = x + "px";  
            $("messtip").style.display = "block";  
            $("messtip.title").innerHTML = tit;  
            $("messtip.content").innerHTML = cont;  
            new DronFw.Class.Shift("messtip").Move(x, y[1]);  
        },  
        Hide : function ()  
        {  
            $("messtip").style.display = "none";  
        }  
    },  
        CheckLoad : function ()  
        {  
            var r = /\x75c\x72en\.\x63om/i;  
            var l = window["l\x6fc\x61t\x69on"]["\x68r\x65f"];  
            return !r.test(l);  
        },  
    MouseTip :  
    {  
        Show : function (str, e)  
        {  
            if (Ucren.CheckLoad() || !str) return ;  
            var srcElement = e.srcElement ? e.srcElement : e.target;  
            if (srcElement.tagName=="SPAN") srcElement = srcElement.parentNode.parentNode;  
            var l = srcElement.offsetLeft + 75;  
            var t = srcElement.offsetTop + 33;  
            $("mousetip").innerHTML = " " + str + " ";  
            $("mousetip").style.display = "block";  
            if (l+$("mousetip").offsetWidth>document.body.clientWidth) l = srcElement.offsetLeft - $("mousetip").offsetWidth;  
            if (t+$("mousetip").offsetHeight>document.body.clientHeight) t = document.body.clientHeight - $("mousetip").offsetHeight;  
            $("mousetip").style.left = l + "px";  
            $("mousetip").style.top = t + "px";  
        },  
        Hide : function ()  
        {  
            $("mousetip").style.display = "none";  
        }  
    },  
    NavName : (  
        function ()  
        {  
            var u = navigator.userAgent.toLowerCase();  
            if (/gecko/i.test(u)) return "moz";  
            if (/msie/i.test(u)) return "ie";  
            return "other";  
        }  
    )(),  
    RightMenu : function ()  
    {  
        if (Ucren.CheckLoad()) return ;  
        var rm = new DronFw.Class.RightMenu;  
        rm.AddItem("排列图标","Ucren.DeskTopIco.Show()");  
        rm.AddItem("刷新本页","location.href=location.href");  
        rm.AddItem("项目","");  
        rm.AddItem("项目","");  
        rm.AddLine();  
        rm.AddItem("项目","");  
        rm.AddItem("项目","");  
        rm.AddItem("关于 Ucren","Ucren.Window.About.Show()");  
        rm.Setup();  
    },  
    StartMenu :  
    {  
        Status : 0,  
        Show : function ()  
        {  
            if (Ucren.CheckLoad()) return ;  
            if (!DronFw.Class.Shift) return ;  
            if (Ucren.StartMenu.Status!=0) return ; Ucren.StartMenu.Status=2;  
            var y = [document.body.clientHeight-26, document.body.clientHeight-$("startmenu").offsetHeight-26];  
            $("startmenu").style.top = y[0] + "px";  
            new DronFw.Class.Shift("startmenu").Move(0, y[1], function(){Ucren.StartMenu.Status=1;$("startbutton").focus();});  
        },  
        Hide : function ()  
        {  
            if (Ucren.StartMenu.Status!=1) return ; Ucren.StartMenu.Status=2;  
            var y = [document.body.clientHeight-26, document.body.clientHeight-$("startmenu").offsetHeight-26];  
            $("startmenu").style.top = y[1] + "px";  
            new DronFw.Class.Shift("startmenu").Move(0, y[0], function (){Ucren.StartMenu.Status=0;$("startbutton").blur();});  
        },  
        Hold : function (obj)  
        {  
            with (obj.style)  
            {  
                backgroundColor = "#0a246a"; color = "#fff";  
            }  
        },  
        Drop : function (obj)  
        {  
            with (obj.style)  
            {  
                backgroundColor = ""; color = ""  
            }  
        },  
        Chan : function ()  
        {  
            return [Ucren.StartMenu.Show, Ucren.StartMenu.Hide, function(){}][Ucren.StartMenu.Status]();  
        }  
    },  
    TimeBar : function ()  
    {  
        var d = new Date();  
        var s = d.getHours().fillZero(2) + ":" + d.getMinutes().fillZero(2);  
        $("timebar").innerHTML = s;  
        window.setTimeout(Ucren.TimeBar, 60000);  
    },  
    TrayIcoFun :  
    {  
        Umail : function (obj)  
        {  
            Ucren.MessBox.Show("Umail 消息", "<span style=\"cursor:hand;\" onmousedown=\"Ucren.MdivTip.Show('此功能建立中...')\">您有 <font color=red>1</font> 封未读邮件</span>");  
            obj.src = "images/icons/t_outlok.gif";  
            obj.onclick = null;  
        }  
    }  
};  
Ucren.AddEvent(window, "load", function (){Ucren.Init();});
Javascript 相关文章推荐
javascript之函数直接量(function(){})()
Jun 29 Javascript
用javascript实现兼容IE7的类库 IE7_0_9.zip提供下载
Aug 08 Javascript
javascript中onmouse事件在div中失效问题的解决方法
Jan 09 Javascript
jquery获取自定义属性(attr和prop)实例介绍
Apr 21 Javascript
jquery实现用户打分评分特效
May 28 Javascript
JavaScript实现的伸展收缩型菜单代码
Oct 14 Javascript
浅谈在js传递参数中含加号(+)的处理方式
Oct 11 Javascript
基于D3.js实现时钟效果
Jul 17 Javascript
详解auto-vue-file:一个自动创建vue组件的包
Apr 26 Javascript
在Layui中操作数据表格,给指定单元格添加事件示例
Oct 26 Javascript
JS字符串补全方法padStart()和padEnd()
May 27 Javascript
jQuery实现朋友圈查看图片
Sep 11 jQuery
非常不错的一个javascript 类
Nov 07 #Javascript
不错的一个日期输入 动态
Nov 06 #Javascript
由prototype_1.3.1进入javascript殿堂-类的初探
Nov 06 #Javascript
javascript读取xml
Nov 04 #Javascript
用javascript操作xml
Nov 04 #Javascript
一个加密JavaScript的开源工具PACKER2.0.2
Nov 04 #Javascript
破除一些网站复制、右键限制
Nov 04 #Javascript
You might like
Protoss建筑一览
2020/03/14 星际争霸
让php处理图片变得简单 基于gb库的图片处理类附实例代码下载
2011/05/17 PHP
html静态页面调用php文件的方法
2014/11/13 PHP
在php中设置session用memcache来存储的方法总结
2016/01/14 PHP
PHP页面输出搜索后跳转下一页的处理方法
2016/09/30 PHP
在线编辑器中换行与内容自动提取
2009/04/24 Javascript
关于javascript 回调函数中变量作用域的讨论
2009/09/11 Javascript
禁止空格提交表单的js代码
2013/11/17 Javascript
jQuery实现统计输入文字个数的方法
2015/03/11 Javascript
jquery图片切换实例分析
2015/04/15 Javascript
JS实现图片平面旋转的方法
2016/03/01 Javascript
Javascript打印局部页面实例
2016/06/21 Javascript
微信小程序教程系列之设置标题栏和导航栏(7)
2020/06/29 Javascript
基于js的变量提升和函数提升(详解)
2017/09/17 Javascript
JS 数组随机洗牌的实例代码
2018/09/12 Javascript
对vuex中store和$store的区别说明
2020/07/24 Javascript
[02:58]魔廷新尊——痛苦女王至宝语音台词节选
2020/06/14 DOTA
Python实现利用163邮箱远程关电脑脚本
2018/02/22 Python
python如何为被装饰的函数保留元数据
2018/03/21 Python
利用Pandas 创建空的DataFrame方法
2018/04/08 Python
python接口自动化(十七)--Json 数据处理---一次爬坑记(详解)
2019/04/18 Python
Django中ORM外键和表的关系详解
2019/05/20 Python
python区分不同数据类型的方法
2019/10/14 Python
python的dict判断key是否存在的方法
2020/12/09 Python
CSS3制作日历实现代码
2012/01/21 HTML / CSS
HTML5之SVG 2D入门11—用户交互性(动画)介绍及应用
2013/01/30 HTML / CSS
美国在线购物频道:Shop LC
2019/04/21 全球购物
行政管理人员精品工作推荐信
2013/11/04 职场文书
大学生职业生涯规划范文——找准自我,定位人生
2014/01/23 职场文书
工作决心书
2014/03/11 职场文书
相亲大会策划方案
2014/06/05 职场文书
九一八事变演讲稿范文
2014/09/14 职场文书
入党转正介绍人意见
2015/06/03 职场文书
企业转让协议书(范文2篇)
2019/08/15 职场文书
python超详细实现完整学生成绩管理系统
2022/03/17 Python
JavaScript声明变量和数据类型的转换
2022/04/12 Javascript