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 相关文章推荐
Jquery插件 easyUI属性汇总
Jan 19 Javascript
JSON.stringify转换JSON时日期时间不准确的解决方法
Aug 08 Javascript
thinkphp 表名 大小写 窍门
Feb 01 Javascript
JS动态日期时间的获取方法
Sep 28 Javascript
基于JQuery打造无缝滚动新闻步骤详解
Mar 31 Javascript
Javascript中内建函数reduce的应用详解
Oct 20 Javascript
SVG描边动画
Feb 23 Javascript
利用jquery如何从json中读取数据追加到html中
Dec 01 jQuery
微信小程序使用map组件实现检索(定位位置)周边的POI功能示例
Jan 23 Javascript
「中高级前端面试」JavaScript手写代码无敌秘籍(推荐)
Apr 08 Javascript
layer父页获取弹出层输入框里面的值方法
Sep 02 Javascript
Vue中foreach数组与js中遍历数组的写法说明
Jun 05 Vue.js
非常不错的一个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
这部番真是良心,画质好到像风景区,剧情让人跟着小公会热血沸腾
2020/03/10 日漫
PHP4引用文件语句的对比
2006/10/09 PHP
PHP If Else(elsefi) 语句
2013/04/07 PHP
ECSHOP完美解决Deprecated: preg_replace()报错的问题
2016/05/17 PHP
php中strlen和mb_strlen用法实例分析
2016/11/12 PHP
Laravel 读取 config 下的数据方法
2019/10/13 PHP
TP5框架简单登录功能实现方法示例
2019/10/31 PHP
Add Formatted Data to a Spreadsheet
2007/06/12 Javascript
javascript控制frame,iframe的src属性代码
2009/12/31 Javascript
JavaScript日期时间格式化函数分享
2014/05/05 Javascript
node.js不得不说的12点内容
2014/07/14 Javascript
Javascript Memoizer浅析
2014/10/16 Javascript
浅谈Sticky组件的改进实现
2016/03/22 Javascript
AngularJS 获取ng-repeat动态生成的ng-model值实例详解
2016/11/29 Javascript
jquery,js简单实现类似Angular.js双向绑定
2017/01/13 Javascript
Angular多选、全选、批量选择操作实例代码
2017/03/10 Javascript
Bootstrap布局之栅格系统学习笔记
2017/05/04 Javascript
从零开始最小实现react服务器渲染详解
2018/01/26 Javascript
浅谈Webpack 持久化缓存实践
2018/03/22 Javascript
Vue路由钩子之afterEach beforeEach的区别详解
2018/07/15 Javascript
Vue.js中 v-model 指令的修饰符详解
2018/12/03 Javascript
深入理解react 组件类型及使用场景
2019/03/07 Javascript
vue实现商品列表的添加删除实例讲解
2020/05/14 Javascript
Vue在H5 项目中使用融云进行实时个人单聊通讯
2020/12/14 Vue.js
js实现Element中input组件的部分功能并封装成组件(实例代码)
2021/03/02 Javascript
Python命令行参数解析模块optparse使用实例
2015/04/13 Python
使用Python的Tornado框架实现一个Web端图书展示页面
2016/07/11 Python
Python如何快速实现分布式任务
2017/07/06 Python
多个应用共存的Django配置方法
2018/05/30 Python
Python中format()格式输出全解
2019/04/12 Python
计算机二级python学习教程(1) 教大家如何学习python
2019/05/16 Python
Django-rest-framework中过滤器的定制实例
2020/04/01 Python
Html+Css+Jquery实现左侧滑动拉伸导航菜单栏的示例代码
2020/03/17 HTML / CSS
草莓网中国:StrawberryNet中国
2020/08/17 全球购物
Java 中访问数据库的步骤?Statement 和PreparedStatement 之间的区别?
2012/06/05 面试题
冰峪沟导游词
2015/02/09 职场文书