|
@@ -264,10 +264,13 @@ var autoSaveTabList = (function(){ |
|
|
const PREF_DSTDIR = "dstdir"; |
|
|
const PREF_DSTDIR = "dstdir"; |
|
|
const PREF_ENABLED = "enabled"; |
|
|
const PREF_ENABLED = "enabled"; |
|
|
// use plugin option to set |
|
|
// use plugin option to set |
|
|
var save_interval = 60 * 10; |
|
|
|
|
|
|
|
|
// in sec |
|
|
|
|
|
var default_timer_interval = 60 * 5; |
|
|
// "/" for unix system |
|
|
// "/" for unix system |
|
|
const DIR_DELIM = userscript.directoryDelimitter; |
|
|
const DIR_DELIM = userscript.directoryDelimitter; |
|
|
|
|
|
|
|
|
|
|
|
var __timer = null; |
|
|
|
|
|
|
|
|
function selectDirectory(title){ |
|
|
function selectDirectory(title){ |
|
|
// open dialog and return nsILocalFile object |
|
|
// open dialog and return nsILocalFile object |
|
|
// https://developer.mozilla.org/en-US/docs/Mozilla/Tech/XPCOM/Reference/Interface/nsILocalFile |
|
|
// https://developer.mozilla.org/en-US/docs/Mozilla/Tech/XPCOM/Reference/Interface/nsILocalFile |
|
@@ -352,7 +355,7 @@ var autoSaveTabList = (function(){ |
|
|
var dstdir = util.getUnicharPref(PREF_PREFIX + PREF_DSTDIR); |
|
|
var dstdir = util.getUnicharPref(PREF_PREFIX + PREF_DSTDIR); |
|
|
if (! dstdir) { |
|
|
if (! dstdir) { |
|
|
display.showPopup("AutoSaveTabList", |
|
|
display.showPopup("AutoSaveTabList", |
|
|
"Dest dir is not set yet. Run setup first"); |
|
|
|
|
|
|
|
|
"Dest dir is not set yet. Run astl-setup first"); |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@@ -377,7 +380,7 @@ var autoSaveTabList = (function(){ |
|
|
openFromLFSplittedString(command.getClipboardText()); |
|
|
openFromLFSplittedString(command.getClipboardText()); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
function openFromLFSplittedString(str) { |
|
|
|
|
|
|
|
|
function openFromLFSplittedString(str){ |
|
|
var urls = str.split("\n"); |
|
|
var urls = str.split("\n"); |
|
|
for (var i = 0; i < urls.length; i++) { |
|
|
for (var i = 0; i < urls.length; i++) { |
|
|
if (urls[i].match(/^http/)) { |
|
|
if (urls[i].match(/^http/)) { |
|
@@ -386,13 +389,34 @@ var autoSaveTabList = (function(){ |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function enableTimer(sec){ |
|
|
|
|
|
sec = sec || default_timer_interval; |
|
|
|
|
|
__timer = window.setInterval(saveCurrentList, sec * 1000); |
|
|
|
|
|
display.showPopup("AutoSaveTabList", |
|
|
|
|
|
"Auto save enabled for every " + sec.toString() + " sec"); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function disableTimer(){ |
|
|
|
|
|
if (__timer) { |
|
|
|
|
|
window.clearInterval(__timer); |
|
|
|
|
|
__timer = null; |
|
|
|
|
|
display.showPopup("AutoSaveTabList", |
|
|
|
|
|
"Auto save disabled"); |
|
|
|
|
|
} else { |
|
|
|
|
|
display.showPopup("AutoSaveTabList", |
|
|
|
|
|
"Auto save timer is not set yet !"); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
return { |
|
|
return { |
|
|
selectDirectory: selectDirectory, |
|
|
selectDirectory: selectDirectory, |
|
|
setup: setup, |
|
|
setup: setup, |
|
|
getTabList: getTabList, |
|
|
getTabList: getTabList, |
|
|
saveCurrentList: saveCurrentList, |
|
|
saveCurrentList: saveCurrentList, |
|
|
openFromClipboard: openFromClipboard |
|
|
|
|
|
openFromFile: openFromFile |
|
|
|
|
|
|
|
|
openFromClipboard: openFromClipboard, |
|
|
|
|
|
openFromFile: openFromFile, |
|
|
|
|
|
enableTimer: enableTimer, |
|
|
|
|
|
disableTimer: disableTimer |
|
|
}; |
|
|
}; |
|
|
})(); |
|
|
})(); |
|
|
|
|
|
|
|
@@ -401,6 +425,9 @@ ext.add("astl-open-from-clipboard", autoSaveTabList.openFromClipboard, "Auto sav |
|
|
ext.add("astl-open-from-file", autoSaveTabList.openFromFile, "Auto save tab list - Open tabs from local file"); |
|
|
ext.add("astl-open-from-file", autoSaveTabList.openFromFile, "Auto save tab list - Open tabs from local file"); |
|
|
ext.add("astl-save-current", autoSaveTabList.saveCurrentList, |
|
|
ext.add("astl-save-current", autoSaveTabList.saveCurrentList, |
|
|
"Auto save tab list - Save current list"); |
|
|
"Auto save tab list - Save current list"); |
|
|
|
|
|
ext.add("astl-enable-timer", autoSaveTabList.enableTimer, "Auto save tab list - Enable periodic timer"); |
|
|
|
|
|
ext.add("astl-disable-timer", autoSaveTabList.disableTimer, "Auto save tab list - disable periodic timer"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var echoTabInfo = (function(){ |
|
|
var echoTabInfo = (function(){ |
|
|
var currenttab; |
|
|
var currenttab; |
|
|