PluginProbe
WpStream – Live Streaming, Video on Demand, Pay Per View / 4.13
WpStream – Live Streaming, Video on Demand, Pay Per View v4.13
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 4.5.12 All 180 releases
wpstream / admin / js / utils / admin_utils.js

admin_utils.js in WpStream – Live Streaming, Video on Demand, Pay Per View 4.13, at admin/js/utils/admin_utils.js

65 lines 2.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 window.WpStreamUtils = window.WpStreamUtils || {};
2
3 WpStreamUtils.generate_download_link = function(){
4 jQuery('.wpstream_get_download_link').on('click',function(){
5 var ajaxurl = wpstream_admin_control_vars.admin_url + 'admin-ajax.php';
6 var video_name = jQuery(this).attr('data-filename');
7 var parent = jQuery(this).parent();
8
9 jQuery(this).remove();
10 parent.find('.wpstream_download_link').show().text('please wait...');
11
12 jQuery.ajax({
13 type: 'POST',
14 url: ajaxurl,
15 dataType: 'json',
16 data: {
17 'action': 'wpstream_get_download_link',
18 'video_name': video_name,
19 },
20 success: function (data) {
21 if( data.success === true ){
22 parent.find('.wpstream_download_link').show().text(wpstream_admin_control_vars.download_mess);
23 parent.find('.wpstream_download_link').show().attr('href',data.url);
24 }else{
25 var error_message = data.error;
26 if( data.error === 'NOT_ENOUGH_TRAFFIC' ) {
27 error_message = 'Not Enough data to download!';
28 }
29
30 parent.find('.wpstream_download_link').show().text(error_message);
31 }
32 },
33 error: function (errorThrown) {
34 // error state
35 }
36 });
37 });
38 }
39
40 WpStreamUtils.generate_delete_link = function() {
41 jQuery('.wpstream_delete_media').on('click',function(){
42 var ajaxurl = wpstream_admin_control_vars.admin_url + 'admin-ajax.php';
43 var video_name = jQuery(this).attr('data-filename').trim();
44 var parent = jQuery(this).parent();
45
46 jQuery.ajax({
47 type: 'POST',
48 url: ajaxurl,
49 dataType: 'json',
50 data: {
51 'action': 'wpstream_get_delete_file',
52 'video_name': video_name
53
54 },
55 success: function (data) {
56 if( data.success === true ){
57 parent.remove();
58 }
59 },
60 error: function (errorThrown) {
61 // error state
62 }
63 });
64 });
65 }