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

📄 quicksearch.js

📁 SugarCRM5.1 开源PHP客户关系管理系统
💻 JS
📖 第 1 页 / 共 3 页
字号:
	collection_extended = new Array();}function handleClick(event) {	e2 = getEvent(event);	eL2 = getEventElement(e2);	toggleMultis(eL2['id'], true);	if (siw && siw.selectingSomething) {		selectFromMouseClick();	}}//handleClick()function handleMouseOver(event) {	e = getEvent(event);	eL = getEventElement(e);	if (siw && (mEl = isWithinNode(eL,null,"sqsMatchedSmartInputItem",null,null))) {		siw.selectingSomething = true;		selectFromMouseOver(mEl);	} else if (isWithinNode(eL,null,"siwCredit",null,null)) {		siw.selectingSomething = true;	}else if (siw) {		siw.selectingSomething = false;	}}//handleMouseOverfunction showSmartInputFloater() {if (!siw) siw = new smartInputWindow(); // moved to callif (!siw.floater.style.display || (siw.floater.style.display=="none")) {	if (!siw.customFloater) {		x = findElementPosX(siw.inputBox);		y = findElementPosY(siw.inputBox) + siw.inputBox.offsetHeight;		//hack: browser-specific adjustments.		if (!siw.isGecko && !siw.isWinIE) x += 8;		if (!siw.isGecko && !siw.isWinIE) y += 10;		siw.floater.style.left = x;		siw.floater.style.top = y;	} else {	}	siw.floater.style.display="block";	siw.floater.style.visibility="visible";	if(siw.isWinIE) {		siw.floaterIframe.style.display="block";		siw.floaterIframe.style.visibility="visible";		resizeSmartInputIframe();	}	siw.floater.style.opacity = 1;	siw.floater.style.filter = 'alpha(opacity=100)';	siw.floater.getElementsByTagName('td')[0].getElementsByTagName('div')[0].style.opacity = 1;	siw.floater.getElementsByTagName('td')[0].getElementsByTagName('div')[0].style.filter = 'alpha(opacity=100)';	siw.floaterIframe.style.opacity = 1;	siw.floaterIframe.style.filter = 'alpha(opacity=100)';}}//showSmartInputFloater()function clearPopulateList(id, sqs_id){		if(sqs_tab_action)return;		for(j = 1; j < sqs_objects[sqs_id]['populate_list'].length; j++) {			if(id != sqs_objects[sqs_id]['populate_list'][j]){				document.getElementById(sqs_objects[sqs_id]['populate_list'][j]).value = '';			}		}}function hideSmartInputFloater(selected) {	postblur = false;	if (siw) {		siw.blurring = true;		if(typeof(callDelay) != 'undefined') window.clearTimeout(callDelay); // stop the last AJAX call		if(typeof(sqs_object_id) != 'undefined') {			user_input = document.getElementById(sqs_object_id).value;			var multi = false;			if(selected && typeof sqs_objects[sqs_object_id]['multi'] != 'undefined' && sqs_objects[sqs_object_id]['multi']) { // handle multiselect quicksearches				if(typeof sqs_objects[sqs_object_id]['multi_populate_list'] == 'undefined')					sqs_objects[sqs_object_id]['multi_populate_list'] = new Array();				if(typeof sqs_objects[sqs_object_id]['multi_populate_list'][user_input] == 'undefined' || sqs_objects[sqs_object_id]['multi_populate_list'][user_input] == null)					sqs_objects[sqs_object_id]['multi_populate_list'][user_input] = new Array();				sqs_objects[sqs_object_id]['multi_populate_list'][user_input][document.getElementById(sqs_object_id).name] = user_input;				multi = true;			}			for(j = 1; j < sqs_objects[sqs_object_id]['populate_list'].length; j++) {				if(typeof(collection_extended) != 'undefined' &&				   typeof(sqs_objects) != 'undefined' &&				   typeof(collection_extended[user_input]) != 'undefined' &&				   typeof(collection_extended[user_input][sqs_objects[sqs_object_id]['field_list'][j]]) != 'undefined') {							if(multi) { // handle multiselect quicksearches								sqs_objects[sqs_object_id]['multi_populate_list'][user_input][sqs_objects[sqs_object_id]['populate_list'][j]] =								collection_extended[user_input][sqs_objects[sqs_object_id]['field_list'][j]];							} else {								document.getElementById(sqs_objects[sqs_object_id]['populate_list'][j]).value =								collection_extended[user_input][sqs_objects[sqs_object_id]['field_list'][j]];							}							postblur = true;				} else {					        document.getElementById(sqs_objects[sqs_object_id]['populate_list'][j]).value = '';				}			}			if(multi) {				sqsCreateSpans(sqs_object_id);				document.getElementById(sqs_object_id).value = '';			}			//	collection = new Array(); // taken out to avoid clearing list when using arrow keys			if(typeof(sqs_objects[sqs_object_id]['post_onblur_function']) != 'undefined' && postblur) {				eval(sqs_objects[sqs_object_id]['post_onblur_function'] + '(collection_extended[user_input], sqs_object_id)');			}		}		sqs_query = '';		// fade effect		theDiv = siw.floaterContent.getElementsByTagName('div')[0];		if((selected && user_input != '' && sqsFilledOut(sqs_object_id)) || user_input == ''  || sqs_query.indexOf(sqs_last_query) != 0){			hideSmartInputFloaterComplete();		}	}//siw exists}//hideSmartInputFloaterfunction sqsCreateSpans(sqs_object_id) {	multi_populate_el = document.getElementById(sqs_objects[sqs_object_id]['multi_populate']);	multi_populate_el.innerHTML = ''; // clear it out and rebuild	list = new Array();	countWP = 0;	for(wp in sqs_objects[sqs_object_id]['multi_populate_list']) {		if(sqs_objects[sqs_object_id]['multi_populate_list'][wp] != null && wp != '') {			countWP++;			span = '<a href="#" onclick="return sqsRemove(\'' + wp + '\', \'' + sqs_object_id + '\' )">' + wp;			for(field in sqs_objects[sqs_object_id]['multi_populate_list'][wp]) {				span += '<input type="hidden" name="' + field + '[]" value="' + sqs_objects[sqs_object_id]['multi_populate_list'][wp][field] + '">';			}			span += '</a>';			list.push(span);//			multi_populate_el.innerHTML += wp;		}	}	multi_populate_el.innerHTML = '<span>' + countWP + ' selected items</span>'							+ '<div style="height: 20px;">'							+ '<div style="padding: 2px 2px 2px 2px; border: 1px black solid; background: #fff; overflow: auto; width: 100px; height: 100px; position: absolute;" id="' + sqs_object_id + '_info">' + list.join(',<br>') + '</div></div>';	toggleMultis(sqs_object_id, true);}// show or hide the list of multi selectsfunction toggleMultis(sqs_object_id, show) {	multi_div = document.getElementById(sqs_object_id + '_info');	if(multi_div && show) { // show it		multi_div.style.height = '100px';		multi_div.style.width = '100px';	}	if(multi_div && !show) { // hide it		multi_div.style.height = '25px';		multi_div.style.width = '100px';	}}function sqsRemove(item, sqs_object_id) {	sqs_objects[sqs_object_id]['multi_populate_list'][item] = null;	sqsCreateSpans(sqs_object_id);	return false;}function hideSmartInputFloaterComplete() {	if (siw) {		siw.floater.style.display="none";		siw.floater.style.visibility="hidden";		siw.floaterIframe.style.display="none";		siw.floaterIframe.style.visibility="hidden";		siw.blurring = false;		siw = null;	}}function setOpacity(value, theDiv) {	if (siw && theDiv) {		newOpacity = 100 - value * 20;		siw.floater.style.opacity = 1 - value / 20;		siw.floater.style.filter = 'alpha(opacity=' + newOpacity + ')';		theDiv.style.opacity = 1 - value / 20;		theDiv.style.filter = 'alpha(opacity=' + newOpacity + ')';		siw.floaterIframe.style.opacity = 1 - value / 20;		siw.floaterIframe.style.filter = 'alpha(opacity=' + newOpacity + ')';	}}function processSmartInput(inputBox, sqs_id) {	if (!siw) siw = new smartInputWindow();	siw.inputBox = inputBox;	try { classData = inputBox.className.split(" "); }	catch(e) {return;}	siwDirectives = null;	for (i=0;(!siwDirectives && classData[i]);i++) {		if (classData[i].indexOf("sqsEnabled") != -1)			siwDirectives = classData[i];	}	if (siwDirectives && (siwDirectives.indexOf(":") != -1)) {		siw.customFloater = true;		newFloaterId = siwDirectives.split(":")[1];		siw.floater = document.getElementById(newFloaterId);		siw.floaterContent = siw.floater.getElementsByTagName("div")[0];	}	//********************8	setSmartInputData();	//*********************	if (siw.matchCollection && (siw.matchCollection.length > 0)) selectSmartInputMatchItem(0);    if (siw.matchCollection && (siw.matchCollection.length == 1)) {        addedValue = siw.matchCollection[0].cleanValue;        siw.inputBox.value = addedValue;        runMatchingLogic(addedValue, true);        siw.inputBox.focus();        hideSmartInputFloater(true);        return;    }	//*********************	content = getSmartInputBoxContent();	if (content) {		modifySmartInputBoxContent(content);		showSmartInputFloater();	} else {		// display no match		if(typeof(sqs_query) != "undefined" && sqs_query.length > 0 && (typeof(sqs_objects[sqs_id]['disable']) == 'undefined' || sqs_objects[sqs_id]['disable'] == false)) {				//if(sqs_query.indexOf(sqs_last_query) != 0){					//hideSmartInputFloater(true);				//}else{					modifySmartInputBoxContent('<div class="sqsNoMatch">' + sqs_objects[sqs_id]['no_match_text'] + '</div>');					showSmartInputFloater();				//}			}	}}//processSmartInput()function smartInputMatch(cleanValue, value) {	this.cleanValue = cleanValue;	this.value = value;	this.isSelected = false;}//smartInputMatchfunction simplify(s) {	var unicode = '';	var badChars = new Object();	badChars['('] = 1;	badChars[')'] = 1;	for(var i=0; i<s.length; i++) {		var tempChar = '';		if(badChars[s.charAt(i)] != undefined){			continue;		} else if(s.charCodeAt(i) > 128) {			tempChar = s.charCodeAt(i).toString(16);			while(tempChar.length < 4) {				tempChar = "0" + tempChar;			}			tempChar = "\\u" + tempChar;		} else {			tempChar = s.charAt(i);		}		unicode += tempChar;	}	// cn: removed regex as MBCS was confusing it.	return unicode;}//simplifyfunction getUserInputToMatch(s) {	a = s;	fields = s.split(";");	if (fields.length > 0) a = fields[fields.length - 1];	return a; //.replace(/[()]+/g,'');}//getUserInputToMatchfunction getUserInputBase() {	try {		s = siw.inputBox.value;	}	catch(e) { return; }	a = s;	if ((lastComma = s.lastIndexOf(";")) != -1) {		a = a.replace(/^(.*\;[ \r\n\t\f\s]*).*$/i,'$1');	}	else		a = "";	return a;}//getUserInputBase()function runMatchingLogic(userInput, standalone) {	userInput = simplify(userInput);	uifc = userInput.charAt(0).toLowerCase();	if (uifc == '"') uifc = (n = userInput.charAt(1)) ? n.toLowerCase() : "z";	if (standalone) userInput = uifc;	if (siw) siw.matchCollection = new Array();	if (typeof(collection) == "undefined" ) return;	pointerToCollectionToUse = collection;	if (siw && (userInput.length == 1) && (!collectionIndex[uifc])) {		siw.buildIndex = true;	} else if (siw) {		siw.buildIndex = false;	}	tempCollection = new Array();    contacts_request = typeof sqs_objects[sqs_id]["modules"] != 'undefined' && sqs_objects[sqs_id]["modules"] == "Contacts";	if(userInput == '\\') {	   return;	}	if(contacts_request) {	   re1m = new RegExp("([\(\) \"\>\<\-]*)("+userInput+")","i");		re1 = new RegExp("([\(\) \"\}\{\-]*)("+userInput+")","gi");    } else {	   re1m = new RegExp("^([\(\) \"\>\<\-]*)("+userInput+")","i");		re1 = new RegExp("^([\(\) \"\}\{\-]*)("+userInput+")","gi");    }

⌨️ 快捷键说明

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