1(function($){ 2 3 "use strict"; 4 5 var Core = { 6 7 TRANSITIONSUPPORTED : $('html').hasClass('md_csstransitions'), 8 TRANSITIONEND : "webkitTransitionEnd otransitionend oTransitionEnd msTransitionEnd transitionend", 9 ISRTL : getComputedStyle(document.body).direction === 'rtl' ? true : false, 10 ISTOUCH : $('html').hasClass('md_touch'), 11 12 windowLoad: function(){ 13 14 var self = this; 15 16 this.preloader(1000); 17 this.helpers.fullWidthBlocks(); 18 19 setTimeout(function(){ 20 self.isotope.init(); 21 },200); 22 23 this.helpers.fullScreenView(); 24 this.helpers.revolutionSliderEvents(); 25 this.events.toggleViewFullScreen(); 26 this.helpers.documentHeightFix(); 27 28 }, 29 30 DOMReady: function(){ 31 32 this.helpers.prepareExtendedBlock(); 33 this.helpers.prepareOwlControls(); 34 this.components.flowCarousel(); 35 this.events.closeButton(); 36 this.events.actions(); 37 this.events.animationBox(); 38 this.events.cookieControl(); 39 this.events.jItemsTouchHover(); 40 this.initializeSVGIcons(); 41 this.components.subscribeForm.init(); 42 this.components.productRating(); 43 this.components.qty(); 44 this.components.contactForm.init(); 45 this.components.protectedForm.init(); 46 this.flickrFeed(); 47 this.dribbbleFeed(); 48 this.components.progressBarsFill(); 49 this.components.statisticCounters(); 50 this.components.beforeAfter(); 51 this.helpers.fancyboxValidate(); 52 this.albums.init(); 53 54 if($('body').hasClass('horizontal_menu_type')) this.mainNavigation.initHorizontalMenu(); 55 else this.mainNavigation.initVerticalMenu(); 56 window.mainNavigation = this.mainNavigation; 57 58 if(window.ie9placeholder){ 59 window.ie9placeholder(); 60 } 61 62 }, 63 64 preloader: function(delay){ 65 66 delay = delay || 0; 67 68 var l = $('#page_loader'); 69 70 l.delay(delay).animate({ 71 opacity: 0 72 }, 1000, function(){ 73 $(this).remove(); 74 }); 75 76 }, 77 78 /** 79 ** extends jQuery by own mini plugins 80 **/ 81 extend : function(){ 82 83 $.fn.extend({ 84 85 /** 86 ** Accordion plugin 87 ** @param toggle - set to true, if need to be toggle 88 ** @return jQuery 89 **/ 90 accordion : function(toggle){ 91 92 return this.each(function(){ 93 94 var $this = $(this), 95 active = $this.children('dt.active').length ? $this.children('dt.active') : $this.children('dt:first').addClass('active'); 96 97 $this.children('dt').not(active).next().hide(); 98 99 $this.on('click', 'dt', function(){ 100 101 if(!toggle){ 102 $(this).addClass('active') 103 .siblings('dt') 104 .removeClass('active') 105 .end() 106 .next('dd') 107 .stop() 108 .slideDown() 109 .siblings('dd') 110 .stop() 111 .slideUp(); 112 } 113 else{ 114 $(this).toggleClass('active').next().stop().slideToggle(); 115 } 116 117 }); 118 119 }); 120 121 }, 122 123 /** 124 ** Emulates select form element 125 ** @return jQuery 126 **/ 127 customSelect : function(){ 128 129 // template 130 var template = "<div class='active_option open_select'><div class='inner'></div></div><ul class='options_list dropdown'></ul>"; 131 132 return this.each(function(){ 133 134 var $this = $(this); 135 136 $this.prepend(template); 137 138 var active = $this.children('.active_option'), 139 activeInner = active.children('.inner'), 140 list = $this.children('.options_list'), 141 select = $this.children('select').hide(), 142 options = select.children('option'); 143 144 active.on('click', function(){ 145 active.add(list).toggleClass('opened'); 146 }); 147 148 activeInner.text( 149 select.children('option[selected]').val() ? 150 select.children('option[selected]').val() : 151 options.eq(0).val() 152 ); 153 154 options.each(function(){ 155 156 var template = $('<li></li>',{ 157 text : $(this).val() 158 }); 159 160 list.append(template); 161 162 }); 163 164 list.on("click", "li", function(){ 165 166 var v = $(this).text(); 167 activeInner.text(v); 168 select.val(v); 169 170 if(!Core.TRANSITIONSUPPORTED){ 171 $(this).closest('.dropdown').add(active).removeClass("active"); 172 }else{ 173 $(this).closest(list).add(active).removeClass("opened"); 174 } 175 176 }); 177 178 }); 179 180 }, 181 182 calendar : function(options){ 183 184 var $this = $(this), 185 186 calendar = { 187 188 init: function(container){ 189 190 var self = this; 191 192 self.container = container; 193 self.currentDate = new Date(); 194 self.CDYear = self.currentDate.getFullYear(); 195 self.CDMonth = self.currentDate.getMonth(); 196 self.dCurrentDate = new Date(self.CDYear, self.CDMonth); 197 self.counter = self.CDMonth; 198 self.generateContainers(self.dCurrentDate); 199 self.bindEvents(); 200 201 }, 202 203 generateContainers: function(date){ 204 205 var self = this, 206 wrap = $('<table class="j_calendar"></table>'),
207 header = $('<thead><tr><th colspan="7" class="jc_header">'+options.months[date.getMonth()]+ ' ' + date.getFullYear() +'</th></tr></thead>'), 208 tbody = '<tbody>', 209 dayLabels = $('<tr></tr>'), 210 footer = $('<footer class="jc_actions"><a href="#" class="jc_prev" data-dir="prev"><span>«</span>'+options.prevNextLabels[self.currentDate.getMonth() - 1]+'</a><a href="#" class="jc_next j_hide" data-dir="next">'+options.prevNextLabels[self.currentDate.getMonth() + 1]+'<span>»</span></a><footer>'); 211 212 for(var i = 0; i < 7; i++) 213 dayLabels.append('<th>'+options.dayLabels[i]+'</th>'); 214 215 header.append(dayLabels); 216 217 tbody += self.generateMonthMarkup(self.CDYear, self.CDMonth) + '</tbody>'; 218 219 wrap.append(header); 220 wrap.append(tbody); 221 self.container.html(wrap); 222 223 wrap.after(footer); 224 225 self.body = self.container.find('tbody'); 226 self.prev = footer.children('.jc_prev'); 227 self.next = footer.children('.jc_next'); 228 self.header = self.container.find('.jc_header'); 229 230 }, 231 232 generateMonthMarkup: function(year, month){ 233 234 var date = new Date(year, month), 235 self = this, 236 template = "<tr>"; 237 238 // fill empty cells 239 for(var i = 0; i < self.getTableDay(date); i++) template += "<td></td>"; 240 241 // generate full month 242 while(date.getMonth() == month){
243 if(year == self.CDYear && month == self.CDMonth && date.getDate() == self.currentDate.getDate()) 244 template += '<td class="active">'+date.getDate()+'</td>'; 245 else{ 246 var isEvent = false; 247 $.each(options.events, function(i, obj){ 248 if(obj.date.valueOf() == date.valueOf()){ 249 template += '<td><a href="'+obj.link+'" class="tooltip_container">'+date.getDate()+'<span class="tooltip top">'+obj.description+'</span></a></td>'; 250 isEvent = true; 251 return false; 252 } 253 }); 254 if(!isEvent){ 255 template += '<td>'+date.getDate()+'</td>'; 256 isEvent = false; 257 } 258 } 259 if (self.getTableDay(date) % 7 == 6) template += '</tr><tr>'; 260 date.setDate(date.getDate()+1); 261 } 262 if(self.getTableDay(date) != 0){ 263 for (var i=self.getTableDay(date); i<7; i++){ 264 template += '<td></td>'; 265 } 266 } 267 268 return template; 269 270 }, 271 272 getTableDay: function(date){ 273 var day = date.getDay(); 274 if (day == 0) day = 7; 275 return day - 1; 276 }, 277 278 bindEvents: function(){ 279 280 var self = this; 281 self.prev.add(self.next).on('click', {self: self}, self.changeMonthHandler); 282 283 }, 284 285 changeMonthHandler: function(event){ 286 event.preventDefault(); 287 288 var self = event.data.self, 289 direction = $(this).data('dir'), 290 ddMonth = self.dCurrentDate.getMonth(); 291 292 if(direction == "prev"){ 293 self.dCurrentDate.setMonth(--ddMonth); 294 --self.counter; 295 if(self.counter == 0) self.counter = 12; 296 } 297 else{ 298 self.dCurrentDate.setMonth(++ddMonth); 299 ++self.counter; 300 } 301 302 303 self.prev.html('<span>«</span>' + options.prevNextLabels[(self.counter-1) % 12]); 304 self.next.html(options.prevNextLabels[(self.counter+1) % 12] + '<span>»</span>'); 305 306 if(self.dCurrentDate.getMonth() == self.CDMonth && self.dCurrentDate.getFullYear() == self.CDYear) 307 self.next.addClass('j_hide'); 308 else 309 self.next.removeClass('j_hide'); 310 311 312 self.header.html(options.months[self.dCurrentDate.getMonth()] + " " + self.dCurrentDate.getFullYear()); 313 self.body.html(self.generateMonthMarkup(self.dCurrentDate.getFullYear(), self.dCurrentDate.getMonth())); 314 } 315 316 } 317 318 return $this.each(function(){ 319 320 calendar.init($(this)); 321 322 }); 323 324 }, 325 326 }); 327 328 }, 329 330 mainNavigation: { 331 332 initHorizontalMenu: function(){ 333 334 var self = this; 335 self.menuType = "H"; 336 self.pageWrap = $('body'); 337 self.header = $('#header'); 338 self.hMenu = $('#horizontal_menu_wrap'); 339 self.vMenu = $('#vertical_menu_wrap'); 340 self.w = $(window); 341 342 $('#toggle_menu').on('click.showMenu', {self: self}, self.toggleShowMenu); 343 344 self.bindHMEvents(); 345 346 }, 347 348 initVerticalMenu: function(){ 349 350 var self = this; 351 self.menuType = "V"; 352 self.pageWrap = $('body'); 353 self.header = $('#header'); 354 self.hMenu = $('#horizontal_menu_wrap'); 355 self.vMenu = $('#vertical_menu_wrap'); 356 self.w = $(window); 357 358 $('#toggle_menu').on('click.showMenu', {self: self}, self.toggleShowMenu); 359 360 self.bindVMEvents(); 361 }, 362 363 bindVMEvents: function(){ 364 365 var self = this; 366 367 self.vMenu.on('click.vmenu', 'a', {self: self}, self.linkEventHandler); 368 369 self.vMenu.on('click.menuFocusOut', function(event){ 370 371 if(event.pageX < self.vMenu.offset()[Core.ISRTL ? 'right' : 'left']) { 372 $('#toggle_menu').data('icon-object').toggle(true); 373 self.pageWrap.removeClass('menu_opened'); 374 self.vMenu.removeClass('opened'); 375 } 376 377 }); 378 379 }, 380 381 bindHMEvents: function(){ 382 383 var self = this; 384 385 if(Core.ISTOUCH){ 386 self.hMenu.on('click.hmenuResponsive', 'a', {self: self}, self.linkEventHandler); 387 } 388 389 $(document).on('click.menuFocusOut', function(event){ 390 391 if($(event.target).closest(self.hMenu.selector).length) return; 392 393 if(Core.TRANSITIONSUPPORTED && self.w.width() > 767){ 394 self.hMenu.find('.active') 395 .removeClass("active") 396 .children("a") 397 .removeClass("prevented"); 398 } 399 else{ 400 self.hMenu.find('.active') 401 .removeClass("active") 402 .children("a") 403 .removeClass("prevented") 404 .siblings('.submenu') 405 .stop() 406 .slideUp(); 407 } 408 409 }); 410 411 self.checkMobile(self); 412 413 $(window).on('resize.mobile', function(){ 414 self.checkMobile(self); 415 }); 416 417 }, 418 419 toggleShowMenu: function(event){ 420 421 var self = event.data.self; 422 423 if(self.menuType == "V"){ 424 425 self.pageWrap.toggleClass('menu_opened'); 426 self.vMenu.toggleClass('opened'); 427 setTimeout(function(){ 428 if(self.vMenu.hasClass('opened')) self.vMenu.addClass('hf'); 429 else self.vMenu.removeClass('hf'); 430 }, 50); 431 } 432 else{ 433 434 self.header.toggleClass('menu_opened'); 435 self.hMenu.toggleClass('opened'); 436 if(self.w.width() < 768){ 437 self.hMenu.find('.navigation').slideToggle(); 438 } 439 } 440 441 }, 442 443 checkMobile: function(self){ 444 445 var self = self, 446 menu = self.hMenu.find('.navigation'); 447 448 if(self.w.width() < 768 && self.hMenu.hasClass('opened') && menu.is(':hidden')){ 449 menu.add(menu.find('.active').children('.submenu')).slideDown(); 450 } 451 if(self.w.width() < 768 && !self.hMenu.hasClass('opened') && menu.is(':visible')){ 452 menu.hide(); 453 } 454 455 if(!Core.ISTOUCH){ 456 if(self.w.width() < 768){ 457 self.hMenu.on('click.horizontalMobile', 'a', {self: self}, self.linkEventHandler); 458 } 459 else{ 460 self.hMenu.off('click.horizontalMobile'); 461 } 462 } 463 464 }, 465 466 linkEventHandler: function(event){ 467 468 var $this = $(this), 469 self = event.data.self; 470 471 if($this.siblings('.submenu').length){ 472 event.preventDefault(); 473 474 $this 475 .siblings('.submenu') 476 .stop() 477 .slideToggle() 478 .end() 479 .parent() 480 .toggleClass('active') 481 .siblings() 482 .removeClass('active') 483 .children('.submenu') 484 .stop() 485 .slideUp(); 486 487 } 488 489 }, 490 491 destroyVerticalMenu: function(){ 492 493 var self = this; 494 495 if(self.vMenu.hasClass('opened')) $('#toggle_menu').data('icon-object').toggle(true); 496 $('#toggle_menu').off('click.showMenu'); 497 self.vMenu.off('click.vmenu'); 498 self.vMenu.off('click.menuFocusOut'); 499 self.hMenu.off('click.horizontalMobile'); 500 if(self.vMenu.hasClass('opened')){ 501 self.pageWrap.removeClass('menu_opened'); 502 self.vMenu.removeClass('opened'); 503 } 504 505 }, 506 507 destroyHorizontalMenu: function(){ 508 509 var self = this; 510 511 if(self.hMenu.hasClass('opened')) $('#toggle_menu').data('icon-object').toggle(true); 512 $('#toggle_menu').off('click.showMenu'); 513 self.hMenu.off('click.hmenuResponsive'); 514 self.hMenu.off('click.horizontalMobile'); 515 $(document).off('click.menuFocusOut'); 516 if(self.hMenu.hasClass('opened')){ 517 self.header.removeClass('menu_opened'); 518 self.hMenu.removeClass('opened'); 519 } 520 } 521 522 }, 523 524 events: { 525 526 closeButton: function(){ 527 528 $('.close').on('click', function(e){ 529 530 e.preventDefault(); 531 532 $(this).parent().stop().animate({ 533 'opacity': 0 534 }, function(){ 535 $(this).slideUp(function(){ 536 $(this).remove(); 537 }); 538 }); 539 540 }); 541 542 }, 543 544 actions: function(){ 545 546 $('body').on('click.all', '.share', function(){ 547 548 $(this).toggleClass('active'); 549 550 }); 551 552 // like 553 554 $('body').on('click.like', '.like_btn', function(){ 555 556 var $this = $(this), 557 icons = $this.children(), 558 isLiked = $this.hasClass('active'), 559 val = $this.data('amount'); 560 561 if(isLiked){ 562 $this.removeClass('active'); 563 --val; 564 icons.not('.liked').attr('data-amount', val); 565 } 566 else{ 567 $this.addClass('active'); 568 ++val; 569 icons.not('.not_liked').attr('data-amount', val); 570 } 571 572 $this.data('amount', val); 573 574 }); 575 576 $('.play_pause_action_wrap').on('click', '.action_btn', function(e){ 577 $(this).parent().toggleClass('active'); 578 }); 579 580 }, 581 582 animationBox: function(){ 583 584 $('.toggle_box').on('click', function(e){ 585 586 var $this = $(this), 587 box = $this.next('.animation_box'); 588 589 // if($this.hasClass('si-icon')){ 590 // $this.data('icon-object').toggle(true); 591 // } 592 593 if(!box.hasClass('roll_in')){ 594 box.removeClass('roll_out').addClass('roll_in'); 595 }else{ 596 box.removeClass('roll_in').addClass('roll_out'); 597 } 598 599 }); 600 601 }, 602 603 toggleViewFullScreen: function(){ 604 605 var action = $('#toggle_view_fullscreen'), 606 hideCollection = $('#header, #footer, .gallery_slide_data, .page_actions > li:not(.fs_stay),.slide_title, .slide_desc'),
607 moveCollection = $('.slide_title, .slide_desc, .page_actions > li'), 608 thumbs = $('.tp-thumbs'); 609 610 action.on('click', function(event){ 611 612 hideCollection.toggleClass('fs_hide'); 613 614 if(revSlider !== undefined){ 615 616 if(hideCollection.hasClass('fs_hide') && moveCollection.hasClass('over_thumbs')){ 617 moveCollection.removeClass('over_thumbs'); 618 thumbs.removeClass('active'); 619 } 620 621 } 622 623 }); 624 625 }, 626 627 cookieControl: function(){ 628 629 var $cookie = $('.cookie_control'); 630 631 $cookie.on('click', '.accept', function(e){ 632 633 e.preventDefault(); 634 635 $cookie.fadeOut(700); 636 637 }); 638 639 }, 640 641 jItemsTouchHover: function(){ 642 643 var body = $('body'); 644 645 $('.md_touch .inner_j_item').on('click', '.overlay_link', function(e){ 646 647 var $this = $(this); 648 649 $this.closest('.inner_j_item').parent().siblings().find('.overlay_link').removeClass('prevented'); 650 651 if(!$this.hasClass('prevented')){ 652 e.preventDefault(); 653 $this.addClass('prevented'); 654 } 655 656 }); 657 658 } 659 660 }, 661 662 albums: { 663 664 init: function(){ 665 666 $('body').on('mouseenter.album', '.album_item', {self: this}, this.startSlideshow); 667 $('body').on('mouseleave.album', '.album_item', {self: this}, this.stopSlideshow); 668 669 }, 670 671 startSlideshow: function(event){ 672 673 var $this = $(this), 674 album = $this.find('.album'), 675 self = event.data.self; 676 677 self.len = album.children().length - 1; 678 self.intervalId = setInterval(self.slideshow.bind(album, self), 1500); 679 680 }, 681 682 slideshow: function(self){ 683 684 var active = this.children('.active'), 685 index = active.index(), 686 nextItem; 687 688 active.stop().animate({ 689 opacity: 0 690 }, 1000, function(){ 691 $(this).removeClass('active'); 692 }); 693 694 if(index == self.len) nextItem = active.siblings(':eq(0)'); 695 else nextItem = active.next(); 696 697 nextItem.stop().animate({ 698 opacity: 1 699 }, 1000, function(){ 700 $(this).addClass('active'); 701 }); 702 703 }, 704 705 stopSlideshow: function(event){ 706 707 var self = event.data.self; 708 clearTimeout(self.intervalId); 709 710 } 711 712 }, 713 714 components: { 715 716 progressBarsFill: function(){ 717 718 var w = $(window), 719 wH = w.height(); 720 721 722 $('.progress_bar').each(function(i){ 723 724 var $this = $(this), 725 val = $this.data('finish-value'), 726 bar = $this.children('span'), 727 offsetY = $this.offset().top - wH / 2; 728 729 $this.attr('data-finish-value', 0); 730 731 w.on('scroll.progressbars', function(i){ 732 733 if($this.data('animated')) return false; 734 735 if(w.scrollTop() + wH >= offsetY){ 736 737 Core.helpers.counter.call($this, 0, val, 'data-finish-value'); 738 739 bar.animate({ 740 741 width: val + '%' 742 743 },500, function(){ 744 745 $this.data('animated', true); 746 747 if(i == $this.parent().find('.progressbars').length - 1){ 748 w.off('scroll.progressbars'); 749 } 750 751 }); 752 753 } 754 755 }); 756 757 }); 758 759 }, 760 761 statisticCounters: function(){ 762 763 var c = $('.counter'), 764 w = $(window), 765 wH = w.height(), 766 len = c.length; 767 768 $('.counter').each(function(i){ 769 770 var $this = $(this), 771 val = $this.data('amount'), 772 offsetY = $this.offset().top - wH / 2; 773 774 $this.attr('data-amount', 0); 775 776 $(window).on('scroll.counters', function(){ 777 778 if(w.scrollTop() + wH >= offsetY){ 779 780 Core.helpers.counter.call($this, 0, val, 'data-amount'); 781 782 if(i == len - 1) w.off('scroll.counters'); 783 784 } 785 786 }); 787 788 }); 789 790 }, 791 792 subscribeForm: { 793 794 init: function(){ 795 796 this.f = $('.subscribe'); 797 798 this.f.on('submit', { obj: this }, this.eventHandler); 799 800 }, 801 802 eventHandler: function(event){ 803 804 event.preventDefault(); 805 806 if($(this).hasClass('informed')) return false; 807 808 var obj = event.data.obj; 809 810 $.ajax({ 811 url: 'php/subscribe.php', 812 type: 'post', 813 data: $(this).serialize(), 814 success: function(data){ 815 obj.showMessage(data); 816 } 817 }); 818 819 }, 820 821 showMessage: function(data){ 822 823 var type = data.indexOf("success") != -1 ? 'success' : 'error', 824 template = $("<div class='alert_box j_hide "+type+"'>"+data+"</div>"), 825 f = this.f; 826 827 if(type === "success") f.find('input').val(""); 828 829 f.addClass('informed'); 830 template.appendTo(f).slideDown(function(){ 831 $(this) 832 .delay(4000) 833 .slideUp(function(){ 834 f.removeClass('informed'); 835 $(this).remove(); 836 }); 837 }); 838 839 } 840 841 }, 842 843 contactForm: { 844 845 init: function(){ 846 847 var self = this; 848 849 self.cF = $('.contactform'); 850 851 852 self.cF.on("submit", { obj: this }, self.eventHandler); 853 854 }, 855 856 eventHandler: function(event){ 857 858 event.preventDefault(); 859 860 var self = event.data.obj, 861 $this = $(this); 862 863 if(!self.clientValidation($this) || self.cF.hasClass('informed')) return false;
864 865 $.ajax({ 866 url: 'php/contact-send.php', 867 type: 'post', 868 data: $this.serialize(), 869 success: function(data){ 870 871 var type = data.indexOf("success") != -1 ? 'success' : 'error'; 872 self.showMessage(data, type); 873 874 } 875 }); 876 877 }, 878 879 clientValidation: function(form){ 880 881 var self = this, 882 collection = form.find('[required]'), 883 minCCollection = form.find('[data-min-characters]'), 884 message = ""; 885 886 collection.each(function(i, el){ 887 if($(el).val() == ""){ 888 message += "All required fields must be filled! <br>"; 889 return false; 890 } 891 }); 892 893 minCCollection.each(function(i, el){ 894 message += self.minCharacters($(el)); 895 }); 896 897 if(message !== ""){ 898 self.showMessage(message, 'error'); 899 } 900 901 return message === ""; 902 }, 903 904 minCharacters: function(el){ 905 906 var amount = el.data('min-characters'); 907 908 return el.val().length < amount ? '"'+el.data('field-name') + '" Contenu doit avoir un minimum de '+amount+' caracteres!' + "<br>" : ""; 909 910 }, 911 912 showMessage: function(data, type){ 913 914 var template = $("<div class='alert_box j_hide "+type+"'>"+data+"</div>"), 915 f = this.cF; 916 917 if(type === "success") f.find('input, textarea').val(""); 918 919 f.addClass('informed'); 920 template.appendTo(f).slideDown(function(){ 921 $(this) 922 .delay(4000) 923 .slideUp(function(){ 924 f.removeClass('informed'); 925 $(this).remove(); 926 }); 927 }); 928 929 } 930 931 }, 932 933 /** 934 ** product raring 935 **/ 936 productRating : function(){ 937 938 $('.rating').each(function(){ 939 940 $(this).append("<div class='empty_state'><i class='icon-star-empty'></i><i class='icon-star-empty'></i><i class='icon-star-empty'></i><i class='icon-star-empty'></i><i class='icon-star-empty'></i></div><div class='fill_state'><i class='icon-star'></i><i class='icon-star'></i><i class='icon-star'></i><i class='icon-star'></i><i class='icon-star'></i></div>"); 941 942 var $this = $(this), 943 rating = $this.data("rating"), 944 fillState = $this.children('.fill_state'), 945 w = $this.outerWidth(); 946 947 fillState.css('width', rating / 5 * w); 948 949 }); 950 951 }, 952 953 qty : function(){ 954 955 $('body').on('click.quantity','.quantity [data-qty-direction]', function(){ 956 957 var $this = $(this), 958 d = $this.data('qty-direction'), 959 input = $this.siblings('input'), 960 c = +input.val(); 961 962 if(c == 1 && d == "minus") return; 963 964 input.val(d == "minus" ? --c : ++c); 965 966 }).on('keydown.qty','.quantity input', function(event){ 967 968 var kC = event.keyCode; 969 970 if( !((kC >= 48 && kC <= 57) || (kC >= 96 && kC <= 105) || kC == 8) ) event.preventDefault(); 971 972 }); 973 974 }, 975 976 protectedForm: { 977 978 container: $('.protected_form'), 979 980 init: function(){ 981 982 this.container.on('submit', {self: this}, this.handler); 983 984 }, 985 986 handler: function(event){ 987 988 var self = event.data.self; 989 990 event.preventDefault(); 991 992 if(self.container.hasClass('informed')) return false; 993 994 if($(this).find('input').val() === '123') window.location.href = 'galleries_flow.html'; 995 else self.showMessage('Your password is incorrect!', 'error') 996 997 }, 998 999 showMessage: function(data, type){ 1000 1001 var template = $("<div class='alert_box j_hide "+type+"'>"+data+"</div>"), 1002 f = this.container; 1003 1004 f.addClass('informed'); 1005 template.appendTo(f).slideDown(function(){ 1006 $(this) 1007 .delay(4000) 1008 .slideUp(function(){ 1009 f.removeClass('informed'); 1010 $(this).remove(); 1011 }); 1012 }); 1013 1014 } 1015 1016 }, 1017 1018 beforeAfter: function(){ 1019 1020 $('.before_after_wrap').each(function(){ 1021 var $this = $(this), 1022 after = $this.find('.after_img'), 1023 divider = $this.find('.ba_divider'); 1024 1025 after.width($this.width()/2); 1026 divider.css('left', ($this.width()/2)+'px'); 1027 }); 1028 1029 $('.before_after_wrap').mousemove(function(e){ 1030 1031 var $this = $(this), 1032 offset = $this.offset().left, 1033 pageX = e.pageX-offset, 1034 after = $this.find('.after_img'), 1035 divider = $this.find('.ba_divider'); 1036 1037 after.width(pageX); 1038 divider.css('left', pageX+'px'); 1039 1040 }); 1041 1042 }, 1043 1044 flowCarousel: function(){ 1045 1046 var whaterWheel = jQuery("#whaterwheel"), 1047 allSize = jQuery('.ww_block').size(); 1048 1049 var window_w = $(window).width(), 1050 window_h = $(window).height(), 1051 header = $('#header'), 1052 carouselWrap = $('.flow_carousel_wrap'), 1053 slideData = $('#gallery_slide_data'), 1054 title = slideData.children('.slide_caption'), 1055 desc = slideData.children('.slide_description'); 1056 1057 if(!carouselWrap.length) return false;
1058 1059 1060 setupWW(); 1061 1062 jQuery('.ww_link').click(function(){ 1063 setSlide(parseInt(jQuery(this).attr('data-count'))) 1064 }); 1065 1066 jQuery(document.documentElement).keyup(function (event) { 1067 if ((event.keyCode == 37) || (event.keyCode == 40)) { 1068 prev_ww(); 1069 // Right Arrow or Up Arrow 1070 } else if ((event.keyCode == 39) || (event.keyCode == 38)) { 1071 next_ww(); 1072 } 1073 }); 1074 1075 jQuery('#ww_finger').on("swipeleft",function(){ 1076 next_ww(); 1077 }); 1078 jQuery('#ww_finger').on("swiperight",function(){ 1079 prev_ww(); 1080 }); 1081 1082 whaterWheel.on('mousewheel', function(e){ 1083 1084 if (e.deltaY<0) { 1085 next_ww(); 1086 } else { 1087 prev_ww(); 1088 } 1089 e.preventDefault(); 1090 1091 }); 1092 1093 function next_ww() { 1094 "use strict"; 1095 var cur_slide = parseInt(jQuery('.curr').attr('data-count')); 1096 cur_slide++; 1097 if (cur_slide > allSize) cur_slide = 1; 1098 if (cur_slide < 1) cur_slide = allSize; 1099 setSlide(cur_slide); 1100 } 1101 function prev_ww() { 1102 "use strict"; 1103 var cur_slide = parseInt(jQuery('.curr').attr('data-count')); 1104 cur_slide--; 1105 if (cur_slide > allSize) cur_slide = 1; 1106 if (cur_slide < 1) cur_slide = allSize; 1107 setSlide(cur_slide); 1108 } 1109 1110 jQuery(window).load(function (){ 1111 "use strict"; 1112 setTimeout(setupWW,600); 1113 }); 1114 jQuery(window).on('resize.flow_carousel', function (){ 1115 "use strict"; 1116 whaterWheel.find('*').removeAttr('style'); 1117 setTimeout(setupWW,1000, true); 1118 carouselWrap.addClass('size_changing'); 1119 setTimeout(function(){ 1120 carouselWrap.removeClass('size_changing'); 1121 }, 1500); 1122 }); 1123 1124 var atr056 = 0, 1125 atr078 = 0, 1126 atr_main = 1, 1127 attrH = 0.7, 1128 attrMT = 0.15, 1129 attrMB = 0.15; 1130 function setSlide(cur) { 1131 "use strict"; 1132 if (window_w > 1025) { 1133 whaterWheel.find('img').unreflect(); 1134 } 1135 if (window_w > 960) { 1136 atr056 = 0.56; 1137 atr078 = 0.78; 1138 atr_main = 1; 1139 } else if (window_w > 760 && window_w < 960){ 1140 atr056 = 0.37; 1141 atr078 = 0.56; 1142 atr_main = 0.75; 1143 } else if (window_w < 760){ 1144 atr056 = 0.3; 1145 atr078 = 0.5; 1146 atr_main = 0.75; 1147 } 1148 jQuery('.prev2').removeClass('prev2'); 1149 jQuery('.prev').removeClass('prev'); 1150 jQuery('.curr').removeClass('curr'); 1151 jQuery('.next').removeClass('next'); 1152 jQuery('.next2').removeClass('next2'); 1153 jQuery('#ww_block'+cur).addClass('curr'); 1154 if (whaterWheel.hasClass('type5')) { 1155 if((cur+1) > allSize) { 1156 jQuery('#ww_block1').addClass('next'); 1157 jQuery('#ww_block2').addClass('next2'); 1158 } else if ((cur+1) == allSize){ 1159 jQuery('#ww_block'+allSize).addClass('next'); 1160 jQuery('#ww_block1').addClass('next2'); 1161 } else { 1162 jQuery('#ww_block'+(cur+1)).addClass('next'); 1163 jQuery('#ww_block'+(cur+2)).addClass('next2'); 1164 } 1165 if((cur-1) < 1) { 1166 jQuery('#ww_block'+allSize).addClass('prev'); 1167 jQuery('#ww_block'+(allSize-1)).addClass('prev2'); 1168 } else if ((cur-1) == 1){ 1169 jQuery('#ww_block1').addClass('prev'); 1170 jQuery('#ww_block'+allSize).addClass('prev2'); 1171 } else { 1172 jQuery('#ww_block'+(cur-1)).addClass('prev'); 1173 jQuery('#ww_block'+(cur-2)).addClass('prev2'); 1174 } 1175 } 1176 1177 var curr = whaterWheel.find('.curr'); 1178 1179 jQuery('.prev2').css('margin-left', -1*(curr.width()/2)-curr.width()*atr078/1.333-curr.width()*atr056/1.333); 1180 jQuery('.prev').css('margin-left', -1*(curr.width()/2)-curr.width()*atr078/1.333); 1181 curr.css('margin-left', -1*(curr.width()/2)); 1182 jQuery('.next').css('margin-left' , -1*(curr.width()/2)+curr.width()*atr078/1.333); 1183 jQuery('.next2').css('margin-left' , -1*(curr.width()/2)+curr.width()*atr078/1.333+curr.width()*atr056/1.333); 1184 1185 1186 slideData.addClass('changing'); 1187 setTimeout(function(){ 1188 title.text(jQuery('.curr').attr('data-title')); 1189 desc.text(jQuery('.curr').attr('data-description')); 1190 slideData.removeClass('changing'); 1191 },300); 1192 if (window_w > 1025) { 1193 whaterWheel.find('img').reflect({height:0.24,opacity:0.25}); 1194 whaterWheel.find('canvas').each(function(){ 1195 jQuery(this).width(jQuery(this).prev('img').width()); 1196 }); 1197 } 1198 } 1199 function setupWW(changeSize) { 1200 "use strict"; 1201 1202 window_w = $(window).width(); 1203 window_h = $(window).height(); 1204 whaterWheel.find('img').unreflect(); 1205 if (window_w > 1025) { 1206 whaterWheel.find('img').unreflect(); 1207 attrH = 0.6; 1208 attrMT = 0.2; 1209 attrMB = 0.2; 1210 } 1211 else if (window_w > 960) { 1212 atr056 = 0.56; 1213 atr078 = 0.78; 1214 atr_main = 1; 1215 attrH = 0.7; 1216 attrMT = 0.15; 1217 attrMB = 0.15; 1218 1219 } else if (window_w > 760 && window_w < 960){ 1220 atr056 = 0.37; 1221 atr078 = 0.56; 1222 atr_main = 1; 1223 attrH = 0.6; 1224 attrMT = 0.2; 1225 attrMB = 0.2; 1226 } else if (window_w < 760){ 1227 atr056 = 0.3; 1228 atr078 = 0.5; 1229 atr_main = 0.75; 1230 } 1231 1232 var setHeight = (window_h-jQuery('#footer').outerHeight() - jQuery('.slide_caption_wrap').outerHeight() + 80 -1)*atr_main;
1233 var setWidth = window_w - parseInt(whaterWheel.css('padding-left')) - parseInt(whaterWheel.css('padding-right')); 1234 1235 whaterWheel.width(setWidth).css({'margin-top' : setHeight*attrMT, 'margin-bottom' : setHeight*attrMB}); 1236 1237 whaterWheel.height((window_h-jQuery('#footer').outerHeight() - jQuery('.slide_caption_wrap').outerHeight() + 80)*attrH); 1238 if (jQuery('.curr').size() < 1) { 1239 if (whaterWheel.find('.ww_block').size() > 4) { 1240 whaterWheel.addClass('type5'); 1241 jQuery('#ww_block1').addClass('prev2'); 1242 jQuery('#ww_block2').addClass('prev'); 1243 jQuery('#ww_block3').addClass('curr'); 1244 jQuery('#ww_block4').addClass('next'); 1245 jQuery('#ww_block5').addClass('next2'); 1246 } else if (whaterWheel.find('.ww_block').size() > 2) { 1247 whaterWheel.addClass('type3'); 1248 jQuery('#ww_block1').addClass('prev'); 1249 jQuery('#ww_block2').addClass('curr'); 1250 jQuery('#ww_block3').addClass('next'); 1251 } else if (whaterWheel.find('.ww_block').size() == 2) { 1252 whaterWheel.addClass('type2'); 1253 jQuery('#ww_block1').addClass('curr'); 1254 jQuery('#ww_block2').addClass('next'); 1255 } else if (whaterWheel.find('.ww_block').size() == 1) { 1256 whaterWheel.addClass('type1'); 1257 jQuery('#ww_block1').addClass('curr'); 1258 } 1259 } 1260 1261 var curr = whaterWheel.find('.curr'); 1262 jQuery('.prev2').css('margin-left', -1*(curr.width()/2)-curr.width()*0.78/1.333-curr.width()*0.56/1.333); 1263 jQuery('.prev').css('margin-left', -1*(curr.width()/2)-curr.width()*0.78/1.333); 1264 curr.css('margin-left', -1*(curr.width()/2)); 1265 jQuery('.next').css('margin-left' , -1*(curr.width()/2)+curr.width()*0.78/1.333); 1266 jQuery('.next2').css('margin-left' , -1*(curr.width()/2)+curr.width()*0.78/1.333+curr.width()*0.56/1.333); 1267 title.text(jQuery('.curr').attr('data-title')); 1268 desc.text(jQuery('.curr').attr('data-description')); 1269 if (window_w > 1025) { 1270 whaterWheel.find('img').reflect({height:0.24,opacity:0.25}); 1271 whaterWheel.find('canvas').each(function(){ 1272 jQuery(this).width(jQuery(this).prev('img').width()); 1273 }); 1274 } 1275 1276 } 1277 1278 } 1279 1280 }, 1281 1282 initializeSVGIcons: function(){ 1283 1284 $('.si-icon').each(function(i, el){ 1285 1286 var iconData = $(el).data(); 1287 1288 if(!$(el).data('initialized')){ 1289 1290 $(el).data('initialized', true); 1291 1292 $(el).data('icon-object',new svgIcon(el, svgIconConfig, { size: { w: iconData.width, h: iconData.height}, evtoggle: iconData.event })); 1293 1294 } 1295 1296 }); 1297 1298 $('.si-icon[data-event="click"]').on('click', function(){ 1299 $(this).data('icon-object').toggle(true); 1300 }); 1301 1302 }, 1303 1304 helpers: { 1305 1306 counter: function(from, to, toAttribute){ 1307 1308 var $this = this; 1309 1310 var interval = setInterval(function(){ 1311 1312 if(toAttribute) $this.attr(toAttribute, ++from); 1313 1314 if(from == to) clearInterval(interval); 1315 1316 }, 4); 1317 1318 }, 1319 1320 fancyboxValidate: function(){ 1321 1322 $('.fancybox').each(function(){ 1323 $(this).attr('rel', $(this).attr('data-rel')); 1324 }); 1325 1326 }, 1327 1328 prepareExtendedBlock: function(){ 1329 var eW = $('.extended_wrap[data-image-url]'); 1330 1331 eW.css('background-image', 'url("' + eW.data('image-url') + '")'); 1332 1333 var tH = { 1334 1335 init: function(){ 1336 1337 var self = this; 1338 1339 self.h = $('#header'); 1340 1341 if(!$('.extended_wrap').length) return false; 1342 1343 self.hH = self.h.outerHeight(); 1344 self.pW = $('#page_wrap'); 1345 self.offsetT = self.pW.offset().top; 1346 self.w = $(window); 1347 1348 self.w.on('scroll.filled', {self : self}, self.scrollEvent); 1349 self.w.on('resize.updateProperties', {self: self}, self.updateProperties); 1350 1351 }, 1352 1353 scrollEvent: function(event){ 1354 1355 var self = event.data.self; 1356 1357 if(self.w.scrollTop() + self.hH > self.offsetT && !self.h.hasClass('filled')){ 1358 self.h.addClass('filled'); 1359 } 1360 else if(self.w.scrollTop() + self.hH < self.offsetT && self.h.hasClass('filled')){ 1361 self.h.removeClass('filled'); 1362 } 1363 1364 }, 1365 1366 updateProperties: function(event){ 1367 1368 var self = event.data.self; 1369 1370 self.offsetT = self.pW.offset().top; 1371 1372 } 1373 1374 } 1375 1376 tH.init(); 1377 1378 }, 1379 1380 fullWidthBlocks: function(){ 1381 1382 var fW = $('.full_width'); 1383 1384 fW.on('generate.columns', function(){ 1385 1386 var $this = $(this), 1387 wW = $('body').width(), 1388 iW = 370, // average width 1389 items = $this.children(); 1390 1391 var firefox = navigator.userAgent.toLowerCase().indexOf('firefox') > -1; 1392 var nth = wW % iW > 45 ? Math.ceil(wW / iW) : Math.floor(wW / iW); 1393 1394 items.css('width', 'auto'); 1395 1396 items.css('width', (firefox ? (100 / nth).toString().substring(0,4) : 100 / nth) + '%'); 1397 1398 }); 1399 1400 fW.trigger('generate.columns'); 1401 1402 $(window).on('resize.fullWidthcolumns', function(){ 1403 fW.trigger('generate.columns'); 1404 }); 1405 1406 }, 1407 1408 prepareOwlControls: function(){ 1409 1410 $('.owl_carousel').each(function(){ 1411 1412 var $this = $(this); 1413 1414 if($this.data('binded')) return; 1415 1416 $this.on('mousewheel', '.owl-stage', function(e){ 1417 1418 if (e.deltaY<0) { 1419 $this.trigger('next.owl.carousel'); 1420 } else { 1421 $this.trigger('prev.owl.carousel'); 1422 } 1423 e.preventDefault(); 1424 1425 }); 1426 1427 $this.data('binded', true); 1428 1429 $(document).on('keypress.owl', function(event){ 1430 1431 if(event.keyCode === 37) $this.trigger('prev.owl.carousel'); 1432 else if(event.keyCode === 39) $this.trigger('next.owl.carousel'); 1433 1434 }); 1435 1436 // custom controls with SVG icons 1437 1438 $this.siblings('.owl-prev').on('click', function(e){ 1439 $this.trigger('prev.owl.carousel'); 1440 }); 1441 1442 $this.siblings('.owl-next').on('click', function(e){ 1443 $this.trigger('next.owl.carousel'); 1444 }); 1445 1446 }); 1447 1448 }, 1449 1450 fullScreenView: function(){ 1451 1452 var w = $(window), 1453 fs = $('.full_screen_container'), 1454 pW = $('#page_wrap:not(.tilt_container)'), 1455 h = $('#header'), 1456 f = $('#footer'), 1457 pWT = $('#page_wrap.tilt_container'); 1458 1459 fs.add(pWT).on('setWindowHeight', function(){ 1460 1461 var wH = w.height(); 1462 $(this).css('height', wH); 1463 1464 }); 1465 1466 fs.add(pWT).trigger('setWindowHeight'); 1467 1468 w.on('resize.fullScreenView', function(){ 1469 fs.add(pWT).trigger('setWindowHeight'); 1470 }); 1471 1472 }, 1473 1474 revolutionSliderEvents: function(){ 1475 1476 if(!revSlider) return false;
1477 1478 var thumbs = $('.tp-thumbs'), 1479 moveCollection = $('.slide_title, .slide_desc, .page_actions > li'); 1480 1481 revSlider.on('mousewheel', function(e){ 1482 1483 if (e.deltaY<0) { 1484 1485 if(window.ISRTL) revSlider.revprev(); 1486 else revSlider.revnext(); 1487 1488 } else { 1489 1490 if(window.ISRTL) revSlider.revnext(); 1491 else revSlider.revprev(); 1492 } 1493 e.preventDefault(); 1494 1495 }); 1496 1497 $('#rs_prev').on('click', function(){ 1498 1499 revSlider.revprev(); 1500 1501 }); 1502 1503 $('#rs_next').on('click', function(){ 1504 1505 revSlider.revnext(); 1506 1507 }); 1508 1509 $('#rs_pause').on('click', function(){ 1510 1511 revSlider.revpause(); 1512 1513 }); 1514 1515 $('#rs_play').on('click', function(){ 1516 1517 revSlider.revresume(); 1518 1519 }); 1520 1521 $('#rs_show_thumbs').on('click', function(){ 1522 1523 thumbs.toggleClass('active'); 1524 moveCollection.toggleClass('over_thumbs'); 1525 1526 1527 }); 1528 1529 }, 1530 1531 documentHeightFix: function(){ 1532 1533 var doc = $(document), 1534 dW = $('#document_wrap'), 1535 w = $(window), 1536 pW = $('#page_wrap:not(.tilt_container)'), 1537 pwPB = parseInt(pW.css('padding-bottom')); 1538 1539 function checkHeight(){ 1540 1541 var diff = doc.height() - dW.outerHeight(); 1542 1543 if(diff > 0) pW.css('padding-bottom', pwPB + diff ); 1544 1545 } 1546 1547 checkHeight(); 1548 1549 $(window).on('resize.documentHeight', checkHeight); 1550 1551 } 1552 1553 }, 1554 1555 flickrFeed: function(){ 1556 1557 // flickr 1558 1559 var flickr = $('.flickr_feed'); 1560 1561 flickr.each(function(){ 1562 1563 var self = $(this), 1564 options = self.data('flickr-options'),config,defaults, 1565 rel = self.data('flickr-gallery'); 1566 1567 1568 defaults = { 1569 flickrbase:'http://api.flickr.com/services/feeds/', 1570 feedapi:'photos_public.gne', 1571 limit: 6, 1572 qstrings:{lang:'en-us',format:'json',jsoncallback:'?'}, 1573 cleanDescription:true, 1574 useTemplate:true, 1575 itemTemplate: '<li><a rel="'+rel+'" title="{{title}}" href="{{image}}" class="fancybox"><img alt="" src="{{image_s}}"/></a></li>', 1576 itemCallback:function(){} 1577 } 1578 1579 config = $.extend(defaults, options); 1580 1581 self.jflickrfeed(config,function(data){ 1582 self.find('.fancybox').fancybox(); 1583 }); 1584 1585 }); 1586 1587 }, 1588 1589 dribbbleFeed: function(){ 1590 1591 var dribbble = $('.dribbble_feed'); 1592 1593 dribbble.each(function(){ 1594 1595 var $this = $(this), 1596 user = $this.data('dribbble-user'), 1597 rel = $this.data('dribbble-gallery'), 1598 html = ""; 1599 1600 var callback = function (playerShots) { 1601 1602 $.each(playerShots.shots, function (i, shot) { 1603 html += '<li><a class="fancybox" rel="'+ rel +'" href="' + shot.image_url + '" title="'+ shot.title +'"><img src="' + shot.image_url + '" alt=""></a></li>'; 1604 }); 1605 1606 $this.html(html).find('.fancybox').fancybox(); 1607 }; 1608 1609 $.jribbble.getShotsByPlayerId(user, callback, {page: 1, per_page: 4}); 1610 1611 }); 1612 1613 }, 1614 1615 isotope : { 1616 1617 init: function(){ 1618 1619 this.container = $('[class*="isotope_container"]'); 1620 1621 if(!this.container.length) return; 1622 1623 this.wH = $(window).height(); 1624 1625 this.pageType = this.container.data("page-type"); 1626 this.url = this.container.data('url'); 1627 this.maxPosts = this.container.data('max-request-posts'); 1628 this.currentAmountOfPosts = this.container.find('.isotope_item').length; 1629 1630 this.setTransitionDelay(); 1631 1632 if(this.container.data('page-type') == undefined) return; 1633 1634 this.initFilter(this); 1635 this.bindScrollEvent(); 1636 1637 this.fillEmptyArea(); 1638 1639 $(window).on('resize.updateDocumentInfo', { self: this } , this.updateDocumentInfo); 1640 1641 }, 1642 1643 fillEmptyArea: function(){ 1644 1645 var self = this, 1646 h = $('#header').outerHeight() + parseInt($('#page_wrap').css('padding-top')); 1647 1648 var interval = setInterval(function(){ 1649 1650 if(self.container.outerHeight() < $(window).height()-h && self.currentAmountOfPosts < self.maxPosts){ 1651 self.loadMore(true); 1652 } 1653 else{ 1654 clearInterval(interval); 1655 } 1656 1657 }, 100); 1658 1659 }, 1660 1661 setTransitionDelay: function(){ 1662 1663 var self = this, 1664 items = self.container.children('.isotope_item').children(); 1665 1666 items.each(function(i, el){ 1667 1668 $(el)[0].style.transitionDelay = i / 20 + 's'; 1669 1670 }).promise().done(self.initialize.bind(self)); 1671 1672 }, 1673 1674 initialize: function(){ 1675 1676 var self = this, 1677 container = self.container, 1678 isMasonry = container.data('masonry'); 1679 1680 container.isotope({ 1681 itemSelector: '.isotope_item', 1682 layoutMode: isMasonry ? 'masonry' : 'fitRows', 1683 transitionDuration: '.7s', 1684 isOriginLeft: Core.ISRTL ? false : true, 1685 hiddenStyle: { 1686 opacity: 0 1687 }, 1688 visibleStyle : { 1689 opacity: 1 1690 } 1691 }); 1692 1693 container.isotope('on', 'layoutComplete', function(){ 1694 1695 var appended = container.find('.isotope_item.appended').children(); 1696 1697 container.addClass('loaded'); 1698 1699 appended.addClass('appended_item'); 1700 1701 if(Core.TRANSITIONSUPPORTED){ 1702 appended.on(Core.TRANSITIONEND, function(){ 1703 $(this).parent().addClass('loaded'); 1704 }); 1705 } 1706 else{ 1707 appended.parent().addClass('loaded'); 1708 } 1709 1710 if(!container.hasClass('filtered')) container.filter('.full_width').trigger('generate.columns'); 1711 1712 }); 1713 1714 container.isotope('layout'); 1715 1716 }, 1717 1718 initFilter: function(self){ 1719 1720 var filter = $('#filter'), 1721 filterBtn = $('#filter_btn'), 1722 fW = $('#filter_wrap'); 1723 1724 filter.on( 'click', '[data-filter]', function() { 1725 1726 $(this).addClass('active').siblings().removeClass('active'); 1727 1728 var filterValue = $(this).data('filter'); 1729 self.container.isotope({ filter: filterValue }); 1730 1731 self.container[filterValue == "*" ? 'removeClass' : 'addClass']('filtered'); 1732 1733 }); 1734 1735 $(document).on('click.filterFocusOut', function(event){ 1736 1737 if($(event.target).closest(fW).length) return; 1738 1739 if(filter.hasClass('roll_in')){ 1740 filterBtn.data('icon-object').toggle(true); 1741 filter.removeClass('roll_in').addClass('roll_out'); 1742 } 1743 1744 }); 1745 1746 1747 }, 1748 1749 updateDocumentInfo: function(event){ 1750 1751 var self = event.data.self; 1752 1753 setTimeout(function(){ 1754 1755 self.wH = $(window).height(); 1756 1757 if(!self.container.hasClass('all_posts_loaded')) self.bindScrollEvent(); 1758 }, 700); 1759 1760 if(self.pageType == "blog"){ 1761 setTimeout(function(){ 1762 self.container.isotope('layout'); 1763 },300); 1764 } 1765 1766 }, 1767 1768 bindScrollEvent: function(){ 1769 1770 var self = this, 1771 w = $(window), 1772 wH = self.wH / 2.25, 1773 container = self.container, 1774 offsetY = container.offset().top + container.outerHeight() - wH; 1775 1776 container.removeClass("scrolled"); 1777 1778 w.off('scroll.loadMoreItems'); 1779 1780 w.on("scroll.loadMoreItems", function(){ 1781 1782 var scrollT = w.scrollTop() + wH; 1783 1784 if(scrollT >= offsetY && !container.hasClass('scrolled')){ 1785 container.addClass('scrolled'); 1786 self.loadMore(); 1787 } 1788 1789 }); 1790 1791 }, 1792 1793 loadMore: function(isFirstLoad){ 1794 1795 var self = this, 1796 container = self.container; 1797 1798 $.ajax({ 1799 url: self.url, 1800 dataType: 'json', 1801 success: function(data){ 1802 self.appendNewItems(data.items,isFirstLoad); 1803 }, 1804 cache: false 1805 }); 1806 1807 }, 1808 1809 appendNewItems: function(data,isFirstLoad){ 1810 1811 var self = this, 1812 newItems = []; 1813 1814 $.each(data, function(i, obj){ 1815 1816 var item = self.generateTemplate(self.pageType, obj); 1817 1818 if(isFirstLoad) i = i - 10 + self.container.find('.isotope_item').length; 1819 1820 item.children()[0].style.transitionDelay = (i + 10) / 20 + 's'; 1821 1822 newItems.push(item); 1823 1824 self.currentAmountOfPosts++; 1825 1826 if(self.currentAmountOfPosts >= self.maxPosts){ 1827 self.container.addClass('all_posts_loaded'); 1828 return false;
1829 } 1830 1831 }); 1832 1833 self.container.append(newItems); 1834 1835 // slideshow post type 1836 1837 if(self.pageType == 'blog'){ 1838 1839 self.container.find('.owl_carousel:not(.owl-loaded)').owlCarousel({ 1840 animateOut: 'slideOutLeft', 1841 animateIn: 'flipInX', 1842 items: 1, 1843 smartSpeed: 300, 1844 loop: true, 1845 nav: true, 1846 dots: false, 1847 navText: [], 1848 autoHeight: true, 1849 rtl: window.ISRTL 1850 }); 1851 1852 } 1853 1854 self.container.isotope('appended', self.container.find('.isotope_item:not([style])')).isotope('layout'); 1855 1856 Core.helpers.prepareOwlControls(); 1857 Core.initializeSVGIcons(); 1858 1859 if(self.container.hasClass('all_posts_loaded')){ 1860 $(window).off('scroll.loadMoreItems'); 1861 return false; 1862 } 1863 else{ 1864 self.bindScrollEvent(); 1865 } 1866 1867 1868 addthis.toolbox('.addthis_toolbox'); 1869 var script = 'http://s7.addthis.com/js/250/addthis_widget.js#domready=1'; 1870 if (window.addthis) { 1871 window.addthis = null; 1872 window._adr = null; 1873 window._atc = null; 1874 window._atd = null; 1875 window._ate = null; 1876 window._atr = null; 1877 window._atw = null; 1878 } 1879 $.getScript(script); 1880 }, 1881 1882 generateTemplate: function(pageType, obj){ 1883 1884 var item = $('<div></div>', { 1885 class: 'isotope_item appended ' + obj.category 1886 }); 1887 1888 item.append(this.jItems.call(obj, obj.layoutType, pageType)); 1889 1890 return item; 1891 }, 1892 1893 jItems: function(layoutType, pageType){ 1894 1895 var index, 1896 self = this; 1897 1898 if(pageType == "portfolio" || pageType == "gallery"){ 1899 1900 switch(layoutType){ 1901 case 1 : 1902 case 5: 1903 index = 0; 1904 break; 1905 case 2: 1906 case 3: 1907 case 4: 1908 index = 1; 1909 break; 1910 // gallery wall items 1911 case 6: // wall item type 1 1912 layoutType = 1; 1913 index = 2; 1914 break; 1915 case 7: // wall item type 2 1916 layoutType = 2; 1917 index = 2; 1918 break; 1919 case 8: // wall iten type 3 1920 layoutType = 3; 1921 index = 2; 1922 break; 1923 case 10: // wall item type 5 1924 layoutType = 5; 1925 index = 2; 1926 break; 1927 case 9: 1928 layoutType = 4; // wall item type 4 1929 index = 3; 1930 break; 1931 } 1932 1933 if(pageType === "gallery" && self.images){ 1934 var album = ""; 1935 1936 $.each(self.images, function(i, obj){ 1937 var active = ""; 1938 if(i == 0) active = "active"; 1939 1940 album += "<li class="+active+"><img src=" + obj + " alt='' /></li>"; 1941 1942 }); 1943 1944 } 1945 1946 var wallItemLink = self.videoLink ? self.videoLink : self.lightBoxImage, 1947 wallItemClass = self.iconType == "video" ? 'fancybox_media' : 'fancybox'; 1948 1949 var portfolioLayouts = [ 1950 1951 "<div class='inner_j_item item_type_" + layoutType +"'>\ 1952 <img class='item_image' src='"+ self.imageSrc +"' alt=''>\ 1953 <a href='"+self.postLink+"' class='overlay_link'></a>\ 1954 <h4 class='title'><a href=" + self.postLink + ">" +self.postTitle+ "</a></h4>\ 1955 <div class='meta'>\ 1956 <div class='category'><a href=" + self.categoryLink + ">"+self.category+"</a></div>\ 1957 </div>\ 1958 </div>", 1959 1960 "<div class='inner_j_item item_type_" + layoutType +"'>\ 1961 <img class='item_image' src='"+ self.imageSrc +"' alt=''>\ 1962 <a href='"+self.postLink+"' class='overlay_link'></a>\ 1963 <div class='meta'>\ 1964 <h4 class='title'><a href=" + self.postLink + ">" +self.postTitle+ "</a></h4>\ 1965 <div class='category'><a href=" + self.categoryLink + ">"+self.category+"</a></div>\ 1966 </div>\ 1967 </div>" 1968 1969 ], 1970 1971 galleryLayouts = [ 1972 1973 "<div class='inner_j_item album_item item_type_" + layoutType +"'>\ 1974 <ul class='album'>"+ album +"</ul>\ 1975 <a href='"+self.postLink+"' class='overlay_link'></a>\ 1976 <h4 class='title'><a href=" + self.postLink + ">" +self.postTitle+ "</a></h4>\ 1977 <div class='meta'>\ 1978 <div class='category'><a href=" + self.categoryLink + ">"+self.category+"</a></div>\ 1979 </div>\ 1980 </div>", 1981 1982 "<div class='inner_j_item album_item item_type_" + layoutType +"'>\ 1983 <ul class='album'>"+ album +"</ul>\ 1984 <a href='"+self.postLink+"' class='overlay_link'></a>\ 1985 <div class='meta'>\ 1986 <h4 class='title'><a href=" + self.postLink + ">" +self.postTitle+ "</a></h4>\ 1987 <div class='category'><a href=" + self.categoryLink + ">"+self.category+"</a></div>\ 1988 </div>\ 1989 </div>", 1990 1991 // wall layouts 1992 1993 '<div class="wall_j_item type_'+layoutType+'">\
1994 <a href="'+wallItemLink+'" class="'+wallItemClass+' wall_image '+self.iconType+'" rel="'+self.galleryName+'">\ 1995 <img class="item_image" src="'+self.imageSrc+'" alt="">\ 1996 </a>\ 1997 </div>', 1998 1999 '<div class="wall_j_item type_'+layoutType+'">\ 2000 <a href="'+wallItemLink+'" class="'+wallItemClass+' wall_image" rel="'+self.galleryName+'">\ 2001 <img class="item_image" src="'+self.imageSrc+'" alt="">\ 2002 <span class="transparent_icon '+self.iconType+'">\ 2003 <span class="left_overlay"></span>\ 2004 <span class="right_overlay"></span>\ 2005 </span>\ 2006 </a>\ 2007 </div>' 2008 2009 ]; 2010 } 2011 else if(pageType == "blog"){ 2012 2013 if(self.postType == 'slideshow'){ 2014 2015 var slideshow = ''; 2016 2017 $.each(self.images, function(i, obj){ 2018 2019 slideshow += "<img src=" + obj + " alt='' />"; 2020 2021 }); 2022 2023 } 2024 2025 switch(self.postType){ 2026 case 'slideshow' : 2027 index = 0; 2028 break; 2029 case 'video' : 2030 index = 1; 2031 break; 2032 case 'audio' : 2033 index = 2; 2034 break; 2035 case 'featured_image' : 2036 index = 3; 2037 break; 2038 case 'blockquote' : 2039 index = 4; 2040 break; 2041 case 'hosted_audio' : 2042 index = 5; 2043 break; 2044 case 'simple_text' : 2045 index = 6; 2046 break; 2047 } 2048 2049 var blogLayouts = [ 2050 2051 // slideshow post type 2052 2053 '<article class="entry">\ 2054 <h4 class="entry_title"><a href="'+self.postLink+'">'+self.title+'</a></h4>\ 2055 <div class="entry_meta">In <a href="#">'+self.category+'</a> '+self.created+' by <a href="#">'+self.author+'</a> with <a href="#">'+self.comments+' comments</a></div>\ 2056 <div class="owl_wrap">\ 2057 <div class="slideshow owl_carousel">'+slideshow+'</div>\ 2058 <span class="si-icon action_btn dark large owl-prev" data-width="28" data-height="28" data-event="mouseover" data-icon-name="previous"></span>\ 2059 <span class="si-icon action_btn dark large owl-next" data-width="28" data-height="28" data-event="mouseover" data-icon-name="next"></span>\ 2060 </div>\ 2061 <div class="entry_extra">\ 2062 <p>'+self.extra+'</p>\ 2063 </div>\ 2064 <footer class="footer_extra clearfix">\ 2065 <div class="row table_layout">\ 2066 <div class="col-sm-8">\ 2067 <a href="blog_post_with_extended_image.html" class="btn small black alignleft">Continue Reading</a>\ 2068 </div>\ 2069 <div class="col-sm-4">\ 2070 <div class="actions_wrap">\ 2071 <ul class="actions_list">\ 2072 <li>\ 2073 <div class="share_wrap">\ 2074 <span class="si-icon share action_btn" data-width="21" data-height="21" data-event="click" data-icon-name="social"></span>\ 2075 <div class="addthis_sharing_toolbox"></div>\ 2076 </div>\ 2077 </li>\ 2078 <li>\ 2079 <span class="like_btn" data-amount="97">\ 2080 <span class="si-icon action_btn not_liked" data-width="27" data-height="23" data-event="mouseover" data-icon-name="likeDark" data-amount="97"></span>\ 2081 <span class="si-icon action_btn liked" data-width="27" data-height="23" data-event="mouseover" data-icon-name="likedDark" data-amount="97"></span>\ 2082 </span>\ 2083 </li>\ 2084 </ul>\ 2085 </div>\ 2086 </div>\ 2087 </div>\ 2088 </footer>\ 2089 </article>', 2090 2091 // vimeo vide post type 2092 2093 '<article class="entry">\ 2094 <h4 class="entry_title"><a href="'+self.postLink+'">'+self.title+'</a></h4>\ 2095 <div class="entry_meta">In <a href="#">'+self.category+'</a> '+self.created+' by <a href="#">'+self.author+'</a> with <a href="#">'+self.comments+' comments</a></div>\ 2096 <div class="iframe_wrap">\ 2097 <iframe src="'+self.videoSrc+'"></iframe>\ 2098 </div>\ 2099 <div class="entry_extra">\ 2100 <p>'+self.extra+'</p>\ 2101 </div>\ 2102 <footer class="footer_extra clearfix">\ 2103 <div class="row table_layout">\ 2104 <div class="col-sm-8">\ 2105 <a href="blog_post_with_extended_image.html" class="btn small black alignleft">Continue Reading</a>\ 2106 </div>\ 2107 <div class="col-sm-4">\ 2108 <div class="actions_wrap">\ 2109 <ul class="actions_list">\ 2110 <li>\ 2111 <div class="share_wrap">\ 2112 <span class="si-icon share action_btn" data-width="21" data-height="21" data-event="click" data-icon-name="social"></span>\ 2113 <div class="addthis_sharing_toolbox"></div>\ 2114 </div>\ 2115 </li>\ 2116 <li>\ 2117 <span class="like_btn" data-amount="97">\ 2118 <span class="si-icon action_btn not_liked" data-width="27" data-height="23" data-event="mou
2118seover" data-icon-name="likeDark" data-amount="97"></span>\ 2119 <span class="si-icon action_btn liked" data-width="27" data-height="23" data-event="mouseover" data-icon-name="likedDark" data-amount="97"></span>\ 2120 </span>\ 2121 </li>\ 2122 </ul>\ 2123 </div>\ 2124 </div>\ 2125 </div>\ 2126 </footer>\ 2127 </article>', 2128 2129 // soundcloud post type 2130 2131 '<article class="entry">\ 2132 <h4 class="entry_title"><a href="'+self.postLink+'">'+self.title+'</a></h4>\ 2133 <div class="entry_meta">In <a href="#">'+self.category+'</a> '+self.created+' by <a href="#">'+self.author+'</a> with <a href="#">'+self.comments+' comments</a></div>\ 2134 <iframe height="120" src="'+self.soundcloudSrc+'"></iframe>\ 2135 <div class="entry_extra">\ 2136 <p>'+self.extra+'</p>\ 2137 </div>\ 2138 <footer class="footer_extra clearfix">\ 2139 <div class="row table_layout">\ 2140 <div class="col-sm-8">\ 2141 <a href="blog_post_with_extended_image.html" class="btn small black alignleft">Continue Reading</a>\ 2142 </div>\ 2143 <div class="col-sm-4">\ 2144 <div class="actions_wrap">\ 2145 <ul class="actions_list">\ 2146 <li>\ 2147 <div class="share_wrap">\ 2148 <span class="si-icon share action_btn" data-width="21" data-height="21" data-event="click" data-icon-name="social"></span>\ 2149 <div class="addthis_sharing_toolbox"></div>\ 2150 </div>\ 2151 </li>\ 2152 <li>\ 2153 <span class="like_btn" data-amount="97">\ 2154 <span class="si-icon action_btn not_liked" data-width="27" data-height="23" data-event="mouseover" data-icon-name="likeDark" data-amount="97"></span>\ 2155 <span class="si-icon action_btn liked" data-width="27" data-height="23" data-event="mouseover" data-icon-name="likedDark" data-amount="97"></span>\ 2156 </span>\ 2157 </li>\ 2158 </ul>\ 2159 </div>\ 2160 </div>\ 2161 </div>\ 2162 </footer>\ 2163 </article>', 2164 2165 // post with featured image 2166 2167 '<article class="entry">\ 2168 <h4 class="entry_title"><a href="'+self.postLink+'">'+self.title+'</a></h4>\ 2169 <div class="entry_meta">In <a href="#">'+self.category+'</a> '+self.created+' by <a href="#">'+self.author+'</a> with <a href="#">'+self.comments+' comments</a></div>\ 2170 <img src="'+self.featuredImage+'" alt="">\ 2171 <div class="entry_extra">\ 2172 <p>'+self.extra+'</p>\ 2173 </div>\ 2174 <footer class="footer_extra clearfix">\ 2175 <div class="row table_layout">\ 2176 <div class="col-sm-8">\ 2177 <a href="blog_post_with_extended_image.html" class="btn small black alignleft">Continue Reading</a>\ 2178 </div>\ 2179 <div class="col-sm-4">\ 2180 <div class="actions_wrap">\ 2181 <ul class="actions_list">\ 2182 <li>\ 2183 <div class="share_wrap">\ 2184 <span class="si-icon share action_btn" data-width="21" data-height="21" data-event="click" data-icon-name="social"></span>\ 2185 <div class="addthis_sharing_toolbox"></div>\ 2186 </div>\ 2187 </li>\ 2188 <li>\ 2189 <span class="like_btn" data-amount="97">\ 2190 <span class="si-icon action_btn not_liked" data-width="27" data-height="23" data-event="mouseover" data-icon-name="likeDark" data-amount="97"></span>\ 2191 <span class="si-icon action_btn liked" data-width="27" data-height="23" data-event="mouseover" data-icon-name="likedDark" data-amount="97"></span>\ 2192 </span>\ 2193 </li>\ 2194 </ul>\ 2195 </div>\ 2196 </div>\ 2197 </div>\ 2198 </footer>\ 2199 </article>', 2200 2201 // post with blockquote 2202 2203 '<article class="entry">\ 2204 <h4 class="entry_title"><a href="'+self.postLink+'">'+self.title+'</a></h4>\ 2205 <div class="entry_meta">In <a href="#">'+self.category+'</a> '+self.created+' by <a href="#">'+self.author+'</a> with <a href="#">'+self.comments+' comments</a></div>\ 2206 <blockquote>\ 2207 <p>'+self.quote+'</p>\ 2208 <div class="author">'+self.quoteAuthor+'</div>\ 2209 </blockquote>\ 2210 <div class="entry_extra">\ 2211 <p>'+self.extra+'</p>\ 2212 </div>\ 2213 <footer class="footer_extra clearfix">\ 2214 <div class="row table_layout">\ 2215 <div class="col-sm-8">\ 2216 <a href="blog_post_with_extended_image.html" class="btn small black alignleft">Continue Reading</a>\ 2217 </div>\ 2218 <div class="col-sm-4">\ 2219 <div class="actions_wrap">\ 2220 <ul class="actions_list">\ 2221 <li>\ 2222 <div class="share_wrap">\ 2223 <span class="si-icon share action_btn" data-width="21" data-height="21" data-event="click" data-icon-name="social"></span>\ 2224 <div class="addthis_sharing_toolbox"></div>\ 2225 </div>\ 2226 </li>\ 2227 <li>\ 2228 <span class="like_btn" data-amount="97">\ 2229 <span class="si-icon action_btn not_liked" data-width="27" data-height="23" data-event="mou
2229seover" data-icon-name="likeDark" data-amount="97"></span>\ 2230 <span class="si-icon action_btn liked" data-width="27" data-height="23" data-event="mouseover" data-icon-name="likedDark" data-amount="97"></span>\ 2231 </span>\ 2232 </li>\ 2233 </ul>\ 2234 </div>\ 2235 </div>\ 2236 </div>\ 2237 </footer>\ 2238 </article>', 2239 2240 // hosted audio post type 2241 2242 '<article class="entry">\ 2243 <h4 class="entry_title"><a href="'+self.postLink+'">'+self.title+'</a></h4>\ 2244 <div class="entry_meta">In <a href="#">'+self.category+'</a> '+self.created+' by <a href="#">'+self.author+'</a> with <a href="#">'+self.comments+' comments</a></div>\ 2245 <audio controls src="'+self.audioSrc+'"></audio>\ 2246 <div class="entry_extra">\ 2247 <p>'+self.extra+'</p>\ 2248 </div>\ 2249 <footer class="footer_extra clearfix">\ 2250 <div class="row table_layout">\ 2251 <div class="col-sm-8">\ 2252 <a href="blog_post_with_extended_image.html" class="btn small black alignleft">Continue Reading</a>\ 2253 </div>\ 2254 <div class="col-sm-4">\ 2255 <div class="actions_wrap">\ 2256 <ul class="actions_list">\ 2257 <li>\ 2258 <div class="share_wrap">\ 2259 <span class="si-icon share action_btn" data-width="21" data-height="21" data-event="click" data-icon-name="social"></span>\ 2260 <div class="addthis_sharing_toolbox"></div>\ 2261 </div>\ 2262 </li>\ 2263 <li>\ 2264 <span class="like_btn" data-amount="97">\ 2265 <span class="si-icon action_btn not_liked" data-width="27" data-height="23" data-event="mouseover" data-icon-name="likeDark" data-amount="97"></span>\ 2266 <span class="si-icon action_btn liked" data-width="27" data-height="23" data-event="mouseover" data-icon-name="likedDark" data-amount="97"></span>\ 2267 </span>\ 2268 </li>\ 2269 </ul>\ 2270 </div>\ 2271 </div>\ 2272 </div>\ 2273 </footer>\ 2274 </article>', 2275 2276 // simple text post type 2277 2278 '<article class="entry">\ 2279 <h4 class="entry_title"><a href="'+self.postLink+'">'+self.title+'</a></h4>\ 2280 <div class="entry_meta">In <a href="#">'+self.category+'</a> '+self.created+' by <a href="#">'+self.author+'</a> with <a href="#">'+self.comments+' comments</a></div>\ 2281 <div class="entry_extra">\ 2282 <p>'+self.extra+'</p>\ 2283 </div>\ 2284 <footer class="footer_extra clearfix">\ 2285 <div class="row table_layout">\ 2286 <div class="col-sm-8">\ 2287 <a href="blog_post_with_extended_image.html" class="btn small black alignleft">Continue Reading</a>\ 2288 </div>\ 2289 <div class="col-sm-4">\ 2290 <div class="actions_wrap">\ 2291 <ul class="actions_list">\ 2292 <li>\ 2293 <div class="share_wrap">\ 2294 <span class="si-icon share action_btn" data-width="21" data-height="21" data-event="click" data-icon-name="social"></span>\ 2295 <div class="addthis_sharing_toolbox"></div>\ 2296 </div>\ 2297 </li>\ 2298 <li>\ 2299 <span class="like_btn" data-amount="97">\ 2300 <span class="si-icon action_btn not_liked" data-width="27" data-height="23" data-event="mouseover" data-icon-name="likeDark" data-amount="97"></span>\ 2301 <span class="si-icon action_btn liked" data-width="27" data-height="23" data-event="mouseover" data-icon-name="likedDark" data-amount="97"></span>\ 2302 </span>\ 2303 </li>\ 2304 </ul>\ 2305 </div>\ 2306 </div>\ 2307 </div>\ 2308 </footer>\ 2309 </article>' 2310 2311 ]; 2312 2313 } 2314 2315 switch(pageType){ 2316 case 'portfolio' : 2317 return portfolioLayouts[index]; 2318 case 'gallery' : 2319 return galleryLayouts[index]; 2320 case 'blog' : 2321 return blogLayouts[index]; 2322 } 2323 2324 } 2325 2326 } 2327 2328 } 2329 2330 Core.extend(); 2331 2332 // Initialize after DOM ready 2333 $(document).ready(function(){ 2334 2335 Core.DOMReady(); 2336 2337 }); 2338 2339 // Initialize when all scripts and images have been loaded 2340 $(window).load(function(){ 2341 2342 Core.windowLoad(); 2343 2344 }); 2345 2346})(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.