1/** 2 * Go Pricing - WordPress Responsive Pricing Tables 3 * 4 * Description: The New Generation Pricing Tables. If you like traditional Pricing Tables, but you would like get much more out of it, then this rodded product is a useful tool for you. 5 * Version: 3.3.3 6 * Author: Granth 7 * License: http://codecanyon.net/licenses/ 8 * 9 * (C) 2016 Granth (http://granthweb.com) 10 */ 11 12 13(function ($, undefined) { 14 "use strict"; 15 16 $(function () { 17 18 /** 19 * Initialize 20 */ 21 22 $.GoPricing = { 23 24 /* Init function */ 25 Init : function () { 26 this.$wrap = $('.gw-go'); 27 this.fixWidth(); 28 this.InitAnim(); 29 this.equalize = this.$wrap.data('equalize'); 30 this.InitMediaElementPlayer(); 31 this.InitGoogleMap(); 32 this.isIE = document.documentMode != undefined && document.documentMode >5 ? document.documentMode : false; 33 if (this.isIE) { 34 this.$wrap.addClass('gw-go-ie'); 35 if (this.isIE < 9) this.$wrap.addClass('gw-go-oldie'); 36 }; 37 if ($.GoPricing!=undefined && $.GoPricing.equalize) { 38 this.EqualizeRows(); 39 }; 40 this.eventType = this.detectEvent(); 41 this.timeout = []; 42 43 }, 44 45 InitAnim: function() { 46 this.$wrap.each(function( i, obj ) { 47 $(obj).css('opacity', 1); 48 var $cols = $(".gw-go-col-wrap[data-col-anim]", this); 49 if ($cols.length) { 50 var tl = new TimelineLite({ 51 paused: true, 52 onStart: function() { 53 var tw = this.getChildren(), i = tw.length; 54 while (i--) if (tw[i].vars.onUpdate) tw[i].vars.onUpdate(); 55 } 56 }); 57 $cols.each(function(i, col) { 58 var anim = $(col).data('col-anim') || {}; 59 if (anim.trans) { 60 anim.css.opacity /= 100, anim.css.scaleX /= 100, anim.css.scaleY /= 100; 61 tl.add( TweenLite.from(col, anim.trans.duration/1000, {css: anim.css, ease: anim.trans.ease}), anim.trans.delay/1000 ); 62 } 63 if (anim.count) { 64 var $price = $('[data-id=price]', col), 65 counter = { value : (anim.count.from || 0) }, 66 $amount = $price.find('[data-id=amount]'), 67 price = $price.data('price') || 0, 68 currency = $price.data('currency') || {}, 69 decimals = (price || '').toString().split('.')[1] || '', 70 decCnt = decimals.length; 71 72 if ($price.data('trailing-zero')) decCnt = $price.data('decimal-no'); 73 74 tl.add( TweenLite.to(counter, anim.count.duration/1000, { 75 value: price, 76 ease: anim.count.ease, 77 onUpdate: function() { 78 var c = counter.value 79 $amount.html(function() { 80 var parts = parseFloat(c).toFixed(decCnt).split('.'); 81 parts[0] = parts[0].replace(/(\d)(?=(\d{3})+(?!\d))/g, "$1"+(currency['thousand-sep'] || ' ')); 82 parts[1] = parts[1] ? ( ( currency['decimal-sep'] || '.' ) + parts[1] ) : ''; 83 return parts[0] + parts[1]; 84 }); 85 86 }, 87 }), anim.count.delay/1000 ); 88 } 89 }); 90 var $this = $(this).data('tl', tl); 91 $this.tablespy({offset: $this.data('scroll-offset')}); 92 TweenLite.set(this, {perspective: '1000px'}); 93 } 94 }); 95 }, 96 97 /* Show Tooltip */ 98 showTooltip : function ($elem, content, top) { 99 100 if ($elem === undefined) return; 101 102 var $rowTooltip = $elem.find('.gw-go-tooltip-content'), 103 rowTooltipContent = $rowTooltip.length ? $rowTooltip.prop('outerHTML') : '', 104 $colWrap = $elem.closest('.gw-go-col-wrap'), 105 $col = $colWrap.find('.gw-go-col'), 106 $tooltip = $col.find('.gw-go-tooltip'), 107 colIndex = $colWrap.data('col-index'), 108 rIndex = $elem.data('row-index'); 109 110 if (!$tooltip.length ) $tooltip = $('<div class="gw-go-tooltip"></div>').appendTo($col); 111 112 if ($tooltip.data('index') != rIndex) { 113 $tooltip.removeClass('gw-go-tooltip-visible'); 114 } else { 115 clearTimeout($.GoPricing.timeout[colIndex]); 116 } 117 118 if (rowTooltipContent != '') { 119 $tooltip.html(rowTooltipContent).data('index', rIndex) 120 var corr = $col.position().top; 121 setTimeout(function() { $tooltip.addClass('gw-go-tooltip-visible').css('top', $elem.find('.gw-go-body-cell').offset().top - $col.closest('.gw-go').offset().top - $tooltip.outerHeight() - 16 - corr) }, 10); 122 } 123 124 }, 125 126 /* Hide Tooltip */ 127 hideTooltip : function ($elem) { 128 129 if ($elem === undefined) return; 130 131 if ($elem.hasClass('gw-go-tooltip')) { 132 $elem.removeClass('gw-go-tooltip-visible'); 133 } else { 134 135 var $colWrap = $elem.closest('.gw-go-col-wrap'), 136 $col = $colWrap.find('.gw-go-col'), 137 $tooltip = $col.find('.gw-go-tooltip'), 138 colIndex = $colWrap.data('col-index'); 139 140 $.GoPricing.timeout[colIndex] = setTimeout(function() { $tooltip.removeClass('gw-go-tooltip-visible'); }, 10); 141 142 } 143 144 }, 145 146 /* Mediaelement Player init */ 147 InitMediaElementPlayer : function () { 148 149 if (jQuery().mediaelementplayer && $.GoPricing.$wrap.find('audio, video').length) { 150 $.GoPricing.$wrap.find('audio, video').mediaelementplayer({ 151 audioWidth: '100%', 152 videoWidth: '100%' 153 }); 154 }; 155 156 }, 157 158 /* Google map init */ 159 InitGoogleMap : function () { 160 161 if (jQuery().goMap && $.GoPricing.$wrap.find('.gw-go-gmap').length) { 162 $.GoPricing.$wrap.find('.gw-go-gmap').each(function(index) { 163 var $this=$(this); 164 $this.goMap($this.data('map')); 165 });
166 }; 167 168 }, 169 170 loadImages : function ( $pricingTable ) { 171 172 if ( !$pricingTable.data('images') || $pricingTable.data('imagesLoaded')) return; 173 174 var images = $pricingTable.data('images'), 175 ready = true; 176 177 for (var x = 0; x < images.length; x++) { 178 var image = images[x]; 179 if (image.el.naturalWidth == 0) ready = false; 180 } 181 182 if (ready) { 183 $pricingTable.data('imagesLoaded', true) 184 this.EqualizeRows(); 185 return; 186 } 187 188 setTimeout($.proxy(function() { 189 this.loadImages($pricingTable); 190 }, this), 100); 191 192 }, 193 194 /* Fix width in webkit browsers */ 195 fixWidth : function() { 196 197 if ( 'WebkitAppearance' in document.documentElement.style === false ) return; 198 199 for (var x = 0; x < $.GoPricing.$wrap.length; x++) { 200 201 var $pricingTable = $.GoPricing.$wrap.eq(x), 202 $cols = $pricingTable.find('.gw-go-col-wrap'); 203 204 if ($pricingTable.is(':hidden') || $pricingTable.offset().top>parseInt($(document).scrollTop()+window.innerHeight+500 || $pricingTable.data('fix-width') === true ) ) continue; 205 206 for (var i = 0; i < $cols.length; i++) { 207 208 var $col = $cols.eq(i); 209 $cols.css('max-width','none'); 210 $cols.css('max-width', Math.floor(parseFloat(window.getComputedStyle($col[0]).width))); 211 212 } 213 214 $pricingTable.data('fix-width', true); 215 216 } 217 218 }, 219 220 /* Equalize rows */ 221 EqualizeRows : function () { 222 223 for (var x = 0; x < $.GoPricing.$wrap.length; x++) { 224 225 if ($.GoPricing.$wrap.eq(x).is(':hidden') || $.GoPricing.$wrap.eq(x).offset().top>parseInt($(document).scrollTop()+window.innerHeight+500) || $.GoPricing.$wrap.eq(x).data('eq-ready') === true ) continue; 226 227 var $pricingTable = $.GoPricing.$wrap.eq(x), 228 $colWrap = $pricingTable.find('.gw-go-col-wrap:visible'), 229 colCnt = $colWrap.length, 230 equalizeCnt = colCnt, 231 views = $pricingTable.data('views') !== undefined ? $pricingTable.data('views') : {}; 232 233 /* Load images */ 234 if ( !$pricingTable.data('images') && !$pricingTable.data('imagesLoaded') ) { 235 var images = []; 236 if ($pricingTable.data('equalize').body != undefined) { $pricingTable.find('.gw-go-body li .gw-go-body-cell:visible img').each(function(index, el){ images.push({'ready' : false, 'el' : el }) }); } 237 if ($pricingTable.data('equalize').footer != undefined) { $pricingTable.find('.gw-go-footer .gw-go-footer-row-inner:visible img').each(function(index, el){ images.push({'ready' : false, 'el' : el }) }); } 238 if ($pricingTable.data('equalize').column != undefined) { $pricingTable.find('.gw-go-header img').each(function(index, el){ images.push({'ready' : false, 'el' : el }) }); } 239 240 if ( images.length ) $pricingTable.data( 'images', images ); 241 242 } 243 244 if ( $pricingTable.data('images') && !$pricingTable.data('imagesLoaded') ) { 245 this.loadImages( $pricingTable ); 246 continue; 247 } 248 249 for (var key in views) { 250 251 var mqSizes = [], mq = ''; 252 if (views[key].min !== undefined && views[key].min !== '') mqSizes.push('(min-width:'+views[key].min+'px)'); 253 if (views[key].max !== undefined && views[key].max !== '') mqSizes.push('(max-width:'+views[key].max+'px)'); 254 mq = mqSizes.join(' and '); 255 256 if (mq != '') if (window.matchMedia && window.matchMedia(mq).matches) { 257 equalizeCnt = views[key].cols !== undefined && views[key].cols !== '' && views[key].cols <= colCnt ? views[key].cols : colCnt; 258 } 259 260 } 261 262 if (equalizeCnt == 1) { 263 $pricingTable.find('.gw-go-body li .gw-go-body-cell').css('height', 'auto'); 264 $pricingTable.find('.gw-go-col-wrap').css('height', 'auto'); 265 $pricingTable.find('.gw-go-footer').css('height', 'auto'); 266 continue; 267 } 268 269 for (var z = 0; z<colCnt/equalizeCnt; z++) { 270 271 if (!$pricingTable.is(':hidden')) $pricingTable.data('eq-ready', true); 272 273 var rowHeights = [], footerHeights = [], colHeights = []; 274 275 /* Body */ 276 if ($pricingTable.data('equalize').body != undefined) { 277 278 for (var i = 0; i < colCnt; i++) { 279 if (i >= (z*equalizeCnt) && i <= (z*equalizeCnt)+equalizeCnt-1) { 280 var $currentCol = $colWrap.eq(i), 281 $row = $currentCol.find('.gw-go-body li .gw-go-body-cell:visible'); 282 283 for (var rIndex = 0; rIndex < $row.length; rIndex++) { 284 285 var $currentRow = $row.eq(rIndex); 286 $currentRow.css('height', 'auto'); 287 288 if (typeof rowHeights[rIndex] !== 'undefined' ) { 289 if ($currentRow.height() > rowHeights[rIndex] ) { 290 rowHeights[rIndex] = $currentRow.height(); 291 } 292 } else { 293 rowHeights[rIndex] = $currentRow.height(); 294 } 295 296 } 297 298 } 299 300 } 301 302 for (var i = 0; i < colCnt; i++) { 303 var $currentCol = $colWrap.eq(i), 304 $row = $currentCol.find('.gw-go-body li .gw-go-body-cell:visible'); 305 306 if (i >= (z*equalizeCnt) && i <= (z*equalizeCnt)+equalizeCnt-1) { 307 for (var rIndex = 0; rIndex < $row.length; rIndex++) { 308 var $currentRow = $row.eq(rIndex); 309 $currentRow.css('height', rowHeights[rIndex]); 310 } 311 312 } 313 314 315 316 } 317 318 } 319 320 /* Footer */ 321 if ($pricingTable.data('equalize').footer != undefined) { 322 323 for (var i = 0; i < colCnt; i++) { 324 if (i >= (z*equalizeCnt) && i <= (z*equalizeCnt)+equalizeCnt-1) { 325 var $currentCol = $colWrap.eq(i), 326 $row = $currentCol.find('.gw-go-footer .gw-go-footer-row-inner:visible'); 327 328 for (var rIndex = 0; rIndex < $row.length; rIndex++) { 329 330 var $currentRow = $row.eq(rIndex); 331 $currentRow.css('height', 'auto'); 332 333 if (typeof footerHeights[rIndex] !== 'undefined' ) { 334 if ($currentRow.height() > footerHeights[rIndex] ) { 335 footerHeights[rIndex] = $currentRow.height(); 336 } 337 } else { 338 footerHeights[rIndex] = $currentRow.height(); 339 } 340 341 } 342 343 } 344 345 } 346 347 for (var i = 0; i < colCnt; i++) { 348 var $currentCol = $colWrap.eq(i), 349 $row = $currentCol.find('.gw-go-footer .gw-go-footer-row-inner:visible'); 350 351 if (i >= (z*equalizeCnt) && i <= (z*equalizeCnt)+equalizeCnt-1) { 352 for (var rIndex = 0; rIndex < $row.length; rIndex++) { 353 var $currentRow = $row.eq(rIndex); 354 $currentRow.css('height', footerHeights[rIndex]); 355 } 356 357 } 358 359 360 361 } 362 363 } 364 365 /* Column */ 366 if ($pricingTable.data('equalize').column != undefined) { 367 368 for (var i = 0; i < colCnt; i++) { 369 var $currentCol = $colWrap.eq(i); 370 371 if (i >= (z*equalizeCnt) && i <= (z*equalizeCnt)+equalizeCnt-1) { 372 $currentCol.css('height', 'auto'); 373 if (typeof colHeights[z] !== 'undefined' ) { 374 if ($currentCol.outerHeight(true) > colHeights[z] ) { 375 colHeights[z] = $currentCol.outerHeight(false); 376 } 377 } else { 378 colHeights[z] = $currentCol.outerHeight(false); 379 } 380 } 381 382 } 383 384 for (var i = 0; i < colCnt; i++) { 385 var $currentCol = $colWrap.eq(i); 386 387 if (i >= (z*equalizeCnt) && i <= (z*equalizeCnt)+equalizeCnt-1) { 388 $currentCol.css('height', colHeights[z]); 389 } 390 391 } 392 393 } 394 395 396 } 397 398 } 399 400 }, 401 402 /* Detect event type */ 403 detectEvent : function() { 404 var eventType = 'mouseenter mouseleave'; 405 if ('ontouchstart' in window) { 406 eventType = 'touchstart'; 407 } else if (window.navigator.pointerEnabled && navigator.msMaxTouchPoints) { 408 eventType = "pointerdown"; 409 } else if (window.navigator.msPointerEnabled && navigator.msMaxTouchPoints) { 410 eventType = "MSPointerDown"; 411 } 412 return eventType; 413 } 414 415 }; 416 417 /* Init */ 418 $.GoPricing.Init(); 419 420 $(window).on('scroll', function() { 421 422 $.GoPricing.EqualizeRows(); 423 424 }); 425 426 /* Submit button event if form found */ 427 $.GoPricing.$wrap.delegate('span.gw-go-btn', 'click', function(){ 428 var $this=$(this); 429 if ($this.find('form').length) { $this.find('form').submit(); }; 430 }); 431 432 433 /* Show & hide tooltip - Event on tooltip */ 434 $.GoPricing.$wrap.on( 'mouseenter mouseleave', '.gw-go-tooltip', function(e) { 435 436 var $this=$(this), 437 $colWrap = $this.closest('.gw-go-col-wrap'), 438 colIndex = $colWrap.data('col-index'); 439 440 if (e.type == 'mouseenter') { 441 clearTimeout($.GoPricing.timeout[colIndex]); 442 } else { 443 $.GoPricing.timeout[colIndex] = setTimeout(function() { $.GoPricing.hideTooltip($this); }, 10); 444 } 445 446 }); 447 448 449 /* Show & hide tooltip - Event on row */ 450 $.GoPricing.$wrap.on( 'mouseenter mouseleave', 'ul.gw-go-body > li', function(e) { 451 452 var $this=$(this); 453 454 if (e.type == 'mouseenter') { 455 $.GoPricing.showTooltip($this); 456 } else { 457 $.GoPricing.hideTooltip($this); 458 } 459 460 }); 461 462 463 /* Event handling */ 464 $('body').on($.GoPricing.eventType, '.gw-go-col-wrap', function(e) { 465 var $this = $(this); 466 467 if (e.type == 'mouseenter') { 468 $this.addClass('gw-go-curr'); 469 } else if (e.type == 'mouseleave') { 470 $this.removeClass('gw-go-curr'); 471 } 472 473 if (e.type == 'mouseenter' && !$this.hasClass('gw-go-disable-hover')) { 474 $this.addClass('gw-go-hover').siblings(':not(.gw-go-disable-hover)').removeClass('gw-go-hover'); 475 $this.closest('.gw-go').addClass('gw-go-hover'); 476 } else if (e.type == 'mouseleave' && !$this.hasClass('gw-go-disable-hover')) { 477 $this.removeClass('gw-go-hover'); 478 $this.closest('.gw-go').find('[data-current="1"]:not(.gw-go-disable-hover)').addClass('gw-go-hover'); 479 $this.closest('.gw-go').removeClass('gw-go-hover') 480 } else if (!$this.hasClass('gw-go-disable-hover')) { 481 $this.closest('.gw-go').addClass('gw-go-hover') 482 $this.addClass('gw-go-hover').siblings(':not(.gw-go-disable-hover)').removeClass('gw-go-hover'); 483 }; 484 485 }); 486 487 488 /** 489 * Google map 490 */ 491 492 if (typeof jQuery.goMap !== 'undefined' && $.GoPricing.$wrap.find('.gw-go-gmap').length) { 493 var GoPricing_MapResize=false; 494 $(window).on('resize', function(e) { 495 if (GoPricing_MapResize) { clearTimeout(GoPricing_MapResize); } 496 GoPricing_MapResize = setTimeout(function() { 497 $.GoPricing.$wrap.find('.gw-go-gmap').each(function(index, element) { 498 //$(this).goMap(); 499 //console.log($.goMap.getMarkers('markers')[0].position); 500 });
501 }, 400); 502 }); 503 }; 504 505 506 /* Equalize heights on resize */ 507 $(window).on('resize', function(e) { 508 509 for (var x = 0; x < $.GoPricing.$wrap.length; x++) { 510 $.GoPricing.$wrap.eq(x).data('eq-ready', false); 511 $.GoPricing.$wrap.eq(x).data('fix-width', false); 512 } 513 $.GoPricing.fixWidth(); 514 $.GoPricing.EqualizeRows(); 515 516 }); 517 518 /* handle animations */ 519 $(window).on("scrollEnter scrollLeave", function(e, spy) { 520 var $target = $(e.target); 521 var repeat = $target.data("anim-repeat") || Infinity; 522 if (e.type == "scrollEnter") { 523 if (spy.enters <= repeat) $target.data("tl").play(); 524 } else { 525 if (spy.enters < repeat) $target.data("tl").stop().seek(0); 526 } 527 }); 528 529 }); 530}(jQuery)); 531 532;(function($, window, undefined) { 533 534 var $elems = $(); 535 var $cont = $(window) 536 .on("resize.tablespy", onResize) 537 .on("load.tablespy", onResize) 538 .on("scroll.tablespy load.tablespy", onScroll); 539 540 function onScroll() { 541 if (!$elems.length) return; 542 var height = $cont.height(); 543 var y = $cont.scrollTop(); 544 $elems.each(function() { 545 var $elem = $(this); 546 var o = $elem.data('tablespy'); 547 var offset = o.rowHeight * o.offset / 100; 548 549 if (Math.floor((o.rowHeight+height)/2) < offset) offset = Math.floor((o.rowHeight+height)/2)-20; 550 551 if (height + y-offset >= o.min && y+offset <= o.max){ 552 if (!o.inside) { 553 o.inside = true; 554 o.enters++; 555 $elem.trigger("scrollEnter", {scrollTop: y, enters: o.enters, leaves: o.leaves}); 556 } 557 $elem.trigger("scrollTick", {scrollTop: y, enters: o.enters, leaves: o.leaves}); 558 } 559 if (o.inside && !(height + y >= o.min && y <= o.max)) { 560 o.inside = false; 561 o.leaves++; 562 $elem.trigger("scrollLeave", {scrollTop: y, enters: o.enters, leaves: o.leaves}); 563 } 564 }); 565 } 566 567 function onResize() { 568 $elems.each(function() { 569 var $elem = $(this); 570 var o = $elem.data("tablespy"); 571 o.min = $elem.offset().top; 572 o.max = $elem.outerHeight() + o.min; 573 o.rowHeight = $elem.children(":visible:first").outerHeight(); 574 }); 575 } 576 577 $.fn.tablespy = function(options) { 578 var defaults = { 579 offset: 0, 580 enters: 0, 581 leaves: 0, 582 inside: false 583 }; 584 return this.each(function() { 585 var $elem = $(this); 586 var top = $elem.offset().top; 587 $elem.data("tablespy", $.extend({ 588 min: top, 589 max: top + $elem.outerHeight(), 590 rowHeight: $elem.children(":visible:first").outerHeight() 591 }, defaults, options)); 592 $elems.push(this); 593 }); 594 }; 595 596})(jQuery, window);
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.