Ucrenvirtual1_topv2.0 _ javascript skills

Source: Internet
Author: User
Ucrenvirtual1_topv2.0 The Code is as follows:

/*************************************** ****\
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: "Ucren Virtual Desktop V2.0 built based on the Framework DronFw ",
Message: ["Great, I have been worried that you will not come."]
},
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. go (I );
Var pos = Ucren. effectopico. Pos (I );
S + ="

"+ IconsInfo. read (" Name ") +"

";
}
$ ("Effectopico"). innerHTML = s;
Ucren. Required topico. CurrentIco = null;
If (Ucren. CheckLoad () return;
Var ps = $ ("desktopico"). getElementsByTagName ("p ");
For (var I = 0; I },
Select: function (obj)
{
If (Ucren. CheckLoad () return;
If (Ucren. effectopico. CurrentIco) Ucren. effectopico. CurrentIco. className = "aIco ";
(Ucren. effectopico. CurrentIco = obj). className = "aIcoSelect ";
}
},
EventSwitch: function ()
{
Function rs ()
{
DronFw. Wait (
Function () {return typeof (IconsInfo) = "object ";},
Ucren. effectopico. 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.tar get;
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/mp.gif ");
Ucren. ImageCache. load ("images/mp_tipCenter.gif ");
Ucren. ImageCache. load ("images/mp_tipLeft.gif ");
Ucren. ImageCache. load ("images/mp_tipRight.gif ");
DronFw. JsPath = "command ";
Ucren. EventSwitch ();
Ucren. TimeBar ();
// Trayico
$ ("Trayico"). style. display = "block ";
// Tipbar
$ ("Tip"). 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. effectopico. Show ();
$ ("Loadhint"). style. display = "none ";
}
);
// Show MessBox
Var getmess = Ucren. Config. Message [Math. floor (Math. random () * Ucren. Config. Message. length)];
Ucren. MessBox. Show ("system message", getmess );
// Wait load vBorder
New DronFw. Class. vBorder ("sp ");
},
MpTip:
{
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 );
$ ("Mptip"). style. left = targetLeft + "px ";
$ ("Mptip"). style. top = "-184px ";
$ ("Mptip. text"). innerHTML = str;
$ ("Mp"). style. display = "block ";
New DronFw. Class. Shift ("mptip"). Move (targetLeft, tartgetTop );
},
Hide: function ()
{
$ ("Mp"). 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.tar get;
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 ("arrangement icon", "Ucren. Sort topico. Show ()");
Rm. AddItem ("refresh this page", "location. href = location. href ");
Rm. AddItem ("project ","");
Rm. AddItem ("project ","");
Rm. AddLine ();
Rm. AddItem ("project ","");
Rm. AddItem ("project ","");
Rm. AddItem ("About 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 message", "you have 1 unread email ");
Obj. src = "images/icons/t_outlok.gif ";
Obj. onclick = null;
}
}
};
Ucren. AddEvent (window, "load", function () {Ucren. Init ();});
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.