mirror of
https://github.com/ruanyf/es6tutorial.git
synced 2025-05-24 18:32:22 +00:00
edit ditto.js
This commit is contained in:
parent
577841a430
commit
a2c0f0cd3f
12
js/ditto.js
12
js/ditto.js
@ -21,7 +21,7 @@ var disqusCode = '<h3>留言</h3><div id="disqus_thread"></div>'
|
|||||||
+ "var disqus_shortname = 'es6'; "
|
+ "var disqus_shortname = 'es6'; "
|
||||||
+ "(function() {"
|
+ "(function() {"
|
||||||
+ "var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;"
|
+ "var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;"
|
||||||
+ "dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js;"
|
+ "dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js;'"
|
||||||
+ "(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);"
|
+ "(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);"
|
||||||
+ " })();"
|
+ " })();"
|
||||||
+ '</script>';
|
+ '</script>';
|
||||||
@ -199,7 +199,7 @@ function router() {
|
|||||||
var loading = show_loading();
|
var loading = show_loading();
|
||||||
$.get(path , function(data) {
|
$.get(path , function(data) {
|
||||||
$(ditto.error_id).hide();
|
$(ditto.error_id).hide();
|
||||||
$(ditto.content_id).html(marked(data));
|
$(ditto.content_id).html(marked(data)+disqusCode);
|
||||||
if ($(ditto.content_id+" h1").text() === ditto.document_title){
|
if ($(ditto.content_id+" h1").text() === ditto.document_title){
|
||||||
document.title = ditto.document_title;
|
document.title = ditto.document_title;
|
||||||
} else {
|
} else {
|
||||||
@ -208,6 +208,14 @@ function router() {
|
|||||||
normalize_paths();
|
normalize_paths();
|
||||||
create_page_anchors();
|
create_page_anchors();
|
||||||
|
|
||||||
|
DISQUS.reset({
|
||||||
|
reload: true,
|
||||||
|
config: function () {
|
||||||
|
this.page.identifier = location.hash;
|
||||||
|
this.page.url = location.href;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
$('#content code').map(function() {
|
$('#content code').map(function() {
|
||||||
Prism.highlightElement(this);
|
Prism.highlightElement(this);
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user