1/** 2 * @file 3 * Javascript for views-accordion. 4 */ 5Drupal.behaviors.views_accordion = { 6 attach: function(context) { 7 if(Drupal.settings.views_accordion){ 8 (function ($) { 9 $.each(Drupal.settings.views_accordion, function(id) { 10 /* Our view settings */ 11 var usegroupheader = this.usegroupheader; 12 var viewname = this.viewname; 13 var display = this.display; 14 15 /* Our panel heightStyle setting */ 16 var heightStyle = (this.autoheight == 1) ? 'auto' : (this.fillspace == 1 ? 'fill' : 'content'); 17 18 /* the selectors we have to play with */ 19 var displaySelector = '.view-id-' + viewname + '.view-display-id-' + display + ' > .view-content'; 20 var headerSelector = this.header; 21 22 /* The row count to be used if Row to display opened on start is set to random */ 23 var row_count = 0; 24 25 /* Prepare our markup for jquery ui accordion */ 26 $(displaySelector + ' ' + headerSelector + ':not(.ui-accordion-header)').each(function(i){ 27 // Hash to use for accordion navigation option. 28 var hash = "#" + viewname + "-" + display + "-" + i; 29 var $this = $(this); 30 var $link = $this.find('a'); 31 // if the header is not already using an anchor tag, add one 32 if($link.length == 0){ 33 // setup anchor tag for navigation 34 $this.wrapInner('<a href="' + hash + '"></a>'); 35 } 36 // if there are already, they wont be clickable with js enabled, we'll use them for accordion navigation 37 else{ 38 // @FIXME ? 39 // We are currently destroying the original link, though search crawlers will stil see it. 40 // Links in accordions are NOT clickable and leaving them would kill deep linking. 41 $link.get(0).href = hash; 42 } 43 44 // Wrap the accordion content within a div if necessary 45 if (!usegroupheader) { 46 $this.siblings().wrapAll('<div></div>'); 47 } 48 row_count++; 49 }); 50 51 if (this.rowstartopen == 'random') { 52 this.rowstartopen = Math.floor(Math.random() * row_count); 53 } 54 55 var options = {}; 56 57 if (this.newoptions) { 58 // Slide was removed from jQuery UI easings, provide sensible fallbacks. 59 if (this.animated === 'slide' || this.animated === 'bounceslide') { 60 this.animated = 'swing'; 61 } 62 63 /* jQuery UI accordion options format changed for jquery >= 1.9 */ 64 options = { 65 header: headerSelector, 66 active: this.rowstartopen, 67 collapsible: this.collapsible, 68 event: this.event, 69 heightStyle: this.autoheight ? 'auto' : this.fillspace ? 'fill' : 'content', 70 }; 71 if (this.animated === false) { 72 options.animate = false; 73 } 74 else { 75 options.animate = { 76 easing: this.animated, 77 duration: this.duration, 78 } 79 } 80 } 81 else { 82 options = { 83 header: headerSelector, 84 animated: this.animated, 85 active: this.rowstartopen, 86 collapsible: this.collapsible, 87 autoHeight: this.autoheight, 88 heightStyle: heightStyle, 89 event: this.event, 90 fillSpace: this.fillspace, 91 navigation: this.navigation, 92 clearstyle: this.clearstyle 93 }; 94 } 95 /* jQuery UI accordion call */ 96 $(displaySelector + ':not(.ui-accordion)').accordion(options); 97 }); 98 })(jQuery); 99 } 100 } 101};
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.