From 28400e92c8e168ac1d0c0aa46953b63b1a025640 Mon Sep 17 00:00:00 2001 From: Ilia Date: Thu, 19 May 2022 23:23:58 +0300 Subject: [PATCH] Open external links in a new tab --- left.cgi | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/left.cgi b/left.cgi index 20b42cd..7fa98ac 100755 --- a/left.cgi +++ b/left.cgi @@ -174,6 +174,11 @@ foreach my $item (@$items) { my $it = $item->{'target'} || ''; my $t = $it eq 'new' ? '_blank' : $it eq 'window' ? '_top' : 'right'; + my $link = add_webprefix($item->{'link'}); + if ($item->{'link'} =~ /^(https?):\/\//) { + $t = '_blank'; + $link = $item->{'link'}; + } if ($item->{'icon'}) { my $icon = add_webprefix($item->{'icon'}); print "
"; - my $link = add_webprefix($item->{'link'}); print "". "$item->{'desc'}"; print "
";