Fixed internal href should not link out

This commit is contained in:
Wu Cheng-Han 2015-12-06 11:25:05 -06:00
parent d3a23ad72f
commit 4b93d868b0

View file

@ -209,7 +209,7 @@ function postProcess(code) {
return "<noiframe>" + $(this).html() + "</noiframe>" return "<noiframe>" + $(this).html() + "</noiframe>"
}); });
//link should open in new window or tab //link should open in new window or tab
result.find('a:not([target])').attr('target', '_blank'); result.find('a:not([href^=#]):not([target])').attr('target', '_blank');
//update continue line numbers //update continue line numbers
var linenumberdivs = result.find('.gutter.linenumber').toArray(); var linenumberdivs = result.find('.gutter.linenumber').toArray();
for (var i = 0; i < linenumberdivs.length; i++) { for (var i = 0; i < linenumberdivs.length; i++) {
@ -374,7 +374,7 @@ function smoothHashScroll() {
if (hash) { if (hash) {
$element.on('click', function (e) { $element.on('click', function (e) {
// store hash // store hash
var hash = this.hash; var hash = decodeURIComponent(this.hash);
if ($(hash).length <= 0) return; if ($(hash).length <= 0) return;
// prevent default anchor click behavior // prevent default anchor click behavior
e.preventDefault(); e.preventDefault();