您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

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