1
0
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:
ruanyf 2014-04-22 09:43:38 +08:00
parent 54fe0d12b6
commit 44ff6ee6dd
2 changed files with 9 additions and 6 deletions

View File

@ -30,7 +30,7 @@
// essential settings
ditto.index = "README.md",
ditto.sidebar_file = "sidebar.md",
ditto.document_title = "ECMAScript 6入门",
// 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!!

View File

@ -186,18 +186,21 @@ function router() {
$.get(path , function(data) {
$(ditto.error_id).hide();
$(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();
create_page_anchors();
$('#content code').map(function() {
Prism.highlightElement(this);
});
}).fail(function() {
show_error();
}).always(function() {
clearInterval(loading);
$('#content code').map(function() {
Prism.highlightElement(this);
});
$(ditto.loading_id).hide();
});
}