Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

no-JS fixes #852

Merged
merged 6 commits into from Dec 4, 2018
Merged

no-JS fixes #852

merged 6 commits into from Dec 4, 2018

Conversation

chappjc
Copy link
Member

@chappjc chappjc commented Dec 3, 2018

This addresses a number of issues in browsers with JavaScript disabled.

Set fallback fonts of the same class as the webfonts:

  • monospace for inconsolata-v15-latin-regular
  • sans-serif for source-sans-pro-v9-latin-regular

Hide all "Age" columns with jsonly class since all age values are set
via stimulus.js.
Also hide all ages in "(X ago)" spots.
Hide the sun/moon icon with jsonly since it is also a webfont. Ideally
both the Night Mode and Enable Hot Keys menu items would be hidden
entirely, but they are difficult to eliminate. d-inline-block uses
display: inline-block !important, which seems to neutralize jQuery's show().
Hide the "since last block" and websocket status footer elements.
Prevent text like Coinbase and Stakebase from being hash-elided by
defining a new flag, TextIsHash, that is set in Go to avoid heuristics
in the frontend.

@chappjc chappjc added this to the 3.1 milestone Dec 3, 2018
@chappjc
Copy link
Member Author

chappjc commented Dec 3, 2018

Before:

image
In the above image, note the following issues: font, "Coinbase" text jumbled because of hashElide, non-functional footer elements, and "( ago)" in the TIME.

After:

image

The other views show the removed "Age" columns, etc.

Copy link
Member

@buck54321 buck54321 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Other than the comments below, I would maybe consider hiding the /ticketpricewindows and /charts links from the hamburger menu, as those pages are pretty much worthless without js.

I put in a PR on your branch for reference or merge.

views/block.tmpl Outdated Show resolved Hide resolved
@@ -77,7 +77,7 @@
{{else}}
<a data-keynav-skip href="https://explorer.dcrdata.org/" title="Home">Switch To Mainnet</a>
{{end}}
<span data-keynav-skip data-action="click->menu#onSunClick" class="jsonly d-inline-block"><span id="sun-icon" class="dcricon-sun-fill no-underline pr-2"></span> Night Mode</span>
<span data-keynav-skip data-action="click->menu#onSunClick" class="jsonly d-inline-block"><span id="sun-icon" class="dcricon-sun-fill no-underline pr-2 jsonly"></span> Night Mode</span>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There was already a .jsonly on the containing span, but there were a number of things coming together here to make this not work.

First, bootstrap d-inline-block's definition is display: inline-block!important; which is the highest specificity, so .jsonly's display: none; was ineffective. Some quick testing indicates that the d-inline-block tag is unnecessary (maybe due to some change in main.css), so probably just remove it.

Second, the way .jsonly elements are shown programmatically is a little blunt. jQuery show() adds a style attribute with display: inline; because that is the default display mode of anchor and span elements. Instead, the .jsonly class should simply be removed so that non-default display mode from the stylesheets can take precedence.

$('.jsonly').removeClass('jsonly')

Of course, changes in index.js will conflict with the SCSS PR, so that stinks.

Third, display: block; was being assigned with a high specificity here, so .jsonly was again innefective.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I discovered the d-inline-block issue, as I noted in the PR description, but I see it's quite a bit worse here. I considered trying a removeClass, but decided not to do anything too drastic. I'll leave this issue until after the bigger PRs go in.

views/mempool.tmpl Outdated Show resolved Hide resolved
@chappjc
Copy link
Member Author

chappjc commented Dec 4, 2018

@buck54321 Thanks for your PR. Changes merged in. Testing it out.

@chappjc chappjc added the bug-fix label Dec 4, 2018
chappjc and others added 5 commits December 4, 2018 08:38
Set fallback fonts of the same class as the webfonts:
- monospace for inconsolata-v15-latin-regular
- sans-serif for source-sans-pro-v9-latin-regular
Hide all "Age" columns with jsonly class since all age values are set
via stimulus.js.
Also hide all ages in "(X ago)" spots.
Hide the sun/moon icon with jsonly since it is also a webfont. Ideally
both the Night Mode and Enable Hot Keys menu items would be hidden
entirely, but they are difficult to eliminate.
Prevent text like Coinbase and Stakebase from being hash-elided by
defining a new flag, TextIsHash, that is set in Go to avoid heuristics
in the frontend.
@chappjc
Copy link
Member Author

chappjc commented Dec 4, 2018

Seems all good now. I had to put the #menu span.jsonly, a.jsonly into the new navigation.scss, but it's working again.

@chappjc chappjc merged commit 720cfa6 into decred:master Dec 4, 2018
@chappjc chappjc deleted the no-js-fixes branch December 4, 2018 15:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants