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.5 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-col-wrap').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 || window.StyleMedia ) 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 ) || $cols.length < 2 ) continue; 205 206 for (var i = 0; i < $cols.length; i++) { 207 208 var $col = $cols.eq(i), 209 fixedMaxWidth = parseInt($pricingTable.data('mw')), 210 maxWidth = Math.floor(parseFloat(window.getComputedStyle($col[0]).width)); 211 212 if ( !fixedMaxWidth || maxWidth < fixedMaxWidth ) { 213 $cols.css('max-width', 'none'); 214 $cols.css('max-width', Math.floor(parseFloat(window.getComputedStyle($col[0]).width))); 215 } 216 217 } 218 219 $pricingTable.data('fix-width', true); 220 221 } 222 223 }, 224 225 /* Equalize rows */ 226 EqualizeRows : function () { 227 228 for (var x = 0; x < $.GoPricing.$wrap.length; x++) { 229 230 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; 231 232 var $pricingTable = $.GoPricing.$wrap.eq(x), 233 $colWrap = $pricingTable.find('.gw-go-col-wrap:visible'), 234 colCnt = $colWrap.length, 235 equalizeCnt = colCnt, 236 views = $pricingTable.data('views') !== undefined ? $pricingTable.data('views') : {}; 237 238 /* Load images */ 239 if ( !$pricingTable.data('images') && !$pricingTable.data('imagesLoaded') ) { 240 var images = []; 241 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 }) }); } 242 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 }) }); } 243 if ($pricingTable.data('equalize').column != undefined) { $pricingTable.find('.gw-go-header img').each(function(index, el){ images.push({'ready' : false, 'el' : el }) }); } 244 245 if ( images.length ) $pricingTable.data( 'images', images ); 246 247 } 248 249 if ( $pricingTable.data('images') && !$pricingTable.data('imagesLoaded') ) { 250 this.loadImages( $pricingTable ); 251 continue; 252 } 253 254 for (var key in views) { 255 256 var mqSizes = [], mq = ''; 257 if (views[key].min !== undefined && views[key].min !== '') mqSizes.push('(min-width:'+views[key].min+'px)'); 258 if (views[key].max !== undefined && views[key].max !== '') mqSizes.push('(max-width:'+views[key].max+'px)'); 259 mq = mqSizes.join(' and '); 260 261 if (mq != '') if (window.matchMedia && window.matchMedia(mq).matches) { 262 equalizeCnt = views[key].cols !== undefined && views[key].cols !== '' && views[key].cols <= colCnt ? views[key].cols : colCnt; 263 } 264 265 } 266 267 if (equalizeCnt == 1) { 268 $pricingTable.find('.gw-go-body li .gw-go-body-cell').css('height', 'auto'); 269 $pricingTable.find('.gw-go-col-wrap').css('height', 'auto'); 270 $pricingTable.find('.gw-go-footer').css('height', 'auto'); 271 continue; 272 } 273 274 for (var z = 0; z<colCnt/equalizeCnt; z++) { 275 276 if (!$pricingTable.is(':hidden')) $pricingTable.data('eq-ready', true); 277 278 var rowHeights = [], footerHeights = [], colHeights = []; 279 280 /* Body */ 281 if ($pricingTable.data('equalize').body != undefined) { 282 283 for (var i = 0; i < colCnt; i++) { 284 if (i >= (z*equalizeCnt) && i <= (z*equalizeCnt)+equalizeCnt-1) { 285 var $currentCol = $colWrap.eq(i), 286 $row = $currentCol.find('.gw-go-body li .gw-go-body-cell:visible'); 287 288 for (var rIndex = 0; rIndex < $row.length; rIndex++) { 289 290 var $currentRow = $row.eq(rIndex); 291 $currentRow.css('height', 'auto'); 292 293 if (typeof rowHeights[rIndex] !== 'undefined' ) { 294 if ($currentRow.height() > rowHeights[rIndex] ) { 295 rowHeights[rIndex] = $currentRow.height(); 296 } 297 } else { 298 rowHeights[rIndex] = $currentRow.height(); 299 } 300 301 } 302 303 } 304 305 } 306 307 for (var i = 0; i < colCnt; i++) { 308 var $currentCol = $colWrap.eq(i), 309 $row = $currentCol.find('.gw-go-body li .gw-go-body-cell:visible'); 310 311 if (i >= (z*equalizeCnt) && i <= (z*equalizeCnt)+equalizeCnt-1) { 312 for (var rIndex = 0; rIndex < $row.length; rIndex++) { 313 var $currentRow = $row.eq(rIndex); 314 $currentRow.css('height', rowHeights[rIndex]); 315 } 316 317 } 318 319 320 321 } 322 323 } 324 325 /* Footer */ 326 if ($pricingTable.data('equalize').footer != undefined) { 327 328 for (var i = 0; i < colCnt; i++) { 329 if (i >= (z*equalizeCnt) && i <= (z*equalizeCnt)+equalizeCnt-1) { 330 var $currentCol = $colWrap.eq(i), 331 $row = $currentCol.find('.gw-go-footer .gw-go-footer-row-inner:visible'); 332 333 for (var rIndex = 0; rIndex < $row.length; rIndex++) { 334 335 var $currentRow = $row.eq(rIndex); 336 $currentRow.css('height', 'auto'); 337 338 if (typeof footerHeights[rIndex] !== 'undefined' ) { 339 if ($currentRow.height() > footerHeights[rIndex] ) { 340 footerHeights[rIndex] = $currentRow.height(); 341 } 342 } else { 343 footerHeights[rIndex] = $currentRow.height(); 344 } 345 346 } 347 348 } 349 350 } 351 352 for (var i = 0; i < colCnt; i++) { 353 var $currentCol = $colWrap.eq(i), 354 $row = $currentCol.find('.gw-go-footer .gw-go-footer-row-inner:visible'); 355 356 if (i >= (z*equalizeCnt) && i <= (z*equalizeCnt)+equalizeCnt-1) { 357 for (var rIndex = 0; rIndex < $row.length; rIndex++) { 358 var $currentRow = $row.eq(rIndex); 359 $currentRow.css('height', footerHeights[rIndex]); 360 } 361 362 } 363 364 365 366 } 367 368 } 369 370 /* Column */ 371 if ($pricingTable.data('equalize').column != undefined) { 372 373 for (var i = 0; i < colCnt; i++) { 374 var $currentCol = $colWrap.eq(i); 375 376 if (i >= (z*equalizeCnt) && i <= (z*equalizeCnt)+equalizeCnt-1) { 377 $currentCol.css('height', 'auto'); 378 if (typeof colHeights[z] !== 'undefined' ) { 379 if ($currentCol.outerHeight(true) > colHeights[z] ) { 380 colHeights[z] = $currentCol.outerHeight(false); 381 } 382 } else { 383 colHeights[z] = $currentCol.outerHeight(false); 384 } 385 } 386 387 } 388 389 for (var i = 0; i < colCnt; i++) { 390 var $currentCol = $colWrap.eq(i); 391 392 if (i >= (z*equalizeCnt) && i <= (z*equalizeCnt)+equalizeCnt-1) { 393 $currentCol.css('height', colHeights[z]); 394 } 395 396 } 397 398 } 399 400 401 } 402 403 } 404 405 }, 406 407 /* Detect event type */ 408 detectEvent : function() { 409 var eventType = 'mouseenter mouseleave'; 410 if ('ontouchstart' in window) { 411 eventType = 'touchstart'; 412 } else if (window.navigator.pointerEnabled && navigator.msMaxTouchPoints) { 413 eventType = "pointerdown"; 414 } else if (window.navigator.msPointerEnabled && navigator.msMaxTouchPoints) { 415 eventType = "MSPointerDown"; 416 } 417 return eventType; 418 } 419 420 }; 421 422 /* Init */ 423 $.GoPricing.Init(); 424 425 $(window).on('scroll', function() { 426 427 $.GoPricing.EqualizeRows(); 428 429 }); 430 431 /* Submit button event if form found */ 432 $.GoPricing.$wrap.delegate('span.gw-go-btn', 'click', function(){ 433 var $this=$(this); 434 if ($this.find('form').length) { $this.find('form').submit(); }; 435 }); 436 437 438 /* Show & hide tooltip - Event on tooltip */ 439 $.GoPricing.$wrap.on( 'mouseenter mouseleave', '.gw-go-tooltip', function(e) { 440 441 var $this=$(this), 442 $colWrap = $this.closest('.gw-go-col-wrap'), 443 colIndex = $colWrap.data('col-index'); 444 445 if (e.type == 'mouseenter') { 446 clearTimeout($.GoPricing.timeout[colIndex]); 447 } else { 448 $.GoPricing.timeout[colIndex] = setTimeout(function() { $.GoPricing.hideTooltip($this); }, 10); 449 } 450 451 }); 452 453 454 /* Show & hide tooltip - Event on row */ 455 $.GoPricing.$wrap.on( 'mouseenter mouseleave', 'ul.gw-go-body > li', function(e) { 456 457 var $this=$(this); 458 459 if (e.type == 'mouseenter') { 460 $.GoPricing.showTooltip($this); 461 } else { 462 $.GoPricing.hideTooltip($this); 463 } 464 465 }); 466 467 468 /* Event handling */ 469 $('body').on($.GoPricing.eventType, '.gw-go-col-wrap', function(e) { 470 var $this = $(this); 471 472 if (e.type == 'mouseenter') { 473 $this.addClass('gw-go-curr'); 474 } else if (e.type == 'mouseleave') { 475 $this.removeClass('gw-go-curr'); 476 } 477 478 if (e.type == 'mouseenter' && !$this.hasClass('gw-go-disable-hover')) { 479 $this.addClass('gw-go-hover').siblings(':not(.gw-go-disable-hover)').removeClass('gw-go-hover'); 480 $this.closest('.gw-go').addClass('gw-go-hover'); 481 } else if (e.type == 'mouseleave' && !$this.hasClass('gw-go-disable-hover')) { 482 $this.removeClass('gw-go-hover'); 483 $this.closest('.gw-go').find('[data-current="1"]:not(.gw-go-disable-hover)').addClass('gw-go-hover'); 484 $this.closest('.gw-go').removeClass('gw-go-hover') 485 } else if (!$this.hasClass('gw-go-disable-hover')) { 486 $this.closest('.gw-go').addClass('gw-go-hover') 487 $this.addClass('gw-go-hover').siblings(':not(.gw-go-disable-hover)').removeClass('gw-go-hover'); 488 }; 489 490 }); 491 492 493 /** 494 * Google map 495 */ 496 497 if (typeof jQuery.goMap !== 'undefined' && $.GoPricing.$wrap.find('.gw-go-gmap').length) { 498 var GoPricing_MapResize=false; 499 $(window).on('resize', function(e) { 500 if (GoPricing_MapResize) { clearTimeout(GoPricing_MapResize); } 501 GoPricing_MapResize = setTimeout(function() { 502 $.GoPricing.$wrap.find('.gw-go-gmap').each(function(index, element) { 503 //$(this).goMap(); 504 //console.log($.goMap.getMarkers('markers')[0].position); 505 });
506 }, 400); 507 }); 508 }; 509 510 511 /* Equalize heights on resize */ 512 $(window).on('resize load', function(e) { 513 514 for (var x = 0; x < $.GoPricing.$wrap.length; x++) { 515 $.GoPricing.$wrap.eq(x).data('eq-ready', false); 516 $.GoPricing.$wrap.eq(x).data('fix-width', false); 517 } 518 $.GoPricing.fixWidth(); 519 $.GoPricing.EqualizeRows(); 520 521 }); 522 523 /* handle animations */ 524 $(window).on("scrollEnter scrollLeave", function(e, spy) { 525 var $target = $(e.target); 526 var repeat = $target.data("anim-repeat") || Infinity; 527 if (e.type == "scrollEnter") { 528 if (spy.enters <= repeat) $target.data("tl").play(); 529 } else { 530 if (spy.enters < repeat) $target.data("tl").stop().seek(0); 531 } 532 }); 533 534 }); 535}(jQuery)); 536 537;(function($, window, undefined) { 538 539 var $elems = $(); 540 var $cont = $(window) 541 .on("resize.tablespy", onResize) 542 .on("load.tablespy", onResize) 543 .on("scroll.tablespy load.tablespy", onScroll); 544 545 function onScroll() { 546 if (!$elems.length) return; 547 var height = $cont.height(); 548 var y = $cont.scrollTop(); 549 $elems.each(function() { 550 var $elem = $(this); 551 var o = $elem.data('tablespy'); 552 var offset = o.rowHeight * o.offset / 100; 553 554 if (Math.floor((o.rowHeight+height)/2) < offset) offset = Math.floor((o.rowHeight+height)/2)-20; 555 556 if (height + y-offset >= o.min && y+offset <= o.max){ 557 if (!o.inside) { 558 o.inside = true; 559 o.enters++; 560 $elem.trigger("scrollEnter", {scrollTop: y, enters: o.enters, leaves: o.leaves}); 561 } 562 $elem.trigger("scrollTick", {scrollTop: y, enters: o.enters, leaves: o.leaves}); 563 } 564 if (o.inside && !(height + y >= o.min && y <= o.max)) { 565 o.inside = false; 566 o.leaves++; 567 $elem.trigger("scrollLeave", {scrollTop: y, enters: o.enters, leaves: o.leaves}); 568 } 569 }); 570 } 571 572 function onResize() { 573 $elems.each(function() { 574 var $elem = $(this); 575 var o = $elem.data("tablespy"); 576 o.min = $elem.offset().top; 577 o.max = $elem.outerHeight() + o.min; 578 o.rowHeight = $elem.children(":visible:first").outerHeight(); 579 }); 580 } 581 582 $.fn.tablespy = function(options) { 583 var defaults = { 584 offset: 0, 585 enters: 0, 586 leaves: 0, 587 inside: false 588 }; 589 return this.each(function() { 590 var $elem = $(this); 591 var top = $elem.offset().top; 592 $elem.data("tablespy", $.extend({ 593 min: top, 594 max: top + $elem.outerHeight(), 595 rowHeight: $elem.children(":visible:first").outerHeight() 596 }, defaults, options)); 597 $elems.push(this); 598 }); 599 }; 600 601})(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.