Including jQuery mixin file in plugin

NodeBB Plugins
  • Hi Guys! I've been writing a plugin for parsing a post for magic the gathering card names and loading an image of the card within the post.

    That works great, but now instead of loading the image directly into the post, I'd like to make a link to a lightbox where the image will be shown. So far I've parsed the post to replace card names with the anchor element, but I cannot properly load a jquery plugin.

    Focusing v0.8.x branch, you can find my current code here: https://github.com/jacobbridges/nodebb-plugin-mtg/tree/v0.3.0

    Any help would be very appreciated..I have been on this for hours and I do not want to give up!

  • Used to be a big fan of MtG. Think I still have a Mox Diamond in my collection that I should probably just sell since its otherwise collecting dust.

    Anyways, can you be more specific as to what your problem is? You can't just add the jquery plugin js into your plugin.json script object?

  • @psychobunny thanks for the response! Sorry it took me a day to get back to you.And if you no longer play I'd happily take that Mox Diamond off your hands. 🙂

    Anyway, my problem is that I cannot properly load the Stripjs library with my plugin. I've tried several ways to include the script into my application. Most of them end up with Uncaught Error: Mismatched anonymous define() module but when I used require.js in my main.js, a different error occurred which was the $ (jQuery) was undefined and the jQuery lightbox plugin I am using could not call $.extend. I doubt I'm explaining this properly as it half sounds like Greek to me. But I assume the staticDir in my plugin is being ran on page load before jQuery is loaded---that is why $ is undefined.

    I got so frustrated with it that I just wrote my own extremely simple lightbox with plain javascript and loaded it into my plugin, though I would still love to use the external library instead.

  • MTGsalvation has this functionality, but with an older tech backend. It is very important to the UX of a mtg related site. Best of luck!
    (I play Cheeri0s and Dredge in modern 🙂 )

  • Uncaught Error: Mismatched anonymous define() module

    This one is a known pain point for NodeBB, hopefully something we can fix in 1.0 when we move off requirejs and use browserify instead.

    See the changes to imagesLoaded.js and masonry.js for how its done; you'll have to make a small modification to the library:

    https://github.com/NodeBB/nodebb-theme-lavender/commit/c652195bd440a0e15e511a40f5f8484272a38a45

  • Thank you @psychobunny! I'll look into how to modify the library for that.

    @lulzdevlol Nice to see someone else using Dredge! That's my favorite mechanic.


Suggested Topics


  • 0 Votes
    5 Posts
    423 Views

    RESOLVED

    If anyone else sees this thread... Don't be the american who thinks the default should be en-US....

    It appears that the nodeBB default language was set for en-GB

    If you need to adjust the language default setting:

    Go to your NodeBB ACP (admin control panel) => General => Languages

  • Spam protection plugin

    NodeBB Plugins
    0 Votes
    3 Posts
    759 Views

    I've had great luck with Spam Be Gone and Captcha's with keeping spammers out of my old site running on SMF. The initial problem though was weeding out all of the spammers that had signed up before I implemented it. I probably manually deleted 2000+ accounts. After that was taken care of, I never found a need to look at individual posts automatically. The ones that slipped through were flagged by users or a moderator deleted it and the associated account.

    The Spam Be Gone plugin prevented over 130,000 spammers from creating accounts in the 4+ years that I used it. It was very effective. I did try Akismet for awhile, but got sick of paying for it. I didn't notice any reduced functionality when I got rid of it.

    I would try Spam Be Gone, use Google's v3 captcha ("I'm not a robot." checkbox), and then make some of your trusted active users into moderators with the ability to delete posts/topics/accounts.

  • 0 Votes
    8 Posts
    3k Views

    @PitaJ No need to submit a PR or so, this can be a plugin!
    I noticed the action:plugin.* hook which is fired on install/uninstall of a plugin! That's perfect for my needs, it allows me to monitor easily!
    I can also use Plugins.showInstalled to retrieve the list of plugins currently installed and save it directly on load!
    And maybe parse the package.json of each plugin to be able to install the exact version that was used.

  • 1 Votes
    4 Posts
    3k Views

    @mootzville Hi. Is it possible to update this plugin to work with 1.17 ?

  • 5 Votes
    38 Posts
    15k Views

    Contest has started, here's the official link: https://community.nodebb.org/topic/2527/nodebb-plugin-theme-contest-bonanza-2014/2
    Locking this thread 🙂