diff options
author | Felix Mulder <felix.mulder@gmail.com> | 2016-02-25 21:37:47 +0100 |
---|---|---|
committer | Felix Mulder <felix.mulder@gmail.com> | 2016-03-01 11:29:29 +0100 |
commit | 5229f97eb9bbd434fb659c29a1d287788a1485f6 (patch) | |
tree | b2d22db318b3aa7048631495ddd1a6dfc58aba4a /src/scaladoc/scala/tools/nsc/doc/html/resource | |
parent | 239d76f21520b17c1a1866e7d2b518f6952d84b1 (diff) | |
download | scala-5229f97eb9bbd434fb659c29a1d287788a1485f6.tar.gz scala-5229f97eb9bbd434fb659c29a1d287788a1485f6.tar.bz2 scala-5229f97eb9bbd434fb659c29a1d287788a1485f6.zip |
Unclutter scaladoc entity members
This commit attempts to fix some minor annoyances regarding the UI when
it comes to how things are shown. I.e. the complete definition is now
hidden. Long signatures like:
```scala
class HashMap[A, +B] extends AbstractMap[A, B] with Map[A, B] with
MapLike[A, B, HashMap[A, B]] with Serializable with
CustomParallelizable[(A, B), ParHashMap[A, B]]
```
will be reduced to: `class HashMap[A, +B]`. Full signature will be shown
on hover and unfold.
The package-view has been tweaked to look better on non-HiDPI displays.
Also, subpackages to current package are now displayed before other
entities.
Diffstat (limited to 'src/scaladoc/scala/tools/nsc/doc/html/resource')
4 files changed, 137 insertions, 119 deletions
diff --git a/src/scaladoc/scala/tools/nsc/doc/html/resource/lib/index.css b/src/scaladoc/scala/tools/nsc/doc/html/resource/lib/index.css index cb11df3011..abb7ec4924 100644 --- a/src/scaladoc/scala/tools/nsc/doc/html/resource/lib/index.css +++ b/src/scaladoc/scala/tools/nsc/doc/html/resource/lib/index.css @@ -413,14 +413,16 @@ div#content-container > div#content { -webkit-overflow-scrolling: touch; display: block; overflow-y: auto; - margin: 5em auto 0; + max-width: 1140px; + margin: 4em auto 0; } div#content-container > div#subpackage-spacer { float: right; height: 100%; - margin: 0.5rem 0.5rem 0 0.5em; + margin: 1.1rem 0.5rem 0 0.5em; font-size: 0.8em; + min-width: 8rem; } div#packages > h1 { @@ -440,6 +442,10 @@ div#packages > ul > li { padding-left: 2em; } +div#packages > ul > li.current-entities { + margin: 0.3rem 0; +} + div#packages > ul > li.current:hover { -webkit-touch-callout: none; -webkit-user-select: none; @@ -449,39 +455,41 @@ div#packages > ul > li.current:hover { cursor: pointer; } -div#packages > ul > li > *:nth-child(1), -div#packages > ul > li > *:nth-child(2) { +div#packages > ul > li.current-entities > *:nth-child(1), +div#packages > ul > li.current-entities > *:nth-child(2) { float: left; display: inline; - height: 1em; - width: 1em; - margin: 2px 0 0; + height: 1rem; + width: 1rem; + margin: 1px 0 0 0; cursor: pointer; } div#packages > ul > li > a.class { background: url("class.svg") no-repeat center; - background-size: 0.9em; + background-size: 0.9rem; } div#packages > ul > li > a.trait { background: url("trait.svg") no-repeat center; - background-size: 0.9em; + background-size: 0.9rem; } div#packages > ul > li > a.object { background: url("object.svg") no-repeat center; - background-size: 0.9em; + background-size: 0.9rem; } div#packages > ul > li > a.abstract.type { background: url("abstract_type.svg") no-repeat center; - background-size: 0.9em; + background-size: 0.9rem; } div#packages > ul > li > a { text-decoration: none !important; - margin-left: 0.1em; + margin-left: 1px; + font-family: "Source Code Pro"; + font-size: 0.9em; } /* Indentation levels for packages */ diff --git a/src/scaladoc/scala/tools/nsc/doc/html/resource/lib/permalink.svg b/src/scaladoc/scala/tools/nsc/doc/html/resource/lib/permalink.svg deleted file mode 100644 index a11d568d94..0000000000 --- a/src/scaladoc/scala/tools/nsc/doc/html/resource/lib/permalink.svg +++ /dev/null @@ -1 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="24" fill="#ffffff" height="24" viewBox="0 0 24 24"><path d="M10.59,13.41C11,13.8 11,14.44 10.59,14.83C10.2,15.22 9.56,15.22 9.17,14.83C7.22,12.88 7.22,9.71 9.17,7.76V7.76L12.71,4.22C14.66,2.27 17.83,2.27 19.78,4.22C21.73,6.17 21.73,9.34 19.78,11.29L18.29,12.78C18.3,11.96 18.17,11.14 17.89,10.36L18.36,9.88C19.54,8.71 19.54,6.81 18.36,5.64C17.19,4.46 15.29,4.46 14.12,5.64L10.59,9.17C9.41,10.34 9.41,12.24 10.59,13.41M13.41,9.17C13.8,8.78 14.44,8.78 14.83,9.17C16.78,11.12 16.78,14.29 14.83,16.24V16.24L11.29,19.78C9.34,21.73 6.17,21.73 4.22,19.78C2.27,17.83 2.27,14.66 4.22,12.71L5.71,11.22C5.7,12.04 5.83,12.86 6.11,13.65L5.64,14.12C4.46,15.29 4.46,17.19 5.64,18.36C6.81,19.54 8.71,19.54 9.88,18.36L13.41,14.83C14.59,13.66 14.59,11.76 13.41,10.59C13,10.2 13,9.56 13.41,9.17Z" /></svg> diff --git a/src/scaladoc/scala/tools/nsc/doc/html/resource/lib/template.css b/src/scaladoc/scala/tools/nsc/doc/html/resource/lib/template.css index 1827868171..c61ab92841 100644 --- a/src/scaladoc/scala/tools/nsc/doc/html/resource/lib/template.css +++ b/src/scaladoc/scala/tools/nsc/doc/html/resource/lib/template.css @@ -53,10 +53,6 @@ body { text-decoration: none; } -body.trait div#definition { - background-color: #2e6d82; -} - #types ol li > p { margin-top: 5px; } @@ -71,8 +67,7 @@ body.trait div#definition { padding: 5px 0; padding: 0; margin: 0.5em; - border-radius: 0.2em; - box-shadow: 0 0 10px rgba(0,0,0,0.2); + min-height: 4.72em; } #definition > a > img { @@ -86,7 +81,8 @@ body.trait div#definition { } #definition > h1 { - color: white; + float: left; + color: #103a51; display: inline-block; overflow: hidden; margin-top: 10px; @@ -94,19 +90,28 @@ body.trait div#definition { } #definition h1 > a { - color: #fff !important; + color: #103a51 !important; text-decoration: none !important; } +#template ol > li > span.permalink > a > i { + transform: rotate(-45deg); +} + #definition #owner { - color: #ffffff; + color: #103a51; padding-top: 1.3em; font-size: 0.8em; overflow: hidden; } +#definition > h3 { + margin-top: 0.85em; + padding: 0; +} + #definition #owner > a { - color: #ffffff; + color: #103a51; } #definition #owner > a:hover { @@ -114,14 +119,13 @@ body.trait div#definition { } #signature { - background-color:#c2d2dc; + background-color: #c2d2dc; min-height: 18px; font-size: 0.9em; padding: 8px; - width: 100%; color: #103a51; - border-bottom-left-radius: 0.2em; - border-bottom-right-radius: 0.2em; + border-radius: 0.2em; + margin: 0 0.5rem; } #signature > span.modifier_kind { @@ -151,7 +155,7 @@ span.symbol > a { .toggleContainer .toggle { position: relative; color: #103a51; - margin-left: 2.3em; + margin-left: 0.3em; cursor: pointer; -webkit-touch-callout: none; -webkit-user-select: none; @@ -196,18 +200,6 @@ span.symbol > a { opacity: 1; } -.value #definition { - background-color: #103A51; /* blue */ -} - -.type #definition { - background-color: rgba(49, 101, 85, 1); /* green */ -} - -.abstract.type #definition { - background-color: #447A90; -} - .big-circle { box-sizing: content-box; height: 5.7em; @@ -254,12 +246,14 @@ body.abstract.type div.big-circle { #template { margin: 0.9em 0.75em 0.75em; - border-radius: 0.2em; - background-color: #fff; - -webkit-box-shadow: 0 0 10px rgba(0,0,0,0.1); - box-shadow: 0 0 10px rgba(0,0,0,0.1); padding-bottom: 0.5em; - overflow: hidden; +} + +#template h3 { + color: #103a51; + height: 2em; + padding: 1em 1em 2em; + font-size: 1.2em; } #order { @@ -267,7 +261,7 @@ body.abstract.type div.big-circle { } h3 { - color: white; + color: #103a51; padding: 5px 10px; font-size: 1em; font-weight: bold; @@ -292,21 +286,10 @@ dl.attributes > dd { min-height: 15px; } -#template .values > h3 { - color: #2C475C; - height: 2em; - padding: 1em 1em 2em; - font-size: 1.2em; -} - .values ol li:last-child { margin-bottom: 5px; } -#template .types > h3 { - height: 18px; -} - #constructors > h3 { height: 2em; padding: 1em 1em 2em; @@ -337,21 +320,23 @@ dl.attributes > dd { /* Member cells */ div.members > ol { - background-color: white; list-style: none; - padding: 0 10px; } div.members > ol > li { display: table; width: 100%; position: relative; - background-color: #e1e7ed; + background-color: #fff; border-radius: 0.2em; color: #103a51; padding: 5px 0 5px; margin-bottom: 0.4em; - min-height: 2.8em; + min-height: 3.7em; + border-left: 0 solid #72D0EB; + -webkit-box-shadow: 0 0 10px rgba(0,0,0,0.1); + box-shadow: 0 0 10px rgba(0,0,0,0.1); + transition: 0.1s; } div.members > ol >li.selected, @@ -359,6 +344,12 @@ div.members > ol > li:hover { background-color: #c2d2dc; } +div.members > ol >li[fullComment=yes].selected, +div.members > ol > li[fullComment=yes]:hover { + cursor: pointer; + border-left: 0.25em solid #72D0EB; +} + div.members > ol > li:last-child { border: 0; padding: 5px 0 5px; @@ -422,6 +413,16 @@ span.symbol > span.name { font-weight: bold; } +#types > ol > li > span.symbol > span.result { + display: none; +} + +#types > ol > li > span.symbol > span.result.alias, +#types > ol > li:hover > span.symbol > span.result, +#types > ol > li.open > span.symbol > span.result { + display: inline; +} + .symbol > .implicit { display: inline-block; font-weight: bold; @@ -467,7 +468,7 @@ i.unfold-arrow { #template .values .name { font-weight: 600; - color: darkblue; + color: #315479; } #template .types .name { @@ -510,31 +511,35 @@ div#definition > h4#signature > span.modifier_kind > i.unfold-arrow, #definition .morelinks { text-align: right; - position: absolute; - top: 2.95em; - right: 1em; - width: 450px; font-family: 'Source Sans Pro', 'Helvetica Neue', Arial, sans-serif; } #definition .morelinks a { - color: #EBEBEB; + color: #103a51; } #template .members li .permalink { position: absolute; - top: 5px; - right: 5px; + left: 0.25em; + top: 0.95em; } #definition .permalink { - position: absolute; - top: 10px; - right: 15px; + display: none; + color: black; } #definition .permalink a { - color: #EBEBEB; + color: #103a51; + transform: rotate(-45deg); +} + +#definition > h1 > span > a > i { + font-size: 1.4rem; +} + +#template ol > li > span.permalink > a > i { + color: #fff; } #template .members li .permalink, @@ -723,6 +728,7 @@ div.fullcomment .block { } div.fullcommenttop .block { + position: relative; padding: 1em; margin: 0.5em 0; border-radius: 0.2em; @@ -731,6 +737,16 @@ div.fullcommenttop .block { box-shadow: 0 0 10px rgba(0,0,0,0.1); } +div.fullcommenttop .toggleContainer { + border-left: 0 solid #72D0EB; + transition: 0.1s; + cursor: pointer; +} + +div.fullcommenttop .toggleContainer:hover { + border-left: 0.25em solid #72D0EB; +} + div#comment, div#mbrsel, div#template, @@ -843,12 +859,9 @@ div.fullcomment dl.paramcmts > dd { margin: 0.8em; border-radius: 0.2em; background-color: #364550; - -webkit-box-shadow: 0 0 10px rgba(0,0,0,0.1); - box-shadow: 0 0 10px rgba(0,0,0,0.1); + -webkit-box-shadow: 0 0 10px rgba(0,0,0,0.2); + box-shadow: 0 0 10px rgba(0,0,0,0.2); position: relative; - margin-bottom: -1em; - border-bottom-left-radius: 0; - border-bottom-right-radius: 0; } #mbrsel > div.toggle { @@ -881,6 +894,12 @@ div.fullcomment dl.paramcmts > dd { left: 0; top: 0; color: #fff; + -webkit-touch-callout: none; + -webkit-user-select: none; + -khtml-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; } #mbrsel > div.toggle.open > i { @@ -1029,7 +1048,7 @@ div.fullcomment dl.paramcmts > dd { /* Media query rules for smaller viewport */ @media only screen /* Large screen with a small window */ -and (max-width: 560px) +and (max-width: 650px) , screen /* HiDPI device like Nexus 5 */ and (max-device-width: 360px) @@ -1062,16 +1081,23 @@ and (-webkit-device-pixel-ratio: 2) height: 6em; } + #definition > h1 { + font-size: 1em; + margin-right: 0.3em; + } + + #definition > h3 { + float: left; + margin: 0.3em 0; + } + + #definition > #owner { + padding-top: 2.6em; + } + #definition .morelinks { text-align: left; - left: 7.2em; font-size: 0.8em; - top: auto; - bottom: 0.5em; - } - - #signature { - top: 6.7em; } .big-circle { diff --git a/src/scaladoc/scala/tools/nsc/doc/html/resource/lib/template.js b/src/scaladoc/scala/tools/nsc/doc/html/resource/lib/template.js index ebffe81490..8bf5f77152 100644 --- a/src/scaladoc/scala/tools/nsc/doc/html/resource/lib/template.js +++ b/src/scaladoc/scala/tools/nsc/doc/html/resource/lib/template.js @@ -16,15 +16,16 @@ $(document).ready(function() { $zoomOut: $('#diagram-zoom-out'), }); - $("#template > div > div > ol > li > span > a").click(function(e) { - var href = $(this).attr("href"); + $("#template > div > div > ol > li > span.permalink").click(function(e) { + e.preventDefault(); + var href = $("a", this).attr("href"); if (href.indexOf("#") != -1) { - e.preventDefault(); location.hash = href.split("#").pop(); $("#template > div > div > ol > li").removeClass("selected"); - var parent = $(this).parent().parent().addClass("selected"); - $("#content-container").animate({scrollTop: $("#content-container").scrollTop() + $(this).offset().top - $("#search").height() - 22}, 500); + var parent = $(this).parent().addClass("selected"); + $("#content-container").animate({scrollTop: $("#content-container").scrollTop() + $(this).offset().top - $("#search").height() - 23}, 500); } + return false; }); var oldWidth = $("div#subpackage-spacer").width() + 1 + "px"; @@ -214,19 +215,16 @@ $(document).ready(function() { filter(); }); $("#order > ol > li.alpha").click(function() { - if ($(this).hasClass("out")) { + if ($(this).hasClass("out")) orderAlpha(); - } }) $("#order > ol > li.inherit").click(function() { - if ($(this).hasClass("out")) { + if ($(this).hasClass("out")) orderInherit(); - } }); $("#order > ol > li.group").click(function() { - if ($(this).hasClass("out")) { + if ($(this).hasClass("out")) orderGroup(); - } }); $("#groupedMembers").hide(); @@ -243,9 +241,7 @@ $(document).ready(function() { }); /* Add toggle arrows */ - //var docAllSigs = $("#template li").has(".fullcomment").find(".signature"); - // trying to speed things up a little bit - var docAllSigs = $("#template li[fullComment=yes] .modifier_kind"); + $("#template li[fullComment=yes] .modifier_kind").addClass("closed"); function commentToggleFct(signature){ var parent = signature.parent(); @@ -272,15 +268,17 @@ $(document).ready(function() { } } }; - docAllSigs.addClass("closed"); - docAllSigs.click(function() { - commentToggleFct($(this)); + + $("#template li[fullComment=yes]").click(function() { + $("#template li.selected").removeClass("selected"); + commentToggleFct($(".modifier_kind", this)); + $(this).toggleClass("open"); }); /* Linear super types and known subclasses */ function toggleShowContentFct(e){ e.toggleClass("open"); - var content = $(".hiddenContent", e.parent().get(0)); + var content = $(".hiddenContent", e); if(content.is(':visible')) { if (!isMobile()) content.slideUp(100); else content.hide(); @@ -290,13 +288,10 @@ $(document).ready(function() { } }; - $(".toggle:not(.diagram-link)").click(function() { + $(".toggleContainer:not(.diagram-container)").click(function() { toggleShowContentFct($(this)); }); - // Set parent window title - windowTitle(); - if ($("#order > ol > li.group").length == 1) { orderGroup(); }; function findElementByHash(locationHash) { @@ -308,9 +303,8 @@ $(document).ready(function() { // highlight and jump to selected member if (window.location.hash) { var jqElem = findElementByHash(window.location.hash); - if (jqElem.length > 0) { + if (jqElem.length > 0) exposeMember(jqElem); - } } $("#mbrsel-input").on("focus", function() { @@ -543,15 +537,6 @@ function filter() { return false; }; -function windowTitle() { - try { - parent.document.title=document.title; - } catch(e) { - // Chrome doesn't allow settings the parent's title when - // used on the local file system. - } -}; - /** Check if user agent is associated with a known mobile browser */ function isMobile() { return /Android|webOS|Mobi|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent); |