• 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

How can I add a script tag to the page from a plugin

Scheduled Pinned Locked Moved Plugin Development
3 Posts 2 Posters 1.5k 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.
  • P Offline
    P Offline
    PAEz
    wrote on last edited by
    #1

    I just made my first plugin (yay me) and Im happy enough with it, except for one thing.
    Right now Im adding a script tag to the page using the Custom HTML & CSS, which works but is rather bleh.
    Id like to be able to inject it from code in the plugin some how, so the user doesnt have to add that stuff to the custom html.
    The script tag links to the dropbox dropin api stuff, so it wouldnt be a good idea to down it and link locally.

    I put it on Github incase that helps....
    https://github.com/PAEz/nodebb-plugin-dropbox-chooser
    ...if you wanna see it working its on c9.....
    https://nodebb-paez.c9.io/

    OH, and its a button for composer that allows you to pick a file from github using its chooser dropin and add its link to the post.

    1 Reply Last reply
    0
  • yariplusY Offline
    yariplusY Offline
    yariplus Community Rep
    wrote on last edited by
    #2

    You can just stick it in the require call, just tested it on my forum and it worked.

          require(['composer', 'composer/controls', 'https://www.dropbox.com/static/api/2/dropins.js'], function(composer, controls) {
    
    1 Reply Last reply
    2
  • P Offline
    P Offline
    PAEz
    wrote on last edited by
    #3

    Off course, tha'll work!
    Thanks heaps for that!

    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