See More

import $ from 'jquery'; import DOMPurify from 'dompurify'; function addSearchFunctions(AblePlayer) { AblePlayer.prototype.showSearchResults = function () { // search VTT file for all instances of searchTerms // Currently just supports search terms separated with one or more spaces // TODO: Add support for more robust search syntax: // Search terms wrapped in quotation marks ("") must occur exactly as they appear in the quotes // Search terms with an attached minus sign (e.g., -term) are to be excluded from results // Boolean AND/OR operators // ALSO: Add localization support var thisObj = this; if (this.searchDiv && this.searchString) { // sanitize search string var cleanSearchString = DOMPurify.sanitize(this.searchString); if ($("#" + this.SearchDiv)) { var searchStringHtml = "

" + this.translate( 'resultsSummary1', 'You searched for:') + ' '; searchStringHtml += '' + cleanSearchString + ""; searchStringHtml += "

"; var resultsArray = this.searchFor( cleanSearchString, this.searchIgnoreCaps ); if (resultsArray.length > 0) { var $resultsSummary = $("

", { class: "able-search-results-summary", }); var resultsSummaryText = this.translate( 'resultsSummary2', 'Found %1 matching items.', [ '' + resultsArray.length + '' ] ); resultsSummaryText += ' ' + this.translate( 'resultsSummary3', 'Click the time associated with any item to play the video from that point.' ); $resultsSummary.html( resultsSummaryText ); var $resultsList = $("