{I" class:ETI"ProcessedAsset;FI"logical_path;TI"fae/accordion.js;FI" pathname;TI"X/Library/WebServer/Documents/work/fine/_fae/app/assets/javascripts/fae/accordion.js;FI"content_type;TI"application/javascript;TI" mtime;Tl+»şTI" length;Tik I" digest;TI"%32ab03388e51657f7563c798d9ef2e34;FI" source;TI"k var Accordion = { initialized: false, // used as a indicator that the Accordion was initially ran status: true, // used as an "off" and "on" flag for the general Accordion containter_selector: ".main_nav-accordion, .sub_nav-accordion", trigger_selector: ".main_nav-link, .main_nav-sub-link", sibling_selector: ".main_nav-sub-nav, .main_nav-third-nav", current: null, navs: [ // name: autogenerated, // container: parent of clickable element and subnav, // trigger: clickable element, // sibling: value, // opened: autogenerated boolean ], init: function() { var self = this; // create an object of knowledge for each nav item $.each($(this.containter_selector), function(index, container){ var $this = $(this); self.navs.push({ name: "nav" + index, container: $this, trigger: $this.find(self.trigger_selector).first(), subnav: $this.find(self.sibling_selector).first(), opened: false, class_name: $this[0].classList[0] }); }); // assign events this.clicker(); // this.resizer(); }, resizer: function () { var self = this; if (this.initialized === false) { $(window).on("resize", function(){ if ($(window).width() < Admin.breakpoints.desktop) { self.destroy(); } else if ($(window).width() >= Admin.breakpoints.desktop) { self.init(); } }); this.initialized = true; } }, clicker: function() { var self = this; $.each(this.navs, function(index, nav){ $(nav.trigger).click(function(e){ // store nav.opened locally as closeLevel() overrides it var was_opened = nav.opened; // prevent default e.preventDefault(); // close all first self.closeLevel(nav.class_name); if (!was_opened) { // open the clicked item if it was not just opened self.open(nav); } }); }); }, destroy: function() { this.closeAll(); // unbind it all $.each(this.navs, function(index, nav){ $(nav.trigger).off(); }); // remove the thoughts of the nav this.navs = []; // remove any style attribute $(this.sibling_selector).removeAttr("style"); }, close: function(nav) { $(nav.container).removeClass("accordion-open"); $(nav.subnav).stop().slideUp(); nav.opened = false; }, closeAll: function() { var self = this; $.each(this.navs, function(index, nav){ self.close(nav); }); }, closeLevel: function(level_class) { var self = this; $.each(this.navs, function(index, nav){ if (nav.class_name === level_class) { self.close(nav); } }); }, open: function(nav) { $(nav.container).addClass("accordion-open"); $(nav.subnav).stop().slideDown(); nav.opened = true; } }; ;TI"dependency_digest;TI"%7e09be9dbdf2d81ef5827b6568595e57;FI"required_paths;T[I"X/Library/WebServer/Documents/work/fine/_fae/app/assets/javascripts/fae/accordion.js;FI"dependency_paths;T[{I" path;TI"X/Library/WebServer/Documents/work/fine/_fae/app/assets/javascripts/fae/accordion.js;FI" mtime;TI"2015-03-09T15:12:11-07:00;TI" digest;TI"%307b93f52785baf3875fee14e3f78161;FI" _version;TI"%4bf7b15359fe8e0974f7f263e26e27f4;F