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

📄 common.js

📁 在线编辑WORD文档
💻 JS
字号:
var dg = document.getElementById;

function LogPage(cntID,opt)
{
	if(dg)
	{
		if(dg('logframe')) dg('logframe').src= "/common/PageLog.aspx?pgOpt=" + opt + "&cntID=" + cntID;
	}		
}


function fetchcookieval(key){
   var cookiename;
   var cookieval;
   var keyfound = false;
   var cookiearray = document.cookie.split(";")
   for(i=0;i<cookiearray.length;i++){
      cookiename = cookiearray[i].substring(0, cookiearray[i].indexOf("="));
      if(cookiename.charAt(0) == " ") cookiename = cookiename.substring(1, cookiename.length);
      cookieval = cookiearray[i].substring(cookiearray[i].indexOf("=")+1, cookiearray[i].length);
      if(key == cookiename){keyfound = true; break;}
   }
   if(keyfound) return cookieval;
   else return "blank";
}

function setcookieval(key, val){
  
		var d = new Date();
		d.setFullYear(d.getFullYear() + 1);	
		if(document.domain.indexOf(".com") > -1)
		{
			document.cookie = key+'='+val+'; expires=' + d + '; Domain=' + document.domain  + '; path=/';
		}
		else
		{ 
         document.cookie = key+'='+val+'; expires=' + d + '; path=/';
		}
   
}

function submitCheck() 
{ 
//	alert( document.frmArt );
//	alert( document.frmArt.elements.length );
//	alert( document.frmArt.elements[0] );
	var sArtNum = document.frmArt.elements[0].value;
	if (sArtNum == '')	return false;

	var M = sArtNum.match(/([A-Z]{0,2})[0-9]{5,6}/);
	var Action = "";
	
	if( null != M )
	{
	/******
	*** This code commented out to support all kbarticle searches with and without prefix.
		if( M[1] == "" )	Action = "Q" + M[0];
		else		Action = M[0];
		document.frmArt.action = "default.aspx?scid=kb;[LN];" + Action;
	******/
		document.frmArt.action = "default.aspx?scid=kb;[LN];" + sArtNum;
	}
	else 
	{ 
		alert("The [" + sArtNum + "] won't bring you any articles. Try something like Q123456"); 
		return false; 
	}
} 


function CheckLineElement(prd)
{

	if(prd)
	{
		if(prd.options[prd.selectedIndex].value == "line")
		{
			prd.selectedIndex = prd.selectedIndex - 1;

		}
	}	

}




function gsfx_switchUIMode(elementName){

	if(d.getElementsByName){
		adv = d.getElementsByName(elementName);
		if(adv.length > 0){
			var dm = adv[0].style.display;
			if(dm == "none") dm = "block";
			else dm = "none";
			for(i=0; i<adv.length; i++){
				adv[i].style.display = dm;
			}
		}
	}else if(d.all){
		var dm;
		for(i=0; i<d.all.length;i++){
			if(d.all[i].id == elementName){
				dm = d.all[i].style.display;
				break;
			}
		}

		if(dm == "none") dm = "block";
		else dm = "none";

		for(i=0; i<d.all.length;i++){
			if(d.all[i].id == elementName) d.all[i].style.display = dm;
		}
	}

	setcookieval(elementName+"_switchMode", dm);
}

function PartWrapperToggle(elementName) {
	var HeaderElement = null;
	var BodyElement = null; 
	if(document.getElementsByName) {
		HeaderElement = document.getElementsByName(elementName+"Header");
		BodyElement = document.getElementsByName(elementName+"Body");
		UpImage = document.getElementsByName(elementName+"Up");
		DownImage = document.getElementsByName(elementName+"Down");
		if(BodyElement) {	
			if(BodyElement[0].style.display == "none") {
				BodyElement[0].style.display = "block";
				HeaderElement[0].className = "ListNuggetHeader";
				DownImage[0].style.display = "none";
				UpImage[0].style.display = "block";
			} else {
				BodyElement[0].style.display = "none";
				HeaderElement[0].className = "ListNuggetHeaderClosed";
				UpImage[0].style.display = "none";
				DownImage[0].style.display = "block";
			}
		}	
	}
	window.event.cancelBubble = true;
	return false;

}

