[fix] syntax error of non-english character (#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
This commit is contained in:
정승원 2019-02-09 02:28:56 +09:00 committed by Michael Rose
parent ea2b6de555
commit 81f7851347

View file

@ -59,7 +59,7 @@ $(document).ready(function() {
var smoothScrolling = false; var smoothScrolling = false;
$(window).bind("popstate", function (event) { $(window).bind("popstate", function (event) {
$.smoothScroll({ $.smoothScroll({
scrollTarget: location.hash, scrollTarget: decodeURI(location.hash),
offset: -20, offset: -20,
beforeScroll: function() { smoothScrolling = true; }, beforeScroll: function() { smoothScrolling = true; },
afterScroll: function() { smoothScrolling = false; } afterScroll: function() { smoothScrolling = false; }
@ -103,7 +103,7 @@ $(document).ready(function() {
if (top <= scrollTop && scrollTop < bottom) { if (top <= scrollTop && scrollTop < bottom) {
// Mark all ancestors as active // Mark all ancestors as active
links[i].link.parents("li").children("a").addClass('active'); links[i].link.parents("li").children("a").addClass('active');
if (links[i].href !== location.hash) { if (links[i].href !== decodeURI(location.hash)) {
history.replaceState(null, null, links[i].href); history.replaceState(null, null, links[i].href);
} }
return; return;