hplus.min.js 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  1. function NavToggle() {
  2. $(".navbar-minimalize").trigger("click")
  3. }
  4. function SmoothlyMenu() {
  5. $("body").hasClass("mini-navbar") ? $("body").hasClass("fixed-sidebar") ? ($("#side-menu").hide(), setTimeout(function() {
  6. $("#side-menu").fadeIn(500)
  7. },
  8. 300)) : $("#side-menu").removeAttr("style") : ($("#side-menu").hide(), setTimeout(function() {
  9. $("#side-menu").fadeIn(500)
  10. },
  11. 100))
  12. }
  13. function localStorageSupport() {
  14. return "localStorage" in window && null !== window.localStorage
  15. }
  16. //进入全屏
  17. function requestFullScreen(e) {
  18. elem=document.documentElement;
  19. if(elem.webkitRequestFullScreen){
  20. elem.webkitRequestFullScreen();
  21. e.html('<i class="fa fa-compress"></i>');
  22. e.addClass('unscreen');
  23. }else if(elem.mozRequestFullScreen){
  24. elem.mozRequestFullScreen();
  25. e.html('<i class="fa fa-compress"></i>');
  26. e.addClass('unscreen');
  27. }else if(elem.requestFullScreen){
  28. elem.requestFullscreen();
  29. e.html('<i class="fa fa-compress"></i>');
  30. e.addClass('unscreen');
  31. }else{
  32. //浏览器不支持全屏API或已被禁用
  33. }
  34. }
  35. //退出全屏
  36. function exitFullscreen(e) {
  37. var de = document;
  38. if (de.exitFullscreen) {
  39. de.exitFullscreen();
  40. } else if (de.mozCancelFullScreen) {
  41. de.mozCancelFullScreen();
  42. } else if (de.webkitCancelFullScreen) {
  43. de.webkitCancelFullScreen();
  44. }
  45. e.html('<i class="fa fa-arrows"></i>');
  46. e.removeClass('unscreen');
  47. }
  48. layer.config({
  49. extend: ["extend/layer.ext.js", "skin/moon/style.css"],
  50. skin: "layer-ext-moon"
  51. }),
  52. $(document).ready(function() {
  53. function e() {
  54. var e = $("body > #wrapper").height() - 61;
  55. $(".sidebard-panel").css("min-height", e + "px")
  56. }
  57. $(".J_tabFullScreen").click(function (e) {
  58. if($(this).is('.unscreen')){
  59. exitFullscreen($(this));
  60. }else{
  61. requestFullScreen($(this));
  62. }
  63. }),
  64. $("#side-menu").metisMenu(),
  65. $(".right-sidebar-toggle").click(function() {
  66. $("#right-sidebar").toggleClass("sidebar-open")
  67. }),
  68. $(".sidebar-container").slimScroll({
  69. height: "100%",
  70. railOpacity: .4,
  71. wheelStep: 10
  72. }),
  73. $(".open-small-chat").click(function() {
  74. $(this).children().toggleClass("fa-comments").toggleClass("fa-remove"),
  75. $(".small-chat-box").toggleClass("active")
  76. }),
  77. $(".small-chat-box .content").slimScroll({
  78. height: "234px",
  79. railOpacity: .4
  80. }),
  81. $(".check-link").click(function() {
  82. var e = $(this).find("i"),
  83. a = $(this).next("span");
  84. return e.toggleClass("fa-check-square").toggleClass("fa-square-o"),
  85. a.toggleClass("todo-completed"),
  86. !1
  87. }),
  88. $(function() {
  89. $(".sidebar-collapse").slimScroll({
  90. height: "100%",
  91. railOpacity: .9,
  92. alwaysVisible: !1
  93. })
  94. }),
  95. $(".navbar-minimalize").click(function() {
  96. $("body").toggleClass("mini-navbar"),
  97. SmoothlyMenu()
  98. }),
  99. e(),
  100. $(window).bind("load resize click scroll",
  101. function() {
  102. $("body").hasClass("body-small") || e()
  103. }),
  104. $(window).scroll(function() {
  105. $(window).scrollTop() > 0 && !$("body").hasClass("fixed-nav") ? $("#right-sidebar").addClass("sidebar-top") : $("#right-sidebar").removeClass("sidebar-top")
  106. }),
  107. $(".full-height-scroll").slimScroll({
  108. height: "100%"
  109. }),
  110. // $("#side-menu>li").click(function() {
  111. // $("body").hasClass("mini-navbar") && NavToggle()
  112. // }),
  113. // $("#side-menu>li li a").click(function() {
  114. // $(window).width() < 769 && NavToggle()
  115. // }),
  116. $(".nav-close").click(NavToggle),
  117. /(iPhone|iPad|iPod|iOS)/i.test(navigator.userAgent) && $("#content-main").css("overflow-y", "auto")
  118. }),
  119. $(window).bind("load resize",
  120. function() {
  121. $(this).width() < 769 && ($("body").addClass("mini-navbar"), $(".navbar-static-side").fadeIn())
  122. }),
  123. $(function() {
  124. if ($("#fixednavbar").click(function() {
  125. $("#fixednavbar").is(":checked") ? ($(".navbar-static-top").removeClass("navbar-static-top").addClass("navbar-fixed-top"), $("body").removeClass("boxed-layout"), $("body").addClass("fixed-nav"), $("#boxedlayout").prop("checked", !1), localStorageSupport && localStorage.setItem("boxedlayout", "off"), localStorageSupport && localStorage.setItem("fixednavbar", "on")) : ($(".navbar-fixed-top").removeClass("navbar-fixed-top").addClass("navbar-static-top"), $("body").removeClass("fixed-nav"), localStorageSupport && localStorage.setItem("fixednavbar", "off"))
  126. }),
  127. $("#collapsemenu").click(function() {
  128. $("#collapsemenu").is(":checked") ? ($("body").addClass("mini-navbar"), SmoothlyMenu(), localStorageSupport && localStorage.setItem("collapse_menu", "on")) : ($("body").removeClass("mini-navbar"), SmoothlyMenu(), localStorageSupport && localStorage.setItem("collapse_menu", "off"))
  129. }),
  130. $("#boxedlayout").click(function() {
  131. $("#boxedlayout").is(":checked") ? ($("body").addClass("boxed-layout"), $("#fixednavbar").prop("checked", !1), $(".navbar-fixed-top").removeClass("navbar-fixed-top").addClass("navbar-static-top"), $("body").removeClass("fixed-nav"), localStorageSupport && localStorage.setItem("fixednavbar", "off"), localStorageSupport && localStorage.setItem("boxedlayout", "on")) : ($("body").removeClass("boxed-layout"), localStorageSupport && localStorage.setItem("boxedlayout", "off"))
  132. }),
  133. $("#refresh").click(function() {
  134. $("#refresh").is(":checked") ? (localStorageSupport && localStorage.setItem("refresh", "on")) : (localStorageSupport && localStorage.setItem("refresh", "off"))
  135. }),
  136. $(".s-skin-0").click(function() {
  137. localStorage.setItem("bodystyle", "");
  138. return $("body").removeClass("skin-1"),
  139. $("body").removeClass("skin-2"),
  140. $("body").removeClass("skin-3"),
  141. !1
  142. }),
  143. $(".s-skin-1").click(function() {
  144. localStorage.setItem("bodystyle", "skin-1");
  145. return $("body").removeClass("skin-2"),
  146. $("body").removeClass("skin-3"),
  147. $("body").addClass("skin-1"),
  148. !1
  149. }),
  150. $(".s-skin-3").click(function() {
  151. localStorage.setItem("bodystyle", "skin-3");
  152. return $("body").removeClass("skin-1"),
  153. $("body").removeClass("skin-2"),
  154. $("body").addClass("skin-3"),
  155. !1
  156. }), localStorageSupport) {
  157. var e = localStorage.getItem("collapse_menu"),
  158. a = localStorage.getItem("fixednavbar"),
  159. o = localStorage.getItem("boxedlayout"),
  160. r = localStorage.getItem("refresh");
  161. "on" == e && $("#collapsemenu").prop("checked", "checked"),
  162. "on" == a && $("#fixednavbar").prop("checked", "checked"),
  163. "on" == o && $("#boxedlayout").prop("checked", "checked"),
  164. "on" == r && $("#refresh").prop("checked", "checked")
  165. }
  166. if (localStorageSupport) {
  167. var e = localStorage.getItem("collapse_menu"),
  168. a = localStorage.getItem("fixednavbar"),
  169. o = localStorage.getItem("boxedlayout"),
  170. s = localStorage.getItem("bodystyle"),
  171. r = localStorage.getItem("refresh"),
  172. l = $("body");
  173. $("body").addClass(s);
  174. "on" == e && (l.hasClass("body-small") || l.addClass("mini-navbar")),
  175. "on" == a && ($(".navbar-static-top").removeClass("navbar-static-top").addClass("navbar-fixed-top"), l.addClass("fixed-nav")),
  176. "on" == o && l.addClass("boxed-layout"),
  177. "on" == r && $("#refresh").prop("checked", "checked")
  178. }
  179. });