mirror of
https://github.com/kirsle/kirsle.net
synced 2024-12-22 15:09:29 +00:00
21 lines
414 B
JavaScript
21 lines
414 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");
|
|
}
|
|
});
|
|
});
|