⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 main_only.js

📁 vc-mfc编程实例 很简单的东西,以后回多传自己的东西
💻 JS
字号:
//////////////////////////////////scoll animation effect///////////////
function scrollSub(subId,height)
{
	var subNode=document.getElementById(subId);
	if(subNode.scrollDirection==1)
	{
		subNode.scrollDirection=0;
		setTimeout(scUPfunction(subNode),50);
	}
	else if(subNode.scrollDirection==0)
	{
		subNode.scrollDirection=1;
		subNode.style.display="block";
		setTimeout(scDOWNfunction(subNode,height),50);
	}
}
function scUPfunction(subObj)
{
	return function()
	{
		if (subObj.scrollDirection==1) return;
		var intHeight=parseInt(subObj.style.height,10)-20;
		if (intHeight<=0)
		{
			subObj.style.display="none";
			subObj.scrollDirection=0;
			return;
		}
		else
		{
			subObj.style.height=intHeight+"px";
		}
		setTimeout(scUPfunction(subObj),50);
	}
}
function scDOWNfunction(subObj,height)
{
	return function()
	{
		if (subObj.scrollDirection==0) return;
		var intHeight=parseInt(subObj.style.height,10)+20;
		if (intHeight>=height)
		{
			subObj.style.height=height+"px";
			return;
		}
		else
		{
			subObj.style.height=intHeight+"px";
		}
		setTimeout(scDOWNfunction(subObj,height),50);
	}
}
function getSimpleFontStyle(str)
{
	return "<div style='font-size:12px;font-family:Tahoma, Arial; padding-top:2px; padding-left:25px; color:#155E95;'>"+str+"</div>"
}
function getCheckFontStyle(str)
{
	return "<div style='font-size:12px;font-family:Tahoma, Arial; padding-top:2px; padding-left:25px; color:#014880;'>"+str+"</div>"
}
//////////////////////////////////scoll animation effect///////////////
///////////////left menu click//////////////////////////
function ChangeAddIcon(divObj,num) {
	switch(num)
	{
		case 0:
			if (divObj.style.backgroundImage == "url(images/left_click_add_icon2.gif)") {
				divObj.style.background="url(images/left_unclick_add_icon2.gif)";
			}
			else {
				divObj.style.background="url(images/left_click_add_icon2.gif)";
			}
			break;
		case 2:
			if (divObj.style.backgroundImage == "url(images/left_click_add_icon1.gif)") {
				divObj.style.background="url(images/left_unclick_add_icon1.gif)";
			}
			else {
				divObj.style.background="url(images/left_click_add_icon1.gif)";
			}
			break;
		case 1:
			if (divObj.style.backgroundImage == "url(images/left_click_add_icon.gif)") {
				divObj.style.background="url(images/left_unclick_add_icon.gif)";
			}
			else {
				divObj.style.background="url(images/left_click_add_icon.gif)";
			}	
	}
	

}
///////////////left menu click//////////////////////////

////////////////main mini and exit window operation//////////////////////////
function MiniWindow() {
	window.external.OnMinimize();
}
function ExitWindow() {
	window.external.OnOK();
	//OnCancle()
}
////////////////main mini window operation end/////////////////////

//left navigation bar, 1---- backup   2------restore    3 ------ clone
function LeftNavigation( operationType ) {
	var openURL;
	//if can't click, then return;
	if (!navigationFlag) { return; }
	navigationFlag = false;
	switch ( operationType ) {
		case 1:
			// backup 0 --- back drivers     1 ----- back file     2 -- back disk
			switch ( backContainer.value ) {
				case "0":
					openURL = "Backup-Drivers.html";
					break;
				case "1":
					openURL = "FileBackupName.htm";
					break;
				case "2":
					openURL = "Startup_Disk.html";
					break;
			}
			break;
		case 2:
			// restore   0 --- restore drivers       1---- restore file
			switch ( restoreContainer.value ) {
				case "0":
					openURL = "Restore_Driver_1.htm";
					break;
				case "1":
					openURL = "customrestore.htm";
					break;
			}
			break;
		case 3:
			// clone   0 --- clone partition       1---- clone disk
			switch ( cloneContainer.value ) {
				case "0":
					openURL = "Clone_Partition.html";
					break;
				case "1":
					//IframeMainUI.location = "Clone-Disk.html";
					openURL = "Clone-Disk.html";
					break;
			}
			break;
	}
	timeOutObject = setTimeout(ChangeNavigationFlag,100);
	window.open(openURL,'IframeMainUI');
}
/////////////////main location  0 ----- summary     1-------- backup      2 --------- restore         3  ------- clone
function MainLocation( locationFlag ) {
	switch (locationFlag) {
		case 0:	
			window.open("Main_Quick_Start_1.htm","IframeMainUI");
			break;
		case 1:	
			window.open("main_VirtualDrive.htm","IframeMainUI");
			break;
		case 2:	
			window.open("main_vhd.htm","IframeMainUI");
			break;
		case 3:	
			window.open("main_liveupdate.htm","IframeMainUI");
			break;
	}
}

