help_tmpl.js 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  1. app.templates.helpPage = ->
  2. ctrlKey = if $.isMac() then 'cmd' else 'ctrl'
  3. navKey = if $.isMac() then 'cmd' else 'alt'
  4. arrowScroll = app.settings.get('arrowScroll')
  5. aliases_one = {}
  6. aliases_two = {}
  7. keys = Object.keys(app.models.Entry.ALIASES)
  8. middle = Math.ceil(keys.length / 2) - 1
  9. for key, i in keys
  10. (if i > middle then aliases_two else aliases_one)[key] = app.models.Entry.ALIASES[key]
  11. """
  12. <nav class="_toc" role="directory">
  13. <h3 class="_toc-title">Table of Contents</h3>
  14. <ul class="_toc-list">
  15. <li><a href="#managing-documentations">Managing Documentations</a>
  16. <li><a href="#search">Search</a>
  17. <li><a href="#shortcuts">Keyboard Shortcuts</a>
  18. <li><a href="#aliases">Search Aliases</a>
  19. </ul>
  20. </nav>
  21. <h1 class="_lined-heading">User Guide</h1>
  22. <h2 class="_block-heading" id="managing-documentations">Managing Documentations</h2>
  23. <p>
  24. Documentations can be enabled and disabled in the <a href="/settings">Preferences</a>.
  25. Alternatively, you can enable a documentation by searching for it in the main search
  26. and clicking the "Enable" link in the results.
  27. For faster and better search, only enable the documentations you plan on actively using.
  28. <p>
  29. Once a documentation is enabled, it becomes part of the search and its content can be downloaded for offline access — and faster page loads when online — in the <a href="/offline">Offline</a> area.
  30. <h2 class="_block-heading" id="search">Search</h2>
  31. <p>
  32. The search is case-insensitive and ignores whitespace. It supports fuzzy matching
  33. (e.g. <code class="_label">bgcp</code> matches <code class="_label">background-clip</code>)
  34. as well as aliases (full list <a href="#aliases">below</a>).
  35. <dl>
  36. <dt id="doc_search">Searching a single documentation
  37. <dd>
  38. The search can be scoped to a single documentation by typing its name (or an abbreviation)
  39. and pressing <code class="_label">tab</code> (<code class="_label">space</code>&nbsp;on mobile).
  40. For example, to search the JavaScript documentation, enter <code class="_label">javascript</code>
  41. or <code class="_label">js</code>, then <code class="_label">tab</code>.<br>
  42. To clear the current scope, empty the search field and hit <code class="_label">backspace</code> or
  43. <code class="_label">esc</code>.
  44. <dt id="url_search">Prefilling the search field
  45. <dd>
  46. The search can be prefilled from the URL by visiting <a href="/#q=keyword" target="_top">devdocs.io/#q=keyword</a>.
  47. Characters after <code class="_label">#q=</code> will be used as search query.<br>
  48. To search a single documentation, add its name (or an abbreviation) and a space before the keyword:
  49. <a href="/#q=js%20date" target="_top">devdocs.io/#q=js date</a>.
  50. <dt id="browser_search">Searching using the address bar
  51. <dd>
  52. DevDocs supports OpenSearch. It can easily be installed as a search engine on most web browsers:
  53. <ul>
  54. <li>On Chrome, the setup is done automatically. Simply press <code class="_label">tab</code> when devdocs.io is autocompleted
  55. in the omnibox (to set a custom keyword, click <em>Manage search engines\u2026</em> in Chrome's settings).
  56. <li>On Firefox, <a href="https://support.mozilla.org/en-US/kb/add-or-remove-search-engine-firefox#w_add-a-search-engine-from-the-address-bar">add the search from the address bar</a>:
  57. Click ••• in the address bar, and select <em>Add Search Engine</em>. Then, you can add a keyword for this search engine in the preferences.
  58. </dl>
  59. <p>
  60. <i>Note: the above search features only work for documentations that are enabled.</i>
  61. <h2 class="_block-heading" id="shortcuts">Keyboard Shortcuts</h2>
  62. <h3 class="_shortcuts-title">Sidebar</h3>
  63. <dl class="_shortcuts-dl">
  64. <dt class="_shortcuts-dt">
  65. #{if arrowScroll then '<code class="_shortcut-code">shift</code> + ' else ''}
  66. <code class="_shortcut-code">&darr;</code>
  67. <code class="_shortcut-code">&uarr;</code>
  68. <dd class="_shortcuts-dd">Move selection
  69. <dt class="_shortcuts-dt">
  70. #{if arrowScroll then '<code class="_shortcut-code">shift</code> + ' else ''}
  71. <code class="_shortcut-code">&rarr;</code>
  72. <code class="_shortcut-code">&larr;</code>
  73. <dd class="_shortcuts-dd">Show/hide sub-list
  74. <dt class="_shortcuts-dt">
  75. <code class="_shortcut-code">enter</code>
  76. <dd class="_shortcuts-dd">Open selection
  77. <dt class="_shortcuts-dt">
  78. <code class="_shortcut-code">#{ctrlKey} + enter</code>
  79. <dd class="_shortcuts-dd">Open selection in a new tab
  80. <dt class="_shortcuts-dt">
  81. <code class="_shortcut-code">alt + r</code>
  82. <dd class="_shortcuts-dd">Reveal current page in sidebar
  83. </dl>
  84. <h3 class="_shortcuts-title">Browsing</h3>
  85. <dl class="_shortcuts-dl">
  86. <dt class="_shortcuts-dt">
  87. <code class="_shortcut-code">#{navKey} + &larr;</code>
  88. <code class="_shortcut-code">#{navKey} + &rarr;</code>
  89. <dd class="_shortcuts-dd">Go back/forward
  90. <dt class="_shortcuts-dt">
  91. #{if arrowScroll
  92. '<code class="_shortcut-code">&darr;</code> ' +
  93. '<code class="_shortcut-code">&uarr;</code>'
  94. else
  95. '<code class="_shortcut-code">alt + &darr;</code> ' +
  96. '<code class="_shortcut-code">alt + &uarr;</code>' +
  97. '<br>' +
  98. '<code class="_shortcut-code">shift + &darr;</code> ' +
  99. '<code class="_shortcut-code">shift + &uarr;</code>'}
  100. <dd class="_shortcuts-dd">Scroll step by step<br><br>
  101. <dt class="_shortcuts-dt">
  102. <code class="_shortcut-code">space</code>
  103. <code class="_shortcut-code">shift + space</code>
  104. <dd class="_shortcuts-dd">Scroll screen by screen
  105. <dt class="_shortcuts-dt">
  106. <code class="_shortcut-code">#{ctrlKey} + &uarr;</code>
  107. <code class="_shortcut-code">#{ctrlKey} + &darr;</code>
  108. <dd class="_shortcuts-dd">Scroll to the top/bottom
  109. <dt class="_shortcuts-dt">
  110. <code class="_shortcut-code">alt + f</code>
  111. <dd class="_shortcuts-dd">Focus first link in the content area<br>(press tab to focus the other links)
  112. </dl>
  113. <h3 class="_shortcuts-title">App</h3>
  114. <dl class="_shortcuts-dl">
  115. <dt class="_shortcuts-dt">
  116. <code class="_shortcut-code">ctrl + ,</code>
  117. <dd class="_shortcuts-dd">Open preferences
  118. <dt class="_shortcuts-dt">
  119. <code class="_shortcut-code">esc</code>
  120. <dd class="_shortcuts-dd">Clear search field / reset UI
  121. <dt class="_shortcuts-dt">
  122. <code class="_shortcut-code">?</code>
  123. <dd class="_shortcuts-dd">Show this page
  124. </dl>
  125. <h3 class="_shortcuts-title">Miscellaneous</h3>
  126. <dl class="_shortcuts-dl">
  127. <dt class="_shortcuts-dt">
  128. <code class="_shortcut-code">alt + c</code>
  129. <dd class="_shortcuts-dd">Copy URL of original page
  130. <dt class="_shortcuts-dt">
  131. <code class="_shortcut-code">alt + o</code>
  132. <dd class="_shortcuts-dd">Open original page
  133. <dt class="_shortcuts-dt">
  134. <code class="_shortcut-code">alt + g</code>
  135. <dd class="_shortcuts-dd">Search on Google
  136. <dt class="_shortcuts-dt">
  137. <code class="_shortcut-code">alt + s</code>
  138. <dd class="_shortcuts-dd">Search on Stack Overflow
  139. <dt class="_shortcuts-dt">
  140. <code class="_shortcut-code">alt + d</code>
  141. <dd class="_shortcuts-dd">Search on DuckDuckGo
  142. </dl>
  143. <p class="_note _note-green">
  144. <strong>Tip:</strong> If the cursor is no longer in the search field, press <code class="_label">/</code> or
  145. continue to type and it will refocus the search field and start showing new results.
  146. <h2 class="_block-heading" id="aliases">Search Aliases</h2>
  147. <div class="_aliases">
  148. <table>
  149. <tr>
  150. <th>Word
  151. <th>Alias
  152. #{("<tr><td class=\"_code\">#{key}<td class=\"_code\">#{value}" for key, value of aliases_one).join('')}
  153. </table>
  154. <table>
  155. <tr>
  156. <th>Word
  157. <th>Alias
  158. #{("<tr><td class=\"_code\">#{key}<td class=\"_code\">#{value}" for key, value of aliases_two).join('')}
  159. </table>
  160. </div>
  161. <p>Feel free to suggest new aliases on <a href="https://github.com/freeCodeCamp/devdocs/issues/new">GitHub</a>.
  162. """