I know that TW takes the tiddler data and renders it. Every time TW senses
a change it refreshes it. Instead of putting the code outside of the
system, what I want to do is modify how tiddlywiki renders this data. In
your words, I want to modify the widget; I just don't know which one.
I have created the html manually, but I want to decrease the amount of time
it takes
On Friday, October 6, 2017 at 12:45:47 AM UTC-7, BJ wrote:
>
> Are you asking (in general) how the dom can be manipulate after
> tiddlywiki has created it?
>
> TW5 is similar to react, it creates the dom using other elements.
>
> Tw creates its own tree, a tree of widgets, it is the result of compiling
> wikitext (or markdown). A widget create dom elements and link them to the
> parent domnode provided by the widgets ancestor (its parent widget).
> Because of this the dom is tied to the widget tree, and so, in general,
> running javascript to manipulate the dom is a bad idea as it may interfere
> with the association between widgets and domnodes.
>
> So it is better to use wikitext
>
>
> On Friday, October 6, 2017 at 1:16:54 AM UTC+1, K wrote:
>>
>> That's really helpful information BJ, but I've finally isolated what I
>> want to do - I want to put a section of code to change the way tiddlywiki
>> renders html tags, but I have no idea where - the script below takes h3
>> tags and appends a link floating to the right of them:
>>
>> function appendH3() {
>> var a = document.createElement('a');
>> a.appendChild(linkText);
>> a.href = "#tw-href000";
>> a.style.float = "right";
>> var linkText = document.createTextNode("[Top]");
>> var x = document.querySelectorAll("h3");
>> var arr = [];
>>
>> for(var i = x.length; i--; arr.unshift(x[i]));
>> for (var i = arr.length - 1; i >= 0; i -= 1) {
>> var clone = a.cloneNode(true);
>> arr[i].appendChild(clone);
>> }
>> }
>>
>> Consulting the dev tiddlywiki, tiddlywiki refreshes its contents, but
>> where do I put it?
>>
>> On Thursday, October 5, 2017 at 3:00:30 PM UTC-7, BJ wrote:
>>>
>>> Have at look at this thread
>>>
>>> https://groups.google.com/forum/#!msg/tiddlywiki/NwOI-QER2ig/lSLS3XolwDoJ
>>>
>>> all the best
>>>
>>> BJ
>>>
>>> On Thursday, October 5, 2017 at 4:32:16 AM UTC+1, K wrote:
>>>>
>>>> Ok, Ive written a function...
>>>> Where do I put it?
>>>>
>>>>
>>>> function appendH3() {
>>>> var my_elem = document.getElementsByTagName(h3);
>>>>
>>>> var appender1 = document.createElement(a);
>>>> appender1.href = "#tw-href000";
>>>> appender1.style.float='right';
>>>> appender1.textContent = '[Top]';
>>>>
>>>> my_elem.parentNode.insertBefore(appender1, my_elem);
>>>> }
>>>>
>>>> ---
>>>>
>>>> The above function didnt work due to me having no knowledge in
>>>> javascript.
>>>>
>>>> After fiddling around, I managed to create a correct script, but I
>>>> still don't know where to put it....
>>>>
>>>> function appendH3() {
>>>> var a = document.createElement('a');
>>>> a.appendChild(linkText);
>>>> a.href = "#tw-href000";
>>>> a.style.float = "right";
>>>> var linkText = document.createTextNode("[Top]");
>>>> var x = document.querySelectorAll("h3");
>>>> var arr = [];
>>>>
>>>> for(var i = x.length; i--; arr.unshift(x[i]));
>>>> for (var i = arr.length - 1; i >= 0; i -= 1) {
>>>> var clone = a.cloneNode(true);
>>>> arr[i].appendChild(clone);
>>>> }
>>>> }
>>>>
>>>
--
You received this message because you are subscribed to the Google Groups
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit
https://groups.google.com/d/msgid/tiddlywiki/48b468a4-f684-453b-af21-93bc2cfdc726%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.