mirror of
https://github.com/kirsle/kirsle.net
synced 2024-11-15 05:19:29 +00:00
21 lines
459 B
JavaScript
21 lines
459 B
JavaScript
/*
|
|
* Hyperlink Editor Script || Copyright 2014 Kirsle
|
|
*
|
|
* This script makes all offsite links open in a new window.
|
|
*/
|
|
|
|
$(document).ready(function() {
|
|
$("a").each(function() {
|
|
var $a = $(this);
|
|
var href = $a.attr("href");
|
|
if (href === undefined) {
|
|
return;
|
|
}
|
|
|
|
// Detect offsite links.
|
|
if (href.indexOf("http:") == 0 || href.indexOf("https:") == 0) {
|
|
$a.attr("target", "_blank");
|
|
}
|
|
});
|
|
});
|