| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166 |
- <?js
- var self = this;
- var isGlobalPage;
- var isTSLPage;
- docs.forEach(function(doc, i) {
- ?>
- <?js
- // we only need to check this once
- if (typeof isGlobalPage === 'undefined') {
- isGlobalPage = (doc.kind === 'globalobj');
- isTSLPage = (doc.isTSL === true);
- }
- ?>
- <?js if (doc.kind === 'mainpage' || (doc.kind === 'package')) { ?>
- <?js= self.partial('mainpage.tmpl', doc) ?>
- <?js } else if (doc.kind === 'source') { ?>
- <?js= self.partial('source.tmpl', doc) ?>
- <?js } else { ?>
- <section>
- <header>
- <?js if (!doc.longname || doc.kind !== 'module') { ?>
- <?js if (doc.classdesc) { ?>
- <div class="class-description"><?js= doc.classdesc ?></div>
- <?js } ?>
- <?js } else if (doc.kind === 'module' && doc.modules) { ?>
- <?js doc.modules.forEach(function(module) { ?>
- <?js if (module.classdesc) { ?>
- <div class="class-description"><?js= module.classdesc ?></div>
- <?js } ?>
- <?js }) ?>
- <?js } ?>
- <?js if (doc.demo) { ?>
- <iframe id="viewer" src="../<?js= doc.demo ?>"></iframe>
- <?js } ?>
- <?js if (doc.codeExample) { ?>
- <h2>Code Example</h2>
- <div translate="no"><?js= doc.codeExample ?></div>
- <?js } ?>
- </header>
- <article>
- <?js if (doc.import) { ?>
- <h2 class="subsection-title">Import</h2>
- <p><span translate="no"><?js= doc.name ?></span> is an addon, and must be imported explicitly, see <a href="https://threejs.org/manual/#en/installation">Installation#Addons</a>.</p>
- <pre class="prettyprint source lang-js" translate="no"><code><?js= doc.import ?></code></pre>
- <?js } ?>
- <div class="container-overview">
- <?js if (doc.kind === 'module' && doc.modules) { ?>
- <?js if (doc.description) { ?>
- <div class="description"><?js= doc.description ?></div>
- <?js } ?>
- <?js doc.modules.forEach(function(module) { ?>
- <?js= self.partial('method.tmpl', module) ?>
- <?js }) ?>
- <?js } else if (doc.kind === 'class' || (doc.kind === 'namespace' && doc.signature)) { ?>
- <?js= self.partial('method.tmpl', doc) ?>
- <?js } else { ?>
- <?js if (doc.description) { ?>
- <div class="description"><?js= doc.description ?></div>
- <?js } ?>
- <?js= self.partial('details.tmpl', doc) ?>
- <?js if (doc.examples && doc.examples.length) { ?>
- <h3>Example<?js= doc.examples.length > 1? 's':'' ?></h3>
- <?js= self.partial('examples.tmpl', doc.examples) ?>
- <?js } ?>
- <?js } ?>
- </div>
- <?js
- var ignoreInheritedSymbols = { ...(self.ignoreInheritedSymbols ? { inherited: {isUndefined: true} } : {}) };
- var classes = self.find({kind: 'class', memberof: doc.longname});
- if (!isGlobalPage && classes && classes.length) {
- ?>
- <h2 class="subsection-title">Classes</h2>
- <dl>
- <?js classes.forEach(function(c) { ?>
- <dt><?js= self.linkto(c.longname, c.name) ?></dt>
- <dd><?js if (c.summary) { ?><?js= c.summary ?><?js } ?></dd>
- <?js }); ?>
- </dl>
- <?js } ?>
- <?js
- var members = self.find({kind: 'member', memberof: isGlobalPage ? {isUndefined: true} : doc.longname, ...ignoreInheritedSymbols});
- // symbols that are assigned to module.exports are not globals, even though they're not a memberof anything
- if (isGlobalPage && members && members.length && members.forEach) {
- members = members.filter(function(m) {
- if (m.longname && m.longname.indexOf('module:') === 0) return false;
- // Filter based on whether this is TSL or Global page
- var hasTslTag = m.tags && m.tags.some(function(tag) { return tag.title === 'tsl'; });
- return isTSLPage ? hasTslTag : !hasTslTag;
- });
- }
- if (members && members.length && members.forEach) {
- ?>
- <h2 class="subsection-title">Properties</h2>
- <?js members.forEach(function(p) { ?>
- <?js= self.partial('members.tmpl', p) ?>
- <?js }); ?>
- <?js } ?>
- <?js
- var methods = self.find({kind: 'function', memberof: isGlobalPage ? {isUndefined: true} : doc.longname, ...ignoreInheritedSymbols});
- // Filter methods for TSL vs Global
- if (isGlobalPage && methods && methods.length) {
- methods = methods.filter(function(m) {
- var hasTslTag = m.tags && m.tags.some(function(tag) { return tag.title === 'tsl'; });
- return isTSLPage ? hasTslTag : !hasTslTag;
- });
- }
- var staticMethods = methods.filter(function(m) { return m.scope === 'static'; });
- var instanceMethods = methods.filter(function(m) { return m.scope !== 'static'; });
- if (instanceMethods.length) {
- ?>
- <h2 class="subsection-title">Methods</h2>
- <?js instanceMethods.forEach(function(m) { ?>
- <?js= self.partial('method.tmpl', m) ?>
- <?js }); ?>
- <?js } ?>
- <?js if (staticMethods.length) { ?>
- <h2 class="subsection-title">Static Methods</h2>
- <?js staticMethods.forEach(function(m) { ?>
- <?js= self.partial('method.tmpl', m) ?>
- <?js }); ?>
- <?js } ?>
- <?js
- var typedefs = self.find({kind: 'typedef', memberof: isGlobalPage ? {isUndefined: true} : doc.longname, ...ignoreInheritedSymbols});
- if (typedefs && typedefs.length && typedefs.forEach) {
- ?>
- <h2 class="subsection-title">Type Definitions</h2>
- <?js typedefs.forEach(function(e) {
- if (e.signature) {
- ?>
- <?js= self.partial('method.tmpl', e) ?>
- <?js
- }
- else {
- ?>
- <?js= self.partial('members.tmpl', e) ?>
- <?js
- }
- }); ?>
- <?js } ?>
- <?js
- var events = self.find({kind: 'event', memberof: isGlobalPage ? {isUndefined: true} : doc.longname, ...ignoreInheritedSymbols});
- if (events && events.length && events.forEach) {
- ?>
- <h2 class="subsection-title">Events</h2>
- <?js events.forEach(function(e) { ?>
- <?js= self.partial('method.tmpl', e) ?>
- <?js }); ?>
- <?js } ?>
- <?js if (doc.meta && doc.meta.shortpath) { ?>
- <h2 class="subsection-title">Source</h2>
- <p>
- <a href="https://github.com/mrdoob/three.js/blob/master/<?js= doc.meta.shortpath ?>" translate="no"><?js= doc.meta.shortpath ?></a>
- </p>
- <?js } ?>
- </article>
- </section>
- <?js } ?>
- <?js }); ?>
|