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



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

    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.


  • Community Rep

    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) {


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


Log in to reply
 

Suggested Topics

| |