function NoSearchResultsTrigger(url) 
{
	GSFxNewWindow(url);
}
document.NoSearchResultsTrigger = NoSearchResultsTrigger;

function GSFxNewWindow(url){
	if(d.body.clientHeight){
		winheight = Math.round(window.document.body.clientHeight * 0.9);
		winwidth = Math.round(window.document.body.clientWidth * 0.9);
		leftmargin = Math.round(window.document.body.clientWidth * 0.05);
		topmargin = Math.round(window.document.body.clientWidth * 0.02);
	}else{
		winheight = Math.round(d.body.offsetHeight * 0.9);
		winwidth = Math.round(d.body.offsetWidth * 0.9);
		leftmargin = Math.round(d.body.offsetWidth * 0.05);
		topmargin = Math.round(d.body.offsetWidth * 0.02);
	}
	var win = window.open(url, "_blank", "resizable=yes,scrollbars=yes,menubar=yes,location=yes,toolbar=yes,status=yes,height="+winheight+",width="+winwidth+",left="+leftmargin+",top="+topmargin);
	win.focus();
}


function srch_setcookieval(key, val){
		
		if(document.domain.indexOf(".com") > -1){
			document.cookie = key+'='+val+'; Domain='+document.domain+'; path=/';
		}else document.cookie = key+'='+val+'; path=/';
	
}

function UnicodeFixup(s){
	var result = new String();
	var c = '';
	var i = -1; 
	var l = s.length;
	result = "";
	for(i = 0; i<l; i++) {
		c = s.substring(i, i+1);
		if(c == "%") {
			result += c; i++;
			c = s.substring(i, i+1);
			if(c != "u") {
				if(parseInt("0x" + s.substring(i, i+2)) > 128) result += "u00";
			}
		}
		result += c;
	}
	return result;
}

