Skip to content

Commit

Permalink
Fix bug with less-known elements display and polish visuals
Browse files Browse the repository at this point in the history
  • Loading branch information
blokhin committed Jan 30, 2023
1 parent f9b2544 commit 5412829
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src_js/markup.js
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ function register_html(){
<input type="radio" name="ptable_dtypes" id="ptable_dtypes_1" value="1" checked><label for="ptable_dtypes_1"> phase diagrams</label><br />
<input type="radio" name="ptable_dtypes" id="ptable_dtypes_2" value="2"><label for="ptable_dtypes_2"> crystal structure counts</label><br />
<input type="radio" name="ptable_dtypes" id="ptable_dtypes_3" value="3"><label for="ptable_dtypes_3"> physical property counts</label><br />
<input type="radio" name="ptable_dtypes" id="ptable_dtypes_0" value="0"><label for="ptable_dtypes_0"> empty cells</label>
<input type="radio" name="ptable_dtypes" id="ptable_dtypes_0" value="0"><label for="ptable_dtypes_0"> empty table</label>
</div>
</div>
Expand Down
18 changes: 13 additions & 5 deletions src_js/ptable.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) : '<img src="' + wmgui.static_host + '/question.svg" width=100 />') + wmgui.ptable.subphases_button;
parent.innerHTML = header + (data.out.length ? build_thumbs_ph(data.out) : '<p>No results</p>') + wmgui.ptable.subphases_button;

if (data.out.length < 10) wmgui.ptable.vis_fixed = false; // prevent screen jumping

Expand All @@ -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 = '<iframe frameborder=0 scrolling="no" width="100%" height="850" src="' + wmgui.v_player_addr_tpl + target_addr + '"></iframe>';

} else document.getElementById('ptable_vis').innerHTML = '';

Expand All @@ -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 = '<iframe frameborder=0 scrolling="no" width="100%" height="850" src="' + target_addr + '"></iframe>';

} else document.getElementById('ptable_vis').innerHTML = '';
}
Expand Down
1 change: 1 addition & 0 deletions webassets/ermac.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 5412829

Please sign in to comment.