diff --git a/src_js/events.js b/src_js/events.js
index a02a2a6..485cbad 100755
--- a/src_js/events.js
+++ b/src_js/events.js
@@ -64,7 +64,7 @@ function register_events(){
var urlstr = $.param(query);
if (window.location.hash == '#inquiry/' + urlstr){
// hash-hack FIXME?
- if (urlstr.slice(-1) == '=') urlstr = urlstr.substr(0, urlstr.length-1);
+ if (urlstr.slice(-1) == '=') urlstr = urlstr.substr(0, urlstr.length - 1);
else urlstr += '=';
}
window.location.hash = '#inquiry/' + urlstr;
@@ -218,7 +218,7 @@ function register_events(){
open_context(parent_row, true);
});
- $('#databrowser').on('click', 'a.launch_ph', function(e){
+ $('#databrowser').on('click', 'a.launch_id', function(e){
wmgui.cancel_event(e);
var phid_link = $(this).attr('href');
if (window.location.hash == phid_link){
@@ -1108,7 +1108,7 @@ function register_events(){
var urlstr = $.param(orepr);
if (window.location.hash == '#inquiry/' + urlstr){
// hash-hack FIXME?
- if (urlstr.slice(-1) == '=') urlstr = urlstr.substr(0, urlstr.length-1);
+ if (urlstr.slice(-1) == '=') urlstr = urlstr.substr(0, urlstr.length - 1);
else urlstr += '=';
}
window.location.hash = '#inquiry/' + urlstr;
@@ -1128,7 +1128,7 @@ function register_events(){
var urlstr = $.param(orepr);
if (window.location.hash == '#inquiry/' + urlstr){
// hash-hack FIXME?
- if (urlstr.slice(-1) == '=') urlstr = urlstr.substr(0, urlstr.length-1);
+ if (urlstr.slice(-1) == '=') urlstr = urlstr.substr(0, urlstr.length - 1);
else urlstr += '=';
}
window.location.hash = '#inquiry/' + urlstr;
diff --git a/src_js/main_logic.js b/src_js/main_logic.js
index bf72152..d25810a 100755
--- a/src_js/main_logic.js
+++ b/src_js/main_logic.js
@@ -260,7 +260,7 @@ function request_search(search, caption, without_history){
if (wmgui.search_type == 2){
$db.addClass('tablesorter').tablesorter({ sortMultiSortKey: 'ctrlKey', headers: {
0: {sorter: 'doi'},
- 6: {sorter: 'digit'}
+ 5: {sorter: false}
}, selectorHeaders: '#dataheader_articles > thead > tr > th', selectorHeaderParent: 'dataheader_articles' });
$('#header_articles').show();
@@ -305,11 +305,11 @@ function request_search(search, caption, without_history){
// switchers
if (wmgui.visavis_terminating) stop_visavis();
- if (wmgui.search_type || search.phid || search.entry || search.interlinkage || search.doi || search.numeric){
+ if (wmgui.search_type || search.phid || search.bid || search.entry || search.interlinkage || search.doi || search.numeric){
- if (search.phid || search.entry){
+ if (search.phid || search.bid || search.entry){
switch_control_mode(9, 11, 'a', 'c');
- show_dunit_info(search.phid, search.entry);
+ show_dunit_info(search.phid, search.bid, search.entry);
} else if (search.interlinkage){
switch_control_mode(9, 11, 'a', 'c');
@@ -534,13 +534,13 @@ function build_cells(json, header, footer){
$.each(json, function(k, row){
row[0] = parseInt(row[0]);
if (row[0] == 999999) row[4] = wmgui.mockyear; // special *ref_id*, only handled in GUI
- result_html += '
[' + row[0] + '] | ' + row[1] + ' | ' + row[2] + ' | ' + row[5] + ' | ' + row[3] + ' | ' + row[4] + ' |
';
+ result_html += '[' + row[0] + '] | ' + row[1] + ' | ' + row[2] + ' | ' + row[5] + ' | ' + row[4] + ' | Show |
';
});
} else if (wmgui.search_type == 1){
if (json[0].length != 5){ wmgui.notify('Rendering error, please try to reload'); return ''; }
$.each(json, function(k, row){
- result_html += '' + row[1] + ' | ' + row[2] + ' | ' + row[3] + ' | ' + row[4] + ' | Show entries |
';
+ result_html += '' + row[1] + ' | ' + row[2] + ' | ' + row[3] + ' | ' + row[4] + ' | Show entries |
';
});
} else {
if (json[0].length != 8){ wmgui.notify('Rendering error, please try to reload'); return ''; }
@@ -576,7 +576,7 @@ function build_thumbs(json){
if (row[0] == 999999) row[4] = wmgui.mockyear; // special *ref_id*, only handled in GUI
if (full_display) title_html = (row[1].length > 60 ? row[1].substr(0, 60) + '…' : row[1]) + ', ' + (row[2].length > 80 ? row[2].substr(0, 80) + '…' : row[2]) + '';
else title_html = '
📖'; // book icon
- result_html += '';
+ result_html += '';
});
} else if (wmgui.search_type == 1){
if (json[0].length != 5){ wmgui.notify('Rendering error, please try to reload'); return ''; }
@@ -585,7 +585,7 @@ function build_thumbs(json){
return a[1] > b[1] ? 1 : a[1] < b[1] ? -1 : 0;
});
$.each(json, function(k, row){
- result_html += '' + row[1] + '
space group ' + row[2] + '
';
+ result_html += '' + row[1] + '
space group ' + row[2] + '
';
});
} else {
if (json[0].length != 8){ wmgui.notify('Rendering error, please try to reload'); return ''; }
@@ -1489,10 +1489,20 @@ function render_all_polyhedra(){
$('#all_polyhedra_content').html(aetypes_html);
}
-function show_dunit_info(phid, entry){
- $('#ind_title').html( phid ? 'Phase ' + phid : 'Entry ' + entry );
- $('#ind_link').attr('href', 'https://mpds.io/' + (phid ? 'phase_id' : 'entry') + '/' + (phid || entry));
- $('#ind_link').html('www.mpds.io/' + (phid ? 'phase_id' : 'entry') + '/' + (phid || entry));
+function show_dunit_info(phid, bid, entry){
+ if (phid){
+ $('#ind_title').html('Phase ' + phid);
+ $('#ind_link').attr('href', 'https://mpds.io/phase_id/' + phid).html('www.mpds.io/phase_id/' + phid);
+
+ } else if (bid){
+ $('#ind_title').html('Publication B' + bid);
+ $('#ind_link').attr('href', 'https://mpds.io/article/' + bid).html('www.mpds.io/article/' + bid);
+
+ } else if (entry){
+ $('#ind_title').html('Entry ' + entry);
+ $('#ind_link').attr('href', 'https://mpds.io/entry/' + entry).html('www.mpds.io/entry/' + entry);
+ }
+
$('#refine_col, #ctx_col').hide();
$('#phase_info, #ind_col > span').empty();
@@ -1516,6 +1526,45 @@ function show_dunit_info(phid, entry){
if (textStatus != 'abort')
wmgui.notify('Sorry, a network error occured. Please, try again');
});
+
+ } else if (bid){
+ $('#ind_col > span').html('📖'); // book icon
+ $('#phase_info').html('Ref. ' + bid + '
Please make sure you are
logged in to see all the details.
');
+
+ wmgui.active_ajax = $.ajax({
+ type: 'GET',
+ url: wmgui.refs_endpoint + '?noredir=1&fmt=bib&ref_id=' + bid + '&sid=' + wmgui.sid
+
+ }).done(function(data){
+ var citation = wmgui.parse_bib(data),
+ citation_html = '',
+ main_author = '',
+ links_html = '';
+
+ if (citation[0].length){
+ citation[0].split(',').forEach(function(item, index){
+ var author_name = item.trim().split('.')[0];
+ author_name = author_name.substr(0, author_name.length - 2).replace("'", "");
+ if (index === 0) main_author = author_name;
+ links_html += '' + author_name + ' or ';
+ });
+ links_html = links_html.substr(0, links_html.length - 4); // " or "
+ if (citation[0].indexOf(',') !== -1) main_author += ' et al.';
+ citation_html += '' + main_author + ', ' + citation[1] + '. ' + citation[2] + ' (' + citation[3] + ')';
+ }
+
+ if (bid == 999999){
+ $('#phase_info').html('In-house data
These data were generated automatically on the MPDS platform based on the original peer-reviewed Pauling File data. Please cite as ' + citation_html + '.
');
+
+ } else {
+ var n_entries = wmgui.thumbed_display ? $('div.gallery_item').length : $('tr.tcell').length;
+ $('#phase_info').html('Ref. ' + bid + '
We have ' + (n_entries == 1 ? 'one entry' : n_entries + ' entries') + ' from this reference ' + citation_html + '.
In addition, search all data co-authored by ' + links_html + '.
');
+ }
+
+ }).fail(function(xhr, textStatus, errorThrown){});
+
+ } else {
+ $('#ind_col > span').html('🔬'); // microscope icon
}
$('#ind_col').show();
diff --git a/src_js/markup.js b/src_js/markup.js
index 81ed28a..d86099c 100755
--- a/src_js/markup.js
+++ b/src_js/markup.js
@@ -69,8 +69,8 @@ function register_html(){
Authors |
Title |
J. name |
- J. code |
Year |
+ |
@@ -488,7 +488,7 @@ function register_html(){
Show more
-
Area colors
+
Color legend
- liquid or gas blue or violet
- 1-phase violet
diff --git a/src_js/ptable.js b/src_js/ptable.js
index 7bf8b11..940c82f 100644
--- a/src_js/ptable.js
+++ b/src_js/ptable.js
@@ -380,7 +380,7 @@ function build_thumbs_ph(json){ // FIXME duplicates another function *build_thum
json.forEach(function(row){
result_html += '';
result_html += '
' + row[1] + '
space group ' + row[2] + '
';
- result_html += '
';
+ result_html += '
';
result_html += '
';
});
return result_html;
@@ -402,7 +402,7 @@ function build_thumbs_pd(json){ // FIXME duplicates another function *build_thum
result_html += '';
result_html += '
' + content + '
';
- result_html += '
' + row[0] + '' + '
[' + row[5] + '’' + row[6].toString().substr(2, 2) + ']' + '
';
+ result_html += '
' + row[0] + '' + '
[' + row[5] + '’' + row[6].toString().substr(2, 2) + ']' + '
';
result_html += '
';
});
return result_html;
diff --git a/src_js/router.js b/src_js/router.js
index 94c580d..15e77e5 100755
--- a/src_js/router.js
+++ b/src_js/router.js
@@ -173,6 +173,18 @@ function url__phase(arg){
} else return wmgui.notify('Sorry, wrong phase given');
}
+/**
+ * The individual B-entry display /#article/integer
+ */
+function url__article(arg){
+ wmgui.search_type = 0;
+ show_interpretation();
+ var bentry = parseInt(arg);
+ wmgui.search = {'bid': bentry};
+ wmgui.search.search_type = wmgui.search_type;
+ request_search({'bid': bentry}, 'B' + bentry, true);
+}
+
/**
* The display of menu with all the physical props
*/
diff --git a/src_js/wmcore.js b/src_js/wmcore.js
index 11bc423..832a249 100755
--- a/src_js/wmcore.js
+++ b/src_js/wmcore.js
@@ -408,3 +408,23 @@ wmgui.get_interpretation = function(search, facet_names, num_database){
return interpret_html;
}
+
+/**
+ * Parse MPDS BIBTEX
+ */
+
+wmgui.parse_bib = function(string){
+ try {
+ var title = string.split('title={')[1].split('},')[0].trim(),
+ authors = string.split('author={')[1].split('},')[0].trim(),
+ journal = string.split('journal={')[1].split('},')[0].trim(),
+ pubyear = string.split('year={')[1].split('},')[0].trim();
+ } catch (error){
+ console.error('Misformatted BIB, terminating...');
+ var title = '',
+ authors = '',
+ journal = '',
+ pubyear = '';
+ }
+ return [authors, title, journal, pubyear];
+}