DF theme: fix flickering at tx page

pull/3333/head
Victor Baranov 4 years ago
parent 35e1b62b81
commit eacb4c4888
  1. 17
      apps/block_scout_web/lib/block_scout_web/templates/layout/app.html.eex
  2. 2
      apps/block_scout_web/lib/block_scout_web/templates/transaction/overview.html.eex

@ -45,6 +45,7 @@
darkForestContractAddressHashes.forEach(darkForestContractAddressHash => { darkForestContractAddressHashes.forEach(darkForestContractAddressHash => {
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";
document.documentElement.className += " " + "dark-forest-theme-applied";
return; return;
} }
}) })
@ -59,6 +60,22 @@
window.onload = applyDarkMode() window.onload = applyDarkMode()
window.onload = applyCustomMode() window.onload = applyCustomMode()
</script> </script>
<%= cond do %>
<% (
@view_module == Elixir.BlockScoutWeb.TransactionView ||
@view_module == Elixir.BlockScoutWeb.TransactionInternalTransactionView ||
@view_module == Elixir.BlockScoutWeb.TransactionLogView ||
@view_module == Elixir.BlockScoutWeb.TransactionRawTraceView ||
@view_module == Elixir.BlockScoutWeb.TransactionTokenTransferView
) -> %>
<script>
if (document.getElementsByTagName("body")[0]) {
document.getElementsByTagName("body")[0].style.visibility = "hidden";
}
</script>
<% true -> %>
<%= nil %>
<% end %>
<div class="layout-container"> <div class="layout-container">
<%= if not Explorer.Chain.finished_indexing?() do %> <%= if not Explorer.Chain.finished_indexing?() do %>
<div class="alert alert-warning text-center mb-0 p-3" data-selector="indexed-status"> <div class="alert alert-warning text-center mb-0 p-3" data-selector="indexed-status">

@ -11,8 +11,10 @@
darkForestContractAddressHashes.forEach(darkForestContractAddressHash => { darkForestContractAddressHashes.forEach(darkForestContractAddressHash => {
if (to_address == darkForestContractAddressHash) { if (to_address == darkForestContractAddressHash) {
document.body.className += " " + "dark-forest-theme-applied"; document.body.className += " " + "dark-forest-theme-applied";
document.documentElement.className += " " + "dark-forest-theme-applied";
return; return;
} }
document.getElementsByTagName("body")[0].style.visibility = "visible";
}) })
} }
window.onload = applyCustomMode() window.onload = applyCustomMode()

Loading…
Cancel
Save