settings_tmpl.js 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. themeOption = ({ label, value }, settings) -> """
  2. <label class="_settings-label _theme-label">
  3. <input type="radio" name="theme" value="#{value}"#{if settings.theme == value then ' checked' else ''}>
  4. #{label}
  5. </label>
  6. """
  7. app.templates.settingsPage = (settings) -> """
  8. <h1 class="_lined-heading">Preferences</h1>
  9. <div class="_settings-fieldset">
  10. <h2 class="_settings-legend">Theme:</h2>
  11. <div class="_settings-inputs">
  12. #{if settings.autoSupported
  13. themeOption label: "Automatic <small>Matches system setting</small>", value: "auto", settings
  14. else
  15. ""}
  16. #{themeOption label: "Light", value: "default", settings}
  17. #{themeOption label: "Dark", value: "dark", settings}
  18. </div>
  19. </div>
  20. <div class="_settings-fieldset">
  21. <h2 class="_settings-legend">General:</h2>
  22. <div class="_settings-inputs">
  23. <label class="_settings-label _setting-max-width">
  24. <input type="checkbox" form="settings" name="layout" value="_max-width"#{if settings['_max-width'] then ' checked' else ''}>Enable fixed-width layout
  25. </label>
  26. <label class="_settings-label _setting-text-justify-hyphenate">
  27. <input type="checkbox" form="settings" name="layout" value="_text-justify-hyphenate"#{if settings['_text-justify-hyphenate'] then ' checked' else ''}>Enable justified layout and automatic hyphenation
  28. </label>
  29. <label class="_settings-label _hide-on-mobile">
  30. <input type="checkbox" form="settings" name="layout" value="_sidebar-hidden"#{if settings['_sidebar-hidden'] then ' checked' else ''}>Automatically hide and show the sidebar
  31. <small>Tip: drag the edge of the sidebar to resize it.</small>
  32. </label>
  33. <label class="_settings-label _hide-on-mobile">
  34. <input type="checkbox" form="settings" name="noAutofocus" value="_no-autofocus"#{if settings.noAutofocus then ' checked' else ''}>Disable autofocus of search input
  35. </label>
  36. <label class="_settings-label">
  37. <input type="checkbox" form="settings" name="autoInstall" value="_auto-install"#{if settings.autoInstall then ' checked' else ''}>Automatically download documentation for offline use
  38. <small>Only enable this when bandwidth isn't a concern to you.</small>
  39. </label>
  40. <label class="_settings-label _hide-in-development">
  41. <input type="checkbox" form="settings" name="analyticsConsent"#{if settings.analyticsConsent then ' checked' else ''}>Enable tracking cookies
  42. <small>With this checked, we enable Google Analytics and Gauges to collect anonymous traffic information.</small>
  43. </label>
  44. </div>
  45. </div>
  46. <div class="_settings-fieldset _hide-on-mobile">
  47. <h2 class="_settings-legend">Scrolling:</h2>
  48. <div class="_settings-inputs">
  49. <label class="_settings-label">
  50. <input type="checkbox" form="settings" name="smoothScroll" value="1"#{if settings.smoothScroll then ' checked' else ''}>Use smooth scrolling
  51. </label>
  52. <label class="_settings-label _setting-native-scrollbar">
  53. <input type="checkbox" form="settings" name="layout" value="_native-scrollbars"#{if settings['_native-scrollbars'] then ' checked' else ''}>Use native scrollbars
  54. </label>
  55. <label class="_settings-label">
  56. <input type="checkbox" form="settings" name="arrowScroll" value="1"#{if settings.arrowScroll then ' checked' else ''}>Use arrow keys to scroll the main content area
  57. <small>With this checked, use <code class="_label">shift</code> + <code class="_label">&uarr;</code><code class="_label">&darr;</code><code class="_label">&larr;</code><code class="_label">&rarr;</code> to navigate the sidebar.</small>
  58. </label>
  59. <label class="_settings-label">
  60. <input type="checkbox" form="settings" name="spaceScroll" value="1"#{if settings.spaceScroll then ' checked' else ''}>Use spacebar to scroll during search
  61. </label>
  62. <label class="_settings-label">
  63. <input type="number" step="0.1" form="settings" name="spaceTimeout" min="0" max="5" value="#{settings.spaceTimeout}"> Delay until you can scroll by pressing space
  64. <small>Time in seconds</small>
  65. </label>
  66. </div>
  67. </div>
  68. <p class="_hide-on-mobile">
  69. <button type="button" class="_btn" data-action="export">Export</button>
  70. <label class="_btn _file-btn"><input type="file" form="settings" name="import" accept=".json">Import</label>
  71. <p>
  72. <button type="button" class="_btn-link _reset-btn" data-behavior="reset">Reset all preferences and data</button>
  73. """