1(function ($) { 2 "use strict"; 3 4 var $grid; 5 var $items; 6 7 function closeSlideMenu() { 8 /*Slide Menu Filter Close*/ 9 var peakHeight = $('.slide-menu-gr-peakaboo').height() + 5; 10 TweenMax.to($('.slide-menu-gr-peakaboo'), 0.2, {y: -peakHeight, delay: 0.3}); 11 $('.slide-menu-gr-filter-toggle').removeClass('open'); 12 } 13 $(document).ready(function () 14 { 15 16 //Load more releases 17 $('a[data-releases-load-more]').on('click', function(e) { 18 e.preventDefault(); 19 20 var loadMoreAnchor = $(this); 21 22 var perPage = $(this).attr('data-load-num'); 23 var orderBy = $(this).attr('data-order-by'); 24 var orderDir = $(this).attr('data-order-dir'); 25 if (orderBy == 'menu_order') { 26 var currentOffset = ($(this).attr('data-offset') == 1 ? 0 : $(this).attr('data-offset')); 27 } else { 28 var currentOffset = $(this).attr('data-offset'); 29 } 30 31 var tileTemplate = $('.isotope-gallery-item.grid-item:last').clone(); 32 33 //add loading icon to the button 34 $(loadMoreAnchor).addClass('-is-loading'); 35 36 let posts = {}; 37 $.ajax({
38 type: "GET", 39 url: theme_vars.wpjsonurl + '/wp/v2/release?_embed&orderby=' + orderBy +'&order=' + orderDir, 40 data: { 41 'per_page' : perPage, 42 'offset': currentOffset 43 }, 44 success: function (response) { 45 posts = response; 46 }, 47 }).then( ( posts ) => { 48 49 if(typeof posts !== 'undefined' && posts.length) { 50 var itemClickAction = $('.page-navigation a').attr('data-item-link'); 51 //loop through retrived posts and render using tile template 52 for(var i in posts) { 53 var post = posts[i]; 54 55 var tile = tileTemplate.clone().attr('data-post-id', post.id).hide(); 56 57 // get a list of all classes so we can get the num-per-row class in use 58 var classList = tile.attr("class"); 59 60 // Create class array by splitting class list string 61 var classArr = classList.split(/\s+/); 62 63 var setLayoutClass = classArr[classArr.length-1]; 64 65 // strip out any curren taxonomy classes from the tile 66 tile.removeAttr('class'); 67 tile.attr('class', ''); 68 tile.addClass('isotope-gallery-item').addClass('grid-item'); 69 70 if(typeof post.type !== 'undefined') { 71 var getReleaseType = post.type; 72 tile.addClass(getReleaseType.toLowerCase()); 73 } 74 75 tile.addClass(setLayoutClass); 76 77 var linkfireLinksGroup = post.umglinkfire_links_group; 78 var linkfireURL = ''; 79 if (linkfireLinksGroup) { 80 linkfireURL = linkfireLinksGroup.match(/href="([^"]*)/)[1]; 81 linkfireURL = linkfireURL.substr(0, linkfireURL.lastIndexOf("/")); 82 } else { 83 linkfireURL = post.link 84 } 85 //update link 86 if (itemClickAction == 'post') { 87 tile.find('a').attr('href', post.link); 88 } else if (itemClickAction == 'external') { 89 tile.find('a').attr('href', linkfireURL); 90 } 91 tile.find('a').attr('title', post.title.rendered); 92 93 //update the image 94 tile.find('.slide-image img').attr('src', post._embedded['wp:featuredmedia']['0'].source_url); 95 tile.find('.slide-image img').attr('alt', post._embedded['wp:featuredmedia']['0'].alt_text); 96 97 //update the overlay title - if applicable 98 if ($('.release-title-overlay').length > 0) { 99 tile.find('.release-title-overlay h2').empty().html(post.title.rendered); 100 } 101 102 //add new tile before the Load More button 103 $grid.isotope( 'insert', tile ); 104 $grid.isotope('layout'); 105 106 //remove loading icon from the button 107 $(loadMoreAnchor).removeClass('-is-loading'); 108 } 109 } else { 110 //no posts left 111 } 112 113 return posts; 114 115 }); 116 117 //calculate new offset 118 if (orderBy == 'menu_order') { 119 var newOffset = (currentOffset == 0 ? 1 + parseInt(perPage) : parseInt(currentOffset) + parseInt(perPage)); 120 } else { 121 var newOffset = parseInt(currentOffset) + parseInt(perPage); 122 } 123 124 //check if there are any more posts, if not then hide the load more button 125 posts = {}; 126 $.ajax({
127 type: "GET", 128 url: theme_vars.wpjsonurl + '/wp/v2/release', 129 data: { 130 'per_page' : perPage, 131 'offset': newOffset 132 }, 133 success: function (response) { 134 posts = response; 135 }, 136 }).then( ( posts ) => { 137 if(typeof posts === 'undefined' || posts.length === 0) { 138 loadMoreAnchor.hide(); 139 } else { 140 loadMoreAnchor.attr('data-offset', newOffset); 141 } 142 }); 143 144 return false; 145 }); 146 147 //Load more artists 148 $('a[data-artists-load-more]').on('click', function(e) { 149 e.preventDefault(); 150 151 var loadMoreAnchor = $(this); 152 153 var currentOffset = $(this).attr('data-offset'); 154 var perPage = $(this).attr('data-load-num'); 155 var orderBy = $(this).attr('data-order-by'); 156 var orderDir = $(this).attr('data-order-dir'); 157 var placeHolderImg = $(this).attr('data-placeholder'); 158 159 var tileTemplate = $('.isotope-gallery-item.grid-item:last').clone(); 160 161 //add loading icon to the button 162 $(loadMoreAnchor).addClass('-is-loading'); 163 164 let posts = {}; 165 $.ajax({
166 type: "GET", 167 url: theme_vars.wpjsonurl + '/wp/v2/artist?_embed&orderby=' + orderBy +'&order=' + orderDir, 168 data: { 169 'per_page' : perPage, 170 'offset': currentOffset 171 }, 172 success: function (response) { 173 posts = response; 174 }, 175 }).then( ( posts ) => { 176 177 if(typeof posts !== 'undefined' && posts.length) { 178 //loop through retrived posts and render using tile template 179 for(var i in posts) { 180 var post = posts[i]; 181 182 var tile = tileTemplate.clone().attr('data-post-id', post.id).hide(); 183 184 //update link 185 tile.find('a').attr('href', post.link); 186 tile.find('a').attr('title', post.title.rendered); 187 188 //update the image 189 if (typeof post._embedded !== 'undefined') { 190 tile.find('.slide-image img').attr('src', post._embedded['wp:featuredmedia']['0'].source_url); 191 tile.find('.slide-image img').attr('alt', post._embedded['wp:featuredmedia']['0'].alt_text); 192 } else { 193 tile.find('.slide-image img').attr('src', placeHolderImg); 194 } 195 196 //update the title 197 if ($('.slide-title h3').length > 0) { 198 tile.find('.slide-title h3').empty().html(post.title.rendered); 199 } 200 201 //add new tile before the Load More button 202 $grid.isotope( 'insert', tile ); 203 $grid.one( 'arrangeComplete', function() { 204 setTimeout(function(){$grid.isotope('layout');}, 100); 205 }); 206 207 //remove loading icon from the button 208 $(loadMoreAnchor).removeClass('-is-loading'); 209 } 210 } else { 211 //no posts left 212 } 213 214 return posts; 215 216 }); 217 218 //calculate new offset 219 var newOffset = parseInt(currentOffset) + parseInt(perPage); 220 221 //check if there are any more posts, if not then hide the load more button 222 posts = {}; 223 $.ajax({
224 type: "GET", 225 url: theme_vars.wpjsonurl + '/wp/v2/artist', 226 data: { 227 'per_page' : perPage, 228 'offset': newOffset 229 }, 230 success: function (response) { 231 posts = response; 232 }, 233 }).then( ( posts ) => { 234 if(typeof posts === 'undefined' || posts.length === 0) { 235 loadMoreAnchor.hide(); 236 } else { 237 loadMoreAnchor.attr('data-offset', parseInt(currentOffset) + parseInt(perPage)); 238 } 239 }); 240 241 return false; 242 }); 243 244 $(window).load(function() { 245 var i = 0; 246 $('.lazy').each(function () { 247 $(this).Lazy({ 248 beforeLoad: function (element) { 249 $(element).parents('.slide-image').find('div.loader').show(); 250 }, 251 afterLoad: function (element) { 252 $(element).parents('.slide-image').find('div.loader').hide(); 253 }, 254 }); 255 i++; 256 }) 257 258 var stdTiledGridSettings = { 259 itemSelector: '.grid-item', 260 filter: '*', 261 percentPosition: true, 262 layoutMode: 'fitRows', 263 masonry: { 264 columnWidth: '.grid-sizer' 265 } 266 }; 267 268 if (typeof window.UMGGR_Music_Tiled_Isotope_Option != "undefined") { 269 var mergedTiledSettings = {...stdTiledGridSettings, ...window.UMGGR_Music_Tiled_Isotope_Option}; 270 } else if (typeof window.UMGGR_Artists_Tiled_Isotope_Option != "undefined") { // 271 var mergedTiledSettings = {...stdTiledGridSettings, ...window.UMGGR_Artists_Tiled_Isotope_Option}; 272 } else { 273 var mergedTiledSettings = stdTiledGridSettings; 274 } 275 276 try{ 277 $grid = $('.tiled_page .grid').isotope(mergedTiledSettings); 278 $items = $grid.find('.grid-item'); 279 } 280 catch(err){ 281 $grid = null; 282 $items = null; 283 } 284 285 // Content items rollovers 286 $('html').on('mouseenter', '.isotope-gallery-item', function () { 287 TweenMax.to($(this).find('.slide-overlay'), 0.3, {opacity: 0.5}); 288 TweenMax.to($(this).find('.slide-image img'), 0.3, {scale: 1.2}); 289 TweenMax.fromTo($(this).find('.icon'), 0.3, {rotation: -20}, {rotation: 0}); 290 }); 291 $('html').on('mouseleave', '.isotope-gallery-item', function () { 292 TweenMax.to($(this).find('.slide-overlay'), 0.3, {opacity: 0}); 293 TweenMax.to($(this).find('.slide-image img'), 0.3, {scale: 1}); 294 TweenMax.to($(this).find('.icon'), 0.3, {rotation: -20}); 295 }); 296 297 $(window).scroll(function () { 298 // $container.isotope('reLayout'); 299 }); 300 301 302 /*Slide Menu Filter Grid*/ 303 $('.filter-btn').click(function () { 304 var filter = $(this).data('filter'); 305 switch (filter) 306 { 307 case 'all': 308 $('.grid').isotope({filter: '*'}); 309 break; 310 case 'albums': 311 $('.grid').isotope({filter: '.album'}); 312 break; 313 case 'singles': 314 $('.grid').isotope({filter: '.single'}); 315 break; 316 } 317 closeSlideMenu(); 318 $('.slide-menu-gr-filter-toggle').html($(this).html()); 319 event.preventDefault(); 320 }); 321 //Listen Now Drop Down Slide 322 $('.open-links').on("click", function () { 323 $(this).next('.links-contain').slideToggle(); 324 if (!$('.open-links').hasClass('open')) { 325 TweenMax.to($(this), 0.3, {opacity: 0.5}); 326 $('.open-links').addClass('open'); 327 } else { 328 TweenMax.to($(this), 0.3, {opacity: 1}); 329 $('.open-links').removeClass('open'); 330 } 331 }); 332 333 //Init Isotope grid without the pre-layout state flashing up + we get a transition animation 334 if ($grid !== null) { 335 $grid.addClass('show-items').isotope('revealItemElements', $items); 336 } 337 }); 338 });
339 340})(jQuery);// JavaScript Document
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.