1(function($) { 2 3 'use strict'; 4 5 var Pages = function() { 6 this.VERSION = "1.1.1"; 7 this.AUTHOR = "Revox"; 8 this.SUPPORT = "[email protected]"; 9 10 this.pageScrollElement = 'html, body'; 11 this.$body = $('body'); 12 13 this.setUserOS(); 14 this.setUserAgent(); 15 } 16 17 // Set environment vars 18 Pages.prototype.setUserOS = function() { 19 var OSName = ""; 20 if (navigator.appVersion.indexOf("Win") != -1) OSName = "windows"; 21 if (navigator.appVersion.indexOf("Mac") != -1) OSName = "mac"; 22 if (navigator.appVersion.indexOf("X11") != -1) OSName = "unix"; 23 if (navigator.appVersion.indexOf("Linux") != -1) OSName = "linux"; 24 25 this.$body.addClass(OSName); 26 } 27 28 Pages.prototype.setUserAgent = function() { 29 if (navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) { 30 this.$body.addClass('mobile'); 31 } else { 32 this.$body.addClass('desktop'); 33 if (navigator.userAgent.match(/MSIE 9.0/)) { 34 this.$body.addClass('ie9'); 35 } 36 } 37 } 38 39 // Pages util functions 40 Pages.prototype.isVisibleXs = function() { 41 (!$('#pg-visible-xs').length) && this.$body.append('<div id="pg-visible-xs" class="visible-xs" />'); 42 return $('#pg-visible-xs').is(':visible'); 43 } 44 45 Pages.prototype.isVisibleSm = function() { 46 (!$('#pg-visible-sm').length) && this.$body.append('<div id="pg-visible-sm" class="visible-sm" />'); 47 return $('#pg-visible-sm').is(':visible'); 48 } 49 50 Pages.prototype.isVisibleMd = function() { 51 (!$('#pg-visible-md').length) && this.$body.append('<div id="pg-visible-md" class="visible-md" />'); 52 return $('#pg-visible-md').is(':visible'); 53 } 54 55 Pages.prototype.isVisibleLg = function() { 56 (!$('#pg-visible-lg').length) && this.$body.append('<div id="pg-visible-lg" class="visible-lg" />'); 57 return $('#pg-visible-lg').is(':visible'); 58 } 59 60 Pages.prototype.getUserAgent = function() { 61 return $('body').hasClass('mobile') ? "mobile" : "desktop"; 62 } 63 64 Pages.prototype.setFullScreen = function(element) { 65 // Supports most browsers and their versions. 66 var requestMethod = element.requestFullScreen || element.webkitRequestFullScreen || element.mozRequestFullScreen || element.msRequestFullscreen; 67 68 if (requestMethod) { // Native full screen. 69 requestMethod.call(element); 70 } else if (typeof window.ActiveXObject !== "undefined") { // Older IE. 71 var wscript = new ActiveXObject("WScript.Shell"); 72 if (wscript !== null) { 73 wscript.SendKeys("{F11}"); 74 } 75 } 76 } 77 78 Pages.prototype.getColor = function(color, opacity) { 79 opacity = parseFloat(opacity) || 1; 80 81 var elem = $('.pg-colors').length ? $('.pg-colors') : $('<div class="pg-colors"></div>').appendTo('body'); 82 83 var colorElem = elem.find('[data-color="' + color + '"]').length ? elem.find('[data-color="' + color + '"]') : $('<div class="bg-' + color + '" data-color="' + color + '"></div>').appendTo(elem); 84 85 var color = colorElem.css('background-color'); 86 87 var rgb = color.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/); 88 var rgba = "rgba(" + rgb[1] + ", " + rgb[2] + ", " + rgb[3] + ', ' + opacity + ')'; 89 90 return rgba; 91 } 92 93 Pages.prototype.setBackgroundImage = function() { 94 $('[data-pages-bg-image]').each(function() { 95 var _elem = $(this) 96 var defaults = { 97 pagesBgImage: "", 98 lazyLoad: 'true', 99 progressType: '', 100 progressColor:'', 101 bgOverlay:'', 102 bgOverlayClass:'', 103 overlayOpacity:0, 104 } 105 var data = _elem.data(); 106 $.extend( defaults, data ); 107 var url = defaults.pagesBgImage; 108 var color = defaults.bgOverlay; 109 var opacity = defaults.overlayOpacity; 110 111 var overlay = $('<div class="bg-overlay"></div>'); 112 overlay.addClass(defaults.bgOverlayClass); 113 overlay.css({ 114 'background-color': color, 115 'opacity': 1 116 }); 117 _elem.append(overlay); 118 119 var img = new Image(); 120 img.src = url; 121 img.onload = function(){ 122 _elem.css({ 123 'background-image': 'url(' + url + ')' 124 }); 125 _elem.children('.bg-overlay').css({'opacity': opacity}); 126 } 127 128 }) 129 } 130 Pages.prototype.initRevealFooter = function() { 131 var _elem = $('[data-pages="reveal-footer"]'); 132 setHeight(); 133 function setHeight(){ 134 var h = _elem.outerHeight(); 135 _elem.prev().css({ 136 'margin-bottom':h 137 }) 138 } 139 $(window).resize(function(){ 140 setHeight(); 141 }) 142 } 143 Pages.prototype.initFormGroupDefault = function() { 144 $('.form-group.form-group-default').click(function() { 145 $(this).find('input').focus(); 146 }); 147 $('body').on('focus', '.form-group.form-group-default :input', function() { 148 $('.form-group.form-group-default').removeClass('focused'); 149 $(this).parents('.form-group').addClass('focused'); 150 }); 151 152 $('body').on('blur', '.form-group.form-group-default :input', function() { 153 $(this).parents('.form-group').removeClass('focused'); 154 if ($(this).val()) { 155 $(this).closest('.form-group').find('.control-label').addClass('fade'); 156 } else { 157 $(this).closest('.form-group').find('.control-label').removeClass('fade'); 158 } 159 }); 160 161 $('.form-group.form-group-default .checkbox, .form-group.form-group-default .radio').hover(function() { 162 $(this).parents('.form-group').addClass('focused'); 163 }, function() { 164 $(this).parents('.form-group').removeClass('focused'); 165 }); 166 } 167 Pages.prototype.initTextRotator = function() { 168 var defaults = { 169 animation:"flipUp", 170 separator:",", 171 speed: 2000 172 } 173 $('[data-pages-init="text-rotate"]').each(function() { 174 defaults = $(this).data(); 175 if (!$.fn.textrotator) return; 176 $(this).textrotator(defaults); 177 }); 178 } 179 Pages.prototype.initAnimatables = function() { 180 if (!$.fn.appear) return; 181 $('[data-pages-animate="number"]').appear(); 182 $('[data-pages-animate="progressbar"]').appear(); 183 $('[data-pages-animate="number"]').on('appear', function() { 184 $(this).animateNumbers($(this).attr("data-value"), true, parseInt($(this).attr("data-animation-duration"))); 185 }); 186 $('[data-pages-animate="progressbar"]').on('appear', function() { 187 $(this).css('width', $(this).attr("data-percentage")); 188 }); 189 } 190 191 Pages.prototype.initAutoImageScroller = function() { 192 //Scrolling Device Image : Showcase 193 $('[data-pages="auto-scroll"]').each(function() { 194 var y = 0; 195 var interval; 196 var Screen = $(this).find('.iphone-border'); 197 var img = Screen.find('img'); 198 var endOfImage = false;
199 var scroll = function() { 200 var screenHeight = Screen.height(); 201 var swipeDistance = screenHeight / 2; 202 203 if(y - swipeDistance <= -img.height() + screenHeight){ 204 y = -img.height() + screenHeight; 205 endOfImage = true; 206 } else { 207 y -= swipeDistance; 208 } 209 img.css({ 210 'transform': 'translateY(' + y + 'px)' 211 }); 212 if (endOfImage) { 213 y = 0; 214 clearInterval(interval); 215 setTimeout(function() { 216 img.css({ 217 'transform': 'translateY(' + y + 'px)' 218 }); 219 endOfImage = false; 220 interval = setInterval(scroll, 1000); 221 }, 2000); 222 } 223 } 224 interval = setInterval(scroll, 1000); 225 }) 226 } 227 228 Pages.prototype.initUnveilPlugin = function() { 229 // lazy load retina images 230 $.fn.unveil && $("img").unveil(); 231 } 232 233 // Call initializers 234 Pages.prototype.init = function() { 235 this.setBackgroundImage(); 236 this.initFormGroupDefault(); 237 this.initUnveilPlugin(); 238 this.initAnimatables(); 239 this.initAutoImageScroller(); 240 this.initTextRotator(); 241 this.initRevealFooter(); 242 } 243 244 $.Pages = new Pages(); 245 $.Pages.Constructor = Pages; 246 247})(window.jQuery); 248/* ============================================================ 249 * Pages Header Plugin 250 * ============================================================ */ 251 252(function($) { 253 'use strict'; 254 255 var Header = function(element, options) { 256 this.$body = $('body'); 257 this.$element = $(element); 258 this.options = $.extend(true, {}, $.fn.header.defaults, options); 259 if (this.$element.attr('data-pages-header') == "autoresize") 260 this.options.autoresize = true 261 262 if (this.$element.attr('data-pages-header') != null) 263 this.options.minimizedClass = this.options.minimizedClass + ' ' + this.$element.attr('data-pages-resize-class'); 264 265 this.initAffix(); 266 } 267 Header.prototype.initAffix = function() { 268 if (this.$element.attr('data-pages-autofixed') == "true") { 269 this.$element.affix({ 270 offset: { 271 top: this.$element.offset().top, 272 } 273 }); 274 } 275 }; 276 Header.prototype.updateAffix = function() { 277 if (this.$element.attr('data-pages-autofixed') == "true") { 278 this.$element.removeData('affix').removeClass('affix affix-top affix-bottom'); 279 this.$element.affix({ 280 offset: this.$element.offset().top 281 }) 282 } 283 }; 284 Header.prototype.addMinimized = function() { 285 if (this.options.autoresize && !this.$element.hasClass('affix-top')) 286 if (!this.$element.hasClass(this.options.minimizedClass)) 287 this.$element.addClass(this.options.minimizedClass); 288 }; 289 Header.prototype.removeMinized = function() { 290 if (this.options.autoresize || this.$element.hasClass('affix-top')) 291 this.$element.removeClass(this.options.minimizedClass); 292 }; 293 294 function Plugin(option) { 295 return this.each(function() { 296 var $this = $(this); 297 var data = $this.data('pg.header'); 298 var options = typeof option == 'object' && option; 299 300 if (!data) $this.data('pg.header', (data = new Header(this, options))); 301 if (typeof option == 'string') data[option](); 302 }) 303 } 304 305 var old = $.fn.header 306 307 $.fn.header = Plugin 308 $.fn.header.Constructor = Header 309 310 311 $.fn.header.defaults = { 312 duration: 350, 313 autoresize: false, 314 minimizedClass: 'minimized' 315 } 316 317 // HEADER NO CONFLICT 318 // ==================== 319 320 $.fn.header.noConflict = function() { 321 $.fn.header = old; 322 return this; 323 } 324 325 // HEADER DATA API 326 //=================== 327 $(document).ready(function() { 328 $('.menu > li > a').each(function(){ 329 if($(this).attr("data-toggle") =="click"){ 330 $(this).on('click', function(e) { 331 openMenu($(this)); 332 }); 333 334 $(document).on("click", function(e){ 335 if($('.menu').has(e.target).length == 0){ 336 $('.menu > li').removeClass('open'); 337 } 338 }); 339 } 340 else{ 341 $(this).on('mouseenter', function(e) { 342 openMenu($(this)); 343 }); 344 $('.desktop .menu > li > nav').on('mouseleave', function(e) { 345 $('.menu > li').removeClass('open'); 346 }); 347 } 348 }) 349 function openMenu(el){ 350 if ($(el).parent().hasClass('mega')) { 351 if ($(el).parent().hasClass('open')) { 352 $(el).parents('.container').removeClass('clip-mega-menu'); 353 } else { 354 $(el).parents('.container').addClass('clip-mega-menu'); 355 } 356 357 } else { 358 $(el).parents('.container').removeClass('clip-mega-menu'); 359 360 361 } 362 $(el).parent().toggleClass('open').siblings().removeClass('open'); 363 } 364 }) 365 366 $(window).on('load', function() { 367 $('[data-pages="header"]').each(function() { 368 var $header = $(this) 369 $header.header($header.data()) 370 }) 371 }); 372 373 $('[data-pages="header-toggle"]').on('click touchstart', function(e) { 374 e.preventDefault(); 375 var el = $(this) 376 377 var header = el.attr('data-pages-element'); 378 $('body').toggleClass('menu-opened'); 379 $('[data-pages="header-toggle"]').toggleClass('on'); 380 381 }); 382 $(window).on("resize", function() { 383 $('[data-pages="header"]').header('updateAffix'); 384 }) 385 $(window).on("scroll", function() { 386 var ScrollTop = parseInt($(window).scrollTop()); 387 if (ScrollTop > 1) { 388 $('[data-pages="header"]').header('addMinimized'); 389 } else { 390 if (ScrollTop < 10) { 391 $('[data-pages="header"]').header('removeMinized'); 392 } 393 } 394 }); 395 396})(window.jQuery); 397 398/* ============================================================ 399 * Pages Parallax Plugin 400 * ============================================================ */ 401 402(function($) { 403 'use strict'; 404 // PARALLAX CLASS DEFINITION 405 // ====================== 406 407 var Parallax = function(element, options) { 408 this.$element = $(element); 409 this.$body = $('body'); 410 this.options = $.extend(true, {}, $.fn.parallax.defaults, options); 411 this.$coverPhoto = this.$element.find('.cover-photo'); 412 // TODO: rename .inner to .page-cover-content 413 this.$content = this.$element.find('.inner'); 414 415 // if cover photo img is found make it a background-image 416 if (this.$coverPhoto.find('> img').length) { 417 var img = this.$coverPhoto.find('> img'); 418 this.$coverPhoto.css('background-image', 'url(' + img.attr('src') + ')'); 419 img.remove(); 420 } 421 this.translateBgImage(); 422 } 423 Parallax.VERSION = "1.0.0"; 424 425 Parallax.prototype.animate = function(translate) { 426 427 var scrollPos; 428 var pagecoverHeight = this.$element.height(); 429 //opactiy to text starts at 50% scroll length 430 var opacityKeyFrame = pagecoverHeight * 50 / 100; 431 var direction = 'translateX'; 432 433 scrollPos = $(window).scrollTop(); 434 if (this.$body.hasClass('mobile')) { 435 scrollPos = -(translate); 436 } 437 direction = 'translateY'; 438 439 this.$coverPhoto.css({ 440 'transform': direction + '(' + scrollPos * this.options.speed.coverPhoto + 'px)' 441 }); 442 443 this.$content.css({ 444 'transform': direction + '(' + scrollPos * this.options.speed.content + 'px)', 445 }); 446 447 448 this.translateBgImage(); 449 450 451 } 452 453 Parallax.prototype.translateBgImage = function() { 454 var scrollPos = $(window).scrollTop(); 455 var pagecoverHeight = this.$element.height(); 456 if (this.$element.attr('data-pages-bg-image')) { 457 var relativePos = this.$element.offset().top - scrollPos; 458 459 // if element is in visible window's frame 460 if (relativePos > -pagecoverHeight && relativePos <= $(window).height()) { 461 var displacePerc = 100 - ($(window).height() - relativePos) / ($(window).height() + pagecoverHeight) * 100; 462 this.$element.css({ 463 'background-position': 'center ' + displacePerc + '%' 464 }); 465 } 466 } 467 } 468 // PARALLAX PLUGIN DEFINITION 469 // ======================= 470 function Plugin(option) { 471 return this.each(function() { 472 var $this = $(this); 473 var data = $this.data('pg.parallax'); 474 var options = typeof option == 'object' && option; 475 476 if (!data) $this.data('pg.parallax', (data = new Parallax(this, options))); 477 if (typeof option == 'string') data[option](); 478 }) 479 } 480 481 var old = $.fn.parallax 482 483 $.fn.parallax = Plugin 484 $.fn.parallax.Constructor = Parallax 485 486 487 $.fn.parallax.defaults = { 488 speed: { 489 coverPhoto: 0.3, 490 content: 0.17 491 } 492 } 493 494 // PARALLAX NO CONFLICT 495 // ==================== 496 497 $.fn.parallax.noConflict = function() { 498 $.fn.parallax = old; 499 return this; 500 } 501 502 // PARALLAX DATA API 503 //=================== 504 505 $(window).on('load', function() { 506 507 $('[data-pages="parallax"]').each(function() { 508 var $parallax = $(this) 509 $parallax.parallax($parallax.data()) 510 }) 511 }); 512 513 $(window).on('scroll', function() { 514 // Disable parallax for Touch devices 515 516 $('[data-pages="parallax"]').parallax('animate'); 517 }); 518 519})(window.jQuery); 520/* ============================================================ 521 * Pages Portlet 522 * ============================================================ */ 523 524(function($) { 525 'use strict'; 526 // PORTLET CLASS DEFINITION 527 // ====================== 528 529 var Portlet = function(element, options) { 530 this.$element = $(element); 531 this.options = $.extend(true, {}, $.fn.portlet.defaults, options); 532 this.$loader = null; 533 this.$body = this.$element.find('.panel-body'); 534 } 535 Portlet.VERSION = "1.0.0"; 536 // Button actions 537 Portlet.prototype.collapse = function() { 538 var icon = this.$element.find(this.options.collapseButton + ' > i'); 539 var heading = this.$element.find('.panel-heading'); 540 541 this.$body.stop().slideToggle("fast"); 542 543 if (this.$element.hasClass('panel-collapsed')) { 544 this.$element.removeClass('panel-collapsed'); 545 icon.removeClass().addClass('pg-arrow_maximize'); 546 $.isFunction(this.options.onExpand) && this.options.onExpand(); 547 return 548 } 549 this.$element.addClass('panel-collapsed'); 550 icon.removeClass().addClass('pg-arrow_minimize'); 551 $.isFunction(this.options.onCollapse) && this.options.onCollapse(); 552 } 553 554 Portlet.prototype.close = function() { 555 this.$element.remove(); 556 $.isFunction(this.options.onClose) && this.options.onClose(); 557 } 558 559 Portlet.prototype.maximize = function() { 560 var icon = this.$element.find(this.options.maximizeButton + ' > i'); 561 562 if (this.$element.hasClass('panel-maximized')) { 563 this.$element.removeClass('panel-maximized'); 564 icon.removeClass('pg-fullscreen_restore').addClass('pg-fullscreen'); 565 $.isFunction(this.options.onRestore) && this.options.onRestore(); 566 } else { 567 this.$element.addClass('panel-maximized'); 568 icon.removeClass('pg-fullscreen').addClass('pg-fullscreen_restore'); 569 $.isFunction(this.options.onMaximize) && this.options.onMaximize(); 570 } 571 } 572 573 // Options 574 Portlet.prototype.refresh = function(refresh) { 575 var toggle = this.$element.find(this.options.refreshButton); 576 577 if (refresh) { 578 if (this.$loader && this.$loader.is(':visible')) return; 579 if (!$.isFunction(this.options.onRefresh)) return; // onRefresh() not set
580 this.$loader = $('<div class="portlet-progress"></div>'); 581 this.$loader.css({ 582 'background-color': 'rgba(' + this.options.overlayColor + ',' + this.options.overlayOpacity + ')' 583 584 }); 585 586 var elem = ''; 587 if (this.options.progress == 'circle') { 588 elem += '<div class="progress-circle-indeterminate progress-circle-' + this.options.progressColor + '"></div>'; 589 } else if (this.options.progress == 'bar') { 590 591 elem += '<div class="progress progress-small">'; 592 elem += ' <div class="progress-bar-indeterminate progress-bar-' + this.options.progressColor + '"></div>'; 593 elem += '</div>'; 594 } else if (this.options.progress == 'circle-lg') { 595 toggle.addClass('refreshing'); 596 var iconOld = toggle.find('> i').first(); 597 var iconNew; 598 if (!toggle.find('[class$="-animated"]').length) { 599 iconNew = $('<i/>'); 600 iconNew.css({ 601 'position': 'absolute', 602 'top': iconOld.position().top, 603 'left': iconOld.position().left 604 }); 605 iconNew.addClass('portlet-icon-refresh-lg-' + this.options.progressColor + '-animated'); 606 toggle.append(iconNew); 607 } else { 608 iconNew = toggle.find('[class$="-animated"]'); 609 } 610 611 iconOld.addClass('fade'); 612 iconNew.addClass('active'); 613 614 615 } else { 616 elem += '<div class="progress progress-small">'; 617 elem += ' <div class="progress-bar-indeterminate progress-bar-' + this.options.progressColor + '"></div>'; 618 elem += '</div>'; 619 } 620 621 this.$loader.append(elem); 622 this.$element.append(this.$loader); 623 624 // Start Fix for FF: pre-loading animated to SVGs 625 var _loader = this.$loader; 626 setTimeout(function() { 627 this.$loader.remove(); 628 this.$element.append(_loader); 629 }.bind(this), 300); 630 // End fix 631 this.$loader.fadeIn(); 632 633 $.isFunction(this.options.onRefresh) && this.options.onRefresh(); 634 635 } else { 636 var _this = this; 637 this.$loader.fadeOut(function() { 638 $(this).remove(); 639 if (_this.options.progress == 'circle-lg') { 640 var iconNew = toggle.find('.active'); 641 var iconOld = toggle.find('.fade'); 642 iconNew.removeClass('active'); 643 iconOld.removeClass('fade'); 644 toggle.removeClass('refreshing'); 645 646 } 647 _this.options.refresh = false; 648 }); 649 } 650 } 651 652 Portlet.prototype.error = function(error) { 653 if (error) { 654 var _this = this; 655 this.$element.pgNotification({ 656 style: 'bar', 657 message: error, 658 position: 'top', 659 timeout: 0, 660 type: 'danger', 661 onShown: function() { 662 _this.$loader.find('> div').fadeOut() 663 }, 664 onClosed: function() { 665 _this.refresh(false) 666 } 667 }).show(); 668 } 669 } 670 671 // PORTLET PLUGIN DEFINITION 672 // ======================= 673 674 function Plugin(option) { 675 return this.each(function() { 676 var $this = $(this); 677 var data = $this.data('pg.portlet'); 678 var options = typeof option == 'object' && option; 679 680 if (!data) $this.data('pg.portlet', (data = new Portlet(this, options))); 681 if (typeof option == 'string') data[option](); 682 else if (options.hasOwnProperty('refresh')) data.refresh(options.refresh); 683 else if (options.hasOwnProperty('error')) data.error(options.error); 684 }) 685 } 686 687 var old = $.fn.portlet 688 689 $.fn.portlet = Plugin 690 $.fn.portlet.Constructor = Portlet 691 692 693 $.fn.portlet.defaults = { 694 progress: 'circle', 695 progressColor: 'master', 696 refresh: false, 697 error: null, 698 overlayColor: '255,255,255', 699 overlayOpacity: 0.8, 700 refreshButton: '[data-toggle="refresh"]', 701 maximizeButton: '[data-toggle="maximize"]', 702 collapseButton: '[data-toggle="collapse"]', 703 closeButton: '[data-toggle="close"]' 704 705 // onRefresh: function() {}, 706 // onCollapse: function() {}, 707 // onExpand: function() {}, 708 // onMaximize: function() {}, 709 // onRestore: function() {}, 710 // onClose: function() {} 711 } 712 713 // PORTLET NO CONFLICT 714 // ==================== 715 716 $.fn.portlet.noConflict = function() { 717 $.fn.portlet = old; 718 return this; 719 } 720 721 // PORTLET DATA API 722 //=================== 723 724 $(document).on('click.pg.portlet.data-api', '[data-toggle="collapse"]', function(e) { 725 var $this = $(this); 726 var $target = $this.closest('.panel'); 727 if ($this.is('a')) e.preventDefault(); 728 $target.data('pg.portlet') && $target.portlet('collapse'); 729 }) 730 731 $(document).on('click.pg.portlet.data-api', '[data-toggle="close"]', function(e) { 732 var $this = $(this); 733 var $target = $this.closest('.panel'); 734 if ($this.is('a')) e.preventDefault(); 735 $target.data('pg.portlet') && $target.portlet('close'); 736 }) 737 738 $(document).on('click.pg.portlet.data-api', '[data-toggle="refresh"]', function(e) { 739 var $this = $(this); 740 var $target = $this.closest('.panel'); 741 if ($this.is('a')) e.preventDefault(); 742 $target.data('pg.portlet') && $target.portlet({ 743 refresh: true 744 }) 745 }) 746 747 $(document).on('click.pg.portlet.data-api', '[data-toggle="maximize"]', function(e) { 748 var $this = $(this); 749 var $target = $this.closest('.panel'); 750 if ($this.is('a')) e.preventDefault(); 751 $target.data('pg.portlet') && $target.portlet('maximize'); 752 }) 753 754 $(window).on('load', function() { 755 $('[data-pages="portlet"]').each(function() { 756 var $portlet = $(this) 757 $portlet.portlet($portlet.data()) 758 }) 759 }) 760 761})(window.jQuery); 762/* ============================================================ 763 * Pages Search overlay 764 * ============================================================ */ 765 766(function($) { 767 768 'use strict'; 769 770 // SEARCH CLASS DEFINITION 771 // ====================== 772 773 var Search = function(element, options) { 774 this.$element = $(element); 775 this.options = $.extend(true, {}, $.fn.search.defaults, options); 776 this.init(); 777 } 778 Search.VERSION = "1.0.0"; 779 780 Search.prototype.init = function() { 781 var _this = this; 782 this.pressedKeys = []; 783 this.ignoredKeys = []; 784 785 //Cache elements 786 this.$searchField = this.$element.find(this.options.searchField); 787 this.$closeButton = this.$element.find(this.options.closeButton); 788 this.$suggestions = this.$element.find(this.options.suggestions); 789 this.$brand = this.$element.find(this.options.brand); 790 791 this.$searchField.on('keyup', function(e) { 792 _this.$suggestions && _this.$suggestions.html($(this).val()); 793 }); 794 795 this.$searchField.on('keyup', function(e) { 796 _this.options.onKeyEnter && _this.options.onKeyEnter(_this.$searchField.val()); 797 if (e.keyCode == 13) { //Enter pressed 798 e.preventDefault(); 799 _this.options.onSearchSubmit && _this.options.onSearchSubmit(_this.$searchField.val()); 800 } 801 if ($('body').hasClass('overlay-disabled')) { 802 return 0; 803 } 804 805 }); 806 807 this.$closeButton.on('click', function() { 808 _this.toggleOverlay('hide'); 809 }); 810 811 this.$element.on('click', function(e) { 812 if ($(e.target).data('pages') == 'search') { 813 _this.toggleOverlay('hide'); 814 } 815 }); 816 817 $(document).on('keypress.pg.search', function(e) { 818 _this.keypress(e); 819 }); 820 821 $(document).on('keyup', function(e) { 822 // Dismiss overlay on ESC is pressed 823 if (_this.$element.is(':visible') && e.keyCode == 27) { 824 _this.toggleOverlay('hide'); 825 } 826 }); 827 828 } 829 830 831 Search.prototype.keypress = function(e) { 832 833 e = e || event; // to deal with IE 834 var nodeName = e.target.nodeName; 835 if ($('body').hasClass('overlay-disabled') || 836 $(e.target).hasClass('js-input') || 837 nodeName == 'INPUT' || 838 nodeName == 'TEXTAREA') { 839 return; 840 } 841 842 if (e.which !== 0 && e.charCode !== 0 && !e.ctrlKey && !e.metaKey && !e.altKey && e.keyCode != 27) { 843 this.toggleOverlay('show', String.fromCharCode(e.keyCode | e.charCode)); 844 } 845 } 846 847 848 Search.prototype.toggleOverlay = function(action, key) { 849 var _this = this; 850 if (action == 'show') { 851 this.$element.removeClass("hide"); 852 this.$element.fadeIn("fast"); 853 if (!this.$searchField.is(':focus')) { 854 this.$searchField.val(key); 855 setTimeout(function() { 856 this.$searchField.focus(); 857 var tmpStr = this.$searchField.val(); 858 this.$searchField.val(''); 859 this.$searchField.val(tmpStr); 860 }.bind(this), 100); 861 } 862 863 this.$element.removeClass("closed"); 864 this.$brand.toggleClass('invisible'); 865 $(document).off('keypress.pg.search'); 866 } else { 867 this.$element.fadeOut("fast").addClass("closed"); 868 this.$searchField.val('').blur(); 869 setTimeout(function() { 870 if ((this.$element).is(':visible')) { 871 this.$brand.toggleClass('invisible'); 872 } 873 $(document).on('keypress.pg.search', function(e) { 874 _this.keypress(e); 875 }); 876 }.bind(this), 100); 877 } 878 }; 879 880 // SEARCH PLUGIN DEFINITION 881 // ======================= 882 883 884 function Plugin(option) { 885 return this.each(function() { 886 var $this = $(this); 887 var data = $this.data('pg.search'); 888 var options = typeof option == 'object' && option; 889 890 if (!data) { 891 $this.data('pg.search', (data = new Search(this, options))); 892 893 } 894 if (typeof option == 'string') data[option](); 895 }) 896 } 897 898 var old = $.fn.search 899 900 $.fn.search = Plugin 901 $.fn.search.Constructor = Search 902 903 $.fn.search.defaults = { 904 searchField: '[data-search="searchField"]', 905 closeButton: '[data-search="closeButton"]', 906 suggestions: '[data-search="suggestions"]', 907 brand: '[data-search="brand"]' 908 } 909 910 // SEARCH NO CONFLICT 911 // ==================== 912 913 $.fn.search.noConflict = function() { 914 $.fn.search = old; 915 return this; 916 } 917 918 $(document).on('click.pg.search.data-api', '[data-toggle="search"]', function(e) { 919 var $this = $(this); 920 var $target = $('[data-pages="search"]'); 921 if ($this.is('a')) e.preventDefault(); 922 $target.data('pg.search').toggleOverlay('show'); 923 }) 924 925 926}
926)(window.jQuery); 927/* ============================================================ 928 * Pages Float Plugin 929 * ============================================================ */ 930 931(function($) { 932 'use strict'; 933 // FLOAT CLASS DEFINITION 934 // ====================== 935 936 var Float = function(element, options) { 937 this.$element = $(element); 938 this.options = $.extend(true, {}, $.fn.pgFloat.defaults, options); 939 940 var _this = this; 941 var _prevY; 942 943 function update() { 944 var element = _this.$element; 945 var w = $(window).scrollTop(); 946 var translateY = (w - element.offset().top) * _this.options.speed; 947 var delay = _this.options.delay / 1000; //in seconds 948 var curve = _this.options.curve; 949 var maxTopTranslate = _this.options.maxTopTranslate; 950 var maxBottomTranslate = _this.options.maxBottomTranslate; 951 952 if (maxTopTranslate == 0) { 953 if (element.offset().top + element.outerHeight() < w) return; 954 } 955 956 if (maxBottomTranslate == 0) { 957 if (element.offset().top > w + $(window).height()) return; 958 } 959 960 if (_prevY < translateY) { // scroll down, element will hide from top 961 if (maxTopTranslate != 0 && Math.abs(translateY) > maxTopTranslate) return; 962 } else { 963 if (maxBottomTranslate != 0 && Math.abs(translateY) > maxBottomTranslate) return; 964 } 965 966 967 element.css({ 968 'transition': 'transform ' + delay + 's ' + curve, 969 'transform': 'translateY(' + translateY + 'px)', 970 }); 971 972 _prevY = translateY; 973 } 974 975 $(window).bind('scroll', function() { 976 update() 977 }); 978 $(window).bind('load', function() { 979 update() 980 }); 981 } 982 Float.VERSION = "1.0.0"; 983 984 985 986 // FLOAT PLUGIN DEFINITION 987 // ======================= 988 function Plugin(option) { 989 return this.each(function() { 990 var $this = $(this); 991 var data = $this.data('pgFloat'); 992 var options = typeof option == 'object' && option; 993 994 if (!data) $this.data('pgFloat', (data = new Float(this, options))); 995 if (typeof option == 'string') data[option](); 996 }) 997 } 998 999 var old = $.fn.pgFloat; 1000 1001 $.fn.pgFloat = Plugin; 1002 $.fn.pgFloat.Constructor = Float; 1003 1004 1005 $.fn.pgFloat.defaults = { 1006 topMargin: 0, 1007 bottomMargin: 0, 1008 speed: 0.1, 1009 delay: 1000, 1010 curve: 'ease' 1011 } 1012 1013 // FLOAT NO CONFLICT 1014 // ==================== 1015 1016 $.fn.pgFloat.noConflict = function() { 1017 $.fn.pgFloat = old; 1018 return this; 1019 } 1020 1021 // FLOAT DATA API 1022 //=================== 1023 1024 $(window).on('load', function() { 1025 1026 $('[data-pages="float"]').each(function() { 1027 var $pgFloat = $(this) 1028 $pgFloat.pgFloat($pgFloat.data()) 1029 }) 1030 }); 1031 1032})(window.jQuery); 1033(function($) { 1034 'use strict'; 1035 // Initialize layouts and plugins 1036 (typeof angular === 'undefined') && $.Pages.init(); 1037})(window.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.