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编程起步(第七课)
Jan 10 Javascript
JSuggest自动匹配下拉框使用方法(示例代码)
Dec 27 Javascript
jquery使用append(content)方法注意事项分享
Jan 06 Javascript
Jquery对象和Dom对象的区别分析
Nov 20 Javascript
JavaScript实现获取dom中class的方法
Feb 09 Javascript
元素绑定click点击事件方法
Jun 08 Javascript
JS实现带关闭功能的阿里妈妈网站顶部滑出banner工具条代码
Sep 17 Javascript
jQuery插件编写步骤详解
Jun 03 Javascript
jquery根据td给相同tr下其他td赋值的实现方法
Oct 05 Javascript
原生JavaScript来实现对dom元素class的操作方法(推荐)
Aug 16 Javascript
详解vue中组件参数
Jul 09 Javascript
在vue中多次调用同一个定义全局变量的实例
Sep 25 Javascript
非常不错的一个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
虫族 Zerg 历史背景
2020/03/14 星际争霸
php 在线打包_支持子目录
2008/06/28 PHP
php 应用程序安全防范技术研究
2009/09/25 PHP
在字符串指定位置插入一段字符串的php代码
2010/02/16 PHP
php解析xml 的四种简单方法(附实例)
2016/07/11 PHP
PHP实现类似于C语言的文件读取及解析功能
2017/09/01 PHP
php strftime函数的详细用法
2018/06/21 PHP
javascript URL锚点取值方法
2009/02/25 Javascript
JS 参数传递的实际应用代码分析
2009/09/13 Javascript
IE6 弹出Iframe层中的文本框“经常”无法获得输入焦点
2009/12/27 Javascript
Extjs Ext.MessageBox.confirm 确认对话框详解
2010/04/02 Javascript
JavaScript的继承的封装介绍
2013/10/15 Javascript
JavaScript控制table某列不显示的方法
2015/03/16 Javascript
基于javascript显示当前时间以及倒计时功能
2016/03/18 Javascript
用AngularJS的指令实现tabs切换效果
2016/08/31 Javascript
bootstrap table实例详解
2017/01/06 Javascript
Javarscript中模块(module)、加载(load)与捆绑(bundle)详解
2017/05/28 Javascript
JavaScript设计模式之代理模式简单实例教程
2018/07/03 Javascript
原生JavaScript实现remove()和recover()功能示例
2018/07/24 Javascript
vuex页面刷新后数据丢失的方法
2019/01/17 Javascript
vue路由跳转传参数的方法
2019/05/06 Javascript
nodejs制作小爬虫功能示例
2020/02/24 NodeJs
nodejs中内置模块fs,path常见的用法说明
2020/11/07 NodeJs
vue实现滚动鼠标滚轮切换页面
2020/12/13 Vue.js
Python使用urllib2获取网络资源实例讲解
2013/12/02 Python
Python实现全角半角转换的方法
2014/08/18 Python
Python三元运算实现方法
2015/01/12 Python
python脚本监控Tomcat服务器的方法
2018/07/06 Python
Django调用支付宝接口代码实例详解
2020/04/04 Python
医院后勤自我鉴定
2013/10/13 职场文书
食品安全宣传标语
2014/06/07 职场文书
运动会口号大全
2014/06/07 职场文书
村支部书记群众路线对照检查材料思想汇报
2014/10/08 职场文书
申报优秀教师材料
2014/12/16 职场文书
本地通过nginx配置反向代理的全过程记录
2021/03/31 Servers
html用代码制作虚线框怎么做? dw制作虚线圆圈的技巧
2022/12/24 HTML / CSS