function ChangeNavigationFlag() { navigationFlag = true; }
////////////////////webmenu function//////////////////////////////////////
function iniTopMenu(clickedObj)
{	
	currentOpenedTopMenuButton=clickedObj;
	var menuTopLevelObj=document.getElementById(clickedObj.submenuid);
	menuUpObj=menuTopLevelObj
	
	appendedTopItem=clickedObj;
	//alert(menuTopLevelObj.clientWidth)
	menuTopLevelObj.style.left=-clickedObj.clientWidth+"px";
	sdObj.className=("menushadow")
	sdObj.style.height=menuTopLevelObj.clientHeight+"px";
	sdObj.style.width=menuTopLevelObj.clientWidth+"px";
	sdObj.style.top=(parseInt(menuTopLevelObj.offsetTop)+4)+"px";
	sdObj.style.left=(parseInt(menuTopLevelObj.offsetLeft)+4)+"px";
	clickedObj.parentNode.appendChild(sdObj);
	menuTopLevelObj.style.visibility="visible";
	sdObj.style.visibility="visible";
	
	//alert(menuTopLevelObj.visibility)
	var subMenuArr=menuTopLevelObj.childNodes;
	for (i=0;i<subMenuArr.length;i++) {
		subMenuArr[i].onmouseover=function() {
			isMove=false;
			var thisMenuSubListArr=this.parentNode.childNodes;
			for (i=0;i<thisMenuSubListArr.length;i++) {
				if (thisMenuSubListArr[i].className=="upMenuStyle") {
					thisMenuSubListArr[i].style.backgroundImage="url(images/topMenuDiv.jpg)";
				}
				thisMenuSubListArr[i].style.backgroundColor="";
				thisMenuSubListArr[i].style.color="#000000";
			}
			if (this.className=="upMenuStyle") {
				this.style.backgroundImage="none";
			}
			this.style.backgroundColor="#316AC5";
			this.style.color="#ffffff";
		}
		subMenuArr[i].onmouseout=function() {
			isMove=true;
			if (this.className=="upMenuStyle") {
				this.style.backgroundImage="url(images/topMenuDiv.jpg)";
			}
			this.style.backgroundColor="";
			this.style.color="#000000";
		}
		subMenuArr[i].onclick=function() {
			menuFireEvent(this.iid)
		}
	}
	submenuIsOpen=true;
}

function appendSubmenu(clickedObj) {
	setTimeout(clickTimeout(clickedObj),20)
}
function clickTimeout(obj) {
	return function() {
		iniTopMenu(obj);
	}
}

//submenu click
function menuFireEvent(id) {
	fffa();
	alert(id);
//	if (id==11) {
//		window.external.OnClose();
//	}
//	if (id==21) {
//		if (window.external.IsPendClose()==true) {
//			return;
//		}
//		clickNavButton(1);
//	}
//	if (id==22) {
//		if (window.external.IsPendClose()==true) {
//			return;
//		}
//		clickNavButton(6);
//	}
//	if (id==23) {
//		if (window.external.IsPendClose()==true) {
//			return;
//		}
//		clickNavButton(5);
//	}
//	if (id==31) { }
//	if (id==34) {
//		var isDoingThing=window.external.IsPendClose()
//		window.external.PendClose(false);
//		window.external.Navigate("mainui/about.htm",320,420);
//	}
}

