diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/compiler/scala/tools/nsc/doc/html/page/Index.scala | 19 | ||||
-rw-r--r-- | src/compiler/scala/tools/nsc/doc/html/page/Template.scala | 27 |
2 files changed, 30 insertions, 16 deletions
diff --git a/src/compiler/scala/tools/nsc/doc/html/page/Index.scala b/src/compiler/scala/tools/nsc/doc/html/page/Index.scala index c76bdc58d9..8802d7c35c 100644 --- a/src/compiler/scala/tools/nsc/doc/html/page/Index.scala +++ b/src/compiler/scala/tools/nsc/doc/html/page/Index.scala @@ -27,13 +27,19 @@ class Index(universe: doc.Universe, val index: doc.Index) extends HtmlPage { val headers = <xml:group> <link href={ relativeLinkTo{List("index.css", "lib")} } media="screen" type="text/css" rel="stylesheet"/> - <script type="text/javascript" src={ relativeLinkTo{List("jquery.js", "lib")} }></script> - <script type="text/javascript" src={ relativeLinkTo{List("jquery-ui.js", "lib")} }></script> - <script type="text/javascript" src={ relativeLinkTo{List("jquery.layout.js", "lib")} }></script> - <script type="text/javascript" src={ relativeLinkTo{List("index.js", "lib")} }></script> - <script type="text/javascript" src={ relativeLinkTo{List("scheduler.js", "lib")} }></script> </xml:group> + private val scripts = { + val sources = + (List("jquery.js", "jquery-ui.js", "jquery.layout.js", "scheduler.js", "index.js").map { + x => relativeLinkTo(List(x, "lib")) + }) :+ "index.js" + + sources map { + src => <script defer="defer" type="text/javascript" src={src}></script> + } + } + val body = <body> <div id="library"> @@ -46,6 +52,7 @@ class Index(universe: doc.Universe, val index: doc.Index) extends HtmlPage { <div id="content" class="ui-layout-center"> <iframe id="template" name="template" src={ relativeLinkTo{List("package.html")} }/> </div> + { scripts } </body> def letters: NodeSeq = @@ -125,7 +132,7 @@ class Index(universe: doc.Universe, val index: doc.Index) extends HtmlPage { </xml:group> } packageElem(universe.rootPackage) - }</div></div><script src="index.js"></script> + }</div></div> </div> def packageQualifiedName(ety: DocTemplateEntity): String = diff --git a/src/compiler/scala/tools/nsc/doc/html/page/Template.scala b/src/compiler/scala/tools/nsc/doc/html/page/Template.scala index 5cbb14b486..63c77e7bb3 100644 --- a/src/compiler/scala/tools/nsc/doc/html/page/Template.scala +++ b/src/compiler/scala/tools/nsc/doc/html/page/Template.scala @@ -40,14 +40,6 @@ class Template(universe: doc.Universe, generator: DiagramGenerator, tpl: DocTemp <xml:group> <link href={ relativeLinkTo{List("template.css", "lib")} } media="screen" type="text/css" rel="stylesheet"/> <link href={ relativeLinkTo{List("diagrams.css", "lib")} } media="screen" type="text/css" rel="stylesheet" id="diagrams-css" /> - <script type="text/javascript" src={ relativeLinkTo{List("jquery.js", "lib")} } id="jquery-js"></script> - <script type="text/javascript" src={ relativeLinkTo{List("jquery-ui.js", "lib")} }></script> - <script type="text/javascript" src={ relativeLinkTo{List("template.js", "lib")} }></script> - <script type="text/javascript" src={ relativeLinkTo{List("tools.tooltip.js", "lib")} }></script> - { if (universe.settings.docDiagrams.value) { - <script type="text/javascript" src={ relativeLinkTo{List("modernizr.custom.js", "lib")} }></script> - <script type="text/javascript" src={ relativeLinkTo{List("diagrams.js", "lib")} } id="diagrams-js"></script> - } else NodeSeq.Empty } <script type="text/javascript"> if(top === self) {{ var url = '{ val p = templateToPath(tpl); "../" * (p.size - 1) + "index.html" }'; @@ -61,6 +53,22 @@ class Template(universe: doc.Universe, generator: DiagramGenerator, tpl: DocTemp </script> </xml:group> + private val scripts = { + val sources = { + val default = List("jquery.js", "jquery-ui.js", "tools.tooltip.js", "template.js") + val forDiagrams = List("modernizr.custom.js", "diagrams.js") + + (default ++ (if (universe.settings.docDiagrams.value) forDiagrams else Nil)) map { + x => x.replace('.', '-') -> relativeLinkTo(List(x, "lib")) + } + } + + sources map { + case (id, src) => + <script defer="defer" type="text/javascript" id={id} src={src}></script> + } + } + val valueMembers = tpl.methods ++ tpl.values ++ tpl.templates.filter(x => x.isObject || x.isPackage) sorted @@ -280,8 +288,7 @@ class Template(universe: doc.Universe, generator: DiagramGenerator, tpl: DocTemp else <div id="footer"> { tpl.universe.settings.docfooter.value } </div> } - - + { scripts } </body> } |