From 7fcfe80d0aa21d727640c219d2f3a48c4e63ba11 Mon Sep 17 00:00:00 2001 From: Queen Bee Date: Fri, 19 Jan 2018 08:25:29 -0800 Subject: [PATCH] minor updates to design --- index.html | 2 +- renderer.js | 26 ++++---------------------- 2 files changed, 5 insertions(+), 23 deletions(-) diff --git a/index.html b/index.html index 23c35e1..7efc413 100644 --- a/index.html +++ b/index.html @@ -17,7 +17,7 @@
-
+
diff --git a/renderer.js b/renderer.js index 836fc80..471595b 100644 --- a/renderer.js +++ b/renderer.js @@ -1,9 +1,7 @@ const electron = require('electron'); -const remote = electron.remote; const desktopCapturer = electron.desktopCapturer; const electronScreen = electron.screen; const shell = electron.shell; -const dialog = remote.dialog; const fs = require('fs'); const os = require('os'); @@ -11,22 +9,9 @@ const path = require('path'); const screenshot = document.getElementById('screen-shot'); const screenshotMsg = document.getElementById('screenshot-path'); -const pathButton = document.getElementById('path-button'); - -var screenshotPath = ''; - -pathButton.addEventListener('click', function(event) { - dialog.showSaveDialog(function(fileName) { - if (fileName === undefined) { - return; - } - screenshotPath = fileName; - screenshotMsg.textContent = screenshotPath; - }); -}); screenshot.addEventListener('click', function(event) { - screenshotMsg.textContent = "Gathering screenshot..."; + screenshotMsg.textContent = 'Gathering screenshot...'; const thumbSize = determineScreenShot(); let options = { types: ['screen'], thumbnailSize: thumbSize }; @@ -35,13 +20,10 @@ screenshot.addEventListener('click', function(event) { sources.forEach(function(source) { if (source.name === 'Entire Screen' || source.name === 'Screen 1') { + const screenshotPath = path.join(os.tmpdir(), 'screenshot.png'); - if (screenshotPath === '') { - screenshotPath = path.join(os.tmpdir(), 'screenshot.png'); - } - - fs.writeFile(screenshotPath, source.thumbnail.toPng(), function(error) { - if (error) return console.log(error.message); + fs.writeFile(screenshotPath, source.thumbnail.toPng(), function(err) { + if (err) return console.log(err.message); shell.openExternal('file://' + screenshotPath); var message = 'Saved screenshot to: ' + screenshotPath;