Fix flickering between light and custom themes

pull/3333/head
Victor Baranov 4 years ago
parent 9d6efa6385
commit 1d86967985
  1. 3
      apps/block_scout_web/lib/block_scout_web/templates/layout/app.html.eex

@ -37,12 +37,11 @@
<body> <body>
<% dark_forest_address_var = Application.get_env(:block_scout_web, :dark_forest_address) %> <% dark_forest_address_var = Application.get_env(:block_scout_web, :dark_forest_address) %>
<% dark_forest_address = if dark_forest_address_var, do: String.downcase(dark_forest_address_var), else: nil %> <% dark_forest_address = if dark_forest_address_var, do: String.downcase(dark_forest_address_var), else: nil %>
<script> <script>
function applyCustomMode() { function applyCustomMode() {
const darkForestContractAddressHash = "<%= dark_forest_address %>" const darkForestContractAddressHash = "<%= dark_forest_address %>"
const addressHash = "<%= @address.hash %>".toLowerCase()
if (window.location.pathname.toLowerCase().includes(darkForestContractAddressHash)) { if (window.location.pathname.toLowerCase().includes(darkForestContractAddressHash)) {
document.body.className += " " + "dark-forest-theme-applied"; document.body.className += " " + "dark-forest-theme-applied";
} }

Loading…
Cancel
Save