topmenu.min.js 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. "use strict";
  2. $(function() {
  3. function e(e) {
  4. switch (e = e.replace("Default", "default")) {
  5. case "/cz/recharge/index":
  6. return "cz";
  7. case "/card/default/cardList":
  8. return "card";
  9. case "/newcard/default/cardListSelected":
  10. return "newcard";
  11. case "/otherIndustry/default/index":
  12. return "otherIndustry";
  13. case "/cardNum/default/cardNumList":
  14. return "cardNum";
  15. case "/video/default/index_list":
  16. return "video";
  17. case "/ringing/index":
  18. return "ringing";
  19. case "/videoringing/default/index":
  20. return "videoringing";
  21. case "/phoneCharge/default/index":
  22. return "cz";
  23. case "/appfreeflow/default/gameFreeFlow":
  24. return "appfreeflow";
  25. case "/freeFlow/default/index":
  26. return "freeFlow";
  27. case "/outlink/default/outlink0":
  28. return "outlink0";
  29. case "/outlink/default/outlink1":
  30. return "outlink1";
  31. case "/outlink/default/outlink2":
  32. return "outlink2";
  33. case "/outlink/default/outlink3":
  34. return "outlink3";
  35. case "/outlink/default/outlink4":
  36. return "outlink4"
  37. }
  38. }
  39. function t() {
  40. var e = window.location.pathname
  41. , t = e.split("/");
  42. i("outlink" == t[1] ? t[3] : t[1])
  43. }
  44. function i(e) {
  45. $("#top-menu .item").removeClass("active"),
  46. "cz" == e ? $("#top-menu .cz").addClass("active") : "card" == e ? $("#top-menu .card").addClass("active") : "newcard" == e ? $("#top-menu .newcard").addClass("active") : "cardNum" == e ? $("#top-menu .cardNum").addClass("active") : "otherIndustry" == e ? $("#top-menu .otherIndustry").addClass("active") : "video" == e ? $("#top-menu .video").addClass("active") : "ring" == e ? $("#top-menu .ringing").addClass("active") : "videoringing" == e ? $("#top-menu .videoringing").addClass("active") : "phoneCharge" == e ? $("#top-menu .cz").addClass("active") : "appfreeflow" == e ? $("#top-menu .appfreeflow").addClass("active") : "freeFlow" == e ? $("#top-menu .freeFlow").addClass("active") : "outlink0" == e ? $("#top-menu .outlink0").addClass("active") : "outlink1" == e ? $("#top-menu .outlink1").addClass("active") : "outlink2" == e ? $("#top-menu .outlink2").addClass("active") : "outlink3" == e ? $("#top-menu .outlink3").addClass("active") : "outlink4" == e && $("#top-menu .outlink4").addClass("active")
  47. }
  48. function a() {
  49. var e = $(".scroll-inner .item").width();
  50. o.find(".item").length < 5 ? o.removeClass("has-shadow") : o.find(".item:nth-child(5)").position().left < o.scrollLeft() + 4 * e ? o.removeClass("has-shadow") : o.addClass("has-shadow")
  51. }
  52. var n = 0
  53. , o = $("#top-menu .scroll-inner");
  54. // common.ajax("/Public/getMenuList", {
  55. // digest: common.getQuery("digest")
  56. // }, {
  57. // success: function(i) {
  58. // for (var n = i.list, s = "", l = "&" + location.href.split("&")[location.href.split("&").length - 1], r = location.href.replace(location.origin, "").replace(l, ""), c = 0; c < n.length; c++) {
  59. // var d = n[c]
  60. // , u = d.path.split("?")[0]
  61. // , m = e(u);
  62. // if (2 == d.is_brank) {
  63. // var f = d.path.split("?")[0].split("/")[3];
  64. // s += '<a class="item ' + f + '" href="javascript:;" data-url="' + d.path + '" data-isoutlink="' + d.is_brank + '" data-isneeddigest="' + d.is_need_digest + '"><i></i>' + d.name + "</a>",
  65. // r == d.path && (document.title = d.name)
  66. // } else
  67. // "/videoringing/Default/activity" == d.path && (m = "videoringing"),
  68. // s += '<a class="item ' + m + '" href="javascript:;" data-url="' + d.path + '" data-isoutlink="' + d.is_brank + '" data-isneeddigest="' + d.is_need_digest + '"><i></i>' + d.name + "</a>"
  69. // }
  70. // o.html(s),
  71. // t(),
  72. // $(".scroll-inner").scrollLeft(localStorage.getItem("menuScrollLeft")),
  73. // a();
  74. // var p = []
  75. // , h = [];
  76. // localStorage.getItem("locationNav") ? (p = JSON.parse(localStorage.getItem("locationNav")),
  77. // h = JSON.parse(localStorage.getItem("isClickNav")),
  78. // n.forEach(function(e, t) {
  79. // p.forEach(function(i, a) {
  80. // i.path == e.path && (i.is_mark != e.is_mark ? (1 == e.is_mark ? $("#top-menu .item").eq(t).find("i").css("display", "none") : ($("#top-menu .item").eq(t).find("i").css("display", "block"),
  81. // h.forEach(function(t) {
  82. // t.path == e.path && (t.isClick = !1)
  83. // })),
  84. // p[a].is_mark = e.is_mark) : (2 == e.is_mark ? $("#top-menu .item").eq(t).find("i").css("display", "block") : $("#top-menu .item").eq(t).find("i").css("display", "none"),
  85. // h.forEach(function(i) {
  86. // i.path == e.path && (i.isClick ? $("#top-menu .item").eq(t).find("i").css("display", "none") : $("#top-menu .item").eq(t).find("i").css("display", "block"))
  87. // })))
  88. // })
  89. // }),
  90. // localStorage.setItem("locationNav", JSON.stringify(p)),
  91. // localStorage.setItem("isClickNav", JSON.stringify(h))) : (n.forEach(function(e, t) {
  92. // 2 == e.is_mark ? $("#top-menu .item").eq(t).find("i").css("display", "block") : $("#top-menu .item").eq(t).find("i").css("display", "none"),
  93. // p.push({
  94. // path: e.path,
  95. // is_mark: e.is_mark
  96. // })
  97. // }),
  98. // localStorage.setItem("locationNav", JSON.stringify(p)),
  99. // localStorage.setItem("isClickNav", JSON.stringify([]))),
  100. // $("#top-menu .item").click(function() {
  101. // var e = $(this).data("isoutlink")
  102. // , t = $(this).data("isneeddigest")
  103. // , i = $(this).data("url")
  104. // , a = JSON.parse(localStorage.getItem("isClickNav"))
  105. // , n = [];
  106. // if (0 == a.length)
  107. // n.push({
  108. // path: i,
  109. // isClick: !0
  110. // });
  111. // else {
  112. // for (var o = !1, s = 0; s < a.length; s++)
  113. // i == a[s].path && (o = !0);
  114. // o ? a.forEach(function(e, t) {
  115. // i == e.path && (e.isClick = !0)
  116. // }) : a.push({
  117. // path: i,
  118. // isClick: !0
  119. // })
  120. // }
  121. // $(this).find("i").css("display", "none"),
  122. // localStorage.setItem("isClickNav", JSON.stringify(n.concat(a))),
  123. // 2 == e ? 1 == t ? i.split("?").length > 2 ? location.href = i + "&digest=" + common.getQuery("digest", location.href) : location.href = i + "?digest=" + common.getQuery("digest", location.href) : location.href = i.split("?url=")[1] : i.indexOf("?") > 0 ? location.href = i + "&digest=" + common.getQuery("digest", location.href) : location.href = i + "?digest=" + common.getQuery("digest", location.href)
  124. // })
  125. // }
  126. // }),
  127. o.scroll(function() {
  128. $(".scroll-inner .item").width();
  129. n = $(this).scrollLeft(),
  130. localStorage.setItem("menuScrollLeft", n),
  131. a()
  132. })
  133. });