aboutsummaryrefslogtreecommitdiffstats
path: root/lang/js/DemoExtension
diff options
context:
space:
mode:
authorMaximilian Krambach <[email protected]>2018-06-06 11:05:53 +0000
committerMaximilian Krambach <[email protected]>2018-06-06 11:05:53 +0000
commitbfd3799d39df265882deedeee083fd5246a2f35d (patch)
treebfee0a85d6373fa578de075cbce4d26ddced14e4 /lang/js/DemoExtension
parentjs: implement import/delete Key, some fixes (diff)
downloadgpgme-bfd3799d39df265882deedeee083fd5246a2f35d.tar.gz
gpgme-bfd3799d39df265882deedeee083fd5246a2f35d.zip
js: code cleanup (eslint)
-- * trying to stick to eslint from now on for readability * As some attribution was lost in previous git confusions, I added my name into some of the licence headers
Diffstat (limited to '')
-rw-r--r--lang/js/DemoExtension/entry.js5
-rw-r--r--lang/js/DemoExtension/maindemo.js40
2 files changed, 26 insertions, 19 deletions
diff --git a/lang/js/DemoExtension/entry.js b/lang/js/DemoExtension/entry.js
index 62583421..77b96f92 100644
--- a/lang/js/DemoExtension/entry.js
+++ b/lang/js/DemoExtension/entry.js
@@ -17,7 +17,12 @@
* License along with this program; if not, see <http://www.gnu.org/licenses/>.
* SPDX-License-Identifier: LGPL-2.1+
*
+ * Author(s):
+ * Maximilian Krambach <[email protected]>
*/
+
+/* global chrome */
+
document.addEventListener('DOMContentLoaded', function() {
chrome.tabs.create({
url: './mainui.html'
diff --git a/lang/js/DemoExtension/maindemo.js b/lang/js/DemoExtension/maindemo.js
index b2cb4c23..5cde1ce8 100644
--- a/lang/js/DemoExtension/maindemo.js
+++ b/lang/js/DemoExtension/maindemo.js
@@ -17,39 +17,41 @@
* License along with this program; if not, see <http://www.gnu.org/licenses/>.
* SPDX-License-Identifier: LGPL-2.1+
*
+ * Author(s):
+ * Maximilian Krambach <[email protected]>
*/
+/* global document, Gpgmejs */
+
document.addEventListener('DOMContentLoaded', function() {
Gpgmejs.init().then(function(gpgmejs){
- document.getElementById("buttonencrypt").addEventListener("click",
+ document.getElementById('buttonencrypt').addEventListener('click',
function(){
let data = document.getElementById('cleartext').value;
let keyId = document.getElementById('pubkey').value;
gpgmejs.encrypt(data, keyId).then(
function(answer){
- console.log(answer);
if (answer.data){
- console.log(answer.data);
- document.getElementById('answer').value = answer.data;
+ document.getElementById(
+ 'answer').value = answer.data;
}
}, function(errormsg){
alert( errormsg.code + ' ' + errormsg.msg);
- });
+ });
});
- document.getElementById("buttondecrypt").addEventListener("click",
- function(){
- let data = document.getElementById("ciphertext").value;
- gpgmejs.decrypt(data).then(
- function(answer){
- console.log(answer);
- if (answer.data){
- document.getElementById('answer').value = answer.data;
- }
- }, function(errormsg){
- alert( errormsg.code + ' ' + errormsg.msg);
+ document.getElementById('buttondecrypt').addEventListener('click',
+ function(){
+ let data = document.getElementById('ciphertext').value;
+ gpgmejs.decrypt(data).then(
+ function(answer){
+ if (answer.data){
+ document.getElementById(
+ 'answer').value = answer.data;
+ }
+ }, function(errormsg){
+ alert( errormsg.code + ' ' + errormsg.msg);
+ });
});
- });
- },
- function(error){console.log(error)});
+ });
});