PluginProbe
WpStream – Live Streaming, Video on Demand, Pay Per View / 4.14.1
WpStream – Live Streaming, Video on Demand, Pay Per View v4.14.1
4.14.1 4.14.0 4.13.2 4.13.1 4.13 4.12.5 4.12.4 4.12.3 4.12.2 4.12.1 4.12 4.4.4 4.4.5 4.4.6 4.4.7 4.4.8 4.4.9 4.5 4.5.1 4.5.11 4.5.11.1 4.5.11.2 4.5.11.4 4.5.11.5 4.5.11.6 All 181 releases
wpstream / integrations / js / integrations.js

integrations.js in WpStream – Live Streaming, Video on Demand, Pay Per View 4.14.1, at integrations/js/integrations.js

66 lines 2.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 /*global $, jQuery, wpstream_integrations_vars*/
2 /*
3 * WpStream integrations front-end script (BuddyPress/BuddyBoss).
4 *
5 * Wires up the profile "Live Video" tab: the channel-selection dropdown that
6 * saves the chosen channel over AJAX. Timeline activities are posted
7 * server-side from the channel lifecycle hooks, not from the browser.
8 * Localized data (admin URL, buddyboss flag, nonce) arrives via the
9 * wpstream_integrations_vars object.
10 */
11 jQuery(document).ready(function ($) {
12 "use strict";
13 // Only bind the channel picker when the BuddyBoss integration is active.
14 if(wpstream_integrations_vars.is_buddyboss==='yes'){
15 wpstream_buddy_boss_select_channel();
16 }
17 });
18
19
20 /*
21 *
22 * Select streaming channet on BuddyBoss
23 *
24 */
25
26
27 /**
28 * Bind the profile tab's channel <select> so a change persists the selection.
29 *
30 * On change, POSTs the chosen channel id to the select-channel AJAX action and
31 * reloads the page when the server confirms it was saved.
32 */
33 function wpstream_buddy_boss_select_channel(){
34 // Listen for the user picking a different channel in the dropdown.
35 jQuery('#wpstream_buddyboss_select_channel').on('change',function(){
36
37 // Build the admin-ajax endpoint and read the newly selected channel id.
38 var ajaxurl = wpstream_integrations_vars.admin_url+ 'admin-ajax.php';;
39 var show_id = jQuery('#wpstream_buddyboss_select_channel').val();
40 var nonce = wpstream_integrations_vars.buddy_nonce;
41 jQuery.ajax({
42 type: 'POST',
43 url: ajaxurl,
44 dataType: 'json',
45 timeout: 300000,
46
47 // Server action, the selected channel id and the integration nonce.
48 data: {
49 'action' : 'wpstream_buddy_boss_select_channel_function',
50 'show_id' : show_id,
51 'security' : nonce
52 },
53 success: function (data) {
54 // Reload so the page reflects the newly selected channel.
55 if(data.saved===true){
56 location.reload();
57 }
58
59 },
60 // Swallow AJAX errors silently.
61 error: function (jqXHR,textStatus,errorThrown) {
62 }
63 });
64 });
65 }
66