<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">//  é–¢é€£ãƒ¯ãƒ¼ãƒ‰ã‚’å‡ºåŠ›ã™ã‚‹ãƒ¡ã‚½ãƒƒãƒ‰
var suggestWord = function (v,commercialTypeParam) {
  $.ajax({
    type: 'GET',
    url: '/common/suggest/v3/json?commercial_type=' + encodeURIComponent(commercialTypeParam) +'&amp;limit=10&amp;q=' + v,
    dataType: 'json'
  }).then(function (json) {
    if ((json.category &amp;&amp; json.category.length) || (json.brand &amp;&amp; json.brand.length) || (json.brand_category &amp;&amp; json.brand_category.length) || (json.shop &amp;&amp; json.shop.length) || (json.hotword &amp;&amp; json.hotword.length)){
      $.each(json, function(i, v) {
        $.each(v, function(j, x) {
          if(commercialTypeParam != '0|3' &amp;&amp; commercialTypeParam != '0|1|2|3'){
            x.commercial_type_param = encodeURIComponent(commercialTypeParam);
          }
          x.brand_name_double_encoded = encodeURIComponent(encodeURIComponent(x.brand_name));
        })
      })
      var template = Handlebars.templates['suggest_pc.template'];
      $('#output_suggestA').html(template(json));
    }
  });
}

//  é–¢é€£ã‚¢ã‚¤ãƒ†ãƒ&nbsp;ã‚’å‡ºåŠ›ã™ã‚‹ãƒ¡ã‚½ãƒƒãƒ‰
var suggestItem = function (v,commercialTypeParam) {
  $.ajax({
    type: 'GET',
    url: '/common/auto-complete?commercialType=' + commercialTypeParam + '&amp;q=' + v,
    dataType: 'json'
  }).then(function (json) {
    var template = Handlebars.compile($('#SuggestCommodities').html());
    $('#output_suggestB').html(template({Commodities:json}));
  });
}

//  æ–°ãƒ»æ¤œç´¢å±¥æ­´å‡ºåŠ›ãƒ¡ã‚½ãƒƒãƒ‰
var searchHistory = function () {
  var values = getSearchHistories();
  var newValues = values.slice(0,5);
  var template = Handlebars.compile($('#pcHeader_searchHistory_template').html());
  //Reebokã®ã¿ ãƒ¬ãƒ‡ã‚£ãƒ¼ã‚¹â†’ã‚¦ã‚£ãƒ¡ãƒ³ã‚ºã«å¤‰æ›
  if ( $('#schema').val() == 'reebok' ){
    var newValuesString = JSON.stringify(newValues);
    var newValuesReplace = newValuesString.replace(/ãƒ¬ãƒ‡ã‚£ãƒ¼ã‚¹/g,'ã‚¦ã‚£ãƒ¡ãƒ³ã‚º');
    var newValuesObject = JSON.parse(newValuesReplace);
    $('#output_searchHistory').html(template(newValuesObject)).show();
  } else {
    $('#output_searchHistory').html(template(newValues)).show();
  }
  headerSearchHistoryHeadingPc();
}

// å±¥æ­´orã‚µã‚¸ã‚§ã‚¹ãƒˆã&nbsp;ã—ã‚ã‘ãƒ¡ã‚½ãƒƒãƒ‰
var suggestDist = function () {
  var commercialTypeParam = '0|1|2|3'
  if($('input[name="commercialType"]').length){
    commercialTypeParam = $('input[name="commercialType"]').val();
  }

  var w = $('#searchText').val().length;
  var v = encodeURI($('#searchText').val());

  if(w &gt; 0){
    // ã‚µã‚¸ã‚§ã‚¹ãƒˆå‡ºã™
    suggestWord(v,commercialTypeParam);
    suggestItem(v,commercialTypeParam);
    // å±¥æ­´æ¶ˆã™
    $('#output_searchHistory').hide();
  }
  if(w == 0){
    // å±¥æ­´å‡ºã™
      searchHistory();
    // ã‚µã‚¸ã‚§ã‚¹ãƒˆæ¶ˆã™
    $('#output_suggestA').empty();
    $('#output_suggestB').empty();
  }
}

