1var videoArray = []; 2var verticalAdjustment = 1.15; 3var myPlayer; 4var myPlayer2; 5var gxCollection = []; 6var activeGx = {}; 7var activeVideo = {}; 8var customizations = []; 9var defaultGX = '1715271907518'; // 1594579002397 this is the dynamodb ID not the GXID, grab it from the query string of the GXBuilder Preview or from Download. 10var gxId = getQueryString('v') || defaultGX; 11var mobileClose = document.getElementById('playerCloseT16'); 12var slideContent = "<h3>Slides may contain any html content.</h2><h3> Use the hotspot 'destination' property or Code Editor to specify what content to display here.</h3>"; 13var myArray = ["", "", "", "", ""]; 14 15//These 3 global arrays are used only for GA4 tracking of GX's with DD questions/answers. GX's without a DD component will ignore them along with the code block in the 'customEvent' hander below. 16var ddArray = []; 17var ddAnswerCodeArray = []; 18var ddAnswerTextArray = []; 19const apiKey = "wgg0OIz2sx10qPdkv3Im057U9YSyRnf257z7BRBr"; 20 21(function () { 22 console.log("GXBasecode version 2 - 2021.10.29"); 23 try { 24 if (gxId == '0' || gxId == '') { 25 alert("Please supply a DynamoDB ID for 'DefaultGX'. Grab it from the GXBuilder Dashboard or from Download."); 26 return; 27 } 28 var xhr = new XMLHttpRequest(); 29 var host; 30 var environmentString = location.hostname; 31 console.log("location is ", location); 32 if (environmentString.substring(0, 3) == "qa." || environmentString.substring(0, 9) == "localhost" || location.pathname.indexOf("/preview/") != -1) { 33 console.log("Viewing QA version of GX"); 34 host = "https://7z4yhdlqzi.execute-api.us-east-1.amazonaws.com/qa/gx/" + gxId; 35 } else if (environmentString.substring(0, 3) == "qc.") { 36 console.log("Viewing QC version of GX"); 37 host = "https://7z4yhdlqzi.execute-api.us-east-1.amazonaws.com/qa/gxqc/" + gxId; 38 } else { 39 console.log("Viewing PROD version of GX"); 40 host = "https://7z4yhdlqzi.execute-api.us-east-1.amazonaws.com/qa/gxprod/" + gxId; 41 } 42 xhr.open("GET", host, true); 43 xhr.setRequestHeader("X-API-Key", apiKey); 44 xhr.onreadystatechange = function () { 45 if (xhr.readyState == 2 && xhr.status != 200) { 46 console.log('not authorized'); 47 } else if (xhr.readyState == 2 && xhr.status == 200) { 48 var processed = true; 49 } 50 if (xhr.readyState == 4 && xhr.status == 200) { 51 try { 52 resp = JSON.parse(this.responseText); 53 } catch (e) { 54 alert("Valid DynamoDB ID required. Be sure your GX definition has been migrated to the appropriate environments in GXBuilder."); 55 return; 56 } 57 activeGx = JSON.parse(resp.definition); 58 59 console.log(activeGx.name + " | " + defaultGX); 60 //check for dynamic control bar 61 if (activeGx.dynamicControlBar == true) { 62 //do nothing 63 } else { 64 $('head').append('<link rel="stylesheet" type="text/css" href="css/controlBar.css">'); 65 } 66 67 //check for ccInMobile 68 if (activeGx.ccInMobile == true) { 69 $(".mobileButtonContainer").append('<span id="showCC" style="float:right" class="mobileButton primary" onclick="showCC()"></span>'); 70 } else { 71 //do nothing 72 } 73 74 //check for Modal Video Size 75 if (activeGx.modalVideoSize) { 76 $("#modalVideo .modal-validation").css("width", activeGx.modalVideoSize + "px"); 77 } else { 78 //do nothing. it will display at default size of 500 79 } 80 81 //check for embedded styles 82 $("<style type='text/css'>" + activeGx.styles + " </style>").appendTo("head"); 83 84 //The page title is set programatically by reading the HTMLTitle property of the GX, which is set in GXBuilder 85 document.title = activeGx.HTMLTitle || 'Define this in GX Properties'; 86 87 videoArray = activeGx.videos; 88 console.log("videoArray:", videoArray); 89 generateAllHotspots(); 90 91 $(".hotspotClass").on("click", function () { 92 if ($(this).attr("data-type") == 'skip') { 93 ga('send', 'event', 'Alight Video Events', 'seek', "null" + " | " + activeGx.name + " | " + activeGx.id + " | " + myPlayer.mediainfo.name, { 'nonInteraction': 0 }); 94 myPlayer.currentTime($(this).attr("data-target")); 95 myPlayer.play(); 96 } else if ($(this).attr("data-type") == 'externalURL') { 97 //event tracking 98 ga('send', 'event', 'Outbound', 'Clicked', $(this).attr("data-target"), { 'nonInteraction': 0 }); 99 console.log("Navigate to external url: " + $(this).attr("data-target")); 100 myPlayer.pause(); 101 window.open($(this).attr("data-target")); 102 } else if ($(this).attr("data-type") == 'localFile') { 103 //event tracking 104 var testString = $(this).attr("data-target").toUpperCase(); 105 if (testString.includes(".PDF")) { 106 ga('send', 'event', 'PDF', 'Clicked', $(this).attr("data-target"), { 'nonInteraction': 0 }); 107 } else if (testString.includes(".DOC") || testString.includes(".XLS") || testString.includes(".PPT")) { 108 ga('send', 'event', 'Media', 'Clicked', $(this).attr("data-target"), { 'nonInteraction': 0 }); 109 } 110 console.log("Navigate to local file: " + $(this).attr("data-target")); 111 myPlayer.pause(); 112 window.open($(this).attr("data-target")); 113 } else if ($(this).attr("data-type") == 'showSlideInfo') { 114 //console.log("Showing Slide Over"); 115 myPlayer.pause(); 116 switch ($(this).attr("data-target")) { 117 case 'sampleSlideContent1': //Example of how to define custom content in the slide-over pane. 118 $("#slideContent").html("Custom Content 1"); 119 break; 120 case 'sampleSlideContent2': 121 $("#slideContent").html("Custom Content 2"); 122 break; 123 case 'sampleSlideContent3': 124 $("#slideContent").html("Custom Content 3"); 125 break; 126 default: 127 $("#slideContent").html(); 128 } 129 $("#slideInfo").slideDown("fast"); 130 } else if ($(this).attr("data-type") == 'modalVideo') { 131 myPlayer.pause(); 132 $("#modalVideo").modal(); 133 134 //this code allows modal videos to show even in full screen mode 135 if (inFullScreen == true) { 136 closeFullscreen(); 137 inFullScreen = false;
138 fullScreenClosedToShowModal = true; 139 var e = document.getElementsByClassName("modal")[0]; 140 if (e.requestFullscreen) { 141 //console.log("Trying to make modal fullscreen"); 142 e.requestFullscreen(); 143 } 144 } 145 146 //send video name to the console for QA purposes: 147 for (var i = 0; i < activeGx.videos.length; i++) { 148 149 150 if (activeGx.videos[i].brightcoveVideoId == $(this).attr("data-target")) { 151 console.log("Loading Modal: ", activeGx.videos[i].brightcoveVideoName); 152 break; 153 } 154 } 155 myPlayer2.catalog.getVideo($(this).attr("data-target"), function (error, video) { 156 if (!error) { 157 myPlayer2.catalog.load(video); 158 myPlayer2.currentTime("0"); 159 myPlayer2.play(); 160 } else { 161 console.log("Error with modal video"); 162 } 163 }); 164 165 myPlayer2.on('firstplay', function () { 166 ga('send', 'event', 'Alight Video Events', 'first play', "null" + " | " + activeGx.name + " | " + activeGx.id + " | " + myPlayer2.mediainfo.name + " | " + myPlayer2.mediainfo.description, { 'nonInteraction': 0 }); 167 }); 168 169 170 } else if ($(this).attr("data-type") == 'externalVideo') { 171 if ($(this).attr("data-target") != "0") { //Test to see if target has been defined 172 for (var i = 0; i < videoArray.length; i++) { 173 if (videoArray[i].brightcoveVideoId == $(this).attr("data-target")) { 174 //send video name to the console for QA purposes: 175 console.log("Using externalVideo handler to Change video to " + $(this).attr("data-target") + " - " + videoArray[i].brightcoveVideoName); 176 } 177 } 178 changeVideo($(this).attr("data-target")); // Call changeVideo here or below but not both. 179 } else { 180 //Target has not been defined 181 if (location.pathname.indexOf("/preview/") != -1) { 182 message = "Hotspot NavType is 'externalVideo' however no Destination is selected."; 183 } else { 184 message = "Hotspot NavType is 'externalVideo' however no Destination is selected."; 185 } 186 alert(message); 187 } 188 189 } else if ($(this).attr("data-type") == 'customEvent') { 190 191 //Google Analytics 4 will use the following if statement to populate and extract tracking data added to the 'Data' field of a hotspot in GXBuilder. 192 //If this is not a Decision Direct GX or if the Data field is used for some other purpose this code block and the three arrays are ignored. 193 //See the sharepoint for info on how to use GA4 with GXBuilder and the 'Data' field of a hotspot. 194 //This code block could alternatively be used in the above 'externalVideo' handler if hotspot navigation uses that method rather than 'customEvent'. 195 if ($(this).attr('data-data').includes('dd')) { 196 ddArray.push($(this).attr('data-data')); 197 var dd = []; 198 dd = $(this).attr('data-data').split('|'); 199 ddAnswerCodeArray.push(dd[1].trim()); 200 ddAnswerTextArray.push(dd[2].trim()); 201 console.log("ddAnswerCodeArray: ", ddAnswerCodeArray); 202 console.log("ddAnswerTextArray: ", ddAnswerTextArray); 203 console.log("ddArray: ", ddArray); 204 }; 205 206 207 switch ($(this).attr('data-target')) { 208 209 210 case "q10": //30 and under //why assign array position 1 here? 211 //myArray.splice(1, 1, "<"); 212 213 214 changeVideo("6354701154112"); 215 ddAnswerCodeArray.push("1a"); 216 ddAnswerTextArray.push("30 and under"); 217 break; 218 219 // case "q11": //26-30 suppressed 220 // //myArray.splice(1, 1, "<"); 221 // changeVideo("q2b"); 222 // break; 223 224 225 case "q12": //31-35 226 changeVideo("6354701538112"); //New video for 2022 227 ddAnswerCodeArray.push("1b"); 228 ddAnswerTextArray.push("31 to 35"); 229 break; 230 case "q13": //36-40 231 changeVideo("6354700259112"); //New video for 2022 232 ddAnswerCodeArray.push("1c"); 233 ddAnswerTextArray.push("36 to 40"); 234 break; 235 case "q14": //41-45 236 changeVideo("6354699865112"); //New video for 2022 237 ddAnswerCodeArray.push("1d"); 238 ddAnswerTextArray.push("41 to 45"); 239 break; 240 case "q15": //46-50 241 changeVideo("6354698984112"); //New video for 2022 242 ddAnswerCodeArray.push("1e"); 243 ddAnswerTextArray.push("46 to 50"); 244 break; 245 case "q16": //51-55 246 changeVideo("6354701046112"); //New video for 2022 247 ddAnswerCodeArray.push("1f"); 248 ddAnswerTextArray.push("51 to 55"); 249 break; 250 case "q17": //56-60 251 changeVideo("6354700359112"); //New video for 2022 252 ddAnswerCodeArray.push("1g"); 253 ddAnswerTextArray.push("56 to 60"); 254 break; 255 case "q18": //61+ 256 changeVideo("6354698985112"); //New video for 2022 257 ddAnswerCodeArray.push("1h"); 258 ddAnswerTextArray.push("60+"); 259 break; 260 261 262 //in assigning values to the array use this mapping for all the questions that follow: 263 //bubble chart blue circle: 'I' - Investment plan recommended 264 //bubble chart purple circle: 'P' - Pension plan recommended 265 //bubble chart yellow circle: '?' - Neither plan can be recommended 266 //'<' or '+' Less than 8 or 8+ years of service 267 268 269 //--------------------------------------------------------------------------------<30 years old scenario 270 //These cases are possible on video q2a_2022: 271 //How long will you be working for FRS 1 . Answering this question will set the array value for positions 0 and 1 272 case "a1": 273 myArray.splice(0, 1, "I"); 274 myArray.splice(1, 1, "<"); 275 changeVideo("6354699070112"); 276 277 ddAnswerCodeArray.push("2v1a"); 278 ddAnswerTextArray.push("Less than 8 years"); 279 280 break; 281 case "a2": 282 myArray.splice(0, 1, "I"); 283 myArray.splice(1, 1, "+"); 284 changeVideo("6354699070112"); 285 286 ddAnswerCodeArray.push("2v1b"); 287 ddAnswerTextArray.push("More than 8 years"); 288 289 break; 290 //--------------------------------------------------------------------------------26-30 years old scenario 291 292 293 //--------------------------------------------------------------------------------------31-35 years old scenario 294 //These cases are possible on video q2c_2022: 295 //How long will you be working for FRS 3 296 case "c1": 297 myArray.splice(0, 1, "I"); 298 myArray.splice(1, 1, "<"); 299 changeVideo("6354699070112"); 300 301 ddAnswerCodeArray.push("2v3a"); 302 ddAnswerTextArray.push("Less than 8 years"); 303 304 break; 305 306 case "c2": 307 myArray.splice(0, 1, "I"); 308 myArray.splice(1, 1, "+"); 309 changeVideo("6354699070112"); 310 311 ddAnswerCodeArray.push("2v3b"); 312 ddAnswerTextArray.push("More than 8 years"); 313 314 break; 315 316 //-------------------------------------------------------------------------------------36-40 years old scenario 317 //These cases are possible on video q2d_2023: 318 //How long will you be working for FRS 4 319 case "d1": 320 myArray.splice(0, 1, "I"); 321 myArray.splice(1, 1, "<"); 322 changeVideo("6354699070112"); 323 324 ddAnswerCodeArray.push("2v4a"); 325 ddAnswerTextArray.push("Less than 8 years"); 326 327 break; 328 case "d2": 329 myArray.splice(0, 1, "I"); 330 myArray.splice(1, 1, "+"); 331 332 changeVideo("6354699070112"); 333 334 ddAnswerCodeArray.push("2v4b"); 335 ddAnswerTextArray.push("More than 8 years"); 336 337 break; 338 339 340 //------------------------------------------------------------41-45 years old scenario 341 //These cases are possible on video q2e_2023: 342 //How long will you be working for FRS 5 343 case "e1": 344 myArray.splice(0, 1, "I"); 345 myArray.splice(1, 1, "<"); 346 changeVideo("6354699070112"); 347 348 ddAnswerCodeArray.push("2v5a"); 349 ddAnswerTextArray.push("Less than 8 years"); 350 351 break; 352 case "e2": 353 myArray.splice(0, 1, "I"); 354 myArray.splice(1, 1, "+"); 355 356 changeVideo("6354699070112"); 357 358 ddAnswerCodeArray.push("2v5b"); 359 ddAnswerTextArray.push("8 to 35 years"); 360 361 break; 362 case "e3": 363 myArray.splice(0, 1, "?"); 364 myArray.splice(1, 1, "+"); 365 366 changeVideo("6354699070112"); 367 368 ddAnswerCodeArray.push("2v5c"); 369 ddAnswerTextArray.push("More than 35 years"); 370 371 break; 372 373 374 //---------------------------------------------------------------------------46-50 years old scenario 375 //These cases are possible on video q2f_2023: 376 //How long will you be working for FRS 6 377 378 case "f1": 379 myArray.splice(0, 1, "I"); 380 myArray.splice(1, 1, "<"); 381 changeVideo("6354699070112"); 382 383 ddAnswerCodeArray.push("2v6a"); 384 ddAnswerTextArray.push("Less than 8 years"); 385 386 break; 387 case "f2": 388 myArray.splice(0, 1, "I"); 389 myArray.splice(1, 1, "+"); 390 391 changeVideo("6354699070112"); 392 393 ddAnswerCodeArray.push("2v6b"); 394 ddAnswerTextArray.push("8 to 35 years"); 395 396 break; 397 case "f3": 398 myArray.splice(0, 1, "?"); 399 myArray.splice(1, 1, "+"); 400 401 changeVideo("6354699070112"); 402 403 ddAnswerCodeArray.push("2v6c"); 404 ddAnswerTextArray.push("More than 35 years"); 405 406 break; 407 408 //-----------------------------------------------------------------------------51-55 years old scenario 409 //These cases are possible on video q2g_2022: 410 //How long will you be working for FRS 7 411 412 case "g1": 413 myArray.splice(0, 1, "I"); 414 myArray.splice(1, 1, "<"); 415 changeVideo("6354699070112"); 416 417 ddAnswerCodeArray.push("2v7a"); 418 ddAnswerTextArray.push("Less than 8 years"); 419 420 break; 421 case "g2": 422 myArray.splice(0, 1, "?"); 423 myArray.splice(1, 1, "+"); 424 425 changeVideo("6354699070112"); 426 427 428 ddAnswerCodeArray.push("2v7b"); 429 ddAnswerTextArray.push("8 to 14 years"); 430 431 break; 432 case "g3": 433 myArray.splice(0, 1, "I"); 434 myArray.splice(1, 1, "+"); 435 changeVideo("6354699070112"); 436 437 438 ddAnswerCodeArray.push("2v7c"); 439 ddAnswerTextArray.push("15 to 35 years"); 440 441 break; 442 case "g4": 443 myArray.splice(0, 1, "?"); 444 myArray.splice(1, 1, "+"); 445 446 changeVideo("6354699070112"); 447 448 449 ddAnswerCodeArray.push("2v7d"); 450 ddAnswerTextArray.push("More than 35 years"); 451 452 break; 453 454 455 //----------------------------------------------------------------------------------56-60 years old scenario 456 //These cases are possible on video q2h_2023: 457 //How long will you be working for FRS 7 458 459 case "h1": 460 myArray.splice(0, 1, "I"); 461 myArray.spl
461ice(1, 1, "<"); 462 changeVideo("6354699070112"); 463 464 465 ddAnswerCodeArray.push("2v8a"); 466 ddAnswerTextArray.push("Less than 8 years"); 467 468 break; 469 case "h2": 470 myArray.splice(0, 1, "?"); 471 myArray.splice(1, 1, "+"); 472 473 changeVideo("6354699070112"); 474 475 ddAnswerCodeArray.push("2v8b"); 476 ddAnswerTextArray.push("8 to 19 years"); 477 478 break; 479 case "h3": 480 myArray.splice(0, 1, "I"); 481 myArray.splice(1, 1, "+"); 482 483 changeVideo("6354699070112"); 484 485 ddAnswerCodeArray.push("2v8c"); 486 ddAnswerTextArray.push("20 to 30 years"); 487 488 break; 489 case "h4": 490 myArray.splice(0, 1, "?"); 491 myArray.splice(1, 1, "+"); 492 493 changeVideo("6354699070112"); 494 495 ddAnswerCodeArray.push("2v8d"); 496 ddAnswerTextArray.push("More than 30 years"); 497 498 break; 499 500 501 //--------------------------------------------------------------------------61+ Years old scenario 502 //These cases are possible on video q2i_2022: 503 504 case "i1": 505 myArray.splice(0, 1, "I"); 506 myArray.splice(1, 1, "<"); 507 508 changeVideo("6354699070112"); 509 510 ddAnswerCodeArray.push("2v9a"); 511 ddAnswerTextArray.push("Less than 8 years"); 512 513 break; 514 case "i2": 515 myArray.splice(0, 1, "?"); 516 myArray.splice(1, 1, "+"); 517 518 changeVideo("6354699070112"); 519 520 ddAnswerCodeArray.push("2v9b"); 521 ddAnswerTextArray.push("More than 8 years"); 522 523 break; 524 525 526 527 528 //questions 3-5 follow and have only 2 possibilities each: 529 530 case "q31": 531 myArray.splice(2, 1, "I"); 532 changeVideo("6354701244112"); 533 534 ddAnswerCodeArray.push("3a"); 535 ddAnswerTextArray.push("Yes, I'd like to manage my investments myself."); 536 537 break; 538 case "q32": 539 myArray.splice(2, 1, "P"); 540 changeVideo("6354701244112"); 541 542 ddAnswerCodeArray.push("3b"); 543 ddAnswerTextArray.push("No, I don't want to have to deal with any investments."); 544 545 break; 546 547 548 549 //Are you comfortable with ups and downs? affects array item 3 550 case "q41": 551 myArray.splice(3, 1, "I"); 552 changeVideo("6354699670112"); 553 554 ddAnswerCodeArray.push("4a"); 555 ddAnswerTextArray.push("Yes, I understand that investing is for the long term."); 556 557 break; 558 case "q42": 559 myArray.splice(3, 1, "P"); 560 changeVideo("6354699670112"); 561 562 ddAnswerCodeArray.push("4a"); 563 ddAnswerTextArray.push("No, even though there is an upside to investing, I'm not comfortable with the risk."); 564 565 break; 566 567 568 569 //do you want flexibility? affects array item 4 570 case "q51": 571 myArray.splice(4, 1, "I"); 572 changeVideo("6354775533112"); 573 //console.log("Now match this result array with the documentation to find the right result video:"); 574 575 ddAnswerCodeArray.push("5a"); 576 ddAnswerTextArray.push("I want to create my own payment plan."); 577 578 break; 579 case "q52": 580 myArray.splice(4, 1, "P"); 581 changeVideo("6354775533112"); 582 //console.log("Now match this result array with the documentation to find the right result video:"); 583 584 ddAnswerCodeArray.push("5b");
585 ddAnswerTextArray.push("I'm ok with the monthly benefit. I don't need other options."); 586 587 break; 588 589 590 591 592 default: 593 if (location.pathname.indexOf('/preview/') != -1) { 594 alert('Custom events are defined by a developer on the host site. They are not triggered on the Preview site unless defined in the code editor.'); 595 } else { 596 alert('Hotspot NavType is Custom Event. Please define an event handler for this Custom Event'); 597 } 598 } 599 600 } else { 601 alert("Please select a NavType for the hotspot."); 602 } 603 }); 604 605 videojs.getPlayer('myPlayerID2').ready(function () { 606 myPlayer2 = this; 607 608 //check for Control Bar on modal 609 if (activeGx.controlBarOnModal == true) { 610 $("#myPlayerID2 .vjs-control-bar").css("display", "flex"); 611 } else { 612 $("#myPlayerID2 .vjs-control-bar").css("display", "none"); 613 } 614 myPlayer2.pause(); 615 }) 616 617 videojs.getPlayer('myPlayerID').ready(function () { 618 619 myPlayer = this; 620 //if the GX has a variable start video determine the video now and assign it to activeGx.startVideo. Otherwise the start video defined in GXBuilder will be used. 621 myPlayer.catalog.getVideo(activeGx.startVideo || activeGx.videos[0].brightcoveVideoId, function (error, video) { 622 if (!error) { 623 $(".video-js .vjs-tech").css("opacity", "0"); 624 625 myPlayer.catalog.load(video); 626 resetActiveVideo(); 627 $("#video, .containing-block").fadeIn(400); 628 for (i = 0; i < video.sources.length; i++) { 629 var videoWidth = video.sources[i].width; 630 var videoHeight = video.sources[i].height; 631 if (videoWidth && videoHeight) { 632 break; 633 } 634 } 635 var paddingTop = (videoHeight / videoWidth) * 100 > 56.25 ? 75 : 56.25; 636 $('body .outer-container').css('padding-top', paddingTop + '%'); 637 myPlayer.play(); 638 } else { 639 console.log("Error with video"); 640 } 641 }); 642 643 myPlayer.on('loadeddata', function () { 644 $("#hotspotHolder").show(); 645 646 $(".video-js .vjs-tech").css("opacity", "1"); 647 }) 648 649 650 myPlayer.on('timeupdate', function () { 651 var vidCurrentTime = myPlayer.currentTime(); 652 $("div[data-parent].hotspotClass").hide(); 653 $("div[data-parent]").filter(function () { 654 return $(this).attr("data-parent") === myPlayer.mediainfo.id; 655 }).filter(function () { 656 return $(this).attr("data-starttime") < vidCurrentTime && $(this).attr("data-endtime") > vidCurrentTime; 657 }).show(); 658 659 660 $("div[data-parent]").filter(function () { 661 return $(this).attr("data-parent") === myPlayer.mediainfo.id; 662 }).filter(function () { 663 return $(this).attr("data-starttime") < vidCurrentTime && $(this).attr("data-endtime") > vidCurrentTime; 664 }).show(); 665 666 667 668 669 if (vidCurrentTime > activeVideo.showIntermediate) { 670 $("#intermediateLayer").show(); 671 $(".layerPane[data-panename='" + myPlayer.mediainfo.name + "']").show(); 672 673 } else { 674 $("#intermediateLayer").hide(); 675 $(".layerPane").hide(); 676 677 } 678 679 680 681 682 //These events are for GA event tracking: 683 if ((vidCurrentTime > activeVideo.recycleTo / 4) && !(checked25 == true)) { 684 checked25 = true; 685 ga('send', 'event', 'Alight Video Events', '25% watched', "null" + " | " + activeGx.name + " | " + activeGx.id + " | " + myPlayer.mediainfo.name + " | " + myPlayer.mediainfo.description, { 'nonInteraction': 0 }); 686 } 687 if ((vidCurrentTime > activeVideo.recycleTo / 2) && !(checked50 == true)) { 688 checked50 = true; 689 ga('send', 'event', 'Alight Video Events', '50% watched', "null" + " | " + activeGx.name + " | " + activeGx.id + " | " + myPlayer.mediainfo.name + " | " + myPlayer.mediainfo.description, { 'nonInteraction': 0 }); 690 } 691 if ((vidCurrentTime > activeVideo.recycleTo / 1.3) && !(checked75 == true)) { 692 checked75 = true; 693 ga('send', 'event', 'Alight Video Events', '75% watched', "null" + " | " + activeGx.name + " | " + activeGx.id + " | " + myPlayer.mediainfo.name + " | " + myPlayer.mediainfo.description, { 'nonInteraction': 0 }); 694 } 695 if ((vidCurrentTime > activeVideo.recycleTo) && !(checkedEnded == true)) { 696 checkedEnded = true; 697 ga('send', 'event', 'Alight Video Events', 'ended', "null" + " | " + activeGx.name + " | " + activeGx.id + " | " + myPlayer.mediainfo.name + " | " + myPlayer.mediainfo.description, { 'nonInteraction': 0 }); 698 } 699 }); 700 701 myPlayer.on('ended', function () { 702 console.log("Video ended"); 703 704 for (var i = 0; i < videoArray.length; i++) { 705 if (videoArray[i].brightcoveVideoId == myPlayer.mediainfo.id && videoArray[i].recycleTo != "") { 706 console.log("Processing end of video for id ", videoArray[i].brightcoveVideoId); 707 708 if (typeof (videoArray[i].recycleTo) == "number" && videoArray[i].recycleTo.toString().length < 13) { 709 console.log("this could not be a video number - treat it as a timing instead"); 710 myPlayer.currentTime(videoArray[i].recycleTo); 711 myPlayer.play(); 712 713 } else if (typeof (videoArray[i].recycleTo) == "number" && videoArray[i].recycleTo.toString().length == 13) { 714 console.log("This must be a Brightcove video id number. load this video"); 715 changeVideo(videoArray[i].recycleTo); //allows you to enter a video number - in the case of proceeding to another video after this one has ended, or to another time in the current video. Long numbers are treated as the former and short numbers are the latter. 716 } else if (typeof (videoArray[i].recycleTo) == "number" && videoArray[i].recycleTo == 100000000000000) { 717 showResults(); 718 } else { 719 720 console.log("Error with recycle value") 721 } 722 return; 723 } else { 724 // 725 } 726 } 727 }); 728 myPlayer.on('firstplay', function () { 729 ga('send', 'event', 'Alight Video Events', 'first play', "null" + " | " + activeGx.name + " | " + activeGx.id + " | " + myPlayer.mediainfo.name + " | " + myPlayer.mediainfo.description, { 'nonInteraction': 0 }); 730 }); 731 myPlayer.on('play', function () { 732 $('#play_pause').addClass('secondary'); 733 ga('send', 'event', 'Alight Video Events', 'play', "null" + " | " + activeGx.name + " | " + activeGx.id + " | " + myPlayer.mediainfo.name + " | " + myPlayer.mediainfo.description, { 'nonInteraction': 0 }); 734 }); 735 myPlayer.on('pause', function () { 736 $('#play_pause').removeClass('secondary'); 737 ga('send', 'event', 'Alight Video Events', 'pause', "null" + " | " + activeGx.name + " | " + activeGx.id + " | " + myPlayer.mediainfo.name + " | " + myPlayer.mediainfo.description, { 'nonInteraction': 0 }); 738 }); 739 740 //injection point of onboard scripts: 741 var script = document.createElement("script"); 742 script.text = activeGx.code; 743 document.body.appendChild(script).parentNode.removeChild(script); 744 745 }); 746 } else if (processed && xhr.readyState == 4 && xhr.status != 200) { 747 console.log("notAuthorized.html?source=validator3"); 748 } 749 }; 750 xhr.send(); 751 } catch (err) { 752 console.log(err); 753 } 754})(); 755 756mobileClose.onclick = function (e) { 757 myPlayer2.pause(); 758 myPlayer.play(); 759 $("#modalVideo").modal("hide"); 760 761 //now repeat the full screen code from below returning it to full screen 762 if (fullScreenClosedToShowModal == true) { 763 if (inFullScreen == false) { 764 var f = document.getElementsByClassName("video")[0]; 765 if (f.requestFullscreen) { 766 f.requestFullscreen(); 767 } else if (f.mozRequestFullScreen) { /* Firefox */ 768 f.mozRequestFullScreen(); 769 } else if (f.webkitRequestFullscreen) { /* Chrome, Safari & Opera */ 770 f.webkitRequestFullscreen(); 771 } else if (f.msRequestFullscreen) { /* IE/Edge */ 772 f.msRequestFullscreen(); 773 } 774 inFullScreen = true; 775 return; 776 } else if (inFullScreen == true) { 777 closeFullscreen(); 778 inFullScreen = false;
779 } 780 } 781 782} 783 784function getQueryString(key) { //This function is used by the preview site. Other sites should use defaultGX value. 785 var reg = new RegExp('[?&]' + key + '=([^&#]*)', 'i'); 786 var tempString = reg.exec(window.location.href); 787 return tempString ? tempString[1].replace(/%20/gi, '').toUpperCase() : null; 788} 789 790function generateAllHotspots() { 791 var hotspotHolder = document.getElementById('hotspotHolder'); 792 793 for (var i = 0; i < videoArray.length; i++) { 794 for (var j = 0; j < videoArray[i].hotspots.length; j++) { 795 var hotSpotDiv = document.createElement('div'); 796 hotSpotDiv.setAttribute('id', videoArray[i].hotspots[j].id); 797 hotSpotDiv.classList.add("hotspotClass"); 798 hotSpotDiv.classList.add("embed-responsive"); 799 hotSpotDiv.classList.add("embed-responsive-16by9"); 800 hotSpotDiv.classList.add("overlayBase"); 801 hotSpotDiv.setAttribute('tabindex', "0"); 802 803 hotSpotDiv.setAttribute('align', "left"); 804 805 hotSpotDiv.setAttribute('onkeydown', "if (event.keyCode == 13){document.getElementById('" + videoArray[i].hotspots[j].id + "').click()}"); 806 hotSpotDiv.setAttribute('style', "display:none"); 807 hotSpotDiv.setAttribute('tabindex', 1); 808 hotSpotDiv.setAttribute('data-parent', videoArray[i].brightcoveVideoId); 809 hotSpotDiv.setAttribute('data-startTime', videoArray[i].hotspots[j].startTime); 810 if (videoArray[i].hotspots[j].autoEnd == "true") { 811 hotSpotDiv.setAttribute('data-endTime', Math.trunc(videoArray[i].duration / 1000)); 812 } else { 813 hotSpotDiv.setAttribute('data-endTime', videoArray[i].hotspots[j].endTime); 814 } 815 hotSpotDiv.setAttribute('data-data', videoArray[i].hotspots[j].data); 816 hotSpotDiv.setAttribute('data-type', videoArray[i].hotspots[j].navType); 817 hotSpotDiv.setAttribute('data-target', videoArray[i].hotspots[j].targetBrightcoveVideoId); 818 hotSpotDiv.style.left = videoArray[i].hotspots[j].left + '%'; 819 hotSpotDiv.style.top = videoArray[i].hotspots[j].top * verticalAdjustment + '%'; 820 hotSpotDiv.style.width = videoArray[i].hotspots[j].width + '%'; 821 hotSpotDiv.style.height = videoArray[i].hotspots[j].height * verticalAdjustment + '%'; 822 hotSpotDiv.classList.add('hotspotBaseClass'); 823 824 var classArray = videoArray[i].hotspots[j].class.split(" "); 825 classArray.forEach(function (item, index) { 826 if (item !== "") { 827 hotSpotDiv.classList.add(item); 828 } 829 }); 830 var textContainer = videoArray[i].hotspots[j].caption; 831 hotSpotDiv.innerHTML += "<span>" + textContainer + "</span>"; 832 hotspotHolder.appendChild(hotSpotDiv); 833 } 834 } 835 836 //now add the dynamic scripts defined by GXBuilder Code Editor - if any 837 //var script = document.createElement("script"); 838 //script.text = activeGx.code; 839 //document.body.appendChild(script).parentNode.removeChild(script); 840 841 if (activeGx.adaCompliant == true) { 842 $(".hotspotClass").addClass('adaCompliant'); 843 } else { 844 $(".hotspotClass").addClass('nonAdaCompliant'); 845 } 846 847 //now apply the built in styles: 848 $(".answerText").wrapInner("<span style='display:block; overflow:hidden'></span>"); 849 $(".questionText").css("font-weight", "bold"); 850 $(".noCaption").html(""); 851 $(".centerCaption").css("text-align", "center"); 852 853 //move the real fullscreen button off the player. this is needed to allow fullscreen mode of the player and html overlay 854 $(".vjs-fullscreen-control").css("display", "none"); 855 856 //replace it with a false fullscreen button 857 var t = '<button id="falseFullscreen" class="vjs-fullscreen-control vjs-control vjs-button" type="button" title="Fullscreen" aria-disabled="false"><span aria-hidden="true" class="vjs-icon-placeholder"></span><span class="vjs-control-text" aria-live="polite">Fullscreen</span></button>'; 858 $(t).insertBefore("#myPlayerID .vjs-fullscreen-control"); 859 860 inFullScreen = false;
861 $("#falseFullscreen").on("click", function () { 862 if (inFullScreen == false) { 863 864 console.log("Going to fullscreen mode"); 865 $("#intermediateLayer").addClass('intermediateLayerFullScreen'); 866 867 var f = document.getElementsByClassName("video")[0]; 868 if (f.requestFullscreen) { 869 f.requestFullscreen(); 870 } else if (f.mozRequestFullScreen) { /* Firefox */ 871 f.mozRequestFullScreen(); 872 } else if (f.webkitRequestFullscreen) { /* Chrome, Safari & Opera */ 873 f.webkitRequestFullscreen(); 874 } else if (f.msRequestFullscreen) { /* IE/Edge */ 875 f.msRequestFullscreen(); 876 } 877 inFullScreen = true; 878 return; 879 } else if (inFullScreen == true) { 880 881 console.log("Going to smallscreen mode"); 882 $("#intermediateLayer").removeClass('intermediateLayerFullScreen'); 883 884 closeFullscreen(); 885 inFullScreen = false; 886 } 887 }); 888} 889 890function play_pause() { 891 if (myPlayer.paused()) { 892 myPlayer.play(); 893 } else { 894 myPlayer.pause(); 895 } 896} 897 898function mute_unmute() { 899 $('#mute_unmute').toggleClass('secondary'); 900 if (myPlayer.muted()) { 901 myPlayer.muted(false); 902 } else { 903 myPlayer.muted(true); 904 } 905} 906 907function showCC() { 908 $('.vjs-menu').css("opacity", "1"); 909 $('.vjs-subs-caps-button').trigger('click'); 910} 911 912function closeFullscreen() { 913 if (document.exitFullscreen) { 914 document.exitFullscreen(); 915 } else if (document.mozCancelFullScreen) { /* Firefox */ 916 document.mozCancelFullScreen(); 917 } else if (document.webkitExitFullscreen) { /* Chrome, Safari and Opera */ 918 document.webkitExitFullscreen(); 919 } else if (document.msExitFullscreen) { /* IE/Edge */ 920 document.msExitFullscreen(); 921 } 922} 923 924function myIsNumeric(str) { 925 if (typeof str != "string") return false // we only process strings! 926 return !isNaN(str) && // use type coercion to parse the _entirety_ of the string (`parseFloat` alone does not do this)... 927 !isNaN(parseFloat(str)) // ...and ensure strings of whitespace fail 928} 929 930function changeVideo(videoId) { 931 if (myIsNumeric(videoId)) { 932 for (var i = 0; i < activeGx.videos.length; i++) { 933 if (activeGx.videos[i].brightcoveVideoId == videoId) { 934 console.log("Navigating to ", activeGx.videos[i].brightcoveVideoName); 935 break; 936 } 937 } 938 // an id is provided rather than a name, no conversion needed 939 } else { 940 // a name is provided, conversion to id needed 941 for (var i = 0; i < activeGx.videos.length; i++) { 942 if (activeGx.videos[i].brightcoveVideoName == videoId) { 943 console.log("Navigating to ", activeGx.videos[i].brightcoveVideoName); 944 945 videoId = activeGx.videos[i].brightcoveVideoId; 946 break; 947 } 948 } 949 } 950 951 myPlayer.catalog.getVideo(videoId, function (error, video) { 952 //console.log("Setting transparency to 0 for white background Change video begin"); 953 $(".video-js .vjs-tech").css("opacity", "0"); 954 myPlayer.catalog.load(video); 955 resetActiveVideo(); 956 }); 957 myPlayer.on('loadeddata', function () { 958 //console.log("Setting transparency to 1 for white background Complete change video loadedmetadata"); 959 $(".video-js .vjs-tech").css("opacity", "1"); 960 }) 961} 962 963function resetActiveVideo() { //needed for ga events on the video 964 var y = myPlayer.mediainfo.id; 965 for (var i = 0; i < activeGx.videos.length; i++) { 966 if (activeGx.videos[i].brightcoveVideoId == y) { 967 activeVideo = activeGx.videos[i]; 968 } 969 } 970 checked25 = false; 971 checked50 = false; 972 checked75 = false; 973 checkedEnded = false; 974} 975 976function showSlideInfo() { 977 //$("#slideInfo").slideDown("fast"); 978 $("#slideInfo").animate({ width: 'toggle' }, 350); 979} 980 981$("#btnDismissInfo").on("click", function () { 982 $("#slideInfo").slideUp("fast"); 983 myPlayer.play(); 984}) 985 986//This code block supports the optional accordion feature. 987var accordionId = '#accordion'; 988$("a[href='#top']").click(function () { 989 $('html, body').animate({ scrollTop: 0 }, 'slow'); 990 return false;
991}); 992 993$('#accordion').on('click', '.toggle-accordion.active', function () { 994 //console.log("Accordion id ", accordionId); 995 closeAllPanels(accordionId); 996 $('.toggle-accordion').removeClass('active'); 997 $('.toggle-accordion').addClass('notActive'); 998}); 999 1000$('#accordion').on('click', '.toggle-accordion.notActive', function () { 1001 //console.log("Accordion id ", accordionId); 1002 openAllPanels(accordionId); 1003 $('.toggle-accordion').removeClass('notActive'); 1004 $('.toggle-accordion').addClass('active'); 1005}); 1006 1007$('.collapse') 1008 .on('shown.bs.collapse', function () { 1009 //console.log("Section1"); 1010 var count = 0; 1011 $(accordionId + ' .panel').each(function (index) { 1012 if ($(this).is(':visible')) count++; 1013 }); 1014 var numPanelClosed = count - $(accordionId + ' .collapse.in').length; //to manage hidden accordions 1015 //console.log( 1016 // count, 1017 // numPanelClosed, 1018 // $(accordionId + ' .panel-collapse:not(".in")').length 1019 //); 1020 if (numPanelClosed == 0) { 1021 $('.toggle-accordion').removeClass('notActive'); 1022 $('.toggle-accordion').addClass('active'); 1023 } 1024 }) 1025 .on('hidden.bs.collapse', function () { 1026 //console.log("Section2"); 1027 1028 var count = 0; 1029 $(accordionId + ' .panel').each(function (index) { 1030 if ($(this).is(':visible')) count++; 1031 }); 1032 var numPanelOpen = 1033 count - $(accordionId + ' .panel-collapse:not(".in")').length; //to manage hidden accordions 1034 //console.log( 1035 // count, 1036 // numPanelOpen, 1037 // $(accordionId + ' .panel-collapse.in').length 1038 //); 1039 if (numPanelOpen == 0) { 1040 $('.toggle-accordion').removeClass('active'); 1041 $('.toggle-accordion').addClass('notActive'); 1042 } 1043 }); 1044 1045openAllPanels = function (aId) { 1046 //console.log('setAllPanelOpen ', aId); 1047 $(aId + ' .panel-collapse:not(".show")').collapse('show'); 1048}; 1049 1050closeAllPanels = function (aId) { 1051 //console.log('setAllPanelclose ', aId); 1052 $(aId + ' .panel-collapse.show').collapse('hide'); 1053}; 1054 1055function showResults() { 1056 console.log("myArray", myArray); 1057 a = myArray[0]; 1058 b = myArray[1]; 1059 c = myArray[2]; 1060 d = myArray[3]; 1061 e = myArray[4]; 1062 1063 if (a == "I" && b == "<" && c == "I" && d == "I" && e == "I") { // is listed in the documentation result column as 'IP-<8-IP-IP-IP' - All the following listings are similar: 1064 changeVideo("6354772925112"); 1065 } else if (a == "I" && b == "<" && c == "I" && d == "P" && e == "I") { 1066 changeVideo("6354775181112"); 1067 } else if (a == "I" && b == "<" && c == "I" && d == "I" && e == "P") { 1068 changeVideo("6354773714112"); 1069 } else if (a == "I" && b == "<" && c == "I" && d == "P" && e == "P") { 1070 changeVideo("6354773715112"); 1071 } else if (a == "I" && b == "<" && c == "P" && d == "I" && e == "I") { 1072 changeVideo("6354774292112"); 1073 } else if (a == "I" && b == "<" && c == "P" && d == "P" && e == "I") { 1074 changeVideo("6354772734112"); 1075 } else if (a == "I" && b == "<" && c == "P" && d == "I" && e == "P") { 1076 changeVideo("6354773314112"); 1077 } else if (a == "I" && b == "<" && c == "P" && d == "P" && e == "P") { 1078 changeVideo("6354774898112"); 1079 } else if (a == "I" && b == "+" && c == "I" && d == "I" && e == "I") { 1080 changeVideo("6354773915112"); 1081 } else if (a == "I" && b == "+" && c == "I" && d == "P" && e == "I") { 1082 changeVideo("6354775376112"); 1083 } else if (a == "I" && b == "+" && c == "I" && d == "I" && e == "P") { 1084 changeVideo("6354773406112"); 1085 } else if (a == "I" && b == "+" && c == "I" && d == "P" && e == "P") { 1086 changeVideo("6354773513112"); 1087 } else if (a == "I" && b == "+" && c == "P" && d == "I" && e == "I") { 1088 changeVideo("6354773916112"); 1089 } else if (a == "I" && b == "+" && c == "P" && d == "P" && e == "I") { 1090 changeVideo("6354774899112"); 1091 } else if (a == "I" && b == "+" && c == "P" && d == "I" && e == "P") { 1092 changeVideo("6354775182112"); 1093 } else if (a == "I" && b == "+" && c == "P" && d == "P" && e == "P") { 1094 changeVideo("6354774386112"); 1095 } else if (a == "?" && b == "+" && c == "I" && d == "I" && e == "I") { 1096 changeVideo("6354772435112"); 1097 } else if (a == "?" && b == "+" && c == "I" && d == "P" && e == "I") { 1098 changeVideo("6354773407112"); 1099 } else if (a == "?" && b == "+" && c == "I" && d == "I" && e == "P") { 1100 changeVideo("6354774097112"); 1101 } else if (a == "?" && b == "+" && c == "I" && d == "P" && e == "P") { 1102 changeVideo("6354773514112"); 1103 } else if (a == "?" && b == "+" && c == "P" && d == "I" && e == "I") { 1104 changeVideo("6354775471112"); 1105 } else if (a == "?" && b == "+" && c == "P" && d == "P" && e == "I") { 1106 changeVideo("6354774999112"); 1107 } else if (a == "?" && b == "+" && c == "P" && d == "I" && e == "P") { 1108 changeVideo("6354774900112"); 1109 } else if (a == "?" && b == "+" && c == "P" && d == "P" && e == "P") { 1110 changeVideo("6354772436112"); 1111 } else if (a == "P" && b == "+" && c == "I" && d == "I" && e == "I") { 1112 changeVideo("6354773814112"); 1113 } else if (a == "P" && b == "+" && c == "I" && d == "P" && e == "I") { 1114 changeVideo("6354775284112"); 1115 } else if (a == "P" && b == "+" && c == "I" && d == "I" && e == "P") { 1116 changeVideo("6354774195112"); 1117 } else if (a == "P" && b == "+" && c == "I" && d == "P" && e == "P") { 1118 changeVideo("6354774595112"); 1119 } else if (a == "P" && b == "+" && c == "P" && d == "I" && e == "I") { 1120 changeVideo("6354774387112"); 1121 } else if (a == "P" && b == "+" && c == "P" && d == "P" && e == "I") { 1122 changeVideo("6354774490112"); 1123 } else if (a == "P" && b == "+" && c == "P" && d == "I" && e == "P") { 1124 changeVideo("6354773139112"); 1125 } else if (a == "P" && b == "+" && c == "P" && d == "P" && e == "P") { 1126 changeVideo("6354773315112"); 1127 } else { 1128 alert("No Result Returned"); 1129 } 1130}
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.