• Resolved aryanduntley

    (@dunar21)


    ReferenceError: SlimStatAdmin is not defined

    For some reason, the slimsat variable defined in slimstat.admin.js is not available to the inline script in wp-slimstat-reports.php.

    I’ve tried defining the variable after page load (jquery(document).ready…) and I’ve tried checking if the variable exists before execution, however there are too many calls to the variable because it’s expected to already be defined, so the error will pass through the first check but come up again later when SlimStatAdmin is used again. I really do not have time to debug this completely and find a solution… that’s your job. So, just so you know that there is an issue there (for me and if for me, then for others as well). The error, obviously, prevents all further javascript execution and therefore none of the graphs or any other dom manipulation take place.

    https://wordpress.org/plugins/wp-slimstat/

Viewing 9 replies - 1 through 9 (of 9 total)
  • Thread Starter aryanduntley

    (@dunar21)

    PS. This is only happening, it seems, in firefox.

    Plugin Author Jason Crouse

    (@coolmann)

    Do you have adblock or similar add-on enabled in Firefox? Or maybe you have some other wp plugin that is compressing the page’s source code and stripping the js that defines that variable.

    Thread Starter aryanduntley

    (@dunar21)

    No, the source of the page has the js available in the header, in the correct location, before the inline script. I really don’t see why this variable is not able to be accessed there. The only thing I thought might be the case would be the order of calling based on the hooks, however that is all php and the page script should be and seems to be generating correctly. I’m not really sure why the issue is occurring.

    Plugin Author Jason Crouse

    (@coolmann)

    The inline script (the code that defines the variable [1]) should come BEFORE the file is being loaded:

    /* <![CDATA[ */
    var SlimStatAdminParams = {"async_load":"no","datepicker_image":"..." ETC
    /* ]]> */
    <script type='text/javascript' src='http://YOURSITE/wp-content/plugins/wp-slimstat/admin/js/slimstat.admin.js'></script>
    Thread Starter aryanduntley

    (@dunar21)

    No, not …adminparams but SlimStatAdmin located in slimstat.admin.js.

    ReferenceError: SlimStatAdmin is not defined
    SlimStatAdmin.chart_data = [];

    I’ll deactivate the plugins again to see if there is a conflict, but based on the error, it doesn’t seem as though there should be.

    Thread Starter aryanduntley

    (@dunar21)

    Ugh, you were right in your first post. The plugins were not the issue, I DID in fact have the add blocker installed on firefox. I apologize for not remembering that this was there. I deactivated it and the script is running fine now. Why would the ad blocker block that particular script? I do not know how the ad blocker works, but maybe there is a work-around? Again, sorry for not debugging better after your first response. Love the plugin, thanks.

    Plugin Author Jason Crouse

    (@coolmann)

    A vote for Slimstat would be a great way to say thank you 😉

    Thread Starter aryanduntley

    (@dunar21)

    Already done 🙂

    Plugin Author Jason Crouse

    (@coolmann)

    You’re fast! 😀

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘SlimStatAdmin not defined js error’ is closed to new replies.