1(function ($) { //an IIFE so safely alias jQuery to $ 2 $.WorldOfNankheel = function (element) { 3 4 //stores the passed element as a property of the created instance. 5 6 if (element instanceof $) { 7 this.element = element 8 } else { 9 this.element = $(element); 10 this.elementSelector = element; 11 } 12 13 this.WONSwiper = {}; 14 }; 15 16 17 //assigning an object literal to the prototype is a shorter syntax 18 //than assigning one property at a time 19 $.WorldOfNankheel.prototype = { 20 Init: function () { 21 if (this.element.length == 0) { return; } 22 new Swiper(this.elementSelector, $.WorldOfNankheel.defaultOptions); 23 24 this.WONSwiper = document.querySelector(this.elementSelector).swiper; 25 26 // get items by api 27 this.GetItems(); 28 }, 29 reinitializeSwiper: function () { 30 this.WONSwiper.destroy(); 31 32 new Swiper(this.elementSelector, $.WorldOfNankheel.defaultOptions); 33 34 this.WONSwiper = document.querySelector(this.elementSelector).swiper; 35 }, 36 GetItems: function () { 37 var that = this; 38 // bind filter button click 39 $('.world-section-filter .nav-link').on('click', function () { 40 41 $('.world-section-filter .nav-link').removeClass('active'); 42 43 $(this).toggleClass('active'); 44 $(this).next().toggleClass('active') 45 46 $(".loader-section").removeClass("d-none"); 47 48 var id = $(this).attr('id'); 49 50 if (id != "") { 51 var templateId = "worldOfNakheelListingTemplate"; 52 var filter = ""; 53 if (id != "All") { 54 filter = "$filter=Category/any(x:x eq " + id + ")&"; 55 } 56 else { 57 filter = ""; 58 } 59 60 var culture = "en"; 61 if ($('html')[0].lang != "" && $('html')[0].lang != undefined) { 62 culture = $('html')[0].lang; 63 } 64 var culturePart = "&sf_culture=" + culture; 65 66 var apiUrl = "/api/nakheelcorporate/worldofnakheelservices?" + filter + "$select=*&$Expand=Image,Logo,InternalLink&$Count=true&$OrderBy=SortOrder" + culturePart; 67 $.ajax({
68 type: "Get", 69 url: apiUrl, 70 contentType: "application/json;", 71 sync: true, 72 datatype: "json", 73 74 success: function (response) { 75 if (response != null && response.value != null && response.value.length > 0) { 76 if (response.value.length < 4) { 77 $('[data-selector="worldOfNakheelListing"]').addClass("justify-content-end"); 78 } else { 79 $('[data-selector="worldOfNakheelListing"]').removeClass("justify-content-end"); 80 } 81 var template = document.getElementById(templateId).innerHTML; 82 var html = Mustache.to_html(template, response.value); 83 84 $('[data-selector="worldOfNakheelListing"]').html(""); 85 $('[data-selector="worldOfNakheelListing"]').append(html); 86 } 87 88 that.reinitializeSwiper(); 89 90 $(".loader-section").addClass("d-none"); 91 92 }, error: function (xhr, ajaxOptions, thrownError) { 93 $(".loader-section").addClass("d-none"); 94 console.log(thrownError); 95 } 96 }); 97 } 98 }); 99 100 //Isotope.Item.prototype._create = function () { 101 // // assign id, used for original-order sorting 102 // this.id = this.layout.itemGUID++; 103 // // transition objects 104 // this._transn = { 105 // ingProperties: {}, 106 // clean: {}, 107 // onEnd: {} 108 // }; 109 // this.sortData = {}; 110 //}; 111 112 //Isotope.Item.prototype.layoutPosition = function () { 113 // this.emitEvent('layout', [this]); 114 //}; 115 116 //Isotope.prototype.arrange = function (opts) { 117 // // set any options pass 118 // this.option(opts); 119 // this._getIsInstant(); 120 // // just filter 121 // this.filteredItems = this._filter(this.items); 122 // // flag for initalized 123 // this._isLayoutInited = true; 124 //}; 125 126 // layout mode that does not position items 127 // Isotope.LayoutMode.create('none'); 128 129 //init Isotope 130 //var slidesRow = this.element.find('.swiper-wrapper'); 131 //var $grid = $(slidesRow).isotope({ 132 // itemSelector: '.swiper-slide', 133 // layoutMode: 'none' 134 //}); 135 } 136 }; 137 138 $.WorldOfNankheel.defaultOptions = { 139 observer: true, 140 observeParents: true, 141 slidesPerView: 1, 142 autoplay: false, 143 //autoplay: { 144 // delay: 5000, 145 // disableOnInteraction: false, 146 // pauseOnMouseEnter: true 147 //}, 148 navigation: { 149 nextEl: ".swiper-button-next", 150 prevEl: ".swiper-button-prev" 151 }, 152 pagination: { 153 el: ".world-pagination", 154 clickable: true 155 }, 156 breakpoints: { 157 567: { 158 slidesPerView: "auto", 159 }, 160 //768: { 161 // slidesPerView: 2, 162 //}, 163 1024: { 164 slidesPerView: "auto", 165 spaceBetween: 0, 166 } 167 }, 168 }; 169 170}(jQuery)); 171 172var worldofnakheel = new $.WorldOfNankheel(".swiper-world"); 173worldofnakheel.Init(); 174 175
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.