1// Setting the primary content and footer width to match the nav bar on larger screens 2jQuery(document).ready(function () { 3 jQuery("#addYear").text(new Date().getFullYear()); 4 5 var topPadding = jQuery("#masthead").height(); 6 console.log("Top padding is: " + topPadding); 7 jQuery(".site-content-contain").css({ 8 "margin-top": topPadding + "px", 9 "padding-top": "0px", 10 }); 11 if (jQuery(window).width() > 1250) { 12 var navWidth = jQuery(".logo-nav-wrapper").width(); 13 jQuery("body:not(.home) .site-content-contain, body:not(.home) #primary.content-area").css({ width: navWidth, "margin-left": "auto", "margin-right": "auto" }); 14 jQuery(".site-footer .footer-widget-area").css("width", navWidth); 15 } 16 17 var headerHeight = jQuery(".navbar").height(); 18 jQuery("#primary").css("padding-top", headerHeight); 19 jQuery(".courses-archive-section").css("padding-top", headerHeight); 20}); 21jQuery(document).on("submit", "#sfwd-mark-complete", function (event) { 22 event.preventDefault(); 23 console.log(event); 24}); 25jQuery(".instructor-read-more").on("click", function () { 26 jQuery(".instructor-bio").find("p").slice(1).toggleClass("read-more-content"); 27 jQuery(this).text(function (i, text) { 28 return text === "Read More" ? "Read Less" : "Read More"; 29 }); 30}); 31jQuery(document).ready(function () { 32 jQuery(".show-hide").click(function () { 33 jQuery(this).text($(this).text() == "Show privacy policy" ? "Hide privacy policy" : "Show privacy policy"); 34 }); 35 jQuery("#show-password").click(function () { 36 // $(this).toggleClass("fa-eye fa-eye-slash"); 37 if (jQuery(this).data("target")) { 38 var input = jQuery("#" + jQuery(this).data("target")); 39 } else { 40 var input = jQuery("#regFormPassword"); 41 } 42 var text = jQuery("#show-hide-toggle"); 43 if (input.attr("type") == "password") { 44 input.attr("type", "text"); 45 text.html("Hide Password <i class='fa fa-eye-slash' aria-hidden='true'></i>"); 46 text.addClass("pw-visible"); 47 } else { 48 input.attr("type", "password"); 49 text.html("Show Password <i class='fa fa-eye' aria-hidden='true'></i>"); 50 text.removeClass("pw-visible"); 51 } 52 }); 53}); 54//This ensures that the footer sits at the bottom of the window if the main content area is too small 55jQuery(document).ready(function () { 56 var masthead = jQuery("#masthead").height(), 57 footer = jQuery("#colophon").height(), 58 offset = footer + masthead, 59 windowHeight = jQuery(document).height(), 60 marginTop = parseInt(jQuery(".site-content-contain").css("marginTop").replace("px", "")), 61 mainHeight = windowHeight - offset - marginTop; 62 63 jQuery(".site-content-contain").css("min-height", mainHeight + "px"); 64}); 65 66jQuery(document).ready(function () { 67 // A small function to work in conjunction with the Logged in reg forms. We'll disabled the reg button if the box is unchecked 68 jQuery("#enroll_me").on("click", function () { 69 jQuery("#logged-in-register-now-button").prop("disabled", function (i, v) { 70 return !v; 71 }); 72 }); 73 // The larger function to work in conjunction with the Logged in reg forms. we'll use AJAX to process the form and return a message. 74 jQuery("#logged-in-register-now-button").removeAttr("disabled"); 75 jQuery("#hiddenOnTwentyFourForm").attr("novalidate", "novalidate"); 76 jQuery("#no-script-identifier-wrapper").html(""); 77 jQuery("#hiddenOnTwentyFourForm").on("submit", function (event) { 78 event.preventDefault(); 79 var form = jQuery(this); 80 jQuery("#hiddenOnTwentyFourForm").css("display", "none"); 81 jQuery("#hiddenOnTwentyFourForm").before('<div class="loader"><p>Please wait while we process your request...</p></div>'); 82 window.scrollTo(0, 0); 83 jQuery.ajax({ 84 type: "POST", 85 url: jQuery(this).attr("action"), 86 data: form.serialize(), 87 processData: false, 88 success: function (response) { 89 console.log(response); 90 //if request if made successfully then the response represent the data 91 if (response.indexOf("Error:") === -1) { 92 // do stuff 93 jQuery(".loader").html("<p>" + response + "</p>"); 94 jQuery(".welcome-back-message").remove(); 95 } else { 96 jQuery(".loader").remove(); 97 var newResponse = response.replace("Error:", ""); 98 var errorLog = jQuery.parseJSON(newResponse); 99 if (errorLog.existing_user_login == "Sorry, that username already exists!") { 100 jQuery("#hiddenOnTwentyFourForm").before('<div style="color: $red;font-size: 16px;line-height: 20px; font-weight: 400;">This email address is already registered. Please click the button below to login.' + '<br /><a href="/login" class="wp-block-button primary register-now">' + '<button id="already-registered-login-button" class="wp-block-button__link nav-primary-button" style="display: block;margin: 20px 0;">Login</button>' + "</a>" + '<p><a href="/login/?action=forgot-password" style="font-size: 80%;">Forgot your password? Click here to reset your password.</a></p>'); 101 } else { 102 jQuery("#hiddenOnTwentyFourForm").before('<div style="color: $red;font-size: 18px;line-height: 20px;">An error occured in processing your request.<br /><span style="color: $red;font-size: 80%;">' + response + "</span>"); 103 jQuery("#hiddenOnTwentyFourForm").css("display", "block"); 104 } 105 } 106 }, 107 }); 108 }); 109}); 110 111jQuery(document).ready(function () { 112 jQuery("#registrationForm").attr("novalidate", "novalidate"); 113 jQuery("#no-script-identifier-wrapper").html(""); 114 jQuery("#register-now-button").removeAttr("disabled"); 115 jQuery("#registrationForm").on("submit", function (event) { 116 event.preventDefault(); 117 jQuery(".error").removeClass("error"); 118 jQuery(".form-error-notification").html(""); 119 let formComplete = true; 120 /// Let's add some form validation for the enroll form only 121 const regForm = document.querySelector("#registrationForm");
122 const emailEl = document.querySelector("#regFormEmail"); 123 const isEmailValid = function (email) { 124 const re = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/; 125 return re.test(email); 126 }; 127 const checkEmail = function () { 128 let valid = false; 129 const email = element.value.trim(); 130 if (email == "") { 131 return "<span class='required-notice'>This field is required.</span>"; 132 } else if (!isEmailValid(email)) { 133 return "Email is not valid."; 134 } else { 135 valid = true; 136 } 137 return valid; 138 }; 139 var elements = regForm.elements; 140 for (var i = 0, element; (element = elements[i++]); ) { 141 if (element.required == true) { 142 let errorMessage = "<span class='required-notice'>This field is required.</span>"; 143 if (element.name == "email") { 144 let isEmailValid = checkEmail(element); 145 if (isEmailValid != true) { 146 errorMessage = isEmailValid; 147 jQuery(element) 148 .addClass("error") 149 .after('<div class="form-error-notification">' + errorMessage + "</div>"); 150 formComplete = false; 151 } 152 } else if ((element.type == "text" || element.type == "password" || jQuery(element).is("select")) && element.value == "") { 153 formComplete = false; 154 jQuery(element) 155 .addClass("error") 156 .after('<div class="form-error-notification">' + errorMessage + "</div>"); 157 } else if (element.type == "checkbox" && element.checked == false) { 158 if (jQuery(element).hasClass("grouped-checkbox")) { 159 var parentWrapper = jQuery(element).closest("td"); 160 jQuery(parentWrapper).find("label.grouped-checkboxes").addClass("error"); 161 jQuery(parentWrapper).find(".wdm-checkbox").addClass("error"); 162 if (jQuery("label.grouped-checkboxes").siblings(".form-error-notification").length < 1) { 163 jQuery(parentWrapper).find("label.grouped-checkboxes").after('<div class="form-error-notification">Please select at least one option below</div>'); 164 } 165 } else { 166 jQuery(element).closest(".wdm-checkbox").addClass("error"); 167 } 168 formComplete = false; 169 } 170 } 171 } 172 if (formComplete == false) { 173 jQuery("html, body").animate( 174 { 175 scrollTop: jQuery(".error:first"), 176 }, 177 1000 178 ); 179 if (jQuery("#incomplete-form").length < 1) { 180 jQuery("#registrationForm").prepend('<div id="incomplete-form" style="border-bottom: none !important; color: $red;">Please complete the required fields below.</div>'); 181 var inputs = jQuery("input,textarea,select,checkbox").filter("[required]:visible"); 182 jQuery(inputs).each(function () { 183 if (!jQuery(this).val()) { 184 //jQuery(this).css("border-bottom", "solid 1px red"); 185 // jQuery(this).addClass("error"); 186 console.log(jQuery(this).attr("name")); 187 var label = jQuery("label[for='" + jQuery(this).attr("id") + "']"); 188 console.log(label); 189 // jQuery(label).addClass("error"); 190 //jQuery(label).css("color", "red"); 191 } 192 }); 193 } 194 return { 195 error: true, 196 message: "Parameter needed", 197 }; 198 } 199 var form = jQuery(this); 200 jQuery("#registrationForm").css("display", "none"); 201 jQuery(".error-message").remove(); 202 jQuery("#registrationForm").before('<div class="loader"><p>Please wait while we process your request...</p></div>'); 203 window.scrollTo(0, 0); 204 jQuery.ajax({ 205 type: "POST", 206 url: jQuery(this).attr("action"), 207 data: form.serialize(), 208 success: function (response) { 209 //if request if made successfully then the response represent the data 210 if (response.indexOf("Error:") === -1) { 211 // do stuff 212 console.log(response); 213 window.location = response; 214 } else { 215 jQuery(".loader").remove(); 216 var newResponse = response.replace("Error:", ""); 217 console.log(newResponse); 218 var errorLog = jQuery.parseJSON(newResponse); 219 console.log(errorLog); 220 if (errorLog.existing_user_login == "Sorry, that username already exists!") { 221 jQuery("#registrationForm").before('<div class="error-message" style="color: $red; font-size: 16px;line-height: 20px; font-weight: 400;">This email address is already registered. Please click the button below to login.' + '<br /><a href="/login" class="wp-block-button primary register-now">' + '<button id="already-registered-login-button" class="wp-block-button__link nav-primary-button" style="display: block;margin: 20px 0;">Login</button></a>' + '<p><a href="/login/?action=forgot-password" style="font-size: 80%;">Forgot your password? Click here to reset your password.</a></p>'); 222 } else { 223 jQuery("#registrationForm").before('<div class="error-message" style="color: $red;text-align: center;font-size: 16px;line-height: 16px;">An error occured in processing your request.<br /><span style="color: $red;font-size: 80%;">' + response + "</span>"); 224 jQuery("#registrationForm").css("display", "block"); 225 } 226 } 227 }, 228 }); 229 }); 230}); 231 232jQuery("#edit-items").on("click", function () { 233 var action = jQuery(this).text();
234 if (jQuery(this).hasClass("submitIt")) { 235 var form = jQuery("#updateProfile"), 236 url = "/wp-content/plugins/ria-registeration-emails/update-fields.php"; 237 jQuery.ajax({ 238 type: "POST", 239 url: url, 240 data: form.serialize(), 241 success: function (response) { 242 console.log(response); 243 }, 244 }); 245 } 246 jQuery(this).toggleClass("submitIt"); 247 jQuery(".can-update").prop("disabled", function (i, val) { 248 return !val; 249 //action == "Edit" ? "Edit" : "Save"; 250 }); 251 jQuery(this).text(action == "Save Profile" ? "Edit Profile" : "Save Profile"); // Element(s) are now enabled. 252}); 253jQuery(document).ready(function () { 254 var minHeight = jQuery("#live-day-image-wrapper").width() * 0.5625; 255 jQuery("#live-day-image-wrapper").css("min-height", minHeight); 256 if (jQuery("div.ld-content-action form.sfwd-mark-complete").length > 0) { 257 jQuery("div.ld-content-action :contains('Next Topic')").css("display", "none"); 258 } 259}); 260/* Scripts To Modify the Nav Bar */ 261jQuery(document).ready(function ($) { 262 /* Search Menu */ 263 $(".search-icon").click(function () { 264 console.log("Let's Go!"); 265 $(".wpbsearchform").slideToggle(); 266 }); 267 $(document).keyup(function (e) { 268 // Ref https://stackoverflow.com/questions/3369593/how-to-detect-escape-key-press-with-pure-js-or-jquery 269 // Close search if esc key pressed 270 if (e.key == "Escape") { 271 $(".wpbsearchform").hide(); 272 } 273 }); 274 /* Mega Menu Width */ 275 var maxWidth = jQuery(".logo-nav-wrapper").width(); 276 jQuery(".mega-menu-row").css("max-width", maxWidth); 277 jQuery(".wdml-post-content.elumine_content").css({ 278 "max-width": maxWidth, 279 margin: "auto", 280 }); 281}); 282/* Mimicing category layouts */ 283jQuery(document).ready(function () { 284 jQuery(".wp-block-latest-posts__post-title").each(function () { 285 link = jQuery(this).attr("href"); 286 excerpt = jQuery(this).siblings(".wp-block-latest-posts__post-excerpt"); 287 console.log(excerpt); 288 jQuery(excerpt) 289 // .text(jQuery(excerpt).text().replace("[â¦]","")) 290 .addClass("excerpt"); 291 // .append(' <span class="excerpt-cta"><a class="read-more-link" href="' + link + '">Read More</a></span>'); 292 }); 293}); 294 295jQuery(".vimeo-embed").each(function () { 296 var vimeoID = jQuery(this).data("vimeo-id"); 297 if (vimeoID == null) { 298 vimeoID = jQuery(this).attr("href"); 299 } 300 getVimeoInfo(vimeoID); 301}); 302 303function getVimeoInfo(vimeoID) { 304 var url = "/wp-content/themes/elumine-child/includes/integrations/vimeo/get-video.php"; 305 jQuery.ajax({ 306 type: "POST", 307 url: url, 308 data: { vimeoID: vimeoID }, 309 success: function (data) { 310 console.log(data); 311 response = jQuery.parseJSON(data); 312 var objectContext = '{"@context": "https://schema.org",' + '"@type": "VideoObject",' + '"name": "' + response.name + '",' + '"description": "' + response.description + '",' + '"thumbnailUrl": [' + '"' + response.photo + '"' + "]," + '"uploadDate": "' + response.created + '",' + '"duration": "' + response.duration + '",' + '"contentUrl": "' + window.location + '",' + '"embedUrl": "' + window.location + '"}'; 313 314 const script = document.createElement("script"); 315 script.setAttribute("type", "application/ld+json"); 316 script.textContent = objectContext; 317 document.head.appendChild(script); 318 console.log("With vanilla javascript"); 319 }, 320 }); 321} 322 323function retrieveBrightcove(e, videoID) { 324 e.preventDefault(); 325 var url = "/wp-content/themes/elumine-child/includes/integrations/brightcove-get-video.php"; 326 console.log(this); 327 328 console.log(videoID); 329 jQuery.ajax({ 330 type: "POST", 331 url: url, 332 data: { videoID: videoID }, 333 success: function (data) { 334 console.log(data); 335 jQuery("#" + videoID).replaceWith(data); 336 }, 337 }); 338} 339 340function vimeoAjaxCall(activityID, loggedTime) { 341 var url = "/wp-content/themes/elumine-child/includes/topic-progress-tracking.php"; 342 jQuery.ajax({ 343 type: "POST", 344 url: url, 345 data: { time: loggedTime, activity_id: activityID }, 346 success: function (response) { 347 console.log(response); 348 }, 349 }); 350} 351function topicVimeoRestrictions(activityID, videoProgressTime) { 352 if (jQuery("#vimeo-od-wrapper").length > 0) { 353 jQuery("#vimeo-od-wrapper iframe").on("load", function () { 354 jQuery.getScript("https://player.vimeo.com/api/player.js", function () { 355 const iframe = document.querySelector("iframe"); 356 const player = new Vimeo.Player(iframe); 357 358 // Let's set our time tracking variables 359 let timeWatched = 0; 360 videoProgressTime ? (timeWatched = videoProgressTime) : (videoProgressTime = 0); 361 let loggedTime = timeWatched; 362 playheadStart = loggedTime >= 10 ? loggedTime - 10 : 0; 363 364 // Now we'll manipulate the player 365 player.setCurrentTime(playheadStart); 366 player.on("play", function () { 367 console.log("Video played."); 368 }); 369 player.on("timeupdate", function (data) { 370 if (data.seconds - 1 < timeWatched && data.seconds > timeWatched) { 371 timeWatched = data.seconds; 372 373 // We'll only call the ajax function after 5 seconds and only after the last time added to the dB 374 if (timeWatched >= loggedTime + 5 && timeWatched > videoProgressTime) { 375 loggedTime = timeWatched; 376 vimeoAjaxCall(activityID, loggedTime); 377 } 378 } 379 }); 380 player.on("seeked", function (data) { 381 console.log("Video seeking is disabled"); 382 if (timeWatched < data.seconds) { 383 player.setCurrentTime(timeWatched); 384 } 385 }); 386 }); 387 }); 388 } 389} 390 391jQuery(".retrieve-brightcove").on("click", function (e) { 392 var videoID = jQuery(this).attr("id"); 393 retrieveBrightcove(e, videoID); 394}); 395 396jQuery(".retrieve-brightcove-slider").on("click", function (e) { 397 var videoID = jQuery(this).attr("href"); 398 jQuery(this).replaceWith('<div id="' + videoID + '"></div>'); 399 retrieveBrightcove(e, videoID); 400}); 401jQuery(".retrieve-brightcove-slider-link").on("click", function (e) { 402 e.preventDefault(); 403 console.log("Inside the embed Vimeo function"); 404 var videoID = jQuery(this).attr("href"), 405 videoContainer = jQuery('a.retrieve-brightcove-slider[href^="' + videoID + '"]'); 406 jQuery(videoContainer).replaceWith('<div id="' + videoID + '"></div>'); 407 retrieveBrightcove(e, videoID); 408}); 409 410jQuery(document).ready(function () { 411 function embedVimeo($this) { 412 console.log("Inside the embed Vimeo function"); 413 console.log($this); 414 var videoID = jQuery($this).attr("id"), 415 width = jQuery($this).width(), 416 height = jQuery($this).height(); 417 console.log(width + " & " + height); 418 jQuery("#" + videoID).html('<div class="intro-video" style="padding:56.25% 0 0 0;position:relative; width: ' + width + "px; height: " + height + 'px"><iframe id="player-frame" src="https://player.vimeo.com/video/' + videoID + '?autoplay=1" allow="autoplay; fullscreen" allowfullscreen="" style="position:absolute;top:0;left:0;width:100%;height:100%;" frameborder="0"></iframe></div>'); 419 } 420 jQuery(".vimeo-embed").on("click", function () { 421 console.log("Clicked"); 422 embedVimeo(this); 423 }); 424 425 jQuery(".vimeo-embed.slider-video").on("click", function (e) { 426 e.preventDefault(); 427 console.log("Inside the embed Vimeo function"); 428 console.log(this); 429 var videoID = jQuery(this).attr("href"), 430 width = jQuery(this).width(), 431 height = jQuery(this).height(); 432 console.log(width + " & " + height); 433 jQuery(this).html('<div class="intro-video" style="padding:56.25% 0 0 0;position:relative; width: ' + width + 'px;"><iframe id="player-frame" src="https://player.vimeo.com/video/' + videoID + '?autoplay=1" allow="autoplay; fullscreen" allowfullscreen="" style="position:absolute;top:0;left:0;width:100%;height:100%;" frameborder="0"></iframe></div>'); 434 }); 435 jQuery(".underline-link.slider-link").on("click", function (e) { 436 e.preventDefault(); 437 console.log("Inside the embed Vimeo function"); 438 var videoID = jQuery(this).attr("href"), 439 videoContainer = jQuery('a.vimeo-embed.slider-video[href^="' + videoID + '"]'), 440 width = jQuery(videoContainer).width(), 441 height = jQuery(videoContainer).height(); 442 console.log(videoContainer); 443 console.log(width + " & " + height); 444 jQuery(videoContainer).html('<div class="intro-video" style="padding:56.25% 0 0 0;position:relative; width: ' + width + "px; height: " + height + 'px"><iframe id="player-frame" src="https://player.vimeo.com/video/' + videoID + '?autoplay=1" allow="autoplay; fullscreen" allowfullscreen="" style="position:absolute;top:0;left:0;width:100%;height:100%;" frameborder="0"></iframe></div>'); 445 }); 446 jQuery(".inline-video-play a").on("click", function (e) { 447 e.preventDefault(); 448 console.log("Inside the embed Vimeo function"); 449 var videoID = jQuery(this).parent().attr("id"); 450 451 (videoContainer = jQuery('figure[id^="' + videoID + '"]')), (width = jQuery(videoContainer).width()), (height = jQuery(videoContainer).height()); 452 console.log(videoContainer); 453 console.log(width + " & " + height); 454 jQuery(videoContainer).html('<div class="intro-video" style="padding:56.25% 0 0 0;position:relative; width: ' + width + "px; height: " + height + 'px"><iframe id="player-frame" src="https://player.vimeo.com/video/' + videoID + '?autoplay=1" allow="autoplay; fullscreen" allowfullscreen="" style="position:absolute;top:0;left:0;width:100%;height:100%;" frameborder="0"></iframe></div>'); 455 }); 456}); 457// Let's be smarter than Wordpress and hide the latest post li of the page we're on 458 459function hideCurrentPost(haystack, needle) { 460 var url = window.location.href; 461 jQuery(haystack).each(function () { 462 console.log("URL: " + url); 463 var container = jQuery(this).find(needle).attr("href"); 464 console.log("Container: " + container); 465 //if (jQuery(url === container)) { 466 if (url.indexOf(container) >= 0) { 467 jQuery(this).css("display", "none"); 468 console.log("match"); 469 } 470 }); 471}
472hideCurrentPost("ul.wp-block-latest-posts li", ".wp-block-latest-posts__post-title"); 473hideCurrentPost(".course-introduction-grid .wp-block-column", "figure a"); 474 475// A quick function to update the default text for buttons of courses a user is not enrolled 476jQuery(document).ready(function () { 477 jQuery(".ld-course-list-content").each(function () { 478 var atts = jQuery(this).data("shortcode-atts"); 479 console.log(atts.mycourses); 480 481 if (atts.mycourses == "not-enrolled") { 482 console.log(this); 483 jQuery(this).find(" .ld_course_grid .ld_course_grid_button a").text("Register Now"); 484 } 485 }); 486}); 487 488// Let's hide the additional header if there aren't any additional classes available 489if (!jQuery.trim(jQuery(".ld-course-list-content .ld-course-list-items.row").html()).length) { 490 jQuery("h2.additional-classes").css("display", "none"); 491} 492 493// Moving the default session navigation up in the page 494jQuery(document).ready(function () { 495 jQuery("#new-actions-space").append(jQuery(".learndash.learndash_post_sfwd-topic.user_has_access .ld-content-actions")); 496}); 497 498function getCookie(SimpleHistoryLoggingCookie) { 499 let name = SimpleHistoryLoggingCookie + "="; 500 let decodedCookie = decodeURIComponent(document.cookie); 501 let ca = decodedCookie.split(";"); 502 for (let i = 0; i < ca.length; i++) { 503 let c = ca[i]; 504 while (c.charAt(0) == " ") { 505 c = c.substring(1); 506 } 507 if (c.indexOf(name) == 0) { 508 return c.substring(name.length, c.length); 509 } 510 } 511 return ""; 512} 513function get_fb(hash, id, time) { 514 var timeGap = 30000 + time; 515 console.log("Time gap is: " + timeGap); 516 postDetails = { userhash: hash, historyID: id, location: window.location.pathname, seconds: timeGap }; 517 console.log(postDetails); 518 var feedback = jQuery 519 .ajax({ 520 type: "POST", 521 url: "/wp-content/themes/elumine-child/includes/simplelogger.php", 522 data: postDetails, 523 async: false, 524 }) 525 .success(function (data) { 526 console.log("Success data: "); 527 newData = jQuery.parseJSON(data); 528 console.log(newData); 529 console.log("Userhash return: " + newData.userhash); 530 setTimeout(function () { 531 get_fb(newData.userhash, newData.historyID, timeGap); 532 }, timeGap); 533 }).responseText; 534} 535var pathName = window.location.pathname; 536if (pathName.indexOf("/topics/") >= 0) { 537 get_fb(getCookie("SimpleHistoryLoggingCookie"), 0, 0); 538} 539 540//Script to add arrows to buttons 541jQuery(document).ready(function ($) { 542 $("input[type='submit'], input[type='button']").each(function () { 543 var value = $(this).attr("value"); 544 var newValue = value + " â"; 545 546 $(this).attr("value", newValue).css("padding-right", "10px"); 547 }); 548}); 549 550jQuery(document).ready(function () { 551 if (document.getElementById("details-box") !== null) { 552 var detailsBox = document.getElementById("details-box"); 553 document.addEventListener("mouseover", function (e) { 554 if (e.target.tagName == "path") { 555 var content = e.target.dataset.name; 556 detailsBox.innerHTML = content; 557 detailsBox.style.opacity = "100%"; 558 } else { 559 detailsBox.style.opacity = "0%"; 560 } 561 }); 562 563 window.onmousemove = function (e) { 564 var x = e.clientX, 565 y = e.clientY; 566 detailsBox.style.top = y + 20 + "px"; 567 detailsBox.style.left = x + "px"; 568 }; 569 } 570 // Ajax call to search database for numbers based on state location 571 function runMapSearch(eventName, eventID) { 572 jQuery("#map-state").html(eventName); 573 var selectedID = eventID; 574 jQuery("#" + selectedID).addClass("selected"); 575 jQuery.ajax({ 576 type: "POST", 577 url: "/wp-content/themes/elumine-child/includes/data-map-search.php", 578 data: selectedID, 579 processData: false, 580 success: function (response) { 581 console.log(response); 582 jQuery("#map-results-list").html(response); 583 }, 584 }); 585 } 586 587 // Ajax call to search database for numbers based on user interest 588 function runInterestSearch(form) { 589 jQuery.ajax({ 590 type: "POST", 591 url: "/wp-content/themes/elumine-child/includes/data-interest-search.php", 592 data: form.serialize(), 593 processData: false, 594 success: function (response) { 595 console.log(response); 596 jQuery("#interest-in-results-list").html(response); 597 }, 598 }); 599 } 600 601 //Run the function when the page loads to populate initial data 602 if (document.getElementById("us-map") !== null) { 603 runMapSearch("New York", "NY"); 604 } 605 // Run the function again when the map is clicked on 606 jQuery("#us-map").on("click", function (event) { 607 event.preventDefault(); 608 jQuery("#us-map path").removeClass("selected"); 609 if (event.target.tagName == "path") { 610 runMapSearch(event.target.dataset.name, event.target.dataset.id); 611 } 612 }); 613 614 //Run the function when the page loads to populate initial data 615 if (document.getElementById("category-search") !== null) { 616 runInterestSearch(jQuery("form#category-search")); 617 } 618 // Run the function again when the form state changes 619 jQuery("form#category-search input").on("change", function (event) { 620 event.preventDefault(); 621 var form = jQuery(this).closest("form"); 622 623 runInterestSearch(form); 624 }); 625}); 626 627/* Below are functions used to create charts using chart.js */ 628function labelFormatter(value, tooltipLabel) { 629 if (((valueCheck = value), (value = (value = (value = (value = value.toString()).split(/(?=(?:...)*$)/)).join("")).replace(/\B(?=(\d{3})+(?!\d))/g, ",")), tooltipLabel.includes("*"))) { 630 var labelArray = tooltipLabel.split("*"), 631 newLabel = labelArray[1]; 632 return "B" == newLabel && valueCheck > 1e3 ? ((newLabel = "T"), (value = (valueCheck / 1e3).toFixed(1).replace(/\.0+$/, ""))) : "B" == labelArray[1] && valueCheck <= 1 && valueCheck > 0 ? ((newLabel = "M"), (value = (1e3 * valueCheck).toFixed(1).replace(/\.0+$/, ""))) : 0 == valueCheck && (newLabel = ""), labelArray[0] + value + newLabel; 633 } 634 return value + tooltipLabel; 635} 636function logarithmicLabelFormatter(value, tooltipLabel) { 637 if (((valueCheck = parseInt(value)), (value = (value = (value = (value = value.toString()).split(/(?=(?:...)*$)/)).join("")).replace(/\B(?=(\d{3})+(?!\d))/g, ",")), tooltipLabel.includes("*"))) { 638 var labelArray = tooltipLabel.split("*"), 639 newLabel = labelArray[1]; 640 return "B" == newLabel && valueCheck >= 1e3 ? ((newLabel = "T"), (value = (valueCheck / 1e3).toFixed(1).replace(/\.0+$/, ""))) : "B" == labelArray[1] && value < 1 && value > 0 ? ((newLabel = "M"), (value *= 100)) : 0 == valueCheck && (newLabel = ""), labelArray[0] + value + newLabel; 641 } 642 return value + tooltipLabel; 643} 644function barChart(chartID, chartLabel, labelArray, dataArray, dataColors, hoverColors, tooltipLabel, barThickness, categoryPercentage) { 645 console.log("Loaded the barChart function"); 646 if (dataArray.length > 1) { 647 barThickness = null; 648 if (!categoryPercentage) { 649 var setCategoryPercentage = 0.6; 650 } else { 651 setCategoryPercentage = categoryPercentage; 652 } 653 } else if (!barThickness && dataArray.length == 1) { 654 barThickness = 60; 655 } 656 var fullDataSet = []; 657 dataArray.forEach(function (item, index, arr) {
658 fullDataSet.push({ label: chartLabel, data: item, fill: !0, barThickness: barThickness, borderRadius: barBorderRadius, borderColor: dataColors[index], backgroundColor: dataColors[index], hoverBackgroundColor: hoverColors, datalabels: { display: !0 } }); 659 }); 660 new Chart(document.querySelector("#" + chartID).getContext("2d"), { 661 plugins: [ChartDataLabels], 662 type: "bar", 663 data: { labels: labelArray, datasets: fullDataSet }, 664 options: { 665 categoryPercentage: setCategoryPercentage, 666 barPercentage: 1, 667 plugins: { 668 legend: { display: !1, position: "right", labels: legendLabels }, 669 datalabels: { 670 color: labelBlack, 671 anchor: "end", 672 align: "end", 673 offset: 1, 674 font: { size: 14, family: '"Soehne Leicht", sans-serif' }, 675 formatter: function (value) { 676 return labelFormatter(value, tooltipLabel); 677 }, 678 }, 679 tooltip: { 680 bodyFont: { family: '"Soehne Leicht", sans-serif', size: 14, lineHeight: 1.5 }, 681 cornerRadius: 5, 682 bodySpacing: 10, 683 caretSize: 10, 684 boxPadding: 5, 685 callbacks: { 686 title: function (context) { 687 return ""; 688 }, 689 label: function (context) { 690 let label = context.label || ""; 691 if (label) { 692 label += ": "; 693 } 694 let dataLabel = label; 695 if (context.parsed.y !== null) { 696 dataLabel = context.raw; 697 } 698 dataLabel = labelFormatter(dataLabel, tooltipLabel); 699 return label + dataLabel; 700 }, 701 }, 702 }, 703 }, 704 layout: { padding: { left: -30, right: 10 } }, 705 scales: { 706 yAxis: { 707 grid: { borderColor: darkGrey, borderWidth: 2, color: ({ tick }) => (tick.value == 0 ? darkGrey : lightGrey), tickLength: 0, lineWidth: ({ tick }) => (tick.value == 0 ? 2 : 0.5) }, 708 ticks: { 709 color: labelBlack, 710 padding: 30, 711 font: { size: 14, family: '"Soehne Leicht", sans-serif' }, 712 callback: function (value, index, ticks) { 713 return labelFormatter(value, tooltipLabel); 714 }, 715 }, 716 }, 717 xAxis: { grid: { borderColor: darkGrey, borderWidth: 2, tickLength: 0, display: !1 }, ticks: { color: labelBlack, padding: 30, font: { size: 14, family: '"Soehne Leicht", sans-serif' } } }, 718 }, 719 }, 720 }); 721} 722function horizontalBarChart(chartID, chartLabel, labelArray, dataArray, dataColors, hoverColors, tooltipLabel, barThickness, chartType) { 723 if (!barThickness) { 724 barThickness = 20; 725 } 726 if (!chartType) { 727 chartType = "logarithmic"; 728 } 729 var fullDataSet = []; 730 dataArray.forEach(function (item, index, arr) { 731 fullDataSet.push({ label: chartLabel, data: item, fill: !0, categoryPercentage: 1.2, barPercentage: 0.5, borderRadius: barBorderRadius, borderColor: dataColors[index], backgroundColor: dataColors[index], hoverBackgroundColor: hoverColors, datalabels: { display: !0 } }); 732 }); 733 new Chart(document.querySelector("#" + chartID).getContext("2d"), { 734 plugins: [ChartDataLabels], 735 type: "bar", 736 data: { labels: labelArray, datasets: fullDataSet }, 737 options: { 738 indexAxis: "y", 739 maintainAspectRatio: !1, 740 plugins: { 741 legend: { display: !1, position: "right", labels: legendLabels }, 742 datalabels: { 743 color: labelBlack, 744 anchor: "end", 745 align: "end", 746 offset: 3, 747 font: { size: 14, family: '"Soehne Leicht", sans-serif' }, 748 formatter: function (value) { 749 return labelFormatter(value, tooltipLabel); 750 }, 751 }, 752 tooltip: { 753 bodyFont: { family: '"Soehne Leicht", sans-serif', size: 14, lineHeight: 1.5 }, 754 cornerRadius: 5, 755 bodySpacing: 10, 756 caretSize: 10, 757 boxPadding: 5, 758 callbacks: { 759 title: function (context) { 760 return ""; 761 }, 762 label: function (context) { 763 let label = context.label || ""; 764 if (label) { 765 label += ": "; 766 } 767 let dataLabel = label; 768 if (context.parsed.y !== null) { 769 dataLabel = context.raw; 770 } 771 dataLabel = labelFormatter(dataLabel, tooltipLabel); 772 return label + dataLabel; 773 }, 774 }, 775 }, 776 }, 777 layout: { padding: { left: -30, right: 40 } }, 778 scales: { 779 yAxis: { 780 grid: { borderColor: darkGrey, borderWidth: 2, tickLength: 0, display: !1 }, 781 ticks: { 782 color: labelBlack, 783 padding: 30, 784 font: { size: 14, family: '"Soehne Leicht", sans-serif' }, 785 callback: function (value, index, ticks) { 786 return labelFormatter(labelArray[index], ""); 787 }, 788 }, 789 }, 790 xAxis: { 791 type: chartType, 792 grid: { borderColor: darkGrey, borderWidth: 2, tickLength: 0, display: !1 }, 793 ticks: { 794 color: labelBlack, 795 padding: 30, 796 autoSkip: !0, 797 maxTicksLimit: 6, 798 maxRotation: 0, 799 font: { size: 14, family: '"Soehne Buch", sans-serif' }, 800 callback: function (value, index, ticks) { 801 return logarithmicLabelFormatter(value, tooltipLabel); 802 }, 803 }, 804 }, 805 }, 806 }, 807 }); 808} 809function doughnutChart(chartID, labelArray, dataArray, dataColors, tooltipLabel) { 810 new Chart(document.querySelector("#" + chartID), { 811 plugins: [ChartDataLabels],
812 type: "doughnut", 813 data: { labels: labelArray, datasets: [{ data: dataArray, fill: !0, borderWidth: 0, backgroundColor: dataColors, datalabels: { display: !1 } }] }, 814 options: { 815 cutout: "87%", 816 plugins: { 817 legend: { display: !1, position: "right", labels: { padding: 50, boxWidth: 600, boxHeight: 20, useBorderRadius: !0, usePointStyle: !0, pointStyle: "rectRounded", borderRadius: 5, font: { size: 24 } } }, 818 tooltip: { 819 bodyFont: { family: '"Soehne Leicht", sans-serif', size: 14, lineHeight: 1.5 }, 820 cornerRadius: 5, 821 bodySpacing: 10, 822 caretSize: 10, 823 boxPadding: 5, 824 callbacks: { 825 title: function (context) { 826 return ""; 827 }, 828 label: function (context) { 829 let label = context.label || ""; 830 if (label) { 831 label += ": "; 832 } 833 let dataLabel = label; 834 if (context.parsed.y !== null) { 835 dataLabel = context.raw; 836 } 837 dataLabel = labelFormatter(dataLabel, tooltipLabel); 838 return label + dataLabel; 839 }, 840 }, 841 }, 842 }, 843 }, 844 }); 845} 846function pieChart(chartID, labelArray, dataArray, dataColors, tooltipLabel) { 847 console.log("In the pie chart function!"); 848 console.log("Chart ID is... " + chartID); 849 new Chart(document.querySelector("#" + chartID), { 850 plugins: [ChartDataLabels], 851 type: "pie", 852 data: { labels: labelArray, datasets: [{ data: dataArray, fill: !0, borderWidth: 0, backgroundColor: dataColors, datalabels: { display: !1 } }] }, 853 options: { 854 plugins: { 855 legend: { display: !1, position: "right", labels: { padding: 50, boxWidth: 600, boxHeight: 20, useBorderRadius: !0, usePointStyle: !0, pointStyle: "rectRounded", borderRadius: 5, font: { size: 24 } } }, 856 tooltip: { 857 bodyFont: { family: '"Soehne Leicht", sans-serif', size: 14, lineHeight: 1.5 }, 858 cornerRadius: 5, 859 bodySpacing: 10, 860 caretSize: 10, 861 boxPadding: 5, 862 callbacks: { 863 title: function (context) { 864 return ""; 865 }, 866 label: function (context) { 867 let label = context.label || ""; 868 if (label) { 869 label += ": "; 870 } 871 let dataLabel = label; 872 if (context.parsed.y !== null) { 873 dataLabel = context.raw; 874 } 875 dataLabel = labelFormatter(dataLabel, tooltipLabel); 876 return label + dataLabel; 877 }, 878 }, 879 }, 880 }, 881 }, 882 }); 883} 884var navy = "#1C3F73", 885 darkerNavy = "#122a4e", 886 steelBlue = "#6482A7", 887 periwinkle = "#6E94CF", 888 paleBlue = "#C4DAF1", 889 midnightGreen = "#024650", 890 ming = "#3D6978", 891 celdonGreen = "#278C8C", 892 pewterBlue = "#82B4B5", 893 labelBlack = "#010101", 894 darkGrey = "#727374", 895 lightGrey = "#c9c9c9"; 896var doughnutColors = [navy, periwinkle, steelBlue, paleBlue, midnightGreen, celdonGreen, ming, pewterBlue]; 897var databaseColors = ["#26456e", "#1c5998", "#1c73b1", "#3a87b7", "#67add4", "#7bc8e2", "#0000A0", "#6f63bb", "#8a60b0", "#ba43b4", "#c7519c", "#d63a3a", "#ff7f0e", "#ffaa0e", "#ffbf50", "#bcbd22", "#78a641", "#2ca030", "#12a2a8", "#1f83b4"]; 898var threeColors = [navy, paleBlue, steelBlue]; 899var chartColors = [navy, steelBlue, periwinkle, paleBlue, midnightGreen, ming, celdonGreen, pewterBlue, darkerNavy]; 900var barBorderRadius = 5; 901var legendLabels = { padding: 50, boxWidth: 600, boxHeight: 20, useBorderRadius: !0, usePointStyle: !0, pointStyle: "rectRounded", borderRadius: 5, font: { size: 24 } }; 902 903// This is the function to build a vertical chart legend that typically sits to the left of the doughnut chart 904function verticalLegend(chartID, labelArray, dataArray, dataColors, tooltipLabel) { 905 jQuery(labelArray).each(function (index, element) { 906 let legendRow = '<tr class="vertical-labels"><td class="label-dot-big"><span style="background: ' + dataColors[index] + ';">â¢</span></td><td class="label-title">' + element + '</td><td class="values">' + dataArray[index].toLocaleString() + tooltipLabel + "</td>"; 907 jQuery("#" + chartID).append(legendRow); 908 console.log(legendRow); 909 }); 910} 911 912/************************************************************************************************************************************************************************ */ 913 914jQuery(document).ready(function () { 915 var i = 1, 916 selected = "selected"; 917 jQuery(".thirteen-f-charts").each(function () { 918 jQuery(this).attr("data-id", i); 919 jQuery(".slide-show-controls").append("<bullet class='thirteen-f-charts-controls " + selected + "' data-id='" + i + "'></bullet>"); 920 selected = ""; 921 i++; 922 }); 923 var baseHeight = jQuery(".thirteen-f-charts.starter").height() + 25; 924 jQuery(".thirteen-f-charts-wrapper").css("min-height", baseHeight + "px"); 925 jQuery(".thirteen-f-charts-wrapper .thirteen-f-charts:gt(0)").hide(); 926 927 function swappingChartsFunction() { 928 jQuery(".thirteen-f-charts-controls").removeClass("selected"); 929 930 jQuery(".thirteen-f-charts-wrapper .thirteen-f-charts:first").fadeOut(1000).next().fadeIn(1000).end().appendTo(".thirteen-f-charts-wrapper > .wp-block-group__inner-container"); 931 var dataID = jQuery(".thirteen-f-charts-wrapper .thirteen-f-charts:first").data("id"); 932 jQuery(".thirteen-f-charts-controls[data-id=" + dataID + "]").addClass("selected"); 933 } 934 935 var swappingCharts = setInterval(swappingChartsFunction, 5000); 936 937 jQuery(".thirteen-f-charts-controls").on("click", function () { 938 var selectedID = jQuery(this).data("id"); 939 var currentID = jQuery(".thirteen-f-charts-controls.selected").data("id"); 940 console.log("SelectedID : " + selectedID); 941 jQuery(".thirteen-f-charts-controls").removeClass("selected"); 942 jQuery(this).addClass("selected"); 943 //jQuery(".thirteen-f-charts-wrapper .thirteen-f-charts:first").fadeOut(1000); 944 jQuery(".thirteen-f-charts-wrapper .thirteen-f-charts[data-id=" + currentID + "]").fadeOut(1000); 945 jQuery(".thirteen-f-charts-wrapper .thirteen-f-charts[data-id=" + selectedID + "]").fadeIn(1000); 946 window.clearInterval(swappingCharts); 947 }); 948}); 949 950jQuery(document).ready(function () { 951 jQuery(".video-preview figure > a").each(function () { 952 jQuery(this).append('<div class="video-overlay"></div>'); 953 }); 954}); 955 956jQuery(document).ready(function ($) { 957 var navHeight = jQuery("header#masthead").height(), 958 elementPosition = navHeight + 75; 959 960 $(window).scroll(function () { 961 if ($(window).scrollTop() > navHeight) { 962 $("#contact-group") 963 .css("position", "fixed") 964 .css("top", elementPosition + "px"); 965 } else { 966 $("#contact-group").css("position", "static"); 967 } 968 }); 969});
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.