$(function() {
  $('#searchText').focusin(function(e) {
    $('.search_box').addClass('focus');
    // ãƒ†ã‚­ã‚¹ãƒˆãƒœãƒƒã‚¯ã‚¹ã«ãƒ•ã‚©ãƒ¼ã‚«ã‚¹æ™‚ã€å…¥åŠ›ãŒ0æ–‡å­—ã&nbsp;ã£ãŸã‚‰æ¤œç´¢å±¥æ­´ã‚’å‡ºã™
    suggestDist();
  });
  $(document).on('click',function(e) {
    if(!$(e.target).closest('.search_box').length) {
      // ã‚¿ãƒ¼ã‚²ãƒƒãƒˆè¦ç´&nbsp;ã®å¤–å´ã‚’ã‚¯ãƒªãƒƒã‚¯ã—ãŸæ™‚ã®æ“ä½œ
      // ãƒ•ã‚©ãƒ¼ã‚«ã‚¹ã‚’å¤–ã—ã¦å±¥æ­´ã¨ã‚µã‚¸ã‚§ã‚¹ãƒˆã‚‚æ¶ˆã™
      $('.search_box').removeClass('focus');
    } else {
      // ã‚¿ãƒ¼ã‚²ãƒƒãƒˆè¦ç´&nbsp;ã‚’ã‚¯ãƒªãƒƒã‚¯ã—ãŸæ™‚ã®æ“ä½œ
      return;
    }
 });

  $('#searchText').on('keyup', function(e) {
    //ã€€çŸ¢å°ã¯ç„¡åŠ¹
    switch(e.which){
      case 39: // Key[â†’]
      return false;
      break;

      case 37: // Key[â†]
      return false;
      break;

      case 38: // Key[â†‘]
      return false;
      break;

      case 40: // Key[â†“]
      return false;
      break;
    }
    suggestDist();

  });
});

// #52297 æ¤œç´¢çµæžœä¿å­˜ - ãƒ†ã‚­ã‚¹ãƒˆã®çœç•¥ãƒ¡ã‚½ãƒƒãƒ‰
function headerSearchHistoryHeadingPc (){
  if($('#searchBox #searchHistoryList .indexItemHeading').length){
    $('#searchBox #searchHistoryList .indexItemHeading').each(function () {
    // è¤‡æ•°è¡Œã‚’åˆ¤åˆ¥
      var H = $(this).height();
      if( H &gt; 30){

        // ã‚ªãƒªã‚¸ãƒŠãƒ«ã®æ–‡ç«&nbsp;ã‚’å–å¾—
        var $target = $(this).find('.inner');
        var htmlOrg = $target.html();
        var htmlEdit = htmlOrg;

        // widthã‚’è¨­å®šã—ã¦çœç•¥
        var W = $target.width();
        if ( W &gt; 290 ){
          $target.after('&lt;span class="displayAll"&gt;å…¨ã¦è¡¨ç¤º&lt;/span&gt;' ); 
        
          while ( W &gt; 270 ) {
            htmlEdit = htmlEdit.substr(0, htmlEdit.length - 1);
            $target.html(htmlEdit + "..."); 
            var W = $target.width(); 
          }
        } 
        // å¯¾è±¡ã®è¦ç´&nbsp;ã‚’ã€data-title ã«å…¥ã‚Œã‚‹
        $target.next('.displayAll').attr('data-title', htmlOrg);
      }
    });

    // å…¨ã¦è¡¨ç¤ºã™ã‚‹
    $('#searchHistoryList .displayAll').on('mousedown', function(){
      var html = $(this).attr('data-title');
      $(this).prev('.inner').html(html);
      $(this).remove();
      return false;
    });

    $('#searchHistoryList .deleteHistoryList').on('click', function(){
      // storageã‹ã‚‰å‰Šé™¤
      var removeItem = $(this).parents('.indexItem');
      var removeItemTitle = $(removeItem).find('.indexItemContent').attr('data-title-localstorage');
      removeSearchHistory(removeItemTitle);
      // è¡¨ç¤ºã•ã‚Œã¦ã„ã‚‹ãƒªã‚¹ãƒˆå‰Šé™¤
      $(removeItem).fadeOut(300, function(){
       $(this).remove();
      });
    });

  }
}</pre></body></html>