Skip to content

Commit 206d182

Browse files
aliwommistakes
authored andcommitted
[fix] syntax error of non-english character (mmistakes#2042)
* Dear the make of one of the world's greatest jekyll theme. [problem] I found that 'Syntax Error' occurs when non-english character is included in some html elements(e.g h2, h3 ...) and 'toc' is generated based of that elements. [debug] Click the any element of auto generated 'toc' in the below link. https://aliwo.github.io/swblog/series/principles_of_python/object/#%EA%B0%9D%EC%B2%B4%EC%99%80-%ED%81%B4%EB%9E%98%EC%8A%A4%EC%9D%98-%EC%A0%95%EC%9D%98 [fix] This happens because escaped url string get right in to jquery. So I fixed it with javascript's 'decodeURI' function! :) * rollback unnecessary changes
1 parent e3e7f02 commit 206d182

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

assets/js/_main.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ $(document).ready(function() {
5959
var smoothScrolling = false;
6060
$(window).bind("popstate", function (event) {
6161
$.smoothScroll({
62-
scrollTarget: location.hash,
62+
scrollTarget: decodeURI(location.hash),
6363
offset: -20,
6464
beforeScroll: function() { smoothScrolling = true; },
6565
afterScroll: function() { smoothScrolling = false; }
@@ -103,7 +103,7 @@ $(document).ready(function() {
103103
if (top <= scrollTop && scrollTop < bottom) {
104104
// Mark all ancestors as active
105105
links[i].link.parents("li").children("a").addClass('active');
106-
if (links[i].href !== location.hash) {
106+
if (links[i].href !== decodeURI(location.hash)) {
107107
history.replaceState(null, null, links[i].href);
108108
}
109109
return;

0 commit comments

Comments
 (0)