diff options
| author | Teddy Wing | 2014-03-30 18:22:47 -0400 |
|---|---|---|
| committer | Teddy Wing | 2014-03-30 18:27:59 -0400 |
| commit | c1d8d6c29f885978fdb5f4adac3515606d100434 (patch) | |
| tree | a4dbcf2650535519ad4c7cf281af5b98a1963305 | |
| parent | 2795d431059557d84cd0898b2eb6ab806a895fbf (diff) | |
| download | chrome-copy-urls-from-all-tabs-c1d8d6c29f885978fdb5f4adac3515606d100434.tar.bz2 | |
Generate HTML output
| -rw-r--r-- | chrome-get-urls-from-tabs-in-windows.js | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/chrome-get-urls-from-tabs-in-windows.js b/chrome-get-urls-from-tabs-in-windows.js index 7d0faad..aefab19 100644 --- a/chrome-get-urls-from-tabs-in-windows.js +++ b/chrome-get-urls-from-tabs-in-windows.js @@ -26,19 +26,35 @@ chrome.windows.getAll({populate:true}, function(windows){ }); } else if (format === 'html') { + textarea.value += '<!doctype html>\n\ +<html lang="en">\n\ +<head>\n\ + <meta charset="utf-8">\n'; + + textarea.value += ' <title>Chrome Copy URLs From All Tabs</title>\n'; + + textarea.value += '</head>\n\ +<body>\n\ + <div role="main">\n'; + windows.forEach(function(window){ - textarea.value += "Window " + w_index + ":"; + textarea.value += " <h1>Window " + w_index + ":</h1>\n\n"; + textarea.value += " <ul>\n"; window.tabs.forEach(function(tab){ - textarea.value += "\n"; - textarea.value += "\t* " + tab.title + "\n"; - textarea.value += "\t " + tab.url + "\n"; + textarea.value += " <li>\n" + textarea.value += " <a href=\"" + tab.url + "\">" + tab.title + "</a>\n"; + textarea.value += " </li>\n" }); - textarea.value += "\n\n"; + textarea.value += " </ul>\n"; w_index++; }); + + textarea.value += ' </div>\n\ +</body>\n\ +</html>'; } else { // format === 'text' windows.forEach(function(window){ |
