2 Replies Latest reply on May 20, 2014 1:42 PM by Powell

    Can the Javascript API be used from within a theme?

    Powell

      Hi all,

      Weird question, forgive me

      So say I have a theme some template within it I reference a custom js...

      Can I utilize the JIve Javascript API within this context of a custom js within a theme?  If so how?

       

      2nd part of question:

      What is the best way to grab environmental information within a javascript called from a theme template?

      For example, I am on a idea page, and I need to do something client side based on what group the id is in, how would I get the idea for the group the idea "resides" in?

      -Thanks,

      Powell

        • Re: Can the Javascript API be used from within a theme?

          The Javascript API is designed to be used inside of Jive Apps specifically, and cannot be leveraged outside of that...including themes. =\

           

          There is very little available via the javascript when you are clicking around via a theme.  Usually you can glean where you are via meta-tags and JS variables (off the top of my head, I do not remember them, but Dave Myers would be a great person to ask).

           

          As for the "currentUser" there is a lovely JSON structure, available in JS,

          window._jive_current_user

          which contains information like username, ID, etc... which can help with some experience management.

           

          Hope that helps.