1
0
mirror of https://github.com/kirsle/kirsle.net synced 2024-12-23 07:29:28 +00:00
kirsle.net/www/js/offsite.js

21 lines
414 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() {
2015-08-12 00:18:25 +00:00
$("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
2015-08-12 00:18:25 +00:00
// Detect offsite links.
if (href.indexOf("http:") == 0 || href.indexOf("https:") == 0) {
$a.attr("target", "_blank");
}
});
2014-04-19 06:46:33 +00:00
});