PageSourceSearch

https://www.lovestruck.com/js/common.js

js lovestruck.com collected 2026-10-02 03:17:37 UTC 35,639 bytes, 1,340 lines download raw bytes

1//cookie begin
2!(function (e) {
3  var n = !1;
4  if (
5    ("function" == typeof define && define.amd && (define(e), (n = !0)),
6    "object" == typeof exports && ((module.exports = e()), (n = !0)),
7    !n)
8  ) {
9    var o = window.Cookies,
10      t = (window.Cookies = e());
11    t.noConflict = function () {
12      return (window.Cookies = o), t;
13    };
14  }
15})(function () {
16  function g() {
17    for (var e = 0, n = {}; e < arguments.length; e++) {
18      var o = arguments[e];
19      for (var t in o) n[t] = o[t];
20    }
21    return n;
22  }
23  return (function e(l) {
24    function C(e, n, o) {
25      var t;
26      if ("undefined" != typeof document) {
27        if (1 < arguments.length) {
28          if (
29            "number" == typeof (o = g({ path: "/" }, C.defaults, o)).expires
30          ) {
31            var r = new Date();
32            r.setMilliseconds(r.getMilliseconds() + 864e5 * o.expires),
33              (o.expires = r);
34          }
35          o.expires = o.expires ? o.expires.toUTCString() : "";
36          try {
37            (t = JSON.stringify(n)), /^[\{\[]/.test(t) && (n = t);
38          } catch (e) {}
39          (n = l.write
40            ? l.write(n, e)
41            : encodeURIComponent(String(n)).replace(
42                /%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g,
43                decodeURIComponent
44              )),
45            (e = (e = (e = encodeURIComponent(String(e))).replace(
46              /%(23|24|26|2B|5E|60|7C)/g,
47              decodeURIComponent
48            )).replace(/[\(\)]/g, escape));
49          var i = "";
50          for (var c in o)
51            o[c] && ((i += "; " + c), !0 !== o[c] && (i += "=" + o[c]));
52          return (document.cookie = e + "=" + n + i);
53        }
54        e || (t = {});
55        for (
56          var a = document.cookie ? document.cookie.split("; ") : [],
57            s = /(%[0-9A-Z]{2})+/g,
58            f = 0;
59          f < a.length;
60          f++
61        ) {
62          var p = a[f].split("="),
63            d = p.slice(1).join("=");
64          this.json || '"' !== d.charAt(0) || (d = d.slice(1, -1));
65          try {
66            var u = p[0].replace(s, decodeURIComponent);
67            if (
68              ((d = l.read
69                ? l.read(d, u)
70                : l(d, u) || d.replace(s, decodeURIComponent)),
71              this.json)
72            )
73              try {
74                d = JSON.parse(d);
75              } catch (e) {}
76            if (e === u) {
77              t = d;
78              break;
79            }
80            e || (t[u] = d);
81          } catch (e) {}
82        }
83        return t;
84      }
85    }
86    return (
87      ((C.set = C).get = function (e) {
88        return C.call(C, e);
89      }),
90      (C.getJSON = function () {
91        return C.apply({ json: !0 }, [].slice.call(arguments));
92      }),
93      (C.defaults = {}),
94      (C.remove = function (e, n) {
95        C(e, "", g(n, { expires: -1 }));
96      }),
97      (C.withConverter = e),
98      C
99    );
100  })(function () {});
101});
102//cookie end
103
104function getErrorMessageByKey(errors, required_key) {
105  for (var key in errors) {
106    if (required_key == key && errors.hasOwnProperty(key)) {
107      // console.log(errors[key]);
108      return errors[key][0];
109    }
110  }
111
112  return "";
113}
114
115var LS = {
116  isDevMode: function () {
117    return (
118      window.location.hostname != "www.lefujiayuan.com" &&
119      window.location.hostname != "www.lefujiayuan.cn" &&
120      window.location.hostname != "www.lovestruck.com"
121    );
122  },
123
124  isChina: function () {
125    return window.location.pathname.indexOf("/shenzhen") > -1;
126  },
127
128  handleBannerGoldenLine: function () {
129    var width = $(window).width();
130    // console.log(width);
131    // console.log(width < 1023);
132    // console.log('banner golden line');
133    if (width >= 1023) {
134      var h = $(".banner-left").height();
135      var my_h = $(".banner-right").height();
136      if (my_h < h) {
137        // console.log('set --');
138        $(".banner-right .box-banner").css({ height: h - 15 });
139      }
140    } else {
141      console.log("unset --");
142      $(".banner-right .box-banner").css({ height: "auto" });
143    }
144  },
145
146  handleReadMore: function () {
147    if (!$.fn.dotdotdot) return false;
148
149    // dotdotdot
150    $("#success-stories .box p").dotdotdot();
151
152    $(".readmore").click(function (e) {
153      e.preventDefault();
154
155      var content = $(this).prev("p").triggerHandler("originalContent");
156
157      $(".modal-body").html(content);
158    });
159  },
160
161  handleForm: function () {
162    $("#booking-form").submit(function (e) {
163      e.preventDefault();
164
165      $.post(post_url, $(this).serialize(), function (rs) {
166        console.log(rs);
167        if (rs.status_code == 301) {
168          // ok and redirect
169          window.location = rs.data.redirect_url;
170        } else if (rs.status_code == 400) {
171          // display error
172          var errors = rs.data.errors;
173          console.log(errors);
174
175          var $inputs = $("form input, form select");
176          $.each($inputs, function (key, v) {
177            if (!$inputs.hasOwnProperty(key)) return true;
178
179            var $input = $(v);
180            if (!$input.length) {
181              return true;
182            }
183
184            var $helpBlock = $input.next();
185            var msg = getErrorMessageByKey(errors, $input.attr("name"));
186            if (msg) {
187              $helpBlock.text(msg);
188              $helpBlock.show();
189            } else {
190              $helpBlock.text("");
191              $helpBlock.hide();
192            }
193          });
194
195          if (errors.hasOwnProperty("ip")) {
196            $inputs.last().next().text("you try again later");
197          }
198        }
199      });
200    });
201  },
202
203  handleMinorPage: function () {
204    /**
205     *
206     * @param target_id string
207     * @param no_redirect
208     * @returns {boolean}
209     */
210    function scrollToTarget(target_id, no_redirect) {
211      var $target = $(target_id);
212      // console.log($target);
213      // window.tmp = $target;
214
215      // console.log('scrollToTarget ' + target_id, $target.length);
216
217      if (!$target.length && !no_redirect) {
218        window.location = "/infinity/" + target_id;
219        return true;
220      }
221
222      var target_id_name = target_id.replace("#", "");
223      var $target_tmp = document.getElementById(target_id_name);
224      var h_position = $target.position().top; // this not correct ! \_/
225      // var h_position = Math.abs($target_tmp.getBoundingClientRect().top) + 200;
226      // console.log(target_id_name);
227      // console.log('target height ' + h_position);
228
229      $("html, body").animate({ scrollTop: h_position }, 0);
230    }
231
232    // hide menu
233    // if ($(window).width() <= 990) {
234    //     $('#bs-example-navbar-collapse-1').hide();
235    // }
236
237    // scroll to top
238    $("#scroll-to-top, .to-top").click(function (e) {
239      e.preventDefault();
240
241      $("html, body").animate({ scrollTop: 0 }, 0);
242
243      $("input, select").first().focus();
244    });
245
246    if (window.location.hash) {
247      console.log("scroll by hash");
248      // setTimeout(function(){
249      scrollToTarget(window.location.hash, true);
250      // }, 500)
251    } else {
252      // focus input
253      setTimeout(function () {
254        if ($(window).scrollTop() < 500) {
255          $("input, select").first().focus();
256        }
257      }, 1000);
258    }
259
260    // menu scroll to div
261    // $('a.nav-link').click(function(e){
262    //     var target_id = $(this).data('target-id');
263    //     if (target_id){
264    //         e.preventDefault();
265    //
266    //         scrollToTarget(target_id);
267    //
268    //         return false;
269    //     }
270    // });
271  },
272
273  handleMatchMaker: function () {
274    // show more matchmaker
275    $(".teams .more-info").click(function () {
276      var $teams = $(this).closest(".teams");
277      $teams.toggleClass("active");
278
279      var data = $(this).data();
280      if ($teams.hasClass("active")) {
281        $(this).text(data.textLess);
282      } else {
283        $(this).text(data.textMore);
284      }
285    });
286
287    $(".teams .more-info").text($(".teams .more-info").data("textMore"));
288  },
289
290  onResize: function () {
291    this.handleBannerGoldenLine();
292  },
293
294  onPageLoad: function () {
295    // $('img[height="1"]').hide();
296    setTimeout(function () {
297      if ($('img[height="1"]').length > 0) {
298        $('img[height="1"]').hide();
299      }
300    }, 800);
301    //this.handleBannerGoldenLine();
302    //this.handleReadMore();
303    //this.handleForm();
304    // this.handleMinorPage();         // todo enable
305    //this.handleMatchMaker();
306    // this.navactive();
307
308    if ($(".cookie_privacy").length > 0) {
309      var consent = Cookies.get("consent");
310      // ucook = null;
311      if (!consent) {
312        $(".cookie_privacy").show();
313        $(".cookie_setting").on("click", function () {
314          $(".ucookie1").hide();
315          $(".ucookie2").show();
316        });
317
318        $(".cookie_reject").on("click", function () {
319          $(".cookie_privacy").hide();
320          // LS.storage.set('cpop', 1);
321          Cookies.set("consent", '{"accept all":false}', {
322            expires: 90,
323            path: "/",
324          });
325          // location.reload();
326        });
327
328        $(".accept_essential").on("click", function () {
329          $(".cookie_privacy").hide();
330          // LS.storage.set('cpop', 1);
331          Cookies.set("consent", '{"accept all":false}', {
332            expires: 90,
333            path: "/",
334          });
335          // location.reload();
336        });
337
338        $(".cookie_agree,.allow_continue,.accept_all").on("click", function () {
339          $(".cookie_privacy").hide();
340          Cookies.set("consent", '{"accept all":true}', {
341            expires: 90,
342            path: "/",
343          });
344          // LS.storage.set('cpop', 1);
345          // location.reload();
346        });
347      }
348    }
349  },
350
351  navactive: function () {
352    var city = location.pathname.split("/")[2];
353    if (!city) {
354      return false;
355    }
356    $('.lsi-localtion-navbar a[data-location="' + city + '"]')
357      .removeClass("text-muted")
358      .addClass("text-ls-y");
359    return false;
360  },
361
362  log: function () {
363    if (this.isDevMode()) console.log(arguments);
364  },
365
366  fbq_track: function (event_name) {
367    // if (this.isChina() || !window.fbq) return false;
368    //
369    // fbq('track', event_name);
370  },
371
372  getRequest: function () {
373    var url = location.search,
374      theRequest = {};
375
376    if (url.indexOf("?") != -1) {
377      var strs = url.substr(1).split("&");
378
379      for (var i = 0; i < strs.length; i++) {
380        theRequest[strs[i].split("=")[0]] = decodeURIComponent(
381          strs[i].split("=")[1]
382        );
383      }
384    }
385    return theRequest;
386  },
387  setUtmData: function () {
388    return false;
389    //utm_source, utm_medium, utm_campaign, utm_term
390
391    var req = LS.getRequest(),
392      cookie_config = { expires: 30, path: "/" };
393    if (req["utm_source"]) {
394      Cookies.set("utmSource", req["utm_source"], cookie_config);
395    }
396    if (req["utm_medium"]) {
397      Cookies.set("utmMedium", req["utm_medium"], cookie_config);
398    }
399    if (req["utm_campaign"]) {
400      Cookies.set("utmCampaign", req["utm_campaign"], cookie_config);
401    }
402    if (req["utm_term"]) {
403      Cookies.set("utmTerm", req["utm_term"], cookie_config);
404    }
405    if (req["utm_content"]) {
406      Cookies.set("utmContent", req["utm_content"], cookie_config);
407    }
408  },
409  removeUtmData: function () {
410    var cookie_config = { path: "/" };
411    Cookies.remove("utmSource", cookie_config);
412    Cookies.remove("utmMedium", cookie_config);
413    Cookies.remove("utmCampaign", cookie_config);
414    Cookies.remove("utmTerm", cookie_config);
415    Cookies.remove("utmContent", cookie_config);
416  },
417  getUtmData: function () {
418    return {
419      utm_source: AD_utm_source,
420      utm_medium: AD_utm_medium,
421      utm_campaign: AD_utm_campaign,
422      utm_term: AD_utm_term,
423      utm_content: AD_utm_content,
424      utm_agid: AD_utm_agid,
425    };
426    // return{
427    //     "utm_source": Cookies.get("utmSource") ? Cookies.get("utmSource") : "",
428    //     "utm_medium": Cookies.get("utmMedium") ? Cookies.get("utmMedium") : "",
429    //     "utm_campaign": Cookies.get("utmCampaign") ? Cookies.get("utmCampaign") : "",
430    //     "utm_term": Cookies.get("utmTerm") ? Cookies.get("utmTerm") : "",
431    //     "utm_content": Cookies.get("utmContent") ? Cookies.get("utmContent") : ""
432    // };
433  },
434  get_date_str: function (y, m, d) {
435    m = m + 1;
436    if (m < 10) {
437      m = "0" + m;
438    }
439
440    if (d < 10) {
441      d = "0" + d;
442    }
443
444    return {
445      en: d + "/" + m + "/" + y,
446      cn: y + "-" + m + "-" + d,
447    };
448  },
449  //LinkedIn conversion tracking LS website
450  addLinkedinAds: function () {
451    $("body").append(
452      `<img height="1" width="1" style="display:none;" alt="" src="https://dc.ads.linkedin.com/collect/?pid=1226412&conversionId=665883&fmt=gif" />`
453    );
454  },
455  gtag_act: function (step_v) {
456    // return false;
457    if (LS.isChina() || !window.gtag || !window.fbq || !window.uetq) {
458      console.log("not found");
459      return false;
460    }
461    // gtag('event', 'generate_lead', { 'value': step_v});
462    // gtag('event', 'generate_lead', {value: step_v, send_to: 'ga4'});
463    // fbq('trackCustom', 'DIA_Step' + step_v);
464    // window.uetq && window.uetq.push('event',       'submit',       {'event_category': 'form',       'event_label': 'dia',       'event_value': '0'});
465
466    // ref: https://help.ads.microsoft.com/#apex/ads/en/56916/2
467    // window.uetq = window.uetq || [];
468    //
469    // window.uetq.push ('event', 'submit', {
470    //     'event_category': 'form',
471    //     'event_label': 'dia',
472    //     'event_value': 0 // enforce to zero, aligin Goal setting
473    // });
474    // window.uetq.push ('event', 'test', {
475    //     'event_category': 'test',
476    //     'event_label': 'test',
477    //     'event_value': 999
478    // });
479
480    // console.log('gtag', 'fbq', step_v)
481  },
482  storage: {
483    set: function (key, value, exp = 0) {
484      if (typeof localStorage == "undefined") {
485        console.log("localStorage undefined");
486        return false;
487      }
488      let now = new Date().getTime();
489      let exp_key = `${key}_expiry`;
490
491      exp = exp ? now + exp * 1000 : 0;
492
493      localStorage.setItem(exp_key, exp);
494      if (typeof value == "object") {
495        localStorage.setItem(key, JSON.stringify(value));
496      } else {
497        localStorage.setItem(key, value);
498      }
499    },
500    get: function (key) {
501      // console.log('-----storage get:', key)
502      if (typeof localStorage == "undefined") {
503        console.log("localStorage undefined");
504        return false;
505      }
506      let now = new Date().getTime();
507      let exp_key = `${key}_expiry`;
508      let expiry = localStorage.getItem(exp_key);
509      //console.log(expiry,now)
510      if (expiry > 0 && expiry < now) {
511        this.remove(key);
512        return false;
513      }
514      let cache = localStorage.getItem(key);
515      try {
516        return cache ? JSON.parse(cache) : false;
517      } catch (e) {
518        //console.log("is not object");
519        return cache;
520      }
521    },
522    remove: function (key) {
523      if (typeof localStorage == "undefined") {
524        return false;
525      }
526      localStorage.removeItem(key);
527      localStorage.removeItem(`${key}_expiry`);
528    },
529    clear: function () {
530      if (typeof localStorage == "undefined") {
531        return false;
532      }
533
534      localStorage.clear();
535    },
536    setAuthTag: function () {
537      this.set("hasAuth", 1, 60);
538    },
539    getAuthTag: function () {
540      return this.get("hasAuth");
541    },
542  },
543  check: {
544    detectSQLInjection: function (text) {
545      const sqlPatterns = [
546        /(\b(SELECT|INSERT|UPDATE|DELETE|DROP|UNION)\b.*\b(FROM|INTO|TABLE)\b)/i,
547        /('|"|`).*('|"|`).*(OR|AND).*=/i,
548        /--|\/\*|\*\//,
549        /;\s*(SELECT|INSERT|UPDATE|DELETE|DROP)/i,
550        /EXEC(\s|\()/i,
551        /xp_cmdshell/i,
552      ];
553
554      return sqlPatterns.some((pattern) => pattern.test(text));
555    },
556    email_format: function (value) {
557      value = value.replace(/ +/g, "");
558      return /^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))$/i.test(
559        value
560      );
561    },
562    check_phone_number: function (icode, mobile) {
563      if (!mobile) {
564        return false;
565      }
566      if (!LS.check.check_country_number(icode)) {
567        return false;
568      }
569      mobile = mobile.replace(/\s+/g, "");
570      if (typeof icode == "string") {
571        icode = icode.replace("+", "");
572        icode = parseInt(icode);
573      }
574      /**
575         * 2023.12.07
576         * select case country code
577         * case 1:
578         * Digits 10
579         * Prefix: Any
580
581         * case 852
582         * Digits: 8
583         * Prefix: 2,3,4,5,6,7,9
584
585         * case 65
586         * Digits: 8
587         * Prefix: 3,6,8,9
588
589         * case 66:
590         * Digits: 9 or 10
591         * Prefix: 02,03,04,05,06,08,09,2,3,4,5,6,7,8,9
592
593         * case 44:
594         * Digits: 10 or 11
595         * Prefix: 01,02,07,1,2,7
596
597         * case 86
598         * Digits 11
599         * Prefix: 1
600
601         * case else:
602         * Digits: >=7 and <=12
603         * Prefix: Any
604
605         */
606      let regex = /^[0-9]{7,12}$/;
607
608      switch (icode) {
609        case 1:
610          regex = /^[0-9]{10}$/;
611          break;
612        case 86:
613          regex = /^1[0-9]{10}$/;
614          break;
615        case 852:
616          regex = /^[0-9]{8}$/;
617          // regex = /^(2|3|4|5|6|7|9)[0-9]{7}$/;
618          break;
619        case 65:
620          regex = /^[0-9]{8}$/;
621          // regex = /^(3|6|8|9)[0-9]{7}$/;
622          break;
623        case 66:
624          regex = /^[0-9]{9,10}$/;
625          break;
626        case 44:
627          regex = /^[0-9]{10,11}$/;
628          break;
629      }
630      return regex.test(mobile);
631    },
632    check_phone_number2: function (mobile) {
633      return /^[0-9]{6,15}$/.test(mobile);
634    },
635    check_country_number: function (icode) {
636      return /^[0-9]{1,4}$/.test(icode);
637    },
638  },
639  layer: {
640    msg: function (txt) {
641      layer.open({
642        content: txt,
643        skin: "msg",
644        time: 2,
645      });
646    },
647    loading: function () {
648      return layer.open({ type: 2 });
649    },
650    close: function (lindex) {
651      layer.close(lindex);
652    },
653    closeAll: function () {
654      layer.closeAll();
655    },
656  },
657  getLsLangCode: function (lang_key) {
658    lang_key = lang_key.toLowerCase();
659    if (lang_key.indexOf("en") > -1) {
660      return "en_US";
661    } else if (lang_key.indexOf("cn") > -1) {
662      return "zh_CN";
663    } else if (lang_key.indexOf("hk") > -1) {
664      return "zh_HK";
665    } else if (lang_key.indexOf("th") > -1) {
666      return "th";
667    } else {
668      return "en_US";
669    }
670  },
671  getRouteLangCode: function (lang_key) {
672    lang_key = lang_key.toLowerCase();
673    if (lang_key.indexOf("en") > -1) {
674      return "en";
675    } else if (lang_key.indexOf("cn") > -1) {
676      return "zh-CN";
677    } else if (lang_key.indexOf("hk") > -1) {
678      return "zh-HK";
679    } else if (lang_key.indexOf("th") > -1) {
680      return "th";
681    } else {
682      return "en";
683    }
684  },
685  getAppCityPath: function (path) {
686    return path;
687    // return path.replace('-', '')
688  },
689  story: {
690    eventInit: function () {
691      $(".viewMoreStoryText").on("click", function () {
692        let self = $(this),
693          successStoryDesc = self.prev(".successStoryDesc");
694        // console.log('height', successStoryDesc.css('height'))
695        let h = "210px";
696        if (successStoryDesc.hasClass("v2")) {
697          h = "125px";
698        }
699        console.log("");
700
701        if (successStoryDesc.css("height") == h) {
702          successStoryDesc.css({ height: "auto" });
703          self.html(lang_view_less);
704        } else {
705          successStoryDesc.css({ height: h });
706          self.html(lang_view_more);
707        }
708      });
709    },
710  },
711  device: {
712    isAndroid: function () {
713      if (
714        /Linux/i.test(navigator.userAgent) &&
715        /android/i.test(navigator.userAgent.toLowerCase())
716      ) {
717        return true;
718      }
719      return false;
720    },
721    isiOS: function () {
722      if (!!navigator.userAgent.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/)) {
723        return true;
724      }
725      return false;
726    },
727  },
728  countryList: {
729    currentFlag: "",
730    currentICode: "",
731    init: function (country) {
732      let self = this;
733      console.log("countryList", country, self.currentFlag, self.currentICode);
734      self.currentFlag = _.get(country, "flag_url");
735      self.currentICode = _.get(country, "dial_code");
736
737      self.setCurrentCode();
738      self.bindEvent();
739    },
740    showCountrySmsCode: function (obj) {
741      let countryCodeBox = $(obj)
742        .closest(".input-group")
743        .children(".countryCodeBox");
744      countryCodeBox.css({ top: "51px" }).show();
745    },
746    hideCountrySmsCode: function () {
747      $(".countryCodeBox").css({ top: "85px" }).hide();
748    },
749    bindEvent: function () {
750      let self = this;
751
752      $(".countty-list a.country_item").on("click", function () {
753        let icode = $(this).attr("data-code");
754
755        self.currentFlag = $(this).children("img").attr("src");
756        self.currentICode = icode;
757        self.hideCountrySmsCode();
758        self.setCurrentCode();
759      });
760    },
761    setCurrentCode: function () {
762      let self = this;
763      $(".currentICode").html(
764        `<img src="${self.currentFlag}" class="mr-2" height="20"/> +${self.currentICode} ▼`
765      );
766    },
767  },
768  setLSLoginData: function (client) {
769    LS.storage.set("user", {
770      id: _.get(client, "client_id", ""),
771      userId: _.get(client, "client_id", ""),
772      brand_id: _.get(client, "brand_id", "1"),
773      token: _.get(client, "access_token", ""),
774      is_new_user: _.get(client, "is_new_user", 0),
775      isEmployee: false,
776      isCrm: true,
777    });
778    LS.storage.set("userInfo", client);
779    LS.storage.set("token", _.get(client, "access_token", ""));
780  },
781};
782
783$(function () {
784  LS.onPageLoad();
785  LS.setUtmData();
786  // $(window).resize(function(){
787  //     LS.onResize();
788  // });
789
790  // LS.story.eventInit();
791
792  setTimeout(function () {
793    if ($('img[height="1"]').length > 0) {
794      $('img[height="1"]').hide();
795    }
796  }, 200);
797
798  $(document).on("click", function (e) {
799    if ($(".countryCodeBox").length == 0) {
800      return;
801    }
802    // console.log('doc', e.target.className)
803    var codeClasses = ["countryCodeBox", "currentICode"];
804    let exit = false;
805    for (let cla of codeClasses) {
806      if (e.target.className.indexOf(cla) > -1) {
807        exit = true;
808        break;
809      }
810    }
811    if (!exit) {
812      // phoneInputObj.hideCountrySmsCode();
813      LS.countryList.hideCountrySmsCode();
814    }
815
816    var target = $(event.target);
817    // console.log("target", target);
818    if (
819      !target.closest(".icode").length &&
820      !target.closest(".icodeList").length
821    ) {
822      $(".icodeList").hide();
823    }
824  });
825});
826
827var LSApiObj = {
828  BASE_URL: `${APP_API_BASE}/`, //'https://api.lovestruck.com/api/',
829  BASE_HEADERS: {
830    "App-Name": location.host.indexOf("ever.") > -1 ? "ever-web" : "ls6-web",
831  },
832  axiosObj: null,
833  client_id: null,
834  getMe: function () {
835    let self = this;
836    // console.log('getMe')
837    let token = localStorage.getItem("token");
838    // console.log('getMe', token)
839    if (!token) {
840      return false;
841    }
842    this.setToken(token);
843    this.postRequest("v2/authorise/loginFromToken", {})
844      .then(function (rs) {
845        // console.log('get me', _.get(rs, 'data'))
846        if (_.get(rs, "data.client_id")) {
847          localStorage.setItem(
848            "ls_city",
849            _.get(rs, "data.city_url", "hong-kong")
850          );
851          let re_url = self.parseFirstLoadPage(_.get(rs, "data"));
852          // console.log("re_url", re_url)
853          location.href = re_url;
854        } else {
855          localStorage.removeItem("token");
856        }
857      })
858      .catch(function (err) {
859        localStorage.removeItem("token");
860        console.log("get me", err);
861      });
862  },
863  initLS: function (lang) {
864    if (!this.axiosObj) {
865      this.axiosObj = axios.create({
866        baseURL: this.BASE_URL,
867        timeout: 10000,
868        responseType: "json",
869        responseEncoding: "utf8",
870        headers: {
871          "Accept-Language": lang,
872          "ls-wishes": "no_legacy",
873          //'Content-Type':'application/x-www-form-urlencoded'
874        },
875      });
876    }
877
878    this.axiosObj.interceptors.response.use(
879      function (response) {
880        return response;
881      },
882      function (error) {
883        // console.log('error', error)
884        if (error && error.response) {
885          switch (error.response.status) {
886            // case 400: error.message = '请求错误'; break
887            case 401:
888              error.message = "Authorize failed";
889              break;
890            case 403:
891              error.message = "拒绝访问";
892              break;
893            case 404:
894              error.message = "Not found";
895              break;
896            case 408:
897              error.message = "请求超时";
898              break;
899            case 500:
900              error.message = "服务器内部错误";
901              break;
902            case 501:
903              error.message = "服务未实现";
904              break;
905            case 502:
906              error.message = "网关错误";
907              break;
908            case 503:
909              error.message = "服务不可用";
910              break;
911            case 504:
912              error.message = "Time out";
913              break;
914            case 505:
915              error.message = "HTTP版本不受支持";
916              break;
917            case 400:
918            case 606:
919              error.message = _.get(error, "response.data.error.body");
920              // console.log('606', error.response)
921              break;
922            default:
923              break;
924          }
925        }
926        // errorLog(error)
927        return Promise.reject(error);
928      }
929    );
930  },
931  setToken: function (token) {
932    this.BASE_HEADERS["Authorization"] = token;
933  },
934  setId: function (id) {
935    this.client_id = id;
936  },
937
938  setPostContentType: function () {
939    this.BASE_HEADERS["Content-Type"] = "application/x-www-form-urlencoded";
940  },
941
942  postRequest: function (url, data) {
943    this.setPostContentType();
944
945    return this.axiosObj.request({
946      method: "post",
947      url: url,
948      data: data,
949      transformRequest: [
950        function (data) {
951          let ret = "";
952          for (let it in data) {
953            ret +=
954              encodeURIComponent(it) + "=" + encodeURIComponent(data[it]) + "&";
955          }
956          return ret;
957        },
958      ],
959      headers: this.BASE_HEADERS,
960    });
961  },
962
963  putRequest: function (url, data) {
964    return this.axiosObj.request({
965      method: "put",
966      url: url,
967      data: data,
968      transformRequest: [
969        function (data) {
970          let ret = "";
971          for (let it in data) {
972            ret +=
973              encodeURIComponent(it) + "=" + encodeURIComponent(data[it]) + "&";
974          }
975          return ret;
976        },
977      ],
978      headers: this.BASE_HEADERS,
979    });
980  },
981
982  getRequest: function (url, params) {
983    return this.axiosObj.request({
984      method: "get",
985      url: url,
986      params: params,
987      headers: this.BASE_HEADERS,
988    });
989  },
990
991  parseFirstLoadPage: function (response) {
992    let refv = "";
993    if (response.is_new_user == 1) {
994      refv = "signup";
995    }
996    let path = "";
997    let query = ""; //lang=${response.lang_code}
998    let firstLoadPage = _.get(response, "uncompleted_field.profile_step");
999    // firstLoadPage = 'profile_step3'
1000    // if (firstLoadPage.indexOf("profile_step") > -1) {
1001    if (firstLoadPage) {
1002      // let step = firstLoadPage.replace("profile_step", "")
1003      path = `reg-step`;
1004      // let stepV = 'miss';
1005      let stepV = firstLoadPage.replace("profile_step", "");
1006      if (
1007        _.get(response, "membership_level_id", 0) > 1 &&
1008        stepV != "email" &&
1009        stepV != "idphoto" &&
1010        stepV != "idphoto_dis"
1011      ) {
1012        stepV = "miss";
1013        // stepV = firstLoadPage.replace("profile_step", "")
1014      }
1015      // query = `${query}&step=${step}`
1016      query = `?step=${stepV}`;
1017    } else {
1018      firstLoadPage = _.get(response, "first_load_page");
1019      switch (firstLoadPage) {
1020        case "search":
1021        case "match":
1022          path = "matchmaking-new-matches";
1023          break;
1024        case "free_page":
1025          path = "matchmaking";
1026          break;
1027        case "elites":
1028          path = "elite/list";
1029          break;
1030        case "client_chat":
1031          path = "chat";
1032          break;
1033        case "op_matches":
1034          path = "op-matches";
1035          break;
1036        default:
1037          path = "op-matches";
1038          break;
1039      }
1040    }
1041
1042    //${_.get(response, 'city_url')}/
1043    //         query = `${query}&ls_city=${_.get(response, 'city_url')}`
1044    url = `${location.origin.replace("-uat", "")}/app/${path}${query}`;
1045    console.log("url", url);
1046    return url;
1047  },
1048};
1049
1050var mmapiObj = {
1051  BASE_URL: "https://app.lovestruck.com/api/",
1052  BASE_HEADERS: {},
1053  MMapiAxios: null,
1054  LSApiAxios: null,
1055  startup_data: null,
1056  client_id: null,
1057  client_data: null,
1058
1059  init: function (lang) {
1060    if (!this.MMapiAxios) {
1061      console.log("inin mmapi");
1062      this.MMapiAxios = this.createAxios(lang);
1063    }
1064
1065    if (!this.startup_data) {
1066      this.getStartup();
1067    }
1068  },
1069
1070  setToken: function (token) {
1071    this.BASE_HEADERS["Authorization"] = token;
1072  },
1073  setId: function (id) {
1074    this.client_id = id;
1075  },
1076
1077  setPostContentType: function () {
1078    this.BASE_HEADERS["Content-Type"] = "application/x-www-form-urlencoded";
1079  },
1080
1081  createAxios: function (lang) {
1082    return axios.create({
1083      baseURL: this.BASE_URL,
1084      timeout: 3000,
1085      responseType: "json",
1086      responseEncoding: "utf8",
1087      headers: {
1088        "Accept-Language": lang,
1089        //'Content-Type':'application/x-www-form-urlencoded'
1090      },
1091    });
1092  },
1093
1094  getStartup: function () {
1095    this.startup({}, function (d) {
1096      // console.log(d);
1097      if (d.data.links) {
1098        mmapiObj.startup_data = d.data;
1099      } else {
1100        console.log("startup failed.");
1101      }
1102    });
1103  },
1104
1105  getClientInfo: function () {
1106    this.client_me({}, function (d) {
1107      if (d.data.client) {
1108        mmapiObj.client_data = d.data.client;
1109        mmapiObj.client_id = d.data.client.client_id;
1110      }
1111    });
1112  },
1113
1114  getLink: function (id) {
1115    try {
1116      let link = this.startup_data["links"][id]["link"];
1117      return link.replace("{{client_hash}}", this.client_data.client_hash);
1118    } catch (e) {
1119      console.error(e);
1120      return false;
1121    }
1122  },
1123
1124  test: function (data, successCallBack, errorCallBack, finallyCallBack) {
1125    this.setPostContentType();
1126    this.postRequest(
1127      "test/clientdata",
1128      data,
1129      successCallBack,
1130      errorCallBack,
1131      finallyCallBack
1132    );
1133  },
1134
1135  login_getVerificationCode: function (
1136    data,
1137    successCallBack,
1138    errorCallBack,
1139    finallyCallBack
1140  ) {
1141    this.setPostContentType();
1142    this.postRequest(
1143      "login/getVerificationCode",
1144      data,
1145      successCallBack,
1146      errorCallBack,
1147      finallyCallBack
1148    );
1149  },
1150
1151  client_verifyVerificationCode: function (
1152    data,
1153    successCallBack,
1154    errorCallBack,
1155    finallyCallBack
1156  ) {
1157    this.setPostContentType();
1158    this.postRequest(
1159      "client/verifyVerificationCode",
1160      data,
1161      successCallBack,
1162      errorCallBack,
1163      finallyCallBack
1164    );
1165  },
1166
1167  client_me: function (
1168    params,
1169    successCallBack,
1170    errorCallBack,
1171    finallyCallBack
1172  ) {
1173    this.getRequest(
1174      "client/me",
1175      params,
1176      successCallBack,
1177      errorCallBack,
1178      finallyCallBack
1179    );
1180  },
1181
1182  client_info: function (
1183    params,
1184    successCallBack,
1185    errorCallBack,
1186    finallyCallBack
1187  ) {
1188    this.getRequest(
1189      "client/info",
1190      params,
1191      successCallBack,
1192      errorCallBack,
1193      finallyCallBack
1194    );
1195  },
1196
1197  client_update: function (
1198    data,
1199    successCallBack,
1200    errorCallBack,
1201    finallyCallBack
1202  ) {
1203    this.setPostContentType();
1204    if (this.client_id) {
1205      this.putRequest(
1206        "client/" + this.client_id,
1207        data,
1208        successCallBack,
1209        errorCallBack,
1210        finallyCallBack
1211      );
1212      return;
1213    }
1214    this.postRequest(
1215      "client/update",
1216      data,
1217      successCallBack,
1218      errorCallBack,
1219      finallyCallBack
1220    );
1221  },
1222
1223  client_generateInitialMatches: function (
1224    data,
1225    successCallBack,
1226    errorCallBack,
1227    finallyCallBack
1228  ) {
1229    this.setPostContentType();
1230    this.postRequest(
1231      "client/generateInitialMatches",
1232      data,
1233      successCallBack,
1234      errorCallBack,
1235      finallyCallBack
1236    );
1237  },
1238
1239  startup: function (params, successCallBack, errorCallBack, finallyCallBack) {
1240    this.getRequest(
1241      "startup",
1242      params,
1243      successCallBack,
1244      errorCallBack,
1245      finallyCallBack
1246    );
1247  },
1248
1249  postRequest: function (
1250    url,
1251    data,
1252    successCallBack,
1253    errorCallBack,
1254    finallyCallBack
1255  ) {
1256    this.MMapiAxios.request({
1257      method: "post",
1258      url: url,
1259      data: data,
1260      transformRequest: [
1261        function (data) {
1262          let ret = "";
1263          for (let it in data) {
1264            ret +=
1265              encodeURIComponent(it) + "=" + encodeURIComponent(data[it]) + "&";
1266          }
1267          return ret;
1268        },
1269      ],
1270      headers: this.BASE_HEADERS,
1271    })
1272      .then(function (response) {
1273        successCallBack && successCallBack(response);
1274      })
1275      .catch(function (error) {
1276        errorCallBack && errorCallBack(error);
1277      })
1278      .then(function (response) {
1279        finallyCallBack && finallyCallBack(response);
1280      });
1281  },
1282
1283  putRequest: function (
1284    url,
1285    data,
1286    successCallBack,
1287    errorCallBack,
1288    finallyCallBack
1289  ) {
1290    this.MMapiAxios.request({
1291      method: "put",
1292      url: url,
1293      data: data,
1294      transformRequest: [
1295        function (data) {
1296          let ret = "";
1297          for (let it in data) {
1298            ret +=
1299              encodeURIComponent(it) + "=" + encodeURIComponent(data[it]) + "&";
1300          }
1301          return ret;
1302        },
1303      ],
1304      headers: this.BASE_HEADERS,
1305    })
1306      .then(function (response) {
1307        successCallBack && successCallBack(response);
1308      })
1309      .catch(function (error) {
1310        errorCallBack && errorCallBack(error);
1311      })
1312      .then(function (response) {
1313        finallyCallBack && finallyCallBack(response);
1314      });
1315  },
1316
1317  getRequest: function (
1318    url,
1319    params,
1320    successCallBack,
1321    errorCallBack,
1322    finallyCallBack
1323  ) {
1324    this.MMapiAxios.request({
1325      method: "get",
1326      url: url,
1327      params: params,
1328      headers: this.BASE_HEADERS,
1329    })
1330      .then(function (response) {
1331        successCallBack && successCallBack(response);
1332      })
1333      .catch(function (error) {
1334        errorCallBack && errorCallBack(error);
1335      })
1336      .then(function (response) {
1337        finallyCallBack && finallyCallBack(response);
1338      });
1339  },
1340};

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.