未验证 提交 cf065b67 编写于 作者: M Mr.doob 提交者: GitHub

Merge pull request #15503 from HypnosNova/docs

Documentation: Easier language switching
......@@ -69,6 +69,8 @@
language = value;
createNavigation();
updateFilter();
autoChangeUrlLanguage( language );
}
......@@ -226,6 +228,19 @@
}
// Auto change language url. If a reader open a document in English, when he click "zh", the document he read will auto change into Chinese version
function autoChangeUrlLanguage( language ) {
var hash = location.hash;
if ( hash === '' ) return;
var docType = hash.substr( 0, hash.indexOf( '/' ) + 1 );
var docLink = hash.substr( hash.indexOf( '/' ) + 1 );
docLink = docLink.substr( docLink.indexOf( '/' ) );
location.href = docType + language + docLink;
}
// Filtering
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册