summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWu Cheng-Han2015-12-06 11:25:05 -0600
committerWu Cheng-Han2015-12-06 11:25:05 -0600
commit4b93d868b04c6dbab7ef72630299822fe6afcf63 (patch)
treeef0dc2d901cea3bd163ac3bbd0685e1f3baaad79
parentd3a23ad72f1cdde4e7b87e8d79c678b27d98b8c2 (diff)
Fixed internal href should not link out
Diffstat (limited to '')
-rw-r--r--public/js/extra.js4
1 files changed, 2 insertions, 2 deletions
diff --git a/public/js/extra.js b/public/js/extra.js
index 26762dde..ef1f7e35 100644
--- a/public/js/extra.js
+++ b/public/js/extra.js
@@ -209,7 +209,7 @@ function postProcess(code) {
return "<noiframe>" + $(this).html() + "</noiframe>"
});
//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
var linenumberdivs = result.find('.gutter.linenumber').toArray();
for (var i = 0; i < linenumberdivs.length; i++) {
@@ -374,7 +374,7 @@ function smoothHashScroll() {
if (hash) {
$element.on('click', function (e) {
// store hash
- var hash = this.hash;
+ var hash = decodeURIComponent(this.hash);
if ($(hash).length <= 0) return;
// prevent default anchor click behavior
e.preventDefault();