Skip to content

Commit

Permalink
show embedded action/notes url with original link
Browse files Browse the repository at this point in the history
and open embedded by javascript
  • Loading branch information
sni committed Sep 18, 2023
1 parent 71350bc commit a245fc4
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
3 changes: 1 addition & 2 deletions lib/Thruk/Utils/Filter.pm
Original file line number Diff line number Diff line change
Expand Up @@ -1670,8 +1670,7 @@ sub set_target_link {

if(!$target || $target eq 'main') {
if(_is_frame_url_allowed($href)) {
$target = '';
$href = $prefix.'#'.$href;
$target = 'embedded';
push @{$c->stash->{'allowed_frame_links'}}, $href;
} else {
$target = '_blank';
Expand Down
15 changes: 15 additions & 0 deletions root/thruk/javascript/thruk-3.08.3.js
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,21 @@ function init_page() {
thrukState.unloading = true;
});

// open embedded action/notes urls in same page (as embedded iframe)
jQuery("A[target=embedded]").off("click").on("click", function(e) {
var link = e.target;
if(link.tagName != "A") {
var links = jQuery(link).parents("A");
if(links && links[0]) {
link = links[0];
}
}
if(link && link.href) {
e.preventDefault();
redirect_url(url_prefix+"#"+link.href);
}
});

// break from old frame mode
try {
if(window.frameElement && window.frameElement.tagName == "FRAME" && window.top && window.top.location != location) {
Expand Down

0 comments on commit a245fc4

Please sign in to comment.