{I" class:ETI"BundledAsset; FI"logical_path; TI"'forever_style_guide/application.js; TI" pathname; TI"i/Users/zschweitzer/git/forever-style-guide/app/assets/javascripts/forever_style_guide/application.js; FI"content_type; TI"application/javascript; TI" mtime; Tl+‹‡WI"length; Ti*|I"digest; TI"%473f59d102a0ccc797c7c66c969db326; FI"source; TI"*|// 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' }) }); /** * Blur.js (jQuery module) * * @see {@link https://github.com/jakiestfu/Blur.js|GitHub} * @see {@link http://blurjs.com/} * @author Jacob Kelley