jQueryのdelegate/liveというものを今更ながら知った。
で書いたスクリプトに適用出来そうだったので直してみた。
変更前
ごちゃごちゃ。
$(window).click(function(event) { var target = $(event.target); if (!target.is("a")) { target = target.parents("a").first(); } target.filter( "[href^=http]:not([href*='" + location.hostname + "'])" ).attr("target", "_blank"); });
変更後
すっきりヽ(´v`)ノ
$(document).on("click", "a[href^=http]:not([target]):not([href*='" + location.hostname + "'])", function(event) { $(event.currentTarget).attr("target", "_blank") } );