summaryrefslogtreecommitdiff
path: root/src/scaladoc/scala/tools/nsc/doc/html/resource/lib/template.js
diff options
context:
space:
mode:
authorFelix Mulder <felix.mulder@gmail.com>2016-02-25 21:37:47 +0100
committerFelix Mulder <felix.mulder@gmail.com>2016-03-01 11:29:29 +0100
commit5229f97eb9bbd434fb659c29a1d287788a1485f6 (patch)
treeb2d22db318b3aa7048631495ddd1a6dfc58aba4a /src/scaladoc/scala/tools/nsc/doc/html/resource/lib/template.js
parent239d76f21520b17c1a1866e7d2b518f6952d84b1 (diff)
downloadscala-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/lib/template.js')
-rw-r--r--src/scaladoc/scala/tools/nsc/doc/html/resource/lib/template.js51
1 files changed, 18 insertions, 33 deletions
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);