1$(function() { 2 3 'use strict'; 4 5 // å è¡å±ç¤ºã®ãªã³ã¯ãåºãããã®manual config 6 var EXHIBITION_JSON = '/share5/sideinclude/exhibition.jsonp'; 7 8 // ãåå詳細ãã§çæãããæã®ä¸è¦§ã¸ã®ãªã³ã¯ 9 var EXHIBITION_URL = '/store/retail/exhibition/'; 10 11 // å¤é¨JSONï¼./share5/sideinclude/exhibition.jsonpï¼ãã 12 // Ajaxã§ãã¨ã§åå¾ãã¦ä¿ç®¡ãããã 13 var exhibitionList = []; 14 15 // å¼·å¶è¡¨ç¤ºã®ãªã¹ã 16 var forceExhibitionList = []; 17 18 // ãå è¡å±ç¤ºãåºåãã¹ãclassãæ¢ãã¦æ ¼ç´ 19 var $exhibition = $('body').find('.s5-exhibition'); 20 21 // å è¡å±ç¤ºã®ç©ºdivãåå¨ãããjsonã®åå¾ãå®è¡ãããåå¾ã§ãããhtmlã使ããã 22 if($exhibition.length > 0){ 23 $.when( 24 25 $.ajax({ 26 url : EXHIBITION_JSON, 27 scriptCharset : 'UTF-8', 28 dataType : 'jsonp', 29 type : 'GET', 30 jsonpCallback : 'manualExhibition', 31 cache : true 32 }) 33 34 ).done(function(json){ 35 36 // åå¾ãã¦æ ¼ç´ãã¦ãã 37 exhibitionList = json; 38 39 // èªã¿è¾¼ãã å¾ã«å®è¡ 40 $(window).on('load',function(){ 41 42 // ä¾¡æ ¼jsã®ã¹ãã¼ã¿ã¹ãåºåããã¦ãããã®ãåå¾ãã¦æ ¼ç´ãã 43 var $apiResponseEl = $('body').find('.s5-price-api-status'); 44 45 // æè£½jsonpãåã 46 $(exhibitionList).each(function(index, el) { 47 // ãããã³ã°ããã«forceã ãé åã«ãã 48 if ( el.display_force === true ) { 49 forceExhibitionList.push(el.product_code); 50 } 51 }); 52 53 // ãå è¡å±ç¤ºãåºåãã¹ãDOMãæ¢ã 54 $exhibition.each(function(index){ 55 56 if ( _.contains(forceExhibitionList, $exhibition.eq(index).attr('data-s5exhibition-productcode')) ) { 57 58 // å¼·å¶è¡¨ç¤ºç¨ã®é åã«å«ã¾ãããªãå¼·å¶ã§ãªã³ã¯ãçæãã 59 setExhibition( $(this) ); 60 61 } else if ( $exhibition.eq(index).attr('data-s5exhibition-productrelease') === 'unsale' ) { 62 63 // PIDã¢ãã«ãdomåºåãã¦ããããçºå£²æ¥ãã©ããã¯data屿§ã§åºåãã¦ããã®ã§ãããã¿ã¦ãªã³ã¯ãçæ 64 setExhibition( $(this) ); 65 66 } else if ( $apiResponseEl.eq(index).attr('data-s5-price-api-status') != null ) { 67 // ä¾¡æ ¼jsã®çºå£²ã¹ãã¼ã¿ã¹ã®nullå¦ç 68 69 if ( /11|12|13|14/.test( $apiResponseEl.eq(index).attr('data-s5-price-api-status') ) ) { 70 71 // st:ååã¹ãã¼ã¿ã¹ã以ä¸ã®ãã®ã¯åºã 72 // 11ï¼ã¡ã¼ã«ç»é² 73 // 12ï¼ã¨ã³ããªã¼ 74 // 13ï¼å注å(è³¼å ¥å°ç·OFF) 75 // 14ï¼å è¡äºç´è²©å£²ä¸ 76 // storeStyleLink ãåºåãã¦ãããã®ã«ããããããã©ãããã§ã㯠77 setExhibition( $(this) ); 78 79 } 80 81 } 82 83 }); 84 85 // å è¡ä½é¨ã»å±ç¤ºæ å ±ã®ãªã³ã¯ãã¬ã³ããªã³ã°ãããã¨ã 86 // IEã ãé«ãåããã®ã¿ã¤ãã³ã°ãåã£ã¦ããªãã£ã 87 var itemMin = new Lineups( [
88 '.s5-listItem4__includeBox' 89 ], { 90 resize: true 91 } ); 92 itemMin.refreshAll(); 93 94 }); 95 96 }); 97 } 98 99 //htmlã®ä½æãè¡ã 100 function setExhibition($el){ 101 102 var isAV = !!$el.attr( 'data-s5exhibition-productcode' ); 103 // checkEnable()ã使ã£ã¦Listã¨ã®ç §åãè¡ãªã£ã¦ãããçµæã¯ true / false ã§è¿å´ãããã®ã§ããããæ ¼ç´ãã 104 var enable = checkEnable($el.attr('data-s5exhibition-productcode'), exhibitionList); 105 var data = {}; 106 data.productcode = []; 107 var productcodeList = []; 108 var templateName = $el.attr('data-s5exhibition-template'); 109 var itemCount = 0; 110 //ã¿ã¤ãã«ã¨ããã¹ã default 111 var title = ""; 112 var text = ""; 113 var list_text = ""; 114 var $html = getTemplate(templateName); 115 var $html_title = $html.find(".s5-previousExhibition__header"); 116 var $html_text = $html.find(".s5-previousExhibition__smallText"); 117 118 if(enable && isAV){ 119 var productcode = $el.attr( 'data-s5exhibition-productcode' ); 120 // ãproductcodeã空ãproductgroupidã®ã¿å¤ãããã®å ´åããã 121 if (!!productcode && productcode != ""){ 122 data.productcode = stringToArray(productcode); 123 } 124 } 125 126 //DOMã使 127 $.each(exhibitionList, function(index, item) { 128 // jsonããåå¾ãããã¼ã¿ 129 productcodeList = stringToArray( item.product_code ); 130 title = "æ°åå çºå£²åå è¡ä½é¨ã»å±ç¤º"; 131 text = "åºèã§åºæ¥ãååä½é¨ãã©ããããæ©ãååã試ãã¾ã!"; 132 list_text = "å è¡ä½é¨ã»å±ç¤ºæ å ±ã¯ãã¡ã"; 133 134 // messageãã©ã° 135 if(!!item.message && item.message != null){ 136 switch(parseInt(item.message)){ 137 case 1: 138 if(!item.title){title = 'çºå£²åå è¡å±ç¤º';} 139 if(!item.list_text){list_text = 'çºå£²åå è¡å±ç¤º';} 140 break; 141 case 2: 142 if(!item.title){title = 'çºå£²åä½é¨ã»å±ç¤º';} 143 if(!item.list_text){list_text = 'çºå£²åä½é¨ã»å±ç¤º';} 144 break; 145 case 3: 146 if(!item.title){title = 'çºå£²åå±ç¤º';} 147 if(!item.list_text){list_text = 'çºå£²åå±ç¤º';} 148 break; 149 default: 150 break; 151 } 152 } 153 //jsonã®å®ç¾©ãããå ´å 154 if(!!item.title && item.title !== ""){ title = item.title; } 155 if(!!item.text && item.text !== ""){ text = item.text; } 156 if(!!item.list_text && item.list_text !== ""){ list_text = item.list_text; } 157 158 //jsonã¨divã¿ã°ã«æå®ãããããã¯ãã³ã¼ããé ååãããã®ãæ¯è¼ 159 $.each(productcodeList, function(productcodeIndex, row){ 160 161 //ãããã¯ãã³ã¼ããä¸è´ããã$htmlã«è¿½å ãã 162 if(data.productcode.indexOf(row) !== -1){ 163 //ãã³ãã¬ã¼ãã«è¿½å ããã¢ã¤ãã ãã«ã¦ã³ã 164 itemCount++; 165 166 //ãã³ãã¬ã¼ãã«å¿ãã¦å 容ã夿´ 167 if(templateName === 'detail'){ 168 $html.find(".s5-previousExhibition__itemLists").append( 169 [ 170 '<div class="s5-previousExhibition__item">', 171 '<div class="s5-previousExhibition__itemInner">', 172 '<a href="' + item.url +'">', 173 '<div class="s5-previousExhibition__image">', 174 '<img src="' + item.img + '" alt="" width="72" height="54">', 175 '</div>', 176 '<div class="s5-previousExhibition__text">', 177 '<div class="s5-previousExhibition__eyecatcher">' + item.product_name + '</div>', 178 '</div>', 179 '</a>', 180 '</div>', 181 '</div><!-- /.s5-previousExhibition__item -->', 182 ].join('\n') 183 ); 184 $html.find(".s5-previousExhibition__header").prepend(title); 185 $html.find(".s5-previousExhibition__smallText").prepend(text); 186 return false; 187 }else if(templateName === "list"){ 188 $html.find('.s5-previousExhibition__hedding').append( 189 [ 190 '<p class="s5-previousExhibition__header">', 191 '<a class="s5-link s5-previousExhibition__eyecatcher" href="' + item.url + '">' + list_text +'</a>', 192 '</p>' 193 ].join('\n') 194 ); 195 return false;
196 } 197 } 198 }); 199 }); 200 if(itemCount > 0){ 201 $el.append($html); 202 } 203 } 204 205 function getTemplate( templateName, templat_title, templat_text){ 206 var template = $(); 207 var url; 208 209 // if(templateName === 'category-top'){ 210 211 // template = $([ 212 // '<div class="s5-previousExhibition1">', 213 // '<div class="s5-previousExhibition__inner">', 214 // '<p class="s5-previousExhibition__header">', 215 // 'æ°åå çºå£²åå è¡ä½é¨ã»å±ç¤º', 216 // '<span class="s5-previousExhibition__smallText">åºèã§åºæ¥ãååä½é¨ãã©ããããæ©ãååã試ãã¾ã!</span>', 217 // '<a class="s5-previousExhibition__eyecatcher" href="' + EXHIBITION_URL + '">ä¸è¦§ã¸</a>', 218 // '</p>', 219 // '<div class="s5-previousExhibition__itemLists">', 220 // '</div>', 221 // '</div>', 222 // '</div>' 223 // ].join( '\n' )); 224 225 // } 226 227 if(templateName === 'detail'){ 228 229 template = $([ 230 '<div class="s5-previousExhibition2">', 231 '<div class="s5-previousExhibition__inner">', 232 '<div class="s5-previousExhibition__hedding">', 233 '<p class="s5-previousExhibition__header">', 234 '<a class="s5-link s5-previousExhibition__eyecatcher" href="' + EXHIBITION_URL + '">ä¸è¦§ã¸</a>', 235 '<span class="s5-previousExhibition__smallText"></span>', 236 '</p>', 237 '</div>', 238 '<div class="s5-previousExhibition__main">', 239 '<div class="s5-previousExhibition__itemLists">', 240 '</div>', 241 '</div>', 242 '</div>', 243 '</div>' 244 ].join( '\n' )); 245 246 }else if(templateName === 'list'){ 247 248 template = $([ 249 '<div class="s5-previousExhibition3">', 250 '<div class="s5-previousExhibition__inner">', 251 '<div class="s5-previousExhibition__hedding">', 252 '</div>', 253 '</div>', 254 '</div>' 255 ].join('\n')); 256 } 257 return template; 258 } 259 260 // ã,ãã«ã³ãã¾ãã¯ã|ããã¤ãåºåãã®ããã¹ããé åã«ãã 261 function stringToArray(string){ 262 return string.replace( /\s/g, '' ).split( /,|\|/ ); 263 } 264 265 //第ä¸å¼æ°(divã«æå®ãããããã¯ãã³ã¼ã)ã第ï¼å¼æ°(jsonãªãã¸ã§ã¯ã) 266 //productcodeãListã«åå¨ããå ´å,trueãè¿ãã¦ãæ¯è¼å¦çãçµäºããã 267 function checkEnable( productcode, list ) { 268 var isProductcode = false; 269 270 if(!!productcode && !!list){ 271 272 // productã³ã¼ãã¯ã¾ã¨ãã¦æ¸ãã¦ããã®ã§æ¯è¼ã®æã¯ãã©ãã©ã«ãã 273 var productcodeArray = productcode.split( /,|\|/ ); 274 var listArray = []; 275 276 $.each(list, function(index, item) { 277 listArray = item.product_code.split( /,|\|/ ); 278 279 $.each(listArray, function(listArrayIndex, row) { 280 if(productcodeArray.indexOf(row) !== -1){ 281 isProductcode = true; 282 return false; 283 } 284 }); 285 if(isProductcode){ return false }; 286 }); 287 } 288 return isProductcode; 289 } 290});
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.