{I" class:ETI"BundledAsset;FI"logical_path;TI"'forever_style_guide/application.js;TI" pathname;TI"o/Users/nmcclay/Documents/git/forever-style-guide/app/assets/javascripts/forever_style_guide/application.js;FI"content_type;TI"application/javascript;TI" mtime;Tl+P®\VI" length;Ti"cI" digest;TI"%6e70387135bdb9dca78ba8c7728e1387;FI" source;TI""c// an 'accounPopover' namespace for additional popover functionality. var accountPopover = (function () { /** Apply 'danger', 'warning' classes to the popover's progress bar and upgrade button. Example ```javascript _addStateClasses($popoverContainer, 'danger'); ``` @private */ var _addStateClasses = function (container, state) { container.find(".account-popover-link-text").addClass("account-popover-link-" + state); container.find(".account-popover-storage-upgrade .btn").addClass("btn-" + state); container.find(".progress-bar").addClass("progress-bar-" + state); }; /** Removes the 'danger' and 'warning' classes to the popover's progress bar and upgrade button. Example ```javascript _resetClasses($popoverContainer); ``` @private */ var _resetClasses = function (container) { container.find(".account-popover-link-danger").removeClass("account-popover-link-danger"); container.find(".account-popover-link-warning").removeClass("account-popover-link-warning"); container.find(".account-popover-storage-upgrade .btn").removeClass("btn-danger btn-warning"); container.find(".progress-bar").removeClass("progress-bar-danger progress-bar-warning"); }; /** Sets the user's storage data in the account popover. Example ```javascript var storage = { membership_type: "Intro Member", percent_used: "35%", total_storage: "3GB" }; accountPopover.setAccountStorage(storage) ``` @public */ var setAccountStorage = function (storage) { if (!storage.membership_type || !storage.percent_used || !storage.total_storage) { return console.warn("argument storage must contain the following keys: 'membership_type', 'percent_used', 'total_storage'"); } var container = $(".account-popover-storage"); var percentAsInt = parseInt(storage.percent_used); _resetClasses(container); container.find(".account-popover-membership_type").html(storage.membership_type); container.find(".account-popover-percent_used, .progress-label").html(storage.percent_used); container.find(".account-popover-total_storage").html(storage.total_storage); container.find(".progress-bar").attr("style", "width: " + storage.percent_used + ";"); if (percentAsInt >= 100) { _addStateClasses(container, "danger"); container.find(".account-popover-storage-upgrade").show(); } else if (percentAsInt >= 90) { _addStateClasses(container, "warning"); } else { container.find(".account-popover-storage-upgrade").hide(); } }; return { setAccountStorage: setAccountStorage }; })(); // Trigger account popovers $(function () { $('[data-toggle="popover-desktop"]').popover({ html: true, content: function () { return $('.account-popover').html(); }, template: '', container: '.account-popover-container', placement: 'bottom' }) $('[data-toggle="popover-mobile"]').popover({ html: true, content: function () { return $('.account-popover').html(); }, template: '', container: '.account-popover-container-mobile', placement: 'bottom' }) }); // Compare height of viewport against height of header on popover expansion $(function () { $('.account-popover-trigger').on('shown.bs.popover', function () { var windowHeight = $(window).height(); $(function() { var navHeight = ($('#header-is_fixed').outerHeight()); if (navHeight >= windowHeight) { $('body').addClass('body-fixed'); $('#header-is_fixed').css('max-height', windowHeight); $('#header-is_fixed').addClass('is_scrolling'); }; }) }) // unfix body on popover close $('.account-popover-trigger').on('hidden.bs.popover', function () { $('body').removeClass('body-fixed'); $('#header-is_fixed').removeClass('is_scrolling'); }) // hide account popover on toggle nav close $('#header-is_fixed .navbar-collapse').on('hide.bs.collapse', function () { $('.popover.account-popover').popover('hide'); }) }); /** * Blur.js (jQuery module) * * @see {@link https://github.com/jakiestfu/Blur.js|GitHub} * @see {@link http://blurjs.com/} * @author Jacob Kelley * @license MIT */ (function (define) { define(['jquery'], function ($) { $.fn.blurjs = function (options) { var canvas = document.createElement('canvas'); var isCached = false; var selector = ($(this).selector).replace(/[^a-zA-Z0-9]/g, ""); if(!canvas.getContext) { return; } options = $.extend({ source: 'body', radius: 5, overlay: '', offset: { x: 0, y: 0 }, optClass: '', cache: false, cacheKeyPrefix: 'blurjs-', draggable: false, debug: false }, options); // Stackblur, courtesy of Mario Klingemann: http://www.quasimondo.com/StackBlurForCanvas/StackBlurDemo.html var mul_table = [512, 512, 456, 512, 328, 456, 335, 512, 405, 328, 271, 456, 388, 335, 292, 512, 454, 405, 364, 328, 298, 271, 496, 456, 420, 388, 360, 335, 312, 292, 273, 512, 482, 454, 428, 405, 383, 364, 345, 328, 312, 298, 284, 271, 259, 496, 475, 456, 437, 420, 404, 388, 374, 360, 347, 335, 323, 312, 302, 292, 282, 273, 265, 512, 497, 482, 468, 454, 441, 428, 417, 405, 394, 383, 373, 364, 354, 345, 337, 328, 320, 312, 305, 298, 291, 284, 278, 271, 265, 259, 507, 496, 485, 475, 465, 456, 446, 437, 428, 420, 412, 404, 396, 388, 381, 374, 367, 360, 354, 347, 341, 335, 329, 323, 318, 312, 307, 302, 297, 292, 287, 282, 278, 273, 269, 265, 261, 512, 505, 497, 489, 482, 475, 468, 461, 454, 447, 441, 435, 428, 422, 417, 411, 405, 399, 394, 389, 383, 378, 373, 368, 364, 359, 354, 350, 345, 341, 337, 332, 328, 324, 320, 316, 312, 309, 305, 301, 298, 294, 291, 287, 284, 281, 278, 274, 271, 268, 265, 262, 259, 257, 507, 501, 496, 491, 485, 480, 475, 470, 465, 460, 456, 451, 446, 442, 437, 433, 428, 424, 420, 416, 412, 408, 404, 400, 396, 392, 388, 385, 381, 377, 374, 370, 367, 363, 360, 357, 354, 350, 347, 344, 341, 338, 335, 332, 329, 326, 323, 320, 318, 315, 312, 310, 307, 304, 302, 299, 297, 294, 292, 289, 287, 285, 282, 280, 278, 275, 273, 271, 269, 267, 265, 263, 261, 259]; var shg_table = [9, 11, 12, 13, 13, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 17, 17, 17, 17, 17, 17, 17, 18, 18, 18, 18, 18, 18, 18, 18, 18, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24]; function stackBlurCanvasRGB(a, b, c, d, f, g) { if(isNaN(g) || g < 1) return; g |= 0; var h = a.getContext("2d"); var j; try { try { j = h.getImageData(b, c, d, f) } catch(e) { try { netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead"); j = h.getImageData(b, c, d, f) } catch(e) { alert("Cannot access local image"); throw new Error("unable to access local image data: " + e); } } } catch(e) { alert("Cannot access image"); throw new Error("unable to access image data: " + e); } var k = j.data; var x, y, i, p, yp, yi, yw, r_sum, g_sum, b_sum, r_out_sum, g_out_sum, b_out_sum, r_in_sum, g_in_sum, b_in_sum, pr, pg, pb, rbs; var l = g + g + 1; var m = d << 2; var n = d - 1; var o = f - 1; var q = g + 1; var r = q * (q + 1) / 2; var s = new BlurStack(); var t = s; for(i = 1; i < l; i++) { t = t.next = new BlurStack(); if(i == q) var u = t } t.next = s; var v = null; var w = null; yw = yi = 0; var z = mul_table[g]; var A = shg_table[g]; for(y = 0; y < f; y++) { r_in_sum = g_in_sum = b_in_sum = r_sum = g_sum = b_sum = 0; r_out_sum = q * (pr = k[yi]); g_out_sum = q * (pg = k[yi + 1]); b_out_sum = q * (pb = k[yi + 2]); r_sum += r * pr; g_sum += r * pg; b_sum += r * pb; t = s; for(i = 0; i < q; i++) { t.r = pr; t.g = pg; t.b = pb; t = t.next } for(i = 1; i < q; i++) { p = yi + ((n < i ? n : i) << 2); r_sum += (t.r = (pr = k[p])) * (rbs = q - i); g_sum += (t.g = (pg = k[p + 1])) * rbs; b_sum += (t.b = (pb = k[p + 2])) * rbs; r_in_sum += pr; g_in_sum += pg; b_in_sum += pb; t = t.next } v = s; w = u; for(x = 0; x < d; x++) { k[yi] = (r_sum * z) >> A; k[yi + 1] = (g_sum * z) >> A; k[yi + 2] = (b_sum * z) >> A; r_sum -= r_out_sum; g_sum -= g_out_sum; b_sum -= b_out_sum; r_out_sum -= v.r; g_out_sum -= v.g; b_out_sum -= v.b; p = (yw + ((p = x + g + 1) < n ? p : n)) << 2; r_in_sum += (v.r = k[p]); g_in_sum += (v.g = k[p + 1]); b_in_sum += (v.b = k[p + 2]); r_sum += r_in_sum; g_sum += g_in_sum; b_sum += b_in_sum; v = v.next; r_out_sum += (pr = w.r); g_out_sum += (pg = w.g); b_out_sum += (pb = w.b); r_in_sum -= pr; g_in_sum -= pg; b_in_sum -= pb; w = w.next; yi += 4 } yw += d } for(x = 0; x < d; x++) { g_in_sum = b_in_sum = r_in_sum = g_sum = b_sum = r_sum = 0; yi = x << 2; r_out_sum = q * (pr = k[yi]); g_out_sum = q * (pg = k[yi + 1]); b_out_sum = q * (pb = k[yi + 2]); r_sum += r * pr; g_sum += r * pg; b_sum += r * pb; t = s; for(i = 0; i < q; i++) { t.r = pr; t.g = pg; t.b = pb; t = t.next } yp = d; for(i = 1; i <= g; i++) { yi = (yp + x) << 2; r_sum += (t.r = (pr = k[yi])) * (rbs = q - i); g_sum += (t.g = (pg = k[yi + 1])) * rbs; b_sum += (t.b = (pb = k[yi + 2])) * rbs; r_in_sum += pr; g_in_sum += pg; b_in_sum += pb; t = t.next; if(i < o) { yp += d } } yi = x; v = s; w = u; for(y = 0; y < f; y++) { p = yi << 2; k[p] = (r_sum * z) >> A; k[p + 1] = (g_sum * z) >> A; k[p + 2] = (b_sum * z) >> A; r_sum -= r_out_sum; g_sum -= g_out_sum; b_sum -= b_out_sum; r_out_sum -= v.r; g_out_sum -= v.g; b_out_sum -= v.b; p = (x + (((p = y + q) < o ? p : o) * d)) << 2; r_sum += (r_in_sum += (v.r = k[p])); g_sum += (g_in_sum += (v.g = k[p + 1])); b_sum += (b_in_sum += (v.b = k[p + 2])); v = v.next; r_out_sum += (pr = w.r); g_out_sum += (pg = w.g); b_out_sum += (pb = w.b); r_in_sum -= pr; g_in_sum -= pg; b_in_sum -= pb; w = w.next; yi += d } } h.putImageData(j, b, c) } function BlurStack() { this.r = 0; this.g = 0; this.b = 0; this.a = 0; this.next = null } return this.each(function () { var $glue = $(this); var $source = $(options.source); var formattedSource = ($source.css('backgroundImage')).replace(/"/g, "").replace(/url\(|\)$/ig, ""); ctx = canvas.getContext('2d'); tempImg = new Image(); tempImg.onload = function () { if(!isCached) { canvas.style.display = "none"; canvas.width = tempImg.width; canvas.height = tempImg.height; ctx.drawImage(tempImg, 0, 0); stackBlurCanvasRGB(canvas, 0, 0, canvas.width, canvas.height, options.radius); ctx.beginPath(); ctx.rect(0, 0, tempImg.width, tempImg.width); if(options.overlay != false) { ctx.fillStyle = options.overlay; } // customer overlay via attribute if ($glue.attr("data-hero-overlay")) { options.overlay = $glue.attr("data-hero-overlay"); ctx.fillStyle = options.overlay; } ctx.fill(); var blurredData = canvas.toDataURL(); if(options.cache) { try { if(options.debug) { console.log('Cache Set'); } localStorage.setItem(options.cacheKeyPrefix + selector + '-' + formattedSource + '-data-image', blurredData); } catch(e) { console.log(e); } } } else { var blurredData = tempImg.src; } var attachment = $source.css('backgroundAttachment'); var position = (attachment == 'fixed') ? '' : '-' + (($glue.offset().left) - ($source.offset().left) - (options.offset.x)) + 'px -' + (($glue.offset().top) - ($source.offset().top) - (options.offset.y)) + 'px'; $glue.css({ 'background-image': 'url("' + blurredData + '")', 'background-repeat': $source.css('backgroundRepeat'), 'background-position': position, 'background-attachment': attachment }); if(options.optClass != false) { $glue.addClass(options.optClass); } if(options.draggable) { $glue.css({ 'background-attachment': 'fixed', 'background-position': '0 0' }); $glue.draggable(); } $glue.attr({ "data-hero-width" : canvas.width, "data-hero-height" : canvas.height, "data-hero-overlay": options.overlay }); $glue.trigger( "loaded", canvas); }; Storage.prototype.cacheChecksum = function (opts) { var newData = ''; for(var key in opts) { var obj = opts[key]; if(obj.toString() == '[object Object]') { newData += ((obj.x).toString() + (obj.y).toString() + ",").replace(/[^a-zA-Z0-9]/g, ""); } else { newData += (obj + ",").replace(/[^a-zA-Z0-9]/g, ""); } } var originalData = this.getItem(options.cacheKeyPrefix + selector + '-' + formattedSource + '-options-cache'); if(originalData != newData) { this.removeItem(options.cacheKeyPrefix + selector + '-' + formattedSource + '-options-cache'); this.setItem(options.cacheKeyPrefix + selector + '-' + formattedSource + '-options-cache', newData); if(options.debug) { console.log('Settings Changed, Cache Emptied'); } } }; var cachedData = null; if(options.cache) { localStorage.cacheChecksum(options); cachedData = localStorage.getItem(options.cacheKeyPrefix + selector + '-' + formattedSource + '-data-image'); } if(cachedData != null) { if(options.debug) { console.log('Cache Used'); } isCached = true; tempImg.src = (cachedData); canvas.width = tempImg.width; canvas.height = tempImg.height; } else { if(options.debug) { console.log('Source Used'); } tempImg.src = formattedSource; } }); }; return $; // return jQuery }); })( typeof define === 'function' && define.amd ? define : function (r, factory) { factory(jQuery); } ); (function UpdateHeroModule (elem) { // percentage of 'x' position of center of focus for bg scaling var xFocus = 0.8; var yFocus = 0.5; this.blurGenerated = false; this.windowWidth = $(window).width(); this.updateHeroPosition = function updateHeroPosition() { var $source = $('.hero-blur'); var $blur = $(".hero-block-blur"); var imgWidth = $blur.attr('data-hero-width'); var imgHeight = $blur.attr('data-hero-height'); var imgScale = imgHeight / imgWidth; var heroScale = $source.outerHeight() / $source.outerWidth(); // how many scaled pixels are on/off the viewport var imgOnScreenX = (imgScale / heroScale) * imgWidth; var imgOffScreenX = imgWidth - imgOnScreenX; var imgOnScreenY = (imgScale / heroScale) * imgHeight; var imgOffScreenY = imgHeight - imgOnScreenY; var viewFactorX = imgOffScreenX / imgOnScreenX; var viewFactorY = Math.abs(imgOffScreenY / imgOnScreenY); // how many actual pixels are on/off the viewport var heroOnScreenX = $source.outerWidth(); var heroOffScreenX = heroOnScreenX * viewFactorX; var heroOnScreenY = $source.outerHeight(); var heroOffScreenY = heroOnScreenY * viewFactorY; var offsetBlurY = $source.offset().top - $blur.offset().top; var offsetBlurX = $source.offset().left - $blur.offset().left; if (heroScale >= imgScale) { //console.log("image is wider than screen", heroOnScreenX, imgOffScreenX, heroOnScreenX, heroOffScreenX, viewFactorX, heroOnScreenY); offsetBlurX -= heroOffScreenX * xFocus; $blur.css('background-size', (heroOnScreenX + heroOffScreenX) + 'px ' + heroOnScreenY + "px"); } else { //console.log("image is taller than screen", imgOnScreenY, imgOffScreenY, heroOnScreenY, heroOffScreenY, viewFactorY); $blur.css('background-size', heroOnScreenX + 'px auto'); } $source.css('background-position', (xFocus * 100) + '% ' + '0%'); $blur.css('background-position', (offsetBlurX) + 'px ' + (offsetBlurY) + 'px'); }; this.generateHeroBlur = function(done) { $('.hero-block-blur').blurjs({ source: '.hero-blur', radius: 30, overlay: 'rgba(255,255,255,0.8)' }).on('loaded', function(e, canvas) { done(e, canvas); }); }; this.initialize = function() { $(".hero-blur").addClass('hero-blur-visible'); this.generateHeroBlur(function(e, canvas) { this.blurGenerated = true; // initializes position upon load $(e.target).addClass('hero-block-blur-visible'); this.updateHeroPosition(); }); this.updateHeroPosition(); }; elem.UpdateHeroModule = this; })(window); // initialize $(function() { // prevents a race condition where var heroOnScreenY = $source.outerHeight(); above returns an incorrect height setTimeout(function() { window.UpdateHeroModule.initialize(); }, 100); // mobile images will use optimized image fallback if ($(window).width() <= 768) { $(".hero-blur").addClass('hero-blur-visible'); $(".hero-block-side .hero-block-blur").addClass('hero-block-blur-visible'); } }); $(window).resize(function() { var updateHeroModule = window.UpdateHeroModule; // Check window width has actually changed and it's not just iOS triggering a resize event on scroll if ($(window).width() != updateHeroModule.windowWidth) { updateHeroModule.updateHeroPosition(); // Update the window width for next time updateHeroModule.windowWidth = $(window).width(); } // if mobile optimized image was loaded, now generate a proper blur image (mostly for local testing) if (!updateHeroModule.blurGenerated && $(window).width() >= 768) { updateHeroModule.blurGenerated = true; $(".hero-block-blur").removeClass('hero-block-blur-visible'); updateHeroModule.generateHeroBlur(function(e, canvas) { $(e.target).addClass('hero-block-blur-visible'); updateHeroModule.updateHeroPosition(); }); } }); $(function () { $(".list-group-toggle-trigger").click(function (e) { e.preventDefault(); $(this).next('.list-group-item-child').toggleClass("is_open"); $("i", this).toggleClass("fa-plus fa-minus"); }) }); $(function () { var activeListItems = $('.list-group-link-is_active'); if ($(activeListItems).length) { $(activeListItems).append(''); $(activeListItems).parents('.list-group-item-child').addClass('is_open'); $(activeListItems).parents('.list-group-item').addClass('is_active'); $(activeListItems).parents('.list-group-item').find('.list-group-toggle-trigger .fa').toggleClass("fa-plus fa-minus"); } }); $(function () { $('#header-is_fixed .dropdown').on('shown.bs.dropdown', function () { var windowHeight = $(window).height(); // this timeout allows for the dropdown item to fully expand before height is calculated setTimeout(function() { var navHeight = ($('#header-is_fixed').outerHeight()); if (navHeight >= windowHeight) { $('body').addClass('body-fixed'); $('#header-is_fixed').css('max-height', windowHeight); $('#header-is_fixed').addClass('is_scrolling'); }; }, 250); $('.popover.account-popover').popover('hide'); }) // unfix body on dropdown close $('#header-is_fixed .dropdown').on('hidden.bs.dropdown', function () { $('body').removeClass('body-fixed'); $('#header-is_fixed').removeClass('is_scrolling'); }) // unfix body on toggle nav close $('#header-is_fixed .navbar-collapse').on('hidden.bs.collapse', function () { $('body').removeClass('body-fixed'); $('#header-is_fixed').removeClass('is_scrolling'); }) }); $(function () { $('.dropdown-toggle').dropdown(); $(document).on('click', '.navbar-dropdown .dropdown-menu', function(e) { e.stopPropagation() }); }); $(function () { $('[data-toggle="popover"]').popover(); }); $.fn.popover.Constructor.prototype.getCalculatedOffset = function (placement, pos, actualWidth, actualHeight) { return placement == 'bottom' ? { top: pos.top + pos.height, left: pos.left + pos.width / 2 - actualWidth / 2 } : placement == 'top' ? { top: pos.top - actualHeight, left: pos.left + pos.width / 2 - actualWidth / 2 } : placement == 'left' ? { top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left - actualWidth } : placement == 'bottomleft' ? { top: pos.top + pos.height, left: (pos.left - actualWidth+ pos.width) } : placement == 'bottomright' ? { top: pos.top + pos.height, left: pos.left } : /* placement == 'right' */ { top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left + pos.width } }; $.fn.popover.Constructor.prototype.replaceArrow = function (delta, dimension, isHorizontal) { var $arrow = this.arrow(); var arrowWidth = $arrow[0].offsetWidth; var arrowHeight = $arrow[0].offsetHeight; var $tip = this.tip(); var tipWidth = $tip[0].offsetWidth; var tipHeight = $tip[0].offsetHeight; var $button = this.$element; var buttonWidth = $button[0].offsetWidth; var buttonHeight = $button[0].offsetHeight; switch(this.options.placement) { case "bottomleft": var centerOfButton = tipWidth - buttonWidth / 2; this.arrow().css('left', centerOfButton + "px"); break; case "bottomright": var centerOfButton = buttonWidth / 2; this.arrow().css('left', centerOfButton + "px"); break; default: this.arrow() .css(isHorizontal ? 'left' : 'top', 50 * (1 - delta / dimension) + '%') .css(isHorizontal ? 'top' : 'left', '') } }; // This is a manifest file that'll be compiled into application.js, which will include all the files // listed below. // // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts, // or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path. // // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the // compiled file. // // Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details // about supported directives. // ; ;TI"required_assets_digest;TI"%5778818da1eb6b774097ae4d0be80a23;FI" _version;TI"%2be930bcbfd3c3e00190e2193dda5c7c;F