forked from MrSwitch/hello.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
share.html
56 lines (46 loc) · 1.37 KB
/
share.html
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
44
45
46
47
48
49
50
51
52
53
54
55
56
<!DOCTYPE html>
<link rel="stylesheet" href="/adorn/adorn.css"/>
<script src="/adorn/adorn.js" async></script>
<script src="client_ids.js"></script>
<script src="../src/hello.polyfill.js"></script>
<script src="../src/hello.js"></script>
<script src="../src/modules/windows.js"></script>
<script src="../src/modules/facebook.js"></script>
<script src="../src/modules/google.js"></script>
<style>
form{
padding:20px;
}
form label{
min-width:100px;
display: inline-block;
text-align: right;
font-weight:bold;
}
form input{
width:250px;
}
</style>
<h1>hello.api( me/share )</h1>
<blockquote>
<form id="activity_form">
<label>message</label> <input type="text" name="message" value="Hello.js is anything but OAuth'ful"/>
<br />
<label>link</label> <input type="url" name="link" value="http://adodson.com/hello.js"/>
</form>
</blockquote>
<script class="pre">
function post(network){
var fields = document.getElementById('activity_form').elements;
var hi = hello(network);
hi.login({scope:'publish'}).then(function(){
// Post the contents of the form
hi.api('me/share', 'post', {message: fields.message.value, link: fields.link.value}).then(function(r) {
alert("Your message has been published to "+ network);
}, function(r) {
alert("Whoops! Failed." + r.error.message);
});
})
}
hello.init(CLIENT_IDS, {redirect_uri:'../redirect.html'});
</script>