function closeTopSubNenu() {
	if (currentOpenedTopMenuButton==null) {
		return;
	}
	var parentMenuObj=document.getElementById(currentOpenedTopMenuButton.submenuid);
	if (parentMenuObj==null) {
		return;
	}
	var listArray1=parentMenuObj.childNodes;
	for(i=0;i<listArray1.length;i++) {
		if (listArray1[i].style.backgroundColor=="") {	continue; }
		listArray1[i].style.backgroundColor="";
		listArray1[i].style.color="#000000";
		if (listArray1[i].className=="upMenuStyle") {
			listArray1[i].style.backgroundImage="url(images/topMenuDiv.jpg)";
		}
	}
	currentOpenedTopMenuButton.style.backgroundColor="";
	currentOpenedTopMenuButton.style.color="#000000";
	currentOpenedTopMenuButton=null;
	menuUpObj.style.visibility="hidden";
	sdObj.style.visibility="hidden";
	submenuIsOpen=false;
}
function showFileMenu() {
	if(currentOpenedTopMenuButton!=null) { closeTopSubNenu(); }
	var fileMenuTopObj=document.getElementById("fileTopMenu");
	fileMenuTopObj.focus();
	currentOpenedTopMenuButton=fileMenuTopObj;
	submenuIsOpen=true;
	fileMenuTopObj.style.backgroundColor="#316AC5";
	fileMenuTopObj.style.color="#ffffff";
	setTimeout(clickTimeout(fileMenuTopObj),20)
}
function showToolsMenu() {
	if(currentOpenedTopMenuButton!=null) { closeTopSubNenu(); }
	var toolsMenuTopObj=document.getElementById("toolsTopMenu");
	toolsMenuTopObj.focus();
	currentOpenedTopMenuButton=toolsMenuTopObj;
	submenuIsOpen=true;
	toolsMenuTopObj.style.backgroundColor="#316AC5";
	toolsMenuTopObj.style.color="#ffffff";
	setTimeout(clickTimeout(toolsMenuTopObj),20)
}
function showHelpMenu() {
	if(currentOpenedTopMenuButton!=null) { closeTopSubNenu(); }
	var helpMenuTopObj=document.getElementById("helpTopMenuA");
	helpMenuTopObj.focus();
	currentOpenedTopMenuButton=helpMenuTopObj;
	submenuIsOpen=true;
	helpMenuTopObj.style.backgroundColor="#316AC5";
	helpMenuTopObj.style.color="#ffffff";
	setTimeout(clickTimeout(helpMenuTopObj),20)
}
////////////////////webmenu function//////////////////////////////////////
////////////////////hot key function//////////////////////////////////////
function declareAltHotKey(key,fun) {
	key=key.toUpperCase();
	var tmpColl=new topMenuEventCollection();
	tmpColl.key=key;
	tmpColl.keyCodeNum=key.charCodeAt(0);
	tmpColl.fireFunction=fun;
	hotKeyList.push(tmpColl);
}

function declareCtrlHotKey(key,fun) {
	key=key.toUpperCase();
	var tmpColl=new topMenuEventCollection();
	tmpColl.key=key;
	tmpColl.keyCodeNum=key.charCodeAt(0);
	tmpColl.fireFunction=fun;
	ctrlHotKeyList.push(tmpColl);
}

var topMenuEventCollection=function() {
	this.key="";
	this.keyCodeNum=0;
	this.fireFunction=function(){}
}

function fireCtrlHotKey(code,fireFrom) {
	for (i=0;i<ctrlHotKeyList.length;i++) {
		if(ctrlHotKeyList[i].keyCodeNum==code) {
			ctrlHotKeyList[i].fireFunction();
			//alert(fireFrom.outerHTML);
		}
	}
}

function fireHotKey(code,fireFrom) {
	//alert(hotKeyList.length);
	for (i=0;i<hotKeyList.length;i++) {
		if(hotKeyList[i].keyCodeNum==code) {
			hotKeyList[i].fireFunction();
			//alert(fireFrom.outerHTML);
			if (fireFrom.tagName=="A" || toUpperCase(fireFrom.tagName)=="OBJECT") {
				fireFrom.blur();
			}
		}
	}
}

function fireUpKeyEvent() {
	if (!submenuIsOpen) return;
	subMenuListArray=document.getElementById(currentOpenedTopMenuButton.submenuid).childNodes;
	highLightIndex=0;
	tempIndexId=0;
	for(i=0;i<subMenuListArray.length;i++) {
		if (subMenuListArray[i].style.backgroundColor!="") {
			tempIndexId=i;
		}
		subMenuListArray[i].style.backgroundColor="";
		subMenuListArray[i].style.color="#000000";
		if (subMenuListArray[i].className=="upMenuStyle") {
			subMenuListArray[i].style.backgroundImage="url(images/topMenuDiv.jpg)";
		}
	}
	if (tempIndexId>0) {
		highLightIndex=tempIndexId-1;
	}
	if (tempIndexId==0) {
		highLightIndex=subMenuListArray.length-1;
	}
	subMenuListArray[highLightIndex].style.backgroundColor="#316AC5";
	subMenuListArray[highLightIndex].style.color="#ffffff";
	if (subMenuListArray[highLightIndex].className=="upMenuStyle") {
		subMenuListArray[highLightIndex].style.backgroundImage="none";
	}
}

