@@ -182,12 +182,13 @@ export function enableSmoothScroll() {
182
182
/***********************************************
183
183
* SETTINGS
184
184
***********************************************/
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 ( ) ;
191
192
/***********************************************
192
193
* INITIALIZE
193
194
***********************************************/
@@ -735,11 +736,11 @@ export function enableSmoothScroll() {
735
736
if ( deltaY < 50 ) tp = true ;
736
737
clearTimeout ( deltaBufferTimer ) ;
737
738
deltaBufferTimer = setTimeout ( function ( ) {
738
- chrome . storage . local . set ( {
739
+ chrome ? .storage ? .local ? .set ?. ( {
739
740
deltaBuffer : deltaBuffer ,
740
741
} ) ;
741
742
if ( ! tp )
742
- chrome . storage . local . set ( {
743
+ chrome ? .storage ? .local ? .set ?. ( {
743
744
lastDiscreetWheel : dateNow ( ) ,
744
745
} ) ;
745
746
} , 1000 ) ;
@@ -755,7 +756,7 @@ export function enableSmoothScroll() {
755
756
isDivisible ( deltaBuffer [ 2 ] , divisor )
756
757
) ;
757
758
}
758
- chrome . storage . local . get ( "deltaBuffer" , function ( stored ) {
759
+ chrome ? .storage ? .local ? .get ?. ( "deltaBuffer" , function ( stored ) {
759
760
if ( stored . deltaBuffer ) {
760
761
deltaBuffer = stored . deltaBuffer ;
761
762
}
@@ -838,21 +839,21 @@ export function enableSmoothScroll() {
838
839
// we check the OS for default middle mouse behavior only!
839
840
let isLinux = navigator . platform . indexOf ( "Linux" ) != - 1 ;
840
841
// 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
+ // });
851
852
/**
852
853
* Initializes the image at the reference point.
853
854
*/
854
855
function init ( ) {
855
- let url = chrome . runtime . getURL ( "/scripts/smoothscroll_cursor.png" ) ;
856
+ let url = chrome ? .runtime ? .getURL ?. ( "/scripts/smoothscroll_cursor.png" ) ;
856
857
img . style . background = "url(" + url + ") no-repeat" ;
857
858
img . style . position = "fixed" ;
858
859
img . style . zIndex = "999999999" ;
0 commit comments