[devdocsgjs/main: 1724/1867] Added a checkbox to enable scroll by space
- From: Andy Holmes <andyholmes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [devdocsgjs/main: 1724/1867] Added a checkbox to enable scroll by space
- Date: Fri, 19 Nov 2021 23:48:16 +0000 (UTC)
commit 7932a457af5090bf9a3e1e5b5812de17ad673901
Author: Shashank Jain <jain362012 gmail com>
Date: Mon Jun 14 21:15:33 2021 +0530
Added a checkbox to enable scroll by space
assets/javascripts/app/settings.coffee | 2 ++
assets/javascripts/app/shortcuts.coffee | 5 ++++-
assets/javascripts/templates/pages/settings_tmpl.coffee | 3 +++
assets/javascripts/views/content/settings_page.coffee | 7 +++++++
4 files changed, 16 insertions(+), 1 deletion(-)
---
diff --git a/assets/javascripts/app/settings.coffee b/assets/javascripts/app/settings.coffee
index d3fc93e1..6c51e261 100644
--- a/assets/javascripts/app/settings.coffee
+++ b/assets/javascripts/app/settings.coffee
@@ -13,6 +13,7 @@ class app.Settings
'size'
'tips'
'autoInstall'
+ 'spaceScroll'
]
INTERNAL_KEYS = [
@@ -33,6 +34,7 @@ class app.Settings
schema: 1
analyticsConsent: false
theme: 'auto'
+ spaceScroll: 0
constructor: ->
@store = new CookiesStore
diff --git a/assets/javascripts/app/shortcuts.coffee b/assets/javascripts/app/shortcuts.coffee
index edd3336e..8ee6e7ea 100644
--- a/assets/javascripts/app/shortcuts.coffee
+++ b/assets/javascripts/app/shortcuts.coffee
@@ -18,6 +18,9 @@ class app.Shortcuts
swapArrowKeysBehavior: ->
app.settings.get('arrowScroll')
+ spaceScroll: ->
+ app.settings.get('spaceScroll')
+
showTip: ->
app.showTip('KeyNav')
@showTip = null
@@ -59,7 +62,7 @@ class app.Shortcuts
@trigger 'escape'
false
when 32
- if event.target.type is 'search' and (not @lastKeypress or @lastKeypress < Date.now() - 3000)
+ if event.target.type is 'search' and @spaceScroll() and (not @lastKeypress or @lastKeypress <
Date.now() - 1000)
@trigger 'pageDown'
false
when 33
diff --git a/assets/javascripts/templates/pages/settings_tmpl.coffee
b/assets/javascripts/templates/pages/settings_tmpl.coffee
index efc9c5a1..b8c7e904 100644
--- a/assets/javascripts/templates/pages/settings_tmpl.coffee
+++ b/assets/javascripts/templates/pages/settings_tmpl.coffee
@@ -56,6 +56,9 @@ app.templates.settingsPage = (settings) -> """
<input type="checkbox" form="settings" name="arrowScroll" value="1"#{if settings.arrowScroll then '
checked' else ''}>Use arrow keys to scroll the main content area
<small>With this checked, use <code class="_label">shift</code> + <code
class="_label">↑</code><code class="_label">↓</code><code class="_label">←</code><code
class="_label">→</code> to navigate the sidebar.</small>
</label>
+ <label class="_settings-label">
+ <input type="checkbox" form="settings" name="spaceScroll" value="1"#{if settings.spaceScroll then '
checked' else ''}>Use spacebar to scroll during search
+ </label>
</div>
</div>
diff --git a/assets/javascripts/views/content/settings_page.coffee
b/assets/javascripts/views/content/settings_page.coffee
index 2db7c6bc..020f8b6f 100644
--- a/assets/javascripts/views/content/settings_page.coffee
+++ b/assets/javascripts/views/content/settings_page.coffee
@@ -16,6 +16,7 @@ class app.views.SettingsPage extends app.View
settings.arrowScroll = app.settings.get('arrowScroll')
settings.autoInstall = app.settings.get('autoInstall')
settings.analyticsConsent = app.settings.get('analyticsConsent')
+ settings.spaceScroll = app.settings.get('spaceScroll')
settings.autoSupported = app.settings.autoSupported
settings[layout] = app.settings.hasLayout(layout) for layout in app.settings.LAYOUTS
settings
@@ -40,6 +41,10 @@ class app.views.SettingsPage extends app.View
resetAnalytics() unless enable
return
+ toggleSpaceScroll: (enable) ->
+ app.settings.set('spaceScroll', if enable then 1 else 0)
+ return
+
toggle: (name, enable) ->
app.settings.set(name, enable)
return
@@ -85,6 +90,8 @@ class app.views.SettingsPage extends app.View
@import input.files[0], input
when 'analyticsConsent'
@toggleAnalyticsConsent input.checked
+ when 'spaceScroll'
+ @toggleSpaceScroll input.checked
else
@toggle input.name, input.checked
return
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]