Skip to content
This repository has been archived by the owner on Nov 29, 2022. It is now read-only.

Commit

Permalink
Open external links in a new tab
Browse files Browse the repository at this point in the history
  • Loading branch information
iliajie committed May 19, 2022
1 parent 67ff1bd commit 28400e9
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion left.cgi
Original file line number Diff line number Diff line change
Expand Up @@ -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 "<div class='linkwithicon".
Expand All @@ -185,7 +190,6 @@ foreach my $item (@$items) {
($item->{'inactive'} ? ' inactive' : '').
'' : 'leftlink';
print "<div class='$cls'>";
my $link = add_webprefix($item->{'link'});
print "<a href='$link' target=$t>".
"$item->{'desc'}</a>";
print "</div>";
Expand Down

0 comments on commit 28400e9

Please sign in to comment.