chg: [popovers] Added dedicated popover container for expansions and sightings

(instead of a shared one with the screenshots)
pull/4478/head
mokaddem 2019-04-15 10:51:06 +02:00
parent f86cc0b2b2
commit 7c8f91cfc4
5 changed files with 33 additions and 20 deletions

View File

@ -169,7 +169,7 @@ $(document).ready(function () {
object_id = selected.join('|');
}
url = "<?php echo $baseurl; ?>" + "/sightings/advanced/" + object_id + "/" + object_context;
genericPopup(url, '#screenshot_box');
genericPopup(url, '#popover_box');
});
$('.correlation-toggle').click(function() {
var attribute_id = $(this).data('attribute-id');

View File

@ -317,7 +317,7 @@ attributes or the appropriate distribution level. If you think there is a mistak
object_id = selected.join('|');
}
url = "<?php echo $baseurl; ?>" + "/sightings/advanced/" + object_id + "/" + object_context;
genericPopup(url, '#screenshot_box');
genericPopup(url, '#popover_box');
});
});
$('#attributesFilterField').bind("keydown", function(e) {

View File

@ -40,6 +40,7 @@
<body>
<div id="popover_form" class="ajax_popover_form"></div>
<div id="popover_form_large" class="ajax_popover_form ajax_popover_form_large"></div>
<div id="popover_box" class="popover_box"></div>
<div id="screenshot_box" class="screenshot_box"></div>
<div id="confirmation_box" class="confirmation_box"></div>
<div id="gray_out" class="gray_out"></div>

View File

@ -846,6 +846,16 @@ a.proposal_link_red:hover {
left: calc(50% - 700px);
}
.popover_box {
display:none;
position: fixed;
top:150px;
background-color:#f4f4f4;
border-radius: 11px 11px 10px 10px;
box-shadow: 4px 4px 4px #333;
z-index:5;
}
.screenshot_box {
display:none;
position: absolute;

View File

@ -1265,6 +1265,7 @@ function cancelPopoverForm(id) {
$("#popover_form").fadeOut();
$("#popover_form_large").fadeOut();
$("#screenshot_box").fadeOut();
$("#popover_box").fadeOut();
$("#confirmation_box").fadeOut();
$('#gray_out').fadeOut();
$('#popover_form').fadeOut();
@ -3262,7 +3263,7 @@ $(".cortex-json").click(function() {
// add the same as below for click popup
$(document).on( "click", ".eventViewAttributePopup", function() {
$('#screenshot_box').empty();
$('#popover_box').empty();
type = $(this).attr('data-object-type');
id = $(this).attr('data-object-id');
if (!(type + "_" + id in ajaxResults["persistent"])) {
@ -3278,16 +3279,16 @@ $(document).on( "click", ".eventViewAttributePopup", function() {
if (type + "_" + id in ajaxResults["persistent"]) {
var enrichment_popover = ajaxResults["persistent"][type + "_" + id];
enrichment_popover += '<div class="close-icon useCursorPointer popup-close-icon" onClick="closeScreenshot();"></div>';
$('#screenshot_box').html('<div class="screenshot_content">' + enrichment_popover + '</div>');
$('#screenshot_box').show();
$('#popover_box').html('<div class="screenshot_content">' + enrichment_popover + '</div>');
$('#popover_box').show();
$("#gray_out").fadeIn();
$('#screenshot_box').css({'padding': '5px'});
$('#screenshot_box').css( "maxWidth", ( $( window ).width() * 0.9 | 0 ) + "px" );
$('#screenshot_box').css( "maxHeight", ( $( window ).width() - 300 | 0 ) + "px" );
$('#screenshot_box').css( "overflow-y", "auto");
$('#popover_box').css({'padding': '5px'});
$('#popover_box').css( "maxWidth", ( $( window ).width() * 0.9 | 0 ) + "px" );
$('#popover_box').css( "maxHeight", ( $( window ).width() - 300 | 0 ) + "px" );
$('#popover_box').css( "overflow-y", "auto");
var left = ($(window).width() / 2) - ($('#screenshot_box').width() / 2);
$('#screenshot_box').css({'left': left + 'px'});
var left = ($(window).width() / 2) - ($('#popover_box').width() / 2);
$('#popover_box').css({'left': left + 'px'});
}
$('#' + currentPopover).popover('destroy');
});
@ -3670,6 +3671,7 @@ $(document).keyup(function(e){
$("#popover_form").fadeOut();
$("#popover_form_large").fadeOut();
$("#screenshot_box").fadeOut();
$("#popover_box").fadeOut();
$("#confirmation_box").fadeOut();
$(".loading").hide();
resetForms();
@ -4017,16 +4019,16 @@ $(document).ready(function() {
cortex_data = htmlEncode(JSON.stringify(cortex_data, null, 2));
var popupHtml = '<pre class="simplepre">' + cortex_data + '</pre>';
popupHtml += '<div class="close-icon useCursorPointer" onClick="closeScreenshot();"></div>';
$('#screenshot_box').html(popupHtml);
$('#screenshot_box').show();
$('#screenshot_box').css({'padding': '5px'});
left = ($(window).width() / 2) - ($('#screenshot_box').width() / 2);
if (($('#screenshot_box').height() + 250) > $(window).height()) {
$('#screenshot_box').height($(window).height() - 250);
$('#screenshot_box').css("overflow-y", "scroll");
$('#screenshot_box').css("overflow-x", "hidden");
$('#popover_box').html(popupHtml);
$('#popover_box').show();
$('#popover_box').css({'padding': '5px'});
left = ($(window).width() / 2) - ($('#popover_box').width() / 2);
if (($('#popover_box').height() + 250) > $(window).height()) {
$('#popover_box').height($(window).height() - 250);
$('#popover_box').css("overflow-y", "scroll");
$('#popover_box').css("overflow-x", "hidden");
}
$('#screenshot_box').css({'left': left + 'px'});
$('#popover_box').css({'left': left + 'px'});
$("#gray_out").fadeIn();
});
$('.add_object_attribute_row').click(function() {