function fireDownKeyEvent() {
	if (!submenuIsOpen) return;
	subMenuListArray=document.getElementById(currentOpenedTopMenuButton.submenuid).childNodes;
	highLightIndex=0;
	tempIndexId=-1;
	for(i=0;i<subMenuListArray.length;i++) {
		if (subMenuListArray[i].style.backgroundColor!="") {
			tempIndexId=i;
		}
		if (tempIndexId==subMenuListArray.length-1) {
			tempIndexId=-1;
		}
		subMenuListArray[i].style.backgroundColor="";
		subMenuListArray[i].style.color="#000000";
		if (subMenuListArray[i].className=="upMenuStyle") {
			subMenuListArray[i].style.backgroundImage="url(images/topMenuDiv.jpg)";
		}
	}
	if (tempIndexId<subMenuListArray.length-1) {
		highLightIndex=tempIndexId+1;
	}
	subMenuListArray[highLightIndex].style.backgroundColor="#316AC5";
	subMenuListArray[highLightIndex].style.color="#ffffff";
	if (subMenuListArray[highLightIndex].className=="upMenuStyle") {
		subMenuListArray[highLightIndex].style.backgroundImage="none";
	}
}

function fireLeftKeyEvent() {
	if (currentOpenedTopMenuButton==null) {
		return;
	}
	var inextId=-1;
	var tmpTopElementCon=currentOpenedTopMenuButton;
	for (var i=0;i<globeTopMenuListArray.length;i++) {
		if(globeTopMenuListArray[i]==tmpTopElementCon) {
			inextId=i;
			inextId-=1;
			break;
		}
	}
	if (inextId<0) {
		inextId=globeTopMenuListArray.length-1;
	}
	closeTopSubNenu();
	if(globeTopMenuListArray[inextId].id=="fileTopMenu") {
		showFileMenu();
	}	
	else if (globeTopMenuListArray[inextId].id=="toolsTopMenu") {
		showToolsMenu();
	}
	else if (globeTopMenuListArray[inextId].id=="helpTopMenuA")	{
		showHelpMenu();
	}
}

function fireRightKeyEvent() {
	if (currentOpenedTopMenuButton==null) {	return;	}
	var inextId=-1;
	var tmpTopElementCon=currentOpenedTopMenuButton;
	for (var i=0;i<globeTopMenuListArray.length;i++) {
		if(globeTopMenuListArray[i]==tmpTopElementCon) {
			inextId=i;
			inextId+=1;
			break;
		}
	}
	if (inextId==-1) { return; }
	if (inextId>globeTopMenuListArray.length-1) { inextId=0; }
//	alert(globeTopMenuListArray[inextId].id);
	closeTopSubNenu();
	if(globeTopMenuListArray[inextId].id=="fileTopMenu") { showFileMenu(); }	
	else if (globeTopMenuListArray[inextId].id=="toolsTopMenu") { showToolsMenu(); }
	else if (globeTopMenuListArray[inextId].id=="helpTopMenuA") { showHelpMenu(); }
}

function fireEnterKeyEvent()
{
	if (!submenuIsOpen) return;
	subMenuListArray=document.getElementById(currentOpenedTopMenuButton.submenuid).childNodes;
	for(i=0;i<subMenuListArray.length;i++) {
		if (subMenuListArray[i].style.backgroundColor!="") {
			menuFireEvent(subMenuListArray[i].iid);
		}
	}
}

function fireEscKeyEvent()
{
	closeTopSubNenu();
}

function fireOtherKeyEvent(code)
{
	if (currentOpenedTopMenuButton==null) { return; }
	var parentMenuObj=document.getElementById(currentOpenedTopMenuButton.submenuid);
	if (parentMenuObj==null) { return; }
	var listArray1=parentMenuObj.childNodes;
	var currentPressKey=(String.fromCharCode(code));
	for(i=0;i<listArray1.length;i++) {
		if (currentPressKey==listArray1[i].hotkeyflag) {
			if (listArray1[i].style.display=="none") { return; }
			listArray1[i].click();
			return;
		}
	}
}

function isTopSubMenuOpened() {
	if(currentOpenedTopMenuButton==null) { return false; }
	else { return true; }
}
////////////////////hot key function//////////////////////////////////////

///////////////////window function///////////////////////////////////////
function moveWindow() {
	if (isMove) {
		closeTopSubNenu();
		window.external.OnMoveWindow();
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -