| 1 |
/*global $, jQuery, wpstream_integrations_vars*/ |
| 2 |
jQuery(document).ready(function ($) { |
| 3 |
"use strict"; |
| 4 |
if(wpstream_integrations_vars.is_buddyboss==='yes'){ |
| 5 |
wpstream_buddy_boss_select_channel(); |
| 6 |
} |
| 7 |
}); |
| 8 |
|
| 9 |
|
| 10 |
/* |
| 11 |
* |
| 12 |
* On this function we receive note that the event is on |
| 13 |
* |
| 14 |
*/ |
| 15 |
|
| 16 |
|
| 17 |
function wpstream_integration_notifications(show_id){ |
| 18 |
if(wpstream_integrations_vars.is_buddyboss==='yes'){ |
| 19 |
wpstream_buddyb_generate_player_html(show_id); |
| 20 |
} |
| 21 |
} |
| 22 |
|
| 23 |
|
| 24 |
/* |
| 25 |
* |
| 26 |
* Select streaming channet on BuddyBoss |
| 27 |
* |
| 28 |
*/ |
| 29 |
|
| 30 |
|
| 31 |
function wpstream_buddy_boss_select_channel(){ |
| 32 |
jQuery('#wpstream_buddyboss_select_channel').on('change',function(){ |
| 33 |
|
| 34 |
var ajaxurl = wpstream_integrations_vars.admin_url+ 'admin-ajax.php';; |
| 35 |
var show_id = jQuery('#wpstream_buddyboss_select_channel').val(); |
| 36 |
jQuery.ajax({ |
| 37 |
type: 'POST', |
| 38 |
url: ajaxurl, |
| 39 |
dataType: 'json', |
| 40 |
timeout: 300000, |
| 41 |
|
| 42 |
data: { |
| 43 |
'action' : 'wpstream_buddy_boss_select_channel_function', |
| 44 |
'show_id' : show_id, |
| 45 |
}, |
| 46 |
success: function (data) { |
| 47 |
|
| 48 |
if(data.saved===true){ |
| 49 |
location.reload(); |
| 50 |
} |
| 51 |
|
| 52 |
}, |
| 53 |
error: function (jqXHR,textStatus,errorThrown) { |
| 54 |
} |
| 55 |
}); |
| 56 |
}); |
| 57 |
} |
| 58 |
|
| 59 |
|
| 60 |
|
| 61 |
/* |
| 62 |
* |
| 63 |
* BuddyB - generate html player to add in timeline |
| 64 |
* |
| 65 |
*/ |
| 66 |
|
| 67 |
function wpstream_buddyb_generate_player_html(show_id,user_id){ |
| 68 |
|
| 69 |
var ajaxurl = wpstream_integrations_vars.admin_url+ 'admin-ajax.php';; |
| 70 |
var nonce = wpstream_integrations_vars.buddy_nonce; |
| 71 |
jQuery.ajax({ |
| 72 |
type: 'POST', |
| 73 |
url: ajaxurl, |
| 74 |
dataType: 'json', |
| 75 |
timeout: 300000, |
| 76 |
|
| 77 |
data: { |
| 78 |
'action' : 'wpstream_buddyb_integrations_generate_player_html', |
| 79 |
'show_id' : show_id, |
| 80 |
|
| 81 |
|
| 82 |
}, |
| 83 |
success: function (data) { |
| 84 |
|
| 85 |
}, |
| 86 |
error: function (jqXHR,textStatus,errorThrown) { |
| 87 |
|
| 88 |
} |
| 89 |
}); |
| 90 |
} |