Diff
diff --git a/cstyle/transformers/scrollbar/main.go b/cstyle/transformers/scrollbar/main.go
index 7740fb0..2eed321 100644
--- a/cstyle/transformers/scrollbar/main.go
+++ b/cstyle/transformers/scrollbar/main.go
@@ -4 +3,0 @@ import (
- "fmt"
@@ -21,12 +20,5 @@ func Init() cstyle.Transformer {
- overflowProps := strings.Split(n.Style["overflow"], " ")
- if n.Style["overflow-y"] == "" {
- val := overflowProps[0]
- if len(overflowProps) >= 2 {
- val = overflowProps[1]
- }
- n.Style["overflow-y"] = val
- }
- if n.Style["overflow-x"] == "" {
- n.Style["overflow-x"] = overflowProps[0]
- }
-
+ // !TODO: Inject grim-scrollbar and grim-scrollbar-thumb elements with stylings added to it
+ // + positioning of it should be done by the crop plugin
+ // + this is how all :: props should be handled, i think
+ // + also crop should hide this if
+ // fmt.Println(n.Style, "here")
@@ -37,2 +28,0 @@ func Init() cstyle.Transformer {
- fmt.Println(n.ScrollHeight, n.Style["height"])
-
@@ -57,0 +48 @@ func Init() cstyle.Transformer {
+ // backgroundColor = "rgba(0,255,255,1)"
@@ -58,0 +50 @@ func Init() cstyle.Transformer {
+ // thumbColor = "orange"
@@ -63,37 +55,27 @@ func Init() cstyle.Transformer {
- // Y scrollbar
-
- if n.Style["overflow-y"] == "scroll" || n.Style["overflow-y"] == "auto" {
- scrollbar := n.CreateElement("grim-scrollbar")
-
- scrollbar.Style["position"] = "absolute"
- scrollbar.Style["top"] = "0"
- scrollbar.Style["right"] = "0"
- scrollbar.Style["width"] = width
- scrollbar.Style["height"] = "100%"
- scrollbar.Style["z-index"] = "9"
- scrollbar.Style["background"] = backgroundColor
-
- thumb := n.CreateElement("grim-thumb")
-
- thumb.Style["position"] = "absolute"
- thumb.Style["top"] = strconv.Itoa(n.ScrollTop) + "px"
- thumb.Style["left"] = "0"
- thumb.Style["width"] = width
- thumb.Style["height"] = "20px"
- thumb.Style["background"] = thumbColor
- thumb.Style["cursor"] = "pointer"
- thumb.Style["z-index"] = "10"
- scrollbar.AppendChild(&thumb)
-
- n.Style["width"] = "calc(" + n.Style["width"] + "-" + width + ")"
- pr := n.Style["padding-right"]
- if pr == "" {
- if n.Style["padding"] != "" {
- pr = n.Style["padding"]
- }
- }
-
- if pr != "" {
- n.Style["padding-right"] = "calc(" + pr + "+" + width + ")"
- } else {
- n.Style["padding-right"] = width
+ scrollbar := n.CreateElement("grim-scrollbar")
+
+ scrollbar.Style["position"] = "absolute"
+ scrollbar.Style["top"] = "0"
+ scrollbar.Style["right"] = "0"
+ scrollbar.Style["width"] = width
+ scrollbar.Style["height"] = "100%"
+ scrollbar.Style["z-index"] = "9"
+ scrollbar.Style["background"] = backgroundColor
+
+ thumb := n.CreateElement("grim-thumb")
+
+ thumb.Style["position"] = "absolute"
+ thumb.Style["top"] = strconv.Itoa(n.ScrollTop) + "px"
+ thumb.Style["left"] = "0"
+ thumb.Style["width"] = width
+ thumb.Style["height"] = "20px"
+ thumb.Style["background"] = thumbColor
+ thumb.Style["cursor"] = "pointer"
+ thumb.Style["z-index"] = "10"
+ scrollbar.AppendChild(&thumb)
+
+ n.Style["width"] = "calc(" + n.Style["width"] + "-" + width + ")"
+ pr := n.Style["padding-right"]
+ if pr == "" {
+ if n.Style["padding"] != "" {
+ pr = n.Style["padding"]
@@ -100,0 +83 @@ func Init() cstyle.Transformer {
+ }
@@ -102 +85,4 @@ func Init() cstyle.Transformer {
- n.AppendChild(&scrollbar)
+ if pr != "" {
+ n.Style["padding-right"] = "calc(" + pr + "+" + width + ")"
+ } else {
+ n.Style["padding-right"] = width
@@ -104,0 +91,2 @@ func Init() cstyle.Transformer {
+ n.AppendChild(&scrollbar)
+