• Home
  • Categories
  • Recent
  • Popular
  • Top
  • Tags
  • Users
  • Groups
  • Documentation
    • Home
    • Read API
    • Write API
    • Plugin Development
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
v3.5.2 Latest
Buy Hosting

Firing off client side javascript in a partial

Scheduled Pinned Locked Moved Unsolved Technical Support
4 Posts 2 Posters 1.6k Views
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • ShardS Offline
    ShardS Offline
    Shard
    wrote on last edited by Shard
    #1

    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...

    pichaliteP 1 Reply Last reply
    0
  • pichaliteP Offline
    pichaliteP Offline
    pichalite Plugin & Theme Dev
    replied to Shard on last edited by
    #2

    @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.

    ShardS 1 Reply Last reply
    0
  • ShardS Offline
    ShardS Offline
    Shard
    wrote on last edited by
    #3

    Oh for heaven's sake.

    The console had turned the logging tab off and I hadn't noticed...

    I'll be over in the corner with the dunce avatar on...

    1 Reply Last reply
    0
  • ShardS Offline
    ShardS Offline
    Shard
    replied to pichalite on last edited by
    #4

    @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.

    1 Reply Last reply
    0

Copyright © 2023 NodeBB | Contributors
  • Login

  • Don't have an account? Register

  • Login or register to search.
Powered by NodeBB Contributors
  • First post
    Last post
0
  • Home
  • Categories
  • Recent
  • Popular
  • Top
  • Tags
  • Users
  • Groups
  • Documentation
    • Home
    • Read API
    • Write API
    • Plugin Development