PageSourceSearch

https://osanghc.com/js/mChat.js

js osanghc.com collected 2026-10-04 15:03:10 UTC 64,324 bytes, 1,682 lines download raw bytes

1var chat_name;
2var chat_style;
3var chat_cnt = 0;
4var chat_color;
5var chat_img;
6let urlPath = location.pathname;
7
8var device;
9$(document).ready(function () {
10  /* ======================================================================
11    *
12    *  COMMON
13    *
14    ====================================================================== */
15  // 디바이스 구분
16  const isMobile =
17    /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(
18      navigator.userAgent
19    )
20      ? true
21      : false;
22
23  if (!isMobile) {
24    //모바일이 아닌 경우 스크립트
25    device = "pc";
26  } else {
27    //모바일인 경우 스크립트
28    device = "mo";
29  }
30
31  // Get today's date
32  function getDate() {
33    const today = new Date();
34    const year = today.getFullYear();
35    const month = ("0" + (1 + today.getMonth())).slice(-2);
36    const day = ("0" + today.getDate()).slice(-2);
37    const hours = today.getHours() % 12 ? today.getHours() % 12 : 12;
38    const minutes =
39      today.getMinutes() < 10 ? "0" + today.getMinutes() : today.getMinutes();
40    const ampm = today.getHours() >= 12 ? "PM" : "AM";
41    const date = `${year}.${month}.${day} ${hours}:${minutes} ${ampm}`;
42
43    return date;
44  }
45
46  setTimeout(function () {
47    $(".notice_yn").fadeOut();
48  }, 3000);
49
50  //챗봇설정
51  function chat_master() {
52    $(".mchat_hard").addClass("dn");
53    $(".goBack").addClass("dn");
54
55    $.ajax({
56      url: "/getChatMaster",
57      type: "get",
58      success: function (data) {
59        if (!(urlPath.indexOf("/en") > -1)) {
60          chat_name = data.name; //챗봇명 국문
61        } else {
62          chat_name = data.name_en; //챗봇명 영문
63        }
64        chat_style = data.style; //챗봇형식
65        chat_color = data.point_color; //포인트컬러
66        text = data.text;
67        chat_img = data.floating_btn;
68        $("#mChat .tit").text(chat_name); //챗봇명
69        chat_contents(chat_style);
70        //챗봇 안내메세지
71        if (data.notice_yn == "Y") {
72          if (!(urlPath.indexOf("/en") > -1)) {
73            $(".quick_message").text(data.notice_content); //안내메세지 국문
74          } else {
75            $(".quick_message").text(data.notice_content_en); //안내매세지 영문
76          }
77        } else {
78          $(".notice_yn").css("display", "none");
79        }
80
81        //노출여부
82        if (device == "mo" && data.mo_yn1 == "N") {
83          $(".quick_btn").css("display", "none");
84          $(".notice_yn").css("display", "none");
85        }
86        if (device == "pc" && data.pc_yn1 == "N") {
87          $(".quick_btn").css("display", "none");
88          $(".notice_yn").css("display", "none");
89        }
90
91        let floating_btn = data.floating_btn;
92        if (floating_btn == "") {
93          floating_btn = "/img/front/mChat/chat_icon.png";
94          chat_img = "/img/front/mChat/chat_icon.png";
95        }
96
97        $("#quick_btn").attr("src", floating_btn);
98        $("#quick_btn_head").attr("src", floating_btn);
99        $(".mchat_inner").css("background", "#f2f8ff"); //배경 그라데이션
100        // $(".mchat_inner").css('background', 'linear-gradient(to bottom right,' + data.bg_color1 + "E6" + ',' + data.bg_color2 + "E6" + ')');//배경 그라데이션
101        if (data.style == "banner") {
102          //배너형식
103          $(".mChat").addClass("banner"); //배너형식 추가
104          $(".greeting").text(repWord(data.text)); //인사말
105          $(".mchat_skin--standard").remove();
106        } else {
107          //기본형식
108          $("#master_text").text(repWord(data.text)); //인사말
109          $("#master_name").text(chat_name); //챗봇명
110          $(".mchat_skin--banner, .banner_menu, .mchat_skin--sub").remove();
111        }
112      },
113    });
114  }
115
116  //최상위 키워드
117  function chat_contents(chat_style) {
118    var lang = "";
119    if (!(urlPath.indexOf("/en") > -1)) {
120      lang = "kor";
121    } else {
122      lang = "eng";
123    }
124
125    $.ajax({
126      url: "/getChatContents",
127      data: {
128        par: 0,
129        banner: chat_style,
130        lang: lang,
131      },
132      type: "get",
133      success: function (data) {
134        if (chat_style == "basic") {
135          //기본형식일때
136          data.forEach(function (e) {
137            let link_arrow = "";
138            if (
139              e.link.replace("|", "") != "" &&
140              e.link.replace("|", "") != null &&
141              e.link.replace("|", "") != "undefined" &&
142              e.link.indexOf("|") == -1
143            ) {
144              link_arrow =
145                '<img src="/img/front/mChat/link_arrow.png" alt="링크버튼">';
146            } else {
147              link_arrow = "";
148            }
149
150            $(".select_list").append(
151              '<li class="select_item select_item' +
152                e.idx +
153                '"> ' +
154                '<button type="button" class="select_btn" name="select_btn"' +
155                'onclick="contScrollDown(' +
156                chat_cnt +
157                "); getCate(" +
158                e.idx +
159                ",'" +
160                e.nm.replace(/&#039;/g, "`") +
161                "','" +
162                e.view_type +
163                "','" +
164                e.guide_text.replace(/&#039;/g, "`") +
165                "','" +
166                e.content.replace(/&#039;/g, "`") +
167                "'," +
168                e.cnt +
169                ",'" +
170                e.link +
171                "','" +
172                e.attach_file +
173                "','" +
174                e.attach_file_ori +
175                "','" +
176                e.page_type +
177                "', '" +
178                e.view_type_sub +
179                "')\">" +
180                e.nm.replace(/&#039;/g, "`") +
181                link_arrow +
182                "</button> </li>"
183            );
184          });
185        } else {
186          //배너형식일때
187          var cnt = 1;
188          data.forEach(function (e) {
189            $(".banner_box").append(
190              '<div id="banner' +
191                cnt +
192                '" onclick="getBanner(\'' +
193                e.nm.replace(/&#039;/g, "`") +
194                "','" +
195                e.content.replace(/&#039;/g, "`") +
196                "'," +
197                e.idx +
198                ",'" +
199                e.guide_text.replace(/&#039;/g, "`") +
200                "','" +
201                cnt +
202                "','" +
203                e.attach_file +
204                "','" +
205                e.link +
206                "','" +
207                e.page_type +
208                '\')" class="banner_item">' +
209                '                       <div class="item_inner">' +
210                '                           <div class="item_info">' +
211                '                               <div class="item_name">' +
212                // e.nm.replace(/&#039;/g, "`") +
213                "</div>" +
214                '                                <div class="item_desc">' +
215                e.content.replace(/&#039;/g, "`") +
216                "</div>" +
217                "                            </div>" +
218                "                        </div>" +
219                "                    </div>"
220            );
221            if (
222              e.attach_file != "" &&
223              e.attach_file != null &&
224              e.attach_file != "undefined"
225            ) {
226              // 기능개발 전 임시 작업
227              // $("#banner" + cnt).css("background-image", `url(/img/front/mChat/banner_img0${cnt}.svg)`);
228              $("#banner" + cnt).css(
229                "background-image",
230                "url(" + repWord(e.attach_file) + ")"
231              );
232            }
233
234            $(".banner_menu_wrap").append(
235              '<li class="link_item">' +
236                "<a onclick=\"getBanner('" +
237                e.nm.replace(/&#039;/g, "`") +
238                "','" +
239                e.content.replace(/&#039;/g, "`") +
240                "'," +
241                e.idx +
242                ",'" +
243                e.guide_text.replace(/&#039;/g, "`") +
244                "','" +
245                cnt +
246                "','" +
247                e.attach_file +
248                "','" +
249                e.link +
250                "','" +
251                e.page_type +
252                "')\">" +
253                e.nm.replace(/&#039;/g, "`") +
254                "</a>" +
255                "</li>"
256            );
257
258            cnt++;
259          });
260        }
261        // console.log("load end")
262        // select btn active
263        //select_list();
264      },
265    }).then(() => {
266      $(".mchat_hard").removeClass("dn");
267    });
268  }
269  chat_master();
270
271  // When the chatbot button is clicked
272  $(".quick_btn").click(function () {
273    $(".now").text(getDate());
274    if ($(".mchat_cont").hasClass("on")) {
275      $(".mchat_cont").removeClass("on");
276    } else {
277      $(".mchat_cont").addClass("on");
278    }
279  });
280
281  // back to home
282  $(".home").click(function () {
283    $(".hard_chat").removeClass("active");
284    if (chat_style == "basic") {
285      $(".mChat").removeClass("banner sub");
286      $(".select_list").empty();
287    } else {
288      $(".mChat").removeClass("sub");
289      $(".banner_target").empty();
290      $(".banner_box").empty();
291      $(".banner_menu_wrap").empty();
292    }
293    $(".basic_target").empty();
294    chat_master();
295    // 문의 영역 하드코딩 리셋
296    resetHardChat();
297  });
298
299  // 뒤로가기
300  document.addEventListener("click", (e) => {
301    const goHomeBtn = e.target.closest(".goHome");
302    if (goHomeBtn) {
303      e.stopPropagation();
304      document.querySelector(".home")?.click();
305    }
306  });
307  // select btn active
308  function select_list() {
309    $(".select_list").each(function () {
310      const _this = $(this);
311      const item = $(this).find(".select_item");
312
313      item.click(function () {
314        _this.find(".select_btn").removeClass("selected");
315        $(this).find(".select_btn").addClass("selected");
316      });
317    });
318    $(".banner_item").click(function () {
319      $(".mChat").addClass("sub");
320    });
321  }
322
323  // banner_menu function
324  $(".banner_menu_button").click(function () {
325    const bannerMn = $(".banner_menu");
326    const bannerWrap = $(".banner_menu_wrap").height();
327    const bn_H = 34 + bannerWrap;
328
329    if ($(".banner_menu").hasClass("on")) {
330      $(".banner_menu").removeClass("on");
331      bannerMn.height(0);
332    } else {
333      $(".banner_menu").addClass("on");
334      bannerMn.height(bn_H);
335    }
336  });
337
338  /* ======================================================================
339    *
340    *  FRONT
341    *
342    ====================================================================== */
343
344  if ($(".front").length > 0) {
345    // Close when clicking other areas
346    $(document).mouseup(function (e) {
347      var LayerPopup = $(".mchat_cont");
348      if (LayerPopup.has(e.target).length === 0) {
349        LayerPopup.removeClass("on");
350      }
351
352      var bannerMenu = $(".banner_menu");
353      if (bannerMenu.has(e.target).length === 0) {
354        bannerMenu.removeClass("on");
355      }
356    });
357
358    // When the close button is clicked
359    $(".quit").click(function () {
360      $(".mchat_cont").removeClass("on");
361    });
362  }
363
364  /* ======================================================================
365    *
366    *  ADMIN
367    *
368    ====================================================================== */
369
370  if ($(".admin_layout").length > 0) {
371    // guide popup
372    $(".guide_wrap button").click(function () {
373      $(this).siblings(".guide_popup").addClass("on");
374    });
375
376    // Close when clicking other areas
377    $(document).mouseup(function (e) {
378      const guidePopup = $(".guide_popup");
379      if (guidePopup.has(e.target).length === 0) {
380        guidePopup.removeClass("on");
381      }
382    });
383
384    // drag & drop
385    $("#sortable")
386      .sortable({
387        cursor: "move",
388        items: $(".dep1_list"),
389        handle: ".sort_handle",
390      })
391      .disableSelection();
392
393    // when depth1 arrow clicked
394    $(".open_sub_btn").click(function () {
395      if ($(this).parents(".dep1_tit").hasClass("on")) {
396        $(this)
397          .parents(".dep1_tit")
398          .removeClass("on")
399          .siblings(".dep2_wrap")
400          .slideUp();
401      } else {
402        $(this)
403          .parents(".dep1_tit")
404          .addClass("on")
405          .siblings(".dep2_wrap")
406          .slideDown();
407      }
408    });
409
410    // checkbox all check
411    $(".chkbox").click(function () {});
412
413    const $chkAll = $("#chkAll");
414    $chkAll.change(function () {
415      const $this = $(this);
416      const checked = $this.prop("checked");
417
418      $('.tab_cont_bx input[name="chk_keyword"]').prop("checked", checked);
419    });
420
421    $(".tab_cont_bx").each(function () {
422      const boxes = $('.tab_cont_bx input[name="chk_keyword"]');
423      boxes.change(function () {
424        const boxLength = boxes.length;
425        const checkedLength = $(
426          '.tab_cont_bx input[name="chk_keyword"]:checked'
427        ).length;
428        const selectAll = boxLength == checkedLength;
429
430        $chkAll.prop("checked", selectAll);
431
432        const AllChecked = $(".tab_cont_bx input[name=chk_keyword]").length;
433        let checkedCnt = $(
434          ".tab_cont_bx input[name=chk_keyword]:checked"
435        ).length;
436
437        if (AllChecked == checkedCnt) {
438          $("#chkAll").prop("checked", true);
439        }
440      });
441    });
442  }
443});
444/* ======================================================================
445*
446*  basic
447*
448====================================================================== */
449
450// 키워드 클릭 시 스크롤 이동
451function contScrollDown(num) {
452  var target = "bubble_customer";
453
454  setTimeout(function () {
455    $("." + target)
456      .last()
457      .get(0)
458      .scrollIntoView({ block: "start", behavior: "smooth" });
459  }, 300);
460}
461
462// 바로답변 이미지
463function linkItem() {
464  $(".link_item").each(function () {
465    const _this = $(this);
466
467    if ($(this).find(".item_info").length > 0) {
468      $(this).find(".item_img").addClass("bdrs_on");
469    }
470  });
471}
472
473//챗봇키워드
474function getCate(
475  par,
476  nm,
477  view_type,
478  guide_text,
479  content,
480  cnt,
481  link,
482  attach_file,
483  attach_file_ori,
484  page_type,
485  view_type_sub
486) {
487  //챗봇통계 년도/월/일로 구분
488  $.ajax({
489    url: "/chatStat",
490    data: {
491      idx: par,
492      device: device,
493    },
494    type: "get",
495    success: function (data) {},
496  });
497
498  if (view_type == "Y_coment") {
499    var content_arr = nullChk(content).split("|");
500    var link_arr = nullChk(link).split("|");
501    var attach_file_arr = nullChk(attach_file).split("|");
502    var page_arr = nullChk(page_type).split("|");
503    var currentPage = isEnPage() ? "en" : "ko";
504
505    if (link_arr != "" && link_arr != null && link_arr != "undefined") {
506      YComent_Ncnt(
507        nm,
508        guide_text,
509        content,
510        cnt,
511        link,
512        attach_file,
513        page_type,
514        currentPage
515      );
516    } else {
517      YComent_Ycnt(par, nm, view_type, guide_text);
518    }
519  } else {
520    if (view_type_sub == "link") {
521      NComent_Ncnt(content, link, page_type);
522    } else {
523      NComent_Ycnt(par, nm, view_type, guide_text);
524    }
525  }
526
527  fontColor(chat_color);
528}
529
530function select_list() {
531  $(".select_list").each(function () {
532    const _this = $(this);
533    const item = $(this).find(".select_item");
534
535    item.click(function () {
536      _this.find(".select_btn").removeClass("selected");
537      $(this).find(".select_btn").addClass("selected");
538    });
539  });
540}
541
542const bubbleSwiper = undefined;
543const swiperOptions = {
544  slidesPerView: "auto",
545  loop: false,
546  draggable: true,
547  allowTouchMove: true,
548};
549
550function YComent_Ncnt(
551  nm,
552  guide_text,
553  content,
554  cnt,
555  link,
556  attach_file,
557  page_type,
558  currentPage
559) {
560  //하위dep가 없고 바로답변일때
561  var content_arr = nullChk(content).split("|");
562  var link_arr = nullChk(link).split("|");
563  var attach_file_arr = nullChk(attach_file).split("&&&");
564  var page_arr = nullChk(page_type).split("|");
565
566  html = '<div id="ddd" class="bubble bubble_customer">';
567  html += '<div class="bubble_box">' + nm + "</div>";
568  html += "</div>";
569
570  html += '<div class="bubble bubble_admin">';
571  html += '<div class="bubble_top_box">';
572  html += '<div class="bubble_status_icon">';
573  html += "<img src=" + chat_img + ">";
574  html += "</div>";
575  html += '<div class="bubble_status_box">';
576  html += '<span class="status">' + chat_name + "</span>";
577  html += '<span class="status_now en_font">' + getNow() + "</span>";
578
579  html += "</div>";
580  html += "</div>";
581
582  html +=
583    '   <div class="bubble_box bubble_box--link bubble_slider swiper-container home_button_box">';
584  html += '       <div class="swiper-wrapper">';
585  for (var i = 0; i < content_arr.length - 1; i++) {
586    html += '           <div class="link_item carousel_item swiper-slide">';
587    html += '<div class="link_answer">' + content_arr[i] + "</div>";
588    html +=
589      '               <a href="' +
590      link_arr[i] +
591      '"  target="' +
592      page_arr[i] +
593      '"  class="item_inner">';
594    if (attach_file_arr[i] != "") {
595      html +=
596        '                   <div class="item_img"><img src="' +
597        attach_file_arr[i] +
598        '" alt="프로젝트 이미지"> </div>';
599    }
600    if (link_arr[i] != "") {
601      html += '                   <div class="item_info">';
602      if (currentPage == "ko") {
603        html += '                       <div class="item_name">바로가기</div>';
604      } else {
605        html += '                       <div class="item_name">Visit Now</div>';
606      }
607      html += '                       <div class="item_arrow"></div>';
608      html += "                  </div>";
609    }
610    html += "               </a>";
611    html += "           </div>";
612  }
613  html += "     </div>";
614
615  html += '<a href="javascript:void(0);" class="goHome">';
616  if (currentPage == "ko") {
617    html +=
618      '<svg width="12.25" height="12.25" viewBox="0 0 25 25" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M10.99 2.638a2.344 2.344 0 0 1 3.02 0l7.032 5.93c.528.445.833 1.1.833 1.791v9.698a1.823 1.823 0 0 1-1.823 1.823h-3.646a1.823 1.823 0 0 1-1.823-1.823V14.84a.26.26 0 0 0-.26-.26h-3.646a.26.26 0 0 0-.26.26v5.216a1.823 1.823 0 0 1-1.823 1.823H4.948a1.823 1.823 0 0 1-1.823-1.823v-9.698c0-.69.305-1.346.833-1.792l7.031-5.93zm2.014 1.194a.781.781 0 0 0-1.008 0l-7.03 5.93a.781.781 0 0 0-.279.597v9.698c0 .144.117.26.26.26h3.647a.26.26 0 0 0 .26-.26V14.84c0-1.007.816-1.823 1.823-1.823h3.646c1.007 0 1.823.816 1.823 1.823v5.216c0 .144.116.26.26.26h3.646a.26.26 0 0 0 .26-.26v-9.698a.781.781 0 0 0-.277-.597l-7.031-5.93z" fill="#0063EF"/></svg> 첫 화면으로 돌아가기';
619  } else {
620    html +=
621      '<svg width="12.25" height="12.25" viewBox="0 0 25 25" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M10.99 2.638a2.344 2.344 0 0 1 3.02 0l7.032 5.93c.528.445.833 1.1.833 1.791v9.698a1.823 1.823 0 0 1-1.823 1.823h-3.646a1.823 1.823 0 0 1-1.823-1.823V14.84a.26.26 0 0 0-.26-.26h-3.646a.26.26 0 0 0-.26.26v5.216a1.823 1.823 0 0 1-1.823 1.823H4.948a1.823 1.823 0 0 1-1.823-1.823v-9.698c0-.69.305-1.346.833-1.792l7.031-5.93zm2.014 1.194a.781.781 0 0 0-1.008 0l-7.03 5.93a.781.781 0 0 0-.279.597v9.698c0 .144.117.26.26.26h3.647a.26.26 0 0 0 .26-.26V14.84c0-1.007.816-1.823 1.823-1.823h3.646c1.007 0 1.823.816 1.823 1.823v5.216c0 .144.116.26.26.26h3.646a.26.26 0 0 0 .26-.26v-9.698a.781.781 0 0 0-.277-.597l-7.031-5.93z" fill="#0063EF"/></svg> Back To Home';
622  }
623  html += "     </a>";
624  html += "   </div>";
625  html += "</div>";
626
627  if (chat_style == "basic") {
628    $(".basic_target").append(html);
629    html = "";
630  } else {
631    $(".banner_box").append(html);
632    html = "";
633  }
634
635  linkItem();
636  bubbleSlider();
637}
638
639function bubbleSlider() {
640  const bubbleSwiper = new Swiper(".bubble_slider", swiperOptions);
641}
642
643function NComent_Ncnt(content, link, page_type) {
644  //하위dep가 없고 내용없음일때
645  if (link != null && link != "") {
646    //링크 띄워주고 끝
647    window.open(link, page_type);
648  }
649}
650
651function YComent_Ycnt(par, nm, view_type, guide_text) {
652  //하위dep가 있고 바로답변일때
653  html = '<div id="ddd" class="bubble bubble_customer">';
654  html += '<div class="bubble_box chat_move_' + chat_cnt + '">' + nm + "</div>";
655  html += "</div>";
656
657  html += '<div class="bubble bubble_admin">';
658
659  html += '<div class="bubble_top_box">';
660  html += '<div class="bubble_status_icon">';
661  html += "<img src=" + chat_img + ">";
662  html += "</div>";
663  html += '<div class="bubble_status_box">';
664  html += '<span class="status">' + chat_name + "</span>";
665  html += '<span class="status_now en_font">' + getNow() + "</span>";
666
667  html += "</div>";
668  html += "</div>";
669
670  if (chat_style == "basic") {
671    $(".basic_target").append(html);
672    html = "";
673  } else {
674    $(".banner_box").append(html);
675    html = "";
676  }
677
678  var chat_move = "chat_move_" + chat_cnt;
679  setTimeout(function () {}, 300);
680  chat_cnt++;
681
682  var lang = "";
683  if (!(urlPath.indexOf("/en") > -1)) {
684    lang = "kor";
685  } else {
686    lang = "eng";
687  }
688
689  $.ajax({
690    url: "/getChatContents",
691    data: {
692      par: par,
693      banner: "basic",
694      lang: lang,
695    },
696    type: "get",
697    success: function (data) {
698      html2 = '<div class="bubble bubble_select">';
699      html2 += '<ul class="select_list">';
700
701      data.forEach(function (e) {
702        let link_arrow = "";
703        if (
704          e.link.replace("|", "") != "" &&
705          e.link.replace("|", "") != null &&
706          e.link.replace("|", "") != "undefined" &&
707          e.link.indexOf("|") == -1
708        ) {
709          link_arrow =
710            '<img src="/img/front/mChat/link_arrow.png" alt="링크버튼">';
711        } else {
712          link_arrow = "";
713        }
714
715        html2 += '<li class="select_item select_item' + e.idx + '">';
716        html2 += '<button type="button" class="select_btn"';
717        html2 +=
718          'onclick="contScrollDown(' +
719          chat_cnt +
720          ");  getCate(" +
721          e.idx +
722          ",'" +
723          e.nm.replace(/&#039;/g, "`") +
724          "','" +
725          e.view_type +
726          "','" +
727          e.guide_text.replace(/&#039;/g, "`") +
728          "','" +
729          e.content.replace(/&#039;/g, "`") +
730          "'," +
731          e.cnt +
732          ",'" +
733          e.link +
734          "','" +
735          e.attach_file +
736          "','" +
737          e.attach_file_ori +
738          "','" +
739          e.page_type +
740          "', '" +
741          e.view_type_sub +
742          "')\" >" +
743          e.nm.replace(/&#039;/g, "`") +
744          link_arrow +
745          "</button> </li>";
746      });
747      html2 += "</ul>";
748
749      if (chat_style == "basic") {
750        $(".basic_target").append(html2);
751        html2 = "";
752      } else {
753        $(".banner_box").append(html2);
754        html2 = "";
755      }
756      linkItem();
757      // select btn active
758      select_list();
759    },
760  });
761}
762
763function NComent_Ycnt(par, nm, view_type, guide_text) {
764  //하위dep가 있고 내용없음일때
765  html = '<div id="ddd" class="bubble bubble_customer">';
766  html += '<span class="status_now en_font">' + getNow() + "</span>";
767  html += '<div class="bubble_box chat_move_' + chat_cnt + '">' + nm + "</div>";
768  html += "</div>";
769
770  html += '<div class="bubble bubble_admin">';
771
772  html += '<div class="bubble_top_box">';
773  html += '<div class="bubble_status_icon">';
774  html += "<img src=" + chat_img + ">";
775  html += "</div>";
776  html += '<div class="bubble_status_box">';
777  html += '<span class="status">' + chat_name + "</span>";
778  html += '<span class="status_now en_font">' + getNow() + "</span>";
779
780  html += "</div>";
781  html += "</div>";
782
783  html += '<div class="bubble_box bubble_box--admin 1">' + guide_text;
784  html += "</div></div>";
785
786  if (chat_style == "basic") {
787    $(".basic_target").append(html);
788    html = "";
789  } else {
790    $(".banner_box").append(html);
791    html = "";
792  }
793
794  var chat_move = "chat_move_" + chat_cnt;
795  setTimeout(function () {}, 300);
796  chat_cnt++;
797
798  var lang = "";
799  if (!(urlPath.indexOf("/en") > -1)) {
800    lang = "kor";
801  } else {
802    lang = "eng";
803  }
804
805  $.ajax({
806    url: "/getChatContents",
807    data: {
808      par: par,
809      banner: "basic",
810      lang: lang,
811    },
812    type: "get",
813    success: function (data) {
814      html2 = '<div class="bubble bubble_select">';
815      html2 += '<ul class="select_list">';
816
817      data.forEach(function (e) {
818        let link_arrow = "";
819        if (
820          e.link.replace("|", "") != "" &&
821          e.link.replace("|", "") != null &&
822          e.link.replace("|", "") != "undefined" &&
823          e.link.indexOf("|") == -1
824        ) {
825        } else {
826          link_arrow = "";
827        }
828
829        html2 += '<li class="select_item select_item' + e.idx + '">';
830        html2 += '<button type="button" class="select_btn"';
831        html2 +=
832          'onclick="contScrollDown(' +
833          chat_cnt +
834          ");  getCate(" +
835          e.idx +
836          ",'" +
837          e.nm.replace(/&#039;/g, "`") +
838          "','" +
839          e.view_type +
840          "','" +
841          e.guide_text.replace(/&#039;/g, "`") +
842          "','" +
843          e.content.replace(/&#039;/g, "`") +
844          "'," +
845          e.cnt +
846          ",'" +
847          e.link +
848          "','" +
849          e.attach_file +
850          "','" +
851          e.attach_file_ori +
852          "','" +
853          e.page_type +
854          "', '" +
855          e.view_type_sub +
856          "')\" >" +
857          e.nm.replace(/&#039;/g, "`") +
858          link_arrow +
859          "</button> </li>";
860      });
861      html2 += "</ul>";
862      if (chat_style == "basic") {
863        $(".basic_target").append(html2);
864        html2 = "";
865      } else {
866        $(".banner_box").append(html2);
867
868        html2 = "";
869      }
870      select_list();
871    },
872  });
873}
874function isDark(color) {
875  var match = /rgb\((\d+).*?(\d+).*?(\d+)\)/.exec(color);
876  return (match[1] & 255) + (match[2] & 255) + (match[3] & 255) < (3 * 256) / 2;
877}
878function fontColor(chat_color) {
879  $(".bubble_customer .bubble_box").each(function () {
880    $(this).css("background-color", chat_color);
881    const bgc = $(this).css("background-color");
882
883    $(this).css("color", isDark(bgc) ? "white" : "black");
884  });
885}
886
887/* ======================================================================
888*
889*  banner
890*
891====================================================================== */
892// Get today's date
893function getDate() {
894  const weeks = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"];
895  const today = new Date();
896  const year = today.getFullYear();
897  const month = ("0" + (1 + today.getMonth())).slice(-2);
898  const day = ("0" + today.getDate()).slice(-2);
899  const hours = today.getHours() % 12 ? today.getHours() % 12 : 12;
900  const minutes =
901    today.getMinutes() < 10 ? "0" + today.getMinutes() : today.getMinutes();
902  const ampm = today.getHours() >= 12 ? "PM" : "AM";
903  const date = `${year}.${month}.${day} ${hours}:${minutes} ${ampm}`;
904  const dayOfWeeks = today.getDay();
905
906  return date;
907}
908function getNow() {
909  const weeks = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"];
910  const today = new Date();
911  const dayOfWeeks = today.getDay();
912  const hours = today.getHours() % 12 ? today.getHours() % 12 : 12;
913  const minutes =
914    today.getMinutes() < 10 ? "0" + today.getMinutes() : today.getMinutes();
915  const ampm = today.getHours() >= 12 ? "PM" : "AM";
916  const now = `${weeks[dayOfWeeks]} ${hours}:${minutes} ${ampm}`;
917
918  return now;
919}
920
921function getBanner(
922  nm,
923  content,
924  par,
925  guide_text,
926  cnt,
927  attach_file,
928  link,
929  page_type
930) {
931  if (link != "" && link != null && link != "undefined") {
932    window.open(link, page_type);
933  } else {
934    //banner_box
935    $(".goBack").removeClass("dn");
936    $(".mchat_hard").addClass("dn");
937    $(".banner_box").empty().addClass("open_bn");
938    $(".greeting").hide();
939    $(".banner_box").append(
940      '<div id="banner_sub' +
941        cnt +
942        '" class="banner_item">' +
943        '                            <div class="item_inner">' +
944        '                                <div class="item_info">' +
945        '                                    <div class="item_name">' +
946        // nm +
947        "</div>" +
948        '                                    <div class="item_desc">' +
949        content +
950        "</div>" +
951        "                                </div>" +
952        "                            </div>" +
953        "                         </div>" +
954        '<div class="now"></div>'
955    );
956
957    html = '<div class="bubble bubble_admin">';
958    html += '<div class="bubble_top_box">';
959    html += '<div class="bubble_status_icon">';
960    html += "<img src=" + chat_img + ">";
961    html += "</div>";
962    html += '<div class="bubble_status_box">';
963    html += '<span class="status">' + chat_name + "</span>";
964    html += '<span class="status_now en_font">' + getNow() + "</span>";
965
966    html += "</div>";
967    html += "</div>";
968    html += '<div class="bubble_box bubble_box--admin">';
969    html += guide_text;
970    html += "</div>";
971    html += "</div>";
972
973    $(".banner_box").append(html);
974    $(".now").text(getDate());
975    if (
976      attach_file != "" &&
977      attach_file != null &&
978      attach_file != "undefined"
979    ) {
980      // 기능개발 전 임시작업
981      $("#banner_sub" + cnt).css(
982        "background-image",
983        `url(/img/front/mChat/banner_img0${cnt}.svg)`
984      );
985      $("#banner_sub" + cnt).css("background-image", `url(${attach_file})`);
986    }
987    html = "";
988
989    var lang = "";
990    if (!(urlPath.indexOf("/en") > -1)) {
991      lang = "kor";
992    } else {
993      lang = "eng";
994    }
995
996    $.ajax({
997      url: "/getChatContents",
998      data: {
999        par: par,
1000        banner: "basic",
1001        lang: lang,
1002      },
1003      type: "get",
1004      success: function (data) {
1005        html2 = '<div class="bubble bubble_select">';
1006        html2 += '<ul class="select_list">';
1007
1008        data.forEach(function (e) {
1009          let link_arrow = "";
1010          if (
1011            e.link.replace("|", "") != "" &&
1012            e.link.replace("|", "") != null &&
1013            e.link.replace("|", "") != "undefined" &&
1014            e.link.indexOf("|") == -1
1015          ) {
1016            link_arrow =
1017              '<img src="/img/front/mChat/link_arrow.png" alt="링크버튼">';
1018          } else {
1019            link_arrow = "";
1020          }
1021
1022          html2 += '<li class="select_item select_item' + e.idx + '">';
1023          html2 += '<button type="button" class="select_btn"';
1024          html2 +=
1025            'onclick="contScrollDown(' +
1026            chat_cnt +
1027            ");  getCate(" +
1028            e.idx +
1029            ",'" +
1030            e.nm.replace(/&#039;/g, "`") +
1031            "','" +
1032            e.view_type +
1033            "','" +
1034            e.guide_text.replace(/&#039;/g, "`") +
1035            "','" +
1036            e.content.replace(/&#039;/g, "`") +
1037            "'," +
1038            e.cnt +
1039            ",'" +
1040            e.link +
1041            "','" +
1042            e.attach_file +
1043            "','" +
1044            e.attach_file_ori +
1045            "','" +
1046            e.page_type +
1047            "', '" +
1048            e.view_type_sub +
1049            "')\" >" +
1050            e.nm.replace(/&#039;/g, "`") +
1051            link_arrow +
1052            "</button> </li>";
1053        });
1054
1055        html2 += "</ul>";
1056        html2 += "</div>";
1057
1058        $(".banner_box").append(html2);
1059        html2 = "";
1060
1061        // select btn active
1062        select_list();
1063      },
1064    });
1065  }
1066}
1067
1068/* ======================================================================
1069*
1070*  문의 하기 하드코딩 start
1071*
1072====================================================================== */
1073
1074const dummyData = {
1075  "AS 문의": `제품 점검 및 AS 문의가 있으신가요?<br/>아래 항목을 입력해주세요.`,
1076  "제품 문의":
1077    "제품 사양, 사용법 등에 대해 궁금하신가요?<br/>아래 항목을 입력해주세요.",
1078};
1079const dummyForm = {
1080  "AS 문의": `asForm`,
1081  "제품 문의": "prdForm",
1082  "기타 문의": "etcForm",
1083};
1084
1085const dummyDataEn = {
1086  "AS Inquiry": `Do you have a product inspection or A/S inquiry?<br/>Please enter the details below.`,
1087  "Product Inquiry":
1088    "Have questions about product specifications or usage?<br/>Please enter the details below.",
1089};
1090const dummyFormEn = {
1091  "AS Inquiry": `asForm`,
1092  "Product Inquiry": "prdForm",
1093};
1094
1095// hardChat 시작
1096$(".items.hard_chat").click(function () {
1097  hardChatFunc();
1098  hardQuestion();
1099});
1100
1101// 기본 화면 제거
1102function hardChatFunc() {
1103  $(".hard_chat").addClass("active");
1104  $(".goBack").removeClass("dn");
1105  $(".mchat_hard").addClass("dn");
1106  $(".banner_box").empty();
1107  $(".greeting").hide();
1108}
1109
1110// hardChat 내역 삭제
1111function resetHardChat() {
1112  $(".hardChatSection").html(null);
1113  if ($(".privacySection").children().length > 0) {
1114    $(".privacySection").html(null);
1115  }
1116}
1117
1118// 관리자 대화 생성
1119function hardQuestion() {
1120  const enHtml = `
1121							<div class="bubble bubble_admin">
1122								<div class="bubble_top_box">
1123									<div class="bubble_status_icon">
1124										<img src="${chat_img}">
1125									</div>
1126									<div class="bubble_status_box">
1127										<span class="status">OSANG HEALTHCARE</span>
1128										<span class="status_now en_font">${getNow()}</span>
1129									</div>
1130								</div>
1131								<div class="bubble_box bubble_box--admin">
1132									Hello! Welcome to OSANG HEALTHCARE.
1133								</div>
1134								<div class="bubble_box bubble_box--admin">
1135									Just let us know what you need,<br/>and we’ll be happy to assist you quickly and accurately.
1136								</div>
1137							</div>
1138
1139							<ul class="select_list">
1140								<li class="select_item select_item"><button type="button" class="select_btn hrad">
1141										AS Inquiry</button>
1142								</li>
1143								<li class="select_item select_item"><button type="button" class="select_btn hrad">
1144										Product Inquiry</button>
1145								</li>
1146						<li class="select_item select_item"><button type="button" class="select_btn contacts" onclick="location.href='/en/support/contacts'">
1147										Others Inquiry</button>
1148								</li>
1149							</ul>`;
1150  const html = `
1151							<div class="bubble bubble_admin">
1152								<div class="bubble_top_box">
1153									<div class="bubble_status_icon">
1154										<img src="${chat_img}">
1155									</div>
1156									<div class="bubble_status_box">
1157										<span class="status">오상헬스케어</span>
1158										<span class="status_now en_font">${getNow()}</span>
1159									</div>
1160								</div>
1161								<div class="bubble_box bubble_box--admin">
1162									안녕하세요! 오상헬스케어입니다 :)
1163								</div>
1164								<div class="bubble_box bubble_box--admin">
1165									원하시는 업무를 선택해 주시면,<br/>
1166									빠르고 정확하게 도움을 드리겠습니다.
1167								</div>
1168							</div>
1169
1170							<ul class="select_list">
1171								<li class="select_item select_item"><button type="button" class="select_btn hrad">
1172										AS 문의</button>
1173								</li>
1174								<li class="select_item select_item"><button type="button" class="select_btn hrad">
1175										제품 문의</button>
1176								</li>
1177								<li class="select_item select_item"><button type="button" class="select_btn contacts" onclick="location.href='/support/contacts'">
1178									기타 문의</button>
1179								</li>
1180							</ul>`;
1181  if (location.pathname.split("/")[1] === "en") {
1182    $(".bubbleSection").html(enHtml);
1183  } else {
1184    $(".bubbleSection").html(html);
1185  }
1186
1187  // 선택지 이벤트 리스너
1188  $(".select_btn.hrad").on("click", function () {
1189    const _this = $(this);
1190    // 문의영역 생성 호출
1191    hardHtml(_this.text());
1192  });
1193}
1194// 문의영역 생성
1195function hardHtml(key) {
1196  const value = key.trim();
1197  const html = `
1198            <div id="ddd" class="bubble bubble_customer">
1199                <span class="status_now en_font">${getNow()}</span>
1200                <div class="bubble_box chat_move_0"
1201                    style="background-color: rgb(206, 234, 254); color: black;">
1202                    ${value}
1203                </div>
1204            </div>
1205            <div class="bubble_box bubble_box--admin">
1206                ${dummyData[value]}
1207            </div>
1208            <div class="submit_hard">
1209                <div class="move_dot">
1210                    <div class="perv_arrow">
1211                    </div>
1212                    <div data-now="trx_1" data-prev="trx_0" class="dot trx_1 active"></div>
1213                    <div data-now="trx_2" data-prev="trx_1" class="dot trx_2"></div>
1214                    ${
1215                      value == "기타 문의"
1216                        ? ``
1217                        : `<div data-now="trx_3" data-prev="trx_2" class="dot trx_3"></div>`
1218                    }
1219                </div>
1220                <div class="move_section">
1221                    <form class="form_chat_box" id="${
1222                      dummyForm[value]
1223                    }"  action="">
1224                        <div class="form_chat form_1">
1225                            <p class="info">
1226                                문의에 빠르게 답변드리기 위해 <br />
1227                                고객님의 소중한 정보를 입력해주세요.
1228                            </p>
1229                            <p class="info_sub">
1230                                귀하가 제공하신 개인정보(이름, 연락처, 이메일)는 서비스 제공 및 <br />
1231                                문의 응대를 위해서만 사용되며, 관련 법령에 따라 안전하게 관리됩니다.
1232                            </p>
1233                            <input type="hidden" id="inquiry_category" name="inquiry_category" value="${value}">
1234                            <label class="label" for="user_name">이름*</label>
1235                            <input autocomplete="off" class="require" data-vali="이름을 입력해주세요." id="user_name" name="user_name" placeholder="이름을 입력해주세요. ex)홍길동" type="text">
1236                            <label class="label" for="user_phone">연락처 *</label>
1237                            <input autocomplete="off" class="require" data-vali="연락처를 입력해주세요." id="user_phone" name="user_phone" placeholder="연락처를 입력해주세요. ex)010-1111-1111" type="phone">
1238                            <label class="label"  for="user_email">이메일 *</label>
1239                            <input autocomplete="off" class="require" data-vali="이메일을 입력해 주세요." id="user_email" name="user_email" placeholder="이메일을 입력해 주세요. ex)[email protected]" type="text">
1240                            <label class="label"  for="user_country">국가 *</label>
1241                            <input autocomplete="off" class="require" data-vali="국가를 입력해 주세요." id="user_country" name="user_country" placeholder="국가를 입력해 주세요. ex)대한민국" type="text">
1242							<input type="checkbox" data-vali="개인정보 수집이용 동의를 체크해주세요." class="require" id="privacy_chk" name="privacy_chk">
1243							<label for="privacy_chk">개인정보 수집이용 동의 (필수) <a href="javascript:void(0);"><span class="underline">전문보기</span></a></label>
1244                            <div class="next_box">
1245                                <p class="next" data-id="trx_2">다음</p>
1246                            </div>
1247                        </div>
1248                        <div class="form_chat form_2">
1249                      
1250                            <label class="label">
1250문의하고 싶은 내용에 대해 자세하게 알려주세요.</label>
1251                            <textarea autocomplete="off" data-vali="문의하실 내용을 작성해주세요." name="project_cont" class="require" placeholder="문의하실 내용을 작성해주세요.*" id=""></textarea>
1252                            <p class="info_file">파일 유형 : pdf, ppt, word, excel, jpg, png, zip 최대 10MB
1253                            </p>
1254                            <div class="file_box">
1255                            <label class="hard_file_label disalbed">파일첨부+</label>
1256                            <label class="hard_file_label hard_file3" for="hard_file3">파일첨부+</label>
1257                            <label class="hard_file_label hard_file2" for="hard_file2">파일첨부+</label>
1258                            <label class="hard_file_label hard_file1" for="hard_file1">파일첨부+</label>
1259                            </div>
1260                            <div class="file_li">
1261                            </div>
1262                            <input id="hard_file1" class="real_files" name="upload[]" type="file" accept=".pdf, .ppt, .word, .excel, .jpg, .png, .zip" hidden>
1263                            <input id="hard_file2" class="real_files" name="upload[]" type="file" accept=".pdf, .ppt, .word, .excel, .jpg, .png, .zip" hidden>
1264                            <input id="hard_file3" class="real_files" name="upload[]" type="file" accept=".pdf, .ppt, .word, .excel, .jpg, .png, .zip" hidden>
1265                            <div class="next_box">
1266                            ${
1267                              value == "기타 문의"
1268                                ? `<button type="button" class="submit" onclick="submitActions('${value}', this)">문의하기</button>`
1269                                : `<p class="next" data-id="trx_3">다음</p>`
1270                            }
1271                            </div>
1272                        </div>
1273                        ${
1274                          value == "기타 문의"
1275                            ? ""
1276                            : `
1277                            <div class="form_chat form_3">
1278                                <label class="label">
1279                                    검사지통 혹은 측정기 뒷면에
1280                                    기재된 Lot No를 기재하여 주십시요.<br />
1281                                    <span class="info_sub">*만약 확인이 어려우시면 작성하지 않으셔도 됩니다.</span>
1282                                </label>
1283                                <textarea autocomplete="off" name="lot_no_cont" placeholder="Lot No" id=""></textarea>
1284                                <div class="next_box">
1285                                    <button type="button" class="submit" onclick="submitActions('${value}', this)">문의하기</button>
1286                                </div>
1287                            </div>
1288                        `
1289                        }
1290                    </form>
1291                </div>
1292            </div>
1293            <a href="javascript:void(0);" class="goHome">
1294                <svg width="12.25" height="12.25" viewBox="0 0 25 25" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M10.99 2.638a2.344 2.344 0 0 1 3.02 0l7.032 5.93c.528.445.833 1.1.833 1.791v9.698a1.823 1.823 0 0 1-1.823 1.823h-3.646a1.823 1.823 0 0 1-1.823-1.823V14.84a.26.26 0 0 0-.26-.26h-3.646a.26.26 0 0 0-.26.26v5.216a1.823 1.823 0 0 1-1.823 1.823H4.948a1.823 1.823 0 0 1-1.823-1.823v-9.698c0-.69.305-1.346.833-1.792l7.031-5.93zm2.014 1.194a.781.781 0 0 0-1.008 0l-7.03 5.93a.781.781 0 0 0-.279.597v9.698c0 .144.117.26.26.26h3.647a.26.26 0 0 0 .26-.26V14.84c0-1.007.816-1.823 1.823-1.823h3.646c1.007 0 1.823.816 1.823 1.823v5.216c0 .144.116.26.26.26h3.646a.26.26 0 0 0 .26-.26v-9.698a.781.781 0 0 0-.277-.597l-7.031-5.93z" fill="#0063EF"/></svg> 첫 화면으로 돌아가기
1295            </a>
1296            `;
1297  const enHtml = `
1298            <div id="ddd" class="bubble bubble_customer">
1299                <span class="status_now en_font">${getNow()}</span>
1300                <div class="bubble_box chat_move_0"
1301                    style="background-color: rgb(206, 234, 254); color: black;">
1302                    ${value}
1303                </div>
1304            </div>
1305            <div class="bubble_box bubble_box--admin">
1306                ${dummyDataEn[value]}
1307            </div>
1308            <div class="submit_hard">
1309                <div class="move_dot">
1310                    <div class="perv_arrow">
1311                    </div>
1312                    <div data-now="trx_1" data-prev="trx_0" class="dot trx_1 active"></div>
1313                    <div data-now="trx_2" data-prev="trx_1" class="dot trx_2"></div>
1314                    ${
1315                      value == "기타 문의"
1316                        ? ``
1317                        : `<div data-now="trx_3" data-prev="trx_2" class="dot trx_3"></div>`
1318                    }
1319                </div>
1320                <div class="move_section">
1321                    <form class="form_chat_box" id="${
1322                      dummyFormEn[value]
1323                    }"  action="">
1324                       <div class="form_chat form_1">
1325                            <p class="info">
1326														To provide you with a quick response,<br />
1327                                please provide your valuable information.
1328                            </p>
1329                            <p class="info_sub">
1330                                The personal information you provide (name, contact number, email) <br />
1331                                will only be used for service provision and inquiry responses,<br />and will be securely managed in accordance with applicable laws.
1332                            </p>
1333                            <input type="hidden" id="inquiry_category" name="inquiry_category" value="${value}">
1334                            <label class="label" for="user_name">Name*</label>
1335                            <input autocomplete="off" class="require" data-vali="Please enter your name." id="user_name" name="user_name" placeholder="Please enter your name." type="text">
1336                            <label class="label" for="user_phone">Contact number *</label>
1337                            <input autocomplete="off" class="require" data-vali="Please enter your contact number." id="user_phone" name="user_phone" placeholder="Please enter your contact number." type="phone">
1338                            <label class="label"  for="user_email">Email *</label>
1339                            <input autocomplete="off" class="require" data-vali="Please enter your email." id="user_email" name="user_email" placeholder="Please enter your email address." type="text">
1340                            <label class="label"  for="user_country">Country *</label>
1341                            <input autocomplete="off" class="require" data-vali="Please enter your country." id="user_country" name="user_country" placeholder="Please enter your country." type="text">
1342							<input type="checkbox" data-vali="Please check the box to agree to the collection and use of personal information." class="require" id="privacy_chk" name="privacy_chk">
1343							<label for="privacy_chk">Consent to collecting and using personal information (required) <a href="javascript:void(0);"><span class="underline">Full contents view</span></a></label>
1344                            <div class="next_box">
1345                                <p class="next" data-id="trx_2">Next</p>
1346                            </div>
1347                        </div>
1348                        <div class="form_chat form_2">
1349                            ${
1350                              value == "기타 문의"
1351                                ? ""
1352                                : `
1353                                    <label class="label">Which OSANG HEALTHCARE product would you like to inquire about?</label>
1354                                    <input autocomplete="off" name="product_name" data-vali="Please enter the product name." class="require" placeholder="Product name*" type="text"></input>`
1355                            }
1356                            <label class="label">Please provide detailed information about your inquiry to OSANG HEALTHCARE.</label>
1357                            <textarea autocomplete="off" data-vali="Enter the details of your inquiry below." name="project_cont" class="require" placeholder="Enter the details of your inquiry below.*" id=""></textarea>
1358                            <p class="info_file"> Allowed formats : pdf, ppt, word, excel, jpg, zip / Maximum size : 10MB
1359                            </p>
1360                            <div class="file_box">
1361                            <label class="hard_file_label disalbed">UPLOAD+</label>
1362                            <label class="hard_file_label hard_file3" for="hard_file3">UPLOAD+</label>
1363                            <label class="hard_file_label hard_file2" for="hard_file2">UPLOAD+</label>
1364                            <label class="hard_file_label hard_file1" for="hard_file1">UPLOAD+</label>
1365                            </div>
1366                            <div class="file_li">
1367                            </div>
1368                            <input id="hard_file1" class="real_files" name="upload[]" type="file" accept=".pdf, .ppt, .word, .excel, .jpg, .png, .zip" hidden>
1369                            <input id="hard_file2" class="real_files" name="upload[]" type="file" accept=".pdf, .ppt, .word, .excel, .jpg, .png, .zip" hidden>
1370                            <input id="hard_file3" class="real_files" name="upload[]" type="file" accept=".pdf, .ppt, .word, .excel, .jpg, .png, .zip" hidden>
1371                            <div class="next_box">
1372                            ${
1373                              value == "기타 문의"
1374                                ? `<button type="button" class="submit" onclick="submitActions('${value}', this)">문의하기</button>`
1375                                : `<p class="next" data-id="trx_3">Submission</p>`
1376                            }
1377                            </div>
1378                        </div>
1379                        ${
1380                          value == "기타 문의"
1381                            ? ""
1382                            : `
1383                            <div class="form_chat form_3">
1384                                <label class="label">
1385                                    Please enter the LOT number found on the test strip vial or the back of the device.<br />
1386                                    <span class="info_sub">*If unknown, you may leave this field blank.</span>
1387                                </label>
1388                                <textarea autocomplete="off" name="lot_no_cont" placeholder="Lot No" id=""></textarea>
1389                                <div class="next_box">
1390                                    <p class="submit" onclick="submitActions('${value}', this)">Submission</p>
1391                                </div>
1392                            </div>
1393                        `
1394                        }
1395                    </form>
1396                </div>
1397            </div>
1398            <a href="javascript:void(0);" class="goHome">
1399                <svg width="12.25" height="12.25" viewBox="0 0 25 25" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M10.99 2.638a2.344 2.344 0 0 1 3.02 0l7.032 5.93c.528.445.833 1.1.833 1.791v9.698a1.823 1.823 0 0 1-1.823 1.823h-3.646a1.823 1.823 0 0 1-1.823-1.823V14.84a.26.26 0 0 0-.26-.26h-3.646a.26.26 0 0 0-.26.26v5.216a1.823 1.823 0 0 1-1.823 1.823H4.948a1.823 1.823 0 0 1-1.823-1.823v-9.698c0-.69.305-1.346.833-1.792l7.031-5.93zm2.014 1.194a.781.781 0 0 0-1.008 0l-7.03 5.93a.781.781 0 0 0-.279.597v9.698c0 .144.117.26.26.26h3.647a.26.26 0 0 0 .26-.26V14.84c0-1.007.816-1.823 1.823-1.823h3.646c1.007 0 1.823.816 1.823 1.823v5.216c0 .144.116.26.26.26h3.646a.26.26 0 0 0 .26-.26v-9.698a.781.781 0 0 0-.277-.597l-7.031-5.93z" fill="#0063EF"/></svg> Back To Home
1400            </a>
1401            `;
1402
1403  if (location.pathname.split("/")[1] === "en") {
1404    $(".hardChatSection").html(enHtml);
1405  } else {
1406    $(".hardChatSection").html(html);
1407  }
1408  contScrollDown(0);
1409
1410  $(".underline").on("click", function () {
1411    const _this = $(this);
1412    // 문의영역 생성 호출
1413    privacy(_this.text());
1414    $(".hardChatSection .goHome").remove();
1415  });
1416
1417  /**
1418   * 문의영역 이벤트 리스너
1419   */
1420
1421  $("#user_phone").on("input", function () {
1422    const numbersOnly = $(this).val().replace(/\D/g, "").slice(0, 11);
1423    let formatted = numbersOnly;
1424
1425    if (numbersOnly.length >= 10) {
1426      formatted = numbersOnly.replace(/(\d{3})(\d{3,4})(\d{4})/, "$1-$2-$3");
1427    } else if (numbersOnly.length >= 4) {
1428      formatted = numbersOnly.replace(/(\d{3})(\d+)/, "$1-$2");
1429    }
1430
1431    $(this).val(formatted);
1432  });
1433
1434  $(".next").on("click", function () {
1435    const _this = $(this);
1436    const this_id = _this.data("id");
1437    const this_form = _this
1438      .parents(".form_chat")
1439      .find("input.require, textarea.require");
1440    const patternPhone = /^[0-9]{3}-[0-9]{3,4}-[0-9]{4}$/;
1441    const patternEmail = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
1442    let msg,
1443      status = null;
1444
1445    this_form.each(function () {
1446      if (!$(this).val() || $(this).val() == "") {
1447        status = $(this).data("vali");
1448        return false;
1449      }
1450      if (
1451        $(this).prop("id") == "user_phone" &&
1452        !patternPhone.test($(this).val())
1453      ) {
1454        status = $(this).data("vali");
1455        if (isEnPage()) {
1456          msg = "Use the format: 010-1111-1111.";
1457        } else {
1458          msg = "ex) 010-1111-1111의 형식으로 작성해야합니다.";
1459        }
1460        return false;
1461      }
1462      if (
1463        $(this).prop("id") == "user_email" &&
1464        !patternEmail.test($(this).val())
1465      ) {
1466        status = $(this).data("vali");
1467        if (isEnPage()) {
1468          msg = "Use the format: [email protected].";
1469        } else {
1470          msg = "ex) [email protected]의 형식으로 작성해야합니다.";
1471        }
1472        return false;
1473      }
1474      if ($(this).prop("id") == "privacy_chk" && !$(this).prop("checked")) {
1475        status = $(this).data("vali");
1476        return false;
1477      }
1478    });
1479
1480    if (status != null) {
1481      let tempMsg = msg == null ? status : msg;
1482      return alert(tempMsg);
1483    }
1484
1485    $(".perv_arrow").addClass("active");
1486    $(".form_chat_box").addClass(this_id);
1487    $(".dot").each(function () {
1488      $(".dot").removeClass("active");
1489      $(`.dot.${this_id}`).addClass("active");
1490    });
1491  });
1492
1493  $(".perv_arrow").on("click", function () {
1494    const now_id = $(".dot.active").data("now");
1495    const prev_id = $(".dot.active").data("prev");
1496    if (prev_id == "trx_1") {
1497      $(".perv_arrow").removeClass("active");
1498    }
1499    $(".form_chat_box").removeClass(now_id);
1500    $(`.dot.${now_id}`).removeClass("active");
1501    $(`.dot.${prev_id}`).addClass("active");
1502  });
1503
1504  // file 리스너
1505  $(".real_files").change(function () {
1506    const fileSize = $(this).prop("files")[0].size;
1507    let maxSize = 10 * 1024 * 1024; //* 10MB 사이즈 제한
1508    if (fileSize > maxSize) {
1509      $(this).val("");
1510      return alert("파일은 10MB 이내로 업로드 가능합니다.");
1511    }
1512
1513    const id = $(this).attr("id");
1514    const file_name = $(this).prop("files")[0].name;
1515    const fileList = $(".file_li");
1516    $(`label.${id}`).addClass("hasFile");
1517    fileList.append(
1518      `<p class="file_names" data-id="${id}">${file_name}<i class="delete_file"></i></p>`
1519    );
1520
1521    // 파일 삭제
1522    $(".delete_file").click(function () {
1523      const del_elem = $(this).parents(".file_names");
1524      const del_id = del_elem.data("id");
1525      $(`label.${del_id}`).removeClass("hasFile");
1526      $(`input.${del_id}`).val("");
1527      del_elem.remove();
1528    });
1529  });
1530}
1531
1532function privacy(key) {
1533  const value = key.trim();
1534  const html = `
1535          <div id="ddd" class="bubble bubble_customer">
1536                <span class="status_now en_font">${getNow()}</span>
1537                <div class="bubble_box chat_move_0"
1538                    style="background-color: rgb(206, 234, 254); color: black;">
1539                    ${value}
1540                </div>
1541            </div>
1542            <div class="submit_hard">
1543					개인정보 수집 및 이용<br/><br/>
1544㈜오상헬스케어는 다음의 목적을 위해서 아래에 나열된 개인정보 항목에 한하여 수집, 이용 및 처리 를 합니다. 수집된 개인정보는 정해진 목적 이외에는 이용되지 않으며, 해당 목적이 변경될 경우에는 정보주체에게 알리고 동의를 받을 예정입니다.<br/><br/>
15451. 목적<br/>
1546서비스 문의, 고객제품 등록, 채용 안내 및 이력서 등 접수 정보<br/><br/>
1547
15482. 항목<br/>
1549[ 수집하는 개인정보 항목 ]<br/><br/>
1550
15511. 서비스 문의 : 이름, 연락처, 이메일<br/>
15522. 고객제품 등록 : 이름, 연락처, 이메일, 성별, 생년월일<br/>
15533. 채용 안내 및 이력서 등 접수정보<br/>
15541) 필수항목 : 개인식별정보(증명사진, 성명, 생년월일, 성별, 주소, 전화번호, 전자우편주소, 긴급연락처), 국적사항(국적/비자의 종류), 학력사항(재학기간, 학교, 전공, 졸업여부, 본교/분교, 평균학점 등), 병역사항(군별, 병과, 계급, 제대여부, 복무기간, 면제사유 등), 경력사항(근무기간, 근무처, 직위, 담당업무, 연봉정보 등), 기타사항(장애/보훈대상여부)<br/>
15552) 선택항목 : 교육수료, 자격증, 공인어학점수, 해외경험, 취미, 특기, 흡연여부 등 기타 채용 관련 정보<br/>
1556위의 수집항목 상기한 목적을 위해 필요한 최소한의 개인정보입니다. 제공하신 개인정보의 처리에 관한 구체적인 내용 및 방침은 회사의 개인정보처리방침을 필히 참조해 주시기 바랍니다. 상기 내용 및 회사의 개인정보처리방침을 반드시 읽으시고, 개인정보를 제공, 서비스 등을 이용해 주 시기 바라며, 그러한 요청, 이용 진행시에는 제공하신 개인정보의 수집, 이용 및 처리에 최종 동의하 신 것으로 간주됩니다. 단, 정보주체는 해당 동의를 거부할 권리가 있고 거부시에는 요청하신 서비스 등이 제한될 수 있음을 미리 고지하여 드리는 바입니다.<br/>
1557            </div>
1558						    <a href="javascript:void(0);" class="goHome">
1559                <svg width="12.25" height="12.25" viewBox="0 0 25 25" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M10.99 2.638a2.344 2.344 0 0 1 3.02 0l7.032 5.93c.528.445.833 1.1.833 1.791v9.698a1.823 1.823 0 0 1-1.823 1.823h-3.646a1.823 1.823 0 0 1-1.823-1.823V14.84a.26.26 0 0 0-.26-.26h-3.646a.26.26 0 0 0-.26.26v5.216a1.823 1.823 0 0 1-1.823 1.823H4.948a1.823 1.823 0 0 1-1.823-1.823v-9.698c0-.69.305-1.346.833-1.792l7.031-5.93zm2.014 1.194a.781.781 0 0 0-1.008 0l-7.03 5.93a.781.781 0 0 0-.279.597v9.698c0 .144.117.26.26.26h3.647a.26.26 0 0 0 .26-.26V14.84c0-1.007.816-1.823 1.823-1.823h3.646c1.007 0 1.823.816 1.823 1.823v5.216c0 .144.116.26.26.26h3.646a.26.26 0 0 0 .26-.26v-9.698a.781.781 0 0 0-.277-.597l-7.031-5.93z" fill="#0063EF"/></svg> 첫 화면으로 돌아가기
1560            </a>
1561            `;
1562  const enhtml = `
1563          <div id="ddd" class="bubble bubble_customer">
1564                <span class="status_now en_font">${getNow()}</span>
1565                <div class="bubble_box chat_move_0"
1566                    style="background-color: rgb(206, 234, 254); color: black;">
1567                    ${value}
1568                </div>
1569            </div>
1570            <div class="submit_hard">
1571					Collection and Use of Personal Information<br/><br/>
1572OSANG HEALTHCARE, Co. Ltd. collects, uses, and processes the following personal information items solely for the purposes listed below. The collected personal information will not be used for purposes other than those specified. Should the purpose of use change, we will notify the data subject and obtain additional consent.<br/><br/>
15731. Purpose<br/>
1574Service inquiries, Customer Product Registration, Recruitment Information and Resume Submission<br/><br/>
1575
15762. Information Items Collected<br/>
1577[ Items of Personal Information Collected ]<br/><br/>
1578
15791. Service Inquiries: Name, Contact Info, Email<br/>
15802. Customer Product Registration: Name, Contact Info, Email, Gender, Year/Date of Birth<br/>
15813. Recruitment Information and Resume Submission<br/>
15821) Required Items : Personal Identification Information (photo, name, year/date of birth, gender, address, phone number, email address, emergency contact), Nationality (nationality/visa type), Education (attendance period, school, major, graduation status, main branch/branch, average grade), Military Service (branch, type, rank, discharge status, service period, exemption reason etc.), Work Experience (employment period, employer, position, job duties, salary information etc.), Other Information (disability/war veteran status)<br/>
15832) Optional Items : Education completion, certificates, language proficiency, overseas experience, hobbies, special skills, smoking status, etc. The above-listed personal information items are the minimum required to fulfill the stated purposes. For more specific details regarding the processing of your personal information, please refer to our company’s Privacy Policy.<br/>
1584Please make sure to read the above statement and our Privacy Policy carefully. By providing your personal information and using our services, you are regarded to have given your final consent to the collection, use, and processing of your information. However, you have the right to refuse consent. Please note that if you choose not to consent, the service(s) you request may be restricted.
1585            </div>
1586						    <a href="javascript:void(0);" class="goHome">
1587                <svg width="12.25" height="12.25" viewBox="0 0 25 25" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M10.99 2.638a2.344 2.344 0 0 1 3.02 0l7.032 5.93c.528.445.833 1.1.833 1.791v9.698a1.823 1.823 0 0 1-1.823 1.823h-3.646a1.823 1.823 0 0 1-1.823-1.823V14.84a.26.26 0 0 0-.26-.26h-3.646a.26.26 0 0 0-.26.26v5.216a1.823 1.823 0 0 1-1.823 1.823H4.948a1.823 1.823 0 0 1-1.823-1.823v-9.698c0-.69.305-1.346.833-1.792l7.031-5.93zm2.014 1.194a.781.781 0 0 0-1.008 0l-7.03 5.93a.781.781 0 0 0-.279.597v9.698c0 .144.117.26.26.26h3.647a.26.26 0 0 0 .26-.26V14.84c0-1.007.816-1.823 1.823-1.823h3.646c1.007 0 1.823.816 1.823 1.823v5.216c0 .144.116.26.26.26h3.646a.26.26 0 0 0 .26-.26v-9.698a.781.781 0 0 0-.277-.597l-7.031-5.93z" fill="#0063EF"/></svg> Back to Home
1588            </a>
1589            `;
1590
1591  if (isEnPage()) {
1592    $(".privacySection").html(enhtml);
1593  } else {
1594    $(".privacySection").html(html);
1595  }
1596
1597  contScrollDown(0);
1598}
1599
1600// document.addEventListener("click", e => {
1601// 	const goHomeBtn = e.target.closest(".goHome");
1602// 	if (goHomeBtn) {
1603// 		e.stopPropagation();
1604// 		document.querySelector(".home")?.click();
1605// 	}
1606// });
1607function setSubmitButtonState2(disabled) {
1608  const submitBtn = document.querySelector(
1609    ".bubble .hard_chat .submit_hard .move_section .next_box .submit"
1610  );
1611  submitBtn.disabled = disabled;
1612  submitBtn.style.opacity = disabled ? "0.5" : "1";
1613  submitBtn.style.cursor = disabled ? "not-allowed" : "pointer";
1614}
1615// submit handler
1616function submitActions(type, _this) {
1617  const submitBtn = document.querySelector(
1618    ".bubble .hard_chat .submit_hard .move_section .next_box .submit"
1619  );
1620  if (submitBtn.disabled) {
1621    return;
1622  }
1623  setSubmitButtonState2(true);
1624  const this_form = $(_this)
1625    .parents(".form_chat")
1626    .find("input.require, textarea.require");
1627  let status = null;
1628  this_form.each(function () {
1629    if (!$(this).val() || $(this).val() == "") {
1630      status = $(this).data("vali");
1631      return false;
1632    }
1633  });
1634
1635  if (status != null) {
1636    return alert(status);
1637  }
1638
1639  const forms = isEnPage()
1640    ? $(`form#${dummyFormEn[type]}`).get(0)
1641    : $(`form#${dummyForm[type]}`).get(0);
1642  const formData = new FormData(forms);
1643
1644  forms.action = "/contact_proc";
1645
1646  $.ajax({
1647    url: "/contact_proc",
1648    type: "POST",
1649    data: formData,
1650    contentType: false, // 중요!
1651    processData: false, // 중요!
1652    enctype: "multipart/form-data",
1653    success: function (data) {
1654      if (data.isSuc == "success") {
1655        //국문
1656        if (type == "AS 문의" || type == "제품 문의") {
1657          alert(type + "가 완료되었습니다.");
1658        }
1659        //영문
1660        else if (type == "AS Inquiry" || type == "Product Inquiry") {
1661          alert("Your " + type + "has been compeleted.");
1662        }
1663      } else {
1664        isEnPage()
1665          ? alert("Contact your administrator.")
1666          : alert("관리자에 문의하세요.");
1667      }
1668
1669      $(".home").trigger("click");
1670    },
1671    error: function (error) {
1672      console.error("에러 발생", error);
1673      alert("전송 중 에러 발생");
1674    },
1675  });
1676}
1677
1678/* ======================================================================
1679*
1680*  문의 하기 하드코딩 end
1681*
1682====================================================================== */

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.