Firing off client side javascript in a partial
-
Throwing this in themes as it's about a template. portion...
I'm working on a plugin that throws some site specific data in the user profile/homepage.
At the moment, I'm simply trying to fire it off, inline, after the div it'll populate.
<script type="text/javascript">
loadArrayOfStuff( [ 1, 1, 1, 1, 1, 1, 1 ] );
</script>So far as I can see, this just flat out doesn't work. The loading method for the template doesn't trigger the function call.
I did a few cursory searches but didn't find anything that SEEMED to apply. What is the recommended way to do the thing here?
I only want this to fire on the profile, so I don't think I want stick this in a widget...
-
@Shard take a look at this plugin as reference
https://github.com/pichalite/nodebb-plugin-reactions/blob/master/lib/client.js#L10
That function is setup to run on the
topic
page. You can do that similarly for profile page. -
@pichalite said in Firing off client side javascript in a partial:
@Shard take a look at this plugin as reference
https://github.com/pichalite/nodebb-plugin-reactions/blob/master/lib/client.js#L10
That function is setup to run on the
topic
page. You can do that similarly for profile page.Well, I was part wrong. Seems that runs kinda inconsistently that way.
I discovered I couldn't pass the array as above from ( {myplugin.thearray} ) as the argument, found I couldn't iterate through that array unless I converted it to an array of objects.
But it won't launch in the iterated loop...
Augh.