diff --git a/static/js/patoroco.js b/static/js/patoroco.js new file mode 100644 index 0000000..4a2c162 --- /dev/null +++ b/static/js/patoroco.js @@ -0,0 +1,18 @@ +/* +Open external links in a new tab. +Copied from: http://mitchbarry.com/handling-external-links/ +*/ +(function() { + var hostname = window.location.hostname; + var new_tab = true; + var set_icon = true; + for (var links = document.links, i = 0, a; a = links[i]; i++) { + if (a.hostname !== hostname) { + if (new_tab) + a.target = '_blank'; + if (set_icon) + a.innerHTML += + ''; + } + } +})(); \ No newline at end of file diff --git a/templates/base.html b/templates/base.html index cbbea97..7e2392f 100644 --- a/templates/base.html +++ b/templates/base.html @@ -205,5 +205,7 @@ {% if GITHUB_CORNER_URL %} {% include 'partial/github.html' %} {% endif %} + +