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>2015-12-24 18:32:29 +0100
committerFelix Mulder <felix.mulder@gmail.com>2016-01-04 18:18:04 +0100
commit30959e5b6b9267286d10c0a7ef2f7cc17f43fcbd (patch)
treeb5b28b7b84fb8abbf5c93af947410715b026202a /src/scaladoc/scala/tools/nsc/doc/html/resource/lib/template.js
parent73d8306424931acb301c9c00b19d72d31f51037e (diff)
downloadscala-30959e5b6b9267286d10c0a7ef2f7cc17f43fcbd.tar.gz
scala-30959e5b6b9267286d10c0a7ef2f7cc17f43fcbd.tar.bz2
scala-30959e5b6b9267286d10c0a7ef2f7cc17f43fcbd.zip
add mobile CSS rules for updated scaladoc look
This commit addresses the need for an improved mobile viewing experience. Specifically it introduces CSS media queries to adjust sizing and indentation of elements on mobile devices. This includes the following changes: - replace absolute font sizing with relative font sizing - fix font-resizing issues for mobile by fixing viewport - hide related links when viewport too small - fix missing trigram from heaven on Android - remove indentation on annotations e.g. `@throws` and place associated text on a separate line - fix bottom scoll-bar appearing on code-snippets - add spacing between entity icons in browser - add dynamic top offset for entity description - fix long entity names corrupting style - remove "EXPERIMENTAL" button from shortcomment divs on mobile
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.js28
1 files changed, 27 insertions, 1 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 be71839502..9d9d7bdfff 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
@@ -1,7 +1,7 @@
// © 2009–2010 EPFL/LAMP
// code by Gilles Dubochet with contributions by Pedro Furlanetto, Marcin Kubala and Felix Mulder
-$(document).ready(function(){
+$(document).ready(function() {
$("#template > div > div > ol > li > span > a").click(function(e) {
$("#template > div > div > ol > li").removeClass("selected");
@@ -10,6 +10,32 @@ $(document).ready(function(){
$('html,body').animate({scrollTop: $(this).offset().top - defHeight}, 500);
});
+ /* Handle dynamic size of signature and offset the fullcommenttop div
+ * appropriately
+ *
+ * Some mobile devices render quite slowly, delay the margin-top
+ * calculation if mobile
+ */
+ if(/Android|webOS|Mobi|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) {
+ setTimeout(function() {
+ $("div.fullcommenttop").css({
+ "margin-top": $("#definition").height() + $("#signature").height() + 15
+ });
+ }, 1000);
+ } else {
+ $("div.fullcommenttop").css({
+ "margin-top": $("#definition").height() + $("#signature").height() + 15
+ });
+ }
+
+ /* When the window is resized, adjust the fullcommenttop div's offset */
+ $(window).resize(function() {
+ $("div.fullcommenttop").css({
+ "margin-top": $("#definition").height() + $("#signature").height() + 15
+ });
+ });
+
+
var controls = {
visibility: {
publicOnly: $("#visbl").find("> ol > li.public"),