From 08781bc28dfa2bd517a0806eab65e6fa2f30974a Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Sun, 30 Mar 2014 19:19:12 -0400 Subject: Add functionality for downloading backup on icon click If the download option is set, a backup file is now downloaded when the extension button is clicked. --- chrome-get-urls-from-tabs-in-windows.js | 4 ++-- 1 file changed, 2 insertions(+), 2 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 0ed0d8f..fc27d1f 100644 --- a/chrome-get-urls-from-tabs-in-windows.js +++ b/chrome-get-urls-from-tabs-in-windows.js @@ -94,14 +94,14 @@ generate_backup_text(function(backup_text) { // Adapted from: // http://stackoverflow.com/a/18197511 -create_download_link = function(text) { +create_download_link = function(text, callback) { generate_filename(function(filename) { var download_link = document.createElement('a'); download_link.setAttribute('href', 'data:text/plain;charset=utf-8,' + encodeURIComponent(text)); download_link.setAttribute('download', filename); download_link.innerHTML = 'Download file'; - document.getElementById('download-link').appendChild(download_link); + callback(download_link); }); }; -- cgit v1.2.3