Skip to content
This repository has been archived by the owner on Feb 7, 2024. It is now read-only.

fix classic view impurities #49

Open
wants to merge 1 commit into
base: GSRS_DEV
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -156,67 +156,4 @@

</table>

<script type = "text/javascript">
//combine relationship table rows which share the same related substance / relationship
window.onload = function() {
var rows = [];
var found = false;
$('#relationships > tbody > tr').each(function (row, val) {
var substance = '';
var pos = row;
var rel = '';
var divID;

if((found === true) && ($(this).attr("class") == "relationship-subtable-tr")){
found = false;
$(this).remove();
}
if ($(this).attr("class") == "main-relationship-tr") {
$(this).children('td').each(function (key, value) {
var data = $(this).html();
if (key == 0) {
substance = $(this).find('a').html();
$(this).find('a').each(function () {
});
}
if (key == 1) {
rel = data;
}
if (key == 2) {
divID = $(this).find('div');
divID = divID.attr("id").slice(1);

}
});

for (var i = 0; i < rows.length; i++) {
if ((rows[i].name == substance) && (rows[i].relationship == rel)) {
found = true;
rows[i].count++;
$('#b'+rows[i].divID).find('button').each(function () {
if ($(this).css('visibility') == 'hidden'){
$(this).css('visibility','visible');
$('#b'+rows[i].divID).find('i').css('display','none');
}
});
$('#' + rows[i].divID).append('<tr>' + $('#a' + divID).html() + '</tr>');
$(this).remove();
}
}
if (found == false) {
rows.push({'name': substance, 'relationship': rel, 'pos': pos, 'count': 1, 'divID': divID})
}
}
});
for (var i = 0; i < rows.length; i++) {
if (rows[i].count > 1) {
var current = $('#relationships > tbody > tr:nth-of-type(' + rows[i].pos + ')');
$('#b' + rows[i].divID).append('<div style = "text-align:center"><i>(' + rows[i].count + ' records)</i></div>');
}
}

}
</script>


</div>