1
0
mirror of https://github.com/kirsle/kirsle.net synced 2024-11-16 21:59:29 +00:00
kirsle.net/www/js/offsite.js

21 lines
459 B
JavaScript
Raw Normal View History

2014-04-09 21:56:29 +00:00
/*
2014-04-19 06:46:33 +00:00
* 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");
2014-04-30 06:42:12 +00:00
if (href === undefined) {
return;
}
2014-04-19 06:46:33 +00:00
// Detect offsite links.
if (href.indexOf("http:") == 0 || href.indexOf("https:") == 0) {
$a.attr("target", "_blank");
}
});
});