View difference between Paste ID: TZyBLiHm and
SHOW:
|
|
- or go back to the newest paste.
| 1 | - | |
| 1 | + | window.fbAsyncInit = function() {
|
| 2 | FB.init({appId: '123730674307697', status: true, cookie: true, xfbml: true});
| |
| 3 | ||
| 4 | /* All the events registered */ | |
| 5 | FB.Event.subscribe('auth.login', function(response) {
| |
| 6 | // do something with response | |
| 7 | login(); | |
| 8 | }); | |
| 9 | FB.Event.subscribe('auth.logout', function(response) {
| |
| 10 | // do something with response | |
| 11 | logout(); | |
| 12 | }); | |
| 13 | ||
| 14 | FB.getLoginStatus(function(response) {
| |
| 15 | if (response.session) {
| |
| 16 | // logged in and connected user, someone you know | |
| 17 | login(); | |
| 18 | } | |
| 19 | }); | |
| 20 | ||
| 21 | getAttendends_new(events); | |
| 22 | ||
| 23 | }; | |
| 24 | (function() {
| |
| 25 | var e = document.createElement('script');
| |
| 26 | e.type = 'text/javascript'; | |
| 27 | e.src = document.location.protocol + | |
| 28 | '//connect.facebook.net/en_US/all.js'; | |
| 29 | e.async = true; | |
| 30 | document.getElementById('fb-root').appendChild(e);
| |
| 31 | }()); | |
| 32 | ||
| 33 | function login(){
| |
| 34 | FB.api('/me', function(response) {
| |
| 35 | document.getElementById('login').style.display = "block";
| |
| 36 | document.getElementById('login').innerHTML = "Welcome " + response.name;
| |
| 37 | }); | |
| 38 | } | |
| 39 | function logout(){
| |
| 40 | document.getElementById('login').style.display = "none";
| |
| 41 | } | |
| 42 | ||
| 43 | function getAttendends_new(events){
| |
| 44 | if(!document.getElementById('events')){
| |
| 45 | return false; | |
| 46 | } | |
| 47 | jQuery('#events').html("Loading...");
| |
| 48 | jQuery.post('<?=get_option('siteurl')?>/wp-content/themes/carrington-blog/footer/getAttendends.php', {
| |
| 49 | event_id: events, | |
| 50 | number: 23 | |
| 51 | }, function(data) {
| |
| 52 | var cnt=data.split('###');
| |
| 53 | jQuery('#events').html(cnt[0])
| |
| 54 | ||
| 55 | }); | |
| 56 | ||
| 57 | } | |
| 58 | function attend(event_id){
| |
| 59 | FB.api('/'+event_id+'/attending', 'post', function(response) {
| |
| 60 | if(response.error){
| |
| 61 | alert("some error occured");
| |
| 62 | } | |
| 63 | if(response.data){
| |
| 64 | window.location.reload(); | |
| 65 | } | |
| 66 | }); | |
| 67 | } | |
| 68 | ||
| 69 | function showfeeds(){
| |
| 70 | FB.api('/me/feed', function(response) {
| |
| 71 | if(response.error){
| |
| 72 | alert("some error occured");
| |
| 73 | } | |
| 74 | if(response.data){
| |
| 75 | window.location.reload(); | |
| 76 | } | |
| 77 | }); | |
| 78 | } |