load/lonm-autosave-sessions.js
/**
     * Init the mod, but only if we are not incognito, to maintain privacy.
     * Save the window id in storage, and only use the most recent window to save sessions
     */
Init the mod, but only if we are not incognito, to maintain privacy.
Save the window id in storage, and only use the most recent window to save sessions
Init the mod but only if we are not incognito to maintain privacy . Save the window id in storage and only use the most recent window to save sessions
function init(){
        if(window.vivaldiWindowId){
            chrome.windows.getCurrent(window => {
                if(!window.incognito){
                    chrome.storage.local.set({
                        "LONM_SESSION_AUTOSAVE_LAST_WINDOW": window.vivaldiWindowId
                    }, () => {
                        setInterval(triggerAutosave, CURRENT_SETTINGS["LONM_SESSION_AUTOSAVE_DELAY_MINUTES"]*60*1000);
                    });
                }
                if(CURRENT_SETTINGS["LONM_SESSION_SAVE_PRIVATE_WINDOWS"] && window.incognito){
                    chrome.storage.local.set({
                        "LONM_SESSION_AUTOSAVE_LAST_PRIV_WINDOW": window.vivaldiWindowId
                    }, () => {
                        setInterval(triggerAutosavePrivate, CURRENT_SETTINGS["LONM_SESSION_AUTOSAVE_DELAY_MINUTES"]*60*1000);
                    });
                }
                chrome.tabs.onUpdated.addListener(function(tabId, changeInfo, tab) {
                    if (changeInfo.url === SETTINGSPAGE) {
                        modSettingsPage();
                    }
                })
            });
        } else {
            setTimeout(init, 500);
        }
    }
function init ( ) { if ( window . vivaldiWindowId ) { chrome . windows . getCurrent ( window => { if ( ! window . incognito ) { chrome . storage . local . set ( { "LONM_SESSION_AUTOSAVE_LAST_WINDOW" : window . vivaldiWindowId } , ( ) => { setInterval ( triggerAutosave , CURRENT_SETTINGS [ "LONM_SESSION_AUTOSAVE_DELAY_MINUTES" ] * 60 * 1000 ) ; } ) ; } if ( CURRENT_SETTINGS [ "LONM_SESSION_SAVE_PRIVATE_WINDOWS" ] && window . incognito ) { chrome . storage . local . set ( { "LONM_SESSION_AUTOSAVE_LAST_PRIV_WINDOW" : window . vivaldiWindowId } , ( ) => { setInterval ( triggerAutosavePrivate , CURRENT_SETTINGS [ "LONM_SESSION_AUTOSAVE_DELAY_MINUTES" ] * 60 * 1000 ) ; } ) ; } chrome . tabs . onUpdated . addListener ( function ( tabId , changeInfo , tab ) { if ( changeInfo . url === SETTINGSPAGE ) { modSettingsPage ( ) ; } } ) } ) ; } else { setTimeout ( init , 500 ) ; } }
Init the mod, but only if we are not incognito, to maintain privacy.
Init the mod but only if we are not incognito to maintain privacy .