0

Hey I'm writing chrome extension and I need to get access to blurSpy in this code:

            var updateCt = (function() {
                var onBlurHandler = function () {
                    window.honestRespondentWarning_popup.open();
                };

                var blurSpy = new BlurSpy(onBlurHandler, null, -1);

                $(function() {
                    if ( document.hasFocus() ) {
                        blurSpy.start();
                    } else {
                        $(window).one("focus", function() {
                            if ( document.hasFocus() ) {
                                blurSpy.start();
                            }
                        });
                    }
                });

                return function() {
                    document.forms["questionForm"]["wb"].value = blurSpy.getBlursCount();
                    eraseCookie('blurs');
                    setEndTimeCookie();
                }
            })();

This code is in script tag in site main html file. Is it doable? ofc I used that trick to gain access to console-like js commands execution so my extension can do that if it is possible from console on site.

woda
  • 107
  • 1
  • 5
  • It's not possible to access local variables from outside a function. – Barmar Jun 02 '20 at 19:27
  • @Barmar maybe it's possible to edit like inject some code to this function and save reference to object globally or do what i need to do there? – woda Jun 02 '20 at 19:30
  • `BlurSpy` seems to be a global type so you can redefine it and thus store the new instance. Note though this all should be done in [page context](/a/9517879). – wOxxOm Jun 02 '20 at 19:36

0 Answers0