https://plakos-akademie.de/wp-content/plugins/edwiser-bridge/public/assets/js/eb-public.js?ver=2.2.0
1(function ($) { 2 'use strict'; 3 4 /** 5 * All of the code for your public-facing JavaScript source 6 * should reside in this file. 7 * 8 * Note that this assume you're going to use jQuery, so it prepares 9 * the $ function reference to be used within the scope of this 10 * function. 11 * 12 * From here, you're able to define handlers for when the DOM is 13 * ready: 14 * 15 * $(function() { 16 * 17 * }); 18 * 19 * Or when the window is loaded: 20 * 21 * $( window ).load(function() { 22 * 23 * }); 24 * 25 * ...and so on. 26 * 27 * Remember that ideally, we should not attach any more than a single DOM-ready or window-load handler 28 * for any particular page. Though other scripts in WordPress core, other plugins, and other themes may 29 * be doing this, we should try to minimize doing that in our own work. 30 */ 31 32 /** 33 * Provides the functionality to place the new order on click of the Take this course button. 34 */ 35 function placeOrder(formSubmit) { 36 var course_id = $("input[name='item_number']").val(); 37 var order_id = ''; 38 var buyer_id = $("input[name='custom']").val(); 39 var custom_data = {}; 40 41 $.ajax({
42 method: 'post', 43 async: false, 44 url: eb_public_js_object.ajaxurl, 45 dataType: 'json', 46 data: { 47 action: 'createNewOrderAjaxWrapper', 48 buyer_id: buyer_id, 49 course_id: course_id, 50 _wpnonce_field: eb_public_js_object.nonce, 51 }, 52 success: function (response) { 53 //prepare response for user 54 if (response.success == 1) { 55 //create custom data encoded in json 56 custom_data['buyer_id'] = parseInt(buyer_id); 57 custom_data['order_id'] = parseInt(response.order_id); 58 // custom_data['eb_nonce'] = response.nonce; 59 60 $("input[name='custom']").val(JSON.stringify(custom_data)); 61 62 /* 63 *--------------------------------------- 64 *Added code to solve payment pending issue 65 * ------------------------------------- 66 */ 67 // submitting form if the submit form is on. 68 // added button click event on class as there are 2 payment forms in the single course page with 2 submit buttons with same id. 69 if (formSubmit) { 70 $('.eb-paid-course').click(); 71 } 72 } else { 73 e.preventDefault(); 74 alert(eb_public_js_object.msg_ordr_pro_err); 75 } 76 }, 77 }); 78 } 79 80 $(window).on('load', function () { 81 function getUrlParameter(sParam) { 82 var sPageURL = decodeURIComponent(window.location.search.substring(1)), 83 sURLVariables = sPageURL.split('&'), 84 sParameterName, 85 i; 86 87 for (i = 0; i < sURLVariables.length; i++) { 88 sParameterName = sURLVariables[i].split('='); 89 90 if (sParameterName[0] === sParam) { 91 return sParameterName[1] === undefined ? true : sParameterName[1]; 92 } 93 } 94 } 95 96 if (getUrlParameter('auto_enroll') === 'true') { 97 if (eb_public_js_object.eb_single_course_override === '1') { 98 $(window).on('eb_course_btn_loaded', function () { 99 $.blockUI({ 100 message: eb_public_js_object.msg_processing, 101 }); 102 103 var btn = document.getElementById('eb_course_payment_button'); 104 if (btn == null) { 105 btn = document.getElementById('wdm-btn'); 106 if (btn.text != eb_public_js_object.access_course) { 107 btn.click(); 108 } else { 109 $.unblockUI(); 110 } 111 } else { 112 /* 113 * --------------------------------- 114 * Commented the btn.click() to solve pending payment issue. 115 * -------------------------------- 116 */ 117 /*btn.click();*/ 118 placeOrder(1); 119 } 120 }); 121 } else { 122 $.blockUI({ 123 message: eb_public_js_object.msg_processing, 124 }); 125 126 var btn = document.getElementById('eb_course_payment_button'); 127 if (btn == null) { 128 btn = document.getElementById('wdm-btn'); 129 if (btn.text != eb_public_js_object.access_course) { 130 btn.click(); 131 } else { 132 $.unblockUI(); 133 } 134 } else { 135 /* 136 * --------------------------------- 137 * Commented the btn.click() to solve pending payment issue. 138 * -------------------------------- 139 */ 140 /*btn.click();*/ 141 placeOrder(1); 142 } 143 } 144 } 145 146 /* Change required fields error messages for login / register page */ 147 var intputElements = document.getElementsByTagName('INPUT'); 148 for (var i = 0; i < intputElements.length; i++) { 149 intputElements[i].oninvalid = function (e) { 150 e.target.setCustomValidity(''); 151 if (!e.target.validity.valid) { 152 if (e.target.name == 'firstname') { 153 e.target.setCustomValidity(eb_public_js_object.msg_val_fn); 154 } else if (e.target.name == 'lastname') { 155 e.target.setCustomValidity(eb_public_js_object.msg_val_ln); 156 } else if (e.target.name == 'email') { 157 e.target.setCustomValidity(eb_public_js_object.msg_val_mail); 158 } 159 } 160 }; 161 } 162 163 /** 164 * datatable js for user order history table 165 */ 166 $('#wdm_user_order_history').dataTable({ 167 aLengthMenu: [ 168 [5, 10, 25, -1], 169 [5, 10, 25, ebDataTable.all], 170 ], 171 iDisplayLength: 10, 172 order: [[1, 'desc']], 173 columnDefs: [ 174 { 175 targets: 'no-sort', 176 orderable: true, 177 }, 178 ], 179 language: { 180 search: ebDataTable.search, 181 sEmptyTable: ebDataTable.sEmptyTable, 182 sLoadingRecords: ebDataTable.sLoadingRecords, 183 sSearch: ebDataTable.sSearch, 184 sZeroRecords: ebDataTable.sZeroRecords, 185 sProcessing: ebDataTable.sProcessing, 186 sInfo: ebDataTable.sInfo, 187 sInfoEmpty: ebDataTable.sInfoEmpty, 188 sInfoFiltered: ebDataTable.sInfoFiltered, 189 sInfoPostFix: ebDataTable.sInfoPostFix, 190 sInfoThousands: ebDataTable.sInfoThousands, 191 sLengthMenu: ebDataTable.sLengthMenu, 192 oPaginate: { 193 sFirst: ebDataTable.sFirst, 194 sLast: ebDataTable.sLast, 195 sNext: ebDataTable.sNext, 196 sPrevious: ebDataTable.sPrevious, 197 }, 198 oAria: { 199 sSortAscending: ebDataTable.sSortAscending, 200 sSortDescending: ebDataTable.sSortDescending, 201 }, 202 }, 203 });
204 205 /** 206 * jquery blockui js to block UI on clicking take course button for paid courses. 207 */ 208 209 /** 210 * called by 'take this course' button for paid courses. 211 * calls create_new_order_ajax_wrapper() function to create a new order 212 * add the newly created order it in form to be sent to paypal. 213 * 214 */ 215 $('body').on('click', '.eb-paid-course', function (e) { 216 if ( 217 getUrlParameter('auto_enroll') === 'true' && 218 eb_public_js_object.eb_single_course_override === '1' 219 ) { 220 return; 221 } 222 223 placeOrder(0); 224 }); 225 }); 226 227 $(document).ready(function () { 228 if ($('#reg_terms_and_cond').length) { 229 $("input[name='register']").prop('disabled', true); 230 $("input[name='register']").css('cursor', 'no-drop'); 231 $('#reg_terms_and_cond').change(function () { 232 if (this.checked) { 233 $("input[name='register']").prop('disabled', false); 234 $("input[name='register']").css('cursor', 'pointer'); 235 } else { 236 $("input[name='register']").prop('disabled', true); 237 $("input[name='register']").css('cursor', 'no-drop'); 238 } 239 }); 240 } 241 242 $('#eb_terms_cond_check').click(function () { 243 var checkbox = $(this).parent().parent(); 244 checkbox = checkbox.find("input[name='reg_terms_and_cond']"); 245 $('#eb-user-account-terms-content').dialog({ 246 modal: true, 247 resizable: true, 248 width: 500, 249 dialogClass: 'eb_admin_terms_dialog', 250 buttons: [ 251 { 252 text: 'Agree', 253 class: 'eb_terms_button_agree', 254 click: function () { 255 checkbox.prop('checked', true); 256 $("input[name='register']").prop('disabled', false); 257 $("input[name='register']").css('cursor', 'pointer'); 258 $(this).dialog('close'); 259 }, 260 }, 261 { 262 text: 'Disagree', 263 class: 'eb_terms_button_disagree', 264 click: function () { 265 checkbox.prop('checked', false); 266 $(this).dialog('close'); 267 }, 268 }, 269 ], 270 }); 271 272 // $('.eb-user-account-terms div').dialog(); 273 }); 274 275 /*Submit filters form on the selction of filter*/ 276 $('#eb_category_filter').on('change', function (event) { 277 var form = $(this).closest('form'); 278 $(form).trigger('submit'); 279 }); 280 281 $('#eb_category_sort').on('change', function (event) { 282 $(this).closest('form').trigger('submit'); 283 }); 284 285 /** 286 * Scroll left 287 */ 288 $('.eb-scroll-left').on('click', function (event) { 289 event.preventDefault(); 290 var parent = $(this).parents('.eb-cat-courses-cont'); 291 var newScrollLeft = parent.scrollLeft(); 292 var width = parent.width(); 293 var scrollWidth = parent.get(0).scrollWidth; 294 var scrollOffcet = width / 2; 295 296 parent.animate( 297 { scrollLeft: parent.scrollLeft() - scrollOffcet }, 298 'fast' 299 ); 300 if (newScrollLeft <= 0 + scrollOffcet) { 301 $(this).hide(); 302 } 303 if (scrollWidth >= newScrollLeft) { 304 parent.children('.eb-scroll-right').show(); 305 } 306 }); 307 308 /** 309 * Scroll right 310 */ 311 $('.eb-scroll-right').on('click', function (event) { 312 event.preventDefault(); 313 var parent = $(this).parents('.eb-cat-courses-cont'); 314 var newScrollLeft = parent.scrollLeft(); 315 var width = parent.width(); 316 var scrollWidth = parent.get(0).scrollWidth; 317 var scrollOffcet = width / 2; 318 $(parent).children('.eb-scroll-left').show(); 319 parent.animate( 320 { scrollLeft: parent.scrollLeft() + scrollOffcet }, 321 'fast' 322 ); 323 if (scrollWidth <= newScrollLeft + width + scrollOffcet) { 324 $(this).hide(); 325 } 326 if (newScrollLeft <= 0) { 327 parent.children('.eb-scroll-left').show(); 328 } 329 }); 330 331 $('.eb-cat-courses-cont').each(function () { 332 var documentScrollLeft = jQuery('.eb-cat-courses-cont').scrollLeft(); 333 var lastScrollLeft = 0; 334 var width = $(this).width(); 335 var scrollWidth = $(this).get(0).scrollWidth; 336 if (scrollWidth <= width) { 337 lastScrollLeft = documentScrollLeft; 338 $(this).children('.eb-scroll-right').hide(); 339 } 340 $(this).children('.eb-scroll-left').hide(); 341 });
342 343 if (typeof eb_user_email_verification != 'undefined') { 344 // Show the message in the dialog box 345 $('<div></div>') 346 .html(eb_user_email_verification.message) 347 .dialog({ 348 modal: false, 349 resizable: false, 350 width: 500, 351 dialogClass: 'eb_admin_terms_dialog eb_email_verify_dialog', 352 buttons: [ 353 { 354 text: 'Ok', 355 class: 'eb_terms_button_agree', 356 click: function () { 357 $(this).dialog('close'); 358 }, 359 }, 360 ], 361 }); 362 } 363 364 // disable woocomerce quantity input field 365 $('.eb-pro-product-page-sidebar .quantity-wrap') 366 .find('input') 367 .prop('disabled', true); 368 $('.eb-pro-product-page-sidebar .quantity-wrap .quantity-minus').prop( 369 'disabled', 370 true 371 ); 372 $('.eb-pro-product-page-sidebar .quantity-wrap .quantity-plus').prop( 373 'disabled', 374 true 375 ); 376 377 $('.eb-pro-product-page-sidebar .grouped-product-quantity') 378 .find('input') 379 .prop('disabled', false); 380 $( 381 '.eb-pro-product-page-sidebar .grouped-product-quantity .quantity-minus' 382 ).prop('disabled', false); 383 $( 384 '.eb-pro-product-page-sidebar .grouped-product-quantity .quantity-plus' 385 ).prop('disabled', false); 386 387 if ($('#wdm_edwiser_self_enroll').length) { 388 var is_checked = $('#wdm_edwiser_self_enroll').is(':checked'); 389 if (is_checked) { 390 $('.eb-pro-product-page-sidebar .quantity-wrap') 391 .find('input') 392 .prop('disabled', false); 393 $('.eb-pro-product-page-sidebar .quantity-wrap .quantity-minus').prop( 394 'disabled', 395 false 396 ); 397 $('.eb-pro-product-page-sidebar .quantity-wrap .quantity-plus').prop( 398 'disabled', 399 false 400 ); 401 } 402 } 403 404 $('#wdm_edwiser_self_enroll').change(function () { 405 if (this.checked) { 406 $('.eb-pro-product-page-sidebar .quantity-wrap') 407 .find('input') 408 .prop('disabled', false); 409 $('.eb-pro-product-page-sidebar .quantity-wrap .quantity-minus').prop( 410 'disabled', 411 false 412 ); 413 $('.eb-pro-product-page-sidebar .quantity-wrap .quantity-plus').prop( 414 'disabled', 415 false 416 ); 417 } else { 418 $('.eb-pro-product-page-sidebar .quantity-wrap') 419 .find('input') 420 .prop('disabled', true); 421 $('.eb-pro-product-page-sidebar .quantity-wrap .quantity-minus').prop( 422 'disabled', 423 true 424 ); 425 $('.eb-pro-product-page-sidebar .quantity-wrap .quantity-plus').prop( 426 'disabled', 427 true 428 ); 429 $('.eb-pro-product-page-sidebar .quantity-wrap').find('input').val(1); 430 } 431 }); 432 }); 433})(jQuery); 434 435function ebSubmitCaptchaForm(token) { 436 document.getElementById('eb-user-account-form').submit(); 437}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.