Skip to content
This repository
Fetching contributors…

Cannot retrieve contributors at this time

file 43 lines (37 sloc) 1.51 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
<!doctype html public "wutlol">
<html lang="en-us">
  <head>
    <meta charset="utf-8"/>
    <meta http-equiv="X-UA-Compatible" content="IE=Edge;chrome=1"/>
    
    <title dir="ltr">Yep</title>
    
    <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
    <script src="http://localhost:8888/issuer.js"></script>
  </head>
  <body>
    <label>Email: <input id='email'></label>
    <button id='unhashed'>Unhashed</button>
    <button id='hashed'>Hashed</button>
    <button id='invalid'>Invalid</button>
    <script>
      var unhashed = document.getElementById('unhashed');
      var hashed = document.getElementById('hashed');
      var invalid = document.getElementById('invalid');
      function getEmail() {
        return document.getElementById('email').value;
      }
      
      unhashed.addEventListener('click', function(){
        var url = 'http://localhost:8889/raw.json?email=' + encodeURIComponent(getEmail());
        OpenBadges.issue(url);
      },false)
    
      hashed.addEventListener('click', function(){
        var url = 'http://localhost:8889/hashed.json?email=' + encodeURIComponent(getEmail())
        OpenBadges.issue([url]);
      },false)

      // added to test whether proper error message is thrown for invalid assertion
      invalid.addEventListener('click', function(){
        var url = 'http://localhost:8889/invalid.json?email=' + encodeURIComponent(getEmail());
        OpenBadges.issue(url);
      },false)
    
    </script>
  </body>
</html>
Something went wrong with that request. Please try again.