diff options
Diffstat (limited to 'lang/js/DemoExtension')
| -rw-r--r-- | lang/js/DemoExtension/entry.js | 5 | ||||
| -rw-r--r-- | lang/js/DemoExtension/maindemo.js | 40 | 
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)}); +    });  }); | 
