1/*** 2 <%--ææ¬åæç´¢--%> 3 <script src="<%=basePath%>/static/js/common/comTextarea.js?v=<%=componentsVersionNum%>"></script> 4 <link rel="stylesheet" href="<%=basePath%>/static/css/stylesheet/comTextarea.css?v=<%=componentsVersionNum%>" /> 5 * 6 * è°ç¨æ¹å¼ï¼MULTI_SEARCH.init(showArr, isAll,option); // å¼å ¥textareaï¼showArr=æ°ç»ï¼éè¦å±ç¤ºå¤ä¸ªæç´¢èç¹çæç´¢ç±»åï¼isAll=allï¼å¦æçäºallåå½åæä»¥æç´¢ç±»åé½å±ç¤ºå¤ä¸ªæç´¢æé®ï¼optionå为åå§å注åé项ï¼å¯éå¡« 7 * 1ãå¨éè¦æ³¨å页é¢ä¸çæç´¢inputè¾å ¥æ¡æ·»å class batchSearchType,å¤å±çtr/divå class searchTr 8 * 注æsearchTrå¿ é¡»æ·»å å¨åæç´¢ç±»åå¤å±èç¹å¹³çº§ï¼å 为è¦éè¿searchTrèç¹æ¾å°ä¸ä¸ä¸ªå å¼èç¹ï¼å¨æ¾è¿ä¸ªå å¼èç¹ä¸çæç´¢ç±»ååèç¹ 9 * 注æboxClassName为searchTrç±»åèç¹ä¸çidå符串åç§°ï¼ç¨æ¥è§£å³ä¸ä¸ªé¡µé¢å¤ä¸ªæç´¢æ³¨å导è´å²çªçé®é¢ï¼å¦æä¸ä¸ªé¡µé¢åªç¨äºä¸æ¬¡è¿ä¸ªæä»¶ï¼å¯ä»¥ä¸ç¨ä¼ ï¼ä½æ¯å¦ææå¤ä¸ªçè¯éè¦ä¼ å ¥åæ°å°optionéé¢ï¼åæ°å¯åèï¼{boxClassName: '#listSearchTr'} 10 * 11 * 2ãå¨åæ¢æç´¢ç±»åçæ¹æ³ä¸è¦è°ç¨ MULTI_SEARCH.closeText()æ¹æ³ï¼ç¨æ¥ç¡®è®¤å½å忢çæç´¢ç±»åæ¯å¦éè¦å±ç¤ºå¤ä¸ªæç´¢æé® 12 * 13 * 3ãå¦é®æ¡äºç²¾ç¡®æ¨¡ç³æç´¢ä¸ææ¡ å¨select䏿·»å èªå®ä¹å±æ§ uid="productSearchType" 14 * (ç±äºä¸ªå«å¸å±ä¼ä½¿iconä½ç½®å离ï¼å¨æ³¨åæ¶èªè¡ä¿®æ¹ä½ç½®å³å¯ 常åºç°çæ åµeq: $('.openSearchIcon').css('left','') || $('.openSearchIcon').addClass('left15');;) 15 ***/ 16 17 18var MULTI_SEARCH = (function($,W,D){ 19 var //searchInitType = false, //注åç¶æ 20 TextareaStr = { 21 openSearchIcon : '<span class="open-search-icon openSearchIcon" title="ç¹æ¤å±å¼ï¼æ¯æå¤ä¸ªæç´¢">', 22 closeSearchIcon : '<span class="close-search-icon closeSearchIcon" title="ç¹æ¤æ¶è
22µ·">', 23 textareaHtml : '<textarea class="textarea-search textareaSearch" placeholder="å¤ä¸ªæç´¢è¯·ç¨å车æ¢è¡(æ ééå·ç»å°¾)"></textarea>' 24 }, 25 spaceWrap = false, // å¤ä¸ªæç´¢è¯æ¯å¦æ¯æç©ºæ ¼éå¼ 26 chineseComma = false, // 䏿éå·éå¼ 27 commIsAll = '', //ä¿åæ¯å¦å ¨é¨æ¯æå±ç¤ºå¤ä¸ªæç´¢æé®ï¼å¦æçäºall忝 28 boxClassName = null, //æ¾å¨searchTrèç¹ä¸çidå符串åç§°ï¼ç¨æ¥è§£å³ä¸ä¸ªé¡µé¢å¤ä¸ªæç´¢æ³¨å导è´å²çªçé®é¢ 29 commShowArr = []; //ä¿åæ¯æå±ç¤ºå¤ä¸ªæç´¢æé®çæç´¢ç±»åææ¡ 30 // NoShowArr = ['æ é¢', 'å ¨çäº§åæ é¢','ä¾è´§å','åååç§°','å¼å¸¸å¤çå·','è§ååç§°','äº§åæ é¢','ç©æµååå·','ä¹°å®¶è´¦å·','æ¶ä»¶äºº','1688åååç§°','è´§æ¶ä½','ä»»å¡ç¼å·','循ç¯è®¡å','å ¥åºç¼å·','å¼å¸¸å¤çåå·','å ³èè¥éåç§°', 'åºååååç§°', 'è´§ååç§°','夿³¨']; //请å¿èªè¡æ·»å 31 32 $(D).off('click', '.openSearchIcon') 33 .on('click', '.openSearchIcon', function(){ 34 updateBoxClassName(this); 35 MULTI_SEARCH.openText(); // æå¼ææ¬å 36 }); 37 38 $(D).off('click', '.closeSearchIcon') 39 .on('click', '.closeSearchIcon', function(){ 40 updateBoxClassName(this); 41 MULTI_SEARCH.closeText(); // åæ¶ææ¬å 42 }); 43 44 $(D).off('blur', '.textareaSearch') 45 .on('blur', '.textareaSearch', function(){ 46 updateBoxClassName(this); 47 acquireVal(); // 失å»ç¦ç¹äºä»¶ 48 }); 49 50 //ç¹å»å ¶ä»ä½ç½®å¤ä¸ªæç´¢æ¶å¤± 51 // D.onmouseup = function (e) { 52 // if(searchInitType){ 53 // if($(e.target).hasClass('textareaSearch') || $(e.target).closest('.btnsss').length || $(e.target).hasClass('openSearchIcon')) return; 54 // MULTI_SEARCH.closeText(); 55 // } 56 // }; 57 58 //textarea失å»ç¦ç¹ 59 var acquireVal = function () { 60 var textareaVal = boxClassName ? $(boxClassName).find('.textareaSearch').val() : $('.textareaSearch').val(), 61 $classSearchType = boxClassName ? $(boxClassName).find('.batchSearchType') : $('.batchSearchType'), 62 $idSearchType = $("#batchSearchType"); 63 if(textareaVal.indexOf(',\n') !== -1){ 64 textareaVal = textareaVal.replace(/,\n/g,','); 65 } 66 if(textareaVal.indexOf('\n') !== -1){ 67 textareaVal = textareaVal.replace(/\n/g,','); 68 } 69 textareaVal = textareaVal.replace(/,+/g,','); 70 if($classSearchType.length){ 71 $classSearchType.val(textareaVal); 72 }else{ 73 $idSearchType.val(textareaVal); 74 } 75 }; 76 77 //æ´æ°å¤é¨èç¹ç±»å 78 var updateBoxClassName = function (obj) { 79 if (boxClassName && $(obj).closest('.searchTr').attr('id')) { 80 boxClassName = '#' + $(obj).closest('.searchTr').attr('id'); 81 } else { 82 boxClassName = null; 83 } 84 }; 85 86 return{ 87 /** 88 * 注åå¤éæç´¢æä»¶ 89 * showArr : é»è®¤ [], å½å忢çæç´¢ç±»åæ¾ç¤ºå¤ä¸ªæç´¢ï¼å¦æä¸ä¼ é»è®¤æææç´¢ç±»åé½å±ç¤ºå¤ä¸ªæç´¢ ['SKU', '产åId', ...] 90 * isAll: é»è®¤ä¸ºç©ºï¼æ¯å¦å ¨é¨æç´¢ç±»åé½å±ç¤ºå¤ä¸ªæç´¢æé®ï¼å¦æçäºallåæ¯å ¨é¨ ï¼'all'ï¼ 91 * option: åå§å注åé项 92 * @option.spaceWrap: é»è®¤false, æ¯å¦æ¯æç©ºæ ¼éå¼ Boolean 93 * @option.chineseComma: é»è®¤false, æ¯å¦æ¯æä¸æéå·éå¼ Boolean 94 * @option.placeholder: é»è®¤(å¤ä¸ªæç´¢è¯·ç¨å车æ¢è¡(æ ééå·ç»å°¾)), ææ¬å为空çæç¤ºæå 95 * @option.boxClassName: é»è®¤ä¸ºç©º, 页é¢å¤å¤ä½¿ç¨æ¤æä»¶æ¶éè¦é½ä¼ å ¥æ¤åæ°ï¼ç¨äºåºå String (éè¦å¨.searchTrèç¹ä¸å ä¸ä¸ªidç¨äºåºåä¸åçç»ä»¶) 96 * */ 97 init: function(showArr, isAll, option){ 98 boxClassName = (option && option.boxClassName) ? option.boxClassName : null; 99 var $batchSearchType = boxClassName ? $(boxClassName).find('.batchSearchType') : $('.batchSearchType'), 100 $tr = $batchSearchType.closest('.searchTr'), 101 $myjActive = $tr.prev().find('.myj-active:visible'), 102 $tabActive = $tr.prev().find('.tab-active:visible'), 103 $inActive = $tr.prev().find('.in-active:visible'), 104 $selectActive = $tr.prev().find('option:selected'), 105 $active, 106 text; 107 108 if($myjActive.length){ 109 $active = $myjActive; 110 }else if($tabActive.length){ 111 $active = $tabActive; 112 }else if ($inActive.length) { 113 $active = $inActive; 114 } else { 115 $active = $selectActive; 116 } 117 118 text = $.trim($active.text()); 119 $batchSearchType.parent().addClass('relative'); 120 if (!$batchSearchType.next('.openSearchIcon').length) $batchSearchType.after(TextareaStr.openSearchIcon);//妿èç¹ä¸å卿æå ¥ 121 if (!showArr) showArr = []; 122 commShowArr = showArr; 123 commIsAll = isAll; 124 125 var $openSearchIcon = boxClassName ? $(boxClassName).find('.openSearchIcon') : $('.openSearchIcon'); 126 if (commIsAll === 'all') { //妿çäºallåæå¤ä¸ªæç´¢æ¾ç¤º 127 $batchSearchType.addClass('p-left30'); 128 $openSearchIcon.removeClass('hide'); 129 } else if (commShowArr.length && commShowArr.indexOf(text) !== -1){ 130 //妿æ°ç»æå¼ä¸åå¨ï¼åæ¾ç¤ºå¤ä¸ªæç´¢ 131 $batchSearchType.addClass('p-left30'); 132 $openSearchIcon.removeClass('hide'); 133 } else { //å¦ææ²¡ä¼ isAllï¼textä¹ä¸å¨commShowArræ°ç»å½ä¸ï¼åå½åçæç´¢ç±»åä¸å±ç¤ºå¤ä¸ªæç´¢ 134 $batchSearchType.removeClass('p-left30'); 135 $openSearchIcon.addClass('hide'); 136 } 137 138 //è®¾ç½®ç¶æ 139 // searchInitType = true; 140 141 // ç©ºæ ¼éå¼ 142 spaceWrap = option && !!option.spaceWrap; 143 // 䏿éå·éå¼ 144 chineseComma = option && !!option.chineseComma; 145 // é»è®¤placeholder
146 if (option && (option.placeholder || option.placeholder === '')) { 147 TextareaStr.textareaHtml = '<textarea class="textarea-search textareaSearch" placeholder="' + option.placeholder + '"></textarea>'; 148 } 149 }, 150 // è®¾ç½®ææ¬åæç¤ºæå textï¼æç¤ºæå isShowæ¯å¦æå¼ææ¬å 151 setPlaceholder: function(text, isShow) { 152 var $closeSearchIcon = boxClassName ? $(boxClassName).find('.closeSearchIcon') : $('.closeSearchIcon'); 153 if(!$closeSearchIcon.length) { //妿èç¹ä¸åå¨ 154 TextareaStr.textareaHtml = '<textarea class="textarea-search textareaSearch" placeholder="' + text + '"></textarea>'; 155 } else { 156 boxClassName ? $(boxClassName).find('.textareaSearch').attr('placeholder', text) : $('.textareaSearch').attr('placeholder', text); 157 } 158 if (!!isShow)MULTI_SEARCH.openText(); // æå¼ææ¬å; 159 }, 160 // 设置æ¯å¦æ¯æç©ºæ ¼éå¼ hasSpaceWrap:Boolean isShow:æ¯å¦æå¼ææ¬å 161 setSpaceWrap: function(hasSpaceWrap, isShow) { 162 spaceWrap = !!hasSpaceWrap; 163 if (!!isShow)MULTI_SEARCH.openText(); // æå¼ææ¬å; 164 }, 165 // æå¼ææ¬å 166 openText : function () { 167 var $batchSearchType = boxClassName ? $(boxClassName).find('.batchSearchType') : $('.batchSearchType'), 168 $openSearchIcon = boxClassName ? $(boxClassName).find('.openSearchIcon') : $('.openSearchIcon'), 169 $closeSearchIcon = boxClassName ? $(boxClassName).find('.closeSearchIcon') : $('.closeSearchIcon'), 170 $textareaSearch = boxClassName ? $(boxClassName).find('.textareaSearch') : $('.textareaSearch'), 171 regRules = chineseComma ? /[,ï¼]/g : /,/g, 172 val = $batchSearchType.val().replace(regRules, '\n'), 173 $select = $openSearchIcon.parent().find('select[uid="productSearchType"]'), 174 createWidth = +$batchSearchType[0].offsetWidth, 175 selectWidth = $select.length ? +$select[0].offsetWidth : 0, 176 positionLeft = $batchSearchType[0].offsetLeft, 177 positionTop = $batchSearchType[0].offsetTop; 178 if (spaceWrap) { 179 val = val.replace(/\s+/g, '\n'); 180 } 181 if(!$closeSearchIcon.length){ //妿èç¹ä¸åå¨ 182 $openSearchIcon.after(TextareaStr.textareaHtml); //æå ¥ææ¬å 183 $openSearchIcon.after(TextareaStr.closeSearchIcon); //æå ¥å ³éæç´¢æé®èç¹ 184 $textareaSearch = boxClassName ? $(boxClassName).find('.textareaSearch') : $('.textareaSearch'); //éæ°èµå¼ææ¬åèç¹ 185 $textareaSearch.css({ 186 'top': positionTop + 'px', 187 'left': positionLeft + 'px' 188 }).val(val); 189 $closeSearchIcon.css({ 190 'top': (positionTop + 7) + 'px', 191 'left': (positionLeft + 8) + 'px' 192 }); 193 }else{ 194 $closeSearchIcon.removeClass('hide'); 195 $textareaSearch.removeClass('hide').val(val); 196 } 197 if($select.length && $select.is(':visible')){ 198 $textareaSearch.css('width', createWidth - selectWidth); 199 }else{ 200 $textareaSearch.css('width', createWidth); 201 } 202 $openSearchIcon.addClass('hide'); 203 }, 204 // åæ¶ææ¬å 205 closeText : function () { 206 var $batchSearchType = boxClassName ? $(boxClassName).find('.batchSearchType') : $('.batchSearchType'), 207 $closeSearchIcon = boxClassName ? $(boxClassName).find('.closeSearchIcon') : $('.closeSearchIcon'), 208 $openSearchIcon = boxClassName ? $(boxClassName).find('.openSearchIcon') : $('.openSearchIcon'), 209 $textareaSearch = boxClassName ? $(boxClassName).find('.textareaSearch') : $('.textareaSearch'), 210 $tr = $batchSearchType.closest('.searchTr'), 211 $myjActive = $tr.prev().find('.myj-active:visible'), 212 $tabActive = $tr.prev().find('.tab-active:visible'), 213 $inActive = $tr.prev().find('.in-active:visible'), 214 $selectActive = $tr.prev().find('option:selected'), 215 $active, 216 text; 217 218 if($myjActive.length){ 219 $active = $myjActive; 220 }else if($tabActive.length){ 221 $active = $tabActive; 222 } else if ($inActive.length) { 223 $active = $inActive; 224 } else { 225 $active = $selectActive; 226 } 227 text = $.trim($active.text()); 228 $textareaSearch.addClass('hide'); 229 $closeSearchIcon.addClass('hide'); 230 231 if (commIsAll === 'all') { //妿çäºallåæå¤ä¸ªæç´¢æ¾ç¤º 232 $batchSearchType.addClass('p-left30'); 233 $openSearchIcon.removeClass('hide'); 234 } else if (commShowArr.length && commShowArr.indexOf(text) !== -1){ 235 //妿æ°ç»æå¼ä¸åå¨ï¼åæ¾ç¤ºå¤ä¸ªæç´¢ 236 $batchSearchType.addClass('p-left30'); 237 $openSearchIcon.removeClass('hide'); 238 } else { //å¦ææ²¡ä¼ isAllï¼textä¹ä¸å¨commShowArræ°ç»å½ä¸ï¼åå½åçæç´¢ç±»åä¸å±ç¤ºå¤ä¸ªæç´¢ 239 $batchSearchType.removeClass('p-left30'); 240 $openSearchIcon.addClass('hide'); 241 } 242 243 //è®¾ç½®ç¶æ 244 // searchInitType = false;
245 }, 246 // 强å¶éèææ¬å 247 forceCloseText: function () { 248 var $openSearchIcon = boxClassName ? $(boxClassName).find('.openSearchIcon') : $('.openSearchIcon'), 249 $textareaSearch = boxClassName ? $(boxClassName).find('.textareaSearch') : $('.textareaSearch'), 250 $closeSearchIcon = boxClassName ? $(boxClassName).find('.closeSearchIcon') : $('.closeSearchIcon'), 251 $batchSearchType = boxClassName ? $(boxClassName).find('.batchSearchType') : $('.batchSearchType'); 252 $textareaSearch.addClass('hide'); 253 $closeSearchIcon.addClass('hide'); 254 $batchSearchType.removeClass('p-left30'); 255 $openSearchIcon.addClass('hide'); 256 } 257 } 258})(jQuery,window,document);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.