From 17348b8ac8c541652dd95467a928e5d0305cfff7 Mon Sep 17 00:00:00 2001 From: neal1991 Date: Sun, 4 Jun 2017 11:51:33 +0800 Subject: [PATCH] modify manifest.json --- manifest.json | 3 ++- scripts/widget.js | 41 ----------------------------------------- 2 files changed, 2 insertions(+), 42 deletions(-) diff --git a/manifest.json b/manifest.json index 8ea8860..8e8e474 100644 --- a/manifest.json +++ b/manifest.json @@ -22,7 +22,8 @@ ], "browser_action": { "default_title": "Export to Markdown", - "default_icon": "icons/icon-19.png" + "default_icon": "icons/icon-19.png", + "default_popup": "popup.html" }, "manifest_version": 2, "homepage_url": "https://github.com/neal1991" diff --git a/scripts/widget.js b/scripts/widget.js index cec29c5..3683dac 100644 --- a/scripts/widget.js +++ b/scripts/widget.js @@ -188,44 +188,3 @@ function createMarkupsArray(markups) { } return markups_array; } - -function doExportToDisk(savedFileEntry) { - if (savedFileEntry) { - exportToFileEntry(savedFileEntry); - } else { - chrome.fileSystem.chooseEntry({ - type: 'saveFile', - accepts: [{description: 'Markdown files (*.md)', - extensions: ['txt']}], - acceptsAllTypes: true - }, exportToFileEntry); - } -} - -function exportToFileEntry(fileEntry) { - savedFileEntry = fileEntry; - - chrome.fileSystem.getDisplayPath(fileEntry, function(path) { - fileDisplayPath = path; - }); - - fileEntry.createWriter(function(fileWriter) { - let truncated = false; - let blob = new Blob([contents]); - - fileWriter.onwriteend = function(e) { - if (!truncated) { - truncated = true; - this.truncate(blob.size); - return; - } - console.log('Export to ' + fileDisplayPath + ' completed'); - }; - - fileWriter.onerror = function(e) { - console.error('Export failed: ' + e.toString()); - }; - - fileWriter.write(blob); - }) -} \ No newline at end of file