hplus.min.js 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. function NavToggle() {
  2. $(".navbar-minimalize").trigger("click")
  3. }
  4. function SmoothlyMenu() {
  5. $("body").hasClass("mini-navbar") ? $("body").hasClass("fixed-sidebar") ? ($("#side-menu").hide(),
  6. setTimeout(function() {
  7. $("#side-menu").fadeIn(500)
  8. }, 300)) : $("#side-menu").removeAttr("style") : ($("#side-menu").hide(),
  9. setTimeout(function() {
  10. $("#side-menu").fadeIn(500)
  11. }, 100))
  12. }
  13. function localStorageSupport() {
  14. return "localStorage"in window && null !== window.localStorage
  15. }
  16. layer.config({
  17. extend: ["extend/layer.ext.js", "skin/default/style.css"],
  18. skin: "layer-ext-moon"
  19. }),
  20. $(document).ready(function() {
  21. function e() {
  22. var e = $("body > #wrapper").height() - 61;
  23. $(".sidebard-panel").css("min-height", e + "px")
  24. }
  25. $("#side-menu").metisMenu(),
  26. $(".right-sidebar-toggle").click(function() {
  27. $("#right-sidebar").toggleClass("sidebar-open")
  28. }),
  29. $(".sidebar-container").slimScroll({
  30. height: "100%",
  31. railOpacity: .4,
  32. wheelStep: 10
  33. }),
  34. $(".open-small-chat").click(function() {
  35. $(this).children().toggleClass("fa-comments").toggleClass("fa-remove"),
  36. $(".small-chat-box").toggleClass("active")
  37. }),
  38. $(".small-chat-box .content").slimScroll({
  39. height: "234px",
  40. railOpacity: .4
  41. }),
  42. $(".check-link").click(function() {
  43. var e = $(this).find("i")
  44. , a = $(this).next("span");
  45. return e.toggleClass("fa-check-square").toggleClass("fa-square-o"),
  46. a.toggleClass("todo-completed"),
  47. !1
  48. }),
  49. $(function() {
  50. $(".sidebar-collapse").slimScroll({
  51. height: "100%",
  52. railOpacity: .9,
  53. alwaysVisible: !1
  54. })
  55. }),
  56. $(".navbar-minimalize").click(function() {
  57. $("body").toggleClass("mini-navbar"),
  58. SmoothlyMenu()
  59. }),
  60. e(),
  61. $(window).bind("load resize click scroll", function() {
  62. $("body").hasClass("body-small") || e()
  63. }),
  64. $(window).scroll(function() {
  65. $(window).scrollTop() > 0 && !$("body").hasClass("fixed-nav") ? $("#right-sidebar").addClass("sidebar-top") : $("#right-sidebar").removeClass("sidebar-top")
  66. }),
  67. $(".full-height-scroll").slimScroll({
  68. height: "100%"
  69. }),
  70. $("#side-menu>li").click(function() {
  71. $("body").hasClass("mini-navbar") && NavToggle()
  72. }),
  73. $("#side-menu>li li a").click(function() {
  74. $(window).width() < 769 && NavToggle()
  75. }),
  76. $(".nav-close").click(NavToggle),
  77. /(iPhone|iPad|iPod|iOS)/i.test(navigator.userAgent) && $("#content-main").css("overflow-y", "auto")
  78. }),
  79. //$(window).bind("load resize", function() {
  80. // $(this).width() < 769 && ($("body").addClass("mini-navbar"),
  81. // $(".navbar-static-side").fadeIn())
  82. //}),
  83. $(function() {
  84. if ($("#fixednavbar").click(function() {
  85. $("#fixednavbar").is(":checked") ? ($(".navbar-static-top").removeClass("navbar-static-top").addClass("navbar-fixed-top"),
  86. $("body").removeClass("boxed-layout"),
  87. $("body").addClass("fixed-nav"),
  88. $("#boxedlayout").prop("checked", !1),
  89. localStorageSupport && localStorage.setItem("boxedlayout", "off"),
  90. localStorageSupport && localStorage.setItem("fixednavbar", "on")) : ($(".navbar-fixed-top").removeClass("navbar-fixed-top").addClass("navbar-static-top"),
  91. $("body").removeClass("fixed-nav"),
  92. localStorageSupport && localStorage.setItem("fixednavbar", "off"))
  93. }),
  94. $("#collapsemenu").click(function() {
  95. $("#collapsemenu").is(":checked") ? ($("body").addClass("mini-navbar"),
  96. SmoothlyMenu(),
  97. localStorageSupport && localStorage.setItem("collapse_menu", "on")) : ($("body").removeClass("mini-navbar"),
  98. SmoothlyMenu(),
  99. localStorageSupport && localStorage.setItem("collapse_menu", "off"))
  100. }),
  101. $("#boxedlayout").click(function() {
  102. $("#boxedlayout").is(":checked") ? ($("body").addClass("boxed-layout"),
  103. $("#fixednavbar").prop("checked", !1),
  104. $(".navbar-fixed-top").removeClass("navbar-fixed-top").addClass("navbar-static-top"),
  105. $("body").removeClass("fixed-nav"),
  106. localStorageSupport && localStorage.setItem("fixednavbar", "off"),
  107. localStorageSupport && localStorage.setItem("boxedlayout", "on")) : ($("body").removeClass("boxed-layout"),
  108. localStorageSupport && localStorage.setItem("boxedlayout", "off"))
  109. }),
  110. $(".s-skin-0").click(function() {
  111. return $("body").removeClass("skin-1"),
  112. $("body").removeClass("skin-2"),
  113. $("body").removeClass("skin-3"),
  114. !1
  115. }),
  116. $(".s-skin-1").click(function() {
  117. return $("body").removeClass("skin-2"),
  118. $("body").removeClass("skin-3"),
  119. $("body").addClass("skin-1"),
  120. !1
  121. }),
  122. $(".s-skin-3").click(function() {
  123. return $("body").removeClass("skin-1"),
  124. $("body").removeClass("skin-2"),
  125. $("body").addClass("skin-3"),
  126. !1
  127. }),
  128. localStorageSupport) {
  129. var e = localStorage.getItem("collapse_menu")
  130. , a = localStorage.getItem("fixednavbar")
  131. , o = localStorage.getItem("boxedlayout");
  132. "on" == e && $("#collapsemenu").prop("checked", "checked"),
  133. "on" == a && $("#fixednavbar").prop("checked", "checked"),
  134. "on" == o && $("#boxedlayout").prop("checked", "checked")
  135. }
  136. if (localStorageSupport) {
  137. var e = localStorage.getItem("collapse_menu")
  138. , a = localStorage.getItem("fixednavbar")
  139. , o = localStorage.getItem("boxedlayout")
  140. , l = $("body");
  141. "on" == e && (l.hasClass("body-small") || l.addClass("mini-navbar")),
  142. "on" == a && ($(".navbar-static-top").removeClass("navbar-static-top").addClass("navbar-fixed-top"),
  143. l.addClass("fixed-nav")),
  144. "on" == o && l.addClass("boxed-layout")
  145. }
  146. });