Am 04.02.2012 20:10, schrieb Anonymous Usercript writer:
I gues post was TLDR sorry anyway that was not the entire userscript
just the code that did not work. (withb the HTMLs inluded)
Right so to replace stuff do I need to remove them then insert New
HTML or does that code automaticly remove everything covered by the
element?
element.innerHTML = "";
sets the innerHTML to the new source code, just like
variable = "New value";
sets the value to the new one, disposing the old one. However I want to
warn you that the results might not necessarily be the ones you
expected/wanted: some functionality might be linked to the elements by
code. Those linkage is invisible within the code, but realized browser
internally. If you replace the tags, the linkage is lost. That might
lead to unwanted side effects like clicking on elements does not trigger
an action that it did before. I don't know if that applies to that part
of the code, but some drop down buttons might apply to that. Especially
the new YouTube gets its functionality by a lot of jQuery code. If you
just want to replace some href of anchors and add elements, you should
do that single step, not by replacing the innerHTML.
Chris
--
You received this message because you are subscribed to the Google Groups
"greasemonkey-users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/greasemonkey-users?hl=en.