oddluck f7590e79da Add 'TriviaTime/' from commit 'ae216897cd9c45259853c3f84eae826f344482aa'
git-subtree-dir: TriviaTime
git-subtree-mainline: 3551587ecdefc75e34b8b2a87d91a466bdf4c764
git-subtree-split: ae216897cd9c45259853c3f84eae826f344482aa
2019-02-14 13:32:21 -05:00

37 lines
1.5 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

var createModalDiv = function() {
if($('#infoModal').length == 0) {
$('body').append('<!-- Modal -->'
+ '<div id="infoModal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="infoModalLabel" aria-hidden="true">'
+ ' <div class="modal-header">'
+ ' <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>'
+ ' <h3 id="infoModalLabel">Table Information</h3>'
+ ' </div>'
+ ' <div class="modal-body">'
+ ' </div>'
+ ' <div class="modal-footer">'
+ ' <button class="btn" data-dismiss="modal" aria-hidden="true">Close</button>'
+ ' </div>'
+ '</div>');
}
};
$(function() {
$(".modal-table tbody tr").click(function(e) {
createModalDiv();
var headers = $(this).parent("tbody").parent("table").find('th');
var values = $(this).children("td");
var content = '';
for(var i=0;i<values.length;i++) {
content += "<h4>" + headers.eq(i).text() + "</h4>";
content += "<p>" + values.eq(i).html() + "</p>";
}
$('#infoModal > .modal-body').html(content);
$('#infoModal').modal('show');
});
$(".modal-table tbody tr td a").click(function(e) {
e.stopPropagation();
e.preventDefault();
window.location.href = $(this).attr("href");
return false;
});
});