PluginProbe
WpStream – Live Streaming, Video on Demand, Pay Per View / 3.3
WpStream – Live Streaming, Video on Demand, Pay Per View v3.3
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 / admin_control.js

admin_control.js in WpStream – Live Streaming, Video on Demand, Pay Per View 3.3, at admin/js/admin_control.js

771 lines 28.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 /*global $, jQuery, */
2 var counters={};
3
4 jQuery(document).ready(function ($) {
5 "use strict";
6
7 wpstream_check_live_connections();
8 generate_download_link();
9 generate_delete_link();
10 social_media_toggle('wpstream_on_facebook');
11 social_media_toggle('wpstream_on_youtube');
12 social_media_toggle('wpstream_on_twich');
13
14
15 function social_media_toggle(social_class){
16
17 jQuery('.'+social_class).on('change',function(){
18
19 if( $(this).prop('checked') ){
20 jQuery($(this).parent().parent().find( '.'+social_class+'_container' )).slideDown('100');
21 }else{
22 jQuery($(this).parent().parent().find( '.'+social_class+'_container' )).slideUp('100');
23 }
24
25 });
26 }
27
28
29
30 jQuery('.wpestate_notices .notice-dismiss').on('click',function(){
31
32 var ajaxurl = wpstream_admin_control_vars.admin_url + 'admin-ajax.php';
33 var notice_type = $(this).parent().attr('data-notice-type');
34 var nonce = $('#wpstream_notice_nonce').val();
35
36
37 jQuery.ajax({
38 type: 'POST',
39 url: ajaxurl,
40 data: {
41 'action' : 'wpstream_update_cache_notice',
42 'notice_type' : notice_type,
43 'security' : nonce
44 },
45 success: function (data) {
46
47
48 },
49 error: function (errorThrown) {
50
51 }
52 });
53 });
54
55
56
57
58 function generate_delete_link(){
59 $('.wpstream_delete_media').on('click',function(){
60
61
62 var ajaxurl = wpstream_admin_control_vars.admin_url + 'admin-ajax.php';
63 var video_name = $(this).attr('data-filename').trim();
64 var acesta = $(this);
65 var parent = $(this).parent();
66
67
68 jQuery.ajax({
69 type: 'POST',
70 url: ajaxurl,
71
72 data: {
73 'action' : 'wpstream_get_delete_file',
74 'video_name' : video_name
75
76 },
77 success: function (data) {
78 parent.remove();
79
80
81 },
82 error: function (errorThrown) {
83 }
84 });
85 });
86
87
88 }
89
90 function generate_download_link(){
91
92 $('.wpstream_get_download_link').on('click',function(){
93 var ajaxurl = wpstream_admin_control_vars.admin_url + 'admin-ajax.php';
94 var video_name = $(this).attr('data-filename');
95 var acesta = $(this);
96 var parent = $(this).parent();
97
98 jQuery(this).remove();
99 parent.find('.wpstream_download_link').show().text('please wait...');
100
101
102
103 jQuery.ajax({
104 type: 'POST',
105 url: ajaxurl,
106
107 data: {
108 'action' : 'wpstream_get_download_link',
109 'video_name' : video_name,
110
111 },
112 success: function (data) {
113
114 if(String(data)==='toolarge'){
115 parent.find('.wpstream_download_link').show().text(wpstream_admin_control_vars.no_band);
116 }else{
117 parent.find('.wpstream_download_link').show().text(wpstream_admin_control_vars.download_mess);
118 parent.find('.wpstream_download_link').show().attr('href',data);
119
120 }
121
122 },
123 error: function (errorThrown) {
124 }
125 });
126 });
127
128 }
129
130
131
132
133
134 $( '.inputfile' ).each( function(){
135 var $input = $( this ),
136 $label = $input.next( 'label' ),
137 labelVal = $label.html();
138
139 $input.on( 'change', function( e )
140 {
141 var fileName = '';
142
143 if( this.files && this.files.length > 1 )
144 fileName = ( this.getAttribute( 'data-multiple-caption' ) || '' ).replace( '{count}', this.files.length );
145 else if( e.target.value )
146 fileName = e.target.value.split( '\\' ).pop();
147
148 if( fileName )
149 $label.find( 'span' ).html( fileName );
150 else
151 $label.html( labelVal );
152 });
153
154 // Firefox bug fix
155 $input
156 .on( 'focus', function(){ $input.addClass( 'has-focus' ); })
157 .on( 'blur', function(){ $input.removeClass( 'has-focus' ); });
158 });
159
160 var form = $('.direct-upload');
161 var filesUploaded = [];
162 var folders = [];
163
164 // var new_file_name='';
165
166 form.fileupload({
167 url: form.attr('action'),
168 type: form.attr('method'),
169 datatype: 'xml',
170 add: function (event, data) {
171
172
173 if( data.files[0].type!=='video/mp4' && data.files[0].type!=='video/quicktime'){
174 jQuery('#wpstream_uploaded_mes').empty().html(wpstream_admin_control_vars.not_accepted);
175 return;
176 }
177
178
179
180 var file_size=(parseInt(data.files[0].size,10))/1000000;
181 var user_storage = jQuery('#wpstream_storage').val();
182 var user_band = jQuery('#wpstream_band').val();
183
184
185
186 if(file_size > user_storage || file_size>user_band){
187 jQuery('#wpstream_uploaded_mes').empty().html(wpstream_admin_control_vars.no_band_no_store);
188 return;
189 }
190
191
192 $('#wpstream_label_action').text(wpstream_admin_control_vars.uploading)
193
194 jQuery('#wpstream_uploaded_mes').empty().html();
195 // Show warning message if your leaving the page during an upload.
196 window.onbeforeunload = function () {
197 return 'You have unsaved changes.';
198 };
199
200 var file = data.files[0];
201
202 //console.log('file'+JSON.stringify(file));
203 form.find('input[name="Content-Type"]').val(file.type);
204 form.find('input[name="Content-Length"]').val(file.size);
205
206 // Actually submit to form to S3.
207 data.submit();
208
209 // Show the progress bar
210 // Uses the file size as a unique identifier
211 var bar = $('<div class="progress" data-mod="'+file.size+'"><div class="bar"></div></div>');
212 $('.progress-bar-area').append(bar);
213 bar.slideDown('fast');
214 },
215 progress: function (e, data) {
216 // This is what makes everything really cool, thanks to that callback
217 // you can now update the progress bar based on the upload progress.
218 var percent = Math.round((data.loaded / data.total) * 100);
219 $('.progress[data-mod="'+data.files[0].size+'"] .bar').css('width', percent + '%').html(percent+'%');
220 },
221
222 fail: function (e, data) {
223 // Remove the 'unsaved changes' message.
224 window.onbeforeunload = null;
225 $('.progress[data-mod="'+data.files[0].size+'"] .bar').css('width', '100%').addClass('red').html('');
226 },
227 done: function (event, data) {
228
229 window.onbeforeunload = null;
230 $('.bar').remove();
231 $('#wpstream_uploaded_mes').empty().html(wpstream_admin_control_vars.upload_complete);
232 $('#wpstream_label_action').text(wpstream_admin_control_vars.upload_complete2);
233
234 var new_file_name=data.files[0].name;
235
236
237 var new_file_name_array= data.files[0].name.split(".");
238 var temp_file_name= new_file_name_array[0].split(' ').join('_');
239 temp_file_name= temp_file_name.replace(/\W/g, '');
240 new_file_name=temp_file_name+'.'+new_file_name_array[new_file_name_array.length-1];
241
242
243
244
245 var onclick_string=' Are you sure you wish to delete '+new_file_name+' ? ';
246
247 var to_insert='<div class="wpstream_video_wrapper"><div class="wpstream_video_title"><div class="wpstream_video_notice"></div></div><div class="wpstream_video_title">';
248 to_insert=to_insert+'<strong class="storage_file_name">File Name :</strong><span class="storage_file_name_real">'+new_file_name+' </span></div>';
249 to_insert=to_insert+'<div class="wpstream_delete_media" ';
250 to_insert=to_insert+' onclick=" return confirm('+onclick_string+') "';
251 to_insert=to_insert+' data-filename="'+new_file_name+'" >delete file</div>';
252 to_insert=to_insert+'<div class="wpstream_get_download_link" data-filename="'+new_file_name+'">get download link</div> ';
253 to_insert=to_insert+'<a href="" class="wpstream_download_link">Click to download! The url will work for the next 20 minutes!</a></div>';
254
255 $('#video_management_title').after(to_insert);
256
257 $('.wpstream_get_download_link').unbind('click');
258 $('.wpstream_delete_media').unbind('click');
259
260 generate_download_link();
261 generate_delete_link();
262
263
264 }
265 });
266
267
268
269
270
271 jQuery('.copy_live_uri').click(function(){
272 var value_uri = jQuery(this).parent().find('.wpstream_live_uri_text').text();
273 var temp = jQuery("<input>");
274 jQuery("body").append(temp);
275 jQuery(temp).val(value_uri).select();
276 document.execCommand("copy");
277 jQuery(temp).remove();
278
279 });
280
281 jQuery('.copy_live_key').click(function(){
282 var value_uri = jQuery(this).parent().find('.wpstream_live_key_text').text();
283 var temp = jQuery("<input>");
284 jQuery("body").append(temp);
285 jQuery(temp).val(value_uri).select();
286 document.execCommand("copy");
287 jQuery(temp).remove();
288 });
289
290
291 jQuery('#product-type').on('change',function(){
292
293 var product_type= jQuery('#product-type').val();
294 if(product_type==='live_stream' || product_type==='video_on_demand'){
295 jQuery('._sold_individually_field').show();
296 }
297
298 });
299
300 if(wpstream_findGetParameter('new_video_name')!=='' && wpstream_findGetParameter('new_video_name')!=null ){
301 jQuery('#product-type').val('video_on_demand').trigger('change');
302 }
303
304 if(wpstream_findGetParameter('new_stream')!=='' && wpstream_findGetParameter('new_stream')!=null ){
305 jQuery('#product-type').val('live_stream').trigger('change');
306 }
307
308 var product_type= jQuery('#product-type').val();
309
310 if ( product_type === 'video_on_demand' ) {
311 jQuery('.show_if_video_on_demand' ).show();
312
313 }
314 else if ( product_type === 'live_stream' ) {
315 $( '.show_if_live_stream' ).show();
316
317 }
318
319
320
321
322
323 function wpstream_findGetParameter(parameterName) {
324 var result = null,
325 tmp = [];
326 location.search
327 .substr(1)
328 .split("&")
329 .forEach(function (item) {
330 tmp = item.split("=");
331 if (tmp[0] === parameterName) result = decodeURIComponent(tmp[1]);
332 });
333 return result;
334 }
335
336
337 jQuery('#_subscript_live_event').change(function(){
338 //alert('move it'+product_type);
339 if ( product_type === 'video_on_demand' || product_type === 'live_stream' ) {
340
341 }else{
342 var value= jQuery(this).val();
343 if(value==="no"){
344 jQuery("._movie_url_field").parent().removeClass("hide_if_subscription").show();
345 }else{
346 jQuery("._movie_url_field").parent().addClass("hide_if_subscription").hide();
347 }
348 }
349 });
350
351 jQuery('#_subscript_live_event').trigger('change');
352
353
354 $('#wpstream_product_type').change(function(){
355 $('.video_free').hide();
356 $('.video_free_external').hide();
357
358 if( $('#wpstream_product_type').val()=== "2"){
359 $('.video_free').show();
360 }
361 if( $('#wpstream_product_type').val()=== "3"){
362 $('.video_free_external').show();
363 }
364 });
365 $('#wpstream_product_type').trigger('change');
366
367
368
369 $('#wpstream_free_video_external_button').on( 'click', function(event) {
370 var formfield = $('#wpstream_free_video_external').attr('name');
371 tb_show('', 'media-upload.php?type=image&amp;TB_iframe=true');
372 window.send_to_editor = function (html) {
373 var pathArray = html.match(/<media>(.*)<\/media>/);
374 var mediaUrl = pathArray != null && typeof pathArray[1] != 'undefined' ? pathArray[1] : '';
375
376 if(mediaUrl===''){
377 mediaUrl = jQuery(html).attr("href");
378 }
379 jQuery('#wpstream_free_video_external').val(mediaUrl);
380 tb_remove();
381 };
382 return false;
383 });
384
385 $('.close_event').click(function(event){
386 event.preventDefault();
387 var ajaxurl = wpstream_admin_control_vars.admin_url + 'admin-ajax.php';
388 var acesta = $(this);
389 var parent = $(this).parent().parent();
390 var notification_area = $(this).parent().find('.event_list_unit_notificationx');
391 var show_id = parseFloat( $(this).attr('data-show-id') );
392 var nonce = $('#wpstream_start_event_nonce').val();
393 //$(this).unbind();
394 notification_area.text('Closing Event');
395
396
397 jQuery.ajax({
398 type: 'POST',
399 url: ajaxurl,
400 dataType: 'json',
401 data: {
402 'action' : 'wpstream_close_event',
403 'security' : nonce,
404 'show_id' : show_id
405 },
406 success: function (data) {
407 parent.remove();
408 },
409 error: function (errorThrown) {
410
411 }
412 });
413
414 });
415
416 $('.start_webcaster').on('click',function(){
417 var caster_url = $(this).attr('data-webcaster-url');
418 $(this).parent().find('.external_software_streaming').slideUp()
419 window.open(caster_url, '_blank', 'location=yes,height=390,width=660,scrollbars=yes,status=yes');
420 })
421
422 $('.start_external').on('click',function(){
423 $(this).parent().parent().find('.external_software_streaming').slideToggle();
424 });
425
426
427 function wpstream_check_live_connections(){
428
429 if( $('.pending_streaming.pending_trigger').length>0 ){
430 $('.pending_streaming.pending_trigger').each(function(){
431 var server_url = $(this).attr('data-server-url');
432 var counter = '';
433 var acesta = $(this);
434
435 var show_id = $(this).attr('data-show-id');
436 var server_id = $(this).attr('data-server-id');
437
438 wpstream_check_live_connections_from_database(acesta,show_id,server_id);
439 var counter_long = '';
440 counter_long = setInterval( function (){ wpstream_check_live_connections_from_database(acesta,show_id,server_id)},60000);
441 counters[show_id]=counter_long;
442
443 });
444 }
445
446 }
447
448
449
450 function wpstream_check_live_connections_step( acesta,server_url){
451
452 var server_status = wpstream_check_server_status(server_url,
453 function( server_status ){
454
455 if(server_status ){
456 acesta.removeClass('show_stream_data').addClass('hide_stream_data');
457 acesta.parent().find('.wpstream_ready_to_stream').removeClass('hide_stream_data').addClass('show_stream_data');
458 clearInterval( counters[server_url]);
459 }
460 });
461
462 }
463
464 function wpstream_check_live_connections_on_start( parent,show_id,server_id,data){
465
466 // server_url is dns change
467
468 wpstream_check_dns_avb_callback(show_id,server_id,
469 function(server_status){
470
471 if(server_status.status==='active' ){
472 clearInterval( counters[server_id]);
473
474
475 parent.find('.pending_streaming').removeClass('show_stream_data').addClass('hide_stream_data');
476 parent.find('.wpstream_ready_to_stream ').removeClass('hide_stream_data').addClass('show_stream_data');
477 parent.find('.external_software_streaming ').removeClass('hide_stream_data').addClass('show_stream_data');
478 parent.find('.view_channel').addClass('show_stream_data');
479
480 parent.find('.wpstream_ready_to_stream .start_webcaster').attr('data-webcaster-url',server_status.webCasterUrl);
481 parent.find('.wpstream_live_uri_text').text(server_status.obs_uri);
482 parent.find('.wpstream_live_key_text').text(server_status.obs_stream);
483
484 }else if(server_status.status==='error' ){
485 clearInterval( counters[server_id]);
486 var curent_content = parent.find('.wpstream_channel_status');
487 curent_content.html('<div class="wpstream_channel_status not_ready_to_stream"><span class="dashicons dashicons-dismiss"></span>Failed to start the channel. Please try again in a few minutes.</div>');
488 }
489 });
490
491 }
492
493 function wpstream_check_live_connections_from_database( acesta,show_id,server_id){
494
495 var server_status = wpstream_check_dns_avb_callback(show_id,server_id,
496 function(server_status){
497
498 if(server_status.status==='active' ){
499
500 acesta.removeClass('show_stream_data').addClass('hide_stream_data');
501 acesta.parent().find('.wpstream_ready_to_stream').removeClass('hide_stream_data').addClass('show_stream_data');
502 acesta.parent().find('.view_channel').addClass('show_stream_data');
503
504 acesta.parent().find('.wpstream_ready_to_stream .start_webcaster').attr('data-webcaster-url',server_status.webCasterUrl);
505 acesta.parent().find('.wpstream_live_uri_text').text(server_status.obs_uri);
506 acesta.parent().find('.wpstream_live_key_text').text(server_status.obs_stream);
507
508
509 clearInterval( counters[show_id]);
510 }else if(server_status.status==='error' ){
511
512 clearInterval( counters[show_id]);
513 var curent_content = acesta.parent().find('.wpstream_channel_status ');
514 curent_content.html('<div class="wpstream_channel_status not_ready_to_stream"><span class="dashicons dashicons-dismiss"></span>Failed to start the channel. Please try again in a few minutes.</div>');
515 }
516 });
517
518 }
519
520
521 function wpstream_check_server_status(url_param,callback) {
522
523 var url = url_param ;
524 var status='';
525 $.ajax({
526 url: url,
527 type: "get",
528 cache: false,
529 dataType: 'jsonp', // it is for supporting crossdomain
530 crossDomain : true,
531 asynchronous : false,
532 timeout : 1500, // set a timeout in milliseconds
533 callback:'',
534 complete : function(xhr) {
535
536 if(xhr.status == "200" || xhr.status == "400") {
537 callback(true);
538 }
539 else {
540 callback(false);
541 }
542 }
543 });
544 }
545
546
547 $('.stop_server').click(function(event){
548 event.preventDefault();
549 var ajaxurl = wpstream_admin_control_vars.admin_url + 'admin-ajax.php';
550 var acesta = $(this);
551 var show_id = parseFloat( $(this).attr('data-show-id') );
552 var nonce = $('#wpstream_stop_event_nonce').val();
553 var parent = $(this).parent().parent();
554
555 acesta.text('turning off...');
556 jQuery.ajax({
557 type: 'POST',
558 url: ajaxurl,
559 timeout: 300000,
560
561 data: {
562 'action' : 'wpstream_stop_server',
563 'security' : nonce,
564 'show_id' : show_id
565
566 },
567 success: function (data) {
568 acesta.text('Turn Off Channel');
569 //wpstream_no_stream show_stream_data
570 //pending_streaming hide_stream_data
571 //wpstream_ready_to_stream hide_stream_data
572 //external_software_streaming hide_stream_data
573 parent.find('.wpstream_no_stream').addClass('show_stream_data').removeClass('hide_stream_data');
574 parent.find('.pending_streaming').addClass('hide_stream_data').removeClass('show_stream_data');
575 parent.find('.wpstream_ready_to_stream').removeClass('show_stream_data').addClass('hide_stream_data');
576 parent.find('.external_software_streaming ').addClass('hide_stream_data');
577 parent.find('.record_wrapper').show();
578 parent.find('.start_event').show();
579 parent.find('.close_event').show();
580 parent.find('.server_notification').text('Channel is inactive.');
581
582 },
583 error: function (jqXHR,textStatus,errorThrown) {
584
585 }
586
587 });
588
589 });
590
591
592
593
594
595
596
597
598 $('.start_event').click(function(event){
599 event.preventDefault();
600 var ajaxurl = wpstream_admin_control_vars.admin_url + 'admin-ajax.php';
601 var acesta = $(this);
602 var notification_area = $(this).parent().find('.event_list_unit_notification');
603 var curent_content = $(this).parent().find('.server_notification');
604 var is_record = false;
605 var is_encrypt = false;
606 var show_id = parseFloat( $(this).attr('data-show-id') );
607 var nonce = $('#wpstream_start_event_nonce').val();
608 var parent = $(this).parent().parent();
609
610 if( $(this).parent().find('.record_event').is(":checked") ){
611 is_record = true;
612 }
613
614 if( $(this).parent().find('.encrypt_event').is(":checked") ){
615 is_encrypt = true;
616 }
617
618
619
620
621
622 var is_fb = 0;
623 var is_youtube = 0;
624 var is_twich = 0;
625 var youtube_rtmp = $(this).parent().find('.wpstream_youtube_rtmp').val();
626 var twich_rtmp = $(this).parent().find('.wpstream_twich_rtmp').val();
627
628 if( $(this).parent().find('.wpstream_on_facebook').is(":checked") ){
629 is_fb = 1;
630 }
631
632 if( $(this).parent().find('.wpstream_on_youtube').is(":checked") ){
633 is_youtube = 1;
634 }
635
636 if( $(this).parent().find('.wpstream_on_twich').is(":checked") ){
637 is_twich = 1;
638 }
639
640
641 // $(this).unbind();
642 $(this).hide();
643 parent.find('.record_wrapper').hide();
644 parent.find('.close_event ').hide();
645 curent_content.html('<div class="wpstream_channel_status not_ready_to_stream"><span class="dashicons dashicons-dismiss"></span>Getting ready to stream. Please wait...<img class="" src="'+wpstream_admin_control_vars.loading_url+'" alt="loading"></div>');
646 parent.find('.multiple_warning_events').html('* Starting a channel can take 1-2 minutes or more. Please be patient.');
647
648
649 jQuery.ajax({
650 type: 'POST',
651 url: ajaxurl,
652 dataType: 'json',
653 timeout: 300000,
654
655 data: {
656 'action' : 'wpstream_give_me_live_uri',
657 'security' : nonce,
658 'show_id' : show_id,
659 'is_record' : is_record,
660 'is_encrypt' : is_encrypt,
661 'is_fb' : is_fb,
662 'is_youtube' : is_youtube,
663 'is_twich' : is_twich,
664 'youtube_rtmp' : youtube_rtmp,
665 'twich_rtmp' : twich_rtmp
666
667 },
668 success: function (data) {
669
670 if(data.conected===true){
671
672 if(data.event_data==='err1'){
673 curent_content.html('<div class="wpstream_channel_status not_ready_to_stream"><span class="dashicons dashicons-dismiss"></span>You don\'t have enough streaming bandwidth to start a new event!</div>');
674 }else if(data.event_data ==='failed event creation'){
675 curent_content.html('<div class="wpstream_channel_status not_ready_to_stream"><span class="dashicons dashicons-dismiss"></span>Failed to start the channel. Please try again in a few minutes.</div>');
676 }else{
677 curent_content.empty();
678 parent.find('.wpstream_no_stream').removeClass('show_stream_data').addClass('hide_stream_data');
679 parent.find('.pending_streaming').removeClass('hide_stream_data').addClass('show_stream_data');
680
681 var counter = setInterval( function (){ wpstream_check_live_connections_on_start(parent,show_id,data.event_data,data)},10000);
682 counters[data.event_data]=counter;
683 }
684
685 }else{
686 parent.find('.wpstream_no_stream').addClass('show_stream_data').empty().html('<div class="error_notice">'+data.error+'</div>');
687 }
688
689 },
690 error: function (jqXHR,textStatus,errorThrown) {
691
692 }
693 });
694
695 });
696
697 $('.category_featured_image_button').on( 'click', function() {
698 var parent = $(this).parent();
699 var formfield = parent.find('#category_featured_image').attr('name');
700 tb_show('', 'media-upload.php?type=image&amp;TB_iframe=true');
701 window.send_to_editor = function (html) {
702 var imgurl = $('img', html).attr('src');
703 parent.find('#category_featured_image').val(imgurl);
704 var theid = $('img', html).attr('class');
705 var thenum = theid.match(/\d+$/)[0];
706 parent.find('#category_attach_id').val(thenum);
707 tb_remove();
708 };
709 return false;
710 });
711
712
713 });
714
715
716
717 function wpstream_check_dns_avb_callback(show_id,server_id,callback){
718
719 var ajaxurl = wpstream_admin_control_vars.admin_url + 'admin-ajax.php';
720 jQuery.ajax({
721 type: 'POST',
722 url: ajaxurl,
723 timeout: 3000000,
724
725 data: {
726 'action' : 'wpstream_check_event_status',
727 'server_id' : server_id,
728 'show_id' : show_id
729
730 },
731 success: function (data) {
732 var obj = JSON.parse(data);
733
734 if(obj.status=='active'){
735 callback(obj);
736 }else if(obj.status=='error'){
737 callback(obj);
738 }else{
739 callback(false);
740 }
741
742 }, error: function (jqXHR,textStatus,errorThrown) {
743
744 }
745 });
746 }
747
748
749 function wpstream_enable_cliboard(parent){
750
751 jQuery(parent).find('.copy_live_uri').click(function(){
752 alert('click');
753 var value_uri = jQuery(parent).find('.wpstream_live_uri_text').text();
754 var temp = jQuery("<input>");
755 jQuery("body").append(temp);
756 jQuery(temp).val(value_uri).select();
757 document.execCommand("copy");
758 jQuery(temp).remove();
759
760 });
761
762 jQuery(parent).find('.copy_live_key').click(function(){
763 var value_uri = jQuery(parent).find('.wpstream_live_key_text').text();
764 var temp = jQuery("<input>");
765 jQuery("body").append(temp);
766 jQuery(temp).val(value_uri).select();
767 document.execCommand("copy");
768 jQuery(temp).remove();
769
770 });
771 }