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 / hello-wpstream / js / wpstream-plugin-script.js

wpstream-plugin-script.js in WpStream – Live Streaming, Video on Demand, Pay Per View 4.12.4, at hello-wpstream/js/wpstream-plugin-script.js

178 lines 6.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 "use strict";
2
3 jQuery(document).ready(function () {
4 wpstream_watch_later();
5 wpstream_watch_later_video_remove();
6 });
7
8 /**
9 *
10 */
11 function wpstream_elementor_submit_form() {
12 jQuery('.wpstream_elementor_form').on('submit', function (event) {
13 event.preventDefault();
14 var form_submit = jQuery('.wpstream_elementor_form').find('.agent_submit_class_elementor');
15 wpstream_elementor_contact_process_form(form_submit);
16 });
17 }
18
19 function wpstream_elementor_contact_process_form(form_submit) {
20 var parent, button,message_area, ajaxurl, contact_u_email, contact_u_name, subject, booking_from_date, booking_to_date, booking_guest_no, message, nonce, agent_property_id, is_elementor;
21
22
23 parent = form_submit.parent();
24 button = jQuery('.wpstream_elementor_form').find('.agent_submit_class_elementor');
25 message_area = jQuery('.wpstream_elementor_form').find('.wpstream-contact-form-message');
26
27
28 button.val(wpstreamPluginScriptsVars.processing);
29 button.text(wpstreamPluginScriptsVars.processing);
30 button.prop('disabled', true);
31 ajaxurl = wpstreamPluginScriptsVars.ajaxurl;
32 message = jQuery("#form-field-message").val();
33 contact_u_email = jQuery("#rentals_contact_builder_email").val();
34 contact_u_name = jQuery("#rentals_contact_builder_name").val();
35 nonce = jQuery('#agent_property_ajax_nonce').val();
36
37
38
39 is_elementor = parent.find('#contact_form_elementor').val();
40 var elementor_email_subject = jQuery('#elementor_email_subject').val();
41
42 var temp_details;
43 temp_details = '';
44 var elementor_form = form_submit.parents('.wpstream_elementor_form');
45
46 var form_items = elementor_form.find('.elementor-field');
47
48 form_items.each(function () {
49 temp_details = temp_details + jQuery(this).attr('name') + ": " + jQuery(this).val() + "/n";
50 });
51
52 message = temp_details;
53
54
55 if (jQuery('#wpstream_agree_gdpr').length > 0 && !jQuery('#wpstream_agree_gdpr').is(':checked')) {
56 button.val(wpstreamPluginScriptsVars.send_mess);
57 button.text(wpstreamPluginScriptsVars.send_mess);
58 var aTag = jQuery(".wpstream_elementor_form");
59 jQuery('html,body').animate({scrollTop: aTag.offset().top - 120}, 'slow');
60 button.prop('disabled', false);
61 message_area.empty().text( wpstreamPluginScriptsVars.gdpr_agree);
62
63 return;
64 }
65
66
67
68 jQuery.ajax({
69 type: 'POST',
70 dataType: 'json',
71 url: ajaxurl,
72 data: {
73 'action': 'wpstream_ajax_contact_function',
74 'name': contact_u_name,
75 'email': contact_u_email,
76 'comment': message,
77 'elementor_email_subject': elementor_email_subject,
78 'is_elementor': 1,
79 'nonce': nonce
80 },
81 success: function (data) {
82 var aTag = jQuery(".wpstream_elementor_form");
83 jQuery('html,body').animate({scrollTop: aTag.offset().top - 120}, 'slow');
84
85 // reset contact form
86 button.val(wpstreamPluginScriptsVars.send_mess);
87 button.text(wpstreamPluginScriptsVars.send_mess);
88 button.prop('disabled', false);
89 jQuery(".wpstream_elementor_form .elementor-field").val('');
90
91 var aTag = jQuery(".wpstream_elementor_form");
92 jQuery('html,body').animate({scrollTop: aTag.offset().top - 120}, 'slow');
93 message_area.empty().text(data.response );
94
95
96 },
97 error: function (errorThrown) {
98
99 }
100
101 });
102
103 }
104
105
106 /**
107 * Add to watch later
108 */
109 function wpstream_watch_later() {
110 jQuery(document).on('click', '.wpstream-watch-later-action', function () {
111 const item = jQuery(this);
112 var parent = jQuery(this).closest('.wpstream-watch-later-btn');
113
114 if (item.hasClass('wpstream_no_action')) {
115 return;
116 }
117
118 const postID = item.attr('data-postID');
119 const nonce = 'nonce';
120 const wpstream_admin_ajax_url = wpstreamPluginScriptsVars.ajaxurl;
121 jQuery.ajax({
122 type: 'POST',
123 url: wpstream_admin_ajax_url, // WordPress AJAX URL,
124 dataType: 'json',
125 data: {
126 action: 'wpstream_handle_watch_later_item_ajax',
127 postID: postID,
128 security: nonce // Include the nonce in the data
129 },
130 success: function (data) {
131 if (data.success === true) {
132 if (item.hasClass('wpstream_already_watched_later')) {
133 // Class exists, remove it
134 item.removeClass('wpstream_already_watched_later');
135 parent.empty();
136 parent.html(data.content);
137 } else {
138 // Class does not exist, add it
139 item.addClass('wpstream_already_watched_later');
140 parent.empty();
141 parent.html(data.content);
142 }
143 }
144 },
145 error: function (errorThrown) {
146 // Handle AJAX errors here
147 }
148 }); // end ajax
149 });
150 }
151
152 /**
153 * Remove Video in Watch later page
154 */
155 function wpstream_watch_later_video_remove() {
156 jQuery('.wpstream_watch-later-remove-btn').on('click', function () {
157 const postIdToRemove = jQuery(this).data('post-id');
158 const wpstream_admin_ajax_url = wpstreamPluginScriptsVars.ajaxurl;
159 const nonce = jQuery('#wpstream-watch-later-nonce').val();
160 const item_to_remove = jQuery(this).closest('.wpstream-dashboard-card');
161
162 jQuery.ajax({
163 url: wpstream_admin_ajax_url,
164 type: 'POST',
165 dataType: 'json',
166 data: {
167 action: 'wpstream_remove_post_id',
168 postID: postIdToRemove,
169 wpstream_nonce: nonce // Include the nonce in the data
170 },
171 success: function (response) {
172 if (response.success) {
173 item_to_remove.remove();
174 }
175 }
176 });
177 });
178 }