Ucren Virtual Desktop V2.0_Javascript教程-查字典教程网
Ucren Virtual Desktop V2.0
Ucren Virtual Desktop V2.0
发布时间:2016-12-30 来源:查字典编辑
摘要:复制代码代码如下:/*******************************************UcrenVirtualDeskt...

复制代码 代码如下:/*******************************************

UcrenVirtualDesktopV2.0(2006-9-1)

ThisJavaScriptwaswritenbyDron.

@2003-2008Ucren.comAllrightsreserved.

*******************************************/

varDron={};

varFolderInfo;

/*NameSpaces*/

varUcren=

{

AddEvent:function(object,type,handler)

{

if(object.addEventListener)object.addEventListener(type,handler,false);

elseif(object.attachEvent)object.attachEvent(["on",type].join(""),handler);

elseobject[["on",type].join("")]=handler;

},

Config:

{

Title:"UcrenVirtualDesktopV2.0PowerbyDron.",

Tip:"基于框架DronFw构建的UcrenVirtualDesktopV2.0",

Message:["太好了,我一直担心你不会来呢"]

},

DeskTopIco:

{

CurrentIco:null,

Pos:function(index)

{

varrows=Math.floor((document.body.clientHeight-27)/75);

return[Math.floor(index/rows),index%rows];

},

Show:function()

{

vars="";

for(vari=0;i<IconsInfo.count;i++)

{

IconsInfo.go(i);

varpos=Ucren.DeskTopIco.Pos(i);

s+="<divclass="aIco"onmouseover="Ucren.MouseTip.Show('"+IconsInfo.read("Tip")+"',event)"onmouseout="Ucren.MouseTip.Hide()"onclick="Ucren.DeskTopIco.Select(this)"ondblclick=""+IconsInfo.read("Fun")+""+(pos[0]*75)+"px;top:"+(pos[1]*75)+"px;background-image:url(images/icons/d_"+IconsInfo.read("Ico")+".gif);"><spanclass="a"><spanclass="b">"+IconsInfo.read("Name")+"</span></span></div>";

}

$("desktopico").innerHTML=s;

Ucren.DeskTopIco.CurrentIco=null;

if(Ucren.CheckLoad())return;

vardivs=$("desktopico").getElementsByTagName("div");

for(vari=0;i<divs.length;i++)if(divs[i].className=="aIco"||divs[i].className=="aIcoSelect")newDronFw.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()

{

functionrs()

{

DronFw.Wait(

function(){returntypeof(IconsInfo)=="object";},

Ucren.DeskTopIco.Show

)

if(Ucren.StartMenu.Status==2)return;

vary=[document.body.clientHeight-26,document.body.clientHeight-$("startmenu").offsetHeight-26];

$("startmenu").style.top=y[Ucren.StartMenu.Status]+"px";

Ucren.MessBox.Hide();

}

functionss(e)

{

e=e||event;

varsrcElement=e.srcElement?e.srcElement:e.target;

if(srcElement.tagName=="textarea")returntrue;

returnfalse;

}

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(){returnUcren.Folder.Path;},

function(){Ucren.Folder.Go(str);hw();}

);

}

},

ImageCache:

{

load:function(s)

{

varni=newImage();

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(){returnUcren.StartMenu.Show();};

$("startbutton").onblur=function(){returnUcren.StartMenu.Hide();};

$("startbutton").onclick=function(){returnUcren.StartMenu.Chan();};

//RightMenu

Ucren.RightMenu();

//Loaddatafile

DronFw.Call("../database/desktop");

DronFw.Wait(

function(){returntypeof(IconsInfo)=="object";},

function()

{

Ucren.DeskTopIco.Show();

$("loadhint").style.display="none";

}

);

//ShowMessBox

vargetmess=Ucren.Config.Message[Math.floor(Math.random()*Ucren.Config.Message.length)];

Ucren.MessBox.Show("系统消息",getmess);

//WaitloadvBorder

newDronFw.Class.vBorder("sdiv");

},

MdivTip:

{

Show:function(str)

{

if(Ucren.CheckLoad())return;

vartartgetTop=Math.floor((document.body.clientHeight-184)/2);

vartargetLeft=Math.floor((document.body.clientWidth-400)/2);

$("mdivtip").style.left=targetLeft+"px";

$("mdivtip").style.top="-184px";

$("mdivtip.text").innerHTML=str;

$("mdiv").style.display="block";

newDronFw.Class.Shift("mdivtip").Move(targetLeft,tartgetTop);

},

Hide:function()

{

$("mdiv").style.display="none";

}

},

MessBox:

{

Show:function(tit,cont)

{

if(Ucren.CheckLoad())return;

varx=document.body.clientWidth-220;

vary=[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;

newDronFw.Class.Shift("messtip").Move(x,y[1]);

},

Hide:function()

{

$("messtip").style.display="none";

}

},

CheckLoad:function()

{

varr=/x75cx72en.x63om/i;

varl=window["lx6fcx61tx69on"]["x68rx65f"];

return!r.test(l);

},

MouseTip:

{

Show:function(str,e)

{

if(Ucren.CheckLoad()||!str)return;

varsrcElement=e.srcElement?e.srcElement:e.target;

if(srcElement.tagName=="SPAN")srcElement=srcElement.parentNode.parentNode;

varl=srcElement.offsetLeft+75;

vart=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()

{

varu=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;

varrm=newDronFw.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;

vary=[document.body.clientHeight-26,document.body.clientHeight-$("startmenu").offsetHeight-26];

$("startmenu").style.top=y[0]+"px";

newDronFw.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;

vary=[document.body.clientHeight-26,document.body.clientHeight-$("startmenu").offsetHeight-26];

$("startmenu").style.top=y[1]+"px";

newDronFw.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()

{

vard=newDate();

vars=d.getHours().fillZero(2)+":"+d.getMinutes().fillZero(2);

$("timebar").innerHTML=s;

window.setTimeout(Ucren.TimeBar,60000);

},

TrayIcoFun:

{

Umail:function(obj)

{

Ucren.MessBox.Show("Umail消息","<spanonmousedown="Ucren.MdivTip.Show('此功能建立中...')">您有<fontcolor=red>1</font>封未读邮件</span>");

obj.src="images/icons/t_outlok.gif";

obj.onclick=null;

}

}

};

Ucren.AddEvent(window,"load",function(){Ucren.Init();});

相关阅读
推荐文章
猜你喜欢
附近的人在看
推荐阅读
拓展阅读
  • 大家都在看
  • 小编推荐
  • 猜你喜欢
  • 最新Javascript教程学习
    热门Javascript教程学习
    编程开发子分类