Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Docs: Added basic language navigation.
  • Loading branch information
mrdoob committed Sep 26, 2018
1 parent 63eca7a commit 6023b2e
Show file tree
Hide file tree
Showing 3 changed files with 869 additions and 418 deletions.
3 changes: 1 addition & 2 deletions docs/index.css
Expand Up @@ -58,7 +58,7 @@ a {
width: 260px;
height: 100%;
overflow: auto;
padding-left: 20px;
padding: 0px 20px 0px 20px;
background: #fafafa;
}

Expand All @@ -77,7 +77,6 @@ iframe {
}

.filterBlock {
margin-right: 20px;
position: relative;
}

Expand Down
34 changes: 29 additions & 5 deletions docs/index.html
Expand Up @@ -22,6 +22,13 @@ <h1><a href="http://threejs.org">three.js</a> / docs</h1>
<input type="text" id="filterInput" placeholder="Type to filter" autocorrect="off" autocapitalize="off" spellcheck="false">
<a href="#" id="clearFilterButton">x</a>
</div>

<div style="text-align:center">
<br />
<a href="javascript:setLanguage('en')">en</a> |
<a href="javascript:setLanguage('zh')">zh</a>
</div>

<div id="content"></div>

</div>
Expand All @@ -44,6 +51,15 @@ <h1><a href="http://threejs.org">three.js</a> / docs</h1>

//

var language = 'en';

function setLanguage( value ) {

language = value;
createNavigation();

}

var panel = document.getElementById( 'panel' );
var content = document.getElementById( 'content' );
var clearFilterButton = document.getElementById( 'clearFilterButton' );
Expand All @@ -55,6 +71,8 @@ <h1><a href="http://threejs.org">three.js</a> / docs</h1>
var titles = {};
var categoryElements = [];

var navigation;


// Functionality for hamburger button (on small devices)

Expand Down Expand Up @@ -118,16 +136,24 @@ <h1><a href="http://threejs.org">three.js</a> / docs</h1>

function createNavigation() {

if ( navigation !== undefined ) {

content.removeChild( navigation );

}

// Create the navigation panel using data from list.js

var navigation = document.createElement( 'div' );
navigation = document.createElement( 'div' );
content.appendChild( navigation );

for ( var section in list ) {
var localList = list[ language ];

for ( var section in localList ) {

// Create sections

var categories = list[ section ];
var categories = localList[ section ];

var sectionHead = document.createElement( 'h2' );
sectionHead.textContent = section;
Expand Down Expand Up @@ -157,8 +183,6 @@ <h1><a href="http://threejs.org">three.js</a> / docs</h1>

// Localisation

pageURL = pageURL.replace( '{lan}', 'en' );

var listElement = document.createElement( 'li' );
categoryContent.appendChild( listElement );

Expand Down

0 comments on commit 6023b2e

Please sign in to comment.