1(function ($, Drupal) { 2 Drupal.behaviors.RedesLayoutComponentContainer = { 3 attach: function (context, settings) { 4 $(once('RedesLayoutComponentContainer', '.region-content', context)) 5 .each(function () { 6 $(".lc-section").each(function () { 7 if ($(this).hasClass("container")) { 8 $(this).removeClass("container"); 9 $(this).addClass("container-xl"); 10 } 11 }); 12 }); 13 }, 14 }; 15 16 Drupal.behaviors.customTabSwitcher = { 17 attach: function (context, settings) { 18 $('#myTab button', context).on('click', function (e) { 19 e.preventDefault(); 20 21 // Cambia la pestaña activa y configura la clase activa 22 $(this).tab('show'); 23 $('#myTab button').removeClass('active'); 24 $(this).addClass('active'); 25 26 // Configura el contenido visible de la pestaña 27 $('.tab-pane').removeClass('active'); 28 const targetContent = $($(this).data('bs-target')).addClass('active'); 29 30 // Obtiene el bloque de las anclas dentro de la pestaña activa 31 const anchorBlock = targetContent.find('.inpage-nav'); 32 if (anchorBlock.length > 0) { 33 // Limpia las anclas antiguas 34 const navList = anchorBlock.find('ol'); 35 navList.empty(); 36 37 // Busca los encabezados <h2> y <h3> con ID dentro del contenido activo 38 targetContent.find('h2[id], h3[id]').each(function () { 39 const anchorId = $(this).attr('id'); 40 const anchorText = $(this).text(); 41 42 // Asigna la clase "menu" para <h2> y "menu-child" para <h3> 43 const className = $(this).is('h3') ? 'menu-child' : 'menu'; 44 45 // Agrega una nueva ancla al bloque 46 navList.append(`<li class="${className}"><a href="#${anchorId}">${anchorText}</a></li>`); 47 }); 48 } 49 // Actualiza la URL de la página con la pestaña activa 50 const activeTabId = targetContent.find('h2[id], h3[id]').first().attr('id'); 51 if (activeTabId) { 52 window.history.replaceState(null, null, `#${activeTabId}`); 53 } 54 55 // Agrega comportamiento sticky al bloque de anclas 56 makeSticky(anchorBlock); 57 }); 58 59 // Función para hacer sticky el bloque de anclas 60 function makeSticky(anchorBlock) { 61 if (anchorBlock.length > 0) { 62 anchorBlock.addClass('sticky'); 63 } 64 } 65 } 66 }; 67 68 Drupal.behaviors.RedesCronologia = { 69 attach: function (context, settings) { 70 $(once('RedesCronologia', '.block-inline-blocktimeline', context)) 71 .each(function () { 72 function timelineHideShow() { 73 if ($(window).width() < 520) { 74 $(".timeline-contenido .field--name-field-pg-body").css( 75 "display", 76 "none" 77 ); 78 $(".field--name-field-pg-titulo").addClass("show-responsive"); 79 } else { 80 $(".timeline-contenido .field--name-field-pg-body").css( 81 "display", 82 "block" 83 ); 84 $(".field--name-field-pg-titulo").removeClass("show-responsive"); 85 } 86 87 $(".timeline-contenido .field--name-field-pg-titulo").each( 88 function () { 89 $(once('RedesCronologia', this, context)) 90 .click(function () { 91 if ($(window).width() < 520) { 92 $(this) 93 .closest(".timeline-contenido") 94 .find(".field--name-field-pg-body") 95 .slideToggle(); 96 $(this).toggleClass("showed"); 97 } else { 98 $(this) 99 .closest(".timeline-contenido") 100 .find(".field--name-field-pg-body") 101 .css("display", "block"); 102 } 103 }); 104 } 105 ); 106 } 107 108 $(window).on("load", function () { 109 timelineHideShow(); 110 }); 111 $(window).on("resize", function () { 112 timelineHideShow(); 113 }); 114 }); 115 }, 116 }; 117 118 Drupal.behaviors.RedesDropdownFix = { 119 attach: function (context, settings) { 120 121 $(once('RedesDropdownFix', '.region-nav-additional .menu--main', context)) 122 .each(function () { 123 if ( 124 $(this) 125 .find(".dropdown-toggle") 126 .click(function () { 127 $(this) 128 .closest(".dropdown") 129 .find(".dropdown-menu") 130 .toggle("show"); 131 }) 132 ); 133 }); 134 }, 135 }; 136 137 Drupal.behaviors.RedesAvatar = { 138 attach: function (context, settings) { 139 $(once('RedesAvatar', '.node--type-event.node--view-mode-full .block-field-blocknodeeventfield-
139pg-extspeaker', context)) 140 .each(function () { 141 if ( 142 $(this) 143 .find(".paragraph--type--ext-speaker .field--name-thumbnail img") 144 .each(function () { 145 var avatar_url = $(this).attr("alt"); 146 if (avatar_url.includes("avatar")) { 147 $(this) 148 .closest(".curriculum__teaser--photo") 149 .addClass("has-avatar"); 150 } 151 }) 152 ); 153 }); 154 }, 155 }; 156 157 Drupal.behaviors.SearchSidebarClose = { 158 attach: function (context, settings) { 159 $(once('SearchSidebarClose', '.custom-sidebar-search .custom-close-responsive', context)) 160 .each(function () { 161 var button = $(this); 162 var sidebar = $(this).closest(".custom-sidebar-search"); 163 button.click(function () { 164 sidebar.toggleClass("show"); 165 }); 166 }); 167 }, 168 }; 169 170 Drupal.behaviors.SearchSidebarShow = { 171 attach: function (context, settings) { 172 $(once('SearchSidebarShow', '.custom-filter-responsive', context)).each(function () { 173 var button = $(this); 174 var sidebar = $(this) 175 .closest(".lc-container-cols") 176 .find(".custom-sidebar-search"); 177 button.click(function () { 178 sidebar.toggleClass("show"); 179 }); 180 }); 181 }, 182 }; 183 184 Drupal.behaviors.ViewExposedFormSidebarClose = { 185 attach: function (context, settings) { 186 $(once('ViewExposedFormSidebarClose', '.resp-close-container .custom-close-responsive', context)).each(function () { 187 var button = $(this); 188 var sidebar = $(this).closest(".resp-close-container"); 189 button.click(function () { 190 sidebar.toggleClass("show"); 191 }); 192 }); 193 }, 194 }; 195 196 Drupal.behaviors.ViewExposedFormSidebarShow = { 197 attach: function (context, settings) { 198 $(once('ViewExposedFormSidebarShow', '.custom-filter-responsive', context)).each(function () { 199 var button = $(this); 200 var sidebar = $(this) 201 .closest(".lc-container-cols") 202 .find(".resp-close-container"); 203 var column = $(this).closest(".lc-inline_column_first-edit"); 204 button.click(function () { 205 sidebar.toggleClass("show"); 206 column.css("z-index", "2"); 207 }); 208 }); 209 }, 210 }; 211 212 Drupal.behaviors.mapblank = { 213 attach: function (context, settings) { 214 $(".map-cards-grid .item-list").find("a").attr("target", "_blank"); 215 $(".map-cards-grid .item-list .node__content") 216 .find("h1") 217 .addClass("custom-external-link"); 218 }, 219 }; 220 221 Drupal.behaviors.MapUlNumberOfElements = { 222 attach: function (context, settings) { 223 224 $(once('MapUlNumberOfElements', '.map-cards-grid', context)) 225 .each(function () { 226 $(".map-cards-grid ul").each(function () { 227 var elements = $(this).find("li").length; 228 $(this).addClass("custom-elements-" + elements); 229 }); 230 }); 231 }, 232 }; 233 234 Drupal.behaviors.zIndexForVideoInHomeGrid = { 235 attach: function (context, settings) { 236 $(once('zIndexForVideoInHomeGrid', '.block-views-blockmosaico-home-mosaico-home', context)).each(function () { 237 $('.node--view-mode-home-grande-drcha .media--type-video').each(function () { 238 $(this).closest('.lc-inline_column_first-edit').css('z-index', '10'); 239 }); 240 $('.node--view-mode-home-grande-drcha .media--type-remote-video').each(function () { 241 $(this).closest('.lc-inline_column_first-edit').css('z-index', '10'); 242 }); 243 }); 244 }, 245 }; 246 247 /* Modificación del atributo aria-label para indicarle el enlace al que iremos (Accesibilidad) */ 248 $(document).ready(function () { 249 let links = []; 250 251 $("a[data-extlink]").each(function () { 252 links.push(this.href); 253 }); 254 255 var i; 256 for (i = 0; i < links.length; i++) { 257 $("a[href='" + links[i] + "'] .custom-external-link").each(function () { 258 $(this).attr("aria-label", links[i]); 259 }); 260 } 261 262 /* Cambio del atributo hreflang de "va" a "ca" (Accesibilidad) */ 263 $("a[hreflang='va']").attr("hreflang", "ca"); 264 265 /* Adición "title" a las etiquetas label con su texto */ 266 $("label").each(function () { 267 $(this).attr("title", $(this).text()); 268 }); 269 270 /* Correciones en tabulación de buscadores de actualidad e iniciativas (Accesibilidad) */ 271 var currentURL = window.location.href.indexOf("actualidad/noticias") > -1; 272 if (currentURL) { 273 $("#collapseFour div input").attr("tabindex", "-1"); 274 $("#edit-submit-solr-noticias").attr("tabindex", "-1"); 275 $("#edit-reset").attr("tabindex", "-1"); 276 277 $("#headingFour button").click(function () { 278 if (($("#collapseFour").hasClass("show"))) { 279 $("#collapseFour div input").attr("tabindex", "-1"); 280 $("#edit-submit-solr-noticias").attr("tabindex", "-1"); 281 $("#edit-reset").attr("tabindex", "-1"); 282 } 283 else{ 284 $("#collapseFour div input").attr("tabindex", "0"); 285 $("#edit-submit-solr-noticias").attr("tabindex", "0"); 286 $("#edit-reset").attr("tabindex", "0"); 287 } 288 }); 289 } 290 291 var currentURL = window.location.href.indexOf("iniciativas/listado") > -1; 292 if (currentURL) { 293 $("#collapseFour div input").attr("tabindex", "-1"); 294 $("#edit-submit-solr-iniciativas").attr("tabindex", "-1"); 295 $("#edit-reset").attr("tabindex", "-1"); 296 297 $("#headingFour button").click(function () { 298 if (($("#collapseFour").hasClass("show"))) { 299 $("#collapseFour div input").attr("tabindex", "-1"); 300 $("#edit-submit-solr-iniciativas").attr("tabindex", "-1"); 301 $("#edit-reset").attr("tabindex", "-1"); 302 } 303 else{ 304 $("#collapseFour div input").attr("tabindex", "0"); 305 $("#edit-submit-solr-iniciativas").attr("tabindex", "0"); 306 $("#edit-reset").attr("tabindex", "0"); 307 } 308 }); 309 } 310 311 var currentURL = window.location.href.indexOf("iniciativas/pymes") > -1; 312 if (currentURL) { 313 $("#collapseThree div input").attr("tabindex", "-1"); 314 $("#edit-submit-solr-iniciativas").attr("tabindex", "-1"); 315 $("#edit-reset").attr("tabindex", "-1"); 316 317 $("#headingThree button").click(function () { 318 if (($("#collapseThree").hasClass("show"))) { 319 $("#collapseThree div input").attr("tabindex", "-1"); 320 $("#edit-submit-solr-iniciativas").attr("tabindex", "-1"); 321 $("#edit-reset").attr("tabindex", "-1"); 322 } 323 else{ 324 $("#collapseThree div input").attr("tabindex", "0"); 325 $("#edit-submit-solr-iniciativas").attr("tabindex", "0"); 326 $("#edit-reset").attr("tabindex", "0"); 327 } 328 }); 329 } 330 var currentURL = window.location.href.indexOf("iniciativas/administraciones") > -1; 331 if (currentURL) { 332 $("#collapseThree div input").attr("tabindex", "-1"); 333 $("#edit-submit-solr-iniciativas--2").attr("tabindex", "-1"); 334 $("#edit-reset--2").attr("tabindex", "-1"); 335 336 $("#headingThree button").click(function () { 337 if (($("#collapseThree").hasClass("show"))) { 338 $("#collapseThree div input").attr("tabindex", "-1"); 339 $("#edit-submit-solr-iniciativas--2").attr("tabindex", "-1"); 340 $("#edit-reset--2").attr("tabindex", "-1"); 341 } 342 else{ 343 $("#collapseThree div input").attr("tabindex", "0"); 344 $("#edit-submit-solr-iniciativas--2").attr("tabindex", "0"); 345 $("#edit-reset--2").attr("tabindex", "0"); 346 } 347 }); 348 } 349 350 var currentURL = window.location.href.indexOf("iniciativas/ciudadania") > -1; 351 if (currentURL) { 352 $("#collapseThree div input").attr("tabindex", "-1"); 353 $("#edit-submit-solr-iniciativas--2").attr("tabindex", "-1"); 354 $("#edit-reset--2").attr("tabindex", "-1"); 355 356 $("#headingThree button").click(function () { 357 if (($("#collapseThree").hasClass("show"))) { 358 $("#collapseThree div input").attr("tabindex", "-1"); 359 $("#edit-submit-solr-iniciativas--2").attr("tabindex", "-1"); 360 $("#edit-reset--2").attr("tabindex", "-1"); 361 } 362 else{ 363 $("#collapseThree div input").attr("tabindex", "0"); 364 $("#edit-submit-solr-iniciativas--2").attr("tabindex", "0"); 365 $("#edit-reset--2").attr("tabindex", "0"); 366 } 367 }); 368 } 369 370 $('#block-redes-main-navigation-menu').addClass('d-inline-block d-md-none') 371 }); 372})(jQuery, Drupal); 373
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.