function ShowSurveyWindow(SurveyURL)
{	
	var sSiteID = '', sSiteRegionID = '', sReferringURL = '', P0 = '', P1 = '', P2 = '', P3 = '', P4 = '', P5 = '', P6 = '', P7 = '', P8 = '', P9 = '';
	if(ShowSurveyWindow.arguments.length > 1){sSiteID = ShowSurveyWindow.arguments[1];}
	if(ShowSurveyWindow.arguments.length > 2){sSiteRegionID = ShowSurveyWindow.arguments[2];}
	if(ShowSurveyWindow.arguments.length > 3){sReferringURL = ShowSurveyWindow.arguments[3];}
	if(ShowSurveyWindow.arguments.length > 4){P0 = ShowSurveyWindow.arguments[4];}
	if(ShowSurveyWindow.arguments.length > 5){P1 = ShowSurveyWindow.arguments[5];}
	if(ShowSurveyWindow.arguments.length > 6){P2 = ShowSurveyWindow.arguments[6];}
	if(ShowSurveyWindow.arguments.length > 7){P3 = ShowSurveyWindow.arguments[7];}
	if(ShowSurveyWindow.arguments.length > 8){P4 = ShowSurveyWindow.arguments[8];}
	if(ShowSurveyWindow.arguments.length > 9){P5 = ShowSurveyWindow.arguments[9];}
	//if(ShowSurveyWindow.arguments.length > 10){P6 = ShowSurveyWindow.arguments[10];}
	var cv;
	var dg = "";
	var p1 = "guid=";
	var p2 = "&guid=";
	var gl = 32;	
	cv = fetchcookieval("MC1").toLowerCase();
	if(cv == "blank") cv = fetchcookieval("MC2").toLowerCase();
	if(cv != "blank")	{
		if(cv.substr(0,p1.length) == p1) { dg = cv.substr(p1.length, gl); }
		else if(cv.indexOf(p2) > -1){ dg = cv.substr(cv.indexOf(p2) + p2.length, gl); }
	}
	P6 = dg;
	
	if(ShowSurveyWindow.arguments.length > 11){P7 = ShowSurveyWindow.arguments[11];}
	if(ShowSurveyWindow.arguments.length > 12){P8 = ShowSurveyWindow.arguments[12];}
	if(ShowSurveyWindow.arguments.length > 13){P9 = ShowSurveyWindow.arguments[13];}

	var fullURL = SurveyURL + '&site=' + sSiteID + '&siteregion=' + sSiteRegionID + '&url=' + sReferringURL + '&p0=' + P0 + '&p1=' + P1 + '&p2=' + P2 + '&p3=' + P3 + '&p4=' + P4 + '&p5=' + P5 + '&p6=' + P6 + '&p7=' + P7 + '&p8=' + P8 + '&p9=' + P9;	window.open(fullURL, '_blank', 'resizable=yes,scrollbars=yes,menubar=no,location=no,toolbar=no,status=no,left=0,top=0,height=500,width=725');	if(window.event != null) window.event.cancelBubble = true;	//return false;}

function PrintContents()
{
	window.print();
}

function LogHit(sUrl)
{
	if(typeof(sUrl) != "undefined")
	{
		var cv;
		var dg = "";
		var p1 = "guid=";
		var p2 = "&guid=";
		var gl = 32;	
		cv = fetchcookieval("MC1").toLowerCase();
		if(cv == "blank") cv = fetchcookieval("MC2").toLowerCase();
		if(cv != "blank")	{
			if(cv.substr(0,p1.length) == p1) { dg = cv.substr(p1.length, gl); }
			else if(cv.indexOf(p2) > -1){ dg = cv.substr(cv.indexOf(p2) + p2.length, gl); }
		}
		sUrl = sUrl + "&msid=" + dg;
		if(document.images) {
			document.images["metrixgif"].src = sUrl;
		}
	}
}

// Funciton to check for external links to be opened in the new window.
var g_reSupportedHostnames;
function ForeignLink_Hookup(branding){
	
	if(branding == "undefined") 
	{
		branding = 'true';
	}	
	
	var eCurrentAnchor = null;
	for( var i=0; i < document.links.length; i++ ){
		eCurrentAnchor = document.links[i];
		//consider only those having a URL protocol prefix
		if(eCurrentAnchor.protocol=="http:" || eCurrentAnchor.protocol=="https:"){ 
			//test to see if foreign
			
			if(!branding && (eCurrentAnchor.href.indexOf(document.location.hostname) > -1) &&(eCurrentAnchor.href.toLowerCase().indexOf("fr=1") < 0)) 
			{	
				if(eCurrentAnchor.href.indexOf("?") > -1) eCurrentAnchor.href = eCurrentAnchor.href + "&FR=1";
				else eCurrentAnchor.href = eCurrentAnchor.href + "?FR=1";
			}	
				
			if(!g_reSupportedHostnames.exec(eCurrentAnchor.hostname)){ 
				//alert("EXTERNAL: " + sUrlBase);
				eCurrentAnchor.target = "_blank"; // open in new window
			}
		}
	} //for each anchor
	if(!branding)
	{
		if(document.getElementsByName)
		{
			var eForms = null;
			for( var i = 0 ; i<document.forms.length ; i++)
			{
				eCurrentForm = document.forms[i];
				if(eCurrentForm.action.indexOf(document.location.hostname) > -1)
				{
					if(!eCurrentForm.FR) {
				
					var elm = document.createElement('input');
					elm.type = "hidden";
					elm.name = "FR";
					elm.id = "FR";
					elm.value = "1";
					eCurrentForm.appendChild(elm);
					}
				}
			}
		}
	}
}

⌨️ 快捷键说明

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