| @@ -7,16 +7,16 @@ | ||
| 7 | 7 | |
| 8 | 8 | var args = { |
| 9 | 9 | itemSelector: '.wpupg-item', |
| 10 | 10 | transitionDuration: wpupg_public.animationSpeed, |
| 11 | - hiddenStyle: wpupg_public.animationHide, | |
| 12 | - visibleStyle: wpupg_public.animationShow | |
| 11 | + hiddenStyle: { | |
| 12 | + opacity: 0 | |
| 13 | + }, | |
| 14 | + visibleStyle: { | |
| 15 | + opacity: 1 | |
| 16 | + } | |
| 13 | 17 | }; |
| 14 | 18 | |
| 15 | - if(wpupg_public.rtl) { | |
| 16 | - args.isOriginLeft = false; | |
| 17 | - } | |
| 18 | - | |
| 19 | 19 | var layout_mode = container.data('layout-mode'); |
| 20 | 20 | if(layout_mode) { |
| 21 | 21 | args.layoutMode = layout_mode; |
| 22 | 22 | } |
| @@ -33,181 +33,57 @@ | ||
| 33 | 33 | container.isotope('layout'); |
| 34 | 34 | }); |
| 35 | 35 | |
| 36 | 36 | WPUltimatePostGrid.grids[grid_id] = { |
| 37 | - args: args, | |
| 38 | 37 | container: container, |
| 39 | 38 | centered: container.data('centered'), |
| 40 | - data: window['wpupg_grid_' + container.data('grid-id')], | |
| 41 | - id: container.data('grid-id'), | |
| 42 | 39 | pages: [0], |
| 43 | 40 | page: 0, |
| 44 | - filter: '', | |
| 45 | - filters: {}, | |
| 46 | - filter_text: false, | |
| 47 | - filter_text_search: '', | |
| 48 | - filter_text_posts: [] | |
| 41 | + filters: {} | |
| 49 | 42 | }; |
| 50 | 43 | |
| 51 | 44 | WPUltimatePostGrid.checkLinks(grid_id); |
| 52 | - WPUltimatePostGrid.updatePosts(grid_id); | |
| 53 | - | |
| 54 | - jQuery(container).on('hover', '.wpupg-item', function(e) { | |
| 55 | - var hovering = e.type == 'mouseenter'; | |
| 56 | - WPUltimatePostGrid.hoverGridItem(jQuery(this), hovering); | |
| 57 | - }); | |
| 58 | - | |
| 59 | - // Check for empty grid | |
| 60 | - container.on('arrangeComplete', function() { | |
| 61 | - WPUltimatePostGrid.checkEmpty(container); | |
| 62 | - }); | |
| 63 | 45 | }; |
| 64 | 46 | |
| 65 | -WPUltimatePostGrid.hoverGridItem = function(grid_item, hovering) { | |
| 66 | - if(hovering) { | |
| 67 | - grid_item.addClass('wpupg-hovering'); | |
| 68 | - | |
| 69 | - grid_item.find('.wpupg-show-on-hover').each(function() { | |
| 70 | - var item = jQuery(this), | |
| 71 | - effect = item.data('hover-in'), | |
| 72 | - duration = parseInt(item.data('hover-in-duration')); | |
| 73 | - | |
| 74 | - if(effect == 'fade') { | |
| 75 | - item.fadeIn(duration); | |
| 76 | - } else if(effect == 'slide') { | |
| 77 | - item.slideDown(duration); | |
| 78 | - } else { | |
| 79 | - item.show(); | |
| 80 | - } | |
| 81 | - }); | |
| 82 | - | |
| 83 | - grid_item.find('.wpupg-hide-on-hover').each(function() { | |
| 84 | - var item = jQuery(this), | |
| 85 | - effect = item.data('hover-out'), | |
| 86 | - duration = parseInt(item.data('hover-out-duration')); | |
| 87 | - | |
| 88 | - if(effect == 'fade') { | |
| 89 | - item.fadeOut(duration); | |
| 90 | - } else if(effect == 'slide') { | |
| 91 | - item.slideUp(duration); | |
| 92 | - } else { | |
| 93 | - item.hide(); | |
| 94 | - } | |
| 95 | - }); | |
| 96 | - } else { | |
| 97 | - grid_item.removeClass('wpupg-hovering'); | |
| 98 | - | |
| 99 | - grid_item.find('.wpupg-show-on-hover').each(function() { | |
| 100 | - var item = jQuery(this), | |
| 101 | - effect = item.data('hover-out'), | |
| 102 | - duration = parseInt(item.data('hover-out-duration')); | |
| 103 | - | |
| 104 | - if(effect == 'fade') { | |
| 105 | - item.fadeOut(duration); | |
| 106 | - } else if(effect == 'slide') { | |
| 107 | - item.slideUp(duration); | |
| 108 | - } else { | |
| 109 | - item.hide(); | |
| 110 | - } | |
| 111 | - }); | |
| 112 | - | |
| 113 | - grid_item.find('.wpupg-hide-on-hover').each(function() { | |
| 114 | - var item = jQuery(this), | |
| 115 | - effect = item.data('hover-in'), | |
| 116 | - duration = parseInt(item.data('hover-in-duration')); | |
| 117 | - | |
| 118 | - if(effect == 'fade') { | |
| 119 | - item.fadeIn(duration); | |
| 120 | - } else if(effect == 'slide') { | |
| 121 | - item.slideDown(duration); | |
| 122 | - } else { | |
| 123 | - item.show(); | |
| 124 | - } | |
| 125 | - }); | |
| 126 | - } | |
| 127 | -}; | |
| 128 | - | |
| 129 | -WPUltimatePostGrid.updatePosts = function(grid_id) { | |
| 130 | - var grid = WPUltimatePostGrid.grids[grid_id]; | |
| 131 | - | |
| 132 | - var posts = []; | |
| 133 | - | |
| 134 | - grid.container.find('.wpupg-item').each(function() { | |
| 135 | - var post_id = jQuery(this).data('id'); | |
| 136 | - posts.push(post_id); | |
| 137 | - }); | |
| 138 | - | |
| 139 | - WPUltimatePostGrid.grids[grid_id].posts = posts; | |
| 140 | -}; | |
| 141 | - | |
| 142 | 47 | WPUltimatePostGrid.filterGrid = function(grid_id) { |
| 143 | 48 | var grid = WPUltimatePostGrid.grids[grid_id]; |
| 144 | 49 | var filters = []; |
| 145 | 50 | |
| 146 | - if(grid.filter_text) { | |
| 147 | - grid.filter = ''; | |
| 148 | - var posts = []; | |
| 51 | + // Page filter | |
| 52 | + if(grid.pagination_type != 'load_more') { | |
| 53 | + var page = grid.page || 0; | |
| 54 | + filters.push(['.wpupg-page-' + page]); | |
| 55 | + } | |
| 149 | 56 | |
| 150 | - for(var i=0; i < grid.filter_text_posts.length; i++) { | |
| 151 | - posts.push('#wpupg-container-post-' + grid.filter_text_posts[i]); | |
| 152 | - } | |
| 57 | + // Taxonomy filters | |
| 58 | + for(var taxonomy in grid.filters) { | |
| 59 | + if(grid.filters.hasOwnProperty(taxonomy)) { | |
| 60 | + var taxonomy_filters = grid.filters[taxonomy]; | |
| 153 | 61 | |
| 154 | - if(posts.length == 0) { | |
| 155 | - posts.push('no-result'); | |
| 156 | - } | |
| 62 | + var match_one_filters = []; | |
| 63 | + var match_all_filter = ''; | |
| 157 | 64 | |
| 158 | - WPUltimatePostGrid.getFilterString(grid_id, '', [posts], 0); | |
| 159 | - } else { | |
| 160 | - // Page filter | |
| 161 | - if(grid.pagination_type == 'pages') { | |
| 162 | - var page = grid.page || 0; | |
| 163 | - filters.push(['.wpupg-page-' + page]); | |
| 164 | - } | |
| 165 | - | |
| 166 | - // Taxonomy filters | |
| 167 | - for(var taxonomy in grid.filters) { | |
| 168 | - if(grid.filters.hasOwnProperty(taxonomy)) { | |
| 169 | - var taxonomy_filters = grid.filters[taxonomy]; | |
| 170 | - | |
| 171 | - var match_one_filters = []; | |
| 172 | - var match_all_filter = ''; | |
| 173 | - var filter = ''; | |
| 174 | - | |
| 175 | - if(taxonomy_filters) { | |
| 176 | - for(var i = 0; i < taxonomy_filters.length; i++) { | |
| 177 | - filter = '.wpupg-tax-' + taxonomy + '-' + taxonomy_filters[i]; | |
| 178 | - | |
| 179 | - if(grid.multiselect_type == 'match_one') { | |
| 180 | - match_one_filters.push(filter); | |
| 181 | - } else { | |
| 182 | - match_all_filter += filter; | |
| 183 | - } | |
| 65 | + if(taxonomy_filters) { | |
| 66 | + for(var i = 0; i < taxonomy_filters.length; i++) { | |
| 67 | + if(grid.multiselect_type == 'match_one') { | |
| 68 | + match_one_filters.push('.wpupg-tax-' + taxonomy + '-' + taxonomy_filters[i]); | |
| 69 | + } else { | |
| 70 | + match_all_filter += '.wpupg-tax-' + taxonomy + '-' + taxonomy_filters[i]; | |
| 184 | 71 | } |
| 185 | 72 | } |
| 186 | - | |
| 187 | - if(grid.multiselect_type == 'match_one') { | |
| 188 | - if(match_one_filters.length > 0) filters.push(match_one_filters); | |
| 189 | - } else { | |
| 190 | - if(match_all_filter !== '') filters.push([match_all_filter]); | |
| 191 | - } | |
| 192 | 73 | } |
| 193 | - } | |
| 194 | 74 | |
| 195 | - grid.filter = ''; | |
| 196 | - WPUltimatePostGrid.getFilterString(grid_id, '', filters, 0); | |
| 197 | - if(grid.inverse) { | |
| 198 | - if(grid.pagination_type == 'pages') { | |
| 199 | - var page = grid.page || 0; | |
| 200 | - var filter_without_page = grid.filter.replace('.wpupg-page-' + page, ''); | |
| 201 | - | |
| 202 | - grid.filter = '.wpupg-page-' + page + ':not(' + filter_without_page + ')'; | |
| 75 | + if(grid.multiselect_type == 'match_one') { | |
| 76 | + if(match_one_filters.length > 0) filters.push(match_one_filters); | |
| 203 | 77 | } else { |
| 204 | - grid.filter = ':not(' + grid.filter + ')'; | |
| 78 | + if(match_all_filter !== '') filters.push([match_all_filter]); | |
| 205 | 79 | } |
| 206 | 80 | } |
| 207 | 81 | } |
| 208 | 82 | |
| 209 | - jQuery('#wpupg-grid-' + grid_id + '-empty').hide(); | |
| 83 | + grid.filter = ''; | |
| 84 | + WPUltimatePostGrid.getFilterString(grid_id, '', filters, 0); | |
| 85 | + | |
| 210 | 86 | grid.container.isotope({ filter: grid.filter }); |
| 211 | 87 | grid.container.trigger('wpupgFiltered'); |
| 212 | 88 | WPUltimatePostGrid.updateDeeplink(); |
| 213 | 89 | }; |
| @@ -222,18 +98,8 @@ | ||
| 222 | 98 | } |
| 223 | 99 | } |
| 224 | 100 | }; |
| 225 | 101 | |
| 226 | -WPUltimatePostGrid.checkEmpty = function(container) { | |
| 227 | - var grid_id = container.data('grid'), | |
| 228 | - filter = WPUltimatePostGrid.grids[grid_id].filter, | |
| 229 | - visible_items = container.find(filter); | |
| 230 | - | |
| 231 | - if(filter !== '' && visible_items.length == 0) { | |
| 232 | - jQuery('#wpupg-grid-' + grid_id + '-empty').slideDown(300); | |
| 233 | - } | |
| 234 | -}; | |
| 235 | - | |
| 236 | 102 | WPUltimatePostGrid.updateDeeplink = function() { |
| 237 | 103 | var link = ''; |
| 238 | 104 | |
| 239 | 105 | for(var grid_id in WPUltimatePostGrid.grids) { |
| @@ -240,23 +106,18 @@ | ||
| 240 | 106 | if(WPUltimatePostGrid.grids.hasOwnProperty(grid_id)) { |
| 241 | 107 | var grid = WPUltimatePostGrid.grids[grid_id]; |
| 242 | 108 | var grid_link = ''; |
| 243 | 109 | |
| 110 | + // Page filter | |
| 111 | + if(grid.page != 0) grid_link += '|p:' + (grid.page+1); | |
| 244 | 112 | |
| 245 | - if(grid.filter_text) { | |
| 246 | - grid_link += '+s:' + grid.filter_text_search; | |
| 247 | - } else { | |
| 248 | - // Page filter | |
| 249 | - if(grid.page != 0) grid_link += '+p:' + (grid.page+1); | |
| 113 | + // Taxonomy filters | |
| 114 | + for(var taxonomy in grid.filters) { | |
| 115 | + if(grid.filters.hasOwnProperty(taxonomy)) { | |
| 116 | + var taxonomy_filter = grid.filters[taxonomy]; | |
| 250 | 117 | |
| 251 | - // Taxonomy filters | |
| 252 | - for(var taxonomy in grid.filters) { | |
| 253 | - if(grid.filters.hasOwnProperty(taxonomy)) { | |
| 254 | - var taxonomy_filter = grid.filters[taxonomy]; | |
| 255 | - | |
| 256 | - if(taxonomy_filter.length > 0) { | |
| 257 | - grid_link += '+' + taxonomy + ':' + taxonomy_filter.join(','); | |
| 258 | - } | |
| 118 | + if(taxonomy_filter.length > 0) { | |
| 119 | + grid_link += '|' + taxonomy + ':' + taxonomy_filter.join(','); | |
| 259 | 120 | } |
| 260 | 121 | } |
| 261 | 122 | } |
| 262 | 123 | |
| @@ -267,54 +128,27 @@ | ||
| 267 | 128 | } |
| 268 | 129 | } |
| 269 | 130 | } |
| 270 | 131 | |
| 271 | - if(link == '') { | |
| 272 | - WPUltimatePostGrid.removeDeepLink(); | |
| 273 | - } else { | |
| 274 | - document.location.hash = link; | |
| 275 | - } | |
| 132 | + if(link == '') link = '*'; | |
| 133 | + document.location.hash = link; | |
| 276 | 134 | }; |
| 277 | 135 | |
| 278 | -/** | |
| 279 | - * Source: http://stackoverflow.com/questions/1397329/how-to-remove-the-hash-from-window-location-with-javascript-without-page-refresh/5298684#5298684 | |
| 280 | - */ | |
| 281 | -WPUltimatePostGrid.removeDeepLink = function() { | |
| 282 | - var scrollV, scrollH, loc = window.location; | |
| 283 | - if ("pushState" in history) | |
| 284 | - history.pushState("", document.title, loc.pathname + loc.search); | |
| 285 | - else { | |
| 286 | - // Prevent scrolling by storing the page's current scroll offset | |
| 287 | - scrollV = document.body.scrollTop; | |
| 288 | - scrollH = document.body.scrollLeft; | |
| 289 | - | |
| 290 | - loc.hash = ""; | |
| 291 | - | |
| 292 | - // Restore the scroll offset, should be flicker free | |
| 293 | - document.body.scrollTop = scrollV; | |
| 294 | - document.body.scrollLeft = scrollH; | |
| 295 | - } | |
| 296 | -} | |
| 297 | - | |
| 298 | 136 | WPUltimatePostGrid.restoreDeeplink = function() { |
| 299 | 137 | var link = document.location.hash; |
| 300 | 138 | link = link.substr(1); |
| 301 | 139 | |
| 302 | - if(link) { | |
| 140 | + if(link && link != '*') { | |
| 303 | 141 | // Make sure characters are not URL encoded |
| 304 | 142 | link = link.replace('%23', '#'); |
| 305 | 143 | link = link.replace('%7C', '|'); |
| 306 | - link = link.replace('%2B', '+'); | |
| 307 | 144 | link = link.replace('%3A', ':'); |
| 308 | 145 | link = link.replace('%2C', ','); |
| 309 | 146 | |
| 310 | - // Backwards compatibility | |
| 311 | - link = link.replace('|', '+'); | |
| 312 | - | |
| 313 | 147 | var grids = link.split('#'); |
| 314 | 148 | |
| 315 | 149 | for(var i=0; i < grids.length; i++) { |
| 316 | - var parts = grids[i].split('+'); | |
| 150 | + var parts = grids[i].split('|'); | |
| 317 | 151 | var grid_id = parts[0]; |
| 318 | 152 | |
| 319 | 153 | for(var j=1; j < parts.length; j++) { |
| 320 | 154 | var filter = parts[j].split(':'); |
| @@ -321,10 +155,8 @@ | ||
| 321 | 155 | |
| 322 | 156 | if(filter[0] == 'p') { |
| 323 | 157 | var page = parseInt(filter[1]) - 1; |
| 324 | 158 | WPUltimatePostGrid.updatePagination(jQuery('#wpupg-grid-' + grid_id + '-pagination'), page); |
| 325 | - } else if(filter[0] == 's') { | |
| 326 | - WPUltimatePostGrid.updateFilter(jQuery('#wpupg-grid-' + grid_id + '-filter'), filter[0], filter[1]); | |
| 327 | 159 | } else { |
| 328 | 160 | var terms = filter[1].split(','); |
| 329 | 161 | WPUltimatePostGrid.updateFilter(jQuery('#wpupg-grid-' + grid_id + '-filter'), filter[0], terms); |
| 330 | 162 | } |
| @@ -334,18 +166,17 @@ | ||
| 334 | 166 | }; |
| 335 | 167 | |
| 336 | 168 | WPUltimatePostGrid.checkLinks = function(grid_id) { |
| 337 | 169 | var grid = WPUltimatePostGrid.grids[grid_id]; |
| 338 | - var default_link_type = grid.container.data('link-type'); | |
| 170 | + var link_type = grid.container.data('link-type'); | |
| 339 | 171 | var link_target = grid.container.data('link-target'); |
| 340 | - var link_rel = link_target == 'post' ? '' : ' rel="lightbox"'; | |
| 341 | 172 | |
| 342 | - if(default_link_type != 'none') { | |
| 173 | + if(link_type != 'none') { | |
| 343 | 174 | grid.container.find('.wpupg-item').each(function() { |
| 344 | 175 | var item = jQuery(this); |
| 345 | 176 | |
| 346 | 177 | // Remove links from item |
| 347 | - item.find('a:not(.wpupg-keep-link, .wpurp-recipe-favorite, .wpurp-recipe-add-to-shopping-list, .wpurp-recipe-add-to-meal-plan, .wpurp-recipe-print-button, .wpurp-recipe-grid-link)').each(function() { | |
| 178 | + item.find('a:not(.wpupg-keep-link, .wpurp-recipe-favorite, .wpurp-recipe-add-to-shopping-list, .wpurp-recipe-print-button, .wpurp-recipe-grid-link)').each(function() { | |
| 348 | 179 | var link = jQuery(this); |
| 349 | 180 | if(link.parents('.sharrre').length == 0) { |
| 350 | 181 | link.replaceWith(function() { return link.contents(); }); |
| 351 | 182 | } |
| @@ -350,16 +181,14 @@ | ||
| 350 | 181 | link.replaceWith(function() { return link.contents(); }); |
| 351 | 182 | } |
| 352 | 183 | }); |
| 353 | 184 | |
| 354 | - var link = item.data('custom-link') ? item.data('custom-link') : ( link_target == 'post' ? item.data('permalink') : item.data('image') ); | |
| 355 | - var link_behaviour = item.data('custom-link-behaviour'); | |
| 185 | + var link = link_target == 'post' ? item.data('permalink') : item.data('image'); | |
| 186 | + var rel = link_target == 'post' ? '' : ' rel="lightbox"'; | |
| 356 | 187 | |
| 357 | - var link_type = link_behaviour == '_blank' || link_behaviour == '_self' ? link_behaviour : default_link_type; | |
| 358 | - | |
| 359 | 188 | // Add link around item |
| 360 | - if (link_behaviour !== 'none' && link && item.parent('a').length == 0) { | |
| 361 | - item.wrap('<a href="' + link + '" target="' + link_type + '"' + link_rel + ' class="' + wpupg_public.link_class + '"></a>'); | |
| 189 | + if (link && item.parent('a').length == 0) { | |
| 190 | + item.wrap('<a href="' + link + '" target="' + link_type + '"' + rel + '></a>'); | |
| 362 | 191 | } |
| 363 | 192 | }); |
| 364 | 193 | } |
| 365 | 194 | }; |
| @@ -382,9 +211,8 @@ | ||
| 382 | 211 | var grid_id = container.data('grid'); |
| 383 | 212 | |
| 384 | 213 | WPUltimatePostGrid.grids[grid_id].multiselect = container.data('multiselect'); |
| 385 | 214 | WPUltimatePostGrid.grids[grid_id].multiselect_type = container.data('multiselect-type'); |
| 386 | - WPUltimatePostGrid.grids[grid_id].inverse = container.data('inverse'); | |
| 387 | 215 | |
| 388 | 216 | container.find('.wpupg-filter-isotope-term').click(function() { |
| 389 | 217 | var filter_item = jQuery(this); |
| 390 | 218 | var taxonomy = filter_item.data('taxonomy'); |
| @@ -501,14 +329,11 @@ | ||
| 501 | 329 | }; |
| 502 | 330 | |
| 503 | 331 | WPUltimatePostGrid.updatePagination = function(container, page) { |
| 504 | 332 | var type = container.data('type'); |
| 505 | - | |
| 506 | - if(type) { | |
| 507 | - var func = 'updatePagination' + type.charAt(0).toUpperCase() + type.slice(1); | |
| 508 | - if(typeof WPUltimatePostGrid[func] == 'function') { | |
| 509 | - WPUltimatePostGrid[func](container, page); | |
| 510 | - } | |
| 333 | + var func = 'updatePagination' + type.charAt(0).toUpperCase() + type.slice(1); | |
| 334 | + if(typeof WPUltimatePostGrid[func] == 'function') { | |
| 335 | + WPUltimatePostGrid[func](container, page); | |
| 511 | 336 | } |
| 512 | 337 | }; |
| 513 | 338 | |
| 514 | 339 | WPUltimatePostGrid.updatePaginationPages = function(container, page) { |
| @@ -523,10 +348,8 @@ | ||
| 523 | 348 | pagination_item.siblings('.wpupg-pagination-term').removeClass('active').trigger('checkActiveFilter'); |
| 524 | 349 | |
| 525 | 350 | var page = parseInt(pagination_item.addClass('active').trigger('checkActiveFilter').data('page')); |
| 526 | 351 | |
| 527 | - WPUltimatePostGrid.scrollTo(WPUltimatePostGrid.grids[grid_id].container); | |
| 528 | - | |
| 529 | 352 | if(WPUltimatePostGrid.grids[grid_id].pages.indexOf(page) !== -1) { |
| 530 | 353 | WPUltimatePostGrid.grids[grid_id].page = page; |
| 531 | 354 | WPUltimatePostGrid.filterGrid(grid_id); |
| 532 | 355 | } else { |
| @@ -543,17 +366,21 @@ | ||
| 543 | 366 | |
| 544 | 367 | // Get recipes through AJAX |
| 545 | 368 | jQuery.post(wpupg_public.ajax_url, data, function(html) { |
| 546 | 369 | var posts = jQuery(html).toArray(); |
| 370 | + WPUltimatePostGrid.grids[grid_id].container.isotope('insert', posts); | |
| 371 | + WPUltimatePostGrid.grids[grid_id].page = page; | |
| 372 | + WPUltimatePostGrid.filterGrid(grid_id); | |
| 373 | + WPUltimatePostGrid.checkLinks(grid_id); | |
| 547 | 374 | |
| 548 | - WPUltimatePostGrid.grids[grid_id].page = page; | |
| 549 | - WPUltimatePostGrid.insertPosts(grid_id, posts); | |
| 375 | + WPUltimatePostGrid.grids[grid_id].container.imagesLoaded( function() { | |
| 376 | + WPUltimatePostGrid.grids[grid_id].container.isotope('layout'); | |
| 377 | + }); | |
| 550 | 378 | |
| 551 | 379 | pagination_item.removeClass('wpupg-spinner'); |
| 552 | 380 | pagination_item.css('color', WPUltimatePostGrid.grids[grid_id].pagination_style.active_text_color); |
| 553 | 381 | |
| 554 | 382 | WPUltimatePostGrid.grids[grid_id].pages.push(page); |
| 555 | - WPUltimatePostGrid.updatePosts(grid_id); | |
| 556 | 383 | }); |
| 557 | 384 | } |
| 558 | 385 | }); |
| 559 | 386 | |
| @@ -624,33 +451,8 @@ | ||
| 624 | 451 | .css('color', text_color); |
| 625 | 452 | } |
| 626 | 453 | }).trigger('checkActiveFilter'); |
| 627 | 454 | }); |
| 628 | -}; | |
| 629 | - | |
| 630 | -WPUltimatePostGrid.insertPosts = function(grid_id, posts) { | |
| 631 | - WPUltimatePostGrid.grids[grid_id].container.isotope('destroy'); | |
| 632 | - | |
| 633 | - WPUltimatePostGrid.grids[grid_id].container.append(posts); | |
| 634 | - WPUltimatePostGrid.grids[grid_id].container.isotope(WPUltimatePostGrid.grids[grid_id].args); | |
| 635 | - | |
| 636 | - WPUltimatePostGrid.updatePosts(grid_id); | |
| 637 | - WPUltimatePostGrid.checkLinks(grid_id); | |
| 638 | - WPUltimatePostGrid.filterGrid(grid_id); | |
| 639 | - | |
| 640 | - WPUltimatePostGrid.grids[grid_id].container.imagesLoaded( function() { | |
| 641 | - WPUltimatePostGrid.grids[grid_id].container.isotope('layout'); | |
| 642 | - WPUltimatePostGrid.grids[grid_id].loading = false; | |
| 643 | - }); | |
| 644 | -}; | |
| 645 | - | |
| 646 | -WPUltimatePostGrid.scrollTo = function(target) { | |
| 647 | - var scroll_to = target.offset().top - 50; | |
| 648 | - scroll_to = scroll_to < 0 ? 0 : scroll_to; | |
| 649 | - | |
| 650 | - jQuery('html,body').animate({ | |
| 651 | - scrollTop: scroll_to | |
| 652 | - }, 500); | |
| 653 | 455 | }; |
| 654 | 456 | |
| 655 | 457 | jQuery(document).ready(function($) { |
| 656 | 458 | $('.wpupg-grid').each(function() { |