lib/atome/renderers/browser/helpers/browser_helper.rb in atome-0.5.4.1.3 vs lib/atome/renderers/browser/helpers/browser_helper.rb in atome-0.5.4.1.7
- old
+ new
@@ -13,45 +13,44 @@
def self.browser_attach_div(parents, html_object, _atome)
html_object.append_to(browser_document[parents])
end
- def self.colorize_vector(vector_id, tag_style)
- # TODO : Create a class instead of modidfying the vector
+ def self.add_class_to_vector(vector_id, color_id)
+ # TODO : Create a class instead of modifying the vector
# get the content the <style> tag
- color_class=self.color.last
+ # color_class=self.color.last
+ # alert color_class
# alert color_class.class
# content_style = tag_style.inner_html
# color_value = content_style[/background-color:\s*([^;}]+)/, 1]
`
let parser = new DOMParser();
var divElement = document.querySelector('#'+#{vector_id});
-divElement.style.removeProperty('background-color');
-divElement.style.backgroundColor = 'transparent';
+// divElement.style.removeProperty('background-color');
+//divElement.style.backgroundColor = 'transparent';
// select the first svg tag inside the div
let foundSVG = divElement.querySelector('svg');
let elements = foundSVG.getElementsByTagName("path");
Array.from(elements).forEach(el => {
- el.classList.add(#{color_class});
+ el.classList.add(#{color_id});
});
`
end
def self.browser_attach_style(parents, _html_object, atome)
- # we test if the atome has a deinition ( it means hold some vectors infomations)
+ # we test if the atome has a definition ( it means hold some vectors information)
if grab(parents).atome[:definition]
- tag_style = $document[atome[:id]]
- # # get the content the <style> tag
- # content_style = tag_style.inner_html
- # extract the color value
- colorize_vector(parents, tag_style)
-
+ # tag_style = $document[atome[:id]]
+ # # # get the content the <style> tag
+ # # content_style = tag_style.inner_html
+ # # extract the color value
+ # alert atome[:id]
+ add_class_to_vector(parents, atome[:id])
else
browser_document[parents].add_class(atome[:id])
-
end
-
end
def self.browser_attached_div(children, _html_object, atome)
children.each do |child_found|
# atome_child.browser_attach_div
@@ -60,14 +59,15 @@
end
end
def self.browser_attached_style(children, _html_object, atome)
if atome[:definition]
+ # alert "yes we arrived here :>\n\n=>#{children}, class:\n=>#{children.class} :\n\n=> #{atome} :\n\n=> #{_html_object}<:"
children.each do |child|
- tag_style = $document[child]
-
- colorize_vector(atome[:id], tag_style)
+ # tag_style = $document[child]
+ # alert "(#{atome[:id]}, #{child})"
+ add_class_to_vector(atome[:id], child)
# get the content the <style> tag
# content_style = tag_style.inner_html
# # extract the color value
# color_value = content_style[/background-color:\s*([^;}]+)/, 1]
# `
@@ -82,14 +82,13 @@
# });
# `
end
else
- # alert atome.class
- browser_document[atome[:id]].add_class(children)
+ # alert "class added : #{children}"
+ # browser_document[atome[:id]].add_class(children)
end
- # browser_document[atome[:id]].add_class(children)
-
+ browser_document[atome[:id]].add_class(children)
end
def self.value_parse(value)
if value.instance_of?(String)
value