1$(document).ready(function (e) { 2 $("a[rel^='prettyPhoto']").prettyPhoto({ social_tools: false }); 3 4 if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) { 5 $("a[rel^='pPhoto_bio']").prettyPhoto( 6 { 7 social_tools: false, 8 default_width: 300, 9 default_height: 500, 10 custom_markup: '<div id="custom_markup"></div>', 11 changepicturecallback: function () { 12 $("#custom_markup").html($(thissite.active_element).parent().parent().find(".provider_bio").html()); 13 } 14 }); 15 16 $("a[rel^='pPhoto_video']").prettyPhoto( 17 { 18 social_tools: false, 19 default_width: 320, 20 default_height: 200, 21 custom_markup: '<div id="custom_markup" class="tac"></div>', 22 changepicturecallback: function () { 23 var src = ""; 24 var youtube_id = $(thissite.active_element).attr("ytid"); 25 if (youtube_id) { 26 src = "https://www.youtube.com/embed/" + youtube_id + "?autoplay=1"; 27 } 28 else { 29 src = $(thissite.active_element).attr("vurl"); 30 } 31 32 $("#custom_markup").html("<iframe width='300' height='169' src='" + src + "' frameborder='0' allowfullscreen></iframe>"); 33 } 34 }); 35 36 $("a[rel^='pPhoto_courses']").prettyPhoto( 37 { 38 social_tools: false, 39 default_width: 300, 40 default_height: 500, 41 custom_markup: '<div id="custom_markup"></div>', 42 changepicturecallback: function () { 43 $("#custom_markup").html($(thissite.active_element).parent().parent().find(".provider_courses").html()); 44 } 45 }); 46 47 $("a[rel^='pPhoto_webinar_sales']").prettyPhoto( 48 { 49 social_tools: false, 50 default_width: 300, 51 default_height: 500, 52 custom_markup: '<div id="custom_markup"></div>', 53 changepicturecallback: function () { 54 $("#custom_markup").html($(thissite.active_element).parent().parent().find(".webinar_sales").html()); 55 } 56 }); 57 58 } 59 else { 60 $("a[rel^='pPhoto_bio']").prettyPhoto( 61 { 62 social_tools: false, 63 default_width: 800, 64 default_height: 600, 65 custom_markup: '<div id="custom_markup"></div>', 66 changepicturecallback: function () { 67 $("#custom_markup").html($(thissite.active_element).parent().parent().find(".provider_bio").html()); 68 } 69 }); 70 71 $("a[rel^='pPhoto_video']").prettyPhoto( 72 { 73 social_tools: false, 74 default_width: 600, 75 default_height: 345, 76 custom_markup: '<div id="custom_markup" class="tac"></div>', 77 changepicturecallback: function () { 78 var src = ""; 79 var youtube_id = $(thissite.active_element).attr("ytid"); 80 if (youtube_id) { 81 src = "https://www.youtube.com/embed/" + youtube_id + "?autoplay=1"; 82 } 83 else { 84 src = $(thissite.active_element).attr("vurl"); 85 } 86 87 $("#custom_markup").html("<iframe width='560' height='315' src='" + src + "' frameborder='0' allowfullscreen></iframe>"); 88 } 89 }); 90 91 $("a[rel^='pPhoto_courses']").prettyPhoto( 92 { 93 social_tools: false, 94 default_width: 800, 95 default_height: 600, 96 custom_markup: '<div id="custom_markup"></div>', 97 changepicturecallback: function () { 98 $("#custom_markup").html($(thissite.active_element).parent().parent().find(".provider_courses").html()); 99 } 100 }); 101 102 $("a[rel^='pPhoto_webinar_sales']").prettyPhoto( 103 { 104 social_tools: false, 105 default_width: 500, 106 default_height: 500, 107 custom_markup: '<div id="custom_markup"></div>', 108 changepicturecallback: function () { 109 $("#custom_markup").html($(thissite.active_element).parent().parent().find(".webinar_sales").html()); 110 } 111 }); 112 } 113 114 $(".subitem_title").click(function () { 115 $(this).parent().find(".subitem_text").slideToggle({ duration: 500 }); 116 }); 117 118 var menuVisible = false; 119 $("#responsiveMenu").on("click", function () { 120 if (menuVisible) { $("#mainMenu").slideToggle(); menuVisible = false; } 121 else { $("#mainMenu").slideToggle(); menuVisible = true; } 122 }); 123 var menuItemSelected = null; 124 if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) { 125 $("#mainMenu > li").unbind("mouseover"); 126 $("#mainMenu > li").unbind("mouseout"); 127 128 $("#mainMenu > li").click(function (e) { 129 if (menuItemSelected != $(this).prop("id") && $(this).find("ul").length != 0) { 130 menuItemSelected = $(this).prop("id"); 131 $(this).children("ul").stop(true, false).slideToggle(); 132 return false;
133 } 134 return true; 135 }); 136 } 137 138 //Make sure we save expanded left navigation 139 $(".leftm").click(function () { 140 if ($("#" + $(this).attr("id") + "_content").is(":hidden")) { 141 $(this).find(".arrow_down").addClass("arrow_up").removeClass("arrow_down"); 142 } 143 else { 144 $(this).find(".arrow_up").addClass("arrow_down").removeClass("arrow_up"); 145 } 146 147 $("#" + $(this).attr("id") + "_content").slideToggle(700); 148 149 $.ajax({ 150 type: 'POST', 151 url: "custom/ajax/savenav.php", 152 data: { navtext: $(this).attr("id") }, 153 success: function (data, status) { }, 154 async: true 155 }); 156 }); 157 158 $(".leftm").each(function (index, element) { 159 thissite.checkArrow(this); 160 }); 161 162 $("#usermenu_shopping_cart").click(function () { 163 $("#cart_summary").stop(true, true, false).fadeToggle(); 164 }); 165 166 167 $(".catleft").not(".catleft.active").mouseover(function () { 168 $(this).find(".subcatleft_wrapper").stop(true, true, false).fadeIn(); 169 $(this).find(".hideit").show(); 170 }); 171 172 $(".catleft").not(".catleft.active").mouseout(function () { 173 $(this).find(".subcatleft_wrapper").stop(true, true, false).hide(); 174 $(this).find(".hideit").hide(); 175 }); 176 177 $(".subcatleft_wrapper").not(".subcatleft_wrapper.active").mouseover(function (event) { 178 $(this).parent().find(".catleft_a").addClass("hover"); 179 $(this).stop(true, false).show(); 180 }); 181 $(".subcatleft_wrapper").not(".subcatleft_wrapper.active").mouseout(function (event) { 182 $(this).parent().find(".catleft_a").removeClass("hover"); 183 }); 184 185 186 $(".payment_method").click(function () { 187 188 $(".payment_method").prop("checked", ""); 189 $(this).prop("checked", "checked"); 190 }); 191 192 $("input[name='payment_method']").click(function () { 193 194 if ($("#pay_cc_radio").is(":checked")) { $("#pay_cc_fields").show(); } 195 else { $("#pay_cc_fields").hide(); } 196 197 if ($("#pay_paypal_radio").is(":checked")) { $("#pay_paypal_fields").show(); } 198 else { $("#pay_paypal_fields").hide(); } 199 200 if ($("#pay_check_radio").is(":checked")) { $("#pay_check_explanation").show(); } 201 else { $("#pay_check_explanation").hide(); } 202 }); 203 204 205 $(".choice_radio").click(function () { 206 207 $(this).parent().parent().parent().find(".question_text").removeClass("redQuizQuestion"); 208 209 $.ajax({ 210 type: 'POST', 211 url: "custom/ajax/save_quiz_answer.php", 212 data: { q_q_c: $(this).val() }, 213 success: function (data, status) { if (data == "error") { alert("There was a problem saving your answer, please refresh your page and try again or contact us for assistance. We apologize for the inconvenience."); } }, 214 async: true 215 }); 216 217 thissite.setSubmitQuizButtonState(); 218 }); 219 220 $("#verify_quiz_button").click(function () { 221 222 //$('.question_choices_wrapper:not(:has(:radio:checked))').each(function () { 223 // $(this).parent().find(".question_text").addClass("redQuizQuestion"); 224 //}); 225 226 $('.question_choices_wrapper').each(function () { 227 var has_unanswered = true; 228 $(this).find(".choice_radio").each(function () { 229 if ($(this).is(":checked")) { has_unanswered = false; } 230 }); 231 232 if (has_unanswered) 233 { 234 $(this).parent().find(".question_text").addClass("redQuizQuestion"); 235 } 236 }); 237 238 //Got first unanswered question 239 $('html, body').animate({ scrollTop: $(".question_text.redQuizQuestion:first-child").offset().top }, 500); 240 241 }); 242 243 $("#cc_type").change(function () { 244 245 $("#cc_num1").val(""); 246 $("#cc_num2").val(""); 247 $("#cc_num3").val(""); 248 $("#cc_num4").val(""); 249 250 if ($(this).val() == "American Express") { 251 $("#cc_num2").removeClass("w50"); 252 $("#cc_num2").addClass("w70"); 253 254 $("#cc_num3").removeClass("w50"); 255 $("#cc_num3").addClass("w60"); 256 257 $("#cc_num4").hide(); 258 } 259 else { 260 $("#cc_num2").removeClass("w70"); 261 $("#cc_num2").addClass("w50"); 262 263 $("#cc_num3").removeClass("w60"); 264 $("#cc_num3").addClass("w50"); 265 266 $("#cc_num4").show(); 267 } 268 269 }); 270 271 $("#cc_num1").keyup(function (event) { 272 if ($(this).val().length == 4) { $("#cc_num2").focus(); } 273 }); 274 $("#cc_num2").keyup(function (event) { 275 276 var field_length = 4; 277 if ($("#cc_type").val() == "American Express") { field_length = 6; } 278 279 $(this).prop("maxlength", field_length); 280 281 if ($(this).val().length == field_length) { $("#cc_num3").focus(); } 282 }); 283 $("#cc_num3").keyup(function (event) { 284 285 var field_length = 4; 286 if ($("#cc_type").val() == "American Express") { field_length = 5; } 287 288 $(this).prop("maxlength", field_length); 289 290 if ($(this).val().length == field_length) { $("#cc_num4").focus(); } 291 }); 292 293 $(window).scroll(function () { 294 if ($(window).scrollTop() > 45) { $("#backtotop").fadeIn(800); } 295 else { $("#backtotop").fadeOut(); } 296 }); 297 $("#backtotop").click(function () { 298 $("html, body").animate({ scrollTop: 0 }, 800); 299 }); 300 301 adjustIVSHeight(); 302 303 thissite.restoreDiscountPackageFilters(); 304 $(document).on("click", ".discountPackageColumnHeader a", function () { 305 this.href = thissite.addDiscountPackageFiltersToUrl($(this).attr("href")); 306 }); 307 308 309}); 310 311function adjustIVSHeight() { 312 return; 313 /* 314 var ivs_height = $("body").height() - ($("#header").height() + $("#menu").height() + $("#footer").height()); 315 var ivs_content_height = $("#ivs_content").height(); 316 //alert(ivs_height + " " + ivs_content_height); 317 var target_height = ivs_height; 318 // if (ivs_content_height > ivs_height-115) { target_height = parseInt(ivs_content_height) + 120;} 319 $("#ivs_titles").height(target_height); 320 */ 321} 322 323var thissite = { 324 captchaFilled: false, 325 gRecaptchaSiteKey:"", 326 submitForm: function (form, action, target) { 327 try { 328 form.action = action; 329 form.target = target; 330 form.submit(); 331 } 332 catch (e) { alert("submit form error"); } 333 },
334 enable_submit_quiz_button: false, 335 setSubmitQuizButtonState: function () { 336 337 thissite.enable_submit_quiz_button = true; 338 //Check if all answers were provided and enable the submit button 339 //if ($('.question_choices_wrapper:not(:has(:radio:checked))').length) { 340 // thissite.enable_submit_quiz_button = false; 341 //} 342 343 $('.question_choices_wrapper').each(function () { 344 var has_unanswered = true; 345 $(this).find(".choice_radio").each(function () { 346 if ($(this).is(":checked")) { has_unanswered = false; } 347 }); 348 349 if (has_unanswered) { thissite.enable_submit_quiz_button = false; } 350 }); 351 352 if (thissite.enable_submit_quiz_button) { 353 $("#quiz_submit_button").removeClass('disabled').removeAttr("disabled"); 354 $("#verify_quiz_button").addClass('disabled').attr("disabled", "disabled"); 355 } 356 else { 357 $("#verify_quiz_button").removeClass('disabled').removeAttr("disabled"); 358 } 359 }, 360 checkState: function (country) { 361 try { 362 $("#state_field").hide(); 363 $("#province_field").hide(); 364 $("#canada_province_field").hide(); 365 undefine("state"); 366 undefine("province"); 367 undefine("canada_province"); 368 369 if (country == "Canada") { 370 $("#canada_province_field").show(); 371 define("canada_province", "string", "Province"); 372 } 373 else if (country == "United States") { 374 $("#state_field").show(); 375 define("state", "string", "State"); 376 } 377 else { 378 $("#province_field").show(); 379 define("province", "string", "State or Province"); 380 } 381 } 382 catch (e) { } 383 }, 384 checkFlorida: function (state_field) { 385 try { 386 if (typeof state_field == "undefined") { 387 $(".state_licensed").each(function () { 388 if ($(this).val() != "Florida") { 389 $(this).parent().find(".florida_license_num").hide(); 390 } 391 else { 392 $(this).parent().find(".florida_license_num").show().attr("placeholder", "Required for FBPE Reporting"); 393 } 394 }); 395 } 396 else { 397 if ($(state_field).val() == "Florida") { 398 $(state_field).parent().find(".florida_license_num").show(); 399 $(state_field).parent().find(".florida_license_num").prop("placeholder", "Required for FBPE Reporting"); 400 } 401 else { 402 $(state_field).parent().find(".florida_license_num").hide(); 403 } 404 } 405 } 406 catch (e) { } 407 }, 408 /* 409 checkState: function (country) { 410 try { 411 if (country != "United States") { 412 $("#state_field").hide(); 413 $("#province_field").show(); 414 if (country == "Canada") { 415 $("#province_field div.label").html("Province:"); 416 } 417 else { 418 $("#province_field div.label").html("State or Province:"); 419 } 420 undefine("state"); 421 define("province", "string", "Province"); 422 } 423 else { 424 $("#state_field").show(); 425 $("#province_field").hide(); 426 define("state", "string", "State"); 427 undefine("province"); 428 } 429 } 430 catch (e) { } 431 },*/ 432 clearDefaultText: function (element, text) { 433 try { 434 $(element).focus(function () { if ($(this).val() == text) { $(this).val(""); } }); 435 $(element).blur(function () { if ($(this).val() == "") { $(this).val(text); } }); 436 } 437 catch (e) { } 438 }, 439 checkRegUser: function () { 440 try { 441 undefine("biography"); 442 undefine("country_licensed"); 443 undefine("state_licensed"); 444 undefine("province_licensed"); 445 $("#provider_info").hide();//it is actually student info 446 if ($("#type_student").is(":checked")) { 447 $("#studentProviderInfo").show(); 448 $("#licensureProviderInfo").text("Licensure Information"); 449 $("#backgroundFields").hide(); 450 $("#licensureFields").show(); 451 $("#provider_info").show(); 452 thissite.checkLicensed(); 453 } 454 if ($("#type_provider").is(":checked")) { 455 $("#studentProviderInfo").show();
456 $("#licensureProviderInfo").text("Background Information"); 457 $("#licensureFields").hide(); 458 $("#backgroundFields").show(); 459 define("biography", "string", "Biography"); 460 461 } 462 463 if ($("#type_corporate").is(":checked")) { 464 $("#studentProviderInfo").hide(); 465 $("#licensureFields").hide(); 466 $("#backgroundFields").hide(); 467 undefine("area_of_profession"); 468 } 469 } 470 catch (e) { } 471 }, 472 checkLicensed: function (edit_profile) { 473 try { 474 undefine("password"); 475 undefine("country_licensed"); 476 undefine("state_licensed"); 477 undefine("province_licensed"); 478 479 if ($("#not_licensed").is(":checked")) { 480 $("#state_licensed_field").hide(); 481 $("#province_licensed_field").hide(); 482 $("#country_licensed_field").hide(); 483 } 484 else { 485 $("#state_licensed_field").show(); 486 $("#country_licensed_field").show(); 487 if (!edit_profile && $("#type_corporate").not(":checked")) { 488 define("country_licensed", "string", "Licensure Country"); 489 define("state_licensed", "string", "Licensure State/Province"); 490 } 491 } 492 //only if new reg 493 if (!edit_profile) { define("password", "string", "Password"); } 494 495 if ($("#type_provider").is(":checked") || $("#type_corporate").is(":checked")) { 496 undefine("country_licensed"); 497 undefine("state_licensed"); 498 undefine("province_licensed"); 499 } 500 } 501 catch (e) { } 502 }, 503 checkLicensedState: function (licensed_country) { 504 try { 505 undefine("state_licensed"); 506 undefine("province_licensed"); 507 508 if (licensed_country != "United States/Canada") { 509 $("#state_licensed_field").hide(); 510 $("#province_licensed_field").show(); 511 //define("province_licensed", "string", "Licensure State/Province"); 512 } 513 else { 514 $("#state_licensed_field").show(); 515 $("#province_licensed_field").hide(); 516 //define("state_licensed", "string", "Licensure State/Province"); 517 } 518 519 if ($("#type_provider").is(":checked") || $("#type_corporate").is(":checked")) { 520 undefine("country_licensed"); 521 undefine("state_licensed"); 522 undefine("province_licensed"); 523 } 524 } 525 catch (e) { } 526 }, 527 filterByCategoryAndPdh: function () { 528 try { 529 $(".category_row").hide(); 530 var category_id = $("#filter_category").val(); 531 var pdh = $("#filter_pdh").val(); 532 if (category_id != "" && pdh != "") { 533 $(".category" + category_id + ".pdh" + pdh).show(); 534 $(".category" + category_id + ".pdh" + pdh).css("background", "#fff"); 535 } 536 else if (category_id != "") { 537 $(".category" + category_id).show(); 538 $(".category" + category_id).css("background", "#fff"); 539 } 540 else { 541 $(".pdh" + pdh).show(); 542 $(".pdh" + pdh).css("background", "#fff"); 543 } 544 if (category_id == "" && pdh == "") { $(".category_row").show(); } 545 546 var counter = 0; 547 $(".row").each(function () { 548 if ($(this).is(":visible")) { counter++; } 549 if (counter % 2 != 0) { $(this).removeClass("whiteBg"); $(this).addClass("blueBg"); } 550 }); 551 } 552 catch (e) { } 553 }, 554 getUrlParameter: function (url, parameter_name) { 555 try { 556 var query = url.split("?")[1] || ""; 557 query = query.split("#")[0]; 558 var parameters = query.split("&"); 559 for (var i = 0; i < parameters.length; i++) { 560 var parameter = parameters[i].split("="); 561 if (decodeURIComponent(parameter[0]) == parameter_name) { 562 return decodeURIComponent((parameter[1] || "").replace(/\+/g, " ")); 563 } 564 } 565 } 566 catch (e) { } 567 return ""; 568 }, 569 addDiscountPackageFiltersToUrl: function (url) { 570 try { 571 var filter_ids = ["filter_profession", "filter_states", "filter_category", "filter_course_type"]; 572 var hash = ""; 573 var hash_parts = url.split("#"); 574 if (hash_parts.length > 1) { 575 url = hash_parts[0]; 576 hash = "#" + hash_parts.slice(1).join("#"); 577 } 578 579 var url_parts = url.split("?"); 580 var base_url = url_parts[0]; 581 var parameters = (url_parts[1]) ? url_parts[1].split("&") : []; 582 var filtered_parameters = []; 583 for (var i = 0; i < parameters.length; i++) { 584 var parameter_name = decodeURIComponent(parameters[i].split("=")[0]); 585 if ($.inArray(parameter_name, filter_ids) == -1) { 586 filtered_parameters.push(parameters[i]); 587 } 588 } 589 590 for (var j = 0; j < filter_ids.length; j++) { 591 var filter = $("#" + filter_ids[j]); 592 if (filter.length && filter.val() != "") { 593 filtered_parameters.push(encodeURIComponent(filter_ids[j]) + "=" + encodeURIComponent(filter.val())); 594 } 595 } 596 597 return base_url + ((filtered_parameters.length) ? "?" + filtered_parameters.join("&") : "") + hash; 598 } 599 catch (e) { } 600 return url; 601 }, 602 restoreDiscountPackageFilters: function () { 603 try { 604 var filter_ids = ["filter_profession", "filter_states", "filter_category", "filter_course_type"]; 605 var has_filter = false;
606 for (var i = 0; i < filter_ids.length; i++) { 607 var filter_value = thissite.getUrlParameter(window.location.href, filter_ids[i]); 608 if (filter_value != "" && $("#" + filter_ids[i]).length) { 609 $("#" + filter_ids[i]).val(filter_value); 610 has_filter = true; 611 } 612 } 613 if (has_filter) { 614 thissite.filterDiscountPackages(null); 615 } 616 } 617 catch (e) { } 618 }, 619 filterDiscountPackages: function (filter) { 620 try { 621 var filter_id = (filter) ? $(filter).prop("id") : ""; 622 if (filter_id == "filter_states") { 623 $("#filter_category").val(""); 624 } 625 else if (filter_id == "filter_category") { 626 $("#filter_states").val(""); 627 } 628 629 $(".category_row").hide().removeClass("blueBg whiteBg").css("background", ""); 630 $(".discount_package_group_heading").hide(); 631 $(".discountPackageColumnHeader").hide(); 632 $(".discountPackageNoResults").hide(); 633 634 var category_id = ""; 635 if ($("#filter_states").length && $("#filter_states").val() != "") { 636 category_id = $("#filter_states").val(); 637 } 638 else if ($("#filter_category").length && $("#filter_category").val() != "") { 639 category_id = $("#filter_category").val(); 640 } 641 642 var profession = ($("#filter_profession").length) ? $("#filter_profession").val() : ""; 643 var course_type = ($("#filter_course_type").length) ? $("#filter_course_type").val() : ""; 644 var row_selector = ".category_row"; 645 646 if (category_id != "") { 647 row_selector += ".category" + category_id; 648 } 649 if (profession != "") { 650 row_selector += ".profession_" + profession; 651 } 652 if (course_type != "") { 653 row_selector += ".package_group_" + course_type; 654 } 655 656 $(row_selector).show(); 657 658 $(".discount_package_group_heading").each(function () { 659 var group = $(this).attr("data-group"); 660 var heading_profession = $(this).attr("data-profession"); 661 var visible_row_selector = ".category_row.package_group_" + group; 662 if (heading_profession) { 663 visible_row_selector += ".profession_" + heading_profession; 664 } 665 if ($(visible_row_selector + ":visible").length) { 666 $(this).show(); 667 $(this).next(".discountPackageColumnHeader").show(); 668 } 669 }); 670 671 var counter = 0; 672 $(".category_row:visible").each(function () { 673 counter++; 674 if (counter % 2 != 0) { $(this).addClass("blueBg"); } 675 }); 676 677 if (!$(".category_row:visible").length) { 678 $(".discountPackageNoResults").show(); 679 } 680 } 681 catch (e) { } 682 }, 683 filterGeneralDiscountPackages: function (filter) { 684 try { 685 var filter_scope = $(filter).closest(".discountPackagesGeneralScope"); 686 if (!filter_scope.length) { 687 filter_scope = $(document); 688 } 689 var profession = $(filter).val(); 690 var group_display = filter_scope.closest(".discountPackagesSplitLayout, .discountPackagesSingleLayout").length ? "grid" : "block"; 691 692 filter_scope.find(".discountPackagesProfessionGroup").hide(); 693 filter_scope.find(".discountPackagesProfessionHeader").show(); 694 filter_scope.find(".discountPackagesGeneralPrompt").hide(); 695 filter_scope.find(".discountPackagesNoGeneralPackages").hide(); 696 697 if (profession == "") { 698 filter_scope.find(".discountPackagesProfessionGroup").css("display", group_display); 699 if (!filter_scope.find(".discountPackagesProfessionGroup .discountPackageSubitemWrapper, .discountPackagesProfessionGroup li").length) { 700 filter_scope.find(".discountPackagesNoGeneralPackages").show(); 701 } 702 return; 703 } 704 705 var group = filter_scope.find(".general_profession_" + profession); 706 group.css("display", group_display); 707 group.find(".discountPackagesProfessionHeader").hide(); 708 709 if (!group.find(".discountPackageSubitemWrapper, li").length) { 710 filter_scope.find(".discountPackagesNoGeneralPackages").show(); 711 } 712 } 713 catch (e) { } 714 }, 715 filterByCategoryAndSubcategory: function () { 716 try { 717 $(".category_row").hide(); 718 var category_id = $("#filter_category").val(); 719 var subcategory_id = $("#filter_subcategory").val(); 720 $.post("custom/ajax/update_subcategory_filter.php", { category: category_id }, function (data, status) { 721 var parentElement = $("#filter_subcategory").parent(); 722 $("#filter_subcategory").remove(); 723 parentElement.append(data); 724 if ($("select#filter_subcategory option[value=" + subcategory_id + "]").length != 0) { 725 $("select#filter_subcategory option[value=" + subcategory_id + "]").attr("selected", "selected"); 726 } 727 else { 728 subcategory_id = ""; 729 } 730 if (category_id != "" && subcategory_id != "") { 731 $(".category" + category_id + ".subcategory" + subcategory_id).show(); 732 $(".category" + category_id + ".subcategory" + subcategory_id).css("background", "#fff"); 733 } 734 else if (category_id != "") { 735 $(".category" + category_id).show(); 736 $(".category" + category_id).css("background", "#fff"); 737 } 738 else if (subcategory_id != "") { 739 $(".subcategory" + subcategory_id).show(); 740 $(".subcategory" + subcategory_id).addClass("whiteBg"); 741 } 742 else { 743 $(".category_row").show(); 744 } 745 746 var counter = 0; 747 $(".row").each(function () { 748 if ($(this).is(":visible")) { counter++; } 749 if (counter % 2 != 0) { $(this).removeClass("whiteBg"); $(this).addClass("blueBg"); } 750 }); 751 752 }); 753 } 754 catch (e) { } 755 }, 756 filterByNewslettersByYear: function () { 757 try { 758 $(".newsletter").hide(); 759 var year = $("#year_filter").val(); 760 $(".newsletterCol").removeClass("db"); 761 if (year != "" && year != "all") { 762 $(".newsletterCol:last-child").addClass("db"); 763 $(".year" + year).show(); 764 } 765 else if (year == "all") { 766 $(".newsletter").show(); 767 } 768 } 769 catch (e) { } 770 }, 771 active_element: null, 772 checkArrow: function (element) { 773 if ($("#" + $(element).attr("id") + "_content").is(":visible")) { 774 $(element).find(".arrow_down").addClass("arrow_up").removeClass("arrow_down"); 775 } 776 else { 777 $(element).find(".arrow_up").addClass("arrow_down").removeClass("arrow_up"); 778 } 779 }, 780 updateCartUserMenu: function () { 781 try { 782 $.post("custom/ajax/updatecart_usermenu.php", {}, function (data, status) { 783 $("#usermenu_shopping_cart").html(data); 784 $("#usermenu_shopping_cart2").html(data); 785 }); 786 } 787 catch (e) { alert("updateCartUserMenu error"); } 788 }, 789 addToCart: function (id, type, title, price, no, pdh, webinar_presentation_id, is_timed) { 790 try { 791 792 //When having webinar discount packages 793 var presentations = []; 794 $(".dp_webinar_p_title_dd").each(function () { 795 if ($(this).val()) { 796 presentations.push($(this).val()); 797 } 798 }); 799 800 801 $.post("custom/ajax/addtocart.php", { id: id, type: type, title: title, price: price, no: no, pdh: pdh, webinar_presentation_id: webinar_presentation_id, is_timed: is_timed, presentations: presentations }, function (data, status) { 802 thissite.updateCartUserMenu(); 803 thissite.showMessages(); 804 }); 805 } 806 catch (e) { alert("addToCart error"); } 807 }, 808 removeFromCart: function (index, reloadPage, hideMessage) { 809 try { 810 $.post("custom/ajax/removefromcart.php", { index: index, hideMessage: hideMessage }, function (data, status) { 811 thissite.updateCartUserMenu(); 812 if (!hideMessage) { thissite.showMessages(); } 813 814 if (reloadPage) { window.location.reload(); } 815 }); 816 } 817 catch (e) { alert("removeFromCart error"); } 818 }, 819 emptyCart: function (reloadPage) { 820 try { 821 $.post("custom/ajax/emptycart.php", {}, function (data, status) { 822 thissite.updateCartUserMenu(); 823 thissite.showMessages(); 824 if (reloadPage) { window.location.reload(); } 825 }); 826 } 827 catch (e) { alert("emptyCart error"); } 828 }, 829 applyPromoCode: function (code, reloadPage) { 830 try { 831 $.post("custom/ajax/applypromocode.php", { code: code }, function (data, status) { 832 thissite.updateCartUserMenu(); 833 thissite.showMessages(); 834 835 if (reloadPage) { window.location.reload(); } 836 }); 837 } 838 catch (e) { alert("applyPromoCode error"); } 839 }, 840 showMessages_old: function () { 841 $.get("custom/system/getmessage.php?echo=1", function (data, status) { 842 $("#messageBar2").html(data); 843 $("#messageBar2").show(); 844 setTimeout(function () { $("#messageBar2").fadeOut(500); }, 20000); 845 }); 846 }, 847 showMessages: function (message, no_timeout) { 848 var show_message; 849 if (message) { 850 show_message = message; 851 } 852 else { 853 $.ajax({ 854 url: 'custom/system/getmessage.php?echo=1', 855 type: 'POST', 856 data: {}, 857 async: false, 858 success: function (data) { show_message = data; }, 859 }); 860 } 861 862 if (!show_message) { return; } 863 $("#messageBar2").show(); 864 $("#messageBar2").html(show_message); 865 if (!no_timeout) { setTimeout(function () { $("#messageBar2").fadeOut(500); }, 20000); } 866 867 }, 868 azlistingdd: function (option) { 869 window.location = option; 870 }, 871 fixstaterequirements: function () { 872 var $content = $('#content'); 873 var $allH3s = $content.find('h3'); 874 875 // Build sections from h3 tags, skipping empty/spacer ones 876 var sections = []; 877 $allH3s.each(function () { 878 var $h3 = $(this); 879 var title = $h3.text().replace(/\u00a0/g, '').trim(); 880 if (!title) { $h3.hide(); return; } 881 var elements = []; 882 var $next = $h3.next(); 883 while ($next.length && $next[0].tagName !== 'H3') { 884 elements.push($next[0]); 885 $next = $next.next(); 886 } 887 sections.push({ title: title, h3: $h3, elements: elements }); 888 }); 889 890 // Only one profession (or none) — show everything as-is, no dropdown needed 891 if (sections.length <= 1) { return; } 892 893 // Find and detach any "Back to State Requirements" links from all sections 894 var $backLinks = $(); 895 $.each(sections, function (i, s) { 896 $.each(s.elements, function (j, el) { 897 var $el = $(el); 898 if ($el.find('a[href*="state-requirements"]').length || $el.is('a[href*="state-requirements"]')) { 899 $backLinks = $backLinks.add($el); 900 } 901 }); 902 }); 903 // Remove back links from their sections so they don't get hidden/shown 904 $backLinks.each(function () { 905 $.each(sections, function (i, s) { 906 var idx = s.elements.indexOf(this); 907 if (idx !== -1) { s.elements.splice(idx, 1); } 908 }.bind(this)); 909 }); 910 911 // Style each h3 as a clickable accordion card and wire up click behaviour 912 $.each(sections, function (i, s) { 913 s.h3.addClass('acc-header') 914 915 // Add a simple open/close indicator 916 s.h3.append('<span class="acc-arrow">▼</span>'); 917 918 // <= 2 professions: all open; > 2 professions: all closed 919 if (sections.length <= 2) { 920 $.each(s.elements, function (j, el) { $(el).show(); }); 921 s.h3.data('open', true); 922 } else { 923 $.each(s.elements, function (j, el) { $(el).hide(); }); 924 s.h3.find('.acc-arrow').html('▶'); 925 s.h3.data('open', false); 926 } 927 928 s.h3.on('click', function () { 929 var isOpen = $(this).data('open');
930 // Toggle only this section 931 if (isOpen) { 932 $.each(s.elements, function (k, el) { $(el).hide(); }); 933 $(this).data('open', false); 934 $(this).find('.acc-arrow').html('▶'); 935 } else { 936 $.each(s.elements, function (k, el) { $(el).show(); }); 937 $(this).data('open', true); 938 $(this).find('.acc-arrow').html('▼'); 939 } 940 }); 941 }); 942 943 // Re-append all back links at the very bottom, always visible 944 $backLinks.each(function () { $content.append($(this).show()); }); 945 }, 946 verifyWebinarFeedback: function () { 947 var error = false; 948 if ($("input[name='learning_objectives']:checked").length <= 0) { error = true; } 949 if ($("input[name='satisfaction']:checked").length <= 0) { error = true; } 950 if ($("input[name='delivery']:checked").length <= 0) { error = true; } 951 if ($("input[name='recommend']:checked").length <= 0) { error = true; } 952 if ($("input[name='share']:checked").length <= 0) { error = true; } 953 954 if (error) { alert("Please complete all questions."); return false; } 955 return true; 956 }, 957 verifyFeedback: function () { 958 var error = false; 959 if ($("input[name='objectives_met']:checked").length <= 0) { error = true; } 960 if ($("input[name='rating']:checked").length <= 0) { error = true; } 961 if ($("input[name='recommend']:checked").length <= 0) { error = true; } 962 if ($("input[name='share']:checked").length <= 0) { error = true; } 963 964 if (error) { alert("Please complete all questions."); return false; } 965 return true; 966 }, 967 resetQuarters: function () { 968 $("#quarter").val(''); 969 }, 970 resetProvAccDates: function () { 971 $("#from").val(''); 972 $("#to").val(''); 973 }, 974 filterSubcategories: function (cat_id) { 975 try { 976 $("#course_subcategory option").show(); 977 978 if (cat_id) { $("#course_subcategory option[cat-id!='" + cat_id + "']").hide(); } 979 } 980 catch (e) { alert("filterSubcategories error"); } 981 }, 982 collectWebinarPlanData: function (detailsPanel) { 983 try { 984 $(detailsPanel).show(); 985 } 986 catch (e) { alert("collectWebinarPlanData error"); } 987 }, 988 calculateWebinarPlanPrice: function (pdh_count, attendees_count, price_element, current_price_element, current_pdh_count_element, current_plan_add_to_cart_btn) { 989 try { 990 $(current_plan_add_to_cart_btn).removeClass("disabled");//reset if previously set 991 $(current_plan_add_to_cart_btn).addClass("disabled");//add, we will only enable when all is ok 992 $(current_plan_add_to_cart_btn).attr("disabled", "disabled"); 993 994 if (!isInt(attendees_count) || !isInt(pdh_count) || attendees_count <= 0 || pdh_count <= 0) { 995 alert("Please check your input."); 996 $(price_element).html("n/a"); 997 return; 998 } 999 1000 $.post("custom/ajax/calculate_webinar_plan.php", { pdh_count: pdh_count, attendees_count: attendees_count }, function (data, status) { 1001 1002 if (parseInt(data) == -1) { 1003 alert("Please check your input."); 1004 $(price_element).html("n/a"); 1005 return; 1006 } 1007 else if (parseInt(data) == -2) { 1008 alert("System error, please contact CEDEngineering.com"); 1009 $(price_element).html("n/a"); 1010 return; 1011 } 1012 1013 var price = parseFloat(data); 1014 $(price_element).html("$" + price.toFixed(2)); 1015 $(current_price_element).val(price); 1016 $(current_pdh_count_element).val(pdh_count * attendees_count); 1017 $(current_plan_add_to_cart_btn).removeClass("disabled");//all seems fine, we can add to cart now 1018 $(current_plan_add_to_cart_btn).removeAttr("disabled"); 1019 1020 //thissite.showMessages(); 1021 }); 1022 1023 } 1024 catch (e) { alert("calculateWebinarPlanPrice error"); } 1025 }, 1026 state_licensed_count: 1, 1027 addStateLicensed: function () { 1028 try { 1029 thissite.loader(true); 1030 var parent = $("#state_licensed_rows .state_licensed_row:first-child"); 1031 var clone = parent.clone(); 1032 clone.prop("id", ""); 1033 clone.find(".state_licensed_remove_item").removeClass("hidden"); 1034 clone.find(".add_item").val("1"); 1035 var date_field_html = clone.find(".cms_datefield_wrapper")[0].outerHTML; 1036 date_field_html = date_field_html.replace(/license_expiration_dates_wrapper_0/g, "license_expiration_dates_wrapper_" + thissite.state_licensed_count); 1037 date_field_html = date_field_html.replace(/license_expiration_dates_0/g, "license_expiration_dates_" + thissite.state_licensed_count); 1038 clone.find(".cms_datefield_wrapper").html(date_field_html); 1039 clone.find(".florida_license_num").prop("placeholder", ""); 1040 clone.find(".florida_license_num").hide(); 1041 1042 thissite.state_licensed_count++; 1043 1044 $("#state_licensed_rows").append(clone); 1045 thissite.loader(false); 1046 } 1047 catch (e) { thissite.loader(false); alert(e.message); alert("addStateLicensed error"); } 1048 }, 1049 removeStateLicensed: function (row) { 1050 try { 1051 //Cannot remove the clone host 1052 if ($(row).prop("id") == 'state_licensed_row_host') { return; } 1053 thissite.loader(true); 1054 $(row).remove(); 1055 $(row).find(".remove_item").val("1"); 1056 thissite.loader(false); 1057 } 1058 catch (e) { thissite.loader(false); alert("removeStateLicensed error"); } 1059 }, 1060 loader: function (onoff) { 1061 1062 }, 1063 iv_slides: [], 1064 jQueryPlayer: null, 1065 yt_player: null, 1066 yt_video_id:"", 1067 change_iv_slide: function (pli, oid, slide_id, is_timed) { 1068 try { 1069 $.ajax({ 1070 type: 'POST',
1071 url: "custom/pages/interactive-video/change-slide.php", 1072 data: { pli: pli, oid: oid, slide_id: slide_id, is_timed: is_timed }, 1073 success: function (data, status) { 1074 if (data.error) { 1075 alert(data.error); 1076 } 1077 else { 1078 slide_complete = data.slide_complete; 1079 slide_last_complete = data.slide_last_complete; 1080 slide_video_watched = data.video_watched; 1081 1082 //Save 'current' youtube video id to be played. 1083 if (data.yt_video_id.length > 0) { 1084 thissite.yt_video_id = data.yt_video_id; 1085 $("#ivs_content").html(data.content); 1086 $("#yt_player").parent().show(); 1087 $("#yt_player").show(); 1088 load_yt_iframe_api(); 1089 if (thissite.yt_player) 1090 { 1091 thissite.yt_player.pauseVideo(); 1092 thissite.yt_player.seekTo(0); 1093 thissite.yt_player.cueVideoById(thissite.yt_video_id); 1094 } 1095 } 1096 else { 1097 $("#yt_player").parent().hide(); 1098 $("#yt_player").hide(); 1099 $("#ivs_content").html(data.content); 1100 } 1101 $(".ivs_slide_title").removeClass("active"); 1102 $(".ivs_slide_title[slide_id='" + slide_id + "']").addClass("active"); 1103 $(".ivs_slide_title[slide_id='" + slide_id + "']").unbind("click"); 1104 $(".ivs_slide_title[slide_id='" + slide_id + "']").on("click", function () { thissite.change_iv_slide(pli, oid, slide_id, is_timed) }); 1105 1106 $("#ivs_ooa").html(data.order_of_appearance); 1107 $("#ivs_cst").html(data.slide_title); 1108 adjustIVSHeight(); 1109 1110 current_slide_id = slide_id; 1111 if (data.current_time_seconds && data.audio_source) { 1112 last_save_time = current_time = data.current_time_seconds; 1113 1114 if (thissite.jQueryPlayer) { thissite.jQueryPlayer.jPlayer("destroy"); } 1115 1116 //var audio = document.getElementById("audio_object"); 1117 //audio.pause(); 1118 //audio.src = "userfiles/" + data.audio_source; 1119 //If we changed to a slide that has finished we probably want to relisten the content 1120 //and this is why we will reset the time to zero 1121 if (data.current_time_seconds == data.max_time_seconds) { 1122 data.current_time_seconds = 0; 1123 current_time = 0; 1124 last_save_time = 0; 1125 } 1126 1127 playhead_percent = Math.round(data.current_time_seconds / data.duration_time * 100); 1128 init_audio_player("userfiles/" + data.audio_source); 1129 1130 //audio.currentTime = data.current_time_seconds; 1131 //audio.play(); 1132 } 1133 1134 if (data.max_time_seconds) { 1135 max_time = data.max_time_seconds; 1136 if (typeof gmxt != "undefined" && gmxt > 0) { max_time = gmxt; } 1137 } 1138 } 1139 }, 1140 dataType: "json", 1141 async: false 1142 }); 1143 } 1144 catch (e) { thissite.loader(false); alert(e.message + " change_iv_slide error"); } 1145 }, 1146 1147 current_pli: 0, 1148 current_oid: 0, 1149 current_slide_id: 0, 1150 current_current_time: 0, 1151 current_is_timed: 0, 1152 current_has_quiz: false, 1153 current_quiz_taken:0, 1154 save_iv_slide_progress: function (pli, oid, slide_id, current_time, is_timed) { 1155 //save references to be accessed by other methods 1156 thissite.current_pli = pli; 1157 thissite.current_oid = oid; 1158 thissite.current_slide_id = slide_id; 1159 thissite.current_current_time = current_time; 1160 thissite.current_is_timed = is_timed; 1161 1162 try { 1163 $.ajax({ 1164 type: 'POST',
1165 url: "custom/pages/interactive-video/save-slide-progress.php", 1166 data: { pli: pli, oid: oid, slide_id: slide_id, current_time: current_time, is_timed: is_timed }, 1167 success: function (data, status) { 1168 //If we completed this slide, when we reload the page we will get to next available slide. 1169 console.log(data); 1170 if (data.slide_complete) { 1171 slide_complete = data.slide_complete; 1172 slide_last_complete = data.slide_last_complete; 1173 slide_video_watched = data.video_watched; 1174 $(".ivs_slide_title[slide_id='" + slide_id + "']").removeClass("ivs_slide_unavailable"); 1175 1176 //var audio = document.getElementById("audio_object"); 1177 //if (audio.ended) 1178 if (audio_ended) { 1179 1180 //save references to be accessed by other methods 1181 thissite.current_has_quiz = data.has_quiz; 1182 thissite.current_quiz_taken = data.quiz_taken; 1183 //alert(thissite.yt_video_id + " " + video_ended + " " + slide_video_watched); 1184 //slide_video_watched = na would mean that video is non applicable, ie. there's no video on this slide 1185 if (thissite.yt_video_id != "" && !video_ended && slide_video_watched != "1" && slide_video_watched != "na") { 1186 if (thissite.jQueryPlayer) { thissite.jQueryPlayer.jPlayer("destroy"); } 1187 alert("Please watch the video before you continue."); 1188 return; 1189 } 1190 1191 if (thissite.jQueryPlayer) { thissite.jQueryPlayer.jPlayer("destroy"); } 1192 1193 if (data.has_quiz == "1" && (data.quiz_taken == "" || data.quiz_taken == "0")) { 1194 //audio.pause(); 1195 if (thissite.jQueryPlayer) { thissite.jQueryPlayer.jPlayer("pause"); } 1196 $("#popup").modal({ backdrop: "static" }); 1197 $.post("custom/pages/interactive-video/popup_quiz.php", { pli: pli, oid: oid, slide_id: slide_id, is_timed: is_timed }, function (data, status) { 1198 $("#popupcontent").html(data); 1199 }); 1200 } 1201 else { 1202 thissite.iv_reload_page(pli, oid, slide_id, is_timed); 1203 } 1204 } 1205 } 1206 if (data.max_time_seconds) { 1207 max_time = data.max_time_seconds; 1208 if (gmxt > 0) { max_time = gmxt; } 1209 } 1210 1211 //Update timer 1212 var elapsed_time = new Date(data.elapsed_seconds * 1000).toISOString().substr(11, 8); 1213 1214 $(".elapsed-time").html(elapsed_time); 1215 }, 1216 async: true, 1217 dataType: "json" 1218 }); 1219 } 1220 catch (e) { thissite.loader(false); alert("save_iv_slide_progress error"); } 1221 }, 1222 iv_reload_page: function (pli, oid, current_slide_id, is_timed) { 1223 1224 if (thissite.iv_slides.length == 0) { 1225 alert("Unexcepted error: please contact website administrator."); 1226 return; 1227 } 1228 1229 //get the next slide 1230 var current_index = thissite.iv_slides.indexOf(current_slide_id); 1231 var next_slide_id = null; 1232 if (current_index >= 0 && current_index < thissite.iv_slides.length - 1) { next_slide_id = thissite.iv_slides[current_index + 1]; } 1233 1234 if (next_slide_id === null) { 1235 1236 if ($(".ivs_slide_unavailable").length > 0) { 1237 alert("Check the Table of Contents, and make sure to view and complete all the grey-highlighted slides. Once you have done so, please go back to the last slide so you can proceed to your account and take the quiz."); 1238 return; 1239 } 1240 else { 1241 alert("You have completed the course. Click 'OK' to proceed to your account and take the quiz."); 1242 window.location.href = "account"; 1243 return; 1244 } 1245 } 1246 1247 thissite.change_iv_slide(pli, oid, next_slide_id, is_timed); 1248 }, 1249 iv_submit_popup_quiz: function (slide_progress_row_id, pli, oid, slide_id) { 1250 try { 1251 //Check if a question was selected 1252 if ($("input[type='radio'][name='popupquiz_radio']:checked").length == 0) { 1253 alert("Please select an answer."); 1254 return; 1255 } 1256 1257 var correct = $("input[type='radio'][name='popupquiz_radio']:checked").attr("super_secret_property"); 1258 1259 if (correct == "1") { 1260 $(".iv_popup_quiz_thank_you_msg").show(); 1261 $("input[type='radio'][name='popupquiz_radio']:checked").parent().find(".iv_popup_quiz_s").removeClass("hidden"); 1262 } 1263 else { 1264 $(".iv_popup_quiz_correct_explain").show(); 1265 $("input[type='radio'][name='popupquiz_radio']:checked").parent().find(".iv_popup_quiz_answer_nc").removeClass("hidden"); 1266 $(".iv_popup_quiz_answer_c").removeClass("hidden"); 1267 } 1268 1269 $(".ivs_slide_title[slide_id='" + slide_id + "']").addClass("quiz_taken"); 1270 1271 $(".iv_popup_quiz_btn_wrapper input").remove(); 1272 } 1273 catch (e) { thissite.loader(false); alert("iv_submit_popup_quiz error"); } 1274 }, 1275 iv_submit_popup_quiz_step2: function (slide_progress_row_id, pli, oid, slide_id, is_timed) { 1276 1277 $.post("custom/pages/interactive-video/popup_quiz_mark.php", { slide_progress_row_id: slide_progress_row_id, is_timed: is_timed }, function (data, status) { 1278 if (data == "ok") { thissite.iv_reload_page(pli, oid, slide_id, is_timed); } 1279 else { alert("Unexpected error: There was a problem submitting your quiz answer. Please contact the website administrator."); } 1280 }); 1281 }, 1282 1283 //Save Ohio Course progress 1284 oc_interval: null, 1285 save_oc_progress: function (pli, oid, cid, current_time_seconds, force_complete) { 1286 1287 try { 1288 $.ajax({ 1289 type: 'POST',
1290 url: "custom/pages/ohio_course/save-course-progress.php", 1291 data: { pli: pli, oid: oid, cid: cid, current_time_seconds: current_time_seconds, force_complete: force_complete }, 1292 success: function (data, status) { 1293 if (typeof data["complete"] != "undefined" && parseInt(data["complete"]) == 1) { 1294 $('#oc_counter').html("00:00:00"); 1295 $(".oc_review_complete").fadeIn(); 1296 clearInterval(thissite.oc_interval); 1297 } 1298 else { 1299 //console.log("Response of progress script: not yet complete ... "); 1300 //console.log(data); 1301 } 1302 }, 1303 async: true, 1304 dataType: "json" 1305 }); 1306 } 1307 catch (e) { thissite.loader(false); alert("save_oc_progress error"); } 1308 } 1309}; 1310 1311function isInt(x) { 1312 var y = parseInt(x, 10); 1313 return !isNaN(y) && x == y && x.toString() == y.toString(); 1314} 1315 1316//Debugging tool-> dumps and object. 1317function dump(obj) { 1318 var out = ''; 1319 for (var i in obj) { 1320 out += i + ": " + obj[i] + "\n"; 1321 } 1322 alert(out); 1323} 1324 1325var seeking = false; 1326 1327function init_audio_player(audio_src) { 1328 thissite.jQueryPlayer = $("#jquery_jplayer_1").jPlayer({ 1329 ready: function (event) { 1330 $(this).jPlayer("setMedia", { 1331 mp3: audio_src 1332 }); 1333 1334 $(this).jPlayer("playHead", playhead_percent); 1335 $(this).jPlayer("play"); 1336 }, 1337 seeking: function (event) { 1338 seeking = true; 1339 seeking_start_time = event.jPlayer.status.currentTime; 1340 }, 1341 seeked: function (event) { 1342 seeking_end_time = event.jPlayer.status.currentTime; 1343 last_save_time = seeking_end_time; 1344 1345 //Allow seeking back or up to the farthest point the user had gotten. 1346 if (seeking_end_time < seeking_start_time || seeking_end_time <= max_time) { return; } 1347 var delta = seeking_end_time - seeking_start_time; 1348 if (Math.abs(delta) > 0.01) { 1349 $(this).jPlayer("playHead", playhead_percent); 1350 } 1351 }, 1352 timeupdate: function (event) { 1353 1354 if (typeof event.jPlayer.status !== 'undefined' && event.jPlayer.status.currentTime > 0 && event.jPlayer.status.paused === false) { 1355 audio_ended = false; 1356 } 1357 1358 if (!seeking) { 1359 current_time = event.jPlayer.status.currentTime; 1360 if (max_time < current_time) { max_time = current_time; } 1361 if (gmxt > 0) { max_time = gmxt; } 1362 if (current_time - last_save_time >= save_progress_interval || event.jPlayer.status.ended) { 1363 last_save_time = current_time; 1364 playhead_percent = Math.round(current_time / duration_time * 100); 1365 thissite.save_iv_slide_progress(pli, oid, current_slide_id, current_time, is_timed); 1366 } 1367 } 1368 seeking = false; 1369 }, 1370 pause: function (event) { 1371 if (typeof (yt_player) != "undefined" && yt_player != null) { 1372 //yt_player.pauseVideo(); 1373 } 1374 }, 1375 play: function (event) { 1376 if (typeof (yt_player) != "undefined" && yt_player != null) { 1377 //yt_player.playVideo(); 1378 } 1379 }, 1380 ended: function (event) { 1381 audio_ended = true; 1382 current_time = 0; 1383 }, 1384 swfPath: "templates/templates_c0mm0n_files/js/jplayer", 1385 supplied: "m4a, oga, wma, mp3", 1386 wmode: "window", 1387 useStateClassSkin: true, 1388 autoBlur: false, 1389 smoothPlayBar: true, 1390 keyEnabled: true, 1391 remainingDuration: true, 1392 toggleDuration: true 1393 }); 1394}//end init audio player 1395 1396 1397function onYouTubeIframeAPIReady() 1398{ 1399 thissite.yt_player = new YT.Player('yt_player', 1400 { 1401 height: '390', 1402 width: '993', 1403 videoId: thissite.yt_video_id, 1404 playerVars: 1405 { 1406 'playsinline': 1, 1407 'disablekb': 1, 1408 'autoplay':0 1409 }, 1410 events: 1411 { 1412 'onReady': onPlayerReady, 1413 'onStateChange': onPlayerStateChange 1414 } 1415 }); 1416} 1417 1418function onPlayerReady(event) 1419{ 1420 //event.target.playVideo(); 1421} 1422 1423var video_ended = false;
1424var current_seconds = 0; 1425var progress_interval; 1426function onPlayerStateChange(event) 1427{ 1428 try { 1429 1430 video_ended = false; 1431 1432 if (event.target.getPlayerState() == -1) { 1433 thissite.yt_player.pauseVideo(); 1434 thissite.yt_player.seekTo(current_seconds); 1435 } 1436 1437 var allow_finish_video = true; 1438 console.log(thissite.yt_player.getDuration() + " " + event.data + " " + audio_ended + " " + slide_complete + " " + current_seconds + " " + (thissite.yt_player.getDuration()-2)); 1439 if (event.data == YT.PlayerState.ENDED) { 1440 //progress bar click hack prevention 1441 if ((typeof (audio_ended) != "undefined" && !audio_ended && slide_complete != "1") || (current_seconds < (parseInt(thissite.yt_player.getDuration())-2))) { 1442 thissite.yt_player.pauseVideo(); 1443 thissite.yt_player.seekTo(0); 1444 allow_finish_video = false; 1445 //console.log("Allow: " + allow_finish_video); 1446 return; 1447 } 1448 1449 //console.log("Allow: " + allow_finish_video); 1450 setTimeout(function () { 1451 if (allow_finish_video) { 1452 1453 $.ajax({ 1454 type: 'POST', 1455 url: "custom/pages/interactive-video/save-slide-video-watched.php", 1456 data: { pli: thissite.current_pli, oid: thissite.current_oid, slide_id: thissite.current_slide_id, is_timed: thissite.current_is_timed }, 1457 success: function (data, status) { 1458 //If we completed this slide, when we reload the page we will get to next available slide. 1459 if (data.error) { 1460 alert(data.error); 1461 return; 1462 } 1463 1464 video_ended = true; 1465 current_seconds = 0; 1466 clearInterval(progress_interval); 1467 1468 if (thissite.jQueryPlayer) { thissite.jQueryPlayer.jPlayer("destroy"); } 1469 1470 if (thissite.current_has_quiz == "1" && (thissite.current_quiz_taken == "" || thissite.current_quiz_taken == "0")) { 1471 //audio.pause(); 1472 if (thissite.jQueryPlayer) { thissite.jQueryPlayer.jPlayer("pause"); } 1473 $("#popup").modal({ backdrop: "static" }); 1474 1475 $.post("custom/pages/interactive-video/popup_quiz.php", { pli: thissite.current_pli, oid: thissite.current_oid, slide_id: thissite.current_slide_id, is_timed: thissite.current_is_timed }, function (data, status) { 1476 $("#popupcontent").html(data); 1477 }); 1478 } 1479 else { 1480 thissite.iv_reload_page(thissite.current_pli, thissite.current_oid, thissite.current_slide_id, thissite.current_is_timed); 1481 } 1482 1483 return; 1484 }, 1485 async: true, 1486 dataType: "json" 1487 }); 1488 } 1489 }, 500); 1490 } 1491 1492 if (event.data == YT.PlayerState.PLAYING) { 1493 //If we haven't finished this slide before and if we're trying to load the video 1494 //before the slide audio has finished, we not allow. 1495 if (typeof (audio_ended) != "undefined" && !audio_ended && slide_complete != "1") { 1496 setTimeout(function () { 1497 alert("Please listen to the audio first before you play the video."); 1498 }, 300); 1499 thissite.yt_player.pauseVideo(); 1500 thissite.yt_player.seekTo(0); 1501 1502 return; 1503 } 1504 1505 clearInterval(progress_interval); 1506 progress_interval = setInterval(function () { 1507 current_seconds += 1; 1508 }, 1000); 1509 } 1510 1511 if (event.data == YT.PlayerState.PAUSED) { 1512 clearInterval(progress_interval); 1513 1514 } 1515 //If we try to seek forward. 1516 if (event.data == YT.PlayerState.BUFFERING) { 1517 //If we moved forward, go back to last recorded, unless this slide has been complete and we can move anywhere we want. 1518 if (thissite.yt_player.playerInfo.currentTime > current_seconds && slide_video_watched != "1") { 1519 clearInterval(progress_interval); 1520 thissite.yt_player.seekTo(current_seconds); 1521 } 1522 } 1523 } 1524 catch (e) { } 1525} 1526function stopVideo() 1527{ 1528 thissite.yt_player.stopVideo(); 1529} 1530 1531function load_yt_iframe_api() 1532{ 1533// var tag = document.createElement('script'); 1534// tag.src = "https://www.youtube.com/iframe_api"; 1535// var firstScriptTag = document.getElementsByTagName('script')[0]; 1536// firstScriptTag.parentNode.insertBefore(tag, firstScriptTag); 1537 1538 $('script').each(function() { 1539 if (this.src === 'https://www.youtube.com/iframe_api') { 1540 this.parentNode.removeChild(this); 1541 } 1542 }); 1543 1544 var head = document.getElementsByTagName('head')[0]; 1545 var script= document.createElement('script'); 1546 script.src= 'https://www.youtube.com/iframe_api'; 1547 head.appendChild(script); 1548} 1549 1550var captcha_filled = false;
1551function capcha_filled() { if (grecaptcha.getResponse() != "") { thissite.captchaFilled = true; captcha_filled = true; } } 1552function capcha_expired() { thissite.captchaFilled = false; } 1553function capcha_error() { thissite.captchaFilled = false; } 1554 1555function CaptchaCallback() { 1556 $('.g-recaptcha').each(function (index, el) { grecaptcha.render(el, { 'sitekey': thissite.gRecaptchaSiteKey }); }) 1557} 1558 1559function CaptchaCallback_async() { 1560 $('.g-recaptcha.async').each(function (index, el) { grecaptcha.render(el, { 'sitekey': $(this).attr("data-sitekey") }); }) 1561}
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.