From 5412829c959b8f4a7b543f65a40a62570363e365 Mon Sep 17 00:00:00 2001 From: Evgeny Blokhin Date: Tue, 31 Jan 2023 00:19:05 +0100 Subject: [PATCH] Fix bug with less-known elements display and polish visuals --- src_js/markup.js | 2 +- src_js/ptable.js | 18 +++++++++++++----- webassets/ermac.css | 1 + 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/src_js/markup.js b/src_js/markup.js index 6dd6d7e..b9bc9ba 100755 --- a/src_js/markup.js +++ b/src_js/markup.js @@ -297,7 +297,7 @@ function register_html(){


- + diff --git a/src_js/ptable.js b/src_js/ptable.js index aced8fb..491e551 100644 --- a/src_js/ptable.js +++ b/src_js/ptable.js @@ -211,7 +211,7 @@ function render_left(data){ const parent = document.getElementById('ptable_previews'); parent.className = ""; parent.classList.add('ptable_dtype_' + wmgui.ptable.dtypes); - parent.innerHTML = header + (data.out.length ? build_thumbs_ph(data.out) : '') + wmgui.ptable.subphases_button; + parent.innerHTML = header + (data.out.length ? build_thumbs_ph(data.out) : '

No results

') + wmgui.ptable.subphases_button; if (data.out.length < 10) wmgui.ptable.vis_fixed = false; // prevent screen jumping @@ -220,8 +220,12 @@ function render_left(data){ if (els.length){ const rnd_i = Math.floor(Math.random() * els.length); els[rnd_i].parentNode.classList.add('active'); - const phid = els[rnd_i].getAttribute('rel'); - document.querySelector('#ptable_vis > iframe').contentWindow.location.hash = '#' + wmgui.phase_endpoint + '?phid=' + phid + '&struct=1'; + const phid = els[rnd_i].getAttribute('rel'), + target = document.querySelector('#ptable_vis > iframe'), + target_addr = '#' + wmgui.phase_endpoint + '?phid=' + phid + '&struct=1'; + + if (target) target.contentWindow.location.hash = target_addr; + else document.getElementById('ptable_vis').innerHTML = ''; } else document.getElementById('ptable_vis').innerHTML = ''; @@ -230,8 +234,12 @@ function render_left(data){ if (els.length){ const rnd_i = Math.floor(Math.random() * els.length); els[rnd_i].parentNode.classList.add('active'); - const phid = els[rnd_i].getAttribute('rel'); - document.querySelector('#ptable_vis > iframe').contentWindow.location.replace(get_visavis_url({phid: phid}, 'graph', window.innerHeight - 50)); + const phid = els[rnd_i].getAttribute('rel'), + target = document.querySelector('#ptable_vis > iframe'), + target_addr = get_visavis_url({phid: phid}, 'graph', window.innerHeight - 50); + + if (target) target.contentWindow.location.replace(target_addr); + else document.getElementById('ptable_vis').innerHTML = ''; } else document.getElementById('ptable_vis').innerHTML = ''; } diff --git a/webassets/ermac.css b/webassets/ermac.css index e27daac..887936d 100755 --- a/webassets/ermac.css +++ b/webassets/ermac.css @@ -427,6 +427,7 @@ div.sops_col{letter-spacing:1px;} #ptable_results{width:99%;margin:0 auto;} #ptable_previews{float:left;width:50%;text-align:left;padding-top:20px;background:#fff;} +#ptable_previews > p{text-align:center;letter-spacing:0.5px;line-height:60px;} #ptable_previews > div.subphases_trigger{width:50%;margin:30px auto;font-size:0.95em;} #ptable_previews > div.subphases_trigger > span{font-size:26px;} #ptable_previews.ptable_dtype_2 > div.gallery_item:hover, div.gallery_item.active, #ptable_previews.ptable_dtype_3 > div.gallery_item:hover, div.gallery_item.active{background:#cf9;}