1/* 2Name: Portfolio - Examples 3Written by: Okler Themes - (http://www.okler.net) 4Theme Version: 5.2.0 5*/ 6(function($) { 7 8 'use strict'; 9 10 /* 11 Portfolio on Modal 12 */ 13 $('a[data-portfolio-on-modal]').magnificPopup({ 14 mainClass: 'portfolio-modal', 15 type: 'inline', 16 gallery: { 17 enabled: true 18 }, 19 callbacks: { 20 beforeOpen: function() { 21 22 // Close 23 $('a[data-portfolio-close]').on('click', function(e) { 24 e.preventDefault(); 25 $.magnificPopup.close(); 26 }); 27 28 // Remove Next and Close 29 if($('a[data-portfolio-on-modal]').length <= 1) { 30 31 $('a[data-portfolio-prev], a[data-portfolio-next]').remove(); 32 33 } else { 34 35 // Prev 36 $('a[data-portfolio-prev]').on('click', function(e) { 37 e.preventDefault(); 38 $('.mfp-arrow-left').trigger('click'); 39 return false; 40 }); 41 42 // Next 43 $('a[data-portfolio-next]').on('click', function(e) { 44 e.preventDefault(); 45 $('.mfp-arrow-right').trigger('click'); 46 return false; 47 }); 48 49 } 50 51 } 52 } 53 }); 54 55 /* 56 Carousel 57 */ 58 if ($.isFunction($.fn.revolution)) { 59 $("#revolutionSliderCarousel").show().revolution({ 60 sliderType: "carousel", 61 sliderLayout: "fullwidth", 62 dottedOverlay: "none", 63 delay: 4000, 64 navigation: { 65 keyboardNavigation: "off", 66 keyboard_direction: "horizontal", 67 mouseScrollNavigation: "off", 68 onHoverStop: "off", 69 arrows: { 70 style: "tparrows-carousel", 71 enable: true, 72 hide_onmobile: false, 73 hide_onleave: false, 74 tmp: '', 75 left: { 76 h_align: "left", 77 v_align: "center", 78 h_offset: 30, 79 v_offset: 0 80 }, 81 right: { 82 h_align: "right", 83 v_align: "center", 84 h_offset: 30, 85 v_offset: 0 86 } 87 } 88 }, 89 carousel: { 90 maxRotation: 65, 91 vary_rotation: "on", 92 minScale: 55, 93 vary_scale: "off", 94 horizontal_align: "center", 95 vertical_align: "center", 96 fadeout: "on", 97 vary_fade: "on", 98 maxVisibleItems: 5, 99 infinity: "on", 100 space: -150, 101 stretch: "off" 102 }, 103 gridwidth: 600, 104 gridheight: 600, 105 lazyType: "none", 106 shadow: 0, 107 spinner: "off", 108 stopLoop: "on", 109 stopAfterLoops: 0, 110 stopAtSlide: -1, 111 shuffle: "off", 112 autoHeight: "off", 113 disableProgressBar: "on", 114 hideThumbsOnMobile: "off", 115 hideSliderAtLimit: 0, 116 hideCaptionAtLimit: 0, 117 hideAllCaptionAtLilmit: 0, 118 debugMode: false, 119 fallbacks: { 120 simplifyAll: "off", 121 nextSlideOnWindowFocus: "off", 122 disableFocusListener: false, 123 } 124 }); 125 } 126 127 /* 128 Medias 129 */ 130 if ($.isFunction($.fn.revolution)) { 131 $("#revolutionSliderMedias").show().revolution({ 132 sliderType: "standard", 133 sliderLayout: "auto", 134 dottedOverlay: "none", 135 delay: 9000, 136 navigation: { 137 keyboardNavigation: "off", 138 keyboard_direction: "horizontal", 139 mouseScrollNavigation: "off", 140 onHoverStop: "off", 141 tabs: { 142 style: "hesperiden hesperiden-custom", 143 enable: true, 144 width: 250, 145 height: 80, 146 min_width: 250, 147 wrapper_padding: 20, 148 wrapper_color: "#ffffff", 149 wrapper_opacity: "1", 150 tmp: '<div class="tp-tab-content"> <span class="tp-tab-date">{{param1}}</span> <span class="tp-tab-title">{{title}}</span></div><div class="tp-tab-image"></div>', 151 visibleAmount: 5, 152 hide_onmobile: false, 153 hide_onleave: false, 154 hide_delay: 200, 155 direction: "horizontal", 156 span: false, 157 position: "outer-bottom", 158 space: 0, 159 h_align: "left", 160 v_align: "bottom", 161 h_offset: 0, 162 v_offset: 0 163 } 164 }, 165 gridwidth: 1230, 166 gridheight: 692, 167 lazyType: "smart", 168 shadow: 0, 169 spinner: "off", 170 stopLoop: "on", 171 stopAfterLoops: 0, 172 stopAtSlide: 1, 173 shuffle: "off", 174 autoHeight: "off", 175 disableProgressBar: "on", 176 hideThumbsOnMobile: "off", 177 hideSliderAtLimit: 0, 178 hideCaptionAtLimit: 0, 179 hideAllCaptionAtLilmit: 0, 180 debugMode: false, 181 fallbacks: { 182 simplifyAll: "off", 183 nextSlideOnWindowFocus: "off", 184 disableFocusListener: false, 185 } 186 }); 187 } 188 189 /* 190 Ajax on Page 191 */ 192 var ajaxOnPage = { 193 194 pages: [], 195 currentPage: 0, 196 total: 0, 197 $ajaxBox: $('#porfolioAjaxBox'), 198 $ajaxBoxContent: $('#porfolioAjaxBoxContent'), 199 200 build: function() { 201 202 var self = this; 203 204 $('a[data-ajax-on-page]').each(function() { 205 self.add($(this)); 206 }); 207 208 $(document).on('mousedown', 'a[data-ajax-on-page]', function (ev) { 209 if (ev.which == 2) { 210 ev.preventDefault(); 211 return false;
212 } 213 }); 214 215 // Key Press 216 $(document.documentElement).on('keyup', function(e) { 217 218 // Next 219 if (e.keyCode == 39) { 220 self.next(); 221 } 222 223 // Prev 224 if (e.keyCode == 37) { 225 self.prev(); 226 } 227 228 }); 229 230 }, 231 232 add: function($el) { 233 234 var self = this, 235 href = $el.attr('data-href'); 236 237 self.pages.push(href); 238 self.total++; 239 240 $el.on('click', function(e) { 241 e.preventDefault(); 242 self.show(self.pages.indexOf(href)); 243 }); 244 245 }, 246 247 events: function() { 248 249 var self = this; 250 251 // Close 252 $('a[data-ajax-portfolio-close]').on('click', function(e) { 253 e.preventDefault(); 254 self.close(); 255 }); 256 257 if (self.total <= 1) { 258 259 $('a[data-ajax-portfolio-prev], a[data-ajax-portfolio-next]').remove(); 260 261 } else { 262 263 // Prev 264 $('a[data-ajax-portfolio-prev]').on('click', function(e) { 265 e.preventDefault(); 266 self.prev(); 267 }); 268 269 // Next 270 $('a[data-ajax-portfolio-next]').on('click', function(e) { 271 e.preventDefault(); 272 self.next(); 273 }); 274 275 } 276 277 // Carousel 278 if ($.isFunction($.fn['themePluginCarousel'])) { 279 280 $(function() { 281 $('[data-plugin-carousel]:not(.manual), .owl-carousel:not(.manual)').each(function() { 282 var $this = $(this), 283 opts; 284 285 var pluginOptions = $this.data('plugin-options'); 286 if (pluginOptions) 287 opts = pluginOptions; 288 289 $this.themePluginCarousel(opts); 290 }); 291 }); 292 293 } 294 295 }, 296 297 close: function() { 298 299 var self = this; 300 301 self.$ajaxBoxContent.empty(); 302 self.$ajaxBox.removeClass('ajax-box-init').removeClass('ajax-box-loading'); 303 304 }, 305 306 next: function() { 307 308 var self = this; 309 310 if(self.currentPage + 1 < self.total) { 311 self.show(self.currentPage + 1); 312 } else { 313 self.show(0); 314 } 315 }, 316 317 prev: function() { 318 319 var self = this; 320 321 if((self.currentPage - 1) >= 0) { 322 self.show(self.currentPage - 1); 323 } else { 324 self.show(self.total - 1); 325 } 326 }, 327 328 show: function(i) { 329 330 var self = this; 331 332 self.$ajaxBoxContent.empty(); 333 self.$ajaxBox.removeClass('ajax-box-init').addClass('ajax-box-loading'); 334 335 $('html, body').animate({ 336 scrollTop: self.$ajaxBox.offset().top - 100 337 }, 300, 'easeOutQuad'); 338 339 self.currentPage = i; 340 341 if (i < 0 || i > (self.total-1)) { 342 self.close(); 343 return false; 344 } 345 346 // Ajax 347 $.ajax({ 348 url: self.pages[i], 349 complete: function(data) { 350 351 setTimeout(function() { 352 353 self.$ajaxBoxContent.html(data.responseText).append('<div class="row"><div class="col-md-12"><hr class="tall mt-xl"></div></div>'); 354 self.$ajaxBox.removeClass('ajax-box-loading'); 355 356 self.events(); 357 358 }, 1000); 359 360 } 361 }); 362 363 } 364 365 } 366 367 if($('#porfolioAjaxBox').get(0)) { 368 ajaxOnPage.build(); 369 } 370 371 /* 372 Ajax on Modal 373 */ 374 $('a[data-ajax-on-modal]').magnificPopup({ 375 type: 'ajax', 376 tLoading: '<div class="bounce-loader"><div class="bounce1"></div><div class="bounce2"></div><div class="bounce3"></div></div>', 377 mainClass: 'portfolio-ajax-modal', 378 gallery: { 379 enabled: true 380 }, 381 callbacks: { 382 ajaxContentAdded: function() { 383 384 // Wrapper 385 var $wrapper = $('.portfolio-ajax-modal'); 386 387 // Close 388 $wrapper.find('a[data-ajax-portfolio-close]').on('click', function(e) { 389 e.preventDefault(); 390 $.magnificPopup.close(); 391 }); 392 393 // Remove Next and Close 394 if($('a[data-ajax-on-modal]').length <= 1) { 395 396 $wrapper.find('a[data-ajax-portfolio-prev], a[data-ajax-portfolio-next]').remove(); 397 398 } else { 399 400 // Prev 401 $wrapper.find('a[data-ajax-portfolio-prev]').on('click', function(e) { 402 e.preventDefault(); 403 $('.mfp-arrow-left').trigger('click'); 404 return false; 405 }); 406 407 // Next 408 $wrapper.find('a[data-ajax-portfolio-next]').on('click', function(e) { 409 e.preventDefault(); 410 $('.mfp-arrow-right').trigger('click'); 411 return false; 412 }); 413 414 } 415 416 // Carousel 417 $(function() { 418 $('[data-plugin-carousel]:not(.manual), .owl-carousel:not(.manual)').each(function() { 419 var $this = $(this), 420 opts; 421 422 var pluginOptions = $this.data('plugin-options'); 423 if (pluginOptions) 424 opts = pluginOptions; 425 426 $this.themePluginCarousel(opts); 427 }); 428 }); 429 430 } 431 } 432 }); 433 434 /*
435 Load More 436 */ 437 var portfolioLoadMore = { 438 439 pages: 0, 440 currentPage: 1, 441 $wrapper: $('#portfolioLoadMoreWrapper'), 442 $btn: $('#portfolioLoadMore'), 443 $loader: $('#portfolioLoadMoreLoader'), 444 445 build: function() { 446 447 var self = this 448 449 self.pages = self.$wrapper.data('total-pages'); 450 451 if(self.pages <= 1) { 452 453 self.$btn.remove(); 454 return; 455 456 } else { 457 458 self.$btn.on('click', function() { 459 //self.loadMore(); 460 }); 461 462 // Infinite Scroll 463 if(self.$btn.hasClass('btn-portfolio-infinite-scroll')) { 464 self.$btn.appear(function() { 465 //self.$btn.trigger('click'); 466 }, { 467 data: undefined, 468 one: false, 469 accX: 0, 470 accY: 0 471 }); 472 } 473 474 } 475 476 }, 477 loadMore: function() { 478 479 var self = this; 480 481 self.$btn.hide(); 482 self.$loader.show(); 483 484 // Ajax 485 $.ajax({ 486 url: 'ajax/portfolio-ajax-load-more-' + (parseInt(self.currentPage)+1) + '.html', 487 complete: function(data) { 488 489 var $items = $(data.responseText); 490 491 setTimeout(function() { 492 493 self.$wrapper.append($items) 494 495 self.$wrapper.isotope('appended', $items); 496 497 self.currentPage++; 498 499 if(self.currentPage < self.pages) { 500 self.$btn.show().blur(); 501 } else { 502 self.$btn.remove(); 503 } 504 505 // Carousel 506 $(function() { 507 $('[data-plugin-carousel]:not(.manual), .owl-carousel:not(.manual)').each(function() { 508 var $this = $(this), 509 opts; 510 511 var pluginOptions = $this.data('plugin-options'); 512 if (pluginOptions) 513 opts = pluginOptions; 514 515 $this.themePluginCarousel(opts); 516 }); 517 }); 518 519 self.$loader.hide(); 520 521 }, 1000); 522 523 } 524 }); 525 526 } 527 528 } 529 530 if($('#portfolioLoadMoreWrapper').get(0)) { 531 portfolioLoadMore.build(); 532 } 533 534 /* 535 Pagination 536 */ 537 var portfolioPagination = { 538 539 pages: 0, 540 $wrapper: $('#portfolioPaginationWrapper'), 541 $filter: $('#portfolioPaginationFilter'), 542 $pager: $('#portfolioPagination'), 543 544 init: function() { 545 546 var self = this; 547 548 self.$filter.on('filtered', function(event, laidOutItems) { 549 self.build(); 550 }); 551 552 }, 553 554 calcPages: function() { 555 556 var self = this, 557 filter = self.$wrapper.attr('data-filter'), 558 itemsPerPage = parseInt(self.$wrapper.attr('data-items-per-page')), 559 $activeItems = self.$wrapper.find(filter + '.isotope-item'); 560 561 self.$wrapper.find('.isotope-item').removeAttr('data-page-rel'); 562 563 $activeItems.each(function(i) { 564 var itemPage = Math.ceil((i+1)/itemsPerPage); 565 566 $(this).attr('data-page-rel', ((itemPage == 0) ? 1 : itemPage)); 567 568 if (itemPage > 1) { 569 $(this).hide(); 570 } 571 }); 572 573 self.$wrapper.isotope('layout'); 574 575 return Math.ceil($activeItems.length/itemsPerPage); 576 }, 577 578 build: function() { 579 580 var self = this; 581 582 self.pages = self.calcPages(); 583 584 self.$wrapper.removeAttr('data-current-page'); 585 586 self.$pager.empty().unbind(); 587 588 if(self.pages <= 1) { 589 590 return; 591 592 } else { 593 594 self.$wrapper.attr('data-current-page', 1); 595 596 self.$pager.bootpag({ 597 total: self.pages, 598 page: 1 599 }).on('page', function(event, num) { 600 self.$wrapper.attr('data-current-page', num); 601 self.$filter.find('.active a').trigger('click'); 602 }); 603 604 } 605 606 self.$filter.find('.active a').trigger('click'); 607 608 } 609 610 } 611 612 if($('#portfolioPagination').get(0)) { 613 portfolioPagination.init(); 614 } 615 616 /* 617 Combination Filters 618 */ 619 if($('.combination-filter').get(0)) { 620 621 $(window).on('load', function() { 622 623 setTimeout(function() { 624 625 var $grid = $('.portfolio-list').isotope({ 626 itemSelector: '.isotope-item', 627 layoutMode: 'masonry', 628 filter: '*', 629 hiddenStyle: { 630 opacity: 0 631 }, 632 visibleStyle: { 633 opacity: 1 634 }, 635 stagger: 30, 636 isOriginLeft: ($('html').attr('dir') == 'rtl' ? false : true) 637 }); 638 639 var filters = {}, 640 $loader = $('.sort-destination-loader'); 641 642 $('.combination-filter').on('click', 'a', function(e) { 643 644 e.preventDefault(); 645 646 var $this = $(this); 647 648 var $buttonGroup = $this.parents('.portfolio-filter-group'); 649 var filterGroup = $buttonGroup.attr('data-filter-group'); 650 651 filters[filterGroup] = $this.parent().attr('data-option-value'); 652 653 var filterValue = concatValues(filters); 654 655 $grid.isotope({ 656 filter: filterValue 657 }); 658 }); 659 660 $('.portfolio-filter-group').each(function(i, buttonGroup) { 661 var $buttonGroup = $(buttonGroup); 662 $buttonGroup.on('click', 'a', function() { 663 $buttonGroup.find('.active').removeClass('active'); 664 $(this).parent().addClass('active'); 665 }); 666 }); 667 668 var concatValues = function(obj) { 669 var value = ''; 670 for (var prop in obj) { 671 value += obj[prop]; 672 } 673 return value; 674 } 675 676 if ($loader) { 677 $loader.removeClass('sort-destination-loader-showing'); 678 679 setTimeout(function() { 680 $loader.addClass('sort-destination-loader-loaded'); 681 }, 500); 682 } 683 684 }, 1000); 685 686 }); 687 688 } 689 690}).apply(this, [jQuery]);
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.