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