PageSourceSearch

https://happinessnet.co.jp/wp-content/themes/happinessnet/js/products.js?ver=202503181149

js happinessnet.co.jp collected 2026-10-07 07:19:06 UTC 146,036 bytes, 3,985 lines download raw bytes

1jQuery(function ($) {
2  $(window).on("load", function () {
3    // ---------------------------------------------------------------
4    // カラーミーがメンテナンス中の場合の処理
5    if (data.length == 0) {
6      const path = location.pathname;
7      if (path == "/") {
8        $("body").html(
9          '<div class="maintenance-wrapper"><p class="maintenance">ただいまメンテナンス中です。<br>ご迷惑をお掛けいたしますが、ご理解いただけますようお願いいたします。</p></div>'
10        );
11      } else {
12        location.pathname = "/";
13      }
14    }
15    
16    const excludeIds = [1896274, 1896271, 1896269, 1896268, 1896267, 1896263, 2741888, 2741889]; // 除外するIDを追加
17    data = data.filter(item =>
18      item && 
19      typeof item.sales_price !== "undefined" && item.sales_price > 30000 &&
20      item.group_ids && 
21      !excludeIds.some(excludeId => item.group_ids.includes(excludeId))
22    );
23
24    // ---------------------------------------------------------------
25
26    // ---------------------------------------------------------------
27    // グローバル変数
28    const battery_group = {
29      2662633: "100%",
30      2662634: "99%",
31      2662635: "98%",
32      2662636: "97%",
33      2662637: "96%",
34      2662638: "95%",
35      2662639: "94%",
36      2662640: "93%",
37      2662641: "92%",
38      2662642: "91%",
39      2662643: "90%",
40      2662644: "89%",
41      2662645: "88%",
42      2662646: "87%",
43      2662647: "86%",
44      2662648: "85%",
45      2662649: "84%",
46      2662651: "83%",
47      2662652: "82%",
48      2662653: "81%",
49      2662654: "80%",
50      2662655: "79%",
51      2662656: "78%",
52      2662657: "77%",
53      2662658: "76%",
54      2662659: "75%",
55      2662661: "74%",
56      2662662: "73%",
57      2662663: "72%",
58      2662664: "71%",
59      2662665: "70%",
60    };
61
62    const model_ids = [
63      "2741888",
64      "2741889",
65      "2717119",
66      "2717117",
67      "2596580",
68      "2596578",
69      "2396154",
70      "2448975",
71      "2439513",
72      "2007747",
73      "2007748",
74      "1896275",
75      "1896274",
76      "1896271",
77      "1896268",
78      "1896267",
79      "1896269",
80      "1896263",
81      "2803017",
82      "3020633",
83      "3020634",
84      "3066674",
85      "3066675",
86    ];
87
88    const battery_ids_str = Object.keys(battery_group);
89    const battery_ids = battery_ids_str.map(Number);
90
91    let model_once_flg = 1;
92
93    let organized_data = data;
94    let sort_val = "new";
95
96    let keyword = "";
97    let organized_keyword = "";
98    let model = [];
99    let career = [];
100    let strage = [];
101    let color = [];
102    let rank = [];
103    let low = "";
104    let heigh = "";
105    let low_flg = 0;
106    let heigh_flg = 0;
107
108    let fav_ids = [];
109
110    let others_flg = 0;
111    let params_flg = 0;
112    let fav_flg = 0;
113
114    const original_data = data;
115
116    let searched_data = [];
117    let searched_keyword = [];
118    let searched_model = [];
119    let searched_career = [];
120    let searched_strage = [];
121    let searched_color = [];
122    let searched_rank = [];
123    let searched_price = [];
124
125    let searched_fav = [];
126
127    let matched_data = [];
128
129    let page = 1;
130    // ---------------------------------------------------------------
131    // ---------------------------------------------------------------
132    // モデルごとのデータを抽出
133    const original_ipad_data = original_data.filter((value) => {
134      //console.log(value);
135
136      if (value.group_ids.find((v) => v == 2741888)) {
137        return true;
138      }
139    });
140    const original_android_data = original_data.filter((value) => {
141      if (value.group_ids.find((v) => v == 2741889)) {
142        return true;
143      }
144    });
145    const original_15pro_data = original_data.filter((value) => {
146      if (value.group_ids.find((v) => v == 3066675)) {
147        return true;
148      }
149    });
150    const original_15_data = original_data.filter((value) => {
151      if (value.group_ids.find((v) => v == 3066674)) {
152        return true;
153      }
154    });
155    const original_14pro_data = original_data.filter((value) => {
156      if (value.group_ids.find((v) => v == 3020634)) {
157        return true;
158      }
159    });
160    const original_14_data = original_data.filter((value) => {
161      if (value.group_ids.find((v) => v == 3020633)) {
162        return true;
163      }
164    });
165    const original_se3_data = original_data.filter((value) => {
166      if (value.group_ids.find((v) => v == 2803017)) {
167        return true;
168      }
169    });
170    const original_13pro_data = original_data.filter((value) => {
171      if (value.group_ids.find((v) => v == 2717119)) {
172        return true;
173      }
174    });
175    const original_13_data = original_data.filter((value) => {
176      if (value.group_ids.find((v) => v == 2717117)) {
177        return true;
178      }
179    });
180    const original_12pro_data = original_data.filter((value) => {
181      if (value.group_ids.find((v) => v == 2596580)) {
182        return true;
183      }
184    });
185    const original_12_data = original_data.filter((value) => {
186      if (value.group_ids.find((v) => v == 2596578)) {
187        return true;
188      }
189    });
190    const original_se2_data = original_data.filter((value) => {
191      if (value.group_ids.find((v) => v == 2396154)) {
192        return true;
193      }
194    });
195    const original_11pro_data = original_data.filter((value) => {
196      if (value.group_ids.find((v) => v == 2448975)) {
197        return true;
198      }
199    });
200    const original_11_data = original_data.filter((value) => {
201      if (value.group_ids.find((v) => v == 2439513)) {
202        return true;
203      }
204    });
205    const original_xs_data = original_data.filter((value) => {
206      if (value.group_ids.find((v) => v == 2007747)) {
207        return true;
208      }
209    });
210    const original_xr_data = original_data.filter((value) => {
211      if (value.group_ids.find((v) => v == 2007748)) {
212        return true;
213      }
214    });
215    const original_x_data = original_data.filter((value) => {
216      if (value.group_ids.find((v) => v == 1896275)) {
217        return true;
218      }
219    });
220    const original_8_data = original_data.filter((value) => {
221      if (value.group_ids.find((v) => v == 1896274)) {
222        return true;
223      }
224    });
225    const original_7_data = original_data.filter((value) => {
226      if (value.group_ids.find((v) => v == 1896271)) {
227        return true;
228      }
229    });
230    const original_6s_data = original_data.filter((value) => {
231      if (value.group_ids.find((v) => v == 1896268)) {
232        return true;
233      }
234    });
235    const original_6_data = original_data.filter((value) => {
236      if (value.group_ids.find((v) => v == 1896267)) {
237        return true;
238      }
239    });
240    const original_se_data = original_data.filter((value) => {
241      if (value.group_ids.find((v) => v == 1896269)) {
242        return true;
243      }
244    });
245    const original_5s_data = original_data.filter((value) => {
246      if (value.group_ids.find((v) => v == 1896263)) {
247        return true;
248      }
249    });
250    // その他のデータ
251    let not_others_data = [];
252    let not_others_data_array = [];
253    for (let i = 0; i < model_ids.length; i++) {
254      not_others_data = original_data.filter((value) => {
255        if (value.group_ids.find((v) => v == model_ids[i])) {
256          return true;
257        }
258      });
259      not_others_data_array = not_others_data_array.concat(not_others_data);
260    }
261    not_others_data_array = Array.from(new Set(not_others_data_array));
262    const original_others_data = original_data.filter(
263      (a) => not_others_data_array.indexOf(a) == -1
264    );
265
266    // モデルごとのデータ
267    let model_ipad_data = [];
268    let model_android_data = [];
269    let model_15pro_data = [];
270    let model_15_data = [];
271    let model_14pro_data = [];
272    let model_14_data = [];
273    let model_se3_data = [];
274    let model_13pro_data = [];
275    let model_13_data = [];
276    let model_12pro_data = [];
277    let model_12_data = [];
278    let model_se2_data = [];
279    let model_11pro_data = [];
280    let model_11_data = [];
281    let model_xs_data = [];
282    let model_xr_data = [];
283    let model_x_data = [];
284    let model_8_data = [];
285    let model_7_data = [];
286    let model_6s_data = [];
287    let model_6_data = [];
288    let model_se_data = [];
289    let model_5s_data = [];
290
291    // ---------------------------------------------------------------
292    // ---------------------------------------------------------------
293    // キャリアごとのデータを抽出
294    const original_sim_data = original_data.filter((value) => {
295      if (value.category.id_small == "4") {
296        return true;
297      }
298    });
299    const original_docomo_data = original_data.filter((value) => {
300      if (value.category.id_small == "1") {
301        return true;
302      }
303    });
304    const original_au_data = original_data.filter((value) => {
305      if (value.category.id_small == "2") {
306        return true;
307      }
308    });
309    const original_softbank_data = original_data.filter((value) => {
310      if (value.category.id_small == "3") {
311        return true;
312      }
313    });
314    const original_ymobile_data = original_data.filter((value) => {
315      if (value.category.id_small == "5") {
316        return true;
317      }
318    });
319
320    // キャリアごとのデータ
321    let career_sim_data = [];
322    let career_docomo_data = [];
323    let career_au_data = [];
324    let career_softbank_data = [];
325    let career_ymobile_data = [];
326
327    // ---------------------------------------------------------------
328    // ---------------------------------------------------------------
329    // ストレージごとのデータを抽出
330    const original_16_data = original_data.filter((value) => {
331      if (value.group_ids.find((v) => v == 2026741)) {
332        return true;
333      }
334    });
335    const original_32_data = original_data.filter((value) => {
336      if (value.group_ids.find((v) => v == 2026742)) {
337        return true;
338      }
339    });
340    const original_64_data = original_data.filter((value) => {
341      if (value.group_ids.find((v) => v == 2026743)) {
342        return true;
343      }
344    });
345    const original_128_data = original_data.filter((value) => {
346      if (value.group_ids.find((v) => v == 2026744)) {
347        return true;
348      }
349    });
350    const original_256_data = original_data.filter((value) => {
351      if (value.group_ids.find((v) => v == 2026745)) {
352        return true;
353      }
354    });
355    const original_512_data = original_data.filter((value) => {
356      if (value.group_ids.find((v) => v == 2026746)) {
357        return true;
358      }
359    });
360
361    // ストレージごとのデータ
362    let strage_16_data = [];
363    let strage_32_data = [];
364    let strage_64_data = [];
365    let strage_128_data = [];
366    let strage_256_data = [];
367    let strage_512_data = [];
368
369    // ---------------------------------------------------------------
370    // ---------------------------------------------------------------
371    // カラーごとのデータを抽出
372    const original_white_data = original_data.filter((value) => {
373      if (value.group_ids.find((v) => v == 2026804)) {
374        return true;
375      }
376    });
377    const original_red_data = original_data.filter((value) => {
378      if (value.group_ids.find((v) => v == 2026751)) {
379        return true;
380      }
381    });
382    const original_silver_data = original_data.filter((value) => {
383      if (value.group_ids.find((v) => v == 2026748)) {
384        return true;
385      }
386    });
387    const original_rosegold_data = original_data.filter((value) => {
388      if (value.group_ids.find((v) => v == 2662277)) {
389        return true;
390      }
391    });
392    const original_gold_data = original_data.filter((value) => {
393      if (value.group_ids.find((v) => v == 2026747)) {
394        return true;
395      }
396    });
397    const original_black_data = original_data.filter((value) => {
398      if (value.group_ids.find((v) => v == 2026750)) {
399        return true;
400      }
401    });
402    const original_gray_data = original_data.filter((value) => {
403      if (value.group_ids.find((v) => v == 2675668)) {
404        return true;
405      }
406    });
407    const original_yellow_data = original_data.filter((value) => {
408      if (value.group_ids.find((v) => v == 2026754)) {
409        return true;
410      }
411    });
412    const original_purple_data = original_data.filter((value) => {
413      if (value.group_ids.find((v) => v == 2026756)) {
414        return true;
415      }
416    });
417    const original_blue_data = original_data.filter((value) => {
418      if (value.group_ids.find((v) => v == 2026757)) {
419        return true;
420      }
421    });
422    const original_green_data = original_data.filter((value) => {
423      if (value.group_ids.find((v) => v == 2026758)) {
424        return true;
425      }
426    });
427    const original_pacificblue_data = original_data.filter((value) => {
428      if (value.group_ids.find((v) => v == 2677767)) {
429        return true;
430      }
431    });
432    const original_graphite_data = original_data.filter((value) => {
433      if (value.group_ids.find((v) => v == 2677768)) {
434        return true;
435      }
436    });
437    const original_spacegray_data = original_data.filter((value) => {
438      if (value.group_ids.find((v) => v == 2677772)) {
439        return true;
440      }
441    });
442    const original_midnightgreen_data = original_data.filter((value) => {
443      if (value.group_ids.find((v) => v == 2677773)) {
444        return true;
445      }
446    });
447    const original_coral_data = original_data.filter((value) => {
448      if (value.group_ids.find((v) => v == 2677775)) {
449        return true;
450      }
451    });
452    const original_jetblack_data = original_data.filter((value) => {
453      if (value.group_ids.find((v) => v == 2677777)) {
454        return true;
455      }
456    });
457
458    // カラーごとのデータ
459    let white_data = [];
460    let red_data = [];
461    let silver_data = [];
462    let rosegold_data = [];
463    let gold_data = [];
464    let black_data = [];
465    let gray_data = [];
466    let yellow_data = [];
467    let purple_data = [];
468    let blue_data = [];
469    let green_data = [];
470    let pacificblue_data = [];
471    let graphite_data = [];
472    let spacegray_data = [];
473    let midnightgreen_data = [];
474    let coral_data = [];
475    let jetblack_data = [];
476
477    // ---------------------------------------------------------------
478    // ---------------------------------------------------------------
479    // ランクごとのデータを抽出
480    const original_ss_data = original_data.filter((value) => {
481      if (value.group_ids.find((v) => v == 2026787)) {
482        return true;
483      }
484    });
485    const original_s_data = original_data.filter((value) => {
486      if (value.group_ids.find((v) => v == 2026778)) {
487        return true;
488      }
489    });
490    const original_a_data = original_data.filter((value) => {
491      if (value.group_ids.find((v) => v == 2026781)) {
492        return true;
493      }
494    });
495    const original_b_data = original_data.filter((value) => {
496      if (value.group_ids.find((v) => v == 2026782)) {
497        return true;
498      }
499    });
500    const original_c_data = original_data.filter((value) => {
501      if (value.group_ids.find((v) => v == 2026784)) {
502        return true;
503      }
504    });
505    const original_j_data = original_data.filter((value) => {
506      if (value.group_ids.find((v) => v == 2026785)) {
507        return true;
508      }
509    });
510
511    // ランクごとのデータ
512    let rank_ss_data = [];
513    let rank_s_data = [];
514    let rank_a_data = [];
515    let rank_b_data = [];
516    let rank_c_data = [];
517    let rank_j_data = [];
518
519    // ---------------------------------------------------------------
520    // ---------------------------------------------------------------
521    // 価格ごとのデータ
522    let price_low_data = [];
523    let price_heigh_data = [];
524
525    // ---------------------------------------------------------------
526    // ---------------------------------------------------------------
527    // 読み込み時にパラメータが存在するかどうか
528    if (typeof search_model_id !== "undefined") {
529      //othersの場合だけ別処理
530      if (search_model_id == 0) {
531        others_flg++;
532      }
533      //othersの処理ここまで
534
535      // others以外の処理
536      model.push(search_model_id);
537      params_flg++;
538    }
539    if (typeof search_strage !== "undefined") {
540      strage.push(search_strage);
541      params_flg++;
542    }
543    if (typeof search_rank !== "undefined") {
544      rank.push(search_rank);
545      params_flg++;
546    }
547    if (typeof search_color !== "undefined") {
548      color.push(search_color);
549      params_flg++;
550    }
551
552    // お気に入り商品一覧画面かどうか
553    if (typeof page_fav !== "undefined") {
554      fav_flg++;
555    }
556
557    // パラメータの条件ごとの処理
558    if (others_flg != 0) {
559      // その他ページの処理
560      $(".js_search_model_wrapper").css("display", "none");
561      search_others();
562      model_page_stock("others");
563    } else if (fav_flg != 0) {
564      // お気に入りページの処理
565      // お気に入り商品のIDを取得
566      let fav_ids_text = window.localStorage.getItem("fav");
567
568      if (fav_ids_text) {
569        if (fav_ids_text.indexOf(",") != -1) {
570          fav_ids = fav_ids_text.split(",");
571        } else {
572          fav_ids = [fav_ids_text];
573        }
574      }
575
576      search_fav_data();
577    } else if (params_flg != 0) {
578      // モデルごとの一覧ページの処理
579      // 該当モデル以外非表示 及び 「○○で探す」の在庫が無い場合の非表示
580      switch (search_model_id) {
581        case 2741888:
582          $(".js_model_ipad").css("display", "block");
583          $(".js_search_model").not(".js_model_ipad").css("display", "none");
584          model_page_stock("ipad");
585          break;
586        case 2741889:
587          $(".js_model_android").css("display", "block");
588          $(".js_search_model").not(".js_model_android").css("display", "none");
589          model_page_stock("android");
590          break;
591        case 3066675:
592          $(".js_model_15pro").css("display", "block");
593          $(".js_search_model").not(".js_model_15pro").css("display", "none");
594          model_page_stock("15pro");
595          break;
596        case 3066674:
597          $(".js_model_15").css("display", "block");
598          $(".js_search_model").not(".js_model_15").css("display", "none");
599          model_page_stock("15");
600          break;
601        case 3020634:
602          $(".js_model_14pro").css("display", "block");
603          $(".js_search_model").not(".js_model_14pro").css("display", "none");
604          model_page_stock("14pro");
605          break;
606        case 3020633:
607          $(".js_model_14").css("display", "block");
608          $(".js_search_model").not(".js_model_14").css("display", "none");
609          model_page_stock("14");
610          break;
611        case 2803017:
612          $(".js_model_se3").css("display", "block");
613          $(".js_search_model").not(".js_model_se3").css("display", "none");
614          model_page_stock("se3");
615          break;
616        case 2717119:
617          $(".js_model_13pro").css("display", "block");
618          $(".js_search_model").not(".js_model_13pro").css("display", "none");
619          model_page_stock("13pro");
620          break;
621        case 2717117:
622          $(".js_model_13").css("display", "block");
623          $(".js_search_model").not(".js_model_13").css("display", "none");
624          model_page_stock("13");
625          break;
626        case 2596580:
627          $(".js_model_12pro").css("display", "block");
628          $(".js_search_model").not(".js_model_12pro").css("display", "none");
629          model_page_stock("12pro");
630          break;
631        case 2596578:
632          $(".js_model_12").css("display", "block");
633          $(".js_search_model").not(".js_model_12").css("display", "none");
634          model_page_stock("12");
635          break;
636        case 2396154:
637          $(".js_model_se2").css("display", "block");
638          $(".js_search_model").not(".js_model_se2").css("display", "none");
639          model_page_stock("se2");
640          break;
641        case 2448975:
642          $(".js_model_11pro").css("display", "block");
643          $(".js_search_model").not(".js_model_11pro").css("display", "none");
644          model_page_stock("11pro");
645          break;
646        case 2439513:
647          $(".js_model_11").css("display", "block");
648          $(".js_search_model").not(".js_model_11").css("display", "none");
649          model_page_stock("11");
650          break;
651        case 2007747:
652          $(".js_model_xs").css("display", "block");
653          $(".js_search_model").not(".js_model_xs").css("display", "none");
654          model_page_stock("xs");
655          break;
656        case 2007748:
657          $(".js_model_xr").css("display", "block");
658          $(".js_search_model").not(".js_model_xr").css("display", "none");
659          model_page_stock("xr");
660          break;
661        case 1896275:
662          $(".js_model_x").css("display", "block");
663          $(".js_search_model").not(".js_model_x").css("display", "none");
664          model_page_stock("x");
665          break;
666        case 1896274:
667          $(".js_model_8").css("display", "block");
668          $(".js_search_model").not(".js_model_8").css("display", "none");
669          model_page_stock("8");
670          break;
671        case 1896271:
672          $(".js_model_7").css("display", "block");
673          $(".js_search_model").not(".js_model_7").css("display", "none");
674          model_page_stock("7");
675          break;
676        case 1896268:
677          $(".js_model_6s").css("display", "block");
678          $(".js_search_model").not(".js_model_6s").css("display", "none");
679          model_page_stock("6s");
680          break;
681        case 1896267:
682          $(".js_model_6").css("display", "block");
683          $(".js_search_model").not(".js_model_6").css("display", "none");
684          model_page_stock("6");
685          break;
686        case 1896269:
687          $(".js_model_se").css("display", "block");
688          $(".js_search_model").not(".js_model_se").css("display", "none");
689          model_page_stock("se");
690          break;
691        case 1896263:
692          $(".js_model_5s").css("display", "block");
693          $(".js_search_model").not(".js_model_5s").css("display", "none");
694          model_page_stock("5s");
695          break;
696      }
697    } else {
698      // トップページの処理
699      set_color_stock();
700      set_strage_stock();
701    }
702    // ---------------------------------------------------------------
703
704    // ---------------------------------------------------------------
705    // 並び替えボタン
706    $(".js_sort").on("change", function () {
707      sort_val = $(this).val();
708      window.localStorage.setItem("sort", sort_val);
709      sort(sort_val);
710    });
711
712    $(".js_sort_btn").on("click", function () {
713      sort_val = $(this).data("val");
714      window.localStorage.setItem("sort", sort_val);
715      sort(sort_val);
716    });
717    // ---------------------------------------------------------------
718
719    // ---------------------------------------------------------------
720    // ページ遷移の条件によって、ローカルストレージの検索条件を削除する
721    let current_page = "";
722    if (window.localStorage.getItem("current_page")) {
723      current_page = window.localStorage.getItem("current_page");
724    }
725
726    let pathname = "";
727    if (location.pathname == "/" || location.pathname == "") {
728      pathname = "home";
729      check_blowswer_back();
730    } else if (location.pathname.match("model")) {
731      pathname = "model";
732      check_blowswer_back();
733    } else if (location.pathname.match("product-list")) {
734      pathname = "product-list";
735      check_blowswer_back();
736    } else if (location.pathname.match("fav-list")) {
737      pathname = "fav-list";
738      localStorage_delete();
739    } else {
740      pathname = "other";
741    }
742
743    function localStorage_delete() {
744      window.localStorage.removeItem("keyword");
745      window.localStorage.removeItem("model");
746      window.localStorage.removeItem("career");
747      window.localStorage.removeItem("strage");
748      window.localStorage.removeItem("color");
749      window.localStorage.removeItem("rank");
750      window.localStorage.removeItem("low");
751      window.localStorage.removeItem("heigh");
752      window.localStorage.removeItem("page_num");
753      window.localStorage.removeItem("sort");
754    }
755
756    function check_blowswer_back() {
757      if (
758        window.performance.navigation.type == 0 ||
759        window.performance.navigation.type == 255
760      ) {
761        localStorage_delete();
762      }
763    }
764
765    if (pathname) {
766      window.localStorage.setItem("current_page", pathname);
767    }
768
769    // ---------------------------------------------------------------
770
771    // ---------------------------------------------------------------
772    // ローカルストレージに保存されている検索条件を読み込む
773    if (
774      window.localStorage.getItem("search_keyword") &&
775      !window.localStorage.getItem("keyword")
776    ) {
777      keyword = window.localStorage.getItem("search_keyword");
778      window.localStorage.setItem("keyword", keyword);
779      $(".js_search_keyword").val(keyword);
780      window.localStorage.removeItem("search_keyword");
781    } else if (window.localStorage.getItem("keyword")) {
782      keyword = window.localStorage.getItem("keyword");
783      $(".js_search_keyword").val(keyword);
784    }
785
786    if (window.localStorage.getItem("model")) {
787      model = window.localStorage.getItem("model").split(",");
788      $(".js_search_model").each(function (i, item) {
789        if (model.some((element) => element == $(item).data("val"))) {
790          $(item).addClass("is-active");
791        }
792      });
793    }
794    if (window.localStorage.getItem("career")) {
795      career = window.localStorage.getItem("career").split(",");
796      $(".js_search_career").each(function (i, item) {
797        if (career.some((element) => element == $(item).data("val"))) {
798          $(item).addClass("is-active");
799        }
800      });
801    }
802    if (window.localStorage.getItem("strage")) {
803      strage = window.localStorage.getItem("strage").split(",");
804      $(".js_search_strage").each(function (i, item) {
805        if (strage.some((element) => element == $(item).data("val"))) {
806          $(item).addClass("is-active");
807        }
808      });
809    }
810    if (window.localStorage.getItem("color")) {
811      color = window.localStorage.getItem("color").split(",");
812      $(".js_search_color").each(function (i, item) {
813        if (color.some((element) => element == $(item).data("val"))) {
814          $(item).addClass("is-active");
815        }
816      });
817    }
818    if (window.localStorage.getItem("rank")) {
819      rank = window.localStorage.getItem("rank").split(",");
820      $(".js_search_rank").each(function (i, item) {
821        if (rank.some((element) => element == $(item).data("val"))) {
822          $(item).addClass("is-active");
823        }
824      });
825    }
826    if (window.localStorage.getItem("low")) {
827      low = window.localStorage.getItem("low").split(",");
828      $(".js_search_low").each(function (i, item) {
829        if (low.some((element) => element == $(item).data("val"))) {
830          $(item).addClass("is-active");
831        }
832      });
833    }
834    if (window.localStorage.getItem("heigh")) {
835      heigh = window.localStorage.getItem("heigh").split(",");
836      $(".js_search_heigh").each(function (i, item) {
837        if (heigh.some((element) => element == $(item).data("val"))) {
838          $(item).addClass("is-active");
839        }
840      });
841    }
842
843    const keywords_num =
844      keyword.length +
845      model.length +
846      career.length +
847      strage.length +
848      color.length +
849      rank.length +
850      low.length +
851      heigh.length;
852    if (fav_flg != 0) {
853      return;
854    } else if (keywords_num || window.localStorage.getItem("page_num")) {
855      if (window.localStorage.getItem("page_num")) {
856        page = window.localStorage.getItem("page_num");
857      }
858      if (window.localStorage.getItem("sort")) {
859        sort_val = window.localStorage.getItem("sort");
860      }
861      search_data();
862    } else {
863      search_data();
864    }
865
866    // ---------------------------------------------------------------
867
868    // ---------------------------------------------------------------
869    // 検索条件をクリックした時の処理
870    if (typeof search_model_id == "undefined") {
871      //モデルごとの一覧ページ以外の場合、処理を行う
872      $(".js_search_model").on("click", function () {
873        $(this).toggleClass("is-active");
874        let data = [];
875        $(".js_search_model.is-active").each(function () {
876          data.push($(this).data("val"));
877        });
878        model = data;
879        window.localStorage.setItem("model", data);
880        page = 1;
881        search_data();
882      });
883    }
884    $(".js_search_keyword").on("change", function () {
885      keyword = $(this).val();
886      window.localStorage.setItem("keyword", $(this).val());
887      page = 1;
888      search_data();
889    });
890    $(".js_search_career").on("click", function () {
891      $(this).toggleClass("is-active");
892      let data = [];
893      $(".js_search_career.is-active").each(function () {
894        data.push($(this).data("val"));
895      });
896      career = data;
897      window.localStorage.setItem("career", data);
898      page = 1;
899      search_data();
900    });
901    $(".js_search_strage").on("click", function () {
902      $(this).toggleClass("is-active");
903      let data = [];
904      $(".js_search_strage.is-active").each(function () {
905        data.push($(this).data("val"));
906      });
907      strage = data;
908      window.localStorage.setItem("strage", data);
909      page = 1;
910      search_data();
911    });
912    $(".js_search_color").on("click", function () {
913      $(this).toggleClass("is-active");
914      let data = [];
915      $(".js_search_color.is-active").each(function () {
916        data.push($(this).data("val"));
917      });
918      color = data;
919      window.localStorage.setItem("color", data);
920      page = 1;
921      search_data();
922    });
923    $(".js_search_rank").on("click", function () {
924      $(this).toggleClass("is-active");
925      let data = [];
926      $(".js_search_rank.is-active").each(function () {
927        data.push($(this).data("val"));
928      });
929      rank = data;
930      window.localStorage.setItem("rank", data);
931      page = 1;
932      search_data();
933    });
934    $(".js_search_low").on("focus", function () {
935      low_flg = 1;
936    });
937    $(".js_search_low").on("blur", function () {
938      low = $(this).val();
939      window.localStorage.setItem("low", $(this).val());
940      if (low_flg == 1) {
941        page = 1;
942        search_data();
943      }
944      low_flg = 0;
945    });
946    $(".js_search_low").keypress(function (e) {
947      if (e.keyCode == 13) {
948        low = $(this).val();
949        window.localStorage.setItem("low", $(this).val());
950        page = 1;
951        search_data();
952        low_flg = 0;
953      }
954    });
955    $(".js_search_heigh").on("focus", function () {
956      heigh_flg = 1;
957    });
958    $(".js_search_heigh").on("blur", function () {
959      heigh = $(this).val();
960      window.localStorage.setItem("heigh", $(this).val());
961      if (heigh_flg == 1) {
962        page = 1;
963        search_data();
964      }
965      heigh_flg = 0;
966    });
967    $(".js_search_heigh").keypress(function (e) {
968      if (e.keyCode == 13) {
969        heigh = $(this).val();
970        window.localStorage.setItem("heigh", $(this).val());
971        page = 1;
972        search_data();
973        heigh_flg = 0;
974      }
975    });
976    // ---------------------------------------------------------------
977
978    // ---------------------------------------------------------------
979    // 読み込み時にモデルごとの個数と最低価格を取得
980    get_category_num();
981
982    // ---------------------------------------------------------------
983
984    function model_page_stock(model_name) {
985      const battery_array = ["16", "32", "64", "128", "256", "512"];
986      const rank_array = ["ss", "s", "a", "b", "c", "j"];
987      const color_array = [
988        "white",
989        "red",
990        "rosegold",
991        "gold",
992        "silver",
993        "black",
994        "gray",
995        "yellow",
996        "purple",
997        "blue",
998        "green",
999        "pacificblue",
1000        "graphite",
1001        "spacegray",
1002        "midnightgreen",
1003        "coral",
1004        "jetblack",
1005      ];
1006      const item_array = [battery_array, rank_array, color_array];
1007
1008      function show_model_search(search_item_name, model_name) {
1009        let search_item_data;
1010        eval("search_item_data = original_" + search_item_name + "_data");
1011        eval(
1012          "search_item_data = search_item_data.concat(original_" +
1013            model_name +
1014            "_data)"
1015        );
1016        search_item_data = search_item_data.filter(function (x, i, self) {
1017          return self.indexOf(x) !== self.lastIndexOf(x);
1018        });
1019        search_item_data = Array.from(new Set(search_item_data));
1020        if (search_item_data.length == 0) {
1021          eval(
1022            '$(".js_model_' + search_item_name + '").css("display", "none")'
1023          );
1024        }
1025      }
1026
1027      for (let i = 0; i < item_array.length; i++) {
1028        for (let j = 0; j < item_array[i].length; j++) {
1029          show_model_search(item_array[i][j], model_name);
1030        }
1031      }
1032    }
1033
1034    function sort(val) {
1035      $("#sort option").each(function (i, item) {
1036        if ($(item).val() == val) {
1037          $(item).prop("selected", true);
1038        }
1039      });
1040      let sort_title = "";
1041      switch (val) {
1042        case "new":
1043          sort_title = "新着順";
1044          break;
1045        case "low":
1046          sort_title = "価格の安い順";
1047          break;
1048        case "heigh":
1049          sort_title = "価格の高い順";
1050          break;
1051        case "battery":
1052          sort_title = "バッテリー順";
1053          break;
1054      }
1055      $(".js_sort_title").text(sort_title);
1056
1057      if (val == "new") {
1058        sort_new();
1059      } else if (val == "low") {
1060        sort_low_price();
1061      } else if (val == "heigh") {
1062        sort_heigh_price();
1063      } else if (val == "battery") {
1064        sort_battery();
1065      }
1066    }
1067
1068    function sort_new() {
1069      organized_data.sort(function (a, b) {
1070        if (a.make_date > b.make_date) return -1;
1071        if (a.make_date < b.make_date) return 1;
1072        return 0;
1073      });
1074      pagenation(1);
1075      show_products(1);
1076    }
1077
1078    function sort_low_price() {
1079      organized_data.sort(function (a, b) {
1080        if (a.sales_price < b.sales_price) return -1;
1081        if (a.sales_price > b.sales_price) return 1;
1082        return 0;
1083      });
1084      pagenation(1);
1085      show_products(1);
1086    }
1087
1088    function sort_heigh_price() {
1089      organized_data.sort(function (a, b) {
1090        if (a.sales_price > b.sales_price) return -1;
1091        if (a.sales_price < b.sales_price) return 1;
1092        return 0;
1093      });
1094      pagenation(1);
1095      show_products(1);
1096    }
1097
1098    function sort_battery() {
1099      organized_data.sort(function (a, b) {
1100        const array1_org = a.group_ids.concat(battery_ids);
1101        const array1_filter = array1_org.filter(
1102          (item) => a.group_ids.includes(item) && battery_ids.includes(item)
1103        );
1104        const object1 = new Set(array1_filter);
1105        const array1 = Array.from(object1);
1106
1107        const array2_org = b.group_ids.concat(battery_ids);
1108        const array2_filter = array2_org.filter(
1109          (item) => b.group_ids.includes(item) && battery_ids.includes(item)
1110        );
1111        const object2 = new Set(array2_filter);
1112        const array2 = Array.from(object2);
1113
1114        if (array1[0] < array2[0]) return -1;
1115        if (array1[0] > array2[0]) return 1;
1116        return 0;
1117      });
1118      pagenation(1);
1119      show_products(1);
1120    }
1121
1122    function get_rank(array) {
1123      if (array.some((element) => element == 2026787)) {
1124        return "SSランク";
1125      } else if (array.some((element) => element == 2026778)) {
1126        return "Sランク";
1127      } else if (array.some((element) => element == 2026781)) {
1128        return "Aランク";
1129      } else if (array.some((element) => element == 2026782)) {
1130        return "Bランク";
1131      } else if (array.some((element) => element == 2026784)) {
1132        return "Cランク";
1133      } else if (array.some((element) => element == 2026785)) {
1134        return "Jランク";
1135      }
1136    }
1137
1138    function get_battery(array) {
1139      const array_total = array.concat(battery_ids);
1140      const array_filter = array_total.filter(function (x, i, self) {
1141        return self.indexOf(x) === i && i !== self.lastIndexOf(x);
1142      });
1143      const object = new Set(array_filter);
1144      const battery_id = Array.from(object);
1145
1146      const battery_val = battery_group[battery_id[0]];
1147
1148      return battery_val;
1149    }
1150
1151    function search_data() {
1152      searched_data = [];
1153      searched_keyword = [];
1154      searched_model = [];
1155      searched_career = [];
1156      searched_strage = [];
1157      searched_color = [];
1158      searched_rank = [];
1159      searched_price = [];
1160
1161      searched_fav = [];
1162
1163      matched_data = [];
1164      // 各検索条件ごとに一致するデータを抽出
1165      organized_keyword = keyword.toLowerCase();
1166      const group_ids_map = {
1167        // 機種
1168        2741888: "iPad",
1169        2741889: "Android",
1170        3020634: "iPhone 14 Pro/Pro Max",
1171        3020633: "iPhone 14/14 Plus",
1172        2803017: "iPhoneSE(第3世代)",
1173        2717119: "iPhone 13 Pro/Pro Max",
1174        2717117: "iPhone 13/13 mini",
1175        2596580: "iPhone 12 Pro / Pro Max",
1176        2596578: "iPhone 12 / mini",
1177        2396154: "iPhoneSE(第2世代)",
1178        2448975: "iPhone11Pro/Max",
1179        2439513: "iPhone11",
1180        2007748: "iPhone XR",
1181        2007747: "iPhoneXS/XSMax",
1182        2007745: "iPhoneXS",
1183        1896275: "iPhoneX",
1184        1896274: "iPhone8/8plus",
1185        1896273: "iPhone8",
1186        1896271: "iPhone7/7plus",
1187        1896270: "iPhone7",
1188        1896269: "iPhone SE",
1189        1896268: "iPhone6s/6s plus",
1190        1896266: "iPhone6s",
1191        1896267: "iPhone6/6plus",
1192        1896265: "iPhone6",
1193        1896263: "iPhone5s",
1194        2032165: "Xperia",
1195        2032434: "AQUOS",
1196        2033218: "Galaxy",
1197        2033380: "Huawei",
1198        2032121: "その他",
1199
1200        // ストレージ
1201        2439435: "8G",
1202        2026741: "16GB",
1203        2026742: "32GB",
1204        2026743: "64GB",
1205        2026744: "128GB",
1206        2026745: "256GB",
1207        2026746: "512GB",
1208
1209        // カラー
1210        2026747: "ゴールド",
1211        2026748: "シルバー",
1212        2026750: "ブラック",
1213        2675668: "グレー",
1214        2026804: "ホワイト",
1215        2026751: "レッド",
1216        2026752: "ピンク",
1217        2026753: "オレンジ",
1218        2026754: "イエロー",
1219        2026755: "ブラウン",
1220        2026756: "パープル",
1221        2026757: "ブルー",
1222        2026758: "グリーン",
1223        2662277: "ローズゴールド",
1224        2677767: "パシフィックブルー",
1225        2677768: "グラファイト",
1226        2677772: "スペースグレイ",
1227        2677773: "ミッドナイトグリーン",
1228        2677775: "コーラル",
1229        2677777: "ジェットブラック",
1230
1231        // 価格
1232        2026760: "0~9,999円",
1233        2026761: "10,000~29,999円",
1234        2026762: "30,000~49,999円",
1235        2026763: "50,000~69,999円",
1236        2026766: "70,000~89,999円",
1237        2026767: "90,000円~",
1238
1239        // ランク
1240        2026787: "SSランク",
1241        2026778: "Sランク",
1242        2026781: "Aランク",
1243        2026782: "Bランク",
1244        2026784: "Cランク",
1245        2026785: "Jランク",
1246
1247        // SIM
1248        2026812: "標準SIM",
1249        2026813: "microSIM",
1250        2026814: "nanoSIM",
1251
1252        // バッテリー
1253        2662633: "100%",
1254        2662634: "99%",
1255        2662635: "98%",
1256        2662636: "97%",
1257        2662637: "96%",
1258        2662638: "95%",
1259        2662639: "94%",
1260        2662640: "93%",
1261        2662641: "92%",
1262        2662642: "91%",
1263        2662643: "90%",
1264        2662644: "89%",
1265        2662645: "88%",
1266        2662646: "87%",
1267        2662647: "86%",
1268        2662648: "85%",
1269        2662649: "84%",
1270        2662651: "83%",
1271        2662652: "82%",
1272        2662653: "81%",
1273        2662654: "80%",
1274        2662655: "79%",
1275        2662656: "78%",
1276        2662657: "77%",
1277        2662658: "76%",
1278        2662659: "75%",
1279        2662661: "74%",
1280        2662662: "73%",
1281        2662663: "72%",
1282        2662664: "71%",
1283        2662665: "70%",
1284      };
1285      const category_map = [
1286        {
1287          2423255: "iPhone",
1288          id_small: {
1289            1: "docomo",
1290            2: "au",
1291            3: "softbank",
1292            4: "SIMフリー",
1293            5: "Y!mobile",
1294            6: "その他",
1295          },
1296        },
1297        {
1298          2434425: "ipad",
1299          id_small: {
1300            1: "Wi-Fi",
1301          },
1302        },
1303        {
1304          2503538: "Android",
1305          id_small: {
1306            1: "Xperia",
1307            2: "AQUOS",
1308            3: "Galaxy",
1309            4: "Huawei",
1310            5: "その他",
1311          },
1312        },
1313        {
1314          2503541: "PC・アクセサリ関係",
1315          id_small: {},
1316        },
1317      ];
1318      function getCategoryName(category) {
1319        const { id_big, id_small } = category;
1320        for (const cat of category_map) {
1321          if (cat[id_big] && cat.id_small[id_small]) {
1322            return cat[id_big] + " - " + cat.id_small[id_small];
1323          }
1324        }
1325        return "";
1326      }
1327      searched_data = original_data.filter((value) => {
1328        // 全配列を抽出する場合
1329        // return Object.values(value).some((value) =>
1330        //   String(value).toLowerCase().includes(organized_keyword)
1331        // );
1332
1333        // 各プロパティに絞って検索する場合
1334        const id_match = String(value.id)
1335          .toLowerCase()
1336          .includes(organized_keyword);
1337        const name_match = String(value.name)
1338          .toLowerCase()
1339          .includes(organized_keyword);
1340        const model_number_match = String(value.model_number)
1341          .toLowerCase()
1342          .includes(organized_keyword);
1343        const sales_price_match = String(value.sales_price)
1344          .toLowerCase()
1345          .includes(organized_keyword);
1346        const expl_match = String(value.expl)
1347          .toLowerCase()
1348          .includes(organized_keyword);
1349        const category_name = getCategoryName(value.category);
1350
1351        // group_ids_mapの検索
1352        const matched_group_ids = Object.entries(group_ids_map)
1353          .filter(([, value]) =>
1354            value.toLowerCase().includes(organized_keyword)
1355          )
1356          .map(([groupid, _]) => Number(groupid));
1357        return (
1358          id_match ||
1359          name_match ||
1360          model_number_match ||
1361          sales_price_match ||
1362          expl_match ||
1363          value.group_ids.some((group_id) =>
1364            matched_group_ids.includes(group_id)
1365          ) ||
1366          category_name.toLowerCase().includes(organized_keyword)
1367        );
1368      });
1369      searched_keyword = searched_keyword.concat(searched_data);
1370
1371      if (model == "0") {
1372        for (let i = 0; i < model_ids.length; i++) {
1373          searched_data = original_data.filter((value) => {
1374            if (value.group_ids.find((v) => v == model_ids[i])) {
1375              return true;
1376            }
1377          });
1378          matched_data = matched_data.concat(searched_data);
1379        }
1380
1381        matched_data = Array.from(new Set(matched_data));
1382
1383        searched_model = original_data.filter(
1384          (a) => matched_data.indexOf(a) == -1
1385        );
1386      } else {
1387        for (let i = 0; i < model.length; i++) {
1388          searched_data = original_data.filter((value) => {
1389            if (value.group_ids.find((v) => v == model[i])) {
1390              return true;
1391            }
1392          });
1393          searched_model = searched_model.concat(searched_data);
1394        }
1395      }
1396
1397      for (let i = 0; i < career.length; i++) {
1398        searched_data = original_data.filter((value) => {
1399          if (value.category.id_small == career[i]) {
1400            return true;
1401          }
1402        });
1403        searched_career = searched_career.concat(searched_data);
1404      }
1405
1406      for (let i = 0; i < strage.length; i++) {
1407        searched_data = original_data.filter((value) => {
1408          if (value.group_ids.find((v) => v == strage[i])) {
1409            return true;
1410          }
1411        });
1412        searched_strage = searched_strage.concat(searched_data);
1413      }
1414
1415      for (let i = 0; i < color.length; i++) {
1416        searched_data = original_data.filter((value) => {
1417          if (value.group_ids.find((v) => v == color[i])) {
1418            return true;
1419          }
1420        });
1421        searched_color = searched_color.concat(searched_data);
1422      }
1423
1424      for (let i = 0; i < rank.length; i++) {
1425        searched_data = original_data.filter((value) => {
1426          if (value.group_ids.find((v) => v == rank[i])) {
1427            return true;
1428          }
1429        });
1430        searched_rank = searched_rank.concat(searched_data);
1431      }
1432
1433      if (low.length && heigh.length) {
1434        searched_price = original_data.filter((value) => {
1435          if (low <= value.sales_price && value.sales_price <= heigh) {
1436            return true;
1437          }
1438        });
1439      } else if (low.length) {
1440        searched_price = original_data.filter((value) => {
1441          if (low <= value.sales_price) {
1442            return true;
1443          }
1444        });
1445      } else if (heigh.length) {
1446        searched_price = original_data.filter((value) => {
1447          if (value.sales_price <= heigh) {
1448            return true;
1449          }
1450        });
1451      }
1452
1453      for (let i = 0; i < fav_ids.length; i++) {
1454        searched_data = original_data.filter((value) => {
1455          value.id == fav_ids[i];
1456        });
1457        searched_fav = searched_fav.concat(searched_data);
1458      }
1459
1460      const keywords_length = [
1461        keyword.length,
1462        model.length,
1463        career.length,
1464        strage.length,
1465        color.length,
1466        rank.length,
1467        searched_price.length,
1468      ];
1469      const filtered_keywords = keywords_length.filter((e) => !(e == 0));
1470
1471      if (filtered_keywords.length == 0) {
1472        organized_data = original_data;
1473      } else {
1474        organized_data = extract_duplicates(
1475          searched_keyword,
1476          searched_model,
1477          searched_career,
1478          searched_strage,
1479          searched_color,
1480          searched_rank,
1481          searched_price
1482        );
1483      }
1484      // 在庫数関係
1485      if (typeof search_model_id == "undefined") {
1486        // モデルの在庫数での表示・非表示は、モデルごとの一覧ページでは行わない
1487        set_model_stock();
1488      }
1489      set_color_stock();
1490      set_strage_stock();
1491      set_career_stock();
1492      set_rank_stock();
1493
1494      sort(sort_val);
1495      pagenation(page);
1496      show_products(page);
1497    }
1498
1499    function extract_duplicates(...array) {
1500      let duplicates_array = array[0];
1501      if (array.length > 1) {
1502        for (let i = 1; i < array.length; i++) {
1503          if (duplicates_array.length != 0 && array[i].length != 0) {
1504            duplicates_array = duplicates_array.concat(array[i]);
1505
1506            duplicates_array = duplicates_array.filter(function (x, i, self) {
1507              return self.indexOf(x) !== self.lastIndexOf(x);
1508            });
1509            duplicates_array = Array.from(new Set(duplicates_array));
1510          } else if (array[i].length != 0) {
1511            duplicates_array = duplicates_array.concat(array[i]);
1512          }
1513        }
1514      }
1515      return duplicates_array;
1516    }
1517
1518    function search_others() {
1519      searched_model = original_others_data;
1520      organized_data = original_others_data;
1521
1522      sort(sort_val);
1523      page = 1;
1524      pagenation(page);
1525      // 在庫数関係
1526      set_color_stock();
1527      set_strage_stock();
1528      set_career_stock();
1529      set_rank_stock();
1530    }
1531
1532    function search_fav_data() {
1533      let original_data = data;
1534      let searched_data = [];
1535      let searched_fav = [];
1536
1537      if (fav_ids.length != 0) {
1538        for (let i = 0; i < fav_ids.length; i++) {
1539          searched_data = original_data.filter(
1540            (value) => value.id == fav_ids[i]
1541          );
1542          searched_fav = searched_fav.concat(searched_data);
1543        }
1544        organized_data = searched_fav;
1545      } else {
1546        organized_data = [];
1547      }
1548
1549      sort(sort_val);
1550      page = 1;
1551      pagenation(page);
1552      // 在庫数関係
1553      set_color_stock();
1554      set_strage_stock();
1555    }
1556
1557    function set_color_stock() {
1558      const keywords_length = [
1559        keyword.length,
1560        model.length,
1561        career.length,
1562        strage.length,
1563        rank.length,
1564        searched_price.length,
1565      ];
1566      const filtered_keywords = keywords_length.filter((e) => !(e == 0));
1567
1568      if (filtered_keywords.length == 0) {
1569        filter_color_data();
1570        get_color_count();
1571      } else {
1572        filter_color_data(
1573          searched_keyword,
1574          searched_model,
1575          searched_career,
1576          searched_strage,
1577          searched_rank,
1578          searched_price
1579        );
1580        get_color_count();
1581      }
1582    }
1583
1584    function filter_color_data(...data_array) {
1585      if (data_array.length > 0) {
1586        // 引数の配列を整形
1587        let filtered_data_array = data_array[0];
1588        if (data_array.length > 1) {
1589          for (let i = 1; i < data_array.length; i++) {
1590            if (filtered_data_array.length != 0 && data_array[i].length != 0) {
1591              filtered_data_array = filtered_data_array.concat(data_array[i]);
1592
1593              filtered_data_array = filtered_data_array.filter(function (
1594                x,
1595                i,
1596                self
1597              ) {
1598                return self.indexOf(x) !== self.lastIndexOf(x);
1599              });
1600              filtered_data_array = Array.from(new Set(filtered_data_array));
1601            } else if (data_array[i].length != 0) {
1602              filtered_data_array = filtered_data_array.concat(data_array[i]);
1603            }
1604          }
1605        }
1606
1607        // ホワイト
1608        white_data = original_white_data;
1609        white_data = white_data.concat(filtered_data_array);
1610        white_data = white_data.filter(function (x, i, self) {
1611          return self.indexOf(x) !== self.lastIndexOf(x);
1612        });
1613        white_data = Array.from(new Set(white_data));
1614
1615        // レッド
1616        red_data = original_red_data;
1617        red_data = red_data.concat(filtered_data_array);
1618        red_data = red_data.filter(function (x, i, self) {
1619          return self.indexOf(x) !== self.lastIndexOf(x);
1620        });
1621        red_data = Array.from(new Set(red_data));
1622
1623        // シルバー
1624        silver_data = original_silver_data;
1625        silver_data = silver_data.concat(filtered_data_array);
1626        silver_data = silver_data.filter(function (x, i, self) {
1627          return self.indexOf(x) !== self.lastIndexOf(x);
1628        });
1629        silver_data = Array.from(new Set(silver_data));
1630
1631        // ローズゴールド
1632        rosegold_data = original_rosegold_data;
1633        rosegold_data = rosegold_data.concat(filtered_data_array);
1634        rosegold_data = rosegold_data.filter(function (x, i, self) {
1635          return self.indexOf(x) !== self.lastIndexOf(x);
1636        });
1637        rosegold_data = Array.from(new Set(rosegold_data));
1638
1639        // ゴールド
1640        gold_data = original_gold_data;
1641        gold_data = gold_data.concat(filtered_data_array);
1642        gold_data = gold_data.filter(function (x, i, self) {
1643          return self.indexOf(x) !== self.lastIndexOf(x);
1644        });
1645        gold_data = Array.from(new Set(gold_data));
1646
1647        // ブラック
1648        black_data = original_black_data;
1649        black_data = black_data.concat(filtered_data_array);
1650        black_data = black_data.filter(function (x, i, self) {
1651          return self.indexOf(x) !== self.lastIndexOf(x);
1652        });
1653        black_data = Array.from(new Set(black_data));
1654
1655        // グレイ
1656        gray_data = original_gray_data;
1657        gray_data = gray_data.concat(filtered_data_array);
1658        gray_data = gray_data.filter(function (x, i, self) {
1659          return self.indexOf(x) !== self.lastIndexOf(x);
1660        });
1661        gray_data = Array.from(new Set(gray_data));
1662
1663        // イエロー
1664        yellow_data = original_yellow_data;
1665        yellow_data = yellow_data.concat(filtered_data_array);
1666        yellow_data = yellow_data.filter(function (x, i, self) {
1667          return self.indexOf(x) !== self.lastIndexOf(x);
1668        });
1669        yellow_data = Array.from(new Set(yellow_data));
1670
1671        // パープル
1672        purple_data = original_purple_data;
1673        purple_data = purple_data.concat(filtered_data_array);
1674        purple_data = purple_data.filter(function (x, i, self) {
1675          return self.indexOf(x) !== self.lastIndexOf(x);
1676        });
1677        purple_data = Array.from(new Set(purple_data));
1678
1679        // ブルー
1680        blue_data = original_blue_data;
1681        blue_data = blue_data.concat(filtered_data_array);
1682        blue_data = blue_data.filter(function (x, i, self) {
1683          return self.indexOf(x) !== self.lastIndexOf(x);
1684        });
1685        blue_data = Array.from(new Set(blue_data));
1686
1687        // グリーン
1688        green_data = original_green_data;
1689        green_data = green_data.concat(filtered_data_array);
1690        green_data = green_data.filter(function (x, i, self) {
1691          return self.indexOf(x) !== self.lastIndexOf(x);
1692        });
1693        green_data = Array.from(new Set(green_data));
1694
1695        // パシフィックブルー
1696        pacificblue_data = original_pacificblue_data;
1697        pacificblue_data = pacificblue_data.concat(filtered_data_array);
1698        pacificblue_data = pacificblue_data.filter(function (x, i, self) {
1699          return self.indexOf(x) !== self.lastIndexOf(x);
1700        });
1701        pacificblue_data = Array.from(new Set(pacificblue_data));
1702
1703        // グラファイト
1704        graphite_data = original_graphite_data;
1705        graphite_data = graphite_data.concat(filtered_data_array);
1706        graphite_data = graphite_data.filter(function (x, i, self) {
1707          return self.indexOf(x) !== self.lastIndexOf(x);
1708        });
1709        graphite_data = Array.from(new Set(graphite_data));
1710
1711        // スペースグレイ
1712        spacegray_data = original_spacegray_data;
1713        spacegray_data = spacegray_data.concat(filtered_data_array);
1714        spacegray_data = spacegray_data.filter(function (x, i, self) {
1715          return self.indexOf(x) !== self.lastIndexOf(x);
1716        });
1717        spacegray_data = Array.from(new Set(spacegray_data));
1718
1719        // ミッドナイトブルー
1720        midnightgreen_data = original_midnightgreen_data;
1721        midnightgreen_data = midnightgreen_data.concat(filtered_data_array);
1722        midnightgreen_data = midnightgreen_data.filter(function (x, i, self) {
1723          return self.indexOf(x) !== self.lastIndexOf(x);
1724        });
1725        midnightgreen_data = Array.from(new Set(midnightgreen_data));
1726
1727        // コーラル
1728        coral_data = original_coral_data;
1729        coral_data = coral_data.concat(filtered_data_array);
1730        coral_data = coral_data.filter(function (x, i, self) {
1731          return self.indexOf(x) !== self.lastIndexOf(x);
1732        });
1733        coral_data = Array.from(new Set(coral_data));
1734
1735        // ジェットブラック
1736        jetblack_data = original_jetblack_data;
1737        jetblack_data = jetblack_data.concat(filtered_data_array);
1738        jetblack_data = jetblack_data.filter(function (x, i, self) {
1739          return self.indexOf(x) !== self.lastIndexOf(x);
1740        });
1741        jetblack_data = Array.from(new Set(jetblack_data));
1742      } else {
1743        white_data = original_white_data;
1744        red_data = original_red_data;
1745        silver_data = original_silver_data;
1746        rosegold_data = original_rosegold_data;
1747        gold_data = original_gold_data;
1748        black_data = original_black_data;
1749        gray_data = original_gray_data;
1750        yellow_data = original_yellow_data;
1751        purple_data = original_purple_data;
1752        blue_data = original_blue_data;
1753        green_data = original_green_data;
1754        pacificblue_data = original_pacificblue_data;
1755        graphite_data = original_graphite_data;
1756        spacegray_data = original_spacegray_data;
1757        midnightgreen_data = original_midnightgreen_data;
1758        coral_data = original_coral_data;
1759        jetblack_data = original_jetblack_data;
1760      }
1761    }
1762
1763    function get_color_count() {
1764      //console.log("----------test----");
1765
1766      const white_num = white_data.length;
1767      const red_num = red_data.length;
1768      const silver_num = silver_data.length;
1769      const rosegold_num = rosegold_data.length;
1770      const gold_num = gold_data.length;
1771      const black_num = black_data.length;
1772      const gray_num = gray_data.length;
1773      const yellow_num = yellow_data.length;
1774      const purple_num = purple_data.length;
1775      const blue_num = blue_data.length;
1776      const green_num = green_data.length;
1777      const pacificblue_num = pacificblue_data.length;
1778      const graphite_num = graphite_data.length;
1779      const spacegray_num = spacegray_data.length;
1780      const midnightgreen_num = midnightgreen_data.length;
1781      const coral_num = coral_data.length;
1782      const jetblack_num = jetblack_data.length;
1783
1784      $(".js_white_num").text("(" + white_num + ")");
1785      $(".js_red_num").text("(" + red_num + ")");
1786      $(".js_silver_num").text("(" + silver_num + ")");
1787      $(".js_rosegold_num").text("(" + rosegold_num + ")");
1788      $(".js_gold_num").text("(" + gold_num + ")");
1789      $(".js_black_num").text("(" + black_num + ")");
1790      $(".js_gray_num").text("(" + gray_num + ")");
1791      $(".js_yellow_num").text("(" + yellow_num + ")");
1792      $(".js_purple_num").text("(" + purple_num + ")");
1793      $(".js_blue_num").text("(" + blue_num + ")");
1794      $(".js_green_num").text("(" + green_num + ")");
1795      $(".js_pacificblue_num").text("(" + pacificblue_num + ")");
1796      $(".js_graphite_num").text("(" + graphite_num + ")");
1797      $(".js_spacegray_num").text("(" + spacegray_num + ")");
1798      $(".js_midnightgreen_num").text("(" + midnightgreen_num + ")");
1799      $(".js_coral_num").text("(" + coral_num + ")");
1800      $(".js_jetblack_num").text("(" + jetblack_num + ")");
1801
1802      if (white_num) {
1803        $(".js_color_white").css("display", "flex");
1804      } else {
1805        $(".js_color_white").css("display", "none");
1806      }
1807      if (red_num) {
1808        $(".js_color_red").css("display", "flex");
1809      } else {
1810        $(".js_color_red").css("display", "none");
1811      }
1812      if (silver_num) {
1813        $(".js_color_silver").css("display", "flex");
1814      } else {
1815        $(".js_color_silver").css("display", "none");
1816      }
1817      if (rosegold_num) {
1818        $(".js_color_rosegold").css("display", "flex");
1819      } else {
1820        $(".js_color_rosegold").css("display", "none");
1821      }
1822      if (gold_num) {
1823        $(".js_color_gold").css("display", "flex");
1824      } else {
1825        $(".js_color_gold").css("display", "none");
1826      }
1827      if (black_num) {
1828        $(".js_color_black").css("display", "flex");
1829      } else {
1830        $(".js_color_black").css("display", "none");
1831      }
1832      if (gray_num) {
1833        $(".js_color_gray").css("display", "flex");
1834      } else {
1835        $(".js_color_gray").css("display", "none");
1836      }
1837      if (yellow_num) {
1838        $(".js_color_yellow").css("display", "flex");
1839      } else {
1840        $(".js_color_yellow").css("display", "none");
1841      }
1842      if (purple_num) {
1843        $(".js_color_purple").css("display", "flex");
1844      } else {
1845        $(".js_color_purple").css("display", "none");
1846      }
1847      if (blue_num) {
1848        $(".js_color_blue").css("display", "flex");
1849      } else {
1850        $(".js_color_blue").css("display", "none");
1851      }
1852      if (green_num) {
1853        $(".js_color_green").css("display", "flex");
1854      } else {
1855        $(".js_color_green").css("display", "none");
1856      }
1857      if (pacificblue_num) {
1858        $(".js_color_pacificblue").css("display", "flex");
1859      } else {
1860        $(".js_color_pacificblue").css("display", "none");
1861      }
1862      if (graphite_num) {
1863        $(".js_color_graphite").css("display", "flex");
1864      } else {
1865        $(".js_color_graphite").css("display", "none");
1866      }
1867      if (spacegray_num) {
1868        $(".js_color_spacegray").css("display", "flex");
1869      } else {
1870        $(".js_color_spacegray").css("display", "none");
1871      }
1872      if (midnightgreen_num) {
1873        $(".js_color_midnightgreen").css("display", "flex");
1874      } else {
1875        $(".js_color_midnightgreen").css("display", "none");
1876      }
1877      if (coral_num) {
1878        $(".js_color_coral").css("display", "flex");
1879      } else {
1880        $(".js_color_coral").css("display", "none");
1881      }
1882      if (jetblack_num) {
1883        $(".js_color_jetblack").css("display", "flex");
1884      } else {
1885        $(".js_color_jetblack").css("display", "none");
1886      }
1887    }
1888
1889    function get_category_num() {
1890      let category_ipad_data = original_data.filter((value) => {
1891        if (value.group_ids.find((v) => v == 2741888)) {
1892          return true;
1893        }
1894      });
1895      let category_android_data = original_data.filter((value) => {
1896        if (value.group_ids.find((v) => v == 2741889)) {
1897          return true;
1898        }
1899      });
1900      let category_15pro_data = original_data.filter((value) => {
1901        if (value.group_ids.find((v) => v == 3066675)) {
1902          return true;
1903        }
1904      });
1905      let category_15_data = original_data.filter((value) => {
1906        if (value.group_ids.find((v) => v == 3066674)) {
1907          return true;
1908        }
1909      });
1910      let category_14pro_data = original_data.filter((value) => {
1911        if (value.group_ids.find((v) => v == 3020634)) {
1912          return true;
1913        }
1914      });
1915      let category_14_data = original_data.filter((value) => {
1916        if (value.group_ids.find((v) => v == 3020633)) {
1917          return true;
1918        }
1919      });
1920      let category_se3_data = original_data.filter((value) => {
1921        if (value.group_ids.find((v) => v == 2803017)) {
1922          return true;
1923        }
1924      });
1925      let category_13pro_data = original_data.filter((value) => {
1926    
1926    if (value.group_ids.find((v) => v == 2717119)) {
1927          return true;
1928        }
1929      });
1930      let category_13_data = original_data.filter((value) => {
1931        if (value.group_ids.find((v) => v == 2717117)) {
1932          return true;
1933        }
1934      });
1935      let category_12pro_data = original_data.filter((value) => {
1936        if (value.group_ids.find((v) => v == 2596580)) {
1937          return true;
1938        }
1939      });
1940      let category_12_data = original_data.filter((value) => {
1941        if (value.group_ids.find((v) => v == 2596578)) {
1942          return true;
1943        }
1944      });
1945      let category_se2_data = original_data.filter((value) => {
1946        if (value.group_ids.find((v) => v == 2396154)) {
1947          return true;
1948        }
1949      });
1950      let category_11pro_data = original_data.filter((value) => {
1951        if (value.group_ids.find((v) => v == 2448975)) {
1952          return true;
1953        }
1954      });
1955      let category_11_data = original_data.filter((value) => {
1956        if (value.group_ids.find((v) => v == 2439513)) {
1957          return true;
1958        }
1959      });
1960      let category_xs_data = original_data.filter((value) => {
1961        if (value.group_ids.find((v) => v == 2007747)) {
1962          return true;
1963        }
1964      });
1965      let category_xr_data = original_data.filter((value) => {
1966        if (value.group_ids.find((v) => v == 2007748)) {
1967          return true;
1968        }
1969      });
1970      let category_x_data = original_data.filter((value) => {
1971        if (value.group_ids.find((v) => v == 1896275)) {
1972          return true;
1973        }
1974      });
1975      let category_8_data = original_data.filter((value) => {
1976        if (value.group_ids.find((v) => v == 1896274)) {
1977          return true;
1978        }
1979      });
1980      let category_7_data = original_data.filter((value) => {
1981        if (value.group_ids.find((v) => v == 1896271)) {
1982          return true;
1983        }
1984      });
1985      let category_6s_data = original_data.filter((value) => {
1986        if (value.group_ids.find((v) => v == 1896268)) {
1987          return true;
1988        }
1989      });
1990      let category_6_data = original_data.filter((value) => {
1991        if (value.group_ids.find((v) => v == 1896267)) {
1992          return true;
1993        }
1994      });
1995      let category_se_data = original_data.filter((value) => {
1996        if (value.group_ids.find((v) => v == 1896269)) {
1997          return true;
1998        }
1999      });
2000      let category_5s_data = original_data.filter((value) => {
2001        if (value.group_ids.find((v) => v == 1896263)) {
2002          return true;
2003        }
2004      });
2005
2006      const category_ipad_num = category_ipad_data.length;
2007      const category_android_num = category_android_data.length;
2008      const category_15pro_num = category_15pro_data.length;
2009      const category_15_num = category_15_data.length;
2010      const category_14pro_num = category_14pro_data.length;
2011      const category_14_num = category_14_data.length;
2012      const category_se3_num = category_se3_data.length;
2013      const category_13pro_num = category_13pro_data.length;
2014      const category_13_num = category_13_data.length;
2015      const category_12pro_num = category_12pro_data.length;
2016      const category_12_num = category_12_data.length;
2017      const category_se2_num = category_se2_data.length;
2018      const category_11pro_num = category_11pro_data.length;
2019      const category_11_num = category_11_data.length;
2020      const category_xs_num = category_xs_data.length;
2021      const category_xr_num = category_xr_data.length;
2022      const category_x_num = category_x_data.length;
2023      const category_8_num = category_8_data.length;
2024      const category_7_num = category_7_data.length;
2025      const category_6s_num = category_6s_data.length;
2026      const category_6_num = category_6_data.length;
2027      const category_se_num = category_se_data.length;
2028      const category_5s_num = category_5s_data.length;
2029
2030      $(".js_ipad_num").text("在庫数 : " + category_ipad_num);
2031      $(".js_android_num").text("在庫数 : " + category_android_num);
2032      $(".js_15pro_num").text("在庫数 : " + category_15pro_num);
2033      $(".js_15_num").text("在庫数 : " + category_15_num);
2034      $(".js_14pro_num").text("在庫数 : " + category_14pro_num);
2035      $(".js_14_num").text("在庫数 : " + category_14_num);
2036      $(".js_se3_num").text("在庫数 : " + category_se3_num);
2037      $(".js_13pro_num").text("在庫数 : " + category_13pro_num);
2038      $(".js_13_num").text("在庫数 : " + category_13_num);
2039      $(".js_12pro_num").text("在庫数 : " + category_12pro_num);
2040      $(".js_12_num").text("在庫数 : " + category_12_num);
2041      $(".js_se2_num").text("在庫数 : " + category_se2_num);
2042      $(".js_11pro_num").text("在庫数 : " + category_11pro_num);
2043      $(".js_11_num").text("在庫数 : " + category_11_num);
2044      $(".js_xs_num").text("在庫数 : " + category_xs_num);
2045      $(".js_xr_num").text("在庫数 : " + category_xr_num);
2046      $(".js_x_num").text("在庫数 : " + category_x_num);
2047      $(".js_8_num").text("在庫数 : " + category_8_num);
2048      $(".js_7_num").text("在庫数 : " + category_7_num);
2049      $(".js_6s_num").text("在庫数 : " + category_6s_num);
2050      $(".js_6_num").text("在庫数 : " + category_6_num);
2051      $(".js_se_num").text("在庫数 : " + category_se_num);
2052      $(".js_5s_num").text("在庫数 : " + category_5s_num);
2053
2054      $(".js_model_ipad_num").text("総在庫数" + category_ipad_num + "台");
2055      $(".js_model_android_num").text("総在庫数" + category_android_num + "台");
2056      $(".js_model_15pro_num").text("総在庫数" + category_15pro_num + "台");
2057      $(".js_model_15_num").text("総在庫数" + category_15_num + "台");
2058      $(".js_model_14pro_num").text("総在庫数" + category_14pro_num + "台");
2059      $(".js_model_14_num").text("総在庫数" + category_14_num + "台");
2060      $(".js_model_se3_num").text("総在庫数" + category_se3_num + "台");
2061      $(".js_model_13pro_num").text("総在庫数" + category_13pro_num + "台");
2062      $(".js_model_13_num").text("総在庫数" + category_13_num + "台");
2063      $(".js_model_12pro_num").text("総在庫数" + category_12pro_num + "台");
2064      $(".js_model_12_num").text("総在庫数" + category_12_num + "台");
2065      $(".js_model_se2_num").text("総在庫数" + category_se2_num + "台");
2066      $(".js_model_11pro_num").text("総在庫数" + category_11pro_num + "台");
2067      $(".js_model_11_num").text("総在庫数" + category_11_num + "台");
2068      $(".js_model_xs_num").text("総在庫数" + category_xs_num + "台");
2069      $(".js_model_xr_num").text("総在庫数" + category_xr_num + "台");
2070      $(".js_model_x_num").text("総在庫数" + category_x_num + "台");
2071      $(".js_model_8_num").text("総在庫数" + category_8_num + "台");
2072      $(".js_model_7_num").text("総在庫数" + category_7_num + "台");
2073      $(".js_model_6s_num").text("総在庫数" + category_6s_num + "台");
2074      $(".js_model_6_num").text("総在庫数" + category_6_num) + "台";
2075      $(".js_model_se_num").text("総在庫数" + category_se_num + "台");
2076      $(".js_model_5s_num").text("総在庫数" + category_5s_num + "台");
2077
2078      let category_ipad_prices = [];
2079      for (let i = 0; i < category_ipad_data.length; i++) {
2080        category_ipad_prices[i] = category_ipad_data[i]["sales_price"];
2081      }
2082      let category_android_prices = [];
2083      for (let i = 0; i < category_android_data.length; i++) {
2084        category_android_prices[i] = category_android_data[i]["sales_price"];
2085      }
2086      let category_15pro_prices = [];
2087      for (let i = 0; i < category_15pro_data.length; i++) {
2088        category_15pro_prices[i] = category_15pro_data[i]["sales_price"];
2089      }
2090      let category_15_prices = [];
2091      for (let i = 0; i < category_15_data.length; i++) {
2092        category_15_prices[i] = category_15_data[i]["sales_price"];
2093      }
2094      let category_14pro_prices = [];
2095      for (let i = 0; i < category_14pro_data.length; i++) {
2096        category_14pro_prices[i] = category_14pro_data[i]["sales_price"];
2097      }
2098      let category_14_prices = [];
2099      for (let i = 0; i < category_14_data.length; i++) {
2100        category_14_prices[i] = category_14_data[i]["sales_price"];
2101      }
2102      let category_se3_prices = [];
2103      for (let i = 0; i < category_se3_data.length; i++) {
2104        category_se3_prices[i] = category_se3_data[i]["sales_price"];
2105      }
2106      let category_13pro_prices = [];
2107      for (let i = 0; i < category_13pro_data.length; i++) {
2108        category_13pro_prices[i] = category_13pro_data[i]["sales_price"];
2109      }
2110      let category_13_prices = [];
2111      for (let i = 0; i < category_13_data.length; i++) {
2112        category_13_prices[i] = category_13_data[i]["sales_price"];
2113      }
2114      let category_12pro_prices = [];
2115      for (let i = 0; i < category_12pro_data.length; i++) {
2116        category_12pro_prices[i] = category_12pro_data[i]["sales_price"];
2117      }
2118      let category_12_prices = [];
2119      for (let i = 0; i < category_12_data.length; i++) {
2120        category_12_prices[i] = category_12_data[i]["sales_price"];
2121      }
2122      let category_se2_prices = [];
2123      for (let i = 0; i < category_se2_data.length; i++) {
2124        category_se2_prices[i] = category_se2_data[i]["sales_price"];
2125      }
2126      let category_11pro_prices = [];
2127      for (let i = 0; i < category_11pro_data.length; i++) {
2128        category_11pro_prices[i] = category_11pro_data[i]["sales_price"];
2129      }
2130      let category_11_prices = [];
2131      for (let i = 0; i < category_11_data.length; i++) {
2132        category_11_prices[i] = category_11_data[i]["sales_price"];
2133      }
2134      let category_xs_prices = [];
2135      for (let i = 0; i < category_xs_data.length; i++) {
2136        category_xs_prices[i] = category_xs_data[i]["sales_price"];
2137      }
2138      let category_xr_prices = [];
2139      for (let i = 0; i < category_xr_data.length; i++) {
2140        category_xr_prices[i] = category_xr_data[i]["sales_price"];
2141      }
2142      let category_x_prices = [];
2143      for (let i = 0; i < category_x_data.length; i++) {
2144        category_x_prices[i] = category_x_data[i]["sales_price"];
2145      }
2146      let category_8_prices = [];
2147      for (let i = 0; i < category_8_data.length; i++) {
2148        category_8_prices[i] = category_8_data[i]["sales_price"];
2149      }
2150      let category_7_prices = [];
2151      for (let i = 0; i < category_7_data.length; i++) {
2152        category_7_prices[i] = category_7_data[i]["sales_price"];
2153      }
2154      let category_6s_prices = [];
2155      for (let i = 0; i < category_6s_data.length; i++) {
2156        category_6s_prices[i] = category_6s_data[i]["sales_price"];
2157      }
2158      let category_6_prices = [];
2159      for (let i = 0; i < category_6_data.length; i++) {
2160        category_6_prices[i] = category_6_data[i]["sales_price"];
2161      }
2162      let category_se_prices = [];
2163      for (let i = 0; i < category_se_data.length; i++) {
2164        category_se_prices[i] = category_se_data[i]["sales_price"];
2165      }
2166      let category_5s_prices = [];
2167      for (let i = 0; i < category_5s_data.length; i++) {
2168        category_5s_prices[i] = category_5s_data[i]["sales_price"];
2169      }
2170      const category_ipad_price = Math.min
2171        .apply(null, category_ipad_prices)
2172        .toLocaleString();
2173      const category_android_price = Math.min
2174        .apply(null, category_android_prices)
2175        .toLocaleString();
2176      const category_15pro_price = Math.min
2177        .apply(null, category_15pro_prices)
2178        .toLocaleString();
2179      const category_15_price = Math.min
2180        .apply(null, category_15_prices)
2181        .toLocaleString();
2182      const category_14pro_price = Math.min
2183        .apply(null, category_14pro_prices)
2184        .toLocaleString();
2185      const category_14_price = Math.min
2186        .apply(null, category_14_prices)
2187        .toLocaleString();
2188      const category_se3_price = Math.min
2189        .apply(null, category_se3_prices)
2190        .toLocaleString();
2191      const category_13pro_price = Math.min
2192        .apply(null, category_13pro_prices)
2193        .toLocaleString();
2194      const category_13_price = Math.min
2195        .apply(null, category_13_prices)
2196        .toLocaleString();
2197      const category_12pro_price = Math.min
2198        .apply(null, category_12pro_prices)
2199        .toLocaleString();
2200      const category_12_price = Math.min
2201        .apply(null, category_12_prices)
2202        .toLocaleString();
2203      const category_se2_price = Math.min
2204        .apply(null, category_se2_prices)
2205        .toLocaleString();
2206      const category_11pro_price = Math.min
2207        .apply(null, category_11pro_prices)
2208        .toLocaleString();
2209      const category_11_price = Math.min
2210        .apply(null, category_11_prices)
2211        .toLocaleString();
2212      const category_xs_price = Math.min
2213        .apply(null, category_xs_prices)
2214        .toLocaleString();
2215      const category_xr_price = Math.min
2216        .apply(null, category_xr_prices)
2217        .toLocaleString();
2218      const category_x_price = Math.min
2219        .apply(null, category_x_prices)
2220        .toLocaleString();
2221      const category_8_price = Math.min
2222        .apply(null, category_8_prices)
2223        .toLocaleString();
2224      const category_7_price = Math.min
2225        .apply(null, category_7_prices)
2226        .toLocaleString();
2227      const category_6s_price = Math.min
2228        .apply(null, category_6s_prices)
2229        .toLocaleString();
2230      const category_6_price = Math.min
2231        .apply(null, category_6_prices)
2232        .toLocaleString();
2233      const category_se_price = Math.min
2234        .apply(null, category_se_prices)
2235        .toLocaleString();
2236      const category_5s_price = Math.min
2237        .apply(null, category_5s_prices)
2238        .toLocaleString();
2239
2240      if (category_ipad_price == "∞") {
2241        $(".js_ipad_price").text("在庫なし");
2242      } else {
2243        $(".js_ipad_price").text("¥" + category_ipad_price + "〜");
2244      }
2245      if (category_android_price == "∞") {
2246        $(".js_android_price").text("在庫なし");
2247      } else {
2248        $(".js_android_price").text("¥" + category_android_price + "〜");
2249      }
2250      if (category_15pro_price == "∞") {
2251        $(".js_15pro_price").text("在庫なし");
2252      } else {
2253        $(".js_15pro_price").text("¥" + category_15pro_price + "〜");
2254      }
2255      if (category_15_price == "∞") {
2256        $(".js_15_price").text("在庫なし");
2257      } else {
2258        $(".js_15_price").text("¥" + category_15_price + "〜");
2259      }
2260      if (category_14pro_price == "∞") {
2261        $(".js_14pro_price").text("在庫なし");
2262      } else {
2263        $(".js_14pro_price").text("¥" + category_14pro_price + "〜");
2264      }
2265      if (category_14_price == "∞") {
2266        $(".js_14_price").text("在庫なし");
2267      } else {
2268        $(".js_14_price").text("¥" + category_14_price + "〜");
2269      }
2270      if (category_se3_price == "∞") {
2271        $(".js_se3_price").text("在庫なし");
2272      } else {
2273        $(".js_se3_price").text("¥" + category_se3_price + "〜");
2274      }
2275      if (category_13pro_price == "∞") {
2276        $(".js_13pro_price").text("在庫なし");
2277      } else {
2278        $(".js_13pro_price").text("¥" + category_13pro_price + "〜");
2279      }
2280      if (category_13_price == "∞") {
2281        $(".js_13_price").text("在庫なし");
2282      } else {
2283        $(".js_13_price").text("¥" + category_13_price + "〜");
2284      }
2285      if (category_12pro_price == "∞") {
2286        $(".js_12pro_price").text("在庫なし");
2287      } else {
2288        $(".js_12pro_price").text("¥" + category_12pro_price + "〜");
2289      }
2290      if (category_12_price == "∞") {
2291        $(".js_12_price").text("在庫なし");
2292      } else {
2293        $(".js_12_price").text("¥" + category_12_price + "〜");
2294      }
2295      if (category_se2_price == "∞") {
2296        $(".js_se2_price").text("在庫なし");
2297      } else {
2298        $(".js_se2_price").text("¥" + category_se2_price + "〜");
2299      }
2300      if (category_11pro_price == "∞") {
2301        $(".js_11pro_price").text("在庫なし");
2302      } else {
2303        $(".js_11pro_price").text("¥" + category_11pro_price + "〜");
2304      }
2305      if (category_11_price == "∞") {
2306        $(".js_11_price").text("在庫なし");
2307      } else {
2308        $(".js_11_price").text("¥" + category_11_price + "〜");
2309      }
2310      if (category_xs_price == "∞") {
2311        $(".js_xs_price").text("在庫なし");
2312      } else {
2313        $(".js_xs_price").text("¥" + category_xs_price + "〜");
2314      }
2315      if (category_xr_price == "∞") {
2316        $(".js_xr_price").text("在庫なし");
2317      } else {
2318        $(".js_xr_price").text("¥" + category_xr_price + "〜");
2319      }
2320      if (category_x_price == "∞") {
2321        $(".js_x_price").text("在庫なし");
2322      } else {
2323        $(".js_x_price").text("¥" + category_x_price + "〜");
2324      }
2325      if (category_8_price == "∞") {
2326        $(".js_8_price").text("在庫なし");
2327      } else {
2328        $(".js_8_price").text("¥" + category_8_price + "〜");
2329      }
2330      if (category_7_price == "∞") {
2331        $(".js_7_price").text("在庫なし");
2332      } else {
2333        $(".js_7_price").text("¥" + category_7_price + "〜");
2334      }
2335      if (category_6s_price == "∞") {
2336        $(".js_6s_price").text("在庫なし");
2337      } else {
2338        $(".js_6s_price").text("¥" + category_6s_price + "〜");
2339      }
2340      if (category_6_price == "∞") {
2341        $(".js_6_price").text("在庫なし");
2342      } else {
2343        $(".js_6_price").text("¥" + category_6_price + "〜");
2344      }
2345      if (category_se_price == "∞") {
2346        $(".js_se_price").text("在庫なし");
2347      } else {
2348        $(".js_se_price").text("¥" + category_se_price + "〜");
2349      }
2350      if (category_5s_price == "∞") {
2351        $(".js_5s_price").text("在庫なし");
2352      } else {
2353        $(".js_5s_price").text("¥" + category_5s_price + "〜");
2354      }
2355
2356      if (category_ipad_price === "∞") {
2357        $(".js_model_ipad_price").css("display", "none");
2358      } else {
2359        $(".js_model_ipad_price").html(
2360          category_ipad_price +
2361            '円〜<span class="modelFv__price--small">(税込)</span>'
2362        );
2363      }
2364      if (category_android_price === "∞") {
2365        $(".js_model_android_price").css("display", "none");
2366      } else {
2367        $(".js_model_android_price").html(
2368          category_android_price +
2369            '円〜<span class="modelFv__price--small">(税込)</span>'
2370        );
2371      }
2372      if (category_15pro_price === "∞") {
2373        $(".js_model_15pro_price").css("display", "none");
2374      } else {
2375        $(".js_model_15pro_price").html(
2376          category_15pro_price +
2377            '円〜<span class="modelFv__price--small">(税込)</span>'
2378        );
2379      }
2380      if (category_15_price === "∞") {
2381        $(".js_model_15_price").css("display", "none");
2382      } else {
2383        $(".js_model_15_price").html(
2384          category_15_price +
2385            '円〜<span class="modelFv__price--small">(税込)</span>'
2386        );
2387      }      
2388      if (category_14pro_price === "∞") {
2389        $(".js_model_14pro_price").css("display", "none");
2390      } else {
2391        $(".js_model_14pro_price").html(
2392          category_14pro_price +
2393            '円〜<span class="modelFv__price--small">(税込)</span>'
2394        );
2395      }
2396      if (category_14_price === "∞") {
2397        $(".js_model_14_price").css("display", "none");
2398      } else {
2399        $(".js_model_14_price").html(
2400          category_14_price +
2401            '円〜<span class="modelFv__price--small">(税込)</span>'
2402        );
2403      }
2404      if (category_se3_price === "∞") {
2405        $(".js_model_se3_price").css("display", "none");
2406      } else {
2407        $(".js_model_se3_price").html(
2408          category_se3_price +
2409            '円〜<span class="modelFv__price--small">(税込)</span>'
2410        );
2411      }
2412      if (category_13pro_price === "∞") {
2413        $(".js_model_13pro_price").css("display", "none");
2414      } else {
2415        $(".js_model_13pro_price").html(
2416          category_13pro_price +
2417            '円〜<span class="modelFv__price--small">(税込)</span>'
2418        );
2419      }
2420      if (category_13_price === "∞") {
2421        $(".js_model_13_price").css("display", "none");
2422      } else {
2423        $(".js_model_13_price").html(
2424          category_13_price +
2425            '円〜<span class="modelFv__price--small">(税込)</span>'
2426        );
2427      }
2428      if (category_12pro_price === "∞") {
2429        $(".js_model_12pro_price").css("display", "none");
2430      } else {
2431        $(".js_model_12pro_price").html(
2432          category_12pro_price +
2433            '円〜<span class="modelFv__price--small">(税込)</span>'
2434        );
2435      }
2436      if (category_12_price === "∞") {
2437        $(".js_model_12_price").css("display", "none");
2438      } else {
2439        $(".js_model_12_price").html(
2440          category_12_price +
2441            '円〜<span class="modelFv__price--small">(税込)</span>'
2442        );
2443      }
2444      if (category_se2_price === "∞") {
2445        $(".js_model_se2_price").css("display", "none");
2446      } else {
2447        $(".js_model_se2_price").html(
2448          category_se2_price +
2449            '円〜<span class="modelFv__price--small">(税込)</span>'
2450        );
2451      }
2452      if (category_11pro_price === "∞") {
2453        $(".js_model_11pro_price").css("display", "none");
2454      } else {
2455        $(".js_model_11pro_price").html(
2456          category_11pro_price +
2457            '円〜<span class="modelFv__price--small">(税込)</span>'
2458        );
2459      }
2460
2461      if (category_11_price === "∞") {
2462        $(".js_model_11_price").css("display", "none");
2463      } else {
2464        $(".js_model_11_price").html(
2465          category_11_price +
2466            '円〜<span class="modelFv__price--small">(税込)</span>'
2467        );
2468      }
2469      if (category_xs_price === "∞") {
2470        $(".js_model_xs_price").css("display", "none");
2471      } else {
2472        $(".js_model_xs_price").html(
2473          category_xs_price +
2474            '円〜<span class="modelFv__price--small">(税込)</span>'
2475        );
2476      }
2477      if (category_xr_price === "∞") {
2478        $(".js_model_xr_price").css("display", "none");
2479      } else {
2480        $(".js_model_xr_price").html(
2481          category_xr_price +
2482            '円〜<span class="modelFv__price--small">(税込)</span>'
2483        );
2484      }
2485      if (category_x_price === "∞") {
2486        $(".js_model_x_price").css("display", "none");
2487      } else {
2488        $(".js_model_x_price").html(
2489          category_x_price +
2490            '円〜<span class="modelFv__price--small">(税込)</span>'
2491        );
2492      }
2493      if (category_8_price === "∞") {
2494        $(".js_model_8_price").css("display", "none");
2495      } else {
2496        $(".js_model_8_price").html(
2497          category_8_price +
2498            '円〜<span class="modelFv__price--small">(税込)</span>'
2499        );
2500      }
2501      if (category_7_price === "∞") {
2502        $(".js_model_7_price").css("display", "none");
2503      } else {
2504        $(".js_model_7_price").html(
2505          category_7_price +
2506            '円〜<span class="modelFv__price--small">(税込)</span>'
2507        );
2508      }
2509      if (category_6s_price === "∞") {
2510        $(".js_model_6s_price").css("display", "none");
2511      } else {
2512        $(".js_model_6s_price").html(
2513          category_6s_price +
2514            '円〜<span class="modelFv__price--small">(税込)</span>'
2515        );
2516      }
2517      if (category_6_price === "∞") {
2518        $(".js_model_6_price").css("display", "none");
2519      } else {
2520        $(".js_model_6_price").html(
2521          category_6_price +
2522            '円〜<span class="modelFv__price--small">(税込)</span>'
2523        );
2524      }
2525      if (category_se_price === "∞") {
2526        $(".js_model_se_price").css("display", "none");
2527      } else {
2528        $(".js_model_se_price").html(
2529          category_se_price +
2530            '円〜<span class="modelFv__price--small">(税込)</span>'
2531        );
2532      }
2533      if (category_5s_price === "∞") {
2534        $(".js_model_5s_price").css("display", "none");
2535      } else {
2536        $(".js_model_5s_price").html(
2537          category_5s_price +
2538            '円〜<span class="modelFv__price--small">(税込)</span>'
2539        );
2540      }
2541    }
2542
2543    //   モデルの在庫関係;
2544    function set_model_stock() {
2545      const keywords_length = [
2546        career.length,
2547        strage.length,
2548        color.length,
2549        rank.length,
2550        searched_price.length,
2551      ];
2552      const filtered_keywords = keywords_length.filter((e) => !(e == 0));
2553
2554      if (filtered_keywords.length == 0) {
2555        filter_model_data();
2556        show_model();
2557      } else {
2558        filter_model_data(
2559          searched_career,
2560          searched_strage,
2561          searched_color,
2562          searched_rank,
2563          searched_price
2564        );
2565        show_model();
2566      }
2567    }
2568
2569    function filter_model_data(...data_array) {
2570      if (data_array.length > 0) {
2571        // 引数の配列を整形
2572        let filtered_data_array = data_array[0];
2573        if (data_array.length > 1) {
2574          for (let i = 1; i < data_array.length; i++) {
2575            if (filtered_data_array.length != 0 && data_array[i].length != 0) {
2576              filtered_data_array = filtered_data_array.concat(data_array[i]);
2577
2578              filtered_data_array = filtered_data_array.filter(function (
2579                x,
2580                i,
2581                self
2582              ) {
2583                return self.indexOf(x) !== self.lastIndexOf(x);
2584              });
2585              filtered_data_array = Array.from(new Set(filtered_data_array));
2586            } else if (data_array[i].length != 0) {
2587              filtered_data_array = filtered_data_array.concat(data_array[i]);
2588            }
2589          }
2590        }
2591
2592        // ipad
2593        model_ipad_data = original_ipad_data;
2594        model_ipad_data = model_ipad_data.concat(filtered_data_array);
2595        model_ipad_data = model_ipad_data.filter(function (x, i, self) {
2596          return self.indexOf(x) !== self.lastIndexOf(x);
2597        });
2598        model_ipad_data = Array.from(new Set(model_ipad_data));
2599
2600        // android
2601        model_android_data = original_android_data;
2602        model_android_data = model_android_data.concat(filtered_data_array);
2603        model_android_data = model_android_data.filter(function (x, i, self) {
2604          return self.indexOf(x) !== self.lastIndexOf(x);
2605        });
2606        model_android_data = Array.from(new Set(model_android_data));
2607
2608        // 15pro
2609        model_15pro_data = original_15pro_data;
2610        model_15pro_data = model_15pro_data.concat(filtered_data_array);
2611        model_15pro_data = model_15pro_data.filter(function (x, i, self) {
2612          return self.indexOf(x) !== self.lastIndexOf(x);
2613        });
2614        model_15pro_data = Array.from(new Set(model_15pro_data));
2615
2616        // 15
2617        model_15_data = original_15_data;
2618        model_15_data = model_15_data.concat(filtered_data_array);
2619        model_15_data = model_15_data.filter(function (x, i, self) {
2620          return self.indexOf(x) !== self.lastIndexOf(x);
2621        });
2622        model_15_data = Array.from(new Set(model_15_data));
2623
2624        // 14pro
2625        model_14pro_data = original_14pro_data;
2626        model_14pro_data = model_14pro_data.concat(filtered_data_array);
2627        model_14pro_data = model_14pro_data.filter(function (x, i, self) {
2628          return self.indexOf(x) !== self.lastIndexOf(x);
2629        });
2630        model_14pro_data = Array.from(new Set(model_14pro_data));
2631
2632        // 14
2633        model_14_data = original_14_data;
2634        model_14_data = model_14_data.concat(filtered_data_array);
2635        model_14_data = model_14_data.filter(function (x, i, self) {
2636          return self.indexOf(x) !== self.lastIndexOf(x);
2637        });
2638        model_14_data = Array.from(new Set(model_14_data));
2639
2640        // se3
2641        model_se3_data = original_se3_data;
2642        model_se3_data = model_se3_data.concat(filtered_data_array);
2643        model_se3_data = model_se3_data.filter(function (x, i, self) {
2644          return self.indexOf(x) !== self.lastIndexOf(x);
2645        });
2646        model_se3_data = Array.from(new Set(model_se3_data));
2647
2648        // 13pro
2649        model_13pro_data = original_13pro_data;
2650        model_13pro_data = model_13pro_data.concat(filtered_data_array);
2651        model_13pro_data = model_13pro_data.filter(function (x, i, self) {
2652          return self.indexOf(x) !== self.lastIndexOf(x);
2653        });
2654        model_13pro_data = Array.from(new Set(model_13pro_data));
2655
2656        // 13
2657        model_13_data = original_13_data;
2658        model_13_data = model_13_data.concat(filtered_data_array);
2659        model_13_data = model_13_data.filter(function (x, i, self) {
2660          return self.indexOf(x) !== self.lastIndexOf(x);
2661        });
2662        model_13_data = Array.from(new Set(model_13_data));
2663
2664        // 12pro
2665        model_12pro_data = original_12pro_data;
2666        model_12pro_data = model_12pro_data.concat(filtered_data_array);
2667        model_12pro_data = model_12pro_data.filter(function (x, i, self) {
2668          return self.indexOf(x) !== self.lastIndexOf(x);
2669        });
2670        model_12pro_data = Array.from(new Set(model_12pro_data));
2671
2672        // 12
2673        model_12_data = original_12_data;
2674        model_12_data = model_12_data.concat(filtered_data_array);
2675        model_12_data = model_12_data.filter(function (x, i, self) {
2676          return self.indexOf(x) !== self.lastIndexOf(x);
2677        });
2678        model_12_data = Array.from(new Set(model_12_data));
2679
2680        // se2
2681        model_se2_data = original_se2_data;
2682        model_se2_data = model_se2_data.concat(filtered_data_array);
2683        model_se2_data = model_se2_data.filter(function (x, i, self) {
2684          return self.indexOf(x) !== self.lastIndexOf(x);
2685        });
2686        model_se2_data = Array.from(new Set(model_se2_data));
2687
2688        // 11pro
2689        model_11pro_data = original_11pro_data;
2690        model_11pro_data = model_11pro_data.concat(filtered_data_array);
2691        model_11pro_data = model_11pro_data.filter(function (x, i, self) {
2692          return self.indexOf(x) !== self.lastIndexOf(x);
2693        });
2694        model_11pro_data = Array.from(new Set(model_11pro_data));
2695
2696        // 11
2697        model_11_data = original_11_data;
2698        model_11_data = model_11_data.concat(filtered_data_array);
2699        model_11_data = model_11_data.filter(function (x, i, self) {
2700          return self.indexOf(x) !== self.lastIndexOf(x);
2701        });
2702        model_11_data = Array.from(new Set(model_11_data));
2703
2704        // xs
2705        model_xs_data = original_xs_data;
2706        model_xs_data = model_xs_data.concat(filtered_data_array);
2707        model_xs_data = model_xs_data.filter(function (x, i, self) {
2708          return self.indexOf(x) !== self.lastIndexOf(x);
2709        });
2710        model_xs_data = Array.from(new Set(model_xs_data));
2711
2712        // xr
2713        model_xr_data = original_xr_data;
2714        model_xr_data = model_xr_data.concat(filtered_data_array);
2715        model_xr_data = model_xr_data.filter(function (x, i, self) {
2716          return self.indexOf(x) !== self.lastIndexOf(x);
2717        });
2718        model_xr_data = Array.from(new Set(model_xr_data));
2719
2720        // x
2721        model_x_data = original_x_data;
2722        model_x_data = model_x_data.concat(filtered_data_array);
2723        model_x_data = model_x_data.filter(function (x, i, self) {
2724          return self.indexOf(x) !== self.lastIndexOf(x);
2725        });
2726        model_x_data = Array.from(new Set(model_x_data));
2727
2728        // 8
2729        model_8_data = original_8_data;
2730        model_8_data = model_8_data.concat(filtered_data_array);
2731        model_8_data = model_8_data.filter(function (x, i, self) {
2732          return self.indexOf(x) !== self.lastIndexOf(x);
2733        });
2734        model_8_data = Array.from(new Set(model_8_data));
2735
2736        // 7
2737        model_7_data = original_7_data;
2738        model_7_data = model_7_data.concat(filtered_data_array);
2739        model_7_data = model_7_data.filter(function (x, i, self) {
2740          return self.indexOf(x) !== self.lastIndexOf(x);
2741        });
2742        model_7_data = Array.from(new Set(model_7_data));
2743
2744        // 6s
2745        model_6s_data = original_6s_data;
2746        model_6s_data = model_6s_data.concat(filtered_data_array);
2747        model_6s_data = model_6s_data.filter(function (x, i, self) {
2748          return self.indexOf(x) !== self.lastIndexOf(x);
2749        });
2750        model_6s_data = Array.from(new Set(model_6s_data));
2751
2752        // 6
2753        model_6_data = original_6_data;
2754        model_6_data = model_6_data.concat(filtered_data_array);
2755        model_6_data = model_6_data.filter(function (x, i, self) {
2756          return self.indexOf(x) !== self.lastIndexOf(x);
2757        });
2758        model_6_data = Array.from(new Set(model_6_data));
2759
2760        // se
2761        model_se_data = original_se_data;
2762        model_se_data = model_se_data.concat(filtered_data_array);
2763        model_se_data = model_se_data.filter(function (x, i, self) {
2764          return self.indexOf(x) !== self.lastIndexOf(x);
2765        });
2766        model_se_data = Array.from(new Set(model_se_data));
2767
2768        // 5s
2769        model_5s_data = original_5s_data;
2770        model_5s_data = model_5s_data.concat(filtered_data_array);
2771        model_5s_data = model_5s_data.filter(function (x, i, self) {
2772          return self.indexOf(x) !== self.lastIndexOf(x);
2773        });
2774        model_5s_data = Array.from(new Set(model_5s_data));
2775      } else {
2776        model_ipad_data = original_ipad_data;
2777        model_android_data = original_android_data;
2778        model_15pro_data = original_15pro_data;
2779        model_15_data = original_15_data;
2780        model_14pro_data = original_14pro_data;
2781        model_14_data = original_14_data;
2782        model_se3_data = original_se3_data;
2783        model_13pro_data = original_13pro_data;
2784        model_13_data = original_13_data;
2785        model_12pro_data = original_12pro_data;
2786        model_12_data = original_12_data;
2787        model_se2_data = original_se2_data;
2788        model_11pro_data = original_11pro_data;
2789        model_11_data = original_11_data;
2790        model_xs_data = original_xs_data;
2791        model_xr_data = original_xr_data;
2792        model_x_data = original_x_data;
2793        model_8_data = original_8_data;
2794        model_7_data = original_7_data;
2795        model_6s_data = original_6s_data;
2796        model_6_data = original_6_data;
2797        model_se_data = original_se_data;
2798        model_5s_data = original_5s_data;
2799      }
2800    }
2801
2802    function show_model() {
2803      if (model_ipad_data.length) {
2804        $(".js_model_ipad").css("display", "block");
2805      } else {
2806        $(".js_model_ipad").css("display", "none");
2807      }
2808      if (model_android_data.length) {
2809        $(".js_model_android").css("display", "block");
2810      } else {
2811        $(".js_model_android").css("display", "none");
2812      }
2813      if (model_15pro_data.length) {
2814        $(".js_model_15pro").css("display", "block");
2815      } else {
2816        $(".js_model_15pro").css("display", "none");
2817      }
2818      if (model_15_data.length) {
2819        $(".js_model_15").css("display", "block");
2820      } else {
2821        $(".js_model_15").css("display", "none");
2822      }
2823      if (model_14pro_data.length) {
2824        $(".js_model_14pro").css("display", "block");
2825      } else {
2826        $(".js_model_14pro").css("display", "none");
2827      }
2828      if (model_14_data.length) {
2829        $(".js_model_14").css("display", "block");
2830      } else {
2831        $(".js_model_14").css("display", "none");
2832      }
2833      if (model_se3_data.length) {
2834        $(".js_model_se3").css("display", "block");
2835      } else {
2836        $(".js_model_se3").css("display", "none");
2837      }
2838      if (model_13pro_data.length) {
2839        $(".js_model_13pro").css("display", "block");
2840      } else {
2841        $(".js_model_13pro").css("display", "none");
2842      }
2843      if (model_13_data.length) {
2844        $(".js_model_13").css("display", "block");
2845      } else {
2846        $(".js_model_13").css("display", "none");
2847      }
2848      if (model_12pro_data.length) {
2849        $(".js_model_12pro").css("display", "block");
2850      } else {
2851        $(".js_model_12pro").css("display", "none");
2852      }
2853      if (model_12_data.length) {
2854        $(".js_model_12").css("display", "block");
2855      } else {
2856        $(".js_model_12").css("display", "none");
2857      }
2858      if (model_se2_data.length) {
2859        $(".js_model_se2").css("display", "block");
2860      } else {
2861        $(".js_model_se2").css("display", "none");
2862      }
2863      if (model_11pro_data.length) {
2864        $(".js_model_11pro").css("display", "block");
2865      } else {
2866        $(".js_model_11pro").css("display", "none");
2867      }
2868      if (model_11_data.length) {
2869        $(".js_model_11").css("display", "block");
2870      } else {
2871        $(".js_model_11").css("display", "none");
2872      }
2873      if (model_xs_data.length) {
2874        $(".js_model_xs").css("display", "block");
2875      } else {
2876        $(".js_model_xs").css("display", "none");
2877      }
2878      if (model_xr_data.length) {
2879        $(".js_model_xr").css("display", "block");
2880      } else {
2881        $(".js_model_xr").css("display", "none");
2882      }
2883      if (model_x_data.length) {
2884        $(".js_model_x").css("display", "block");
2885      } else {
2886        $(".js_model_x").css("display", "none");
2887      }
2888      if (model_8_data.length) {
2889        $(".js_model_8").css("display", "block");
2890      } else {
2891        $(".js_model_8").css("display", "none");
2892      }
2893      if (model_7_data.length) {
2894        $(".js_model_7").css("display", "block");
2895      } else {
2896        $(".js_model_7").css("display", "none");
2897      }
2898      if (model_6s_data.length) {
2899        $(".js_model_6s").css("display", "block");
2900      } else {
2901        $(".js_model_6s").css("display", "none");
2902      }
2903      if (model_6_data.length) {
2904        $(".js_model_6").css("display", "block");
2905      } else {
2906        $(".js_model_6").css("display", "none");
2907      }
2908      if (model_se_data.length) {
2909        $(".js_model_se").css("display", "block");
2910      } else {
2911        $(".js_model_se").css("display", "none");
2912      }
2913      if (model_5s_data.length) {
2914        $(".js_model_5s").css("display", "block");
2915      } else {
2916        $(".js_model_5s").css("display", "none");
2917      }
2918    }
2919
2920    //   キャリアの在庫関係;
2921    function set_career_stock() {
2922      const keywords_length = [
2923        keyword.length,
2924        model.length,
2925        strage.length,
2926        color.length,
2927        rank.length,
2928        searched_price.length,
2929      ];
2930      const filtered_keywords = keywords_length.filter((e) => !(e == 0));
2931
2932      if (filtered_keywords.length == 0) {
2933        filter_career_data();
2934        show_career();
2935      } else {
2936        filter_career_data(
2937          searched_keyword,
2938          searched_model,
2939          searched_strage,
2940          searched_color,
2941          searched_rank,
2942          searched_price
2943        );
2944        show_career();
2945      }
2946    }
2947
2948    function filter_career_data(...data_array) {
2949      if (data_array.length > 0) {
2950        // 引数の配列を整形
2951        let filtered_data_array = data_array[0];
2952        if (data_array.length > 1) {
2953          for (let i = 1; i < data_array.length; i++) {
2954            if (filtered_data_array.length != 0 && data_array[i].length != 0) {
2955              filtered_data_array = filtered_data_array.concat(data_array[i]);
2956
2957              filtered_data_array = filtered_data_array.filter(function (
2958                x,
2959                i,
2960                self
2961              ) {
2962                return self.indexOf(x) !== self.lastIndexOf(x);
2963              });
2964              filtered_data_array = Array.from(new Set(filtered_data_array));
2965            } else if (data_array[i].length != 0) {
2966              filtered_data_array = filtered_data_array.concat(data_array[i]);
2967            }
2968          }
2969        }
2970
2971        // simフリー
2972        career_sim_data = original_sim_data;
2973        career_sim_data = career_sim_data.concat(filtered_data_array);
2974        career_sim_data = career_sim_data.filter(function (x, i, self) {
2975          return self.indexOf(x) !== self.lastIndexOf(x);
2976        });
2977        career_sim_data = Array.from(new Set(career_sim_data));
2978
2979        // docomoフリー
2980        career_docomo_data = original_docomo_data;
2981        career_docomo_data = career_docomo_data.concat(filtered_data_array);
2982        career_docomo_data = career_docomo_data.filter(function (x, i, self) {
2983          return self.indexOf(x) !== self.lastIndexOf(x);
2984        });
2985        career_docomo_data = Array.from(new Set(career_docomo_data));
2986
2987        // auフリー
2988        career_au_data = original_au_data;
2989        career_au_data = career_au_data.concat(filtered_data_array);
2990        career_au_data = career_au_data.filter(function (x, i, self) {
2991          return self.indexOf(x) !== self.lastIndexOf(x);
2992        });
2993        career_au_data = Array.from(new Set(career_au_data));
2994
2995        // softbankフリー
2996        career_softbank_data = original_softbank_data;
2997        career_softbank_data = career_softbank_data.concat(filtered_data_array);
2998        career_softbank_data = career_softbank_data.filter(function (
2999          x,
3000          i,
3001          self
3002        ) {
3003          return self.indexOf(x) !== self.lastIndexOf(x);
3004        });
3005        career_softbank_data = Array.from(new Set(career_softbank_data));
3006
3007        // ymobileフリー
3008        career_ymobile_data = original_ymobile_data;
3009        career_ymobile_data = career_ymobile_data.concat(filtered_data_array);
3010        career_ymobile_data = career_ymobile_data.filter(function (x, i, self) {
3011          return self.indexOf(x) !== self.lastIndexOf(x);
3012        });
3013        career_ymobile_data = Array.from(new Set(career_ymobile_data));
3014      } else {
3015        career_sim_data = original_sim_data;
3016        career_docomo_data = original_docomo_data;
3017        career_au_data = original_au_data;
3018        career_softbank_data = original_softbank_data;
3019        career_ymobile_data = original_ymobile_data;
3020      }
3021    }
3022
3023    function show_career() {
3024      if (career_sim_data.length) {
3025        $(".js_career_sim").css("display", "block");
3026      } else {
3027        $(".js_career_sim").css("display", "none");
3028      }
3029      if (career_docomo_data.length) {
3030        $(".js_career_docomo").css("display", "block");
3031      } else {
3032        $(".js_career_docomo").css("display", "none");
3033      }
3034      if (career_au_data.length) {
3035        $(".js_career_au").css("display", "block");
3036      } else {
3037        $(".js_career_au").css("display", "none");
3038      }
3039      if (career_softbank_data.length) {
3040        $(".js_career_softbank").css("display", "block");
3041      } else {
3042        $(".js_career_softbank").css("display", "none");
3043      }
3044      if (career_ymobile_data.length) {
3045        $(".js_career_ymobile").css("display", "block");
3046      } else {
3047        $(".js_career_ymobile").css("display", "none");
3048      }
3049    }
3050
3051    //   ストレージの在庫関係;
3052    function set_strage_stock() {
3053      const keywords_length = [
3054        keyword.length,
3055        model.length,
3056        career.length,
3057        color.length,
3058        rank.length,
3059        searched_price.length,
3060      ];
3061      const filtered_keywords = keywords_length.filter((e) => !(e == 0));
3062
3063      if (filtered_keywords.length == 0) {
3064        filter_strage_data();
3065        show_strage();
3066      } else {
3067        filter_strage_data(
3068          searched_keyword,
3069          searched_model,
3070          searched_career,
3071          searched_color,
3072          searched_rank,
3073          searched_price
3074        );
3075        show_strage();
3076      }
3077    }
3078
3079    function filter_strage_data(...data_array) {
3080      if (data_array.length > 0) {
3081        // 引数の配列を整形
3082        let filtered_data_array = data_array[0];
3083        if (data_array.length > 1) {
3084          for (let i = 1; i < data_array.length; i++) {
3085            if (filtered_data_array.length != 0 && data_array[i].length != 0) {
3086              filtered_data_array = filtered_data_array.concat(data_array[i]);
3087
3088              filtered_data_array = filtered_data_array.filter(function (
3089                x,
3090                i,
3091                self
3092              ) {
3093                return self.indexOf(x) !== self.lastIndexOf(x);
3094              });
3095              filtered_data_array = Array.from(new Set(filtered_data_array));
3096            } else if (data_array[i].length != 0) {
3097              filtered_data_array = filtered_data_array.concat(data_array[i]);
3098            }
3099          }
3100        }
3101
3102        // 16GB
3103        strage_16_data = original_16_data;
3104        strage_16_data = strage_16_data.concat(filtered_data_array);
3105        strage_16_data = strage_16_data.filter(function (x, i, self) {
3106          return self.indexOf(x) !== self.lastIndexOf(x);
3107        });
3108        strage_16_data = Array.from(new Set(strage_16_data));
3109
3110        // 32GB
3111        strage_32_data = original_32_data;
3112        strage_32_data = strage_32_data.concat(filtered_data_array);
3113        strage_32_data = strage_32_data.filter(function (x, i, self) {
3114          return self.indexOf(x) !== self.lastIndexOf(x);
3115        });
3116        strage_32_data = Array.from(new Set(strage_32_data));
3117
3118        // 64GB
3119        strage_64_data = original_64_data;
3120        strage_64_data = strage_64_data.concat(filtered_data_array);
3121        strage_64_data = strage_64_data.filter(function (x, i, self) {
3122          return self.indexOf(x) !== self.lastIndexOf(x);
3123        });
3124        strage_64_data = Array.from(new Set(strage_64_data));
3125
3126        // 128GB
3127        strage_128_data = original_128_data;
3128        strage_128_data = strage_128_data.concat(filtered_data_array);
3129        strage_128_data = strage_128_data.filter(function (x, i, self) {
3130          return self.indexOf(x) !== self.lastIndexOf(x);
3131        });
3132        strage_128_data = Array.from(new Set(strage_128_data));
3133
3134        // 256GB
3135        strage_256_data = original_256_data;
3136        strage_256_data = strage_256_data.concat(filtered_data_array);
3137        strage_256_data = strage_256_data.filter(function (x, i, self) {
3138          return self.indexOf(x) !== self.lastIndexOf(x);
3139        });
3140        strage_256_data = Array.from(new Set(strage_256_data));
3141
3142        // 512GB
3143        strage_512_data = original_512_data;
3144        strage_512_data = strage_512_data.concat(filtered_data_array);
3145        strage_512_data = strage_512_data.filter(function (x, i, self) {
3146          return self.indexOf(x) !== self.lastIndexOf(x);
3147        });
3148        strage_512_data = Array.from(new Set(strage_512_data));
3149      } else {
3150        strage_16_data = original_16_data;
3151        strage_32_data = original_32_data;
3152        strage_64_data = original_64_data;
3153        strage_128_data = original_128_data;
3154        strage_256_data = original_256_data;
3155        strage_512_data = original_512_data;
3156      }
3157    }
3158
3159    function show_strage() {
3160      if (strage_16_data.length) {
3161        $(".js_strage_16").css("display", "block");
3162      } else {
3163        $(".js_strage_16").css("display", "none");
3164      }
3165      if (strage_32_data.length) {
3166        $(".js_strage_32").css("display", "block");
3167      } else {
3168        $(".js_strage_32").css("display", "none");
3169      }
3170      if (strage_64_data.length) {
3171        $(".js_strage_64").css("display", "block");
3172      } else {
3173        $(".js_strage_64").css("display", "none");
3174      }
3175      if (strage_128_data.length) {
3176        $(".js_strage_128").css("display", "block");
3177      } else {
3178        $(".js_strage_128").css("display", "none");
3179      }
3180      if (strage_256_data.length) {
3181        $(".js_strage_256").css("display", "block");
3182      } else {
3183        $(".js_strage_256").css("display", "none");
3184      }
3185      if (strage_512_data.length) {
3186        $(".js_strage_512").css("display", "block");
3187      } else {
3188        $(".js_strage_512").css("display", "none");
3189      }
3190    }
3191
3192    //   ランクの在庫関係;
3193    function set_rank_stock() {
3194      const keywords_length = [
3195        keyword.length,
3196        model.length,
3197        career.length,
3198        color.length,
3199        strage.length,
3200        searched_price.length,
3201      ];
3202      const filtered_keywords = keywords_length.filter((e) => !(e == 0));
3203
3204      if (filtered_keywords.length == 0) {
3205        filter_rank_data();
3206        show_rank();
3207      } else {
3208        filter_rank_data(
3209          searched_keyword,
3210          searched_model,
3211          searched_career,
3212          searched_color,
3213          searched_strage,
3214          searched_price
3215        );
3216        show_rank();
3217      }
3218    }
3219
3220    function filter_rank_data(...data_array) {
3221      if (data_array.length > 0) {
3222        // 引数の配列を整形
3223        let filtered_data_array = data_array[0];
3224        if (data_array.length > 1) {
3225          for (let i = 1; i < data_array.length; i++) {
3226            if (filtered_data_array.length != 0 && data_array[i].length != 0) {
3227              filtered_data_array = filtered_data_array.concat(data_array[i]);
3228
3229              filtered_data_array = filtered_data_array.filter(function (
3230                x,
3231                i,
3232                self
3233              ) {
3234                return self.indexOf(x) !== self.lastIndexOf(x);
3235              });
3236              filtered_data_array = Array.from(new Set(filtered_data_array));
3237            } else if (data_array[i].length != 0) {
3238              filtered_data_array = filtered_data_array.concat(data_array[i]);
3239            }
3240          }
3241        }
3242
3243        // SSランク
3244        rank_ss_data = original_ss_data;
3245        rank_ss_data = rank_ss_data.concat(filtered_data_array);
3246        rank_ss_data = rank_ss_data.filter(function (x, i, self) {
3247          return self.indexOf(x) !== self.lastIndexOf(x);
3248        });
3249        rank_ss_data = Array.from(new Set(rank_ss_data));
3250
3251        // sランク
3252        rank_s_data = original_s_data;
3253        rank_s_data = rank_s_data.concat(filtered_data_array);
3254        rank_s_data = rank_s_data.filter(function (x, i, self) {
3255          return self.indexOf(x) !== self.lastIndexOf(x);
3256        });
3257        rank_s_data = Array.from(new Set(rank_s_data));
3258
3259        // aランク
3260        rank_a_data = original_a_data;
3261        rank_a_data = rank_a_data.concat(filtered_data_array);
3262        rank_a_data = rank_a_data.filter(function (x, i, self) {
3263          return self.indexOf(x) !== self.lastIndexOf(x);
3264        });
3265        rank_a_data = Array.from(new Set(rank_a_data));
3266
3267        // bランク
3268        rank_b_data = original_b_data;
3269        rank_b_data = rank_b_data.concat(filtered_data_array);
3270        rank_b_data = rank_b_data.filter(function (x, i, self) {
3271          return self.indexOf(x) !== self.lastIndexOf(x);
3272        });
3273        rank_b_data = Array.from(new Set(rank_b_data));
3274
3275        // cランク
3276        rank_c_data = original_c_data;
3277        rank_c_data = rank_c_data.concat(filtered_data_array);
3278        rank_c_data = rank_c_data.filter(function (x, i, self) {
3279          return self.indexOf(x) !== self.lastIndexOf(x);
3280        });
3281        rank_c_data = Array.from(new Set(rank_c_data));
3282
3283        // jランク
3284        rank_j_data = original_j_data;
3285        rank_j_data = rank_j_data.concat(filtered_data_array);
3286        rank_j_data = rank_j_data.filter(function (x, i, self) {
3287          return self.indexOf(x) !== self.lastIndexOf(x);
3288        });
3289        rank_j_data = Array.from(new Set(rank_j_data));
3290      } else {
3291        rank_ss_data = original_ss_data;
3292        rank_s_data = original_s_data;
3293        rank_a_data = original_a_data;
3294        rank_b_data = original_b_data;
3295        rank_c_data = original_c_data;
3296        rank_j_data = original_j_data;
3297      }
3298    }
3299
3300    function show_rank() {
3301      if (rank_ss_data.length) {
3302        $(".js_rank_ss").css("display", "block");
3303      } else {
3304        $(".js_rank_ss").css("display", "none");
3305      }
3306      if (rank_s_data.length) {
3307        $(".js_rank_s").css("display", "block");
3308      } else {
3309        $(".js_rank_s").css("display", "none");
3310      }
3311      if (rank_a_data.length) {
3312        $(".js_rank_a").css("display", "block");
3313      } else {
3314        $(".js_rank_a").css("display", "none");
3315      }
3316      if (rank_b_data.length) {
3317        $(".js_rank_b").css("display", "block");
3318      } else {
3319        $(".js_rank_b").css("display", "none");
3320      }
3321      if (rank_c_data.length) {
3322        $(".js_rank_c").css("display", "block");
3323      } else {
3324        $(".js_rank_c").css("display", "none");
3325      }
3326      if (rank_j_data.length) {
3327        $(".js_rank_j").css("display", "block");
3328      } else {
3329        $(".js_rank_j").css("display", "none");
3330      }
3331    }
3332
3333    function show_products(page) {
3334      const max_products = organized_data.length;
3335      const max_page = Math.floor(max_products / 12) + 1;
3336      const max_page_products = max_products % 12;
3337      const page_per_items = 12;
3338      const items_add = (page - 1) * page_per_items;
3339      let products_html = "";
3340      const root_url = location.protocol + "//" + location.host;
3341
3342      $(".js_products_count").text(max_products);
3343
3344      if (max_products == 0) {
3345        products_html +=
3346          '<p style="text-align: center;font-size: 16px;margin-top: 50px;width: 100%;">一致する商品はありません。</p>';
3347      } else if (page == max_page) {
3348        for (let i = 0; i < max_page_products; i++) {
3349          const num = i + items_add;
3350          const detail_images = organized_data[num]["images"];
3351          let images =
3352            `<a href="` +
3353            root_url +
3354            `/detail?id=` +
3355            organized_data[num]["id"] +
3356            `"><img src="` +
3357            organized_data[num]["thumbnail_image_url"] +
3358            `" class="product__img" alt=""></a>`;
3359          for (let i = 0; i < detail_images.length; i++) {
3360            images +=
3361              `<a href="` +
3362              root_url +
3363              `/detail?id=` +
3364              organized_data[num]["id"] +
3365              `"><img src="` +
3366              detail_images[i]["src"] +
3367              `" class="product__img" alt=""></a>`;
3368          }
3369
3370          products_html +=
3371            '<div class="search__list">\n' +
3372            '<div class="product">\n' +
3373            '<div class="product__imgArea">\n' +
3374            '<div class="product__slide js_product_slide">' +
3375            images +
3376            "</div>" +
3377            "</div>" +
3378            '<span class="product__point">' +
3379            get_rank(organized_data[num]["group_ids"]) +
3380            "</span>\n" +
3381            '<a href="' +
3382            root_url +
3383            "/detail?id=" +
3384            organized_data[num]["id"] +
3385            '" class="product__textArea">' +
3386            '<p class="product__title">' +
3387            organized_data[num]["name"] +
3388            "</p>\n" +
3389            '<p class="product__battery">バッテリー:' +
3390            get_battery(organized_data[num]["group_ids"]) +
3391            "</p>\n" +
3392            '<p class="product__price">Â¥' +
3393            organized_data[num]["sales_price"].toLocaleString() +
3394            "(税込)</p>\n" +
3395            '<p class="product__note">明日中にお届け</p>\n' +
3396            "</a>\n" +
3397            "</div>\n" +
3398            "</div>\n";
3399        }
3400      } else {
3401        for (let i = 0; i < 12; i++) {
3402          const num = i + items_add;
3403          const detail_images = organized_data[num]["images"];
3404          let images =
3405            `<a href="` +
3406            root_url +
3407            `/detail?id=` +
3408            organized_data[num]["id"] +
3409            `"><img src="` +
3410            organized_data[num]["thumbnail_image_url"] +
3411            `" class="product__img" alt=""></a>`;
3412          for (let i = 0; i < detail_images.length; i++) {
3413            images +=
3414              `<a href="` +
3415              root_url +
3416              `/detail?id=` +
3417              organized_data[num]["id"] +
3418              `"><img src="` +
3419              detail_images[i]["src"] +
3420              `" class="product__img" alt=""></a>`;
3421          }
3422
3423          products_html +=
3424            '<div class="search__list">\n' +
3425            '<div class="product">\n' +
3426            '<div class="product__imgArea">\n' +
3427            '<div class="product__slide js_product_slide">' +
3428            images +
3429            "</div>" +
3430            "</div>" +
3431            '<span class="product__point">' +
3432            get_rank(organized_data[num]["group_ids"]) +
3433            "</span>\n" +
3434            '<a href="' +
3435            root_url +
3436            "/detail?id=" +
3437            organized_data[num]["id"] +
3438            '" class="product__textArea">' +
3439            '<p class="product__title">' +
3440            organized_data[num]["name"] +
3441            "</p>\n" +
3442            '<p class="product__battery">バッテリー:' +
3443            get_battery(organized_data[num]["group_ids"]) +
3444            "</p>\n" +
3445            '<p class="product__price">Â¥' +
3446            organized_data[num]["sales_price"].toLocaleString() +
3447            "(税込)</p>\n" +
3448            '<p class="product__note">明日中にお届け</p>\n' +
3449            "</a>\n" +
3450            "</div>\n" +
3451            "</div>\n";
3452        }
3453      }
3454      $(".js_show_products").html(products_html);
3455      $(".js_product_slide").slick({
3456        autoplay: false,
3457        arrows: true,
3458        infinite: true,
3459        initialSlide: 0,
3460      });
3461    }
3462
3463    function pagenation(page) {
3464      window.localStorage.setItem("page_num", page);
3465      const max_products = organized_data.length;
3466      const max_page = Math.floor(max_products / 12) + 1;
3467      const max_page_5 = Math.floor(max_products / 12) - 4;
3468      const max_page_4 = Math.floor(max_products / 12) - 3;
3469      const max_page_3 = Math.floor(max_products / 12) - 2;
3470      const max_page_2 = Math.floor(max_products / 12) - 1;
3471      const max_page_1 = Math.floor(max_products / 12);
3472      const page_2 = Number(page) - 2;
3473      const page_1 = Number(page) - 1;
3474      const page__1 = Number(page) + 1;
3475      const page__2 = Number(page) + 2;
3476
3477      let pagenation_html = "";
3478
3479      if (max_page == 1) {
3480        pagenation_html =
3481          '<button class="search__pagenationItem search__pagenationItem--active" data-num="1">1</button>';
3482      } else if (max_page == 2 && page == 1) {
3483        pagenation_html =
3484          '<button class="search__pagenationItem search__pagenationItem--active" data-num="1">1</button>' +
3485          '<button class="search__pagenationItem js_pagenation_num" data-num="2">2</button>';
3486      } else if (max_page == 2 && page == 2) {
3487        pagenation_html =
3488          '<button class="search__pagenationItem js_pagenation_num" data-num="1">1</button>' +
3489          '<button class="search__pagenationItem search__pagenationItem--active" data-num="2">2</button>';
3490      } else if (max_page == 3 && page == 1) {
3491        pagenation_html =
3492          '<button class="search__pagenationItem search__pagenationItem--active" data-num="1">1</button>' +
3493          '<button class="search__pagenationItem js_pagenation_num" data-num="2">2</button>' +
3494          '<button class="search__pagenationItem js_pagenation_num" data-num="3">3</button>';
3495      } else if (max_page == 3 && page == 2) {
3496        pagenation_html =
3497          '<button class="search__pagenationItem js_pagenation_num" data-num="1">1</button>' +
3498          '<button class="search__pagenationItem search__pagenationItem--active" data-num="2">2</button>' +
3499          '<button class="search__pagenationItem js_pagenation_num" data-num="3">3</button>';
3500      } else if (max_page == 3 && page == 3) {
3501        pagenation_html =
3502          '<button class="search__pagenationItem js_pagenation_num" data-num="1">1</button>' +
3503          '<button class="search__pagenationItem js_pagenation_num" data-num="2">2</button>' +
3504          '<button class="search__pagenationItem search__pagenationItem--active" data-num="3">3</button>';
3505      } else if (max_page == 4 && page == 1) {
3506        pagenation_html =
3507          '<button class="search__pagenationItem search__pagenationItem--active" data-num="1">1</button>' +
3508          '<button class="search__pagenationItem js_pagenation_num" data-num="2">2</button>' +
3509          '<button class="search__pagenationItem js_pagenation_num" data-num="3">3</button>' +
3510          '<button class="search__pagenationItem js_pagenation_num" data-num="4">4</button>';
3511      } else if (max_page == 4 && page == 2) {
3512        pagenation_html =
3513          '<button class="search__pagenationItem js_pagenation_num" data-num="1">1</button>' +
3514          '<button class="search__pagenationItem search__pagenationItem--active" data-num="2">2</button>' +
3515          '<button class="search__pagenationItem js_pagenation_num" data-num="3">3</button>' +
3516          '<button class="search__pagenationItem js_pagenation_num" data-num="4">4</button>';
3517      } else if (max_page == 4 && page == 3) {
3518        pagenation_html =
3519          '<button class="search__pagenationItem js_pagenation_num" data-num="1">1</button>' +
3520          '<button class="search__pagenationItem js_pagenation_num" data-num="2">2</button>' +
3521          '<button class="search__pagenationItem search__pagenationItem--active" data-num="3">3</button>' +
3522          '<button class="search__pagenationItem js_pagenation_num" data-num="4">4</button>';
3523      } else if (max_page == 4 && page == 4) {
3524        pagenation_html =
3525          '<button class="search__pagenationItem js_pagenation_num" data-num="1">1</button>' +
3526          '<button class="search__pagenationItem js_pagenation_num" data-num="2">2</button>' +
3527          '<button class="search__pagenationItem js_pagenation_num" data-num="3">3</button>' +
3528          '<button class="search__pagenationItem search__pagenationItem--active" data-num="4">4</button>';
3529      } else if (max_page == 5 && page == 1) {
3530        pagenation_html =
3531          '<button class="search__pagenationItem search__pagenationItem--active" data-num="1">1</button>' +
3532          '<button class="search__pagenationItem js_pagenation_num" data-num="2">2</button>' +
3533          '<button class="search__pagenationItem js_pagenation_num" data-num="3">3</button>' +
3534          '<button class="search__pagenationItem js_pagenation_num" data-num="4">4</button>' +
3535          '<button class="search__pagenationItem js_pagenation_num" data-num="5">5</button>';
3536      } else if (max_page == 5 && page == 2) {
3537        pagenation_html =
3538          '<button class="search__pagenationItem js_pagenation_num" data-num="1">1</button>' +
3539          '<button class="search__pagenationItem search__pagenationItem--active" data-num="2">2</button>' +
3540          '<button class="search__pagenationItem js_pagenation_num" data-num="3">3</button>' +
3541          '<button class="search__pagenationItem js_pagenation_num" data-num="4">4</button>' +
3542          '<button class="search__pagenationItem js_pagenation_num" data-num="5">5</button>';
3543      } else if (max_page == 5 && page == 3) {
3544        pagenation_html =
3545          '<button class="search__pagenationItem js_pagenation_num" data-num="1">1</button>' +
3546          '<button class="search__pagenationItem js_pagenation_num" data-num="2">2</button>' +
3547          '<button class="search__pagenationItem search__pagenationItem--active" data-num="3">3</button>' +
3548          '<button class="search__pagenationItem js_pagenation_num" data-num="4">4</button>' +
3549          '<button class="search__pagenationItem js_pagenation_num" data-num="5">5</button>';
3550      } else if (max_page == 5 && page == 4) {
3551        pagenation_html =
3552          '<button class="search__pagenationItem js_pagenation_num" data-num="1">1</button>' +
3553          '<button class="search__pagenationItem js_pagenation_num" data-num="2">2</button>' +
3554          '<button class="search__pagenationItem js_pagenation_num" data-num="3">3</button>' +
3555          '<button class="search__pagenationItem search__pagenationItem--active" data-num="4">4</button>' +
3556          '<button class="search__pagenationItem js_pagenation_num" data-num="5">5</button>';
3557      } else if (max_page == 5 && page == 5) {
3558        pagenation_html =
3559          '<button class="search__pagenationItem js_pagenation_num" data-num="1">1</button>' +
3560          '<button class="search__pagenationItem js_pagenation_num" data-num="2">2</button>' +
3561          '<button class="search__pagenationItem js_pagenation_num" data-num="3">3</button>' +
3562          '<button class="search__pagenationItem js_pagenation_num" data-num="4">4</button>' +
3563          '<button class="search__pagenationItem search__pagenationItem--active" data-num="5">5</button>';
3564      } else if (max_page == 6 && page == 1) {
3565        pagenation_html =
3566          '<button class="search__pagenationItem search__pagenationItem--active" data-num="1">1</button>' +
3567          '<button class="search__pagenationItem js_pagenation_num" data-num="2">2</button>' +
3568          '<button class="search__pagenationItem js_pagenation_num" data-num="3">3</button>' +
3569          '<button class="search__pagenationItem js_pagenation_num" data-num="4">4</button>' +
3570          '<button class="search__pagenationItem js_pagenation_num" data-num="5">5</button>' +
3571          '<button class="search__pagenationItem js_pagenation_num" data-num="6">6</button>';
3572      } else if (max_page == 6 && page == 2) {
3573        pagenation_html =
3574          '<button class="search__pagenationItem js_pagenation_num" data-num="1">1</button>' +
3575          '<button class="search__pagenationItem search__pagenationItem--active" data-num="2">2</button>' +
3576          '<button class="search__pagenationItem js_pagenation_num" data-num="3">3</button>' +
3577          '<button class="search__pagenationItem js_pagenation_num" data-num="4">4</button>' +
3578          '<button class="search__pagenationItem js_pagenation_num" data-num="5">5</button>' +
3579          '<button class="search__pagenationItem js_pagenation_num" data-num="6">6</button>';
3580      } else if (max_page == 6 && page == 3) {
3581        pagenation_html =
3582          '<button class="search__pagenationItem js_pagenation_num" data-num="1">1</button>' +
3583          '<button class="search__pagenationItem js_pagenation_num" data-num="2">2</button>' +
3584          '<button class="search__pagenationItem search__pagenationItem--active" data-num="3">3</button>' +
3585          '<button class="search__pagenationItem js_pagenation_num" data-num="4">4</button>' +
3586          '<button class="search__pagenationItem js_pagenation_num" data-num="5">5</button>' +
3587          '<button class="search__pagenationItem js_pagenation_num" data-num="6">6</button>';
3588      } else if (max_page == 6 && page == 4) {
3589        pagenation_html =
3590          '<button class="search__pagenationItem js_pagenation_num" data-num="1">1</button>' +
3591          '<button class="search__pagenationItem js_pagenation_num" data-num="2">2</button>' +
3592          '<button class="search__pagenationItem js_pagenation_num" data-num="3">3</button>' +
3593          '<button class="search__pagenationItem search__pagenationItem--active" data-num="4">4</button>' +
3594          '<button class="search__pagenationItem js_pagenation_num" data-num="5">5</button>' +
3595          '<button class="search__pagenationItem js_pagenation_num" data-num="6">6</button>';
3596      } else if (max_page == 6 && page == 5) {
3597        pagenation_html =
3598          '<button class="search__pagenationItem js_pagenation_num" data-num="1">1</button>' +
3599          '<button class="search__pagenationItem js_pagenation_num" data-num="2">2</button>' +
3600          '<button class="search__pagenationItem js_pagenation_num" data-num="3">3</button>' +
3601          '<button class="search__pagenationItem js_pagenation_num" data-num="4">4</button>' +
3602          '<button class="search__pagenationItem search__pagenationItem--active" data-num="5">5</button>' +
3603          '<button class="search__pagenationItem js_pagenation_num" data-num="6">6</button>';
3604      } else if (max_page == 6 && page == 6) {
3605        pagenation_html =
3606          '<button class="search__pagenationItem js_pagenation_num" data-num="1">1</button>' +
3607          '<button class="search__pagenationItem js_pagenation_num" data-num="2">2</button>' +
3608          '<button class="search__pagenationItem js_pagenation_num" data-num="3">3</button>' +
3609          '<button class="search__pagenationItem js_pagenation_num" data-num="4">4</button>' +
3610          '<button class="search__pagenationItem js_pagenation_num" data-num="5">5</button>' +
3611          '<button class="search__pagenationItem search__pagenationItem--active" data-num="6">6</button>';
3612      } else if (page == 1) {
3613        pagenation_html =
3614          '<button class="search__pagenationItem search__pagenationItem--active" data-num="1">1</button>' +
3615          '<button class="search__pagenationItem js_pagenation_num" data-num="2">2</button>' +
3616          '<button class="search__pagenationItem js_pagenation_num" data-num="3">3</button>' +
3617          '<span class="search__pagenationOmit">...</span>' +
3618          '<button class="search__pagenationItem js_pagenation_num" data-num="' +
3619          max_page +
3620          '">' +
3621          max_page +
3622          "</button>" +
3623          '<button class="search__pagenationNext js_pagenation_next"><img src="https://happinessnet.co.jp/wp-content/themes/happinessnet/img/pagenation-next.svg" alt=""></button>';
3624      } else if (page == 2) {
3625        pagenation_html =
3626          '<button class="search__pagenationPrev js_pagenation_prev"><img src="https://happinessnet.co.jp/wp-content/themes/happinessnet/img/pagenation-
3626prev.svg" alt=""></button>' +
3627          '<button class="search__pagenationItem js_pagenation_num" data-num="1">1</button>' +
3628          '<button class="search__pagenationItem search__pagenationItem--active" data-num="2">2</button>' +
3629          '<button class="search__pagenationItem js_pagenation_num" data-num="3">3</button>' +
3630          '<button class="search__pagenationItem js_pagenation_num" data-num="4">4</button>' +
3631          '<span class="search__pagenationOmit">...</span>' +
3632          '<button class="search__pagenationItem js_pagenation_num" data-num="' +
3633          max_page +
3634          '">' +
3635          max_page +
3636          "</button>" +
3637          '<button class="search__pagenationNext js_pagenation_next"><img src="https://happinessnet.co.jp/wp-content/themes/happinessnet/img/pagenation-next.svg" alt=""></button>';
3638      } else if (page == 3) {
3639        pagenation_html =
3640          '<button class="search__pagenationPrev js_pagenation_prev"><img src="https://happinessnet.co.jp/wp-content/themes/happinessnet/img/pagenation-prev.svg" alt=""></button>' +
3641          '<button class="search__pagenationItem js_pagenation_num" data-num="1">1</button>' +
3642          '<button class="search__pagenationItem js_pagenation_num" data-num="2">2</button>' +
3643          '<button class="search__pagenationItem search__pagenationItem--active" data-num="3">3</button>' +
3644          '<button class="search__pagenationItem js_pagenation_num" data-num="4">4</button>' +
3645          '<button class="search__pagenationItem js_pagenation_num" data-num="5">5</button>' +
3646          '<span class="search__pagenationOmit">...</span>' +
3647          '<button class="search__pagenationItem js_pagenation_num" data-num="' +
3648          max_page +
3649          '">' +
3650          max_page +
3651          "</button>" +
3652          '<button class="search__pagenationNext js_pagenation_next"><img src="https://happinessnet.co.jp/wp-content/themes/happinessnet/img/pagenation-next.svg" alt=""></button>';
3653      } else if (page == 4) {
3654        pagenation_html =
3655          '<button class="search__pagenationPrev js_pagenation_prev"><img src="https://happinessnet.co.jp/wp-content/themes/happinessnet/img/pagenation-prev.svg" alt=""></button>' +
3656          '<button class="search__pagenationItem js_pagenation_num" data-num="1">1</button>' +
3657          '<button class="search__pagenationItem js_pagenation_num" data-num="2">2</button>' +
3658          '<button class="search__pagenationItem js_pagenation_num" data-num="3">3</button>' +
3659          '<button class="search__pagenationItem search__pagenationItem--active" data-num="4">4</button>' +
3660          '<button class="search__pagenationItem js_pagenation_num" data-num="5">5</button>' +
3661          '<button class="search__pagenationItem js_pagenation_num" data-num="6">6</button>' +
3662          '<span class="search__pagenationOmit">...</span>' +
3663          '<button class="search__pagenationItem js_pagenation_num" data-num="' +
3664          max_page +
3665          '">' +
3666          max_page +
3667          "</button>" +
3668          '<button class="search__pagenationNext js_pagenation_next"><img src="https://happinessnet.co.jp/wp-content/themes/happinessnet/img/pagenation-next.svg" alt=""></button>';
3669      } else if (page == max_page - 3) {
3670        pagenation_html =
3671          '<button class="search__pagenationPrev js_pagenation_prev"><img src="https://happinessnet.co.jp/wp-content/themes/happinessnet/img/pagenation-prev.svg" alt=""></button>' +
3672          '<button class="search__pagenationItem js_pagenation_num" data-num="1">1</button>' +
3673          '<span class="search__pagenationOmit">...</span>' +
3674          '<button class="search__pagenationItem js_pagenation_num" data-num="' +
3675          max_page_5 +
3676          '">' +
3677          max_page_5 +
3678          "</button>" +
3679          '<button class="search__pagenationItem js_pagenation_num" data-num="' +
3680          max_page_4 +
3681          '">' +
3682          max_page_4 +
3683          "</button>" +
3684          '<button class="search__pagenationItem js_pagenation_num search__pagenationItem--active" data-num="' +
3685          max_page_3 +
3686          '">' +
3687          max_page_3 +
3688          "</button>" +
3689          '<button class="search__pagenationItem js_pagenation_num" data-num="' +
3690          max_page_2 +
3691          '">' +
3692          max_page_2 +
3693          "</button>" +
3694          '<button class="search__pagenationItem js_pagenation_num" data-num="' +
3695          max_page_1 +
3696          '">' +
3697          max_page_1 +
3698          "</button>" +
3699          '<button class="search__pagenationItem js_pagenation_num" data-num="' +
3700          max_page +
3701          '">' +
3702          max_page +
3703          "</button>" +
3704          '<button class="search__pagenationNext js_pagenation_next"><img src="https://happinessnet.co.jp/wp-content/themes/happinessnet/img/pagenation-next.svg" alt=""></button>';
3705      } else if (page == max_page - 2) {
3706        pagenation_html =
3707          '<button class="search__pagenationPrev js_pagenation_prev"><img src="https://happinessnet.co.jp/wp-content/themes/happinessnet/img/pagenation-
3707prev.svg" alt=""></button>' +
3708          '<button class="search__pagenationItem js_pagenation_num" data-num="1">1</button>' +
3709          '<span class="search__pagenationOmit">...</span>' +
3710          '<button class="search__pagenationItem js_pagenation_num" data-num="' +
3711          max_page_4 +
3712          '">' +
3713          max_page_4 +
3714          "</button>" +
3715          '<button class="search__pagenationItem js_pagenation_num" data-num="' +
3716          max_page_3 +
3717          '">' +
3718          max_page_3 +
3719          "</button>" +
3720          '<button class="search__pagenationItem search__pagenationItem--active" data-num="' +
3721          max_page_2 +
3722          '">' +
3723          max_page_2 +
3724          "</button>" +
3725          '<button class="search__pagenationItem js_pagenation_num" data-num="' +
3726          max_page_1 +
3727          '">' +
3728          max_page_1 +
3729          "</button>" +
3730          '<button class="search__pagenationItem js_pagenation_num" data-num="' +
3731          max_page +
3732          '">' +
3733          max_page +
3734          "</button>" +
3735          '<button class="search__pagenationNext js_pagenation_next"><img src="https://happinessnet.co.jp/wp-content/themes/happinessnet/img/pagenation-next.svg" alt=""></button>';
3736      } else if (page == max_page - 1) {
3737        pagenation_html =
3738          '<button class="search__pagenationPrev js_pagenation_prev"><img src="https://happinessnet.co.jp/wp-content/themes/happinessnet/img/pagenation-prev.svg" alt=""></button>' +
3739          '<button class="search__pagenationItem js_pagenation_num" data-num="1">1</button>' +
3740          '<span class="search__pagenationOmit">...</span>' +
3741          '<button class="search__pagenationItem js_pagenation_num" data-num="' +
3742          max_page_3 +
3743          '">' +
3744          max_page_3 +
3745          "</button>" +
3746          '<button class="search__pagenationItem js_pagenation_num" data-num="' +
3747          max_page_2 +
3748          '">' +
3749          max_page_2 +
3750          "</button>" +
3751          '<button class="search__pagenationItem search__pagenationItem--active" data-num="' +
3752          max_page_1 +
3753          '">' +
3754          max_page_1 +
3755          "</button>" +
3756          '<button class="search__pagenationItem js_pagenation_num" data-num="' +
3757          max_page +
3758          '">' +
3759          max_page +
3760          "</button>" +
3761          '<button class="search__pagenationNext js_pagenation_next"><img src="https://happinessnet.co.jp/wp-content/themes/happinessnet/img/pagenation-next.svg" alt=""></button>';
3762      } else if (page == max_page) {
3763        pagenation_html =
3764          '<button class="search__pagenationPrev js_pagenation_prev"><img src="https://happinessnet.co.jp/wp-content/themes/happinessnet/img/pagenation-prev.svg" alt=""></button>' +
3765          '<button class="search__pagenationItem js_pagenation_num" data-num="1">1</button>' +
3766          '<span class="search__pagenationOmit">...</span>' +
3767          '<button class="search__pagenationItem js_pagenation_num" data-num="' +
3768          max_page_2 +
3769          '">' +
3770          max_page_2 +
3771          "</button>" +
3772          '<button class="search__pagenationItem js_pagenation_num" data-num="' +
3773          max_page_1 +
3774          '">' +
3775          max_page_1 +
3776          "</button>" +
3777          '<button class="search__pagenationItem search__pagenationItem--active" data-num="' +
3778          max_page +
3779          '">' +
3780          max_page +
3781          "</button>";
3782      } else {
3783        pagenation_html =
3784          '<button class="search__pagenationPrev js_pagenation_prev"><img src="https://happinessnet.co.jp/wp-content/themes/happinessnet/img/pagenation-prev.svg" alt=""></button>' +
3785          '<button class="search__pagenationItem js_pagenation_num" data-num="1">1</button>' +
3786          '<span class="search__pagenationOmit">...</span>' +
3787          '<button class="search__pagenationItem js_pagenation_num" data-num="' +
3788          page_2 +
3789          '">' +
3790          page_2 +
3791          "</button>" +
3792          '<button class="search__pagenationItem js_pagenation_num" data-num="' +
3793          page_1 +
3794          '">' +
3795          page_1 +
3796          "</button>" +
3797          '<button class="search__pagenationItem search__pagenationItem--active" data-num="' +
3798          page +
3799          '">' +
3800          page +
3801          "</button>" +
3802          '<button class="search__pagenationItem js_pagenation_num" data-num="' +
3803          page__1 +
3804          '">' +
3805          page__1 +
3806          "</button>" +
3807          '<button class="search__pagenationItem js_pagenation_num" data-num="' +
3808          page__2 +
3809          '">' +
3810          page__2 +
3811          "</button>" +
3812          '<span class="search__pagenationOmit">...</span>' +
3813          '<button class="search__pagenationItem js_pagenation_num" data-num="' +
3814          max_page +
3815          '">' +
3816          max_page +
3817          "</button>" +
3818          '<button class="search__pagenationNext js_pagenation_next"><img src="https://happinessnet.co.jp/wp-content/themes/happinessnet/img/pagenation-next.svg" alt=""></button>';
3819      }
3820
3821      $(".js_pagenation").html(pagenation_html);
3822    }
3823
3824    function pagenation_scroll() {
3825      const position = $(".js_search").offset().top - 100;
3826      $("html,body").animate(
3827        {
3828          scrollTop: position,
3829        },
3830        {
3831          queue: false,
3832        }
3833      );
3834    }
3835
3836    $(".js_pagenation").on("click", function () {
3837      pagenation_scroll();
3838    });
3839
3840    $(document).on("click", ".js_pagenation_num", function () {
3841      const pagenation_num = this.dataset.num;
3842      page = pagenation_num;
3843      window.localStorage.setItem("page_num", page);
3844      pagenation(pagenation_num);
3845      show_products(pagenation_num);
3846    });
3847
3848    $(document).on("click", ".js_pagenation_prev", function () {
3849      page--;
3850      window.localStorage.setItem("page_num", page);
3851      pagenation(page);
3852      show_products(page);
3853    });
3854
3855    $(document).on("click", ".js_pagenation_next", function () {
3856      page++;
3857      window.localStorage.setItem("page_num", page);
3858      pagenation(page);
3859      show_products(page);
3860    });
3861
3862    let param = location.search;
3863    if (param.match(/key/)) {
3864      let model_id = param.slice(-7);
3865    }
3866
3867    function get_model_products(id) {
3868      let original_data = data;
3869      const model_id = id;
3870
3871      organized_data = original_data.filter((value) => {
3872        if (value.group_ids.find((v) => v == model_id)) {
3873          return true;
3874        }
3875      });
3876
3877      show_products(1);
3878    }
3879
3880    function get_product(id) {
3881      const result = test_data.filter((u) => u.id === id);
3882      if (result) {
3883        return result;
3884      } else {
3885      }
3886    }
3887
3888    function set_product(array) {
3889      const detail_name = array[0]["name"];
3890      const detail_imei = array[0]["model_number"];
3891      const detail_price = array[0]["sales_price"];
3892      const detail_group_ids = array[0]["group_ids"];
3893      const detail_img_url = array[0]["image_url"];
3894      const detail_thumb = array[0]["thumbnail_image_url"];
3895      const detail_images = array[0]["images"];
3896      let images = "";
3897      for (let i = 0; i < detail_images.length; i++) {
3898        images +=
3899          '<img src="' +
3900          detail_images[i]["src"] +
3901          '" alt="" class="products__img">';
3902      }
3903
3904      $(".js_product_name").html(detail_name);
3905      $(".js_product_price").html(detail_price.toLocaleString());
3906    }
3907
3908    // トップページ ハピネスネットのおすすめ機種
3909    if ($(".js_top_recommended").length) {
3910      //iPhone11以降のデータ
3911      const recommended_data = original_data.filter((value) => {
3912        if (
3913          value.group_ids.find(
3914            (v) =>
3915              v == 3066675 ||
3916              v == 3066674 ||
3917              v == 3020634 ||
3918              v == 3020633 ||
3919              v == 2803017 ||
3920              v == 2717119 ||
3921              v == 2717117 ||
3922              v == 2596580 ||
3923              v == 2596578
3924          )
3925        ) {
3926          return true;
3927        }
3928      });
3929
3930      let recommended_data_html = "";
3931
3932      let recommended_data_num = recommended_data.length;
3933      let recommended_data_max_num = 10;
3934      if (recommended_data_num < 10) {
3935        recommended_data_max_num = recommended_data_num;
3936      }
3937      for (let i = 0; i < recommended_data_max_num; i++) {
3938        recommended_data_html +=
3939          '<div class="products__newItem">\n' +
3940          '<a href="https://happinessnet.co.jp/detail?id=' +
3941          recommended_data[i]["id"] +
3942          '" class="products__newInner">\n' +
3943          '<div class="product__imgArea">\n' +
3944          '<img src="' +
3945          recommended_data[i]["thumbnail_image_url"] +
3946          '" alt="" class="product__img">\n' +
3947          '<span class="product__point">' +
3948          get_rank(recommended_data[i]["group_ids"]) +
3949          "</span>\n" +
3950          "</div>\n" +
3951          '<p class="product__title product__title--clamp">' +
3952          recommended_data[i]["name"] +
3953          "</p>\n" +
3954          '<p class="product__battery">バッテリー:' +
3955          get_battery(recommended_data[i]["group_ids"]) +
3956          "</p>\n" +
3957          '<p class="product__price product__price--red">Â¥' +
3958          recommended_data[i]["sales_price"].toLocaleString() +
3959          "(税込)</p>\n" +
3960          '<p class="product__note">明日中にお届け</p>\n' +
3961          '<div class="product__linkArea"><p class="product__link">商品を見る</p><span class="product__linkArrow"></span></div>\n' +
3962          "</a>\n" +
3963          "</div>\n";
3964      }
3965
3966      $(".js_top_recommended").html(recommended_data_html);
3967
3968      // トップページ ハピネスネットのおすすめ機種 スライダー
3969      $(".js_top_recommended_slider").slick({
3970        autoplay: true,
3971        arrows: true,
3972        infinite: true,
3973        slidesToShow: 4,
3974        responsive: [
3975          {
3976            breakpoint: 768,
3977            settings: {
3978              slidesToShow: 1,
3979            },
3980          },
3981        ],
3982      });
3983    }
3984  });
3985});

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.