[valadoc] html: Allow to change +/- icons in CSS



commit f5b61201cc434cdb55d363d318e45ae423aada28
Author: Florian Brosch <flo brosch gmail com>
Date:   Sun Jan 17 00:40:45 2016 +0100

    html: Allow to change +/- icons in CSS

 icons/devhelpstyle.css               |   10 +++-------
 icons/scripts.js                     |    7 +++++--
 icons/style.css                      |   11 +++--------
 src/libvaladoc/html/basicdoclet.vala |   28 +++++++++++++++-------------
 4 files changed, 26 insertions(+), 30 deletions(-)
---
diff --git a/icons/devhelpstyle.css b/icons/devhelpstyle.css
index 8de747b..1fb803d 100644
--- a/icons/devhelpstyle.css
+++ b/icons/devhelpstyle.css
@@ -542,6 +542,9 @@ code {
 .box {
 }
 .box .headline {
+       background-image: url("coll_open.png");
+       background-position: calc(100% - 1px) center;
+       background-repeat: no-repeat;
        background-color: #eeeeff;
        border-color: #aaaaff;
        border-style: solid;
@@ -549,14 +552,7 @@ code {
        margin: auto;
        width: 90%;
        margin-top: 20px;
-}
-.box .text {
        font-weight: bold;  
-       float: left;
-}
-.box .toggle {
-       text-align: right;
-       float: clear;
 }
 .box .content {
        border-color: #aaaaff;
diff --git a/icons/scripts.js b/icons/scripts.js
index eb79093..02629ed 100644
--- a/icons/scripts.js
+++ b/icons/scripts.js
@@ -35,12 +35,15 @@ function toggle_box (self, id) {
                return ;
        }
 
+       var style = self.currentStyle || window.getComputedStyle (self, false);
+       var orig_path = /url[ \t]*\(('(.*)'|"(.*)")\)/.exec (style.backgroundImage)[1].slice(1, -1);
+       var orig_dir = get_path (orig_path);
        if (element.style.display == 'block') {
                element.style.display = 'none';
-               self.src = get_path (self.src) + 'coll_open.png';
+               self.style.backgroundImage = "url('" + orig_dir + 'coll_open.png' + "')";
        } else {
                element.style.display = 'block';
-               self.src = get_path (self.src) + 'coll_close.png';
+               self.style.backgroundImage = "url('" + orig_dir + 'coll_close.png' + "')";
        }
 }
 
diff --git a/icons/style.css b/icons/style.css
index c4ffc13..160cdcb 100644
--- a/icons/style.css
+++ b/icons/style.css
@@ -592,10 +592,12 @@ code {
        text-decoration: underline;
 }
 
-
 .box {
 }
 .box .headline {
+       background-image: url("coll_open.png");
+       background-position: calc(100% - 1px) center;
+       background-repeat: no-repeat;
        background-color: #eeeeff;
        border-color: #aaaaff;
        border-style: solid;
@@ -603,14 +605,7 @@ code {
        margin: auto;
        width: 90%;
        margin-top: 20px;
-}
-.box .text {
        font-weight: bold;  
-       float: left;
-}
-.box .toggle {
-       text-align: right;
-       float: clear;
 }
 .box .content {
        border-color: #aaaaff;
diff --git a/src/libvaladoc/html/basicdoclet.vala b/src/libvaladoc/html/basicdoclet.vala
index 67e76ad..66ab3e0 100644
--- a/src/libvaladoc/html/basicdoclet.vala
+++ b/src/libvaladoc/html/basicdoclet.vala
@@ -627,19 +627,21 @@ public abstract class Valadoc.Html.BasicDoclet : Api.Visitor, Doclet {
                writer.start_tag ("div", {"class", css_box});
 
                // headline:
-               writer.start_tag ("div", {"class", css_box_headline});
-               writer.start_tag ("div", {"class", css_box_headline_text})
+               writer.start_tag ("div", {"class", css_box_headline, "onclick", "toggle_box (this, 
'%s')".printf (html_id)})
                        .text (headline)
                        .end_tag ("div");
-               writer.start_tag ("div", {"class", css_box_headline_toggle});
-               writer.start_tag ("img", {"onclick",
-                                                                 "toggle_box  (this, '" + html_id + "')",
-                                                                 "src",
-                                                                 Path.build_filename (get_icon_directory (),
-                                                                 "coll_open.png")});
-               writer.raw_text ("&nbsp;");
-               writer.end_tag ("div");
-               writer.end_tag ("div");
+               //writer.start_tag ("div", {"class", css_box_headline_text, "onclick", "toggle_box (this, 
'%s')".printf (html_id)})
+               //      .text (headline)
+               //      .end_tag ("div");
+               //writer.start_tag ("div", {"class", css_box_headline_toggle});
+               //writer.start_tag ("img", {"onclick",
+               //                                                "toggle_box  (this, '" + html_id + "')",
+               //                                                "src",
+               //                                                Path.build_filename (get_icon_directory (),
+               //                                                "coll_open.png")});
+               //writer.raw_text ("&nbsp;");
+               //writer.end_tag ("div");
+               //writer.end_tag ("div");
 
 
                // content:
@@ -720,7 +722,6 @@ public abstract class Valadoc.Html.BasicDoclet : Api.Visitor, Doclet {
                                                                          "All known sub-structs:");
                }
 
-
                if (node.parent is Namespace) {
                        writer.simple_tag ("br");
                        write_namespace_note (node);
@@ -744,7 +745,8 @@ public abstract class Valadoc.Html.BasicDoclet : Api.Visitor, Doclet {
                                        Api.NodeType.PROPERTY,
                                        Api.NodeType.FIELD,
                                        Api.NodeType.CONSTANT
-                               })) {
+                               }))
+                       {
                                writer.start_tag ("h2", {"class", css_title}).text ("Content:").end_tag 
("h2");
                                write_children (node, Api.NodeType.ERROR_CODE, "Error codes", node);
                                write_children (node, Api.NodeType.ENUM_VALUE, "Enum values", node);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]