help_tmpl.coffee 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. ctrlKey = if $.isMac() then 'cmd' else 'ctrl'
  2. navKey = if $.isMac() then 'cmd' else 'alt'
  3. app.templates.helpPage = """
  4. <nav class="_toc" role="directory">
  5. <h3 class="_toc-title">Table of Contents</h3>
  6. <ul class="_toc-list">
  7. <li><a href="#search">Search</a>
  8. <li><a href="#shortcuts">Keyboard Shortcuts</a>
  9. <li><a href="#aliases">Search Aliases</a>
  10. </ul>
  11. </nav>
  12. <h1 class="_lined-heading" id="search">Help</h2>
  13. <h2 class="_block-heading" id="search">Search</h2>
  14. <p>
  15. The search is case-insensitive. It supports fuzzy matching
  16. (e.g. <code class="_label">bgcp</code> matches <code class="_label">background-clip</code>)
  17. and aliases (<a href="#aliases">full list</a> below).
  18. <dl>
  19. <dt id="doc_search">Searching a single documentation
  20. <dd>
  21. You can scope the search to a single documentation by typing its name (or an abbreviation)
  22. and pressing <code class="_label">Tab</code> (<code class="_label">Space</code> on mobile devices).
  23. For example, to search the JavaScript documentation, enter <code class="_label">javascript</code>
  24. or <code class="_label">js</code>, then <code class="_label">Tab</code>.<br>
  25. To clear the current scope, empty the search field and hit <code class="_label">Backspace</code>.
  26. <dt id="url_search">Prefilling the search field
  27. <dd>
  28. The search field can be prefilled from the URL by visiting <a href="/#q=keyword" target="_top">devdocs.io/#q=keyword</a>.
  29. Characters after <code class="_label">#q=</code> will be used as search query.<br>
  30. To search a single documentation, add its name and a space before the keyword:
  31. <a href="/#q=js%20date" target="_top">devdocs.io/#q=js date</a>.
  32. <dt id="browser_search">Searching using the address bar
  33. <dd>
  34. DevDocs supports OpenSearch. It can easily be installed as a search engine on most web browsers:
  35. <ul>
  36. <li>On Chrome, the setup is done automatically. Simply press <code class="_label">Tab</code> when devdocs.io is autocompleted
  37. in the omnibox (to set a custom keyword, click <em>Manage search engines\u2026</em> in Chrome's settings).
  38. <li>On Firefox, open the search engine list (icon in the search bar) and click <em>Add "DevDocs Search"</em>.
  39. DevDocs is now available in the search bar. You can also search from the location bar by following
  40. <a href="https://support.mozilla.org/en-US/kb/how-search-from-address-bar">these instructions</a>.
  41. </dl>
  42. <h2 class="_block-heading" id="shortcuts">Keyboard Shortcuts</h2>
  43. <h3 class="_shortcuts-title">Sidebar</h3>
  44. <dl class="_shortcuts-dl">
  45. <dt class="_shortcuts-dt">
  46. <code class="_shortcut-code">&darr;</code>
  47. <code class="_shortcut-code">&uarr;</code>
  48. <dd class="_shortcuts-dd">Move selection
  49. <dt class="_shortcuts-dt">
  50. <code class="_shortcut-code">&rarr;</code>
  51. <code class="_shortcut-code">&larr;</code>
  52. <dd class="_shortcuts-dd">Show/hide sub-list
  53. <dt class="_shortcuts-dt">
  54. <code class="_shortcut-code">enter</code>
  55. <dd class="_shortcuts-dd">Open selection
  56. <dt class="_shortcuts-dt">
  57. <code class="_shortcut-code">#{ctrlKey} + enter</code>
  58. <dd class="_shortcuts-dd">Open selection in a new tab
  59. <dt class="_shortcuts-dt">
  60. <code class="_shortcut-code">alt + r</code>
  61. <dd class="_shortcuts-dd">Reveal current page in sidebar
  62. </dl>
  63. <h3 class="_shortcuts-title">Browsing</h3>
  64. <dl class="_shortcuts-dl">
  65. <dt class="_shortcuts-dt">
  66. <code class="_shortcut-code">#{navKey} + &larr;</code>
  67. <code class="_shortcut-code">#{navKey} + &rarr;</code>
  68. <dd class="_shortcuts-dd">Go back/forward
  69. <dt class="_shortcuts-dt">
  70. <code class="_shortcut-code">alt + &darr;</code>
  71. <code class="_shortcut-code">alt + &uarr;</code>
  72. <br>
  73. <code class="_shortcut-code">shift + &darr;</code>
  74. <code class="_shortcut-code">shift + &uarr;</code>
  75. <dd class="_shortcuts-dd">Scroll step by step<br><br>
  76. <dt class="_shortcuts-dt">
  77. <code class="_shortcut-code">space</code>
  78. <code class="_shortcut-code">shift + space</code>
  79. <dd class="_shortcuts-dd">Scroll screen by screen
  80. <dt class="_shortcuts-dt">
  81. <code class="_shortcut-code">#{ctrlKey} + &uarr;</code>
  82. <code class="_shortcut-code">#{ctrlKey} + &darr;</code>
  83. <dd class="_shortcuts-dd">Scroll to the top/bottom
  84. <dt class="_shortcuts-dt">
  85. <code class="_shortcut-code">alt + f</code>
  86. <dd class="_shortcuts-dd">Focus first link in the content area<br>(press tab to focus the other links)
  87. </dl>
  88. <h3 class="_shortcuts-title">App</h3>
  89. <dl class="_shortcuts-dl">
  90. <dt class="_shortcuts-dt">
  91. <code class="_shortcut-code">ctrl + ,</code>
  92. <dd class="_shortcuts-dd">Open preferences
  93. <dt class="_shortcuts-dt">
  94. <code class="_shortcut-code">escape</code>
  95. <dd class="_shortcuts-dd">Reset UI
  96. <dt class="_shortcuts-dt">
  97. <code class="_shortcut-code">?</code>
  98. <dd class="_shortcuts-dd">Show this page
  99. </dl>
  100. <h3 class="_shortcuts-title">Miscellaneous</h3>
  101. <dl class="_shortcuts-dl">
  102. <dt class="_shortcuts-dt">
  103. <code class="_shortcut-code">alt + o</code>
  104. <dd class="_shortcuts-dd">Open original page
  105. <dt class="_shortcuts-dt">
  106. <code class="_shortcut-code">alt + g</code>
  107. <dd class="_shortcuts-dd">Search on Google
  108. <dt class="_shortcuts-dt">
  109. <code class="_shortcut-code">alt + s</code>
  110. <dd class="_shortcuts-dd">Search on Stack Overflow
  111. </dl>
  112. <p class="_note _note-green">
  113. <strong>Tip:</strong> If the cursor is no longer in the search field, press <code class="_label">/</code> or
  114. continue to type and it will refocus the search field and start showing new results.
  115. <h2 class="_block-heading" id="aliases">Search Aliases</h2>
  116. <table>
  117. <tr>
  118. <th>Word
  119. <th>Alias
  120. #{("<tr><td class=\"_code\">#{key}<td class=\"_code\">#{value}" for key, value of app.models.Entry.ALIASES).join('')}
  121. </table>
  122. <p>Feel free to suggest new aliases on <a href="https://github.com/Thibaut/devdocs/issues/new">GitHub</a>.
  123. """