Mercurial > hg > bitsyauth
comparison example/persona.html @ 40:cb1d21648588
count clicks the hard way
author | Jeff Hammel <jhammel@mozilla.com> |
---|---|
date | Fri, 27 Dec 2013 20:13:04 -0800 |
parents | 6b5946843928 |
children | d4522af2c6e5 |
comparison
equal
deleted
inserted
replaced
39:8255e769828b | 40:cb1d21648588 |
---|---|
8 <meta http-equiv="X-UA-Compatible" content="IE=Edge"> | 8 <meta http-equiv="X-UA-Compatible" content="IE=Edge"> |
9 | 9 |
10 <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script> | 10 <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script> |
11 <script src="https://login.persona.org/include.js"></script> | 11 <script src="https://login.persona.org/include.js"></script> |
12 <script> | 12 <script> |
13 var nclicks = 0; | |
14 | |
13 $(document).ready(function() { | 15 $(document).ready(function() { |
14 | 16 |
15 var currentUser = null; | 17 var currentUser = null; |
16 | 18 |
17 navigator.id.watch({ | 19 navigator.id.watch({ |
45 } | 47 } |
46 }); | 48 }); |
47 | 49 |
48 var signinLink = document.getElementById('signin'); | 50 var signinLink = document.getElementById('signin'); |
49 if (signinLink) { | 51 if (signinLink) { |
50 signinLink.onclick = function() { navigator.id.request(); }; | 52 signinLink.onclick = function() { navigator.id.request(); |
53 nclicks += 1; | |
54 $('clickcounter').append('<li>This is click ' + nclicks + '</li>'); | |
55 }; | |
51 } | 56 } |
52 | 57 |
53 var signoutLink = document.getElementById('signout'); | 58 var signoutLink = document.getElementById('signout'); |
54 if (signoutLink) { | 59 if (signoutLink) { |
55 signoutLink.onclick = function() { navigator.id.logout(); }; | 60 signoutLink.onclick = function() { navigator.id.logout(); }; |
67 | 72 |
68 <div> | 73 <div> |
69 <a id="signin">sign in</a> | 74 <a id="signin">sign in</a> |
70 </div> | 75 </div> |
71 | 76 |
77 <ul id="clickcounter"> | |
78 </ul> | |
79 | |
72 <h2>Resources</h2> | 80 <h2>Resources</h2> |
73 <ul> | 81 <ul> |
74 <li> | 82 <li> |
75 <a href="https://developer.mozilla.org/en-US/Persona/branding"> | 83 <a href="https://developer.mozilla.org/en-US/Persona/branding"> |
76 branding | 84 branding |