From 1cd7e8b754d2f91e7b5ed9c4b37eb2dd5ad57ca2 Mon Sep 17 00:00:00 2001 From: ruanyf Date: Sat, 26 Apr 2014 02:02:51 +0800 Subject: [PATCH] edit ditto.js --- js/ditto.js | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/js/ditto.js b/js/ditto.js index 7f82f94..3b0bd01 100644 --- a/js/ditto.js +++ b/js/ditto.js @@ -18,9 +18,9 @@ var ditto = { var disqusCode = '

留言

'; -var disqus_identifier=location.hash; +var disqus_identifier; var disqus_title; -var disqus_url='http://'+location.host+'/'+location.hash?location.hash.replace("#", ""):'index'; +var disqus_url; function initialize() { // initialize sidebar and buttons @@ -187,9 +187,6 @@ function router() { path = path + ".md"; } - window.disqus_identifier=location.hash; - window.disqus_url='http://'+location.host+'/'+location.hash?location.hash.replace("#", ""):'index'; - // otherwise get the markdown and render it var loading = show_loading(); $.get(path , function(data) { @@ -203,6 +200,15 @@ function router() { normalize_paths(); create_page_anchors(); + if(window.DISQUS){DISQUS.reset({ + reload: true, + config: function () { + this.page.identifier = location.hash; + this.page.url = location.href; + } + }); +} + $('#content code').map(function() { Prism.highlightElement(this); });