1function removeDuplicates() { 2 jQuery(".portfolio-item .funded-by-data").each(function(i){ 3 var data = $(this).html(); 4 var results = []; 5 data = data.split("<br>"); 6 data.forEach(function(row, index, ar){ 7 row = row.split("|"); 8 if ($.trim(row[0]) == $.trim(row[1])) { 9 delete row[1]; 10 } 11 row = row.filter(Boolean); 12 results.push(row.join(" | ")); 13 }); 14 data = data.filter(Boolean); 15 $(this).html(results.join("<br>")); 16 }); 17} 18 19 20var Portfolio = { 21 22 popup_timer : null, 23 24 shuffle_instance : null, 25 26 init: function () { 27 28 var t = this; 29 30 $(".fake-select").FakeSelect(); 31 $(".portfolio-popup-content").mCustomScrollbar(); 32 $(".fake-select-options").mCustomScrollbar(); 33 t.initShuffleJs(); 34 t.eventsListeners(); 35 36 }, 37 38 39 40 eventsListeners: function () { 41 42 var t = this; 43 44 // $(".plus-img").click(function () { 45 // t.openPortfolioPopup(); 46 // }); 47 48 $(".portfolio-arrows-wrapper .close-btn").click(function () { 49 overlay_show = false; 50 window.history.pushState({ }, "", "https://www.viola-group.com/portfolio/"); 51 t.closePortfolioPopup(); 52 }); 53 54 55 // $(".fake-select").on('fs-changed', function (e, data) { 56 // t.shuffleResults(); 57 // }); 58 59 $(".open-filtering-box").click(function (){ 60 t.openMobileFilters(); 61 }); 62 63 $(".filtering-box .close-img").click(function (){ 64 t.closeMobileFilters(); 65 }); 66 67 $(".filtering-box .fake-option").click(function () { 68 t.closeMobileFilters(); 69 }); 70 71 }, 72 73 74 isMobile: function () { 75 76 if($(window).width() <= 640 || /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)){ 77 return true; 78 } 79 return false; 80 81 }, 82 83 84 openMobileFilters: function () { 85 86 $(".filtering-box").removeClass("hidden-m").addClass("animated slideInLeft"); 87 setTimeout(function() { 88 $(".filtering-box").removeClass("animated slideInLeft"); 89 }, 300); 90 91 }, 92 93 closeMobileFilters: function () { 94 95 $(".filtering-box").removeClass("slideInLeft animated").addClass("animated slideOutLeft"); 96 setTimeout(function() { 97 $(".filtering-box").removeClass("animated slideOutLeft").addClass('hidden-m'); 98 }, 300); 99 100 }, 101 102 103 scrollToContent: function () { 104 $("body, html").animate({ 105 scrollTop: $(".portfolio .content-wrapper").offset().top 106 }, 1000); 107 }, 108 109 110 111 openPortfolioPopup: function () { 112 113 var t = this; 114 $("body").addClass('no-scrolling'); 115 t.clearPopupTimeout(); 116 $("#portfolio_popup").removeClass("hidden-elem").addClass('animated fadeInRight'); 117 118 }, 119 120 121 122 closePortfolioPopup: function (callback = null) { 123 124 var t = this; 125 126 $("body").removeClass('no-scrolling'); 127 t.clearPopupTimeout(); 128 $("#portfolio_popup").removeClass("fadeInRight").removeClass('animated').addClass('animated fadeOutLeft'); 129 t.popup_timer = setTimeout(function () { 130 $("#portfolio_popup").addClass('hidden-elem'); 131 $("#portfolio_popup").removeClass("fadeOutLeft").removeClass('animated') 132 if (callback != null) 133 callback(); 134 }, 1000); 135 136 }, 137 138 139 140 clearPopupTimeout: function () { 141 142 var t = this; 143 if(t.popup_timer){ 144 clearTimeout(t.popup_timer); 145 } 146 147 }, 148 149 150 151 initShuffleJs: function () { 152 153 var t = this; 154 155 Shuffle.ShuffleItem.Scale.HIDDEN = 0; 156 t.shuffle_instance = new Shuffle($(".portfolio-items-container"), { 157 speed : 500, 158 staggerAmount: 50, 159 sizer: $('#sizer'), 160 staggerAmountMax: 100 161 }); 162 163 }, 164 165 166 167 shuffleResults: function () { 168 169 var t = this; 170 171 var selected_elements = $(".fake-select .fake-option.selected"); 172 var selected_values = []; 173 174 if(selected_elements) { 175 176 $.each(selected_elements, function (){ 177 selected_values.push($(this).text().trim()); 178 }); 179 180 t.shuffle_instance.filter(selected_values); 181 182 }else{ 183 184 t.shuffle_instance.filter(); 185 186 } 187 188 if(t.isMobile()) { 189 t.closeMobileFilters(); 190 t.scrollToContent(); 191 } 192 193 194 } 195 196 197}; 198 199var updatePortfolio; 200var portfolioPopupAjax; 201$(document).ready(function () { 202 203 204 $.ajaxSetup({ 205 beforeSend: function() { 206 $('.the-loader').fadeIn(); 207 }, 208 complete: function() { 209 $('.the-loader').fadeOut(); 210 } 211 }); 212 213 214 215 setTimeout(function(){ 216 $("div#filter_by_status .fake-option:nth-child(2)").click(); 217 if (search_data = "") { 218 $(".results-for").remove(); 219 } }, 500); 220 setTimeout(function(){ $(".filtering-box.hidden-m").css("opacity","1"); }, 1000); 221 var vw = $(window).width(), 222 direction; 223 224 Portfolio.init(); 225 226 227 228 229 // Mobile Only JS 230 if(vw < 480) { 231 232 $('.sticky-menu').addClass('white'); 233 $('.sticky-menu .btn').removeClass('white-outline-btn').addClass('blue-btn'); 234 235 236 237 // $('.search-box').appendTo('.box-title'); 238 239 } 240 241 // Check Scroll Direction 242 $(window).bind('mousewheel', function(event) { 243 if (event.originalEvent.wheelDelta >= 0) { 244 direction = 'up'; 245 } 246 else { 247 direction = 'down'; 248 } 249 250 }); 251 252 if(vw > 480) { 253 // Sticky Filters 254 $(window).scroll(function(){ 255 var wScroll = $(this).scrollTop(), 256 $filters = $('.filtering-box'); 257 258 if(wScroll > $($filters).position().top + $($filters).height() && direction == 'down') { 259 $($filters).addClass('top'); 260 } 261 262 if(wScroll < $($filters).position().top && direction == 'up') { 263 $('.page-content.portfolio .filtering-box.top').addClass('back') 264 .one('webkitTransitionEnd otransitionend oTransitionEnd msTransitionEnd transitionend', function(){ 265 $($filters).removeClass('top back'); 266 }); 267 } 268 269 //Menu Transition 270 var menu = $('.sticky-menu') 271 menuBtn = $('.sticky-menu .btn') 272 wScroll = $(window).scrollTop(); 273 274 if (wScroll >= 170) { 275 menu.addClass('white'); 276 menuBtn.removeClass('white-outline-btn').addClass('blue-btn'); 277 } else { 278 menu.removeClass('white'); 279 menuBtn.removeClass('blue-btn').addClass('white-outline-btn'); 280 } 281 282 }); 283 284 285 286 } 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 var scrollProtect = false;
302 $("#filter_by_founds").on("fs-changed", function(e){ 303 fund_data = $.trim($(this).find(".fake-option.selected").text()).replace(" ","+"); 304 page_data=1; 305 updatePortfolio(720) 306 console.log(1); 307 }); 308 $("#filter_by_industry").on("fs-changed", function(e){ 309 industry_data = $.trim($(this).find(".fake-option.selected").text()); 310 page_data=1; 311 updatePortfolio(720); 312 console.log(2); 313 }); 314 $("#filter_by_status").on("fs-changed", function(e){ 315 activeexit_data = $.trim($(this).find(".fake-option.selected").text()); 316 console.log(activeexit_data) 317 if (activeexit_data == "Exits") { 318 activeexit_data = "Exit"; 319 } 320 else if (activeexit_data == "Publics" || activeexit_data == "Public") { 321 activeexit_data = "Public"; 322 } 323 page_data=1; 324 updatePortfolio(720); 325 console.log(3); 326 }); 327 328 var searchTimeout; 329 $(".input-wrap .search-input").on("keyup", function(){ 330 var that = this; 331 clearTimeout(searchTimeout); 332 searchTimeout = setTimeout(function(){ 333 search_data = $.trim($(that).val()); 334 page_data=1; 335 updatePortfolio(720) 336 console.log(4); 337 }, 500); 338 }) 339 340 $(".mobileonly .search-input").on("keyup", function(e){ 341 var that = this; 342 if (e.which == 13) { 343 search_data = $.trim($(that).val()); 344 page_data=1; 345 $(".filtering-box .close-img").click(); 346 updatePortfolio(720) 347 console.log(5); 348 } 349 }) 350 $(".mobileonly .search-input-clickzone").on("click", function(){ 351 var e = jQuery.Event("keyup", { which: 13 }); 352 // e.which = 13; 353 $(".mobileonly .search-input").trigger(e); 354 }); 355 356 357 $(document).on("click",".portfolio-item", function(e){ 358 var href = $(this).find(".plus-img a").attr("href"); 359 window.location = href; 360 }) 361 362 363 updatePortfolio = function(perPage = 36, thePage = 1, shouldRemove = true) { 364 updateUrl(); 365 console.log("fund_data ", fund_data); 366 console.log("industry_data ", industry_data); 367 console.log("activeexit_data ", activeexit_data); 368 369 $.ajax({ 370 url: "https://www.viola-group.com/api/portfolio-filter.php", 371 method: "get", 372 data: { 373 activeexit: activeexit_data, 374 industry: industry_data, 375 fund: fund_data, 376 search: search_data, 377 per_page: perPage, 378 page: thePage 379 }, 380 success: function(datas){ 381 $(".load-more-wrap").show(); 382 383 if (shouldRemove) { 384 $(".portfolio-items-container .portfolio-item").remove(); 385 $(".results-for").remove(); 386 } 387 388 if (search_data != "") { 389 $(".content-wrapper .container ").prepend("<div class='results-for'>Displaying results for: \""+search_data+"\" | <span class='clear-results'>Clear results</span></div>"); 390 391 if (!datas.length) { 392 $(".results-for").text("No results for\""+search_data+"\""); 393 $(".load-more-wrap ").hide(); 394 } 395 } else { 396 if (fund_data != "" || industry_data != "" || activeexit_data == "exits" || activeexit_data == "public") { 397 $(".content-wrapper .container ").prepend("<div class='results-for'><span class='clear-results'>Clear filters</span></div>"); 398 } 399 } 400 401 datas.forEach(function(data){ 402 // console.log(data); 403 404 // add new box 405 var newElement = $(".portfolio-item.portfolio-hidden").clone().removeClass("portfolio-hidden"); 406 407 // update the image 408 newElement.find(".portfolio-image").attr("src",data.icon_logo); 409 newElement.find(".plus-img a").attr("href","/portfolio/"+data.post_name); 410 411 // funded by 412 var temp1 = []; 413 var temp2 = []; 414 // temp.push(data.funded_by); 415 if (data.funded_by) { 416 data.funded_by.forEach(function(e){ 417 var templist = []; 418 419 e.funds.forEach(function(d){ 420 templist.push(d); 421 }); 422 423 templist.push(e.name); 424 425 temp1.push(templist); 426 }); 427 428 } 429 temp1.forEach(function(data){ 430 temp2.push(data.join(" | ")); 431 }); 432 433 newElement.find(".funded-by-data").html( temp2.join(" <br> ") ); 434 435 //title 436 newElement.find(".portfolio-title-data").text(data.public_name); 437 if (data.public_title != "") { 438 newElement.find(".activeexitField").text(data.public_title); 439 } 440 441 newElement.attr("data-id", data.id); 442 443 444 if (data.activeexit != "Exit") { 445 newElement.find(".activeexitField").remove(); 446 newElement.find(".portfolio-title-data").remove(); 447 if (search_data = "") { 448 $(".results-for").remove(); 449 } 450 451 } 452 453 $(".portfolio-items-container").append(newElement); 454 }); 455 456 // refresh shufflejs 457 Portfolio.initShuffleJs(); 458 removeDuplicates(); 459 460 if (datas.length >= perPage) 461 scrollProtect = false;
462 } 463 }); 464 } 465 function updateUrl() { 466 var url = "industry="+industry_data.replace("&","%26").replace(" ","%2B").replace("+","%2B")+"&fund="+fund_data.replace("&","%26").replace(" ","%2B").replace("+","%2B")+"&search="+search_data.replace("&","%26").replace(" ","%2B").replace("+","%2B")+"&activeexit="+activeexit_data+"&thePage="+page_data; 467 if ( ! overlay_show ) { 468 window.history.pushState({ }, "", "https://www.viola-group.com/portfolio/?"+url); 469 } 470 } 471 $(document).on("click", ".clear-results", function(){ 472 page_data=1; 473 activeexit_data = ""; 474 industry_data = ""; 475 fund_data = "" 476 search_data = ""; 477 $(".search-input").val(""); 478 $(".search-box.open .search-btn").click(); 479 updatePortfolio(720) 480 console.log(6); 481 }); 482 $(document).on("click", ".plus-img", function () { 483 // var id = $(this).closest(".portfolio-item").attr("data-id"); 484 // portfolioPopupAjax(id); 485 }); 486 487 portfolioPopupAjax = function(post_id) { 488 $.ajax({ 489 url: "https://www.viola-group.com/api/portfolio-filter.php", 490 method: "get", 491 data: { 492 id: post_id 493 }, 494 success: function(data){ 495 // console.log(data); 496 $("#portfolio_popup").attr("data-id", post_id); 497 $("#portfolio_popup #single_portfolio_img").attr("src",data.popup_image); 498 $("#portfolio_popup .portfolio-logo-wrapper img").attr("src",data.icon_logo); 499 $("#portfolio_popup .company-name").text(data.title); 500 $("#portfolio_popup #mCSB_1_container p").remove(); 501 $("#portfolio_popup #mCSB_1_container").html("").prepend(data.content); 502 $("#portfolio_popup .funded-by .popup-credit-wrapper").remove(); 503 504 data.funded_by.forEach(function(name){ 505 $("#portfolio_popup .funded-by").append('<div class="popup-credit-wrapper"> <div class="funded-by-logo"> <img src="https://www.viola-group.com/wp-content/themes/viola/assets/img/portfolio/credit-img.png" alt="" class="full-width mCS_img_loaded"> </div> <div class="funded-by-name"> <h3> ' + name + ' </h3> </div> </div>'); 506 }); 507 508 $("#portfolio_popup .go-to-site").attr("href",data.website); 509 $("#portfolio_popup .linkdin").attr("href",data.linkdin); 510 $("#portfolio_popup .twitter").attr("href",data.twitter); 511 $("#portfolio_popup .facebook").attr("href",data.facebook); 512 $("#portfolio_popup .youtube").attr("href",data.youtube); 513 514 // portfolio-logo-wrapper 515 Portfolio.openPortfolioPopup(); 516 } 517 }); 518 } 519 $(document).on("click", "#portfolio_popup .left-control", function () { 520 var currentId = $("#portfolio_popup").attr("data-id"); 521 var current = $(".portfolio-item[data-id='"+currentId+"']"); 522 var totalItems = $(".portfolio-item:not(.portfolio-hidden)").length; 523 var nextIndex; 524 if (current.index() == 0) { 525 nextIndex = totalItems-1; 526 } else { 527 nextIndex = current.index()-1; 528 } 529 Portfolio.closePortfolioPopup(function(){ 530 $(".portfolio-items-container .portfolio-item").eq(nextIndex).find(".plus-img").click(); 531 }); 532 }); 533 $(document).on("click", "#portfolio_popup .right-control", function () { 534 var currentId = $("#portfolio_popup").attr("data-id"); 535 var current = $(".portfolio-item[data-id='"+currentId+"']"); 536 var totalItems = $(".portfolio-item:not(.portfolio-hidden)").length; 537 var nextIndex; 538 if (current.index() == totalItems-1) { 539 nextIndex = 0; 540 } else { 541 nextIndex = current.index()+1; 542 } 543 Portfolio.closePortfolioPopup(function(){ 544 $(".portfolio-items-container .portfolio-item").eq(nextIndex).find(".plus-img").click(); 545 }); 546 }); 547 548 $(".load-more").on("click", function(){ 549 // if($("#sizer").position().top < $(this).scrollTop() + $(this).height() ) { 550 // console.log("more"); 551 if (!scrollProtect) { 552 scrollProtect = true; 553 updatePortfolio(720, ++page_data, false); 554 console.log(7); 555 } 556 // } 557 }); 558 559 $('.search-btn').on('click', function(){ 560 $('.select-wrap').toggleClass('outLeft'); 561 $('.search-box').toggleClass('open'); 562 }); 563 564 565});
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.