@@ -182,12 +182,13 @@ export function enableSmoothScroll() {
182182 /***********************************************
183183 * SETTINGS
184184 ***********************************************/
185- chrome . storage . sync . get ( defaultOptions , function ( syncedOptions ) {
186- options = syncedOptions ;
187- // it seems that sometimes settings come late
188- // and we need to test again for excluded pages
189- initTest ( ) ;
190- } ) ;
185+ // chrome.storage.sync.get(defaultOptions, function (syncedOptions) {
186+ // options = syncedOptions;
187+ // // it seems that sometimes settings come late
188+ // // and we need to test again for excluded pages
189+ // initTest();
190+ // });
191+ initTest ( ) ;
191192 /***********************************************
192193 * INITIALIZE
193194 ***********************************************/
@@ -735,11 +736,11 @@ export function enableSmoothScroll() {
735736 if ( deltaY < 50 ) tp = true ;
736737 clearTimeout ( deltaBufferTimer ) ;
737738 deltaBufferTimer = setTimeout ( function ( ) {
738- chrome . storage . local . set ( {
739+ chrome ? .storage ? .local ? .set ?. ( {
739740 deltaBuffer : deltaBuffer ,
740741 } ) ;
741742 if ( ! tp )
742- chrome . storage . local . set ( {
743+ chrome ? .storage ? .local ? .set ?. ( {
743744 lastDiscreetWheel : dateNow ( ) ,
744745 } ) ;
745746 } , 1000 ) ;
@@ -755,7 +756,7 @@ export function enableSmoothScroll() {
755756 isDivisible ( deltaBuffer [ 2 ] , divisor )
756757 ) ;
757758 }
758- chrome . storage . local . get ( "deltaBuffer" , function ( stored ) {
759+ chrome ? .storage ? .local ? .get ?. ( "deltaBuffer" , function ( stored ) {
759760 if ( stored . deltaBuffer ) {
760761 deltaBuffer = stored . deltaBuffer ;
761762 }
@@ -838,21 +839,21 @@ export function enableSmoothScroll() {
838839 // we check the OS for default middle mouse behavior only!
839840 let isLinux = navigator . platform . indexOf ( "Linux" ) != - 1 ;
840841 // get global settings
841- chrome . storage . sync . get ( defaultOptions , function ( syncedOptions ) {
842- options = syncedOptions ;
843- // leave time for the main script to check excluded pages
844- setTimeout ( function ( ) {
845- // if we shouldn't run, stop listening to events
846- if ( isExcluded && ! options . middleMouse ) {
847- cleanup ( ) ;
848- }
849- } , 10 ) ;
850- } ) ;
842+ // chrome.storage.sync.get(defaultOptions, function (syncedOptions) {
843+ // options = syncedOptions;
844+ // // leave time for the main script to check excluded pages
845+ // setTimeout(function () {
846+ // // if we shouldn't run, stop listening to events
847+ // if (isExcluded && !options.middleMouse) {
848+ // cleanup();
849+ // }
850+ // }, 10);
851+ // });
851852 /**
852853 * Initializes the image at the reference point.
853854 */
854855 function init ( ) {
855- let url = chrome . runtime . getURL ( "/scripts/smoothscroll_cursor.png" ) ;
856+ let url = chrome ? .runtime ? .getURL ?. ( "/scripts/smoothscroll_cursor.png" ) ;
856857 img . style . background = "url(" + url + ") no-repeat" ;
857858 img . style . position = "fixed" ;
858859 img . style . zIndex = "999999999" ;
0 commit comments