1/** 2 * Component Archive 3 * @module Archive 4 * @param {jQuery} $ Instance of jQuery 5 * @return {Object} List of archive methods 6 */ 7XA.component.archive = (function($) { 8 /** 9 * This object stores all public api methods 10 * @type {Object.<Methods>} 11 * @memberOf module:Archive 12 * */ 13 var api = {}; 14 /** 15 * toggleClick method toggle childs visibility 16 * for archive items 17 * @memberOf module:Archive 18 * @param {eventObject} args 19 * @private 20 */ 21 var toggleClick = function(args) { 22 var groupHeader = $(args.target); 23 groupHeader.siblings("ul").toggle(); 24 groupHeader.toggleClass("opened"); 25 }; 26 /** 27 * initInstance method bindc toggling for 28 * an archive element 29 * @memberOf module:Archive 30 * @method 31 * @param {jQuery} component Root DOM element of archive component wrapped by jQuery 32 * @alias module:Archive.initInstance 33 */ 34 api.initInstance = function(component) { 35 var toggles = component.find(".group-header"); 36 toggles.on("click", toggleClick); 37 }; 38 39 /** 40 * init method calls in a loop for each 41 * archive component on a page and runs Archive's 42 * ["initInstance"]{@link module:Archive.api.initInstance} method. 43 * @memberOf module:Archive 44 * @alias module:Archive.init 45 */ 46 api.init = function() { 47 var archives = $(".sxa-archive:not(.initialized)"), 48 archive; 49 50 for (var i = 0, l = archives.length; i < l; i++) { 51 archive = $(archives[i]); 52 api.initInstance(archive); 53 archive.addClass("initialized"); 54 } 55 }; 56 57 return api; 58})(jQuery, _); 59 60XA.register("archive", XA.component.archive);
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.