PluginProbe
WpStream – Live Streaming, Video on Demand, Pay Per View / 4.12.4
WpStream – Live Streaming, Video on Demand, Pay Per View v4.12.4
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 / admin / js / wpstream-onboarding2.js

wpstream-onboarding2.js in WpStream – Live Streaming, Video on Demand, Pay Per View 4.12.4, at admin/js/wpstream-onboarding2.js

1,386 lines 54.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 let sessionId = '';
2 let wpstreamCaptchaPayload = '';
3
4 const urlParams = new URLSearchParams(window.location.search);
5 if ( urlParams.get('page') === 'wpstream_onboard' ) {
6 if ( typeof crypto !== 'undefined' && crypto.randomUUID ) {
7 sessionId = crypto.randomUUID();
8 } else {
9 sessionId = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace( /[xy]/g, function( c ) {
10 var r = Math.random() * 16 | 0;
11 return ( c === 'x' ? r : ( r & 0x3 | 0x8 ) ).toString( 16 );
12 } );
13 }
14 } else {
15 sessionId = urlParams.get('session_id');
16 }
17
18 const ONBOARD=(function(){
19
20 document.addEventListener('DOMContentLoaded',init);
21 const BubbleFreeVod = [
22 //free live stream
23 [
24 {id: 1,
25 selector: "#menu-posts-wpstream_product",
26 title: "Hooray! You just created your first Free-To-View Channel.",
27 content:"You can check out all your FTV Channels or create new ones from this menu.<div class='onboard_line_break'></div>Just look for ‘Free-To-View Live Channels’.",
28 left:"175px",
29 right:"-30px",
30 top:"-30px",
31 arrow:"boarding-left-arrow"},
32 {id: 2,
33 selector: "#wpstream-sidebar-meta",
34 title: "Control your Live Channel",
35 content:"Look for the 'Live Streaming' box to the right of the page.",
36 left:"-430px",
37 right:"60px",
38 top:"0px",
39 arrow:"boarding-right-arrow"},
40 {id: 3,
41 selector: ".wpstream_show_settings_wrapper",
42 title: "Channel Settings",
43 content:'Clicking on the <div class="wpstream_sample_icon_settings"></div> icon will let you access the channel settings.<div class="onboard_line_break"></div> You can adjust preferences for <strong>recording, autoplay</strong>, etc.',
44 left:"-444px",
45 right:"0px",
46 top:"100px",
47 arrow:"boarding-right-arrow"},
48 {id: 4,
49 selector: ".wpstream_stream_browser_wrapper",
50 title: "Turn it ON",
51 content:"To Go Live, first TURN ON your channel. Go ahead, click the big green button below! <div id=\"wpstream_onboarding_start_chanel\">TURN ON</div> Turning on may take a minute or so. You can wait or move on to the next step.",
52 left:"-444px",
53 right:"auto",
54 top:"0px",
55 arrow:"boarding-right-arrow"},
56
57 {id: 5,
58 selector: ".wpstream_show_settings_wrapper",
59 title: "Your Channel Page",
60 content:"This is the link to the page with your live stream. Viewers will be able to watch your live stream here.<div class='onboard_line_break'></div>To see it, click <div id=\"wpstream_onboarding_open_chanel\" class=\"wpstream_sample_icon_settings wpstream_sample_icon_open_channel\"></div> Page will open in a new tab.",
61 left:"-400px",
62 right:"auto",
63 top:"100px",
64 arrow:"boarding-right-arrow"},
65 {id: 6,
66 selector: ".wpstream_stream_browser_wrapper",
67 title: "Go LIVE",
68 content:"To go live, first turn on your channnel.<div class='onboard_line_break'></div> If it's already <strong>Turning ON</strong>, wait until <strong>Channel is ON</strong>",
69 left:"-444px",
70 right:"auto",
71 top:"58px",
72 arrow:"boarding-right-arrow"}
73 ] ,
74 // paid live stream
75 [
76 {id: 1,
77 selector: "#menu-posts-product",
78 title: "Hooray! You just created your first Pay-Per-View Channel.",
79 content:"You can check out all your PPV Channels or create new ones from this menu. Just look for ‘Products’.",
80 left:"175px",
81 right:"-30px",
82 top:"-30px",
83 arrow:"boarding-left-arrow"},
84 {id: 2,
85 selector: "#normal-sortables",
86 title: "A Pay-Per-View Channel is a Custom Woocommerce Product",
87 content:"Note the type of the product: <strong>Live Channel</strong> </br>This sets it apart from other products you may want to sell.",
88 left:"345px",
89 right:"-30px",
90 top:"-35px",
91 arrow:"boarding-left-arrow"},
92 {id: 3,
93 selector: "#normal-sortables",
94 title: "Set the Pay-Per-View price here",
95 content:"Your users will have to purchase the product in order to be allowed to watch the live stream.",
96 left:"550px",
97 right:"-30px",
98 top:"25px",
99 arrow:"boarding-left-arrow"},
100 {id: 4,
101 selector: "#wpstream-sidebar-meta",
102 title: "Control your channel from here",
103 content:"Look for the 'Live Streaming' box on the side bar.",
104 left:"-430px",
105 right:"60px",
106 top:"0px",
107 arrow:"boarding-right-arrow"},
108 {id: 5,
109 selector: ".wpstream_show_settings_wrapper",
110 title: "Channel Settings",
111 content:'Clicking on the <div class="wpstream_sample_icon_settings"></div> icon will let you access the channel settings.<div class="onboard_line_break"></div> You can adjust preferences for <strong>recording, autoplay</strong>, etc.',
112 left:"-444px",
113 right:"0px",
114 top:"100px",
115 arrow:"boarding-right-arrow"},
116 {id: 6,
117 selector: ".wpstream_stream_browser_wrapper",
118 title: "Turn it ON",
119 content:"To Go Live, first TURN ON your channel. Go ahead, click the big green button below!<div id=\"wpstream_onboarding_start_chanel\">TURN ON</div> Turning on may take a minute or so. You can wait or move on to the next step.",
120 left:"-444px",
121 right:"auto",
122 top:"0px",
123 arrow:"boarding-right-arrow"},
124 {id: 7,
125 selector: ".wpstream_show_settings_wrapper",
126 title: "Your Channel Page",
127 content:"This is the link to the page with your live stream. Viewers will be able to watch your live stream here.<div class='onboard_line_break'></div>To see it, click <div id=\"wpstream_onboarding_open_chanel\" class=\"wpstream_sample_icon_settings wpstream_sample_icon_open_channel\"></div> Page will open in a new tab.",
128 left:"-385px",
129 right:"auto",
130 top:"105px",
131 arrow:"boarding-right-arrow"},
132 {id: 8,
133 selector: ".wpstream_stream_browser_wrapper",
134 title: "Go LIVE",
135 content:"To go live, first turn on your channnel.<div class='onboard_line_break'></div> If it's already <strong>Turning ON</strong>, wait until <strong>Channel is ON</strong>",
136 left:"-430px",
137 right:"auto",
138 top:"50px",
139 arrow:"boarding-right-arrow"}
140 ] ,
141 // free vod
142 [
143 {id: 1,
144 selector: "#menu-posts-wpstream_product_vod",
145 title: "Hooray! You just created your first FTV Video-On-Demand.",
146 content:"You can check out all your FTV VODs or create new ones from this menu. Just look for 'Free-To-View VODs'",
147 left:"175px",
148 right:"-30px",
149 top:"-30px",
150 arrow:"boarding-left-arrow"},
151 {id: 2,
152 selector: "#add_wpstream_product_metaboxes-sectionid",
153 title: "The FTV VOD can be a Recording, self hosted, or external video",
154 content:"Recordings are stored in the WpStream cloud. <div class='onboard_line_break'></div> Self hosted videos are videos in your WordPress Media Library.<div class='onboard_line_break'></div>External videos are videos hosted on YouTube or Vimeo.",
155 left:"245px",
156 right:"-30px",
157 top:"30px",
158 arrow:"boarding-left-arrow"},
159 {id: 3,
160 selector: "#add_wpstream_product_metaboxes-sectionid",
161 title: "Choose a specific recording to create the VOD from",
162 content:"You can create new recordings by recording a live channel or uploading video files directly.",
163 left:"245px",
164 right:"-30px",
165 top:"100px",
166 arrow:"boarding-left-arrow"},
167 {id: 4,
168 selector: "#post-body",
169 title: "The VOD Page",
170 content:"This is the page that your <strong>viewers</strong> see when they <strong>watch</strong> your VOD.<div class='onboard_line_break'></div> To see it yourself, click the permalink. Page will open in a new tab. <div id=\"wpstream_onboarding_view_vod\">View VOD Page</div>",
171 left:"350px",
172 right:"0px",
173 top:"-10px",
174 arrow:"boarding-left-arrow"},
175
176 /*{id: 5,
177 selector: "#post-body",
178 title: "And Thats it",
179 content:"That's it , you users will be free to view this Video on Demand",
180 left:"350px",
181 right:"0px",
182 top:"155px",
183 arrow:""},
184 */
185 ] ,
186 //paid vod
187 [
188 {id: 1,
189 selector: "#menu-posts-product",
190 title: "Hooray! You just created your first PPV Video-On-Demand.",
191 content:"You can check out all your PPV VODs or create new ones from this menu. Just look for ‘Products’",
192 left:"175px",
193 right:"-30px",
194 top:"-30px",
195 arrow:"boarding-left-arrow"},
196 {id: 2,
197 selector: "#normal-sortables",
198 title: "A Pay-Per-View VOD is a Custom Woocommerce Product",
199 content:"Note the type of the product: <strong>Video On Demand</strong>.<div class='onboard_line_break'></div>This sets it apart from other products you may want to sell.",
200 left:"345px",
201 right:"-30px",
202 top:"-35px",
203 arrow:"boarding-left-arrow"},
204 {id: 3,
205 selector: "#normal-sortables",
206 title: "Set the Pay-Per-View price here",
207 content:"Your users will have to purchase the product in order to be allowed to watch the VOD stream. ",
208 left:"550px",
209 right:"-30px",
210 top:"25px",
211 arrow:"boarding-left-arrow"},
212 {id: 4,
213 selector: "#normal-sortables",
214 title: "Choose a specific recording to create the VOD from ",
215 content:"You can create new recordings by recording a live channel or uploading video files directly." ,
216 left:"700px",
217 right:"-30px",
218 top:"135px",
219 arrow:"boarding-left-arrow"},
220 {id: 5,
221 selector: "#post-body",
222 title: "The VOD Page",
223 content:"This is the page that your <strong>viewers</strong> see when they <strong>watch</strong> your VOD.<div class='onboard_line_break'></div>To see it yourself, click the permalink. Page will open in a new tab.<div class='onboard_line_break'></div><div id=\"wpstream_onboarding_view_vod\">View VOD Page</div>.",
224 left:"350px",
225 right:"0px",
226 top:"-10px",
227 arrow:"boarding-left-arrow"},
228 {id: 4,
229 selector: "#post-body",
230 title: "Your PPV VOD is now for sale.",
231 content:"Upon successful purchase, your viewers will be able to watch it as many times as they like.",
232 left:"350px",
233 right:"-200px",
234 top:"25px",
235 arrow:""},
236
237
238
239 ]
240
241 ];
242
243 function init(){
244 wpstream_policy_privacy_checkbox();
245 if ( window.location.protocol !== 'https:' ) {
246 jQuery('.wpstream_onboard_register').attr('disabled', true);
247 wpstream_fetchCaptcha();
248 }
249 wpstream_by_pass_login();
250 wpstream_onboard_login();
251 wpstream_get_videos_list();
252 wpstream_onboard_register();
253 wpstream_main_on_boarding_function();
254 wpstream_on_boarding_click_actions();
255 wpstream_create_free_channel_action();
256 wpstream_create_ppv_channel_action();
257 wpstream_create_free_vod_action();
258 wpstream_create_ppv_vod_action();
259 wpstream_local_modal_onboarding();
260 wpstream_on_boarding_initial_close();
261 wpstream_onboard_initial_bubble_prev_action();
262
263 }
264
265 function wpstream_policy_privacy_checkbox() {
266 jQuery('.wpstream_onboard_register').attr('disabled', true);
267
268 jQuery('#wpstream_register_privacy').on('change', function() {
269 var powReady = window.location.protocol !== 'https:'
270 ? wpstreamCaptchaPayload !== ''
271 : true;
272 jQuery('.wpstream_onboard_register').attr('disabled', !this.checked || !powReady );
273 });
274 }
275
276 /*
277 * Start browser broadcaster
278 *
279 **/
280 function wpstream_start_camera(){
281
282 if( jQuery('.event_list_unit .wpstream_button').hasClass('wpstream_stop_event') ){
283 jQuery('.wpstream_sample_icon_camera').css('cursor','pointer');
284
285 jQuery('.wpstream_sample_icon_camera').on('click',function(){
286 jQuery('.start_webcaster').trigger('click');
287 jQuery(this).unbind('click');
288
289 })
290 }
291 }
292
293
294 /*
295 * ByPass Login if already in
296 *
297 **/
298 function wpstream_by_pass_login(){
299 if(jQuery('#wpstream_have_token').length >0 ){
300
301 var nextThing = 'wpstream_step_2';
302 jQuery('.wpstream_step_wrapper').hide();
303 jQuery('#'+nextThing).show();
304
305
306 }else{
307 jQuery('.wpstream_on_board_register_wrapper').show();
308 jQuery('#wpstream_onboarding_action_login').show();
309 }
310 jQuery('.wpstream_check_account_status').hide();
311 }
312
313
314
315 /*
316 * On Board Login
317 *
318 */
319
320 function wpstream_onboard_login() {
321 jQuery('.wpstream_onboard_login').on('click',function(){
322 wpstream_onboard_actual_login();
323 });
324
325
326 jQuery('.wpstream_on_board_login_wrapper #api_username,.wpstream_on_board_login_wrapper #api_password').keydown(function (e) {
327 if (e.keyCode === 13) {
328 e.preventDefault();
329 wpstream_onboard_actual_login();
330 }
331 });
332 }
333
334 function wpstream_onboard_actual_login(){
335 var api_username = jQuery('#api_username').val();
336 var api_password = jQuery('#api_password').val();
337 var ajaxurl = wpstream_admin_control_vars.admin_url + 'admin-ajax.php';
338 var nonce = jQuery('#wpstream_onboarding_nonce').val();
339
340
341 jQuery('.wpstream_onboarding_notification').removeClass('onboarding_error').text('Sending data. Please Stand by...').show();
342
343 jQuery.ajax({
344 type: 'POST',
345 url: ajaxurl,
346 dataType: 'json',
347 data: {
348 'action' : 'wpstream_on_board_login',
349 'api_username' : api_username,
350 'api_password' : api_password,
351 'security' : nonce
352 },
353 success: function (data) {
354 if(!data.success){
355 jQuery('.wpstream_onboarding_notification').addClass('onboarding_error').text(data.error).show();
356 }else{
357 jQuery('.wpstream_onboarding_notification').text('Login successful, please stand by...').show();
358 setTimeout(function() {
359
360 var nextThing = 'wpstream_step_2';
361 jQuery('.wpstream_onboarding_notification').empty().hide();
362 jQuery('.wpstream_step_wrapper').hide();
363 jQuery('#'+nextThing).show();
364
365 }, 2500);
366 }
367
368
369 },
370 error: function (errorThrown) {
371
372 }
373 });
374
375 wpstream_track_onboarding_step( 'account_login', 'login_step', 'button', 'account_login_button' );
376 }
377
378 function wpstream_get_videos_list() {
379 var nonce = jQuery('#wpstream_onboarding_video_list_nonce').val();
380 var ajaxurl = wpstream_admin_control_vars.admin_url + 'admin-ajax.php';
381
382 jQuery('.wpstream_step_2_create_vod').on('click', function() {
383 // check the current object
384 var data_control = 'wpstream_onboard_vod_free';
385 jQuery.ajax({
386 type: 'POST',
387 url: ajaxurl,
388 dataType: 'json',
389 data: {
390 'action': 'wpstream_get_videos_list',
391 'security': nonce
392 },
393 success: function(data) {
394 if(data.success) {
395 if ( data.videos === null ||
396 data.videos === undefined ||
397 data.videos === '' ||
398 Array.isArray(data.videos) && data.videos.length === 0
399 ) {
400 // No videos found
401 wpstream_no_videos_notice(data_control === 'wpstream_onboard_vod_free' ? '' : '_for_ppv');
402 } else {
403 if ( data_control === 'wpstream_onboard_vod_free' ) {
404 wpstream_create_videos_list_content(data.videos, '');
405 jQuery('#wpstream_onboard_vod_free > .spinner').css('display', 'none');
406 jQuery('#wpstream_onboard_vod_free > .wpstream-step-container').css('display', 'block');
407 } else {
408 wpstream_create_videos_list_content(data.videos, '_for_ppv');
409 jQuery('#wpstream_onboard_vod_ppv > .spinner').css('display', 'none');
410 jQuery('#wpstream_onboard_vod_ppv > .wpstream-step-container').css('display', 'block');
411 }
412 }
413 }
414 },
415 error: function(data) {
416 jQuery('.wpstream_onboarding_notification').addClass('onboarding_error').text('Couldn\'t retrieve data.').show();
417 }
418 })
419 })
420 }
421
422 function wpstream_create_videos_list_content( data, data_control ) {
423 // if data_control is empty, it means it's for free vod
424 var container = data_control === '' ? jQuery('#wpstream_free_vod_dropdown_videos_list') : jQuery('#wpstream_ppv_vod_dropdown_videos_list');
425 container.empty();
426 var label = jQuery('<label value="">' + wpstream_admin_control_vars.choose_recording + '</label>');
427 container.append(label);
428 var select = jQuery('<select name="wpstream_free_vod_file_name" id="wpstream_free_vod_file_name' + data_control + '">');
429 var option = jQuery('<option value="">' + wpstream_admin_control_vars.select_recording + '</option>');
430 select.append(option);
431 for (let key in data) {
432 let option = jQuery('<option value="' + key + '">' + data[key] + '</option>');
433 select.append(option);
434 }
435 select.append('</select>');
436 container.append(select);
437 }
438
439 function wpstream_no_videos_notice(data_control) {
440 jQuery('#wpstream_onboard_vod_free, #wpstream_onboard_vod_ppv').css('display', 'none');
441 jQuery('.wpstream_warning_onboarding').css('display', 'block');
442 }
443
444
445
446 /*
447 * On Board Register
448 *
449 */
450 function wpstream_onboard_register(){
451
452 jQuery('.wpstream_onboard_register').on('click',function(){
453 wpstream_on_board_actual_register();
454 });
455
456
457 jQuery('#wpstream_register_email, #wpstream_register_password,#wpstream_register_captcha').keydown(function (e) {
458 if (e.keyCode === 13) {
459 e.preventDefault();
460 wpstream_on_board_actual_register();
461 }
462 });
463
464 }
465
466
467 function wpstream_on_board_actual_register(){
468 var button=jQuery(this);
469 button.css('pointer-events','none');
470
471 var wpstream_register_email = jQuery('#wpstream_register_email').val();
472 var wpstream_register_password = jQuery('#wpstream_register_password').val();
473 var ajaxurl = wpstream_admin_control_vars.admin_url + 'admin-ajax.php';
474 var wpstream_altcha = window.location.protocol !== 'https:'
475 ? wpstreamCaptchaPayload
476 : jQuery('input[name="altcha"]').val();
477 var nonce = jQuery('#wpstream_onboarding_nonce').val();
478 var wpstream_privacy_checkbox = jQuery('#wpstream_register_privacy').is(':checked');
479
480
481
482 if( wpstream_register_email ==='' || wpstream_register_password==='' ){
483 jQuery('.wpstream_onboarding_notification').addClass('onboarding_error').text('Please fill all the fields!').show();
484 button.css('pointer-events','auto');
485 return;
486 }
487
488 if( !wpstream_privacy_checkbox ){
489 jQuery('.wpstream_onboarding_notification').addClass('onboarding_error').text('You must agree to the Privacy Policy to continue.').show();
490 button.css('pointer-events','auto');
491 return;
492 }
493
494
495 jQuery('.wpstream_onboarding_notification').removeClass('onboarding_error').text('Sending data. Please Stand by...').show();
496
497 jQuery.ajax({
498 type: 'POST',
499 url: ajaxurl,
500 dataType: 'json',
501 data: {
502 'action' : 'wpstream_on_board_register',
503 'wpstream_register_email' : wpstream_register_email,
504 'wpstream_register_password': wpstream_register_password,
505 'wpstream_altcha' : wpstream_altcha,
506 'security' : nonce
507 },
508 success: function (data) {
509
510 if(data.success){
511 if(data.token==='false' || data.token===false){
512 jQuery('.wpstream_onboarding_notification').addClass('onboarding_error').text('We couldn\'t authenticate with your new credentials').show();
513 }else{
514 jQuery('.wpstream_onboarding_notification').text('Registration successful, please stand by...').show();
515 wpstream_track_onboarding_step( 'register_account', 'wpstream_step_1' );
516 setTimeout(function() {
517
518 var nextThing = 'wpstream_step_2';
519 jQuery('.wpstream_step_wrapper').hide();
520 jQuery('.wpstream_onboarding_notification').empty().hide();
521 jQuery('#'+nextThing).show();
522
523 }, 2500);
524 }
525 }else{
526 jQuery('.wpstream_onboarding_notification').addClass('onboarding_error').text(data.message).show();
527 // wpstream_fetchCaptcha();
528
529 }
530 button.css('pointer-events','auto');
531
532 },
533 error: function (errorThrown) {
534 button.css('pointer-events','auto');
535 }
536 });
537
538 wpstream_track_onboarding_step('register_account', 'register_step', 'button', 'register_account_button');
539 }
540
541
542
543 /*
544 * Check and Start the on Board
545 *
546 */
547
548 async function sha256(message) {
549 if ( typeof crypto !== 'undefined' && crypto.subtle ) {
550 const msgBuffer = new TextEncoder().encode(message);
551 const hashBuffer = await crypto.subtle.digest('SHA-256', msgBuffer);
552 const hashArray = Array.from(new Uint8Array(hashBuffer));
553 return hashArray.map(b => b.toString(16).padStart(2, '0')).join('');
554 }
555 // Pure-JS SHA-256 fallback for non-secure (HTTP) contexts
556 function rightRotate(value, amount) {
557 return (value >>> amount) | (value << (32 - amount));
558 }
559 var mathPow = Math.pow;
560 var maxWord = mathPow(2, 32);
561 var i, j;
562 var result = '';
563 var words = [];
564 var asciiBitLength = message.length * 8;
565 var hash = sha256.h = sha256.h || [];
566 var k = sha256.k = sha256.k || [];
567 var primeCounter = k.length;
568 var isComposite = {};
569 for (var candidate = 2; primeCounter < 64; candidate++) {
570 if (!isComposite[candidate]) {
571 for (i = 0; i < 313; i += candidate) {
572 isComposite[i] = candidate;
573 }
574 hash[primeCounter] = (mathPow(candidate, .5) * maxWord) | 0;
575 k[primeCounter++] = (mathPow(candidate, 1/3) * maxWord) | 0;
576 }
577 }
578 message += '\x80';
579 while (message.length % 64 - 56) message += '\x00';
580 for (i = 0; i < message.length; i++) {
581 j = message.charCodeAt(i);
582 if (j >> 8) return '';
583 words[i >> 2] |= j << ((3 - i) % 4) * 8;
584 }
585 words[words.length] = ((asciiBitLength / maxWord) | 0);
586 words[words.length] = (asciiBitLength | 0);
587 for (j = 0; j < words.length;) {
588 var w = words.slice(j, j += 16);
589 var oldHash = hash.slice(0);
590 hash = sha256.h.slice(0);
591 for (i = 0; i < 64; i++) {
592 var i2 = i + j - 16;
593 var w15 = w[i - 15], w2 = w[i - 2];
594 var a = hash[0], e = hash[4];
595 var temp1 = hash[7]
596 + (rightRotate(e, 6) ^ rightRotate(e, 11) ^ rightRotate(e, 25))
597 + ((e & hash[5]) ^ (~e & hash[6]))
598 + k[i]
599 + (w[i] = (i < 16) ? w[i] : (
600 w[i - 16]
601 + (rightRotate(w15, 7) ^ rightRotate(w15, 18) ^ (w15 >>> 3))
602 + w[i - 7]
603 + (rightRotate(w2, 17) ^ rightRotate(w2, 19) ^ (w2 >>> 10))
604 ) | 0);
605 var temp2 = (rightRotate(a, 2) ^ rightRotate(a, 13) ^ rightRotate(a, 22))
606 + ((a & hash[1]) ^ (a & hash[2]) ^ (hash[1] & hash[2]));
607 hash = [(temp1 + temp2) | 0].concat(hash);
608 hash[4] = (hash[4] + temp1) | 0;
609 hash.length = 8;
610 }
611 for (i = 0; i < 8; i++) {
612 hash[i] = (hash[i] + oldHash[i]) | 0;
613 }
614 }
615 for (i = 0; i < 8; i++) {
616 for (j = 3; j + 1; j--) {
617 var b = (hash[i] >> (j * 8)) & 255;
618 result += ((b < 16) ? 0 : '') + b.toString(16);
619 }
620 }
621 return result;
622 }
623
624 async function wpstream_solve_pow(salt, challenge, maxNumber) {
625 // Altcha PoW: find a number where sha256(salt + number) === challenge
626 for ( var number = 0; number <= maxNumber; number++ ) {
627 var hash = await sha256( salt + number );
628 if ( hash === challenge ) {
629 return number;
630 }
631 }
632 return null;
633 }
634
635 async function wpstream_fetchCaptcha () {
636 fetch( wpstream_admin_control_vars.admin_url + 'admin-ajax.php?action=wpstream_get_captcha_challenge' )
637 .then( response => response.json() )
638 .then( async function( result ) {
639 if ( result.algorithm && result.challenge && result.salt && result.signature ) {
640 const solution = await wpstream_solve_pow( result.salt, result.challenge, 50000 );
641 if ( solution !== null ) {
642 var altchaPayload = {
643 algorithm : result.algorithm,
644 challenge : result.challenge,
645 number : solution,
646 salt : result.salt,
647 signature : result.signature
648 };
649 // URL-safe base64 so http_build_query doesn't corrupt + characters
650 var payloadBase64 = btoa( JSON.stringify( altchaPayload ) )
651 .replace( /\+/g, '-' )
652 .replace( /\//g, '_' )
653 .replace( /=+$/, '' );
654 wpstreamCaptchaPayload = payloadBase64;
655 if ( jQuery('#wpstream_register_privacy').is(':checked') ) {
656 jQuery('.wpstream_onboard_register').attr( 'disabled', false );
657 }
658 } else {
659 console.log( 'Security check: could not solve PoW challenge' );
660 wpstream_captcha_show_retry();
661 }
662 } else {
663 console.log( 'Security check init failed', result );
664 wpstream_captcha_show_retry();
665 }
666 } )
667 .catch( function( error ) {
668 console.log( 'Security check error', error );
669 wpstream_captcha_show_retry();
670 } );
671 }
672
673 function wpstream_captcha_show_retry() {
674 jQuery('.wpstream_onboard_register').attr( 'disabled', true );
675 if ( jQuery('#wpstream_captcha_retry').length === 0 ) {
676 jQuery('.wpstream_onboard_register').before(
677 '<div id="wpstream_captcha_retry" style="margin-bottom:8px;color:#c00;">' +
678 'Security check failed. <a href="#" id="wpstream_captcha_retry_link">Click here to retry.</a>' +
679 '</div>'
680 );
681 jQuery(document).on( 'click', '#wpstream_captcha_retry_link', function(e) {
682 e.preventDefault();
683 jQuery('#wpstream_captcha_retry').remove();
684 wpstream_fetchCaptcha();
685 });
686 }
687 }
688
689
690 function wpstream_process_capthca(response){
691
692
693 jQuery('#wpstream_capthca').empty().append(response.capthca);
694 jQuery('#wpstream_register_captcha_id').val(response.capthca_id);
695 jQuery('#wpstream_register_captcha').empty();
696
697 }
698
699
700
701
702 /*
703 * Check and Start the on Board
704 *
705 */
706
707
708 function wpstream_main_on_boarding_function(){
709
710 jQuery('#wpstream_trigger_quick_start').on('click',function(){
711
712 jQuery(".wpstream_on_boarding_wrapper").show();
713 jQuery(".wpstream_modal_background_onboard").show();
714
715 jQuery('.wpstream_on_board_login_wrapper,#wpstream_onboarding_action_register,.wpstream_onboarding_notification').hide();
716 jQuery('#wpstream_step_1,.wpstream_close_initial_onboarding,.wpstream_on_board_register_wrapper').show();
717 wpstream_by_pass_login();
718 });
719
720
721 let params = (new URL(document.location)).searchParams;
722 let onboard = params.get('onboard_start');
723
724 if(onboard!=='yes'){
725 return;
726 }
727
728 jQuery('.wpstream_on_boarding_wrapper').show();
729 jQuery('.wpstream_modal_background_onboard').show();
730
731
732
733 }
734
735 /*
736 * WpStream on Boarding CLick actions
737 *
738 */
739
740
741 function wpstream_on_boarding_click_actions(){
742 jQuery('#wpstream_onboarding_action_login').on('click',function(){
743 jQuery(this).hide();
744 jQuery('.wpstream_onboarding_notification').hide();
745 jQuery('.wpstream_on_board_register_wrapper').hide();
746 jQuery('.wpstream_on_board_login_wrapper').show();
747 jQuery('#wpstream_onboarding_action_register').show();
748 wpstream_track_onboarding_step( 'already_have_account', 'register_step', 'link' );
749 });
750
751 jQuery('#wpstream_onboarding_action_register').on('click',function(){
752 jQuery(this).hide();
753 jQuery('.wpstream_onboarding_notification').hide();
754 jQuery('.wpstream_on_board_login_wrapper').hide();
755 jQuery('.wpstream_on_board_register_wrapper').show();
756 jQuery('#wpstream_onboarding_action_login').show();
757 wpstream_track_onboarding_step( 'back_to_registration', 'login_step', 'link' );
758 });
759
760
761 jQuery('.wpstream_action_next_step').on('click',function(){
762 var nextThing = jQuery(this).attr('data-nextthing');
763 jQuery('.wpstream_step_wrapper').hide();
764 jQuery('#'+nextThing).show();
765 var buttonStep = jQuery(this).parent().attr('id');
766
767 wpstream_track_onboarding_step( 'step_button_press', onboarding_step_to_string(buttonStep) + '_step', 'button', onboarding_step_to_string(nextThing) + '_button' );
768 });
769 }
770
771
772 /*
773 * Create free Channel action
774 *
775 */
776
777 function wpstream_create_free_channel_action(){
778 jQuery('#wpstream_on_board_create_channel').on('click',function(){
779 wpstream_actual_create_free_channel_action();
780 });
781
782 jQuery('#wpstream_onboarding_channel_name').keydown(function (e) {
783 if (e.keyCode === 13) {
784 e.preventDefault();
785 wpstream_actual_create_free_channel_action();
786 }
787 });
788
789
790 }
791
792 function wpstream_actual_create_free_channel_action(){
793 jQuery('#wpstream_onboard_live_notice').removeClass('onboarding_error').text('Creating your FTV live channel. Please Stand by...').show();
794 jQuery('#wpstream_on_board_create_channel').prop('disabled', true);
795 var channel_name = jQuery('#wpstream_onboarding_channel_name').val();
796 var ajaxurl = wpstream_admin_control_vars.admin_url + 'admin-ajax.php';
797 var nonce = jQuery('#wpstream_onboarding_nonce').val();
798
799 jQuery.ajax({
800 type: 'POST',
801 url: ajaxurl,
802 dataType: 'json',
803 data: {
804 'action' : 'wpstream_on_board_create_channel',
805 'channel_name' : channel_name,
806 'security' : nonce
807 },
808 success: function (data) {
809
810 if( data.success ) {
811 var new_link = data.link;
812 var decoded = new_link.replace(/&amp;/g, '&');
813 var redirectUrl = new URL(decoded, window.location.origin);
814 redirectUrl.searchParams.append('session_id', sessionId);
815 window.location.href = redirectUrl.toString();
816 } else {
817 jQuery('#wpstream_onboard_live_notice').empty().addClass('onboarding_error').show().text(wpstream_admin_control_vars.channel_create_error)
818 jQuery('#wpstream_on_board_create_channel').prop('disabled', false);
819 }
820 },
821 error: function ( errorThrown ) {
822 jQuery('#wpstream_onboard_live_notice').empty().addClass('onboarding_error').show().text(wpstream_admin_control_vars.channel_create_error)
823 jQuery('#wpstream_on_board_create_channel').prop('disabled', false);
824 }
825 });
826
827 wpstream_track_onboarding_step( 'create_free_channel_button', 'create_free_channel' );
828 }
829
830 /*
831 * Create PPV Channel action
832 *
833 */
834
835 function wpstream_create_ppv_channel_action(){
836 jQuery('#wpstream_onboard_live_ppv_action').on('click',function(){
837 wpstream_actual_create_ppv_channel_action();
838 });
839
840
841 jQuery('#wpstream_onboarding_channel_name_ppv,#wpstream_onboarding_event_price_ppv').keydown(function (e) {
842 if (e.keyCode === 13) {
843 e.preventDefault();
844 wpstream_actual_create_ppv_channel_action();
845 }
846 });
847
848 }
849
850
851 function wpstream_actual_create_ppv_channel_action(){
852 jQuery('#wpstream_onboard_live_ppv_notice').removeClass('onboarding_error').text('Creating your Pay Per View live channel. Please Stand by...').show();
853 jQuery('#wpstream_onboard_live_ppv_action').prop('disabled', true);
854 var channel_name = jQuery('#wpstream_onboarding_channel_name_ppv').val();
855 var channel_price = jQuery('#wpstream_onboarding_event_price_ppv').val();
856 var ajaxurl = wpstream_admin_control_vars.admin_url + 'admin-ajax.php';
857 var nonce = jQuery('#wpstream_onboarding_nonce').val();
858
859
860 jQuery.ajax({
861 type: 'POST',
862 url: ajaxurl,
863 dataType: 'json',
864 data: {
865 'action' : 'wpstream_on_board_create_channel_ppv',
866 'channel_name' : channel_name,
867 'channel_price' : channel_price,
868 'security' : nonce
869 },
870 success: function (data) {
871
872 if( data.success ) {
873 var new_link = data.link;
874 var decoded = new_link.replace(/&amp;/g, '&');
875 window.location.href=decodeURI(decoded);
876 } else {
877 jQuery('#wpstream_onboard_live_ppv_notice').empty().addClass('onboarding_error').show().text(wpstream_admin_control_vars.channel_create_error)
878 jQuery('#wpstream_onboard_live_ppv_action').prop('disabled', false);
879 }
880
881 },
882 error: function (errorThrown) {
883 jQuery('#wpstream_onboard_live_ppv_notice').empty().addClass('onboarding_error').show().text(wpstream_admin_control_vars.channel_create_error)
884 jQuery('#wpstream_onboard_live_ppv_action').prop('disabled', false);
885 }
886 });
887
888 wpstream_track_onboarding_step( 'create_ppv_channel_button', 'create_ppv_channel' );
889 }
890
891
892 /*
893 * Create Free VOD Action
894 *
895 */
896
897
898 function wpstream_create_free_vod_action(){
899 jQuery('#wpstream_onboard_vod_free_action').on('click',function(){
900 wpstream_actual_create_free_vod_action();
901 });
902
903 jQuery('#wpstream_onboarding_vod_name, #wpstream_free_vod_file_name').keydown(function (e) {
904 if (e.keyCode === 13) {
905 e.preventDefault();
906 wpstream_actual_create_free_vod_action();
907 }
908 });
909 }
910
911
912 function wpstream_actual_create_free_vod_action(){
913 jQuery('#wpstream_onboard_vod_free_notice').removeClass('onboarding_error').text('Creating your VOD. Please Stand by...').show();
914 jQuery('#wpstream_onboard_vod_free_action').prop('disabled', true);
915 var channel_name = jQuery('#wpstream_onboarding_vod_name').val();
916 var file_name = jQuery('#wpstream_free_vod_file_name').val();
917 var ajaxurl = wpstream_admin_control_vars.admin_url + 'admin-ajax.php';
918 var nonce = jQuery('#wpstream_onboarding_nonce').val();
919
920
921 if(file_name===''){
922 jQuery('#wpstream_onboard_vod_free_notice').empty().addClass('onboarding_error').show().text('Please select a recording from the list')
923 jQuery('#wpstream_onboard_vod_free_action').prop('disabled', false);
924 return;
925 }
926
927 jQuery.ajax({
928 type: 'POST',
929 url: ajaxurl,
930 dataType: 'json',
931 data: {
932 'action' : 'wpstream_on_board_create_free_vod',
933 'channel_name' : channel_name,
934 'file_name' : file_name,
935 'security' : nonce
936 },
937 success: function (data) {
938 if( data.success ) {
939 var new_link = data.link;
940 var decoded = new_link.replace(/&amp;/g, '&');
941 window.location.href=decodeURI(decoded);
942 } else {
943 jQuery('#wpstream_onboard_vod_free_notice').empty().addClass('onboarding_error').show().text(wpstream_admin_control_vars.channel_create_error)
944 jQuery('#wpstream_onboard_vod_free_action').prop('disabled', false);
945 }
946 },
947 error: function (errorThrown) {
948 jQuery('#wpstream_onboard_vod_free_notice').empty().addClass('onboarding_error').show().text(wpstream_admin_control_vars.channel_create_error)
949 jQuery('#wpstream_onboard_vod_free_action').prop('disabled', false);
950 }
951 });
952 }
953
954
955 /*
956 * Create PPV VOD Action
957 *
958 */
959
960
961 function wpstream_create_ppv_vod_action(){
962 jQuery('#wpstream_onboard_vod_ppv_action').on('click',function(){
963 wpstream_actual_create_ppv_vod_action();
964 });
965
966 jQuery('#wpstream_onboarding_ppv_vod_name, #wpstream_free_vod_file_name_for_ppv,#wpstream_onboarding_vod_price').keydown(function (e) {
967 if (e.keyCode === 13) {
968 e.preventDefault();
969 wpstream_actual_create_ppv_vod_action();
970 }
971 });
972
973
974 }
975
976 function wpstream_actual_create_ppv_vod_action(){
977 jQuery('#wpstream_onboard_vod_ppv_notice').removeClass('onboarding_error').text('Creating your VOD. Please Stand by...').show();
978 jQuery('#wpstream_onboard_vod_ppv_action').prop('disabled', true);
979
980 var channel_name = jQuery('#wpstream_onboarding_ppv_vod_name').val();
981 var file_name = jQuery('#wpstream_free_vod_file_name_for_ppv').val();
982 var vod_price = jQuery('#wpstream_onboarding_vod_price').val()
983 var ajaxurl = wpstream_admin_control_vars.admin_url + 'admin-ajax.php';
984 var nonce = jQuery('#wpstream_onboarding_nonce').val();
985
986
987 if( file_name === '' ) {
988 jQuery('#wpstream_onboard_vod_ppv_notice').empty().addClass('onboarding_error').show().text('Please select a recording from the list')
989 jQuery('#wpstream_onboard_vod_ppv_action').prop('disabled', false);
990 return;
991 }
992
993
994 jQuery.ajax({
995 type: 'POST',
996 url: ajaxurl,
997 dataType: 'json',
998 data: {
999 'action' : 'wpstream_on_board_create_ppv_vod',
1000 'channel_name' : channel_name,
1001 'file_name' : file_name,
1002 'vod_price' : vod_price,
1003 'security' : nonce
1004 },
1005 success: function (data) {
1006 if( data.success ) {
1007 var new_link = data.link;
1008 var decoded = new_link.replace(/&amp;/g, '&');
1009 window.location.href=decodeURI(decoded);
1010 } else {
1011 jQuery('#wpstream_onboard_vod_ppv_notice').empty().addClass('onboarding_error').show().text(wpstream_admin_control_vars.channel_create_error)
1012 jQuery('#wpstream_onboard_vod_ppv_action').prop('disabled', false);
1013 }
1014 },
1015 error: function (errorThrown) {
1016 jQuery('#wpstream_onboard_vod_ppv_notice').empty().addClass('onboarding_error').show().text('Something did not work .Please try again.')
1017 jQuery('#wpstream_onboard_vod_ppv_action').prop('disabled', false);
1018 }
1019 });
1020
1021 wpstream_track_onboarding_step( 'create_ppv_vod', 'create_vod' );
1022 }
1023
1024 /*
1025 * Start Modal on Particular Pages
1026 *
1027 */
1028
1029 function wpstream_local_modal_onboarding(){
1030 let params = (new URL(document.location)).searchParams;
1031 let onboard = params.get('onboard');
1032
1033 if(onboard!=='yes'){
1034 return;
1035 }
1036
1037 let branch= params.get('branch');
1038 branch=parseInt(branch);
1039
1040 if(isNaN(branch)){
1041 return;
1042 }
1043
1044 branch=branch-1;
1045
1046
1047 var help_bubble_to_insert='<div id="wpstream_onboard_bubble" data-bubble-step="0"><div class="wpstream_close_onboarding"></div>'+
1048 '<h2 id="wpstream_onboard_bubble_tile"></h2>'+
1049 '<p id="wpstream_onboard_bubble_content"></p>'+
1050 '<span class="wpstream_onboard_bubble_prev">Prev</span>'+
1051 '<span class="wpstream_onboard_bubble_next">Next</span>'+
1052 '<span class="wpstream_onboard_bubble_finish">Finish</span>'+
1053 // '<ul class="wpstream_round_bubble">';
1054 // for (let step = 0; step < BubbleFreeVod[branch].length ; step++) {
1055 // help_bubble_to_insert=help_bubble_to_insert+'<li></li>';
1056 // }
1057
1058 //help_bubble_to_insert=help_bubble_to_insert+'</ul>'+
1059 '</div><div class="wpstream_modal_background_onboard2"></div>';
1060
1061 jQuery('#wpcontent').append(help_bubble_to_insert);
1062
1063 wpstream_show_bubble(0,branch);
1064 jQuery('.woocommerce-layout__header').hide();
1065 jQuery('.wpstream_modal_background_onboard2,#wpstream_onboard_bubble').show();
1066
1067 wpstream_on_boarding_close();
1068 wpstream_bubble_controls(branch);
1069
1070 }
1071
1072
1073 /*
1074 * Close initial on boarding
1075 *
1076 */
1077
1078 function wpstream_on_boarding_initial_close(){
1079
1080 jQuery('.wpstream_close_initial_onboarding').on('click',function(){
1081 var parent_modal=jQuery(this).parent();
1082 parent_modal.find('.wpstream_step_wrapper').each(function() {
1083 if (jQuery(this).css('display') === 'block') {
1084 var current_step = jQuery(this).attr('id');
1085 wpstream_track_onboarding_step( 'close_onboarding', onboarding_step_to_string(current_step) + '_step' );
1086 }
1087 });
1088 parent_modal.find('.wpstream_close_initial_onboarding,.wpstream_step_wrapper').hide();
1089 parent_modal.find('.wpstream_close_onboarding_warning').show().html('You can run the wizard again at any time.</br> In the left menu navigate to WpStream -> WpStream Quick Start <div id="wpstrean_close_modal_ack" class="wpstrean_close_modal_ack_action">Okay, Close it now!</div>');
1090
1091 wpstrean_close_modal_ack_function();
1092 });
1093 }
1094
1095
1096 /*
1097 * Close ACK
1098 *
1099 */
1100 function wpstrean_close_modal_ack_function(){
1101 jQuery('.wpstrean_close_modal_ack_action').on('click',function(){
1102
1103 wpstream_onboarding_close_modal_logic( 'close_onboarding_acknowledge', 'wpstream_close_notice' );
1104 var parent_modal=jQuery(this).parent();
1105 parent_modal.hide();
1106 jQuery('.wpstream_modal_background_onboard2,.wpstream_modal_background_onboard').hide();
1107 jQuery('.wpstream_on_boarding_wrapper').hide();
1108 jQuery('#wpstream_onboard_bubble').hide();
1109 });
1110 }
1111
1112
1113
1114
1115 /*
1116 * Iniial next prev actions
1117 *
1118 */
1119
1120 function wpstream_onboard_initial_bubble_prev_action(){
1121 jQuery('.wpstream_onboard_initial_bubble_prev').on('click',function(){
1122 var prev_step = jQuery(this).attr('data-step');
1123 jQuery('.wpstream_step_wrapper').hide();
1124 jQuery("#"+prev_step).show();
1125
1126 var current_step = jQuery(this).parent().parent().attr('id');
1127 wpstream_track_onboarding_step( 'prev_button_click' , onboarding_step_to_string(current_step) + '_step' );
1128 });
1129
1130
1131 jQuery('.wpstream_onboarding_tryagain').on('click',function(){
1132 location.reload();
1133 });
1134
1135 jQuery('.wpstream_install_plugin').on('click',function(){
1136 var url = wpstreamonboarding_js_vars.plugin_url;
1137 window.open(url, '_blank');
1138 });
1139
1140 jQuery('.wpstream_upload_video').on('click',function(){
1141 var url = wpstreamonboarding_js_vars.upload_url;
1142 window.open(url, '_blank');
1143 });
1144
1145 }
1146
1147
1148
1149 /*
1150 * Show MOdal/Bubble for local pages
1151 *
1152 */
1153
1154 function wpstream_show_bubble(current_bubble_step,branch){
1155
1156 var current_bubble = jQuery('#wpstream_onboard_bubble');
1157 current_bubble.detach();
1158
1159 var new_info = BubbleFreeVod[branch][current_bubble_step];
1160 var new_title = new_info.title;
1161 var new_selector = new_info.selector;
1162 var new_content = new_info.content;
1163 var new_css = new_info.css;
1164 var new_left = new_info.left;
1165 var new_top = new_info.top;
1166 var new_right = new_info.right;
1167 var new_arrow = new_info.arrow;
1168
1169 current_bubble.find('#wpstream_onboard_bubble_tile').html(new_title);
1170 current_bubble.find('#wpstream_onboard_bubble_content').html(new_content);
1171 current_bubble.attr('data-bubble-step',current_bubble_step);
1172 current_bubble.removeClass('boarding-left-arrow boarding-right-arrow');
1173 current_bubble.addClass(new_arrow);
1174 current_bubble.css({
1175 'left':new_left,
1176 'right':new_right,
1177 'top':new_top
1178 });
1179
1180
1181 if( BubbleFreeVod[branch].hasOwnProperty(parseInt(current_bubble_step+1)) ){
1182 current_bubble.find('.wpstream_onboard_bubble_next').show();
1183 current_bubble.find('.wpstream_onboard_bubble_finish').hide();
1184 }else{
1185 current_bubble.find('.wpstream_onboard_bubble_next').hide();
1186 current_bubble.find('.wpstream_onboard_bubble_finish').show().css('display','inline-block');
1187 }
1188
1189
1190
1191 jQuery(new_selector).append(current_bubble);
1192
1193 jQuery('html, body').animate({
1194 scrollTop: jQuery(new_selector).offset().top-200
1195 }, 1000);
1196
1197 wpstream_on_boarding_trigger_event_start_channel();
1198 wpstream_on_boarding_trigger_event_open_channel();
1199 wpstream_on_boarding_open_vod_page();
1200 wpstream_start_camera();
1201
1202 }
1203
1204
1205 /*
1206 * Trigger Start Event
1207 *
1208 */
1209
1210 function wpstream_on_boarding_trigger_event_start_channel(){
1211 if(jQuery('.start_event').hasClass('wpstream_turning_on')){
1212
1213 jQuery('#wpstream_onboarding_start_chanel').hide();
1214 var bubble_Step =jQuery('#wpstream_onboard_bubble').attr('data-bubble-step');
1215
1216
1217 var check_against='3';
1218 if(jQuery('#woocommerce-product-data').length>0){
1219 check_against='5';
1220 }
1221
1222
1223 if(bubble_Step===check_against ){
1224 jQuery('#wpstream_onboard_bubble_tile').text('Turning ON ');
1225 jQuery('#wpstream_onboard_bubble_content').text('Good, the channel is now turning on. This may take a minute or so. You can wait or move on to the next step.');
1226 }
1227
1228 }else if( jQuery('.event_list_unit .wpstream_button').hasClass('wpstream_stop_event') ){
1229 jQuery('#wpstream_onboarding_start_chanel').hide();
1230
1231 var bubble_Step =jQuery('#wpstream_onboard_bubble').attr('data-bubble-step');
1232 var check_against='3';
1233 check_against_camera_icon='5';
1234 if(jQuery('#woocommerce-product-data').length>0){
1235 check_against='5';
1236 check_against_camera_icon='7';
1237 }
1238
1239
1240 if(bubble_Step===check_against){
1241 jQuery('#wpstream_onboard_bubble_tile').text('Channel is now ON');
1242 jQuery('#wpstream_onboard_bubble_content').text('You are ready to GO LIVE. Click Next to see how.');
1243 }
1244
1245
1246 if(bubble_Step===check_against_camera_icon){
1247 jQuery('#wpstream_onboard_bubble_tile').html('Go LIVE');
1248 jQuery('#wpstream_onboard_bubble_content').html('Go Live now, click the <div class=\"wpstream_sample_icon_settings wpstream_sample_icon_camera\"></div> icon. The broadcast app will open in a new window.');
1249 wpstream_start_camera();
1250 }
1251
1252
1253
1254
1255 }else {
1256 jQuery('#wpstream_onboarding_start_chanel').show();
1257
1258 jQuery('#wpstream_onboarding_start_chanel').on('click',function(){
1259 start_onboarding = 'yes';
1260 jQuery('.start_event.wpstream_button').trigger('click');
1261 jQuery('#wpstream_onboarding_start_chanel').unbind('click');
1262 jQuery('#wpstream_onboard_bubble_tile').text('Turning ON');
1263 jQuery('#wpstream_onboard_bubble_content').text('Good, the channel is now turning on. This may take a minute or so. You can wait or move on to the next step.');
1264 })
1265
1266 }
1267
1268 }
1269
1270
1271 /*
1272 * Trigger open page
1273 *
1274 */
1275
1276 function wpstream_on_boarding_trigger_event_open_channel(){
1277 jQuery('#wpstream_onboarding_open_chanel').on('click',function(){
1278 var link = jQuery('.wpstream_view_channel').attr('href');
1279 window.open(link, '_blank');
1280 })
1281 }
1282
1283
1284 /*
1285 * Trigger VOD Page
1286 *
1287 */
1288
1289 function wpstream_on_boarding_open_vod_page(){
1290 jQuery('#wpstream_onboarding_view_vod').on('click',function(event){
1291 event.stopPropagation();
1292 var link = jQuery('#sample-permalink a').attr('href');
1293 window.open(link, '_blank');
1294
1295 });
1296 }
1297
1298
1299
1300 /*
1301 * Close Modal
1302 *
1303 */
1304 function wpstream_on_boarding_close(){
1305 jQuery('.wpstream_close_onboarding,.wpstream_onboard_bubble_finish').on('click',function(){
1306 wpstream_onboarding_close_modal_logic(this);
1307 });
1308 jQuery('.wpstream_on_boarding_wrapper').keydown(function(e) {
1309 if ( e.keyCode === 27 ) { // ESC key
1310 wpstream_onboarding_close_modal_logic(this);
1311 }
1312 });
1313 }
1314
1315 function wpstream_onboarding_close_modal_logic(context) {
1316 wpstream_track_onboarding_step( 'close_onboarding', 'close_modal_acknowledge' );
1317 jQuery('.wpstream_onboard_bubble_finish').hide();
1318 var parent_modal=jQuery(context).parent();
1319
1320 parent_modal.find('.wpstream_close_onboarding').hide();
1321 parent_modal.find('#wpstream_onboard_bubble_tile').html('You did it!');
1322 parent_modal.find('.wpstream_onboard_bubble_prev,.wpstream_onboard_bubble_next').hide();
1323
1324 parent_modal.find('#wpstream_onboard_bubble_content').html('You can run the wizard again at any time. </br>In the left menu navigate to WpStream -> WpStream Quick Start </br> <div id="wpstrean_close_modal_ack" class="wpstrean_close_modal_ack_action">Okay, Close it now!</div>');
1325 // parent_modal.find('#wpstream_onboard_bubble_content').after('<div id="wpstrean_close_modal_ack" class="wpstrean_close_modal_ack_action">Okay, Close it now!</div>');
1326
1327 wpstrean_close_modal_ack_function();
1328 }
1329
1330
1331 /*
1332 * Bubble/Modal Controls
1333 *
1334 */
1335
1336
1337 function wpstream_bubble_controls(branch){
1338
1339 jQuery('.wpstream_onboard_bubble_next,.wpstream_onboard_bubble_prev').on('click',function(){
1340
1341 var current_bubble_step = jQuery('#wpstream_onboard_bubble').attr('data-bubble-step');
1342
1343 current_bubble_step = parseInt(current_bubble_step,10);
1344 if( jQuery(this).hasClass('wpstream_onboard_bubble_next')){
1345 current_bubble_step++;
1346 wpstream_track_onboarding_step( 'onboard_wpstream_navigation_' + branch_to_string(wpstreamonboarding_js_vars.branch), 'onboarding_step_' + current_bubble_step, 'button', 'next' );
1347 }else{
1348 current_bubble_step--;
1349 wpstream_track_onboarding_step( 'onboard_wpstream_navigation_' + branch_to_string(wpstreamonboarding_js_vars.branch), 'onboarding_step_' + current_bubble_step, 'button', 'prev' );
1350 }
1351
1352 if( current_bubble_step<0){
1353 current_bubble_step=0;
1354 var url = window.location.href;
1355 jQuery('#wpstream_onboard_bubble,.wpstream_modal_background_onboard2').hide();
1356
1357 jQuery('.wpstream_on_boarding_wrapper').show();
1358 jQuery('.wpstream_modal_background_onboard').show();
1359
1360 }
1361
1362 var max_length = BubbleFreeVod[branch].length-1;
1363
1364 if( current_bubble_step>max_length){
1365 current_bubble_step=max_length;
1366 }
1367
1368 wpstream_show_bubble(current_bubble_step,branch)
1369
1370
1371
1372 })
1373 }
1374
1375
1376 return {
1377
1378 }
1379 })();
1380
1381
1382 window.addEventListener('DOMContentLoaded', function() {
1383
1384 });
1385
1386