annotate views/index.jade @ 6:a94ac7c3b182

appId clientid in index.jade, remove logo from index
author Mathias Gebbe <mgebbe@intevation.de>
date Sat, 07 Jun 2014 10:22:12 +0200
parents 98a070c98982
children 2123f355ab68
rev   line source
0
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
1 doctype html
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
2 html(lang="en")
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
3 head
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
4 title= pageTitle
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
5
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
6 link(rel='stylesheet', href='/stylesheets/style.css')
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
7 link(rel='icon', href='/images/favicon.ico',type='image/x-icon')
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
8 link(rel='stylesheet', href='/stylesheets/bootstrap.min.css')
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
9
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
10 // load jquery
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
11 script(src='https://ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.min.js')
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
12
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
13 // load googleplus api
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
14 script(type='text/javascript').
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
15 (function() {
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
16 var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
17 po.src = 'https://apis.google.com/js/client:plusone.js';
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
18 var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
19 })();
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
20
6
a94ac7c3b182 appId clientid in index.jade, remove logo from index
Mathias Gebbe <mgebbe@intevation.de>
parents: 3
diff changeset
21
0
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
22 // load googleplus api sign in
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
23
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
24 script(type='text/javascript').
6
a94ac7c3b182 appId clientid in index.jade, remove logo from index
Mathias Gebbe <mgebbe@intevation.de>
parents: 3
diff changeset
25
3
98a070c98982 add Twitter support
Mathias Gebbe <mgebbe@intevation.de>
parents: 0
diff changeset
26
0
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
27 (function() {
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
28 var po = document.createElement('script');
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
29 po.type = 'text/javascript'; po.async = true;
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
30 po.src = 'https://apis.google.com/js/client:plusone.js?onload=render';
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
31 var s = document.getElementsByTagName('script')[0];
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
32 s.parentNode.insertBefore(po, s);
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
33 })();
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
34
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
35 /* Executed when the APIs finish loading */
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
36 function render() {
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
37
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
38 gapi.signin.render('gp-root', {
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
39 'callback': 'signinCallback',
6
a94ac7c3b182 appId clientid in index.jade, remove logo from index
Mathias Gebbe <mgebbe@intevation.de>
parents: 3
diff changeset
40 'clientid': 'GOOOGLEPLUSCLIENTID',
0
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
41 'redirecturi': 'postmessage',
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
42 'response_type' : 'code',
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
43 'accesstype': 'offline',
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
44 'approvalprompt': 'force',
6
a94ac7c3b182 appId clientid in index.jade, remove logo from index
Mathias Gebbe <mgebbe@intevation.de>
parents: 3
diff changeset
45 'cookiepolicy': "https://yourserver.org",
0
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
46 'requestvisibleactions': 'http://schemas.google.com/AddActivity',
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
47 'scope': 'https://www.googleapis.com/auth/plus.login https://www.googleapis.com/auth/userinfo.email'
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
48 });
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
49 }
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
50
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
51 // handle googleplus callback
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
52
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
53 script(type='text/javascript').
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
54 function signinCallback(authResult) {
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
55 if (authResult['status']['signed_in']) {
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
56 // Update the app to reflect a signed in user
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
57 // Hide the sign-in button now that the user is authorized, for example:
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
58 //document.getElementById('signinButton').setAttribute('style', 'display: none');
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
59 //alert('googleplus is ready for bridging');
6
a94ac7c3b182 appId clientid in index.jade, remove logo from index
Mathias Gebbe <mgebbe@intevation.de>
parents: 3
diff changeset
60
0
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
61 gapi.client.load('plus', 'v1', function() {
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
62 var request = gapi.client.plus.people.get({
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
63 'userId': 'me'
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
64 });
6
a94ac7c3b182 appId clientid in index.jade, remove logo from index
Mathias Gebbe <mgebbe@intevation.de>
parents: 3
diff changeset
65 request.execute(function(resp) {
a94ac7c3b182 appId clientid in index.jade, remove logo from index
Mathias Gebbe <mgebbe@intevation.de>
parents: 3
diff changeset
66 //alert(JSON.stringify(resp));
0
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
67 $('#gpstatus').html('<a href=' + resp.url + '> ' + resp.displayName + '</a>');
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
68 var token = gapi.auth.getToken();
6
a94ac7c3b182 appId clientid in index.jade, remove logo from index
Mathias Gebbe <mgebbe@intevation.de>
parents: 3
diff changeset
69 //alert(JSON.stringify(resp.id));
0
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
70 $('#gpid').val(resp.id+'@google');
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
71 $('#gptoken').val(token.access_token + ';' + token.code);
6
a94ac7c3b182 appId clientid in index.jade, remove logo from index
Mathias Gebbe <mgebbe@intevation.de>
parents: 3
diff changeset
72 });
a94ac7c3b182 appId clientid in index.jade, remove logo from index
Mathias Gebbe <mgebbe@intevation.de>
parents: 3
diff changeset
73 });
0
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
74
6
a94ac7c3b182 appId clientid in index.jade, remove logo from index
Mathias Gebbe <mgebbe@intevation.de>
parents: 3
diff changeset
75
0
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
76 } else {
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
77 // Update the app to reflect a signed out user
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
78 // Possible error values:
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
79 // "user_signed_out" - User is signed-out
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
80 // "access_denied" - User denied access to your app
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
81 // "immediate_failed" - Could not automatically log in the user
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
82 //alert('you cancelled login or did not fully authorize: ' + authResult['error']);
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
83 }
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
84 }
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
85
6
a94ac7c3b182 appId clientid in index.jade, remove logo from index
Mathias Gebbe <mgebbe@intevation.de>
parents: 3
diff changeset
86 script.
3
98a070c98982 add Twitter support
Mathias Gebbe <mgebbe@intevation.de>
parents: 0
diff changeset
87 // twitter stuff
98a070c98982 add Twitter support
Mathias Gebbe <mgebbe@intevation.de>
parents: 0
diff changeset
88 function getCookie(cname) {
98a070c98982 add Twitter support
Mathias Gebbe <mgebbe@intevation.de>
parents: 0
diff changeset
89 var name = cname + "=";
98a070c98982 add Twitter support
Mathias Gebbe <mgebbe@intevation.de>
parents: 0
diff changeset
90 var ca = document.cookie.split(';');
98a070c98982 add Twitter support
Mathias Gebbe <mgebbe@intevation.de>
parents: 0
diff changeset
91 for(var i=0; i<ca.length; i++) {
98a070c98982 add Twitter support
Mathias Gebbe <mgebbe@intevation.de>
parents: 0
diff changeset
92 var c = ca[i].trim();
98a070c98982 add Twitter support
Mathias Gebbe <mgebbe@intevation.de>
parents: 0
diff changeset
93 if (c.indexOf(name) == 0) return c.substring(name.length,c.length);
98a070c98982 add Twitter support
Mathias Gebbe <mgebbe@intevation.de>
parents: 0
diff changeset
94 }
98a070c98982 add Twitter support
Mathias Gebbe <mgebbe@intevation.de>
parents: 0
diff changeset
95 return "";
98a070c98982 add Twitter support
Mathias Gebbe <mgebbe@intevation.de>
parents: 0
diff changeset
96 }
6
a94ac7c3b182 appId clientid in index.jade, remove logo from index
Mathias Gebbe <mgebbe@intevation.de>
parents: 3
diff changeset
97
a94ac7c3b182 appId clientid in index.jade, remove logo from index
Mathias Gebbe <mgebbe@intevation.de>
parents: 3
diff changeset
98
0
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
99
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
100 // load facebook api
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
101 script.
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
102 $(document).ready(function () {
6
a94ac7c3b182 appId clientid in index.jade, remove logo from index
Mathias Gebbe <mgebbe@intevation.de>
parents: 3
diff changeset
103
a94ac7c3b182 appId clientid in index.jade, remove logo from index
Mathias Gebbe <mgebbe@intevation.de>
parents: 3
diff changeset
104 var twstatus = getCookie('twitterid')
a94ac7c3b182 appId clientid in index.jade, remove logo from index
Mathias Gebbe <mgebbe@intevation.de>
parents: 3
diff changeset
105 if (twstatus != "") $('#twstatus').html('<a href=https://twitter.com/account/redirect_by_id/' + twstatus + '> ' + getCookie('twitteruser') + '</a>');
a94ac7c3b182 appId clientid in index.jade, remove logo from index
Mathias Gebbe <mgebbe@intevation.de>
parents: 3
diff changeset
106
0
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
107 $.ajaxSetup({
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
108 cache: true
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
109 });
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
110
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
111 $.getScript('//connect.facebook.net/en_UK/all.js', function () {
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
112 FB.init({
6
a94ac7c3b182 appId clientid in index.jade, remove logo from index
Mathias Gebbe <mgebbe@intevation.de>
parents: 3
diff changeset
113 appId: 'FACEBOOKID',
0
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
114 status : true
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
115 });
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
116
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
117 FB.getLoginStatus(function(response) {
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
118 if (response.status === 'connected') {
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
119 // the user is logged in and has authenticated your
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
120 // app, and response.authResponse supplies
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
121 // the user's ID, a valid access token, a signed
6
a94ac7c3b182 appId clientid in index.jade, remove logo from index
Mathias Gebbe <mgebbe@intevation.de>
parents: 3
diff changeset
122 // request, and the time the access token
0
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
123 // and signed request each expire
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
124 var uid = response.authResponse.userID;
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
125 var accessToken = response.authResponse.accessToken;
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
126 $('#fbtoken').val(accessToken);
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
127 FB.api('/me', function(response) {
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
128 $('#fbstatus').html('<a href=//facebook.com/' + response.id + '> ' + response.name + '</a>');
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
129 $('#fbid').val(response.id+'@facebook');
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
130 });
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
131 } else if (response.status === 'not_authorized') {
6
a94ac7c3b182 appId clientid in index.jade, remove logo from index
Mathias Gebbe <mgebbe@intevation.de>
parents: 3
diff changeset
132 // the user is logged in to Facebook,
0
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
133 // but has not authenticated your app
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
134 $('#fbstatus').html('not authorized');
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
135 } else {
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
136 // the user isn't logged in to Facebook.
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
137 $('#fbstatus').html('not logged in');
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
138 }
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
139 });
6
a94ac7c3b182 appId clientid in index.jade, remove logo from index
Mathias Gebbe <mgebbe@intevation.de>
parents: 3
diff changeset
140
0
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
141
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
142 });
6
a94ac7c3b182 appId clientid in index.jade, remove logo from index
Mathias Gebbe <mgebbe@intevation.de>
parents: 3
diff changeset
143
0
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
144
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
145 $('.fbloginbutton').on('click', function(e){
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
146 FB.login(function(response) {
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
147 if (response.authResponse) {
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
148 FB.api('/me', function(response) {
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
149 //document.getElementById("logoutbutton").disabled = false;
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
150 });
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
151 } else {
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
152 //Not logged in
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
153 //alert('you cancelled login or did not fully authorize.');
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
154 }
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
155 }, {scope: 'publish_actions,publish_stream,read_stream,read_friendlists,user_likes,read_insights,user_activities'});
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
156 })
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
157
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
158 //$('.logoutbutton').on('click', function(e){
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
159 // FB.logout();
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
160 // })
6
a94ac7c3b182 appId clientid in index.jade, remove logo from index
Mathias Gebbe <mgebbe@intevation.de>
parents: 3
diff changeset
161 $('#pumpobj').val(JSON.stringify(!{JSON.stringify(user)}));
0
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
162 });
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
163
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
164 body
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
165 block content
6
a94ac7c3b182 appId clientid in index.jade, remove logo from index
Mathias Gebbe <mgebbe@intevation.de>
parents: 3
diff changeset
166 .main
0
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
167 h1(class='headline') pumpbridge.<br>connecting social networks
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
168 #fb-root.fb-root
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
169 input(id='fbloginbutton',type='image',class='fbloginbutton',value='fbLogin',src='images/fb.svg',width='100px',height='100px')
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
170 #gp-root.gp-root
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
171 input(id='gploginbutton',type='image',class='gploginbutton',value='gpLogin',src='images/gp.svg',width='100px',height='100px')
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
172 //span.g-signin(data-scope='https://www.googleapis.com/auth/plus.login', data-clientid='460404084439-rgb5r2vh7hh8hvf2na65c7n1ofhmomek.apps.googleusercontent.com', data-redirecturi='postmessage', data-accesstype='offline', data-cookiepolicy='single_host_origin', data-callback='signInCallback', approval_prompt='force')
3
98a070c98982 add Twitter support
Mathias Gebbe <mgebbe@intevation.de>
parents: 0
diff changeset
173 #tw-root.tw-root
98a070c98982 add Twitter support
Mathias Gebbe <mgebbe@intevation.de>
parents: 0
diff changeset
174 a(href='/add-account'): input(id='twloginbutton',type='image',class='twloginbutton',value='twLogin',src='images/twitter.svg',width='100px',height='100px')
6
a94ac7c3b182 appId clientid in index.jade, remove logo from index
Mathias Gebbe <mgebbe@intevation.de>
parents: 3
diff changeset
175 //#pump-root.pump-root
a94ac7c3b182 appId clientid in index.jade, remove logo from index
Mathias Gebbe <mgebbe@intevation.de>
parents: 3
diff changeset
176 // a(href='/login')
a94ac7c3b182 appId clientid in index.jade, remove logo from index
Mathias Gebbe <mgebbe@intevation.de>
parents: 3
diff changeset
177 // input(id='pumploginbutton',type='image',class='pumploginbutton',value='pumpLogin',src='images/pumpiologo.svg',width='100px',height='100px')
0
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
178 br
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
179 form(class='',action='/bridge',method='post')
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
180 #connect.connect
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
181 ul
6
a94ac7c3b182 appId clientid in index.jade, remove logo from index
Mathias Gebbe <mgebbe@intevation.de>
parents: 3
diff changeset
182 li pump.io:
a94ac7c3b182 appId clientid in index.jade, remove logo from index
Mathias Gebbe <mgebbe@intevation.de>
parents: 3
diff changeset
183 a(id='pumpstatus',class='pumpstatus',href=user.homepage)= user.id
a94ac7c3b182 appId clientid in index.jade, remove logo from index
Mathias Gebbe <mgebbe@intevation.de>
parents: 3
diff changeset
184 br
a94ac7c3b182 appId clientid in index.jade, remove logo from index
Mathias Gebbe <mgebbe@intevation.de>
parents: 3
diff changeset
185 input(id='pumpid',name='pumpid',hidden='true',value=user.id)
a94ac7c3b182 appId clientid in index.jade, remove logo from index
Mathias Gebbe <mgebbe@intevation.de>
parents: 3
diff changeset
186 input(id='pumptoken',name='pumptoken',hidden='true', value=user.token)
a94ac7c3b182 appId clientid in index.jade, remove logo from index
Mathias Gebbe <mgebbe@intevation.de>
parents: 3
diff changeset
187 input(id='pumpsecret',name='pumpsecret',hidden='true', value=user.secret)
a94ac7c3b182 appId clientid in index.jade, remove logo from index
Mathias Gebbe <mgebbe@intevation.de>
parents: 3
diff changeset
188 input(id='pumpobj',name='pumpobj', hidden='true' value='')
0
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
189 li Facebook:
3
98a070c98982 add Twitter support
Mathias Gebbe <mgebbe@intevation.de>
parents: 0
diff changeset
190 i(id='fbstatus') &nbsp; not logged in
0
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
191 br
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
192 input(id='fbid',name='fbid',hidden='true')
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
193 input(id='fbtoken',name='fbtoken',hidden='true')
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
194 li GooglePlus:
3
98a070c98982 add Twitter support
Mathias Gebbe <mgebbe@intevation.de>
parents: 0
diff changeset
195 i(id='gpstatus') &nbsp; not logged in
0
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
196 br
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
197 input(id='gpid',name='gpid',hidden='true')
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
198 input(id='gptoken',name='gptoken',hidden='true',size=100)
3
98a070c98982 add Twitter support
Mathias Gebbe <mgebbe@intevation.de>
parents: 0
diff changeset
199 li Twitter:
98a070c98982 add Twitter support
Mathias Gebbe <mgebbe@intevation.de>
parents: 0
diff changeset
200 i(id='twstatus') &nbsp; not logged in
98a070c98982 add Twitter support
Mathias Gebbe <mgebbe@intevation.de>
parents: 0
diff changeset
201 br
98a070c98982 add Twitter support
Mathias Gebbe <mgebbe@intevation.de>
parents: 0
diff changeset
202 input(id='twid',name='twid',hidden='true')
98a070c98982 add Twitter support
Mathias Gebbe <mgebbe@intevation.de>
parents: 0
diff changeset
203 input(id='twtoken',name='twtoken',hidden='true',size=100)
0
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
204 br
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
205 input(type='submit',class='btn btn-default',value='save tokens')
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
206 .footer
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
207 #logout.logout
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
208 //input(id='logoutbutton',type='button',class='logoutbutton',value='Logout',disabled)
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
209 form(class='',action='/logout',method='post')
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
210 input(type='submit',class='btn btn-default',value='logout')
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
211 br
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
212 p.
b73191efc65b Initial import of pumpbridge (bloody bloody alpha)
Mathias Gebbe <mgebbe@intevation.de>
parents:
diff changeset
213 here our bridge will be.
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)