forked from MrSwitch/hello.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathshare.html
61 lines (50 loc) · 1.48 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
57
58
59
60
61
<!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>
<button onclick="post('facebook');">Post to Facebook</button>
<button onclick="post('windows');">Post to Windows Live</button>
<button onclick="post('google');">Post to Google (will fail)</button>
</blockquote>
<script class="pre">
function post(network){
hello.login(network,{scope:'publish'}, function(){
// Post the contents of the form
hello.api(network+':/me/share', 'post', document.getElementById('activity_form'), function(r){
if(!r||r.error){
alert("Whoops! "+r.error.message);
}
else{
alert("Your message has been published to "+ network);
}
});
})
}
hello.init(CLIENT_IDS, {redirect_uri:'../redirect.html'});
</script>