Skip to content

Commit

Permalink
Don't use inline JS where possible.
Browse files Browse the repository at this point in the history
  • Loading branch information
mnot committed Dec 21, 2023
1 parent 360457b commit 759e89d
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 8 deletions.
6 changes: 2 additions & 4 deletions redbot/formatter/templates/footer.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,9 @@
<p class="navigation">
version {{ redbot_version }} (httplint {{ httplint_version }}) |
<a href="https://REDbot.org/about/">about</a> |
<script type="text/javascript" nonce="{{ nonce }}">
document.write('<a href="#help" id="help"><strong>help</strong></a> |')
</script>
<span class="js"><a href="#help" id="help"><strong>help</strong></a> |</span>
<span class="help hidden">Drag the bookmarklet to your bookmark bar - it makes checking easy!</span>
<a href="javascript:(function(){window.open('{{ baseuri }}?uri='+encodeURIComponent(location))})();"
<a class="js" href="javascript:(function(){window.open('{{ baseuri }}?uri='+encodeURIComponent(location))})();"
title="drag me to your toolbar to use REDbot any time.">REDbot</a> bookmarklet
</p>

Expand Down
6 changes: 2 additions & 4 deletions redbot/formatter/templates/response_finish.html
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,8 @@

<br/>

<div class='option' title='View this response content (with any gzip compression removed)'>
<script type="text/javascript" nonce="{{ nonce }}">
document.write("<a href='#' id='body_view' accesskey='b'>view content</a>")
</script>
<div class='option js' title='View this response content (with any gzip compression removed)'>
<a href='#' id='body_view' accesskey='b'>view content</a>
</div>

{% if is_resource %}
Expand Down
4 changes: 4 additions & 0 deletions src/js/red_script.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
import { qs, qsa, docReady, toggleHidden, config } from './red_util.js'

docReady(function () {
qsa('.js', function (item) {
item.style.display = 'unset'
})

qsa('#request_form, form.link', function (form) {
form.onsubmit = captchaLink
})
Expand Down
4 changes: 4 additions & 0 deletions src/scss/red_layout.scss
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@ h3 {
display: none;
}

.js {
display: none;
}

.hilight {
color: #d33;
}
Expand Down

0 comments on commit 759e89d

Please sign in to comment.