1(function ($) { 2 'use strict'; 3 var mdModalWrap = $("#tlp-modal"); 4 var elementThumbInstances = []; 5 window.initTlpTeam = function () { 6 $(".rt-team-container").each(function (index) { 7 var container = $(this), 8 str = container.attr("data-layout"), 9 popupBg = container.attr("data-popup-bg"), 10 id = $.trim(container.attr('id')), 11 randId = id.replace("rt-team-container-", ""), 12 scID = $.trim(container.attr("data-sc-id")), 13 mdPopup = $('.ttp-single-md-popup', container), 14 multiPopup = $('.ttp-multi-popup', document), 15 $default_order_by = $('.rt-order-by-action .order-by-default', container), 16 $default_order = $('.rt-sort-order-action .rt-sort-order-action-arrow', container), 17 $taxonomy_filter = $('.rt-filter-item-wrap.rt-tax-filter', container), 18 $pagination_wrap = $('.rt-pagination-wrap', container), 19 $loadmore = $('.rt-loadmore-action', container), 20 $infinite = $('.rt-infinite-action', container), 21 $page_prev_next = $('.rt-cb-page-prev-next', container), 22 $page_numbers = $('.rt-page-numbers', container), 23 html_loading = '<div class="rt-loading-overlay"></div><div class="rt-loading rt-ball-clip-rotate"><div></div></div>', 24 preLoader = container.find('.ttp-pre-loader'), 25 loader = container.find(".rt-content-loader"), 26 contentLoader = container.children(".rt-row.rt-content-loader"), 27 search_wrap = container.find(".rt-search-filter-wrap"), 28 ttp_order = '', 29 ttp_order_by = '', 30 ttp_taxonomy = '', 31 ttp_term = '', 32 ttp_search = '', 33 ttp_paged = 1, 34 temp_total_pages = parseInt($pagination_wrap.attr('data-total-pages'), 10), 35 ttp_total_pages = typeof (temp_total_pages) != 'undefined' && temp_total_pages != '' ? temp_total_pages : 1, 36 temp_posts_per_page = parseInt($pagination_wrap.attr('data-posts-per-page'), 10), 37 ttp_posta_per_page = typeof (temp_posts_per_page) != 'undefined' && temp_posts_per_page != '' ? temp_posts_per_page : 3, 38 infinite_status = 0, 39 paramsRequest = {}, 40 mIsotopeWrap = '', 41 IsotopeWrap = '', 42 isMasonry = $('.rt-row.rt-content-loader.tpg-masonry', container), 43 isIsotope = $(".tlp-team-isotope", container), 44 IsoButton = $(".ttp-isotope-buttons", container), 45 IsoDropDownFilter = $("select.isotope-dropdown-filter", container), 46 isCarousel = $('.rt-carousel-holder', container), 47 caroThumb = $('.rttm-carousel-main', container), 48 isSpecial = $('.rt-special-wrapper', container), 49 placeholder_loading = function () { 50 if (loader.find('.rt-loading-overlay').length == 0) { 51 loader.addClass('ttp-pre-loader'); 52 loader.append(html_loading); 53 } 54 }, 55 remove_placeholder_loading = function () { 56 loader.find('.rt-loading').fadeOut(300); 57 loader.removeClass('ttp-pre-loader'); 58 $loadmore.removeClass('rt-lm-loading'); 59 $page_numbers.removeClass('rt-lm-loading'); 60 $infinite.removeClass('rt-active-elm'); 61 search_wrap.find('input').prop("disabled", false); 62 }, 63 check_query = function () { 64 if ($taxonomy_filter.length > 0) { 65 ttp_taxonomy = $taxonomy_filter.attr('data-taxonomy'); 66 var term; 67 if ($taxonomy_filter.hasClass('rt-filter-button-wrap')) { 68 term = $taxonomy_filter.find('.rt-filter-button-item.selected').attr('data-term'); 69 } else { 70 term = $taxonomy_filter.find('.term-default').attr('data-term'); 71 } 72 if (typeof (term) != 'undefined' && term != '') { 73 ttp_term = term; 74 } 75 } 76 if ($default_order_by.length > 0) { 77 var order_by_param = $default_order_by.attr('data-order-by'); 78 if (typeof (order_by_param) != 'undefined' && order_by_param != '' && (order_by_param.toLowerCase())) { 79 ttp_order_by = order_by_param; 80 } 81 } 82 if ($default_order_by.length > 0) { 83 var order_param = $default_order.attr('data-sort-order'); 84 if (typeof (order_param) != 'undefined' && order_param != '' && (order_param == 'DESC' || order_param == 'ASC')) { 85 ttp_order = order_param; 86 } 87 } 88 if (search_wrap.length > 0) { 89 ttp_search = $.trim(search_wrap.find('input').val()); 90 } 91 paramsRequest = { 92 'ttp_post__not_in': [20], 93 'scID': scID, 94 'order': ttp_order, 95 'order_by': ttp_order_by, 96 'taxonomy': ttp_taxonomy, 97 'term': ttp_term, 98 'paged': ttp_paged, 99 'action': 'ttp_Layout_Ajax_Action', 100 'search': ttp_search, 101 'tlp_nonce': ttp.nonce 102 }; 103 }, 104 infinite_scroll = function () { 105 if (infinite_status == 1 || $infinite.hasClass('rt-hidden-elm') || $pagination_wrap.length == 0) { 106 return; 107 } 108 var ajaxVisible = $pagination_wrap.offset().top, 109 ajaxScrollTop = $(window).scrollTop() + $(window).height(); 110 111 if (ajaxVisible <= (ajaxScrollTop) && (ajaxVisible + $(window).height()) > ajaxScrollTop) { 112 infinite_status = 1; //stop inifite scroll 113 ttp_paged = ttp_paged + 1; 114 $infinite.addClass('rt-active-elm'); 115 ajax_action(true, true); 116 } 117 }, 118 generateData = function (number) { 119 var result = []; 120 for (var i = 1; i < number + 1; i++) { 121 result.push(i); 122 } 123 return result; 124 }, 125 createPagination = function () { 126 if ($page_numbers.length > 0) { 127 $page_numbers.pagination({ 128 dataSource: generateData(ttp_total_pages * parseFloat(ttp_posta_per_page)), 129 pageSize: parseFloat(ttp_posta_per_page), 130 autoHidePrevious: true, 131 autoHideNext: true, 132 prevText: '<i class="fa fa-angle-double-left" aria-hidden="true"></i>', 133 nextText: '<i class="fa fa-angle-double-right" aria-hidden="true"></i>' 134 }); 135 $page_numbers.addHook('beforePaging', function (pagination) { 136 infinite_status = 1; 137 ttp_paged = pagination; 138 $page_numbers.addClass('rt-lm-loading'); 139 $page_numbers.pagination('disable'); 140 ajax_action(true, false); 141 }); 142 if (ttp_total_pages <= 1) { 143 $page_numbers.addClass('rt-hidden-elm'); 144 } else { 145 $page_numbers.removeClass('rt-hidden-elm'); 146 } 147 } 148 }, 149 getItemsArray = function (contentLoader) { 150 return contentLoader.find('.rt-grid-item').map(function () { 151 var _self = $(this); 152 if (_self.is(":visible")) { 153 return _self.attr("data-id"); 154 } 155 }).get(); 156 }, 157 animateAction = function () { 158 var $postItem = $('.rt-grid-item:not(.rt-ready-animation, .isotope-item)', container); 159 $postItem.addClass('rt-ready-animation animated fadeIn'); 160 }, 161 ajax_action = function (page_request, append) { 162 page_request = page_request || false; 163 append = append || false; 164 if (!page_request) { 165 ttp_paged = 1; 166 } 167 check_query(); 168 if (page_request == true && ttp_total_pages > 1 && paramsRequest.paged > ttp_total_pages) { 169 remove_placeholder_loading(); 170 return; 171 } 172 $.ajax({ 173 url: ttp.ajaxurl, 174 type: 'POST', 175 data: paramsRequest, 176 cache: false, 177 beforeSend: function () { 178 placeholder_loading(); 179 }, 180 success: function (data) { 181 if (!data.error) { 182 ttp_paged = data.paged; 183 ttp_total_pages = data.total_pages; 184 if (data.paged >= ttp_total_pages) { 185 if ($loadmore.length) { 186 $loadmore.addClass('rt-hidden-elm'); 187 } 188 if ($infinite.length) { 189 infinite_status = 1; 190 $infinite.addClass('rt-hidden-elm'); 191 } 192 if ($page_prev_next.length) { 193 if (!page_request) { 194 $page_prev_next.addClass('rt-hidden-elm'); 195 } else { 196 $page_prev_next.find('.rt-cb-prev-btn').removeClass('rt-disabled'); 197 $page_prev_next.find('.rt-cb-next-btn').addClass('rt-disabled'); 198 } 199 } 200 } else { 201 if ($loadmore.length) { 202 $loadmore.removeClass('rt-hidden-elm'); 203 } 204 if ($infinite.length) { 205 infinite_status = 0; 206 $infinite.removeClass('rt-hidden-elm'); 207 } 208 if ($page_prev_next.length) { 209 if (!page_request) { 210 $page_prev_next.removeClass('rt-hidden-elm'); 211 } else { 212 if (data.paged == 1) { 213 $page_prev_next.find('.rt-cb-prev-btn').addClass('rt-disabled'); 214 $page_prev_next.find('.rt-cb-next-btn').removeClass('rt-disabled'); 215 } else { 216 $page_prev_next.find('.rt-cb-prev-btn').removeClass('rt-disabled'); 217 $page_prev_next.find('.rt-cb-next-btn').removeClass('rt-disabled'); 218 } 219 } 220 } 221 } 222 if (append) { 223 if (isIsotope.length) { 224 IsotopeWrap.append(data.data) 225 .isotope('appended', data.data) 226 .isotope('reloadItems') 227 .isotope('updateSortData') 228 .isotope(); 229 IsotopeWrap.imagesLoaded(function () { 230 preFunction(); 231 IsotopeWrap.isotope(); 232 }); 233 } else if (isMasonry.length) { 234 mIsotopeWrap.append(data.data).isotope('appended', data.data).isotope('updateSortData').isotope('reloadItems'); 235 mIsotopeWrap.imagesLoaded(function () { 236 mIsotopeWrap.isotope(); 237 }); 238 } else { 239 contentLoader.append(data.data); 240 } 241 } else { 242 if (isMasonry.length) { 243 mIsotopeWrap.html(data.data); 244 mIsotopeWrap.imagesLoaded(function () { 245 mIsotopeWrap.isotope(); 246 }); 247 } else { 248 contentLoader.html(data.data); 249 } 250 } 251 contentLoader.imagesLoaded(function () { 252 preFunction(); 253 remove_placeholder_loading(); 254 }); 255 if (!page_request) { 256 createPagination(); 257 } 258 animateAction(); 259 } else { 260 remove_placeholder_loading(); 261 } 262 }, 263 error: function () { 264 remove_placeholder_loading(); 265 } 266 }); 267 if ($('.paginationjs-pages .paginationjs-page', $page_numbers).length > 0) { 268 $page_numbers.pagination('enable'); 269 } 270 }, 271 specialLayoutEqualHeight = function () { 272 var target = $('.special-selected-top-wrap > .img'); 273 target.imagesLoaded(function () { 274 var imgHeight = target.outerHeight(); 275 $('.special-selected-top-wrap .ttp-label, .special-selected-bottom-wrap').height(imgHeight); 276 }); 277 }, 278 scrollToTopMember = function () { 279 if ($(window).width() < 768) { 280 $('html, body').animate({ 281 scrollTop: $('#special-selected-wrapper').offset().top - 35 282 }, 200); 283 } 284 }; 285 286 switch ($pagination_wrap.attr('data-type')) { 287 case 'load_more': 288 $loadmore.on('click', function () { 289 $(this).addClass('rt-lm-loading'); 290 ttp_paged = ttp_paged + 1; 291 ajax_action(true, true); 292 }); 293 break; 294 case 'pagination_ajax': 295 createPagination(); 296 break; 297 case 'pagination': 298 break; 299 case 'load_on_scroll': 300 $(window).on('scroll load', function () { 301 infinite_scroll(); 302 }); 303 break; 304 case 'page_prev_next': 305 if (ttp_paged == 1) { 306 $page_prev_next.find('.rt-cb-prev-btn').addClass('rt-disabled'); 307 } 308 if (ttp_paged == ttp_total_pages) { 309 $page_prev_next.find('.rt-cb-next-btn').addClass('rt-disabled'); 310 } 311 if (ttp_total_pages == 1) { 312 $page_prev_next.addClass('rt-hidden-elm'); 313 } 314 break; 315 } 316 317 if (str) { 318 var qsRegex, buttonFilter; 319 if (preLoader.find('.rt-loading-overlay').length == 0) { 320 preLoader.append(html_loading); 321 } 322 323 if (isCarousel.length) { 324 isCarousel.imagesLoaded(function () { 325 if (str === "carousel10") { 326 var carouselOptions = caroThumb.data('options'); 327 328 RTElementThumbCarousel(container, carouselOptions, elementThumbInstances, index); 329 remove_placeholder_loading(); 330 } else { 331 rtSliderInit($); 332 } 333 334 $(document).on('rttm_slider_loaded', function () { 335 remove_placeholder_loading(); 336 }); 337 }); 338 } else if (isIsotope.length) { 339 if (!buttonFilter) { 340 buttonFilter = IsoButton.find('button.selected').data('filter'); 341 } 342 IsotopeWrap = isIsotope.imagesLoaded(function () { 343 preFunction(); 344 IsotopeWrap.isotope({ 345 itemSelector: '.isotope-item', 346 masonry: { columnWidth: '.isotope-item' }, 347 filter: function () { 348 return buttonFilter ? $(this).is(buttonFilter) : true; 349 } 350 }); 351 setTimeout(function () { 352 IsotopeWrap.isotope(); 353 remove_placeholder_loading(); 354 }, 100); 355 }); 356 357 IsoButton.on('click touchstart', 'button', function (e) { 358 e.preventDefault(); 359 buttonFilter = $(this).attr('data-filter'); 360 IsotopeWrap.isotope(); 361 $(this).parent().find('.selected').removeClass('selected'); 362 $(this).addClass('selected'); 363 }); 364 365 } else if (isSpecial.length) { 366 var selected = container.find('.special-items-wrapper .rt-grid-item.selected'), 367 selectedId = selected.attr('data-id'); 368 selected.remove(); 369 target = container.find('#special-selected-wrapper'); 370 if (selectedId) { 371 $.ajax({ 372 url: ttp.ajaxurl, 373 type: 'POST', 374 data: { memberId: selectedId, scID: scID, action: 'rtGetSpecialLayoutData',tlp_nonce:ttp.nonce }, 375 cache: false, 376 beforeSend: function () { 377 placeholder_loading(); 378 }, 379 success: function (data) { 380 if (!data.error) { 381 target.html(data.data); 382 target.attr('data-id', selectedId); 383 specialLayoutEqualHeight(); 384 remove_placeholder_loading(); 385 } 386 }, 387 error: function () { 388 remove_placeholder_loading(); 389 } 390 } 391 ); 392 } 393 394 $(document).on('click', '.single-team-item.image-wrapper', function () { 395 var self = $(this), 396 id = self.attr('data-id'), 397 toggleId = target.attr('data-id'); 398 $.ajax({ 399 url: ttp.ajaxurl, 400 type: 'POST', 401 data: { memberId: id, toggleId: toggleId, scID: scID, action: 'rtGetSpecialLayoutData',tlp_nonce:ttp.nonce }, 402 cache: false, 403 beforeSend: function () { 404 placeholder_loading(); 405 }, 406 success: function (data) { 407 if (!data.error) { 408 target.attr('data-id', id); 409 target.html(data.data); 410 self.attr('data-id', toggleId); 411 self.parent().attr('data-id', toggleId); 412 self.html("<img class='img-responsive rt-profile-img' src='" + data.toggle_image_src + "' />"); 413 specialLayoutEqualHeight(); 414 remove_placeholder_loading(); 415 scrollToTopMember(); 416 } 417 }, 418 error: function () { 419 remove_placeholder_loading(); 420 } 421 } 422 ); 423 }); 424 425 $(window).on('resize', function () { 426 specialLayoutEqualHeight(); 427 }); 428 429 } else if (container.find('.rt-row.rt-content-loader.ttp-masonry').length) { 430 var masonryTarget = $('.rt-row.rt-content-loader.ttp-masonry', container); 431 mIsotopeWrap = masonryTarget.imagesLoaded(function () { 432 preFunction(); 433 mIsotopeWrap.isotope({ 434 itemSelector: '.masonry-grid-item', 435 masonry: { columnWidth: '.masonry-grid-item' } 436 }); 437 remove_placeholder_loading(); 438 }); 439 } else { 440 var target = $('.rt-row.rt-content-loader.ttp-masonry', container); 441 target.imagesLoaded(function () { 442 preFunction(); 443 remove_placeholder_loading(); 444 }); 445 } 446 } 447 448 $('#' + id).on('click', '.rt-search-filter-wrap .rt-action', function (e) { 449 search_wrap.find('input').prop("disabled", true); 450 ajax_action(); 451 }); 452 $('#' + id).on('keypress', '.rt-search-filter-wrap .rt-search-input', function (e) { 453 if (e.which == 13) { 454 search_wrap.find('input').prop("disabled", true); 455 ajax_action(); 456 } 457 }); 458 $('#' + id).on('click', '.rt-filter-dropdown-wrap', function (event) { 459 var self = $(this); 460 self.toggleClass('active-dropdown'); 461 });// Dropdown click 462 $('#' + id).on('click', '.term-dropdown-item', function (event) { 463 $loadmore.addClass('rt-lm-loading'); 464 var $this_item = $(this), 465 default_target = $taxonomy_filter.find('.rt-filter-dropdown-default'), 466 old_param = default_target.attr('data-term'), 467 old_text = default_target.find('.rt-text').html(); 468 $this_item.parents('.rt-filter-dropdown-wrap').removeClass('active-dropdown'); 469 $this_item.parents('.rt-filter-dropdown-wrap').toggleClass('active-dropdown'); 470 default_target
470.attr('data-term', $this_item.attr('data-term')); 471 default_target.find('.rt-text').html($this_item.html()); 472 $this_item.attr('data-term', old_param); 473 $this_item.html(old_text); 474 ajax_action(); 475 });//term 476 $('#' + id).on('click', '.order-by-dropdown-item', function (event) { 477 $loadmore.addClass('rt-lm-loading'); 478 var $this_item = $(this), 479 old_param = $default_order_by.attr('data-order-by'), 480 old_text = $default_order_by.find('.rt-text-order-by').html(); 481 482 $this_item.parents('.rt-order-by-action').removeClass('active-dropdown'); 483 $this_item.parents('.rt-order-by-action').toggleClass('active-dropdown'); 484 $default_order_by.attr('data-order-by', $this_item.attr('data-order-by')); 485 $default_order_by.find('.rt-text-order-by').html($this_item.html()); 486 $this_item.attr('data-order-by', old_param); 487 $this_item.html(old_text); 488 ajax_action(); 489 });//Order By 490 491 //Sort Order 492 $('#' + id).on('click', '.rt-sort-order-action', function (event) { 493 $loadmore.addClass('rt-lm-loading'); 494 var $this_item = $(this), 495 $sort_order_elm = $('.rt-sort-order-action-arrow', $this_item), 496 sort_order_param = $sort_order_elm.attr('data-sort-order'); 497 if (typeof (sort_order_param) != 'undefined' && sort_order_param.toLowerCase() == 'desc') { 498 $default_order.attr('data-sort-order', 'ASC'); 499 } else { 500 $default_order.attr('data-sort-order', 'DESC'); 501 } 502 ajax_action(); 503 });//Sort Order 504 505 $taxonomy_filter.on('click touchstart', '.rt-filter-button-item', function () { 506 var self = $(this); 507 self.parents('.rt-filter-button-wrap').find('.rt-filter-button-item').removeClass('selected'); 508 self.addClass('selected'); 509 ajax_action(); 510 }); 511 512 $page_prev_next.on('click', '.rt-cb-prev-btn', function (event) { 513 if (ttp_paged <= 1) { 514 return; 515 } 516 ttp_paged = ttp_paged - 1; 517 ajax_action(true, false); 518 }); 519 $page_prev_next.on('click', '.rt-cb-next-btn', function (event) { 520 if (ttp_paged >= ttp_total_pages) { 521 return; 522 } 523 ttp_paged = ttp_paged + 1; 524 ajax_action(true, false); 525 }); 526 527 // md Popup 528 $(document).on('click', '.ttp-single-md-popup', function (e) { 529 e.preventDefault(); 530 var id = $(this).attr("data-id"); 531 var data = "action=tlp_md_popup_single&id=" + id+"&tlp_nonce="+ttp.nonce; 532 var modalWrapper = ".tlp-modal-" + scID; 533 534 $.ajax({ 535 type: "post", 536 url: ttp.ajaxurl, 537 data: data, 538 beforeSend: function () { 539 mdModalWrap.addClass("tlp-modal-" + scID); 540 // mdModalWrap.addClass("tlp-modal-" + randId); 541 mdModalWrap.addClass('md-show'); 542 mdModalWrap.find('.tlp-md-content-holder').html('<div class="tlp-md-loading">Loading...</div>'); 543 var modalWrapper = ".tlp-modal-" + scID; 544 // var modalWrapper = ".tlp-modal-" + randId; 545 $(modalWrapper + " .md-content").css("background-color", popupBg); 546 // $(modalWrapper + " .tlp-md-content").css("background-color", popupBg); 547 548 }, 549 success: function (data) { 550 mdModalWrap.find('.tlp-md-content-holder').html(data.data); 551 }, 552 complete: function () { 553 // $(modalWrapper + " .md-content > .tlp-md-content-holder .tlp-md-content").css("background-color", popupBg); 554 }, 555 error: function (e) { 556 console.log(e); 557 } 558 }); 559 return false; 560 }); 561 562 // Smart Popup 563 $(document).on('click', '.ttp-smart-popup', function (e) { 564 e.preventDefault(); 565 var self = $(this), 566 id = $(this).attr("data-id"), 567 container = self.parents('.rt-team-container'), 568 containerId = container.attr("data-sc-id"), 569 contentLoader = $('.rt-row.rt-content-loader', container), 570 smartModal = { 571 currentId: id, 572 ids: getItemsArray(contentLoader) || [], 573 wrap: '', 574 wrapper: "<div id='rt-smart-modal-container' class='rt-modal-" + containerId + "'><div class='rt-smart-modal-main'>" + 575 "<div class='rt-smart-modal-header'>" + 576 "<span class='rt-smart-modal-nav'>" + 577 "<a href='#' class='rt-smart-nav-left rt-smart-nav-item'><i class='fa fa-angle-left' aria-hidden='true'></i></a>" + 578 "<a href='#' class='rt-smart-nav-right rt-smart-nav-item'><i class='fa fa-angle-right' aria-hidden='true'></i></a>" + 579 "</span>" + 580 "<a href='#' class='rt-smart-modal-close'><i class='fa fa-times'> </i></a>" + 581 "</div>" + 582 "<div class='rt-smart-modal' style='background:"+ popupBg +"'><div class='rt-smart-modal-main-content-wrapper'></div></div>" + 583 "</div></div>", 584 setWrap: function () { 585 this.wrap = $('body > #rt-smart-modal-container'); 586 return this; 587 }, 588 addModal: function () { 589 $('html').addClass('rt-smart-modal-on'); 590 this.setWrap(); 591 if (!this.wrap.length) { 592 $('body').append(this.wrapper); 593 this.setWrap(); 594 } 595 if (!this.wrap.hasClass('ready')) { 596 this.wrap.append("<span class='rt-spinner'></span>"); 597 } 598 this.wrap.addClass('open'); 599 }, 600 removeModal: function () { 601 $('html').removeClass('rt-smart-modal-on'); 602 this.wrap.removeClass('open loading ready').find('.rt-smart-modal-main-content-wrapper').html(''); 603 }, 604 addLoading: function () { 605 this.wrap.addClass('loading').find('.rt-smart-modal-main-content-wrapper').html('<span class="rt-spinner"></span>'); 606 return this; 607 }, 608 removeLoading: function () { 609 this.wrap.removeClass('loading').find('.rt-spinner').remove(); 610 return this; 611 }, 612 addData: function (data) { 613 this.wrap.find('.rt-smart-modal-main-content-wrapper').html(data); 614 return this; 615 }, 616 setNextID: function () { 617 var index = this.ids.indexOf(this.currentId); 618 index++; 619 if (index >= this.ids.length) 620 index = 0; 621 this.currentId = this.ids[index]; 622 }, 623 setPrevId: function () { 624 var index = this.ids.indexOf(this.currentId); 625 index--; 626 if (index < 0) 627 index = this.ids.length - 1; 628 this.currentId = this.ids[index]; 629 }, 630 renderScript: function () { 631 $('.tlp-tooltip', this.wrap).rtTooltip(); 632 $('.tlp-team-skill', this.wrap).find('.fill').css('width', '0%'); 633 $('.tlp-team-skill .fill', this.wrap).each(function () { 634 var k = 0, f = $(this), p = f.attr('data-progress-animation'), w = f.width(); 635 if (w == 0) { 636 p = p.substring(0, p.length - 1); 637 var go = function () { 638 return k >= p || k >= 100 ? (false) : (k += 1, f.css('width', k + '%'), setTimeout(go, 20)) 639 }; 640 go(); 641 } 642 }); 643 rtSliderInit(jQuery); 644 // this.wrap.find('.rt-smart-modal-main-content-wrapper').mCustomScrollbar(); 645 this.wrap.find('.rt-smart-modal-main-content').mCustomScrollbar(); 646 this.wrap.find('.rt-smart-modal-main-content').css('opacity', 1); 647 }, 648 rightClick: function () { 649 this.setNextID(); 650 this.requestData(); 651 }, 652 leftClick: function () { 653 this.setPrevId(); 654 this.requestData(); 655 }, 656 requestData: function () { 657 var data = { 658 action: 'tlp_team_smart_popup', 659 id: this.currentId 660 }, 661 modal = this; 662 data[ttp.nonceID] = ttp.nonce; 663 $.ajax({ 664 type: "post", 665 url: ttp.ajaxurl, 666 data: data, 667 beforeSend: function () { 668 modal.addModal(); 669 modal.addLoading(); 670 }, 671 success: function (response) { 672 modal.removeLoading(); 673 modal.addData(response.data); 674 modal.wrap.addClass('ready'); 675 modal.renderScript(); 676 }, 677 error: function (e) { 678 console.log(e); 679 } 680 }); 681 } 682 }; 683 smartModal.requestData(); 684 smartModal.wrap.find('.rt-smart-modal-close').on('click', function (e) { 685 e.preventDefault(); 686 smartModal.removeModal(); 687 return false;
688 }); 689 690 smartModal.wrap.find('.rt-smart-nav-right').on('click', function (e) { 691 e.preventDefault(); 692 smartModal.rightClick(); 693 return false; 694 }); 695 smartModal.wrap.find('.rt-smart-nav-left').on('click', function (e) { 696 e.preventDefault(); 697 smartModal.leftClick(); 698 return false; 699 }); 700 701 return false; 702 }); 703 704 $(document).on('click', '.ttp-multi-popup', function () { 705 var self = $(this), 706 current = self.attr("data-id"), 707 contentLoader = self.parents('.rt-team-container').children('.rt-row.rt-content-loader'), 708 itemArray = getItemsArray(contentLoader), 709 data = "action=tlp_multi_popup_single&id=" + current+"&tlp_nonce="+ttp.nonce, 710 popupWrap, popupContainer; 711 712 $.ajax({ 713 type: "post", 714 url: ttp.ajaxurl, 715 data: data, 716 beforeSend: function () { 717 initPopupTeamPro(); 718 setLevelTeamPro(current, itemArray); 719 popupWrap = $("#tlp-popup-wrap"); 720 popupWrap.addClass("tlp-popup-wrap-" + scID); 721 // popupWrap.addClass("tlp-popup-wrap-" + randId); 722 popupContainer = $(".tlp-popup-content", popupWrap); 723 var modalWrapper = ".tlp-popup-wrap-" + scID; 724 // var modalWrapper = ".tlp-popup-wrap-" + randId; 725 $(modalWrapper + " .tlp-popup-navigation-wrap").css("background-color", popupBg); 726 }, 727 success: function (data) { 728 popupContainer.html(data.data); 729 }, 730 error: function (e) { 731 console.log(e); 732 popupContainer.html("<p>Loading error!!!</p>"); 733 } 734 }); 735 736 popupWrap.find('.tlp-popup-next').on('click', function () { 737 rightClick(); 738 }); 739 popupWrap.find('.tlp-popup-prev').on('click', function () { 740 leftClick(); 741 }); 742 popupWrap.find('.tlp-popup-close').on('click', function () { 743 ttpAnimation(); 744 }); 745 746 $(window).bind('keydown', function (event) { 747 if (event.keyCode === 27) { // Esc 748 ttpAnimation(); 749 } else if (event.keyCode === 37) { // left arrow 750 leftClick(); 751 } else if (event.keyCode === 39) { // right arrow 752 rightClick(); 753 } 754 }); 755 756 function rightClick() { 757 var nextId = nextItem(current, itemArray); 758 current = nextId; 759 var data = ttp.nonceID + "=" + ttp.nonce + "&action=tlp_multi_popup_single&id=" + current; 760 $.ajax({ 761 type: "post", 762 url: ttp.ajaxurl, 763 data: data, 764 beforeSend: function () { 765 setLevelTeamPro(current, itemArray); 766 popupContainer.html('<div class="tlp-popup-loading"></div>'); 767 }, 768 success: function (data) { 769 popupContainer.html(data.data); 770 }, 771 error: function (e) { 772 console.log(e); 773 } 774 }); 775 } 776 777 function leftClick() { 778 var prevId = prevItem(current, itemArray); 779 current = prevId; 780 var data = ttp.nonceID + "=" + ttp.nonce + "&action=tlp_multi_popup_single&id=" + current; 781 $.ajax({ 782 type: "post", 783 url: ttp.ajaxurl, 784 data: data, 785 beforeSend: function () { 786 setLevelTeamPro(current, itemArray); 787 popupContainer.html('<div class="tlp-popup-loading"></div>'); 788 }, 789 success: function (data) { 790 popupContainer.html(data.data); 791 }, 792 error: function (e) { 793 console.log(e); 794 } 795 }); 796 } 797 798 return false; 799 }); 800 801 802 }); 803 }; 804 initTlpTeam(); 805 function preFunction() { 806 HeightResize(); 807 } 808 809 function equalHeight4Layout4() { 810 var $maxH = $(".rt-row.rt-content-loader.layout4 .layout4item").height(); 811 $(".rt-row.rt-content-loader.layout4 .layout4item .layoutInner .rt-img-holder img,.rt-row.rt-content-loader.layout4 .layout4item .layoutInner.layoutInner-content").height($maxH + "px"); 812 } 813 814 function HeightResize() { 815 if($(".rt-team-container[data-layout*='layout']").length > 0) { 816 return; 817 } 818 819 var wWidth = $(window).width(); 820 $(".rt-team-container").each(function () { 821 var self = $(this), 822 dCol = self.data('desktop-col'), 823 tCol = self.data('tab-col'), 824 mCol = self.data('mobile-col'), 825 target = $(this).find('.rt-row.rt-content-loader.ttp-even'); 826 if ((wWidth >= 992 && dCol > 1) || (wWidth >= 768 && tCol > 1) || (wWidth < 768 && mCol > 1)) { 827 target.imagesLoaded(function () { 828 var tlpMaxH = 0; 829 target.find('.even-grid-item').height('auto'); 830 target.find('.even-grid-item').each(function () { 831 var $thisH = $(this).outerHeight(); 832 if ($thisH > tlpMaxH) { 833 tlpMaxH = $thisH; 834 } 835 }); 836 target.find('.even-grid-item').height(tlpMaxH + "px"); 837 }); 838 } else { 839 target.find('.even-grid-item').height('auto'); 840 } 841 842 }); 843 if ($(".rt-row.rt-content-loader.layout4").length) { 844 equalHeight4Layout4(); 845 } 846 } 847 848 function ttpAnimation() { 849 var $pHolder = jQuery('#tlp-popup-wrap'); 850 $pHolder.animate({ 851 marginLeft: parseInt($pHolder.css('marginLeft'), 10) == 0 ? 852 $pHolder.outerWidth() : 0, 853 }).promise().done(function () { 854 if (parseInt($pHolder.css('marginLeft')) > 0) { 855 $pHolder.remove(); 856 } 857 }); 858 } 859 860 function initPopupTeamPro() { 861 var html = '<div id="tlp-popup-wrap" class="tlp-popup-wrap tlp-popup-singlePage-sticky tlp-popup-singlePage">' + 862 '<div class="tlp-popup-content">' + 863 '<div class="tlp-popup-loading"></div>' + 864 '</div>' + 865 '<div class="tlp-popup-navigation-wrap">' + 866 '<div class="tlp-popup-navigation">' + 867 '<div class="tlp-popup-prev" title="Previous (Left arrow key)" data-action="prev"> <i class="fas fa-angle-left"></i></div>' + 868 '<div class="tlp-popup-close" title="Close (Esc arrow key)" data-action="close"> <i class="fas fa-times"></i> </div>' + 869 '<div class="tlp-popup-next" title="Next (Right arrow key)" data-action="next"> <i class="fas fa-angle-right"></i> </div>' + 870 '<div class="tlp-popup-singlePage-counter"><span class="ccurrent"></span> ' + ttp.lan.of + ' <span class="ctotal"></span></div>' + 871 '</div>' + 872 '</div>' + 873 '</div>'; 874 $("body").append(html); 875 var $pHolder = $('#tlp-popup-wrap'); 876 $pHolder.css('display', 'block');
877 var navHeight = $pHolder.find('.tlp-popup-navigation-wrap').height(); 878 $pHolder.find('.tlp-popup-content').css('padding-top', navHeight + "px"); 879 ttpAnimation(); 880 } 881 882 function nextItem(current, list) { 883 var index = list.indexOf(current); 884 index++; 885 if (index >= list.length) 886 index = 0; 887 return list[index]; 888 } 889 890 function prevItem(current, list) { 891 var index = list.indexOf(current); 892 index--; 893 if (index < 0) 894 index = list.length - 1; 895 return list[index]; 896 } 897 898 function setLevelTeamPro(current, list) { 899 var index = list.indexOf(current) + 1, 900 count = list.length; 901 $(".ccurrent").text(index); 902 $(".ctotal").text(count); 903 } 904 905 function navResize() { 906 var $pHolder = jQuery('#tlp-popup-wrap'); 907 $pHolder.css('display', 'block'); 908 } 909 910 $(window).on('load resize', function () { 911 navResize(); 912 HeightResize(); 913 if ($(".tlp-md-content").length) { 914 $(".tlp-md-content").mCustomScrollbar({ 915 scrollbarPosition: "outside" 916 }); 917 } 918 }); 919 $.fn.alterClass = function (removals, additions) { 920 var self = this; 921 if (removals.indexOf('*') === -1) { 922 // Use native jQuery methods if there is no wildcard matching 923 self.removeClass(removals); 924 return !additions ? self : self.addClass(additions); 925 } 926 var patt = new RegExp('\\s' + 927 removals.replace(/\*/g, '[A-Za-z0-9-_]+').split(' ').join('\\s|\\s') + 928 '\\s', 'g'); 929 self.each(function (i, it) { 930 var cn = ' ' + it.className + ' '; 931 while (patt.test(cn)) { 932 cn = cn.replace(patt, ' '); 933 } 934 it.className = $.trim(cn); 935 }); 936 return !additions ? self : self.addClass(additions); 937 }; 938 939 $('.md-close').on('click', function (e) { 940 e.preventDefault(); 941 mdModalWrap.removeClass('md-show'); 942 mdModalWrap.alterClass('tlp-modal-*'); 943 mdModalWrap.find('.tlp-md-content-holder').html(''); 944 }); 945 946 skillAnimation(); 947 948 if( $('.tlp-tooltip').length > 0 ) { 949 $('.tlp-tooltip').rtTooltip(); 950 } 951 952 var RttmSlider = function ($slider) { 953 this.$slider = $slider; 954 this.slider = this.$slider.get(0); 955 this.swiperSlider = this.slider.swiper || null; 956 this.defaultOptions = { 957 breakpointsInverse: true, 958 observer: true, 959 navigation: { 960 nextEl: this.$slider.find('.swiper-button-next').get(0), 961 prevEl: this.$slider.find('.swiper-button-prev').get(0), 962 }, 963 pagination: { 964 el: this.$slider.find('.swiper-pagination').get(0), 965 type: 'bullets', 966 clickable: true 967 } 968 }; 969 970 this.slider_enabled = 'function' === typeof Swiper; 971 this.options = Object.assign({}, this.defaultOptions, this.$slider.data('options') || {}); 972 this.initSlider = function () { 973 if (!this.slider_enabled) { 974 return; 975 } 976 if (this.options.rtl) { 977 this.$slider.attr('dir', 'rtl'); 978 } 979 if (this.swiperSlider) { 980 this.swiperSlider.parents = this.options; 981 this.swiperSlider.update(); 982 } else { 983 this.swiperSlider = new Swiper(this.$slider.get(0), this.options); 984 } 985 }; 986 this.imagesLoaded = function () { 987 if(this.$slider.data('options').lazy) { 988 this.$slider.trigger('rttm_slider_loaded', this); 989 return; 990 } 991 992 var that = this; 993 994 if (!$.isFunction($.fn.imagesLoaded) || $.fn.imagesLoaded.done) { 995 this.$slider.trigger('rttm_slider_loading', this); 996 this.$slider.trigger('rttm_slider_loaded', this); 997 return; 998 } 999 1000 this.$slider.imagesLoaded().progress(function (instance, image) { 1001 that.$slider.trigger('rttm_slider_loading', [that]); 1002 }).done(function (instance) { 1003 that.$slider.trigger('rttm_slider_loaded', [that]); 1004 }); 1005 }; 1006 this.start = function () { 1007 var that = this; 1008 this.$slider.on('rttm_slider_loaded', this.init.bind(this)); 1009 setTimeout(function () { 1010 that.imagesLoaded(); 1011 }, 1); 1012 }; 1013 this.init = function () { 1014 this.initSlider(); 1015 }; 1016 this.rtSwiper = function () { 1017 return new Swiper(this.$slider.get(0), this.options); 1018 }; 1019 1020 this.start(); 1021 }; 1022 1023 $.fn.rttm_slider = function () { 1024 new RttmSlider(this); 1025 return this; 1026 }; 1027 window.rttmpBuilderInit = { 1028 initSlider: function () { 1029 var $ = jQuery; 1030 rtSliderInit($); 1031 }, 1032 initLoader: function () { 1033 $(".rttmp-team-builder").each(function (index) { 1034 var container = $(this), 1035 loader = container.find(".rt-content-loader"); 1036 1037 loader.find('.rt-loading').fadeOut(300); 1038 loader.removeClass('ttp-pre-loader'); 1039 }); 1040 1041 } 1042 }; 1043 rttmpBuilderInit.initLoader(); 1044 rttmpBuilderInit.initSlider() 1045 1046 1047})(jQuery); 1048 1049function rtSliderInit($) {
1050 $('.rttm-carousel-slider').each(function () { 1051 $(this).rttm_slider(); 1052 }); 1053} 1054 1055function skillAnimation() { 1056 jQuery('.tlp-team-skill').find('.fill').css('width', '0%'); 1057 jQuery(window).bind('load', function () { 1058 jQuery('.tlp-team-skill').each(function () { 1059 jQuery(this).find('.fill').each(function () { 1060 var k = 0, f = jQuery(this), p = f.attr('data-progress-animation'), w = f.width(); 1061 if (w == 0) { 1062 p = p.substring(0, p.length - 1); 1063 var go = function () { 1064 return k >= p || k >= 100 ? (false) : (k += 1, f.css('width', k + '%'), setTimeout(go, 20)) 1065 }; 1066 go(); 1067 } 1068 }); 1069 }); 1070 }); 1071} 1072 1073function mdPopUpSkillAnimation() { 1074 rtSliderInit(jQuery); 1075 jQuery('#tlp-modal .tlp-md-content').mCustomScrollbar({ 1076 scrollbarPosition: 'outside' 1077 }); 1078 jQuery('#tlp-modal .tlp-tooltip').rtTooltip(); 1079 jQuery('#tlp-modal .tlp-md-content .tlp-team-skill').find('.fill').css('width', '0%'); 1080 1081 jQuery('#tlp-modal .tlp-md-content .tlp-team-skill').each(function () { 1082 jQuery(this).find('.fill').each(function () { 1083 var k = 0, f = jQuery(this), p = f.attr('data-progress-animation'), w = f.width(); 1084 if (w == 0) { 1085 p = p.substring(0, p.length - 1); 1086 var go = function () { 1087 return k >= p || k >= 100 ? (false) : (k += 1, f.css('width', k + '%'), setTimeout(go, 20)) 1088 }; 1089 go(); 1090 } 1091 }); 1092 }); 1093} 1094 1095function tlpSingleTeamScript() { 1096 jQuery('#tlp-popup-wrap .tlp-tooltip').rtTooltip(); 1097 jQuery('#tlp-popup-wrap .tlp-popup-content .tlp-team-skill').find('.fill').css('width', '0%'); 1098 jQuery('#tlp-popup-wrap .tlp-popup-content .tlp-team-skill .fill').each(function () { 1099 var k = 0, f = jQuery(this), p = f.attr('data-progress-animation'), w = f.width(); 1100 if (w == 0) { 1101 p = p.substring(0, p.length - 1); 1102 var go = function () { 1103 return k >= p || k >= 100 ? (false) : (k += 1, f.css('width', k + '%'), setTimeout(go, 20)) 1104 }; 1105 go(); 1106 } 1107 }); 1108 rtSliderInit(jQuery); 1109} 1110 1111function RTElementThumbCarousel(container, options, instance, index) { 1112 // Params 1113 var mainSlider = container.find('.rttm-carousel-main').addClass('instance-' + index), 1114 navSlider = container.find('.ttp-carousel-thumb').addClass('instance-' + index), 1115 navPrev = '.swiper-button-prev', 1116 navNext = '.swiper-button-next', 1117 dotsEl = '.swiper-pagination'; 1118 1119 container.find(navPrev).addClass('prev-' + index); 1120 container.find(navNext).addClass('next-' + index); 1121 1122 // Main Slider 1123 var mainSliderOptions = { 1124 loop: true, 1125 speed: options.speed ? options.speed : 1000, 1126 loopedSlides: 5, 1127 autoHeight: options.autoHeight ? options.autoHeight : false, 1128 navigation: { 1129 nextEl: navNext, 1130 prevEl: navPrev 1131 }, 1132 pagination: { 1133 el: dotsEl, 1134 type: 'bullets', 1135 clickable: true 1136 } 1137 }; 1138 1139 var main = new Swiper(mainSlider[0], mainSliderOptions); 1140 1141 // Navigation Slider 1142 var navSliderOptions = { 1143 loop: true, 1144 speed: options.speed ? options.speed : 1000, 1145 observer: true, 1146 observerParents: true, 1147 slidesPerView: options.slidesPerView ? options.slidesPerView : 5, 1148 centeredSlides: true, 1149 spaceBetween: 0, 1150 touchRatio: 0.2, 1151 slideToClickedSlide: true, 1152 loopedSlides: 5, 1153 watchSlidesProgress: true, 1154 breakpoints: options.breakpoints 1155 }; 1156 1157 if (options.autoplay) { 1158 navSliderOptions.autoplay = { 1159 delay: options.autoplay.delay, 1160 pauseOnMouseEnter: options.autoplay.pauseOnMouseEnter, 1161 disableOnInteraction: false 1162 }; 1163 } 1164 1165 if (options.lazy) { 1166 navSliderOptions.preloadImages = false; 1167 navSliderOptions.lazy = true; 1168 } 1169 1170 var thumb = new Swiper(navSlider[0], navSliderOptions); 1171 1172 // Syncing the sliders 1173 main.controller.control = thumb; 1174 thumb.controller.control = main; 1175 1176 instance[index] = [main, thumb]; 1177}
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.