提交 9212298b 编写于 作者: M Mr.doob

Examples: Clean up.

上级 fff06ef3
......@@ -291,25 +291,12 @@
var links = {};
var selected = null;
for ( var key in files ) {
var section = files[ key ];
var header = document.createElement( 'h2' );
header.textContent = key;
header.setAttribute( 'data-category', key );
container.appendChild( header );
for ( var i = 0; i < section.length; i ++ ) {
( function ( file ) {
var name = getName( file );
function createLink( file ) {
var link = document.createElement( 'a' );
link.className = 'link';
link.textContent = name;
link.href = file + '.html';
link.textContent = getName( file );
link.setAttribute( 'target', 'viewer' );
link.addEventListener( 'click', function ( event ) {
......@@ -320,12 +307,29 @@
}
} );
return link;
}
for ( var key in files ) {
var section = files[ key ];
var header = document.createElement( 'h2' );
header.textContent = key;
header.setAttribute( 'data-category', key );
container.appendChild( header );
for ( var i = 0; i < section.length; i ++ ) {
var file = section[ i ];
var link = createLink( file );
container.appendChild( link );
links[ file ] = link;
} )( section[ i ] );
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册