Skip to content

Commit bfc8215

Browse files
Disables the feedback mechanism (#1483)
* Disables the feedback mechanism * Ignore generated files and build the one-page book (#1482) * Apply suggestion from @chrishtr Change from email to github --------- Co-authored-by: Chris Harrelson <3453258+chrishtr@users.noreply.github.com>
1 parent fb6a72e commit bfc8215

9 files changed

Lines changed: 27 additions & 27 deletions

File tree

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,7 @@ package.json
3030
.coverage
3131
bin/
3232
lib/
33-
pyvenv.cfg
33+
pyvenv.cfg
34+
links.txt
35+
integra
36+
infra/*.pickle

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ EXAMPLE_HTML=$(patsubst src/example%.html,%,$(wildcard src/example*.html))
1515
EXAMPLE_JS=$(patsubst src/example%.js,%,$(wildcard src/example*.js))
1616
EXAMPLE_CSS=$(patsubst src/example%.css,%,$(wildcard src/example*.css))
1717

18-
book: $(patsubst %,www/%.html,$(CHAPTERS)) www/rss.xml widgets examples www/index.html
18+
book: $(patsubst %,www/%.html,$(CHAPTERS)) www/rss.xml widgets examples www/index.html www/onepage.html
1919
examples: $(patsubst %,www/examples/example%.html,$(EXAMPLE_HTML)) \
2020
$(patsubst %,www/examples/example%.js,$(EXAMPLE_JS)) \
2121
$(patsubst %,www/examples/example%.css,$(EXAMPLE_CSS))

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@ The source code contains:
1717
- A template and code for converting the book to HTML, in `infra/`
1818
- Chapter-by-chapter implementations of the browser, in `src/`
1919
- Styling for the book's website, in `www/`
20-
- The book's built-in feedback system, in `www/`, including JavaScript
21-
and the Python backend.
20+
- The Python backend for the book's former feedback system, in `www/` and
21+
`infra/`.
2222

23-
We prefer to receive typos and small comments on the text using the
24-
book's built-in feedback tools, which you can enable with `Ctrl+E`.
23+
The book's built-in feedback system is disabled. Please [open a GitHub issue](https://github.com/browserengineering/book/issues)
24+
with typos or small comments about the text.
2525

2626
You can run the book's built-in checks with:
2727

book/invalidation.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,9 @@ there are other text editing APIs that can't be. For example, the
5151
layout, just paint.
5252

5353
[^amazing-ce]: The `contenteditable` attribute can turn any element on
54-
any page into a living document. It's how we implemented the "typo"
55-
feature for this book: type `Ctrl-E` (or `Cmd-E` on a Mac) to turn
56-
it on. The source code is [on the website](https://browser.engineering/feedback.js); see the
57-
`typo_mode` function for the `contenteditable` attribute.
54+
any page into a living document. When we were first writing this book,
55+
we used it to implement a typo feature on this website, so users could
56+
make corrections and send them to us for review.
5857

5958
::: {.web-only .demo contenteditable=true}
6059
Click on this <i>formatted</i> <b>text</b> to edit it, including rich text!

book/preface.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -111,11 +111,9 @@ me to join the adventure. (Turns out Pavel and I had the same idea!)
111111
A final note
112112
============
113113

114-
This book is, and will remain, a work in progress. Please leave
115-
comments and mark typos; the book has built-in feedback tools, which
116-
you can enable with `Ctrl-E` (or `Cmd-E` on a Mac). The full source
117-
code is also available [on GitHub][github], though we prefer to
118-
receive comments through the built-in tools.
114+
This book is, and will remain, a work in progress. Please [file a github issue](https://github.com/browserengineering/book/issues/new)
115+
with comments or typos. The full source code is also available
116+
[on GitHub][github].
119117

120118
[github]: https://github.com/browserengineering/book
121119

infra/api.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -132,20 +132,20 @@ def __iter__(self):
132132

133133
DATA = Data("db.json")
134134

135+
def feedback_disabled():
136+
bottle.abort(410, "Feedback submission is disabled.")
137+
135138
@bottle.post("/api/typo")
136139
def typo():
137-
data = json.load(bottle.request.body)
138-
DATA.typo(**data)
140+
feedback_disabled()
139141

140142
@bottle.post("/api/text_comment")
141143
def text_comment():
142-
data = json.load(bottle.request.body)
143-
DATA.text_comment(**data)
144+
feedback_disabled()
144145

145146
@bottle.post("/api/chapter_comment")
146147
def comment():
147-
data = json.load(bottle.request.body)
148-
DATA.chapter_comment(**data)
148+
feedback_disabled()
149149

150150
@bottle.post("/api/quiz_telemetry", method=['OPTIONS', 'POST'])
151151
def quiz_telemetry():

infra/template.html

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -118,15 +118,10 @@ <h1 class="title">$title$</h1>
118118
</nav>
119119
$endif$
120120

121-
$if(chapter)$
122-
<p>Did you find this chapter useful? <button id=feedback-button>Send us feedback!</button></p>
123-
$endif$
124-
125121
<footer>
126122
&copy; 2018&ndash;2023 <a href="https://pavpanchekha.com">Pavel Panchekha</a> &amp; <a href="https://twitter.com/chrishtr">Chris Harrelson</a>
127123
</footer>
128124

129-
<script type="text/javascript" defer src="$base$feedback.js"></script>
130125
<script type="text/javascript" defer src="$base$book.js"></script>
131126
$if(show_quiz)$<script type="text/javascript" defer async src="$base$quiz-embed.iife.js"></script>$endif$
132127
</body>

www/feedback.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@
55
// This code is written in a bit of an odd style to avoid error
66
// messages in the WBE browser. There's a lot of old-school JS.
77

8+
// Retained for historical reference, but the public feedback mechanism is
9+
// disabled. The server also rejects all feedback submissions.
10+
var FEEDBACK_ENABLED = false;
11+
812
var chapter_overlay;
913

1014
function ctrl_key_pressed(e) {
@@ -25,6 +29,7 @@ function ctrl_key_name() {
2529

2630
if (document.addEventListener)
2731
document.addEventListener("DOMContentLoaded", function() {
32+
if (!FEEDBACK_ENABLED) return;
2833
if (window.localStorage["edit"] == "true") {
2934
typo_mode();
3035
}

www/thanks.view

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ We want to thank our
4545

4646
<p>
4747
Moreover, we thank <em>contributors</em> who submitted typo fixes,
48-
questions, and comments through the book's built-in feedback tools,
48+
questions, and comments through a feedback tool in earlier drafts of this book,
4949
or through Github:
5050
{{", ".join(contribute[:-1])}}, and {{contribute[-1]}}.
5151
</p>

0 commit comments

Comments
 (0)