1/*= Grid View Switcher v3.4.1 */ 2// @Since 1.0.0 3( function( $ ) { 4 5 "use strict"; 6 7 jQuery( document ).ready( function() { 8 9 // Changing grids. 10 jQuery( '.spg-loop-actions .spg-view a' ).on( 'click', function( e ) { 11 var viewType = jQuery( this ).attr( 'data-type' ), 12 loop = jQuery( '.switchable-view' ), 13 loopView = loop.attr( 'data-view' ); 14 15 e.preventDefault(); 16 17 if ( viewType == loopView ) { 18 return false; 19 } 20 21 jQuery( this ).addClass( 'current' ).siblings( 'a' ).removeClass( 'current' ); 22 23 loop.stop().fadeOut( 100, function() { 24 if ( loopView ) 25 loop.removeClass( loopView ); 26 27 // If mansory layout. 28 if ( jQuery( "#loop-content" ).hasClass( "spg-masonry" ) ) { 29 spg_masonry(); 30 } 31 jQuery( this ).fadeIn().attr( 'data-view', viewType ).addClass( viewType ); 32 } ); 33 34 jQuery( '.spg-loop-content .spg-thumb' ).show(); 35 36 return false; 37 } ); 38 39 jQuery( '.spg-custom-sort-opt' ).each( function() { 40 var x = jQuery( this ).data( 'placeholder' ); 41 jQuery( this ).select2(); 42 } ); 43 } ); 44 45 jQuery( window ).on( 'load', function() { 46 jQuery( '.spg-loop-actions .spg-view a.current' ).trigger( 'click' ); 47 } ); 48 49 /** 50 * Loading content with ajax 51 * 52 * @Since 1.1.0 53 */ 54 jQuery( document ).ready( function() { 55 var container = jQuery( '#loop-content' ), 56 orderby = jQuery( '.spg-orderby-select' ), 57 order = jQuery( '.spg-order' ), 58 paginate = jQuery( '.spg-pagination a' ), 59 filters = jQuery( '.spg-custom-sort-opt, .spg-custom-sort-chk' ); 60 61 // Check for load_with_ajax class. 62 if ( container.data( 'ajaxload' ) ) { 63 64 // Load content on orderby,\. 65 orderby.on( 'change', function( e ) { 66 var url = jQuery( this ).val(); 67 68 e.preventDefault(); 69 70 if ( url ) { 71 container.load( url + " #loop-content > *", function() { 72 // If mansory layout. 73 if ( jQuery( "#loop-content" ).hasClass( "spg-masonry" ) ) { 74 spg_masonry(); 75 } 76 } ); 77 78 animate_elements(); 79 80 if ( url != window.location.href ) { 81 window.history.pushState( { 82 path: url 83 }, '', url ); 84 } 85 86 // Stop refreshing to the page given in. 87 return false; 88 } 89 } ); 90 91 // Load content on order. 92 order.on( 'click', function( e ) { 93 var new_order = jQuery( this ).data( 'order' ), 94 url = jQuery( this ).children( 'a' ).attr( 'href' ); 95 96 e.preventDefault(); 97 98 if ( url ) { 99 container.load( url + " #loop-content > *", function() { 100 // If mansory layout. 101 if ( jQuery( "#loop-content" ).hasClass( "spg-masonry" ) ) { 102 spg_masonry(); 103 } 104 } ); 105 106 order.load( url + " .spg-order > *" ); 107 108 animate_elements(); 109 110 if ( url != window.location ) { 111 window.history.pushState( { 112 path: url 113 }, '', url ); 114 } 115 116 // Stop refreshing to the page given in. 117 return false; 118 } 119 } ); 120 121 // Ajaxify content on pagination. 122 paginate.on( 'click', function( e ) { 123 var url = jQuery( this ).attr( 'href' ) 124 125 e.preventDefault(); 126 127 if ( url ) { 128 container.load( url + " #loop-content > *", function() { 129 // If mansory layout, 130 if ( jQuery( "#loop-content" ).hasClass( "spg-masonry" ) ) { 131 spg_masonry(); 132 } 133 } ); 134
135 jQuery( '.spg-pagination' ).load( url + " .spg-pagination > *" ); 136 137 paginate.each( function() { 138 jQuery( this ).removeClass( 'current' ); 139 } ); 140 141 jQuery( this ).addClass( 'current' ); 142 143 animate_elements(); 144 145 if ( url != window.location.href ) { 146 window.history.pushState( { 147 path: url 148 }, '', url ); 149 } 150 151 // Stop refreshing to the page given in. 152 return false; 153 } 154 } ); 155 } else { 156 // Bind change event to select. 157 jQuery( '.spg-orderby-select' ).on( 'change', function() { 158 var url = jQuery( this ).val(); // get selected value 159 160 if ( url ) { // require a URL 161 window.location = url; // redirect 162 } 163 164 return false; 165 } ); 166 } 167 168 // Process ajax filtering. 169 filters.on( 'change', function( event ) { 170 var currentUrl = spg_current_url, 171 url = '', 172 formData = jQuery( this ).parents( 'form' ).serialize(), 173 querySeperator = '?'; 174 175 if ( !jQuery( this ).parents( 'form' ).hasClass( 'spg-ajax-filter' ) ) { 176 return false; 177 } 178 179 if ( -1 !== url.indexOf( '?' ) ) { 180 querySeperator = '&'; 181 } 182 183 url = spg_current_url + querySeperator + formData; 184 185 container.load( url + " #loop-content > *", function() { 186 // If mansory layout. 187 if ( jQuery( '#loop-content' ).hasClass( 'spg-masonry' ) ) { 188 spg_masonry(); 189 } 190 191 jQuery( '.spg-remove-filter-button' ).removeAttr( 'style' ); 192 jQuery( '.spg-pagination' ).remove(); 193 } ); 194 195 animate_elements(); 196 197 if ( url != window.location.href ) { 198 window.history.pushState( { 199 path: url 200 }, '', url ); 201 } 202 203 // Stop refreshing to the page given in. 204 return false; 205 } ); 206 207 // Display quick view. 208 jQuery( 'body' ).on( 'click', '.spg-clip-overview', function( e ) { 209 var $this, 210 post_id, 211 singleColumn, 212 post_id_prev, 213 post_id_next, 214 popup_title, 215 html, 216 next_post, 217 prev_post, 218 style, 219 next_is_ok, 220 prev_is_ok, 221 data; 222 223 $this = jQuery( this ); 224 225 post_id = $this.data( 'post-id' ); 226 singleColumn = ( $this.hasClass( 'spg-quick-view-single-column' ) ) ? 'spg-quick-view-single-column' : ''; 227 post_id_prev = $this.parents( '.spg-item' ).prev( '.spg-item' ).find( ".spg-clip-overview" ).data( "post-id" ); 228 post_id_next = $this.parents( '.spg-item' ).next( '.spg-item' ).find( ".spg-clip-overview" ).data( "post-id" ); 229 230 popup_title = $this.data( 'title' ); 231 html = '<div class="spg-quick-view-overlay"></div>'; 232 next_post = ''; 233 prev_post = ''; 234 style = ''; 235 236 next_is_ok = typeof post_id_next === 'undefined' ? false : true; 237 prev_is_ok = typeof post_id_prev === 'undefined' ? false : true; 238 239 e.preventDefault(); 240 241 jQuery( ".spg-quick-view-overlay" ).fadeOut( 'slow' ).remove(); 242 jQuery( ".spg-quick-view" ).fadeOut( 'slow' ).remove(); 243 jQuery( "html" ).removeClass( "spg-html-fixed" ); 244 245 if ( post_id_next !== '' && next_is_ok ) 246 next_post = '<span class="spg-overlay-quick-view-next" data-post-id="' + post_id_next + '"></span>'; 247 else 248 style = 'style="right: 50px;"'; 249 if ( post_id_prev !== '' && prev_is_ok ) 250 prev_post = '<span class="spg-overlay-quick-view-prev" data-post-id="' + post_id_prev + '" ' + style + '></span>'; 251 252 html += '<div class="spg-quick-view ' + singleColumn + '">'; 253 html += '<div class="spg-quick-heading"><h3 class="spg-popup-title">
253' + popup_title + '</h3>' + prev_post + ' ' + next_post + '<span class="spg-overlay-quick-view-close"></span></div>'; 254 html += '<div class="spg-quick-view-content woocommerce"><div class="spg-overlay-quick-view-loader"></div></div>'; 255 html += '</div>'; 256 257 jQuery( 'body' ).append( html ); 258 jQuery( 'html' ).addClass( 'spg-html-fixed' ); 259 260 data = { 261 action: 'spg_get_data', 262 post_id: post_id 263 }; 264 265 jQuery.ajax( { 266 url: spg_ajax, 267 data: data, 268 type: 'POST', 269 success: function( res ) { 270 console.log( 'Content loaded for post ID - ' + post_id ); 271 var element = jQuery(".spg-quick-view-content").append('<div class="temp"></div>'); 272 var data = jQuery.parseJSON(res); 273 jQuery(".spg-quick-view-content").html(data.content); 274 var content_class = jQuery(".spg-quick-view-content").find('.post-content').data('content-selector'); 275 jQuery(".spg-quick-view-content").find('.post-content').html("<div class='loader'>Loading...</div>").load( jQuery(".spg-quick-view-content").find('.post-content').data('url') + ' ' + content_class, 276 function( data ) { 277 var dom = jQuery(data); 278 dom.filter('script').each( function( index, test ) { 279 if ( -1 === this.src.indexOf( 'sortable-post-grid' ) ) { 280 jQuery(".spg-quick-view-content").append( test ); 281 } 282 }); 283 284 dom.filter('link').each( function( index, test ) { 285 if ( 'stylesheet' === this.rel ) { 286 console.log( this.rel ); 287 jQuery(".spg-quick-view-content").append( test ); 288 } 289 }); 290 291 if (jQuery('.flexslider').length) { 292 jQuery('.flexslider').flexslider({ 293 smoothHeight: true 294 }); 295 296 jQuery(".spg-quick-view-content").css("overflow-x", "hidden"); 297 } 298 } 299 ); 300 } 301 } ); 302 } ); 303 304 // Close the overview. 305 jQuery( 'body' ).on( 'click', '.spg-overlay-quick-view-close, .spg-quick-view-overlay', function( e ) { 306 e.preventDefault(); 307 308 jQuery( '.spg-quick-view-overlay' ).fadeOut( 'slow' ).remove(); 309 jQuery( '.spg-quick-view' ).fadeOut( 'slow' ).remove(); 310 jQuery( 'html' ).removeClass( 'spg-html-fixed' ); 311 } ); 312 313 // Load next post. 314 jQuery( 'body' ).on( 'click', '.spg-overlay-quick-view-next', function( e ) { 315 var post_id = jQuery( this ).data( 'post-id' ); 316 spg_get_content_ajax( post_id ); 317 } ); 318 319 // Load previous post, 320 jQuery( 'body' ).on( 'click', '.spg-overlay-quick-view-prev', function( e ) { 321 var post_id = jQuery( this ).data( 'post-id' ); 322 spg_get_content_ajax( post_id ); 323 } ); 324 325 } ); 326 327 jQuery( window ).on( 'scroll', function() { 328 animate_elements(); 329 } ); 330 331 jQuery( window ).on( 'load', function() { 332 animate_elements(); 333 } ); 334 335 function animate_elements() { 336 jQuery( ".spg-item" ).each( function( index, element ) { 337 var $this = jQuery( element ), 338 animate = $this.data( 'animate' ); 339 340 if ( animate !== "animate no-animation" ) { 341 if ( isAppeared( $this ) ) { 342 jQuery( $this ).addClass( animate ); 343 } 344 } 345 } ); 346 } 347 348 function isAppeared( element ) { 349 var win = jQuery( window ), 350 bounds, 351 viewport = { 352 top: win.scrollTop(), 353 left: win.scrollLeft() 354 }; 355 356 viewport.right = viewport.left + win.width(); 357 viewport.bottom = viewport.top + win.height() - 180; 358 359 bounds = jQuery( element ).offset(); 360 bounds.right = bounds.left + jQuery( element ).outerWidth(); 361 bounds.bottom = bounds.top + jQuery( element ).outerHeight(); 362 363 return ( ! ( viewport.right < bounds.left || viewport.left > bounds.right || viewport.bottom < bounds.top || viewport.top > bounds.bottom ) ); 364 }; 365 366 function spg_get_content_ajax( post_id ) { 367 var $this, 368 post_id, 369 singleColumn, 370 post_id_prev, 371 post_id_next, 372 popup_title, 373 html, 374 next_post, 375 prev_post, 376 style, 377 next_is_ok, 378 prev_is_ok; 379 380 $this = jQuery( 'a[data-post-id="' + post_id + '"]' ); 381 post_id = post_id; 382 383 singleColumn = ( $this.hasClass( 'spg-quick-view-single-column' ) ) ? 'spg-quick-view-single-column' : ''; 384 385 post_id_prev = $this.parents( '.spg-item' ).prev( '.spg-item' ).find( '.spg-clip-overview' ).data( 'post-id' ); 386 post_id_next = $this.parents( '.spg-item' ).next( '.spg-item' ).find( '.spg-clip-overview' ).data( 'post-id' ); 387 388 popup_title = $this.data( 'title' ); 389 html = '<div class="spg-quick-view-overlay"></div>'; 390 next_post = ''; 391 prev_post = ''; 392 style = ''; 393 next_is_ok = typeof post_id_next === 'undefined' ? false : true; 394 prev_is_ok = typeof post_id_prev === 'undefined' ? false : true; 395 396 jQuery( '.spg-quick-view-overlay' ).fadeOut( 'slow' ).remove(); 397 jQuery( '.spg-quick-view' ).fadeOut( 'slow' ).remove(); 398 jQuery( 'html' ).removeClass( 'spg-html-fixed' ); 399 400 if ( post_id_next !== '' && next_is_ok ) { 401 next_post = '<span class="spg-overlay-quick-view-next" data-post-id="' + post_id_next + '"></span>'; 402 } else { 403 style = 'style="right: 50px;"'; 404 } 405 406 if ( post_id_prev !== '' && prev_is_ok ) { 407 prev_post = '<span class="spg-overlay-quick-view-prev" data-post-id="' + post_id_prev + '" ' + style + '></span>'; 408 } 409 410 html += '<div class="spg-quick-view ' + singleColumn + '">'; 411 html += '<div class="spg-quick-heading"><h3 class="spg-popup-title">
411' + popup_title + '</h3>' + prev_post + ' ' + next_post + '<span class="spg-overlay-quick-view-close"></span></div>'; 412 html += '<div class="spg-quick-view-content woocommerce"><div class="spg-overlay-quick-view-loader"></div></div>'; 413 html += '</div>'; 414 415 jQuery( 'body' ).append( html ); 416 jQuery( 'html' ).addClass( 'spg-html-fixed' ); 417 418 var data = { 419 action: 'spg_get_data', 420 post_id: post_id 421 }; 422 423 jQuery.ajax( { 424 url: spg_ajax, 425 data: data, 426 type: "POST", 427 success: function( res ) { 428 var element = jQuery(".spg-quick-view-content").append('<div class="temp"></div>'); 429 var data = jQuery.parseJSON(res); 430 jQuery(".spg-quick-view-content").html(data.content); 431 var content_class = jQuery(".spg-quick-view-content").find('.post-content').data('content-selector'); 432 jQuery(".spg-quick-view-content").find('.post-content').html("<div class='loader'>Loading...</div>").load( jQuery(".spg-quick-view-content").find('.post-content').data('url') + ' ' + content_class, 433 function( data ) { 434 var dom = jQuery(data); 435 dom.filter('script').each( function( index, test ) { 436 if ( -1 === this.src.indexOf( 'sortable-post-grid' ) ) { 437 jQuery(".spg-quick-view-content").append( test ); 438 } 439 }); 440 441 dom.filter('link').each( function( index, test ) { 442 if ( 'stylesheet' === this.rel ) { 443 console.log( this.rel ); 444 jQuery(".spg-quick-view-content").append( test ); 445 } 446 }); 447 448 if (jQuery('.flexslider').length) { 449 jQuery('.flexslider').flexslider({ 450 smoothHeight: true 451 }); 452 453 jQuery(".spg-quick-view-content").css("overflow-x", "hidden"); 454 } 455 } 456 ); 457 } 458 } ); 459 } 460 461 // Masonry js. 462 jQuery( document ).ready( function() { 463 var grid_switcher = jQuery( ".spg-view-link" ); 464 465 spg_masonry(); 466 467 grid_switcher.on( 'click', function() { 468 spg_clear_css(); 469 spg_masonry(); 470 471 setTimeout( function() { 472 animate_elements(); 473 }, 500 ); 474 } ); 475 } ); 476 477 jQuery( window ).resize( function( e ) { 478 spg_clear_css(); 479 spg_masonry(); 480 animate_elements(); 481 } ); 482 483 function spg_clear_css() { 484 jQuery( '.spg-item' ).each( function( index, element ) { 485 jQuery( this ).removeClass( 'animate' ); 486 } ); 487 } 488 489 function spg_masonry() { 490 491 var $container = jQuery( '#loop-content.spg-masonry > .spg-grids' ); 492 493 if ( jQuery( $container ).length ) { 494 setTimeout( function() { 495 $container.masonry( { 496 itemSelector: '.spg-item' 497 } ); 498 }, 100 ); 499 } 500 } 501 502 jQuery( '.spg-item' ).on( 'hover mouseenter', function() { 503 jQuery( this ).find( '.vc_grid-item-mini' ).addClass( 'vc_is-hover' ); 504 } ); 505 506 jQuery( '.spg-item' ).on( 'hover mouseleave', function() { 507 jQuery( this ).find( '.vc_grid-item-mini' ).removeClass( 'vc_is-hover' ); 508 } ); 509} )( 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.