You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

index.html 5.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209
  1. <!doctype html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="viewport"
  6. content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
  7. <meta http-equiv="X-UA-Compatible" content="ie=edge">
  8. <title>DC SDK examples</title>
  9. <script src="./jquery.min.js"></script>
  10. <script src="./jquery.accordion.js"></script>
  11. <style>
  12. * {
  13. margin: 0;
  14. padding: 0;
  15. }
  16. html,
  17. body {
  18. width: 100%;
  19. height: 100%;
  20. overflow: hidden;
  21. }
  22. .container{
  23. display: flex;
  24. height: 100%;
  25. }
  26. .example-list::-webkit-scrollbar{
  27. width:10px;
  28. height:10px;
  29. /**/
  30. }
  31. .example-list::-webkit-scrollbar-track{
  32. background: #424242;
  33. }
  34. .example-list::-webkit-scrollbar-thumb{
  35. background: #686868;
  36. max-height: 20px;
  37. }
  38. .nav{
  39. width: 250px;
  40. height: 100%;
  41. overflow: hidden;
  42. background: #222;
  43. color: #fff;
  44. display: flex;
  45. flex-direction: column;
  46. }
  47. .example{
  48. flex: 1;
  49. height: 100%;
  50. overflow: hidden;
  51. }
  52. iframe{
  53. width: 100%;
  54. height: 100%;
  55. overflow: hidden;
  56. }
  57. .nav .banner{
  58. padding: 20px 20px 0 20px;
  59. color:#1e80ff;
  60. font-weight: bold;
  61. font-style: italic;
  62. }
  63. .example-list-wrapper{
  64. flex: 1;
  65. overflow: hidden;
  66. user-select: none;
  67. margin-top: 15px;
  68. display: flex;
  69. flex-direction: column;
  70. }
  71. .example-list{
  72. flex: 1;
  73. overflow: hidden;
  74. overflow-y: auto;
  75. }
  76. .example-list-wrapper .desc{
  77. height: 150px;
  78. }
  79. .example-list .example-item{
  80. border-top: 1px solid #444 ;
  81. }
  82. .example-list h4{
  83. padding-left: 20px;
  84. font-size: 14px ;
  85. margin: 7px 0;
  86. color: #bcbcbc;
  87. }
  88. .example-list h4:hover,.example-list ul li:hover{
  89. cursor: pointer;
  90. }
  91. .example-list ul{
  92. padding-left: 35px;
  93. list-style: none;
  94. margin-top: 5px;
  95. background: #181717;
  96. }
  97. .example-list ul li{
  98. margin: 5px 0;
  99. font-size: 13px;
  100. }
  101. .example-list ul li:hover a,.example-list ul li.active a{
  102. color: #1e80ff;
  103. }
  104. .example-list ul li:hover,.example-list ul li a{
  105. color: #fff;
  106. text-decoration: none;
  107. }
  108. #code-link{
  109. position: fixed;
  110. bottom: 16px;
  111. left: 270px;
  112. padding: 8px;
  113. border-radius: 50%;
  114. margin-bottom: 0;
  115. background-color: #FFF;
  116. opacity: .9;
  117. z-index: 999;
  118. box-shadow: 0 0 4px rgba(0,0,0,.15);
  119. display: flex;
  120. }
  121. #code-link img{
  122. width: 30px;
  123. }
  124. </style>
  125. </head>
  126. <body>
  127. <div class="container">
  128. <div class="nav">
  129. <div class="banner"> DC-SDK v3.3.0 </div>
  130. <div class="example-list-wrapper">
  131. <div id="example-list" class="example-list" data-accordion-group> </div>
  132. <div class="desc"></div>
  133. </div>
  134. </div>
  135. <div class="example">
  136. <iframe sandbox="allow-same-origin allow-scripts allow-popups allow-forms" id="inner-page" name="inner-page" style="border: 0" allow="fullscreen; xr-spatial-tracking;" > </iframe>
  137. <a id="code-link" href="" target="_blank"><img src="./assets/icon/code.svg" title="源码" alt=“”></a>
  138. </div>
  139. <script src="./list.js"></script>
  140. <script type="text/javascript">
  141. $(document).ready(function() {
  142. let href =undefined
  143. let $currentPage = undefined
  144. if(window.location.href.indexOf("#")> -1){
  145. let hrefArr = window.location.href.split('#')
  146. if(hrefArr[1]){
  147. href = hrefArr[1].replace('_','/')
  148. }
  149. $('#code-link').attr('href','https://github.com/dvgis/dc-sdk/blob/master/examples/'+href)
  150. }
  151. $('#inner-page').attr('src',href || 'info/start.html')
  152. EXAMPLE_LIST.forEach(item => {
  153. let $section = $('<div data-accordion ></div>')
  154. $section.addClass('example-item')
  155. let $title = $('<h4 data-control ></h4>').text(item.name)
  156. $title.appendTo($section)
  157. let $pageWrapper= $('<ul data-content></ul>')
  158. $pageWrapper.appendTo($section)
  159. if(item.children){
  160. item.children.forEach(child => {
  161. let $page = $('<li></li>')
  162. let $link = $('<a></a>').text(child.name)
  163. $link.attr('href',item.folder+'/'+child.page).attr('target','inner-page')
  164. $link.bind('click',e=>{
  165. if($currentPage){
  166. $currentPage.removeClass('active')
  167. }
  168. window.location.href = window.location.href.replace(/#\w*\.?\w*/g,'') +'#'+ item.folder+ '_'+child.page
  169. $page.addClass('active')
  170. $('#code-link').attr('href','https://github.com/dvgis/dc-sdk/blob/master/examples/'+item.folder +'/'+child.page)
  171. $currentPage =$page
  172. })
  173. $page.append($link)
  174. $pageWrapper.append($page)
  175. })
  176. }
  177. $section.appendTo($('#example-list'))
  178. })
  179. $('#example-list [data-accordion]').accordion();
  180. });
  181. </script>
  182. </div>
  183. </body>
  184. </html>