diff --git a/src_js/events.js b/src_js/events.js index 99d19d5..ba805b4 100755 --- a/src_js/events.js +++ b/src_js/events.js @@ -270,7 +270,7 @@ function register_events(){ $('#visualize, #xrpdize').click(function(){ close_vibox(); - launch_iframed_app(this.getAttribute('data-rank')); + launch_db_iframed(this.getAttribute('data-rank')); }); $('#absolidize').click(function(){ @@ -484,6 +484,14 @@ function register_events(){ $('#inquirybox').hide(); }); + $('#close_tr_dialogue').click(function(){ + var value = $("input[name=engines]:checked").val(); + wmgui.engines = (value == 'a') ? value : 'b'; + window.localStorage.setItem(wmgui.store_engines_key, wmgui.engines); + if (wmgui.visavis_working) start_visavis(wmgui.visavis_curtype); + $('#engines_box, #overlay').hide(); + }); + $('#close_ss_dialogue').click(function(){ var x_sort = $('#ss_x > ul > li.ss_x').attr('rel').split('_')[1], y_sort = $('#ss_y > ul > li.ss_y').attr('rel').split('_')[1], @@ -1290,6 +1298,9 @@ function register_events(){ } that.remove(); }); + $('#toggle_engines').click(function(){ + $('#engines_box, #overlay').show(); + }); $('#ss_gear_matrix, #ss_gear_cube').click(function(){ var domain = $(this).attr('id').substr(8); // ss_gear_ if (domain == 'matrix'){ diff --git a/src_js/main_logic.js b/src_js/main_logic.js index 2ef5ed0..3e5777f 100755 --- a/src_js/main_logic.js +++ b/src_js/main_logic.js @@ -328,9 +328,9 @@ function request_search(search, caption, without_history){ show_examples('#examples', true, true); } - if (search.entry && (search.entry.substr(0, 1) == 'S' || search.entry.substr(0, 1) == 'C') && search.entry.indexOf('-') == -1){ - // TODO add also 'P' for plottable entries + if (search.entry){ var that = $('#e__' + search.entry); + if (search.entry.indexOf('-') == -1 && !that.length) that = $('#e__' + search.entry + '-1'); if (that.length && that.attr('data-rank') != 0){ // NB "!=", not "!==" that.removeClass('busy_entry'); open_context(that, true); @@ -765,7 +765,7 @@ function open_context(el, launch_ext){ $('#ctx_col').show(); $('#visualize').attr('data-rank', rank); - $('#xrpdize').attr('data-rank', 99); + $('#xrpdize').attr('data-rank', 99); // FIXME hack $('#visualize, #xrpdize, #absolidize, div.spinoff_pane, li.d_icon').hide(); open_sim_col(entry, entype, rank); @@ -820,7 +820,7 @@ function open_context(el, launch_ext){ (wmgui.mydata_history.indexOf(entry) == -1) ? $('#absolidize').addClass('wmbutton') : $('#absolidize').removeClass('wmbutton'); - if (launch_ext) launch_iframed_app(rank); + if (launch_ext) launch_db_iframed(rank); } } @@ -937,7 +937,7 @@ function close_vibox(){ return false; } -function launch_iframed_app(rank){ +function launch_db_iframed(rank){ var that = $('.busy_entry'); if (!that.length) return; @@ -947,28 +947,34 @@ function launch_iframed_app(rank){ iframe_height; if (entype == 'S'){ - if (rank == 99) { - iframe_src = wmgui.v_xrpd_addr + entry, iframe_height = 550; + if (rank == 99){ + iframe_src = wmgui.engines_addrs[wmgui.engines]['visavis'] + wmgui.path_s_xrpd + entry, iframe_height = 550; } else - iframe_src = wmgui.v_player_addr + entry, iframe_height = 650; + iframe_src = wmgui.engines_addrs[wmgui.engines]['cifplayer'] + wmgui.path_s_entry + entry, iframe_height = 650; } else if (entype == 'P'){ - if (rank == 10) + if (rank == 4 || rank == 9) + iframe_src = wmgui.engines_addrs[wmgui.engines]['visavis'] + wmgui.path_sd_plot + entry, iframe_height = 550; + + else if (rank == 10) iframe_src = wmgui.v_ab_vis_addr + entry, iframe_height = 600; - else - iframe_src = wmgui.v_sd_addr + entry, iframe_height = 550; + + else return; } else { if (rank == 12){ var triple = wmgui.thumbed_display ? $('div.busy_entry > div.gallery_img > p').text() : $('tr.busy_entry > td.c1').text().split(' ')[0]; iframe_src = wmgui.v_pd_3d_addr + triple, iframe_height = 550; - } else - iframe_src = (wmgui.sid ? wmgui.v_pd_addr : wmgui.v_pd_addr_anon) + entry, iframe_height = 600; + } else if (rank == 6) + iframe_src = (wmgui.sid ? wmgui.v_pd_user_addr : wmgui.engines_addrs[wmgui.engines]['visavis'] + wmgui.path_c_entry) + entry, iframe_height = 600; + + else return; if (entry.startswith('C3') || entry.startswith('C4')) wmgui.notify('This entry is now in preparation'); + else if (wmgui.entries_messages[entry]) wmgui.notify(wmgui.entries_messages[entry]); } @@ -1008,7 +1014,6 @@ function start_visavis(plot_type){ wmgui.search_type = 0; wmgui.visavis_working = true; - wmgui.visavis_starting = false; var cur_obj = {total_count: 1}; $.extend(cur_obj, wmgui.search); @@ -1106,11 +1111,11 @@ function stop_visavis(){ function get_visavis_url(request, type, height){ if (wmgui.visavis_curtype == 'pie' && !type) - return wmgui.v_vis_addr + '#' + wmgui.rfn_endpoint + '?q=' + escape(JSON.stringify(request)); + return wmgui.engines_addrs[wmgui.engines]['visavis'] + '#' + wmgui.rfn_endpoint + '?q=' + escape(JSON.stringify(request)); var height_str = height ? ('&visavis_height=' + height) : ''; - return wmgui.v_vis_addr + '#' + wmgui.vis_endpoint + '/' + (type || wmgui.visavis_curtype) + '?q=' + escape(JSON.stringify(request)) + height_str; + return wmgui.engines_addrs[wmgui.engines]['visavis'] + '#' + wmgui.vis_endpoint + '/' + (type || wmgui.visavis_curtype) + '?q=' + escape(JSON.stringify(request)) + height_str; } function describe_perms(perms){ @@ -1445,10 +1450,10 @@ function update_dc(){ var count = 0, cur_str = JSON.stringify(orepr), - cmp_html = ''; + cmp_html = ''; $.each(JSON.parse(window.localStorage.getItem(wmgui.store_history_key) || '[]'), function(n, past){ - if (count > 5) return false; + if (count > 6) return false; var title = [], past_str = JSON.stringify(past); @@ -1459,7 +1464,8 @@ function update_dc(){ cmp_html += ''; count++; }); - cmp_html += ''; + cmp_html += ''; + if (wmgui.engines == 'a') cmp_html += ''; $('#select_cmp_trigger').empty().append(cmp_html); } @@ -1519,7 +1525,7 @@ function show_dunit_info(phid, bid, entry){ var html = '

' + data.out.formula_html.split(' ')[0] + ' ' + (data.out.spg || '?') + ' ' + (data.out.pearson || '—') + '

This phase was reported in ' + data.out.articles_count + ' article' + (data.out.articles_count > 1 ? 's' : '') + '.'; if (data.out.sim_count > 1) html += ' There are ' + data.out.sim_count + ' structurally similar phases from other articles.'; - html += '

' + html += '

'; $('#phase_info').html(html); }).fail(function(xhr, textStatus, errorThrown){ diff --git a/src_js/markup.js b/src_js/markup.js index d86099c..eab8974 100755 --- a/src_js/markup.js +++ b/src_js/markup.js @@ -293,10 +293,10 @@ function register_html(){
Show chemical elements as:
-
-
-
- +
+
+
+
@@ -444,7 +444,7 @@ function register_html(){
-
View
+
View
entries
phases
articles
@@ -780,7 +780,7 @@ function register_html(){
-
+
+ + + diff --git a/src_js/ptable.js b/src_js/ptable.js index 940c82f..f911b8e 100644 --- a/src_js/ptable.js +++ b/src_js/ptable.js @@ -130,11 +130,11 @@ function refresh_ptable_results(elA, elB, elC){ if (els.length == 1){ if (wmgui.ptable.dtypes == 2){ - iframe_addr = wmgui.v_player_addr_tpl; + iframe_addr = wmgui.engines_addrs[wmgui.engines]['cifplayer']; wmgui.ptable.vis_fixed = true; } else if (wmgui.ptable.dtypes == 3){ - iframe_addr = wmgui.v_vis_addr; + iframe_addr = wmgui.engines_addrs[wmgui.engines]['visavis']; wmgui.ptable.vis_fixed = true; } else @@ -148,11 +148,11 @@ function refresh_ptable_results(elA, elB, elC){ ajax_download(null, wmgui.search_endpoint + '?q=' + JSON.stringify(query_pds), render_right); } else if (wmgui.ptable.dtypes == 2){ - iframe_addr = wmgui.v_player_addr_tpl; + iframe_addr = wmgui.engines_addrs[wmgui.engines]['cifplayer']; wmgui.ptable.vis_fixed = true; } else if (wmgui.ptable.dtypes == 3){ - iframe_addr = wmgui.v_vis_addr; + iframe_addr = wmgui.engines_addrs[wmgui.engines]['visavis']; wmgui.ptable.vis_fixed = true; } else @@ -167,10 +167,10 @@ function refresh_ptable_results(elA, elB, elC){ iframe_addr = wmgui.v_pd_3d_addr + els.join('-'); } else if (wmgui.ptable.dtypes == 2){ - iframe_addr = wmgui.v_player_addr_tpl; + iframe_addr = wmgui.engines_addrs[wmgui.engines]['cifplayer']; } else if (wmgui.ptable.dtypes == 3){ - iframe_addr = wmgui.v_vis_addr; + iframe_addr = wmgui.engines_addrs[wmgui.engines]['visavis']; } else document.getElementById('ptable_vis').innerHTML = ''; @@ -216,7 +216,7 @@ function render_left(data){ if (data.out.length < 10) wmgui.ptable.vis_fixed = false; // prevent screen jumping if (wmgui.ptable.dtypes == 2){ - const els = document.querySelectorAll('#ptable_results div.gallery_img'); + const els = document.querySelectorAll('#ptable_results div.gallery_img.renderable'); if (els.length){ const rnd_i = Math.floor(Math.random() * els.length); els[rnd_i].parentNode.classList.add('active'); @@ -225,12 +225,12 @@ function render_left(data){ 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 = ''; } else document.getElementById('ptable_vis').innerHTML = ''; } else if (wmgui.ptable.dtypes == 3){ - const els = document.querySelectorAll('#ptable_results div.gallery_img'); + const els = document.querySelectorAll('#ptable_results div.gallery_img.renderable'); if (els.length){ const rnd_i = Math.floor(Math.random() * els.length); els[rnd_i].parentNode.classList.add('active'); @@ -379,7 +379,7 @@ function build_thumbs_ph(json){ // FIXME duplicates another function *build_thum json.forEach(function(row){ result_html += ''; }); diff --git a/src_js/router.js b/src_js/router.js index 15e77e5..5178e8e 100755 --- a/src_js/router.js +++ b/src_js/router.js @@ -106,11 +106,9 @@ function url__plot(arg){ //if (wmgui.view_mode == 1) switch_view_mode(2); - if (wmgui.visavis_ready) + setTimeout(function(){ start_visavis(plot_type); - - else - wmgui.visavis_starting = true; + }, 0); if (wmgui.tooltip_counter < 2 && (plot_type == 'matrix' || plot_type == 'cube')){ setTimeout(function(){ show_tooltip(wmgui.tooltips['ss_axes'], true) }, 4000); diff --git a/src_js/startup.js b/src_js/startup.js index 54943a8..74073e7 100755 --- a/src_js/startup.js +++ b/src_js/startup.js @@ -17,7 +17,7 @@ function satisfy_requirements(){ $.each(JSON.parse(window.localStorage.getItem(wmgui.store_history_key) || '[]'), function(n, past){ wmgui.tooltip_counter++; - if (n > 7) + if (n > 5) return false; var title = [], @@ -378,6 +378,10 @@ function satisfy_requirements(){ wmgui._selectize_display(wmgui.multiselects['main'], facet, term); } + wmgui.engines = window.localStorage.getItem(wmgui.store_engines_key) || 'a'; + $('#engines_a').prop('checked', wmgui.engines == 'a'); + $('#engines_b').prop('checked', wmgui.engines == 'b'); + //create_floating_slider('density', 42, 'Mg/m3', 10, 900, 10); // EOF satisfy_requirements } diff --git a/src_js/wmsettings.js b/src_js/wmsettings.js index 28c8bca..64ad168 100755 --- a/src_js/wmsettings.js +++ b/src_js/wmsettings.js @@ -92,7 +92,7 @@ wmgui.visavis_curtype = 'pie'; // pie, graph, discovery, matrix, cube, qproj, li wmgui.visavis_ready = false; wmgui.visavis_working = false; wmgui.visavis_terminating = false; -wmgui.visavis_starting = false; +wmgui.visavis_starting = false; // only used by an old engine, to delete TODO wmgui.numerics = { // first 8 are *pseudo_numerics*, client_prop_id > 5000 @@ -140,16 +140,26 @@ wmgui.mydata_endpoint = wmgui.api_host + '/extension/mydata'; wmgui.dd_addr_tpl = wmgui.api_host + '/download'; wmgui.mydata_addr = wmgui.prod ? 'https://absolidix.com' : 'http://localhost:5000'; -// below are resources used in the *iframe* -wmgui.v_player_addr_tpl = '/crystvis/player.html'; -wmgui.v_player_addr = wmgui.v_player_addr_tpl + '#' + wmgui.api_host + '/download/s?fmt=cif&q='; -wmgui.v_pd_addr = wmgui.static_host + '/pd_stub.html#' + wmgui.api_host + '/download/c?fmt=png&q='; -wmgui.v_pd_addr_anon = wmgui.static_host + '/visavis/?290623#' + wmgui.api_host + '/download/c?fmt=json&q='; -wmgui.v_sd_addr = wmgui.static_host + '/visavis/?290623#' + wmgui.api_host + '/download/p?fmt=json&q='; -wmgui.v_xrpd_addr = wmgui.static_host + '/visavis/?290623#' + wmgui.api_host + '/download/s?fmt=xrpd&q='; -wmgui.v_vis_addr = wmgui.static_host + '/visavis/?nobanner&290623'; +wmgui.path_c_entry = '#' + wmgui.api_host + '/download/c?fmt=json&q=' +wmgui.path_s_entry = '#' + wmgui.api_host + '/download/s?fmt=cif&q='; +wmgui.path_s_xrpd = '#' + wmgui.api_host + '/download/s?fmt=xrpd&q='; +wmgui.path_sd_plot = '#' + wmgui.api_host + '/download/p?fmt=json&q='; + +wmgui.engines = 'a'; // a or b +wmgui.engines_addrs = { + 'a': { + 'cifplayer': '/crystvis/player.html', + 'visavis': '/visavis/?nobanner' + }, + 'b': { + 'cifplayer': 'webassets/iframe_cifplayer.html', + 'visavis': 'webassets/iframe_visavis.html' + } +} + +wmgui.v_pd_user_addr = wmgui.static_host + '/pd_stub.html#' + wmgui.api_host + '/download/c?fmt=png&q='; wmgui.v_ab_vis_addr = wmgui.static_host + '/labs/view-phonons/#' + wmgui.api_host + '/download/p?fmt=json&q='; -wmgui.v_pd_3d_addr = wmgui.gui_host + '/labs/pd3d/?'; // FIXME will not work for pure Ermac +wmgui.v_pd_3d_addr = 'labs/pd3d/?'; // below are remote files commonly used wmgui.client_data_addr = wmgui.static_host + '/wmdata.json?220923'; @@ -374,6 +384,7 @@ wmgui.store_mydata_key = 'absolidix_v1'; wmgui.store_oauth_email_key = 'wm_u_email'; wmgui.store_comm_exec_key = 'wm_reload_v1'; wmgui.store_redir_key = 'wm_redir_v1'; +wmgui.store_engines_key = 'wm_engines_v0'; wmgui.tooltips = { //'advsearch': {el: 'advsearch_init_trigger', oleft: -90, otop: 60, view_mode: 1, text: 'Use the ☰ button for the detailed search by 15+ categories.
Next'}, diff --git a/webassets/ermac.css b/webassets/ermac.css index 577a3b3..3b1cb32 100755 --- a/webassets/ermac.css +++ b/webassets/ermac.css @@ -414,12 +414,14 @@ label{font-size:0.95em;line-height:30px;cursor:pointer;} #ss_custom_box{display:none;z-index:198;top:4%;margin-left:-305px;width:560px;height:auto;padding:25px;text-align:center;background:#fff;overflow:visible;} div.ss_col, div.sops_col{float:left;} +div.ss_col > ul, div.sops_col > ul{margin:0;padding:0;} div.ss_col > ul > li, div.sops_col > ul > li{display:block;list-style:none;user-select:none;text-align:center;color:#fff;background:#bfbfbf;line-height:27px;border-radius:4px;cursor:pointer;margin:8px 4px;} div.ss_col > ul > li.ss_x, div.sops_col > ul > li.sops_x, #ss_x > ul > li:hover, #sops_x > ul > li:hover{background:#FE9A2E;} div.ss_col > ul > li.ss_y, div.sops_col > ul > li.sops_y, #ss_y > ul > li:hover, #sops_y > ul > li:hover{background:#E36868;} div.ss_col > ul > li.ss_z, div.sops_col > ul > li.sops_z, #ss_z > ul > li:hover, #sops_z > ul > li:hover{background:#3e3f95;} div.sops_col{letter-spacing:1px;} #all_polyhedra_box{display:none;position:absolute !important;z-index:103;top:4%;margin-left:-49%;margin-bottom:100px;width:98%;height:auto;background:#fff url(wm_logo_opt.png) 28% 3em no-repeat;background-size:3%;} +#engines_box{display:none;z-index:198;top:30%;margin-left:-250px;width:450px;height:auto;padding:25px;text-align:center;background:#fff;padding-bottom:3em;} #tooltip{display:none;position:fixed;z-index:202;width:200px;height:auto;text-align:center;background:#ebffd6;padding:15px 10px;border-right:1px solid #ddd;border-bottom:1px solid #ddd;} #tooltip > div{position:relative;width:100%;height:100%;font-size:1em;line-height:2em;}