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 相关文章推荐
数组Array进行原型prototype扩展后带来的for in遍历问题
Feb 07 Javascript
ANT 压缩(去掉空格/注释)JS文件可提高js运行速度
Apr 15 Javascript
JAVASCRIPT模式窗口中下载文件无法接收iframe的流
Oct 11 Javascript
addEventListener()第三个参数useCapture (Boolean)详细解析
Nov 07 Javascript
一个jquery实现的不错的多行文字图片滚动效果
Sep 28 Javascript
js实现跟随鼠标移动且带关闭功能的图片广告实例
Feb 26 Javascript
关于List.ToArray()方法的效率测试
Sep 30 Javascript
微信小程序 location API实例详解
Oct 02 Javascript
jQuery中$.grep() 过滤函数 数组过滤
Nov 22 Javascript
angularjs下ng-repeat点击元素改变样式的实现方法
Sep 12 Javascript
angular4自定义表单控件[(ngModel)]的实现
Nov 23 Javascript
微信小程序图片加载失败时替换为默认图片的方法
Dec 09 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
PHP中冒号、endif、endwhile、endfor使用介绍
2010/04/28 PHP
PHP设置图片文件上传大小的具体实现方法
2013/10/11 PHP
PHP获取MAC地址的具体实例
2013/12/13 PHP
什么是PEAR?什么是PECL?PHP中两个容易混淆的概念解释
2015/07/01 PHP
全面了解PHP中的全局变量
2016/06/17 PHP
laravel-admin select框默认选中的方法
2019/10/03 PHP
浅谈PHP5.6 与 PHP7.0 区别
2019/10/09 PHP
jquery 表格分页等操作实现代码(pagedown,pageup)
2010/04/11 Javascript
Jquery之Ajax运用 学习运用篇
2011/09/26 Javascript
JS和Jquery获取和修改label的值的示例代码
2014/01/15 Javascript
浅谈javascript的调试
2015/01/28 Javascript
原生js和jQuery写的网页选项卡特效对比
2015/04/27 Javascript
js模仿php中strtotime()与date()函数实现方法
2015/08/11 Javascript
JS实现兼容性好,带缓冲的动感网页右键菜单效果
2015/09/18 Javascript
Bootstrap导航栏各元素操作方法(表单、按钮、文本)
2015/12/28 Javascript
node操作mysql数据库实例详解
2017/03/17 Javascript
Vue input控件通过value绑定动态属性及修饰符的方法
2017/05/03 Javascript
bootstrap响应式导航条模板使用详解(含下拉菜单,弹出框)
2017/11/17 Javascript
Linux Centos7.2下安装nodejs&amp;npm配置全局路径的教程
2018/05/15 NodeJs
vux-scroller实现移动端上拉加载功能过程解析
2019/10/08 Javascript
微信小程序缓存支持二次开发封装实现解析
2019/12/16 Javascript
JavaScript/TypeScript 实现并发请求控制的示例代码
2021/01/18 Javascript
Python 中迭代器与生成器实例详解
2017/03/29 Python
用python实现k近邻算法的示例代码
2018/09/06 Python
一篇文章搞懂Python的类与对象名称空间
2018/12/10 Python
python 判断字符串中是否含有汉字或非汉字的实例
2019/07/15 Python
wxpython多线程防假死与线程间传递消息实例详解
2019/12/13 Python
如何使用Python自动生成报表并以邮件发送
2020/10/15 Python
纽约海:Sea New York
2018/11/04 全球购物
成都思必达公司C#程序员招聘面试题
2013/06/26 面试题
最新教师自我评价分享
2013/11/12 职场文书
心理健康日活动总结
2014/05/08 职场文书
高中生毕业评语
2014/12/30 职场文书
教师个人学习总结
2015/02/11 职场文书
遇事可以测出您的见识与格局
2019/09/16 职场文书
Python NumPy灰度图像的压缩原理讲解
2021/08/04 Python