Support » Plugin: WordPress LiveRacers » Java script errors

  • I have the widget in the side bar. When using full width pages or having the visibility filtered. the widget gives JS errors:

    Uncaught TypeError: Cannot read property 'url' of undefined
        at HTMLDocument.<anonymous> (wp-liveracers.js?ver=1:26)
        at i (jquery.js?ver=1.12.4:2)
        at Object.fireWith [as resolveWith] (jquery.js?ver=1.12.4:2)
        at Function.ready (jquery.js?ver=1.12.4:2)
        at HTMLDocument.K (jquery.js?ver=1.12.4:2)

    The page I need help with: [log in to see the link]

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author pglewis

    (@pglewis)

    I apologize for long delay, my excuse is that I don’t seem to get email notifications on new support posts. This plugin isn’t super active, being a niche, there’s not a lot to break, and it has been stable for ages so I haven’t been checking in here very often.

    Excuses aside I will still support the plugin. Let me know if you still have issues and haven’t found a workaround and I’ll play around based on the info in your post and see if I can reproduce the problem.

    Thanks for the reply 🙂

    I think i never managed to “fix” it. what i did was not use the plug-in directly but use a Custom HTML widget with the instructions at:

    http://liveracers.com/Support/Widgets/Widget/Live

    using the code:

    <div id="lr-servers" orientation="horizontal" width="300px" canjoin="true"></div>

    and it was working for sometime. later I got a SSL certificate for the website and so the script stopped working whenusing https, I changed the URL in the <head> in to https:

    <script type="text/javascript">
        window._lr = {
            url: 'httpS://liveracers.com',
            domains: ['domain'] //or multiple domains: ['domain1', 'domain2']
        };
        (function () {
        	var lr = document.createElement('script'); lr.type = 'text/javascript'; lr.async = true;
        	lr.src = window._lr.url + '/Scripts/api.js';
        	var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(lr, s);
        })();	
    </script>

    But it didnt work anymore.

    so right now it doesnt show any server unless i forced the use of non-secure http.

    • This reply was modified 3 months, 4 weeks ago by  osilvab.
    Plugin Author pglewis

    (@pglewis)

    Let’s trace this back from the main error message: “Cannot read property ‘url’ of undefined”. That would be coming from here:

    https://github.com/pglewis/wp-liveracers/blob/15485d0/scripts/wp-liveracers.js#L26

    There should be a global Javascript _lr object and _lr.url should hold the league’s LiveRacer URL. The _lr object should be created in a script tag directly above the div that holds the widget itself:

    https://github.com/pglewis/wp-liveracers/blob/15485d0/wp-liveracers.php#L107

    The error basically says the _lr object doesn’t exist, however. My first guess was maybe the widget area was inside an iFrame in your theme or something like that but I don’t see any such thing checking your page.

    The first thing I’d do is manually double-check that _lr is missing from the console in Dev Tools (Chrome), Firebug (Firefox), or whatever your browser uses to get to the Javascript console. Just type _lr (note the leading underscore) and hit enter and see if it is undefined. If so, you’ll want to check the page source where the widget is inserted and see if the script that defines _lr exists.

    • This reply was modified 3 months, 4 weeks ago by  pglewis.

    The thing is that I’m not using the plugin anymore. so right now the problem can not be reproduced.

    But if it helps, the plugin was being used on the siderbar that was visible only on homepage. But in other pages where sidebar was hidden then it was showing those errors and the format of the page (full width) was misplaced.

    Now i’m using the manual approach with the codes found in the liveracers page. I have the script on the <head> of the webpage and a custom html widget instead of the wp-liveracers plugin. It works well, but not in https.

Viewing 4 replies - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.