Ucren Virtual Desktop V2.0

 更新时间:2006年11月07日 00:00:00   作者:  

复制代码 代码如下:
/*******************************************\ 
  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 = "&nbsp;" + str + "&nbsp;"; 
            $("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();});

相关文章

  • js正则test匹配的踩坑及解决

    js正则test匹配的踩坑及解决

    这篇文章主要为大家介绍了正则test匹配的踩坑示例讲解,有需要的朋友可以借鉴参考下,希望能够有所帮助,祝大家多多进步,早日升职加薪
    2022-07-07
  • JavaScript动态操作表格实例(添加,删除行,列及单元格)

    JavaScript动态操作表格实例(添加,删除行,列及单元格)

    这篇文章主要是对JavaScript动态操作表格实例(添加,删除行,列及单元格)进行了详细的分析介绍,需要的朋友可以过来参考下,希望对大家有所帮助
    2013-11-11
  • SVG实现时钟效果

    SVG实现时钟效果

    这篇文章主要为大家详细介绍了SVG实现时钟效果,具有一定的参考价值,感兴趣的小伙伴们可以参考一下
    2018-07-07
  • JavaScript中高级语法??表达式用法示例详解

    JavaScript中高级语法??表达式用法示例详解

    这篇文章主要为大家介绍了JavaScript中高级语法??表达式用法示例详解,有需要的朋友可以借鉴参考下,希望能够有所帮助,祝大家多多进步,早日升职加薪
    2023-04-04
  • ES6模板字符串和标签模板的应用实例分析

    ES6模板字符串和标签模板的应用实例分析

    这篇文章主要介绍了ES6模板字符串和标签模板的应用,结合实例形式分析了ES6模板字符串和标签模板的功能、原理、用法及相关操作注意事项,需要的朋友可以参考下
    2019-06-06
  • 如何用JS实现简单的数据监听

    如何用JS实现简单的数据监听

    这篇文章主要介绍了如何用JS实现简单的数据监听,对数据监听感兴趣的同学,可以参考一下
    2021-05-05
  • JS实现多物体运动

    JS实现多物体运动

    这篇文章主要为大家详细介绍了JS实现多物体运动,文中示例代码介绍的非常详细,具有一定的参考价值,感兴趣的小伙伴们可以参考一下
    2022-05-05
  • webpack打包js的方法

    webpack打包js的方法

    这篇文章主要介绍了webpack打包js的方法,小编觉得挺不错的,现在分享给大家,也给大家做个参考。一起跟随小编过来看看吧
    2018-03-03
  • 微信小程序开发常见问题及解决方案

    微信小程序开发常见问题及解决方案

    这篇文章主要介绍了微信小程序开发常见问题及解决方案,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友可以参考下
    2019-07-07
  • webpack打包并将文件加载到指定的位置方法

    webpack打包并将文件加载到指定的位置方法

    下面小编就为大家分享一篇webpack打包并将文件加载到指定的位置方法,具有很好的参考价值,希望对大家有所帮助。一起跟随小编过来看看吧
    2018-02-02

最新评论