help.blade.php 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270
  1. <!DOCTYPE html>
  2. <html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
  3. <head>
  4. <meta charset="utf-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1">
  6. <link rel="icon" href="{{asset('icon/faviconc.ico')}}" type="image/x-icon"/>
  7. <title>系统🎯手册</title>
  8. <style>
  9. .sidebar {
  10. background: #ffffff;
  11. line-height: 180%;
  12. position: fixed;
  13. left: 0;
  14. top: 0;
  15. border: 1px solid #aaaaaa;
  16. width: 20%;
  17. height:100%;
  18. }
  19. .sidebar p {
  20. font-size: 18px;
  21. color: #15a230;
  22. margin: 0 0 0.3rem 0;
  23. text-align: right;
  24. }
  25. .sidebar li{
  26. text-indent: 0.5rem;
  27. font-size: 14px;
  28. list-style: none;
  29. border-bottom:1px solid #ced4da;
  30. }
  31. .sidebar li .nav_item{
  32. padding: 3px;
  33. }
  34. .sidebar li .item_h1{
  35. margin-left: 0;
  36. }
  37. .sidebar li .item_h2{
  38. margin-left: 2rem;
  39. font-size: 0.8rem;
  40. }
  41. .sidebar li .item_h3{
  42. margin-left: 4rem;
  43. font-size: 0.8rem;
  44. }
  45. .sidebar li .item_h4{
  46. margin-left: 5rem;
  47. font-size: 0.8rem;
  48. }
  49. .sidebar li .item_h5{
  50. margin-left: 6rem;
  51. font-size: 0.8rem;
  52. }
  53. .sidebar li .item_h6{
  54. margin-left: 7rem;
  55. font-size: 0.8rem;
  56. }
  57. .sidebar li .nav_item.current{
  58. color: white;
  59. background-color: #5cc26f;
  60. }
  61. .sidebar a:hover {
  62. color: #5cc26f;
  63. }
  64. .sidebar a {
  65. text-decoration: none;
  66. }
  67. .nowrap{white-space:nowrap;}
  68. code {
  69. border-radius: 6px;
  70. background: rgba(0,0,0,.1);
  71. color: red;
  72. padding: 8px;
  73. }
  74. kbd {
  75. border-radius: 6px;
  76. background: rgba(5,1,5,.2);
  77. color: #000000;
  78. font-weight: bold;
  79. padding: 8px;
  80. }
  81. </style>
  82. </head>
  83. <body>
  84. <div class="sidebar">
  85. <div class="AnchorContent nowrap" id="AnchorContent"></div>
  86. </div>
  87. <div id="content" style="margin-left: 100px"></div>
  88. <script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script>
  89. <script>
  90. document.getElementById('content').innerHTML = marked("{!! $read !!}");
  91. </script>
  92. <script src="http://code.jquery.com/jquery-1.7.2.min.js"></script>
  93. <script type="text/javascript">
  94. let currentIndex = 0;
  95. let currentScrollHigh = 0;
  96. let currentContentScrollHigh = 0;
  97. $(window).load(function(){
  98. let body = $("body");
  99. let content = $("#AnchorContent");
  100. let headCounts = [body.find("h1").length, body.find("h2").length, body.find("h3").length, body.find("h4").length,
  101. body.find("h5").length, body.find("h6").length];
  102. let vH1Tag = null; // 显示的最高层级
  103. let vH2Tag = null; // 显示的最低层级
  104. for(let i = 0; i < headCounts.length; i++){
  105. if(headCounts[i] > 0){
  106. if(vH1Tag == null)vH1Tag = 'h' + (i + 1);
  107. else vH2Tag = 'h' + (i + 1);
  108. }
  109. }
  110. if(vH1Tag == null)return;
  111. let vIndexH1 = 0;
  112. let vIndexH2 = 0;
  113. let vIndexH3 = 0;
  114. let vIndexH4 = 0;
  115. let vIndexH5 = 0;
  116. let vIndexH6 = 0;
  117. let headerALL = [];
  118. let headerIDALL = [];
  119. let headerHeightALL = [];
  120. body.find("h1,h2,h3,h4,h5,h6").each(function(i,item){
  121. let id = '';
  122. let name = '';
  123. let tag = $(item).get(0).tagName.toLowerCase();
  124. let className = '';
  125. switch (tag){
  126. case "h1":
  127. id = name = ++vIndexH1;
  128. vIndexH2 = 0;
  129. vIndexH3 = 0;
  130. vIndexH4 = 0;
  131. vIndexH5 = 0;
  132. vIndexH6 = 0;
  133. className = 'item_h1';
  134. break;
  135. case "h2":
  136. id = vIndexH1 + '_' + ++vIndexH2;
  137. name = vIndexH1 + '.' + vIndexH2;
  138. className = 'item_h2';
  139. vIndexH3 = 0;
  140. vIndexH4 = 0;
  141. vIndexH5 = 0;
  142. vIndexH6 = 0;
  143. break;
  144. case "h3":
  145. id = vIndexH1 + '_' + vIndexH2+ '_' + ++vIndexH3;
  146. name = vIndexH1 + '.' + vIndexH2+ '.' + +vIndexH3;
  147. className = 'item_h3';
  148. vIndexH4 = 0;
  149. vIndexH5 = 0;
  150. vIndexH6 = 0;
  151. break;
  152. case "h4":
  153. id = vIndexH1 + '_' + vIndexH2+ '_' +vIndexH3 +'_'+ ++vIndexH4 ;
  154. name = vIndexH1 + '.' + vIndexH2+ '.' +vIndexH3 +'.'+ vIndexH4 ;
  155. className = 'item_h4';
  156. vIndexH5 = 0;
  157. vIndexH6 = 0;
  158. break;
  159. case "h5":
  160. id = vIndexH1 + '_' + vIndexH2+ '_' +vIndexH3 +'_' +vIndexH4+'_'+ ++vIndexH5;
  161. name = vIndexH1 + '.' + vIndexH2+ '.' +vIndexH3 +'.' +vIndexH4+'.'+ vIndexH5;
  162. className = 'item_h5';
  163. vIndexH6 = 0;
  164. break;
  165. case "h6":
  166. id = vIndexH1 + '_' + vIndexH2+ '_' +vIndexH3 +'_' +vIndexH4+'_' +vIndexH5+'_'+ ++vIndexH6;
  167. name = vIndexH1 + '.' + vIndexH2+ '.' +vIndexH3 +'.' +vIndexH4+'.' +vIndexH5+'.'+ vIndexH6;
  168. className = 'item_h6';
  169. break;
  170. }
  171. if(name.length > 2){
  172. let mFirstName = name.substring(0,2);
  173. while(mFirstName === "0."){
  174. name = name.substring(2,name.length);
  175. mFirstName = name.substring(0,2);
  176. }
  177. }
  178. $(item).attr("id","wow"+id+"_index_"+i);
  179. $(item).addClass("wow_head");
  180. content.css('max-height', ($(document).height()) + 'px');
  181. content.css('height', ($(window).height()) + 'px');
  182. content.css('overflow','auto');
  183. content.append('<li><a class="nav_item '+className+' anchor-link" href="#wow'+id+'_index_'+i+'" link="#wow'+id+'" index="'+i+'">'+name+" "+$(this).text()+" "+'</a></li>');
  184. let str = "#wow"+id+"_index_"+i;
  185. headerALL.push($(item));
  186. headerIDALL.push(str);
  187. });
  188. $(".anchor-link").click(function(){
  189. let index = $(this).attr("index");
  190. $(".sidebar li .nav_item.current").removeClass('current');
  191. $(headerNavs[index]).addClass('current');
  192. currentScrollHigh = $(window).scrollTop();
  193. currentContentScrollHigh = headerHeightALL[index];
  194. currentIndex = headerTops[index];
  195. });
  196. let headerNavs = $(".sidebar li .nav_item");
  197. let headerTops = [];
  198. $(".wow_head").each(function(i, n){
  199. headerTops.push($(n).offset().top);
  200. });
  201. headerTops.push($(document).height());
  202. window.onresize = function(){
  203. headerTops = [];
  204. $.each(headerNavs, function(i, n){
  205. $(n).trigger("click");
  206. document.querySelector(headerIDALL[i]).scrollIntoView(true);
  207. let scrollTop = $(window).scrollTop();
  208. headerTops.push(scrollTop);
  209. }
  210. );
  211. headerTops.push($(document).height());
  212. content.css('height', ($(window).height()) + 'px');
  213. let xcontentWidth = content.width();
  214. let xWidth = $(window).width();
  215. let xlength = xWidth - xcontentWidth;
  216. body.css("marginLeft",xcontentWidth+'px');
  217. body.css("max-width",xlength);
  218. $(headerNavs[currentIndex]).trigger("click");
  219. }
  220. $(window).scroll(function(){
  221. let scrollTop = $(window).scrollTop(); // 获得将要到达的点离顶距离
  222. $.each(headerTops, function(i, n){
  223. if( (scrollTop >= (headerTops[i]) && scrollTop < (headerTops[i+1] -1)) ){
  224. $(".sidebar li .nav_item.current").removeClass('current');
  225. $(headerNavs[i]).addClass('current');
  226. currentScrollHigh = scrollTop;
  227. currentContentScrollHigh = headerHeightALL[i];
  228. currentIndex = i;
  229. let mscrollTop1 = content.scrollTop(); // 当前标签的高度
  230. if((currentContentScrollHigh - mscrollTop1)> ($(window).height()/2)){
  231. content.animate({scrollTop: (currentContentScrollHigh)}, 10);
  232. } else if( ( mscrollTop1 - currentContentScrollHigh )> 0 ){
  233. content.animate({scrollTop: currentContentScrollHigh-(content.height()/3)}, 10);
  234. }
  235. return false;
  236. }
  237. }
  238. );
  239. if(scrollTop === 0){
  240. content.animate({scrollTop: 0}, 10);
  241. }
  242. if(scrollTop === $(document).height()){
  243. content.animate({scrollTop: headerHeightALL[headerHeightALL.length-1]}, 10);
  244. }
  245. });
  246. $.each(headerNavs, function(i, n){
  247. headerHeightALL.push($(n).offset().top);
  248. }
  249. );
  250. headerTops = [];
  251. $.each(headerNavs, function(i, n){
  252. $(n).trigger("click");
  253. document.querySelector(headerIDALL[i]).scrollIntoView(true);
  254. let scrollTop = $(window).scrollTop();
  255. headerTops.push(scrollTop);
  256. }
  257. );
  258. headerTops.push($(document).height());
  259. $(headerNavs[0]).trigger("click");
  260. document.querySelector(headerIDALL[0]).scrollIntoView(true);
  261. let xcontentWidth = content.width();
  262. let xWidth = $(window).width();
  263. let xlength = xWidth - xcontentWidth;
  264. body.css("marginLeft",xcontentWidth+'px');
  265. body.css("max-width",xlength);
  266. });
  267. </script>
  268. </body>
  269. </html>