Javascript Functions

jimmyk
jimmyk
@jimmy
8 years ago
514 posts
Is there a list somewhere of the javascript functions available to developers. In the docs there is a line which is quoted below:

"There are a number of javascript functions provided by Jamroom Core that are useful to know."
https://www.jamroom.net/the-jamroom-network/documentation/development/1670/javascript-functions

But the only one listed in the docs is jrCore_window_location().

Is it possible to get a list of the available functions? Or an update to the docs at least listing what's available.

Thanks!
updated by @jimmy: 09/07/16 02:35:31AM
michael
@michael
8 years ago
7,715 posts
from /modules/jrCore/js/jrCore.js these ones are useful:

jrCore_set_csrf_cookie() // useful for ajax submission use in conjunction with the php function jrCore_validate_location_url(); to make sure the location sending the data is one you want sending the data. prevent CSRF attacks


jrSetCookie // sets a cookie
jrReadCookie // read a cookie
jrEraseCookie // erase a cookie

There are probably other ones provided by other modules, depends on what you're interested in doing.
updated by @michael: 06/04/16 12:06:04AM
jimmyk
jimmyk
@jimmy
8 years ago
514 posts
Thanks @michael

I'm converting another script into a JR module and it's very JS heavy. So, if you find any others, let me know.

Now I'm hungry for cookies! ;)
michael
@michael
8 years ago
7,715 posts
I don't remember all the code, I just go look in the /js/ directory for a file called the name of the module, then use alt+shift+- (in phpstorm) to shrink all the functions down to their explanation and name, then expand ones that look interesting.

Same thing for modules, repeat process for the include.php file to see what functions it provides. :)
jimmyk
jimmyk
@jimmy
8 years ago
514 posts
Thanks for the tip!

It took me a little bit, but loving phpstorm. :)
michael
@michael
8 years ago
7,715 posts
yeah me too. fantastic program. Tons of stuff to keep finding. Saw someone using it in a video the other day and though "ok, they haven't found the auto-complete html yet :) "

in an html document if you write

div.someclass(then hit tab) it will produce
<div class="someclass"></div>
or
table>tr.someclass>td.odd(then hit tab) it will produce
<table>
    <tr class="someclass">
        <td class="odd"></td>
    </tr>
</table>

excellent piece of software.
jimmyk
jimmyk
@jimmy
8 years ago
514 posts
That's pretty neat. I'll have to watch some videos on YouTube and find some tips n tricks for using it.

I honestly don't know how I lived without phpstorm.
updated by @jimmy: 06/05/16 06:14:12PM
michael
@michael
8 years ago
7,715 posts
I found most of the interesting stuff from PHPSTORM -> HELP -> PRODUCTIVITY GUIDE

Then click the USED colum and look through stuff that are labeled "never" been used.
jimmyk
jimmyk
@jimmy
8 years ago
514 posts
I'll have to check that out. Thanks!

Tags