mirror of
https://github.com/ruanyf/es6tutorial.git
synced 2025-05-24 18:32:22 +00:00
edit document title
This commit is contained in:
parent
54fe0d12b6
commit
44ff6ee6dd
@ -30,7 +30,7 @@
|
|||||||
// essential settings
|
// essential settings
|
||||||
ditto.index = "README.md",
|
ditto.index = "README.md",
|
||||||
ditto.sidebar_file = "sidebar.md",
|
ditto.sidebar_file = "sidebar.md",
|
||||||
|
ditto.document_title = "ECMAScript 6入门",
|
||||||
// where the docs are actually stored on github - so you can edit
|
// where the docs are actually stored on github - so you can edit
|
||||||
ditto.base_url = "https://github.com/ruanyf/es6tutorial/edit/gh-pages/"; // <------- EDIT ME!!
|
ditto.base_url = "https://github.com/ruanyf/es6tutorial/edit/gh-pages/"; // <------- EDIT ME!!
|
||||||
|
|
||||||
|
13
js/ditto.js
13
js/ditto.js
@ -186,18 +186,21 @@ function router() {
|
|||||||
$.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));
|
||||||
|
if ($(ditto.content_id h1) === ditto.document_title){
|
||||||
|
document.title = ditto.document_title;
|
||||||
|
} else {
|
||||||
|
document.title = $(ditto.content_id h1).text() + " - " + ditto.document_title;
|
||||||
|
}
|
||||||
normalize_paths();
|
normalize_paths();
|
||||||
create_page_anchors();
|
create_page_anchors();
|
||||||
|
$('#content code').map(function() {
|
||||||
|
Prism.highlightElement(this);
|
||||||
|
});
|
||||||
}).fail(function() {
|
}).fail(function() {
|
||||||
show_error();
|
show_error();
|
||||||
|
|
||||||
}).always(function() {
|
}).always(function() {
|
||||||
clearInterval(loading);
|
clearInterval(loading);
|
||||||
$('#content code').map(function() {
|
|
||||||
Prism.highlightElement(this);
|
|
||||||
});
|
|
||||||
$(ditto.loading_id).hide();
|
$(ditto.loading_id).hide();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user