From 9195a855b9f4a02440b70fe83addd37ff60b41ad Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Sun, 30 Mar 2014 15:22:43 -0400 Subject: Page: update 'text' format output * Remove tags * Show page title and URL for each entry --- chrome-get-urls-from-tabs-in-windows.js | 41 ++++++++++++++++++++++----------- 1 file changed, 27 insertions(+), 14 deletions(-) (limited to 'chrome-get-urls-from-tabs-in-windows.js') diff --git a/chrome-get-urls-from-tabs-in-windows.js b/chrome-get-urls-from-tabs-in-windows.js index a689b0c..0717a01 100644 --- a/chrome-get-urls-from-tabs-in-windows.js +++ b/chrome-get-urls-from-tabs-in-windows.js @@ -2,26 +2,39 @@ var textarea = document.getElementById('copy-area'); var create_download_link; var generate_filename; -chrome.windows.getAll({populate:true},function(windows){ + +chrome.windows.getAll({populate:true}, function(windows){ var w_index = 0; - windows.forEach(function(window){ - textarea.value += "Window " + w_index + ":"; + chrome.storage.sync.get(function(items) { + var format = items.file_format; + console.log(format); + + if (format === 'yaml') { + + } + else if (format === 'html') { + + } + else { // format === 'text' + windows.forEach(function(window){ + textarea.value += "Window " + w_index + ":"; + + window.tabs.forEach(function(tab){ + textarea.value += "\n"; + textarea.value += "\t* " + tab.title + "\n"; + textarea.value += "\t " + tab.url + "\n"; + }); - window.tabs.forEach(function(tab){ - //collect all of the urls here, I will just log them instead - //console.log(tab.url); - textarea.value += "\n\t"; - textarea.value += '* ' + tab.url + "\n"; - textarea.value += "\t\t" + '' + tab.title + ''; - }); + textarea.value += "\n\n"; - textarea.value += "\n\n"; + w_index++; + }); + } - w_index++; + + create_download_link(textarea.value); }); - - create_download_link(textarea.value); }); -- cgit v1.2.3