diff options
author | Florian Brosch <flo.brosch@gmail.com> | 2016-01-17 00:40:45 +0100 |
---|---|---|
committer | Florian Brosch <flo.brosch@gmail.com> | 2016-01-17 00:41:15 +0100 |
commit | f5b61201cc434cdb55d363d318e45ae423aada28 (patch) | |
tree | cbed2d149c00a3f897616a04c2689a3ccfafef1e | |
parent | 836db337f758b1639e5a6bc9d620d611e78bc78b (diff) | |
download | vala-f5b61201cc434cdb55d363d318e45ae423aada28.tar.gz |
html: Allow to change +/- icons in CSS
-rw-r--r-- | icons/devhelpstyle.css | 10 | ||||
-rw-r--r-- | icons/scripts.js | 7 | ||||
-rw-r--r-- | icons/style.css | 11 | ||||
-rw-r--r-- | src/libvaladoc/html/basicdoclet.vala | 28 |
4 files changed, 26 insertions, 30 deletions
diff --git a/icons/devhelpstyle.css b/icons/devhelpstyle.css index 8de747b66..1fb803df1 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 eb7909365..02629edd9 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 c4ffc1351..160cdcba4 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 67e76addc..66ab3e053 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 (" "); - 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 (" "); + //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); |