1/*************************************************************************************************** 2 // 3 // AssistExpo inc. 4 // (c) 1996-2026 AssistExpo inc. 5 // All Rights Reserved 6 // NOTICE: All text, information, code and data contained herein is, and remains the property of 7 // AssistExpo inc. The intellectual and technical concepts contained herein are proprietary to 8 // AssistExpo inc. and are protected by trade secret and, or copyright laws. Dissemination of this 9 // information or reproduction of this material is strictly forbidden. 10 ***************************************************************************************************/ 11 12(function( $ ) { 13 'use strict'; 14 15 jQuery( document ).ready(function() { 16 17 /*********************************************************/ 18 /* fixes assistexpo sponsor ads inserted in enigmaswiper */ 19 jQuery(".assistex-enigma-swiper-wrapper").each(function(){ 20 let w = jQuery(this).find("img:first").width(); let h = jQuery(this).find("img:first").height(); 21 let r1 = w / 196; let r2 = h / 106; 22 let r = Math.max(r1, r2); 23 if( (r1 < 1.0) && (r2 < 1.0) ) { 24 r = 1.0; 25 } else { 26 r = 1.0 / r; 27 } 28 jQuery(this).css("transform", "scale("+r+")").css("transform-origin", "top left"); 29 jQuery(this).parent().css("overflow", "hidden").css("height", "106px").css("width", "196px"); 30 }); 31 32 /*********************************************************/ 33 /* fixes assistexpo sponsor ads inserted in enigmaswiper */ 34 if(jQuery(".assistex-ad-swiper-wrapper").length!==0) { 35 let swiper = new Swiper('.assistex-ad-swiper-wrapper',{ 36 slidesPerView: 3, 37 spaceBetween: 0, 38 autoplay: 2000, 39 loop: true, 40 breakpoints: { 41 768: { 42 slidesPerView: 3, 43 spaceBetween: 30 44 }, 45 640: { 46 slidesPerView: 2, 47 spaceBetween: 20 48 }, 49 480: { 50 slidesPerView: 1, 51 spaceBetween: 10 52 } 53 } 54 }); 55 }; 56 57 /* pre-process some content */ 58 assistexpoProcessPrizebookContent(); 59 60 /* hook to ESC key */ 61 jQuery(document).on('keydown', function(event) { 62 if(jQuery.trim(event.key).toLowerCase() === "escape") { 63 assistexpoResultsCloseModal(); 64 } 65 }); 66 }); 67 68})( jQuery ); 69 70let assistexpoResultsSlideIndex = 1; 71function assistexpoResultsOpenModal(data, caption, allcaps) { 72 jQuery('body').append("<div id='assistexpo-results-modal'><span class='assistexpo-modal-close assistexpo-modal-cursor' onclick='assistexpoResultsCloseModal();'>×</span><div class='assistexpo-modal-content'>"+data+"<a class='assistexpo-modal-prev' onclick='assistexpoResultsPlusSlides(-1)'>❮</a> <a class='assistexpo-modal-next' onclick='assistexpoResultsPlusSlides(1)'>❯</a><div class='assistexpo-modal-caption-container'><p id='assistexpo-modal-caption-p'></p></div></div>"); 73 jQuery("#assistexpo-modal-caption-p").html(jQuery.trim(caption)); 74 jQuery("#assistexpo-modal-caption-p").toggleClass("assistexpo-sr-rol-allcaps", allcaps); 75 assistexpoResultsCurrentSlide(1); 76 if(jQuery(".assistexpo-modal-slide").length<=1) { 77 jQuery(".assistexpo-modal-numbertext").remove(); 78 jQuery(".assistexpo-modal-prev").remove(); 79 jQuery(".assistexpo-modal-next").remove(); 80 } 81 jQuery("#assistexpo-results-modal").show(); 82} 83function assistexpoResultsCloseModal() { 84 jQuery('#assistexpo-video').find("source").attr("src", ""); 85 jQuery('#assistexpo-video').attr("src", ""); 86 jQuery("#assistexpo-results-modal").remove(); 87 return false; 88} 89function assistexpoResultsPlusSlides(n) { 90 assistexpoResultsShowSlides(assistexpoResultsSlideIndex += n); 91} 92function assistexpoResultsCurrentSlide(n) { 93 assistexpoResultsShowSlides(assistexpoResultsSlideIndex = n); 94} 95function assistexpoResultsShowSlides(n) { 96 let slides = jQuery(".assistexpo-modal-slide"); 97 if (n > slides.length) {assistexpoResultsSlideIndex = 1} 98 if (n < 1) {assistexpoResultsSlideIndex = slides.length} 99 for (let i = 0; i < slides.length; i++) { 100 jQuery(slides[i]).hide(); 101 } 102 jQuery(slides[assistexpoResultsSlideIndex-1]).show().css("display", "block"); 103 window.dispatchEvent(new Event('resize')); 104 if(jQuery(slides[assistexpoResultsSlideIndex-1]).find("video").length!==0) {
105 try { 106 jQuery('#assistexpo-video').get(0).play(); 107 } catch(e) { } 108 } else { 109 if(jQuery('#assistexpo-video').length!==0) { 110 try { 111 jQuery('#assistexpo-video').get(0).pause(); 112 } catch(e) { } 113 } 114 } 115 /* move caption inside slide on diplomas */ 116 if(jQuery(slides[assistexpoResultsSlideIndex-1]).find(".assistexpo-sr-diploma-exhibit").length!==0) { 117 jQuery("#assistexpo-modal-caption-p").hide(); 118 jQuery(slides[assistexpoResultsSlideIndex-1]).find(".assistexpo-sr-diploma-exhibit").html(jQuery("#assistexpo-modal-caption-p").html()); 119 jQuery(slides[assistexpoResultsSlideIndex-1]).find(".assistexpo-sr-diploma-exhibit").toggleClass("assistexpo-sr-rol-allcaps", (jQuery("#assistexpo-modal-caption-p").hasClass("assistexpo-sr-rol-allcaps"))); 120 } else { 121 jQuery("#assistexpo-modal-caption-p").show(); 122 } 123 /* remove slide index on diplomas */ 124 if(jQuery(slides[assistexpoResultsSlideIndex-1]).find(".assistexpo-sr-diploma-exhibit").length!==0) { 125 jQuery(slides[assistexpoResultsSlideIndex-1]).find(".assistexpo-modal-numbertext").remove(); 126 } 127 128} 129 130 131function assistexpoProcessPrizebookContent() { 132 /*********************************************************/ 133 /* replace ordinals in prizes with superscripts */ 134 jQuery(".assistexpo-pb-useordinalssup .ae-pb-money, .assistexpo-pb-useordinalssup .ae-pb-gifts").each(function(){ 135 let content = jQuery(this).html(); 136 content = content.replace(/1st\:/g, "1<sup>st</sup>:"); 137 content = content.replace(/2nd\:/g, "2<sup>nd</sup>:"); 138 content = content.replace(/3rd\:/g, "3<sup>rd</sup>:"); 139 content = content.replace(/4th\:/g, "4<sup>th</sup>:"); 140 content = content.replace(/5th\:/g, "5<sup>th</sup>:"); 141 content = content.replace(/6th\:/g, "6<sup>th</sup>:"); 142 content = content.replace(/7th\:/g, "7<sup>th</sup>:"); 143 content = content.replace(/8th\:/g, "8<sup>th</sup>:"); 144 content = content.replace(/9th\:/g, "9<sup>th</sup>:"); 145 content = content.replace(/0th\:/g, "0<sup>th</sup>:"); 146 content = content.replace(/1th\:/g, "1<sup>th</sup>:"); 147 content = content.replace(/2th\:/g, "2<sup>th</sup>:"); 148 content = content.replace(/3th\:/g, "3<sup>th</sup>:"); 149 jQuery(this).html(content); 150 }); 151 152 /*********************************************************/ 153 /* replace ordinals in prizes with icons */ 154 let ciconsbefore = "<span style='font-family: bbpbiconsordinals; padding-left:1em;'>"; 155 let ciconsbefore1 = "<span style='font-family: bbpbiconsordinals; padding-left:0.3em;'>"; 156 let ciconsbefore2 = "<span style='font-family: bbpbiconsordinals; padding-left:1em; letter-spacing:-0.3em; padding-right: 0.3em;'>"; 157 let ciconsafter = "</span>"; 158 jQuery(".assistexpo-pb-useordinalsicons .ae-pb-money, .assistexpo-pb-useordinalsicons .ae-pb-gifts").each(function(){ 159 let content = jQuery(this).html(); 160 content = content.replace(/\,\s26th\:/g, ciconsbefore2+"26"+ciconsafter); 161 content = content.replace(/\,\s25th\:/g, ciconsbefore2+"25"+ciconsafter); 162 content = content.replace(/\,\s24th\:/g, ciconsbefore2+"24"+ciconsafter); 163 content = content.replace(/\,\s23rd\:/g, ciconsbefore2+"23"+ciconsafter); 164 content = content.replace(/\,\s22nd\:/g, ciconsbefore2+"22"+ciconsafter); 165 content = content.replace(/\,\s21st\:/g, ciconsbefore2+"21"+ciconsafter); 166 content = content.replace(/\,\s20th\:/g, ciconsbefore2+"20"+ciconsafter); 167 content = content.replace(/\,\s19th\:/g, ciconsbefore2+"19"+ciconsafter); 168 content = content.replace(/\,\s18th\:/g, ciconsbefore2+"18"+ciconsafter); 169 content = content.replace(/\,\s17th\:/g, ciconsbefore2+"17"+ciconsafter); 170 content = content.replace(/\,\s16th\:/g, ciconsbefore2+"16"+ciconsafter); 171 content = content.replace(/\,\s15th\:/g, ciconsbefore2+"15"+ciconsafter); 172 content = content.replace(/\,\s14th\:/g, ciconsbefore2+"14"+ciconsafter); 173 content = content.replace(/\,\s13th\:/g, ciconsbefore2+"13"+ciconsafter); 174 content = content.replace(/\,\s12th\:/g, ciconsbefore2+"12"+ciconsafter); 175 content = content.replace(/\,\s11th\:/g, ciconsbefore2+"11"+ciconsafter); 176 content = content.replace(/\,\s10th\:/g, ciconsbefore2+"10"+ciconsafter); 177 content = content.replace(/\,\s9th\:/g, ciconsbefore+"9"+ciconsafter); 178 content = content.replace(/\,\s8th\:/g, ciconsbefore+"8"+ciconsafter); 179 content = content.replace(/\,\s7th\:/g, ciconsbefore+"7"+ciconsafter); 180 content = content.replace(/\,\s6th\:/g, ciconsbefore+"6"+ciconsafter); 181 content = content.replace(/\,\s5th\:/g, ciconsbefore+"5"+ciconsafter); 182 content = content.replace(/\,\s4th\:/g, ciconsbefore+"4"+ciconsafter); 183 content = content.replace(/\,\s3rd\:/g, ciconsbefore+"3"+ciconsafter); 184 content = content.replace(/\,\s2nd\:/g, ciconsbefore+"2"+ciconsafter); 185 content = content.replace(/1st\:/g, ciconsbefore1+"1"+ciconsafter); 186 jQuery(this).html(content); 187 }); 188 189 /*********************************************************/ 190 /* hook to multimedia link in showresults */ 191 jQuery(".assistexpo-sr-multimedia").click(function(){ 192 let href = jQuery(this).attr("href"); 193 let guid = jQuery(this).attr("data-guid"); 194 let caption = jQuery(this).parent().html(); 195 caption = jQuery.trim(caption.split('</a>')[1]); 196 caption = jQuery.trim(caption.replace(/\<br\>/g,", ")); 197 caption = jQuery.trim(caption.replace(/,\s,/g, ", ")); 198 caption = jQuery.trim(caption.replace(/\s+/g, " ")); 199 let allcaps = (jQuery(this).closest("ol").hasClass("assistexpo-sr-rol-allcaps")); 200 jQuery('body').append("<div id='assistexpo-results-modal-loading'></div>"); 201 jQuery.ajax({ 202 url: href, 203 data: { "action": "assistexpo_get_multimedia_content", "guid": guid }, 204 cache: true, 205 type: "GET", 206 success: function(data) { 207 assistexpoResultsOpenModal(data, caption, allcaps); 208 jQuery("#assistexpo-results-modal-loading").remove(); 209 } 210 }); 211 return false;
212 }); 213 214 /*********************************************************/ 215 /* render PDF inserts */ 216 let myOwnUniqueIdForPdfInserts = 0; 217 if((jQuery(".assistexpo-wp-pdf-insert").length!==0) && (jQuery.trim(assistexpo_options.pdfjs)!=="0") && (jQuery.trim(assistexpo_options.pdfjs)!=="") ) { 218 // init PDF library 219 // Loaded via <script> tag, create shortcut to access PDF.js exports. 220 let pdfjsLib = window['pdfjs-dist/build/pdf']; 221 // The workerSrc property shall be specified. 222 pdfjsLib.GlobalWorkerOptions.workerSrc = assistexpo_options.siteurl+'/public/js/pdf.worker.js'; 223 // process all pages 224 jQuery(".assistexpo-wp-pdf-insert").each(function(){ 225 let id = jQuery.trim(jQuery(this).attr('id')); 226 if(id==='') { 227 myOwnUniqueIdForPdfInserts++; 228 id = 'assistexpo-wp-pdf-insert-'+jQuery.trim(myOwnUniqueIdForPdfInserts); 229 jQuery(this).attr('id', id); 230 id = jQuery.trim(jQuery(this).attr('id')); 231 } 232 if(id!=='') { 233 let wrapper = document.getElementById(id); 234 let pdfData = atob(jQuery("#"+id).attr("data-pdf")); 235 if(pdfData!=='') { 236 jQuery("#"+id).find("img").addClass("assistexpo-wp-pdf-image"); 237 let page = 'all'; 238 let myscale = 'fit'; 239 // Asynchronous download of PDF 240 let loadingTask = pdfjsLib.getDocument({data: pdfData}); 241 loadingTask.promise.then(function(pdf) { 242 // PDF loaded 243 let pages = [1]; // default first page 244 let ipage = parseInt('0'+page, 10); 245 if((ipage>1) && (ipage<=pdf.numPages)) { 246 pages = [ipage]; 247 } 248 if(page.toLowerCase()==='all') { 249 pages = []; 250 for(let p=1; p<=pdf.numPages; p++) { 251 pages.push(p); 252 } 253 } 254 jQuery.each(pages, function(i, page){ 255 pdf.getPage(page).then(function(page) { 256 // Create canvas 257 let mycanvasid = id+"-"+i; 258 let canvasw = jQuery("<canvas id='"+mycanvasid+"'></canvas>").appendTo(wrapper); 259 let canvas = document.getElementById(mycanvasid); 260 //Page loaded 261 let scale = 1; 262 if(myscale==="fit") { 263 let containerWidth = jQuery("#"+id).width(); 264 let viewport = page.getViewport({ scale: 1, }); 265 scale = containerWidth / viewport.width; 266 } 267 scale = Math.max(scale, 0.1); 268 let viewport = page.getViewport({scale: scale}); 269 // Prepare canvas using PDF page dimensions 270 let context = canvas.getContext('2d'); 271 canvas.height = viewport.height; 272 canvas.width = viewport.width; 273 // Render PDF page into canvas context 274 let renderContext = { 275 canvasContext: context, 276 viewport: viewport 277 }; 278 let renderTask = page.render(renderContext); 279 renderTask.promise.then(function () { 280 //Page rendered 281 jQuery("#"+id).find("img.assistexpo-wp-pdf-image").remove(); // unload 282 jQuery("#"+id).attr("data-pdf", ""); // unload 283 }); 284 }); 285 }); 286 }, function (reason) { 287 // PDF loading error 288 }); 289 } 290 } 291 }); 292 } 293} 294 295 296 297 298function assistExpoAddWaitSpinnerOverlay(selector) { 299 let opacity = 0.5; 300 let offset = ""; 301 jQuery(selector).prepend('<svg width="120px" height="120px" class="assistexpowaitspinner" style="display:none;opacity: '+opacity+'; position:absolute; left:220px; '+offset+' right:0; margin: auto;" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100" preserveAspectRatio="xMidYMid"><g><circle r="7" cx="24" cy="0" transform="translate(32,32)" stroke-width="0"><animate attributeName="fill-opacity" dur="750ms" values="1;.9;.85;.7;.4;.3;.3;.3;
3011" repeatCount="indefinite"></animate></circle><circle r="7" cx="16.970562748477143" cy="16.97056274847714" transform="translate(32,32)" stroke-width="0"><animate attributeName="fill-opacity" dur="750ms" values=".3;1;.9;.85;.7;.4;.3;.3;.3" repeatCount="indefinite"></animate></circle><circle r="7" cx="1.4695761589768238e-15" cy="24" transform="translate(32,32)" stroke-width="0"><animate attributeName="fill-opacity" dur="750ms" values=".3;.3;1;.9;.85;.7;.4;.3;.3" repeatCount="indefinite"></animate></circle><circle r="7" cx="-16.97056274847714" cy="16.970562748477143" transform="translate(32,32)" stroke-width="0"><animate attributeName="fill-opacity" dur="750ms" values=".3;.3;.3;1;.9;.85;.7;.4;.3" repeatCount="indefinite"></animate></circle><circle r="7" cx="-24" cy="2.9391523179536475e-15" transform="translate(32,32)" stroke-width="0"><animate attributeName="fill-opacity" dur="750ms" values=".4;.3;.3;.3;1;.9;.85;.7;.4" repeatCount="indefinite"></animate></circle><circle r="7" cx="-16.970562748477143" cy="-16.97056274847714" transform="translate(32,32)" stroke-width="0"><animate attributeName="fill-opacity" dur="750ms" values=".7;.4;.3;.3;.3;1;.9;.85;.7" repeatCount="indefinite"></animate></circle><circle r="7" cx="-4.408728476930472e-15" cy="-24" transform="translate(32,32)" stroke-width="0"><animate attributeName="fill-opacity" dur="750ms" values=".85;.7;.4;.3;.3;.3;1;.9;.85" repeatCount="indefinite"></animate></circle><circle r="7" cx="16.970562748477136" cy="-16.970562748477143" transform="translate(32,32)" stroke-width="0"><animate attributeName="fill-opacity" dur="750ms" values=".9;.85;.7;.4;.3;.3;.3;1;.9" repeatCount="indefinite"></animate></circle></g></svg>'); 302 return jQuery(selector).find("svg.assistexpowaitspinner").fadeIn(300); 303} 304
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.