wangshan 4 lat temu
rodzic
commit
28c121b98a

+ 3 - 1
src/jfw/modules/app/src/web/staticres/jyapp/js/common.js

@@ -795,6 +795,8 @@ function pcredirect (link, sid) {
   window.open("/pcdetail/" + sid + ".html");
 }
 
+var isNumber = /^[0-9]+$/
+var isLetter = /^[a-zA-Z]+$/
 function keyWordHighlight (value, oldChars, newChar) {
   if (typeof (oldChars) == "undefined" || oldChars == null || typeof (newChar) == "undefined" || newChar == null || newChar == "") {
     return value;
@@ -809,7 +811,7 @@ function keyWordHighlight (value, oldChars, newChar) {
     var map = {};
     for (var i = 0; i < array.length; i++) {
       var oldChar = array[i];
-      if (oldChar.replace(/\s+/g, "") == "" || map[oldChar]) {
+      if (oldChar.replace(/\s+/g, "") == "" || map[oldChar] || isNumber.test(oldChar) || isLetter.test(oldChar)) {
         continue;
       }
       map[oldChar] = true;

+ 1 - 1
src/web/staticres/js/common.js

@@ -201,7 +201,7 @@ function keyWordHighlight(value,oldChars,newChar){
 		var map = {};
 		for(var i=0;i<array.length;i++){
 			var oldChar = array[i];
-			if(oldChar.replace(/\s+/g,"") == "" || map[oldChar]||isNumber.test(oldChar)||isLetter.test(oldChar)){
+			if(oldChar.replace(/\s+/g,"") == "" || map[oldChar] || isNumber.test(oldChar) || isLetter.test(oldChar)){
 				continue;
 			}
 			map[oldChar] = true;