PageSourceSearch

https://internacionales.uba.ar/wp-content/plugins/jquery-collapse-o-matic/js/collapse.js?ver=1.7.2

js uba.ar collected 2026-09-24 08:24:32 UTC 19,961 bytes, 666 lines download raw bytes

1/*!
2 * Collapse-O-Matic JavaSctipt v1.7.0
3 * https://pluginoven.com/plugins/collapse-o-matic/
4 *
5 * Copyright 2021, Twinpictures
6 */
7
8function collapse_init() {
9	//force collapse
10	jQuery('.force_content_collapse').each(function(index) {
11		jQuery(this).css('display', 'none');
12	});
13
14	//inital collapse
15	jQuery('.collapseomatic:not(.colomat-close)').each(function(index) {
16		var thisid = jQuery(this).attr('id');
17		jQuery('#target-'+thisid).css('display', 'none');
18	});
19
20	//inital swaptitle for pre-expanded elements
21	jQuery('.collapseomatic.colomat-close').each(function(index) {
22		var thisid = jQuery(this).attr('id');
23		if(jQuery("#swap-"+thisid).length > 0){
24			swapTitle(this, "#swap-"+thisid );
25		}
26		if(jQuery("#swapexcerpt-"+thisid).length > 0){
27			swapTitle("#excerpt-"+thisid, "#swapexcerpt-"+thisid);
28		}
29		jQuery('[id^=extra][id$='+thisid+']').each( function( index ){
30			if(jQuery(this).data('swaptitle')){
31				old_swap_title = jQuery(this).data('swaptitle');
32				old_title = jQuery(this).html();
33				jQuery(this).html(old_swap_title);
34				jQuery(this).data('swaptitle', old_title);
35			}
36		});
37	});
38}
39
40function swapTitle(origObj, swapObj){
41	if(jQuery(origObj).prop("tagName") == 'IMG'){
42		var origsrc = jQuery(origObj).prop('src');
43		var swapsrc = jQuery(swapObj).prop('src');
44
45		jQuery(origObj).prop('src',swapsrc);
46		jQuery(swapObj).prop('src',origsrc);
47	}
48	else{
49		var orightml = jQuery(origObj).html();
50		var swaphtml = jQuery(swapObj).html();
51
52		jQuery(origObj).html(swaphtml);
53		jQuery(swapObj).html(orightml);
54
55		//is cufon involved? if so, do that thing
56		if(swaphtml.indexOf("<cufon") != -1){
57			var trigelem = jQuery(this).get(0).tagName;
58			Cufon.replace(trigelem);
59		}
60	}
61}
62
63function toggleState (obj, id, maptastic, trig_id) {
64
65	if (maptastic && jQuery('[id^=target][id$='+id+']').hasClass('maptastic') ) {
66		jQuery('[id^=target][id$='+id+']').removeClass('maptastic');
67	}
68
69	//reset effect and duration to default
70	com_effect = com_options.colomatslideEffect;
71	com_duration = com_options.colomatduration;
72
73	//effect override
74	if( obj.attr('data-animation_effect') ){
75		com_effect = obj.attr('data-animation_effect');
76	}
77
78	//duration override
79	if( obj.attr('data-duration') ){
80		com_duration = obj.attr('data-duration');
81	}
82
83	//if durration is a number, make it a number
84	if( isFinite(com_duration) ){
85		com_duration = parseFloat(com_duration);
86	}
87
88	//slideToggle
89	if(com_effect == 'slideToggle'){
90		//jQuery('[id^=target][id$='+id+']').slideToggle(com_duration, function() {
91		jQuery('#target-'+id).slideToggle(com_duration, function() {
92			// Animation complete.
93			if( jQuery(this).hasClass('colomat-inline') && jQuery(this).is(':visible') ){
94				jQuery(this).css('display', 'inline');
95			}
96
97			//deal with any findme links
98			if(trig_id && jQuery('#'+trig_id).is('.find-me.colomat-close')){
99				//offset_top = jQuery('#find-'+trig_id).attr('name');
100				findme = jQuery('#'+trig_id).attr('data-findme');
101				target_offset = jQuery('#'+trig_id).offset();
102
103				if( findme == 'auto' || findme == 'target'){
104					target_offset = jQuery('#target-'+trig_id).offset();
105				}
106				if( findme == 'trigger'){
107					target_offset = jQuery('#'+trig_id).offset();
108				}
109				jQuery('html, body').animate({scrollTop:target_offset.top}, 500);
110			}
111		});
112	}
113	//slideFade
114	else if(com_effect == 'slideFade'){
115		jQuery('#target-'+id).animate({
116			height: "toggle",
117			opacity: "toggle"
118		}, com_duration, function (){
119			//Animation complete
120			if( jQuery(this).hasClass('colomat-inline') && jQuery(this).is(':visible') ){
121				jQuery(this).css('display', 'inline');
122			}
123
124			//deal with any findme links
125			if(trig_id && jQuery('#'+trig_id).is('.find-me.colomat-close')){
126				findme = jQuery('#'+trig_id).attr('data-findme');
127				target_offset = jQuery('#'+trig_id).offset();
128
129				if( findme == 'auto' || findme == 'target'){
130					target_offset = jQuery('#target-'+trig_id).offset();
131				}
132				if( findme == 'trigger'){
133					target_offset = jQuery('#'+trig_id).offset();
134				}
135				jQuery('html, body').animate({scrollTop:target_offset.top}, 500);
136			}
137		});
138	}
139
140	//deal with google maps builder resize
141	if(jQuery('#'+id).hasClass('colomat-close')){
142		jQuery('.google-maps-builder').each(function(index) {
143			map = jQuery(".google-maps-builder")[index];
144			google.maps.event.trigger(map, 'resize');
145		});
146	}
147
148	//callback
149	if ( typeof colomat_callback != 'undefined' ) {
150		colomat_callback();
151	}
152}
153
154function closeOtherGroups(rel){
155	jQuery('.collapseomatic[rel!="' + rel +'"]').each(function(index) {
156		//add close class if open
157		if(jQuery(this).hasClass('colomat-expand-only') && jQuery(this).hasClass('colomat-close')){
158			return;
159		}
160		if(jQuery(this).hasClass('colomat-close') && jQuery(this).attr('rel') !== undefined){
161			jQuery(this).removeClass('colomat-close');
162			var id = jQuery(this).attr('id');
163			//remove parent highlight class
164			jQuery('#parent-'+id).removeClass('colomat-parent-highlight');
165
166			//check if the title needs to be swapped out
167			if(jQuery("#swap-"+id).length > 0){
168				swapTitle(this, "#swap-"+id);
169			}
170
171			//check if the excerpt needs to be swapped out
172			if(jQuery("#swapexcerpt-"+id).length > 0){
173				swapTitle("#exerpt-"+id, "#swapexcerpt-"+id);
174			}
175
176			//external triggers
177			jQuery('[id^=extra][id$='+id+']').each( function( index ){
178				if(jQuery(this).data('swaptitle')){
179					old_swap_title = jQuery(this).data('swaptitle');
180					old_title = jQuery(this).html();
181					jQuery(this).html(old_swap_title);
182					jQuery(this).data('swaptitle', old_title);
183				}
184			});
185
186			toggleState (jQuery(this), id, false, false);
187
188			//check if there are nested children that need to be collapsed
189			var ancestors = jQuery('.collapseomatic', '#target-'+id);
190			ancestors.each(function(index) {
191				jQuery(this).removeClass('colomat-close');
192				var thisid = jQuery(this).attr('id');
193				jQuery('#target-'+thisid).css('display', 'none');
194			})
195		}
196	});
197}
198
199function closeOtherRelMembers(rel, id){
200	jQuery('.collapseomatic[rel="' + rel +'"]').each(function(index) {
201		closeOtherMembers( this, id);
202	});
203}
204
205function closeOtherTogMembers(togname, id){
206	jQuery('.collapseomatic[data-togglegroup="' + togname +'"]').each(function(index) {
207		closeOtherMembers( this, id);
208	});
209}
210
211function closeOtherMembers(obj, id){
212		if(jQuery(obj).hasClass('colomat-expand-only') && jQuery(obj).hasClass('colomat-close')){
213			return;
214		}
215
216		//add close class if open
217		if(jQuery(obj).attr('id') != id && jQuery(obj).hasClass('colomat-close')){
218			//collapse the element
219			jQuery(obj).removeClass('colomat-close');
220			var thisid = jQuery(obj).attr('id');
221			//remove parent highlight class
222			jQuery('#parent-'+thisid).removeClass('colomat-parent-highlight');
223
224			//check if the title needs to be swapped out
225			if(jQuery("#swap-"+thisid).length > 0){
226				swapTitle(obj, "#swap-"+thisid);
227			}
228
229			//check if the excerpt needs to be swapped out
230			if(jQuery("#swapexcerpt-"+thisid).length > 0){
231				swapTitle("#excerpt-"+thisid, "#swapexcerpt-"+thisid);
232			}
233
234			//external triggers
235			jQuery('[id^=extra][id$='+thisid+']').each( function( index ){
236				if(jQuery(this).data('swaptitle')){
237					old_swap_title = jQuery(this).data('swaptitle');
238					old_title = jQuery(this).html();
239					jQuery(this).html(old_swap_title);
240					jQuery(this).data('swaptitle', old_title);
241				}
242			});
243
244			//check for snap-shut
245			if(!jQuery(obj).hasClass('colomat-close') && jQuery(obj).hasClass('snap-shut')){
246				jQuery('#target-'+thisid).hide();
247			}
248			else{
249				toggleState (jQuery(obj), thisid, false, false);
250			}
251
252			//check if there are nested children that need to be collapsed
253			var ancestors = jQuery('.collapseomatic', '#target-'+id);
254			ancestors.each(function(index) {
255				if(jQuery(this).hasClass('colomat-expand-only') && jQuery(this).hasClass('colomat-close')){
256					return;
257				}
258				//deal with extra tirggers
259				var pre_id = id.split('-');
260				if (pre_id[0].indexOf('extra') != '-1') {
261					//console.log('this is an extra trigger');
262					pre = pre_id.splice(0, 1);
263					id = pre_id.join('-');
264
265					//deal with any scroll to links from the Extra Collapse Trigger
266					if(jQuery(this).hasClass('scroll-to-trigger')){
267						var target_offset = jQuery('#'+id).offset();
268						offset_top = target_offset.top;
269					}
270
271					//deal with any scroll to links from the Title Trigger
272					if(jQuery('#'+id).hasClass('scroll-to-trigger')){
273						offset_top = jQuery('#scrollonclose-'+id).attr('name');
274						if (offset_top == 'auto') {
275							var target_offset = jQuery('#'+id).offset();
276							offset_top = target_offset.top;
277						}
278					}
279
280					//toggle master trigger arrow
281					jQuery('#'+id).toggleClass('colomat-close');
282
283					//toggle any other extra trigger arrows
284					jQuery('[id^=extra][id$='+id+']').toggleClass('colomat-close');
285				}
286
287				if(jQuery(this).attr('id').indexOf('bot-') == '-1'){
288					jQuery(this).removeClass('colomat-close');
289					var thisid = jQuery(this).attr('id');
290					//check if the title needs to be swapped out
291					if(jQuery("#swap-"+thisid).length > 0){
292						swapTitle(this, "#swap-"+thisid);
293					}
294					//check if the excerpt needs to be swapped out
295					if(jQuery("#swapexcerpt-"+thisid).length > 0){
296						swapTitle("#excerpt-"+thisid, "#swapexcerpt-"+thisid);
297					}
298					//external triggers
299					jQuery('[id^=extra][id$='+thisid+']').each( function( index ){
300						if(jQuery(this).data('swaptitle')){
301							old_swap_title = jQuery(this).data('swaptitle');
302							old_title = jQuery(this).html();
303							jQuery(this).html(old_swap_title);
304							jQuery(this).data('swaptitle', old_title);
305						}
306					});
307					jQuery('#target-'+thisid).css('display', 'none');
308				}
309			})
310		}
311}
312
313function colomat_expandall(loop_items){
314	if (!loop_items){
315		loop_items = jQuery('.collapseomatic:not(.colomat-close)');
316	}
317	loop_items.each(function(index) {
318		jQuery(this).addClass('colomat-close');
319		var thisid = jQuery(this).attr('id');
320		jQuery('#parent-'+thisid).addClass('colomat-parent-highlight');
321
322		if(jQuery("#swap-"+thisid).length > 0){
323			swapTitle(this, "#swap-"+thisid);
324		}
325
326		if(jQuery("#swapexcerpt-"+thisid).length > 0){
327			swapTitle("#excerpt-"+thisid, "#swapexcerpt-"+thisid);
328		}
329
330		//external triggers
331		jQuery('[id^=extra][id$='+thisid+']').each( function( index ){
332			if(jQuery(this).data('swaptitle')){
333				old_swap_title = jQuery(this).data('swaptitle');
334				old_title = jQuery(this).html();
335				jQuery(this).html(old_swap_title);
336				jQuery(this).data('swaptitle', old_title);
337			}
338		});
339
340		toggleState(jQuery(this), thisid, true, false);
341	});
342}
343
344function colomat_collapseall(loop_items){
345	if (!loop_items){
346		loop_items = jQuery('.collapseomatic.colomat-close');
347	}
348
349	loop_items.each(function(index) {
350		if(jQuery(this).hasClass('colomat-expand-only') && jQuery(this).hasClass('colomat-close')){
351			return;
352		}
353
354		jQuery(this).removeClass('colomat-close');
355		var thisid = jQuery(this).attr('id');
356		jQuery('#parent-'+thisid).removeClass('colomat-parent-highlight');
357
358		if(jQuery("#swap-"+thisid).length > 0){
359			swapTitle(this, "#swap-"+thisid);
360		}
361
362		if(jQuery("#swapexcerpt-"+thisid).length > 0){
363			swapTitle("#excerpt-"+thisid, "#swapexcerpt-"+thisid);
364		}
365
366		//external triggers
367		jQuery('[id^=extra][id$='+thisid+']').each( function( index ){
368			if(jQuery(this).data('swaptitle')){
369				old_swap_title = jQuery(this).data('swaptitle');
370				old_title = jQuery(this).html();
371				jQuery(this).html(old_swap_title);
372				jQuery(this).data('swaptitle', old_title);
373			}
374		});
375
376		toggleState(jQuery(this), thisid, false, false);
377
378	});
379}
380
381
382jQuery(document).ready(function() {
383	com_binding = 'click';
384	if (com_options.colomattouchstart) {
385		com_binding = 'click touchstart';
386	}
387
388	if (com_options.colomatpauseInit) {
389		init_pause = setTimeout(collapse_init, com_options.colomatpauseInit);
390	}
391	else{
392		collapse_init();
393	}
394
395	//jetpack infinite scroll catch-all
396	jQuery( document.body ).on( 'post-load', function () {
397		collapse_init();
398	} );
399
400	//Display the collapse wrapper... use to reverse the show-all on no JavaScript degredation.
401	jQuery('.content_collapse_wrapper').each(function(index) {
402		jQuery(this).css('display', 'inline');
403	});
404
405	//hover
406	jQuery(document).on({
407		mouseenter: function(){
408			//stuff to do on mouseover
409			jQuery(this).addClass('colomat-hover');
410		},
411		mouseleave: function(){
412			//stuff to do on mouseleave
413			jQuery(this).removeClass('colomat-hover');
414		},
415		focusin: function(){
416			//stuff to do on keyboard focus
417			jQuery(this).addClass('colomat-hover');
418		},
419		focusout: function(){
420			//stuff to do on losing keyboard focus
421			jQuery(this).removeClass('colomat-hover');
422		}
423	}, '.collapseomatic'); //pass the element as an argument to .on
424
425	//tabindex enter
426	jQuery(document).on('keypress','.collapseomatic', function(event) {
427		if (event.which == 13) {
428			event.currentTarget.click();
429		};
430	});
431
432	//the main collapse/expand function
433	jQuery(document.body).on(com_binding, '.collapseomatic', function(event) {
434		var offset_top;
435
436		//alert('phones ringin dude');
437		if(jQuery(this).hasClass('colomat-expand-only') && jQuery(this).hasClass('colomat-close')){
438			return;
439		}
440
441		// rel highlander must be one
442		if(jQuery(this).attr('rel') && jQuery(this).attr('rel').toString().indexOf('-highlander') != '-1' && jQuery(this).hasClass('must-be-one') && jQuery(this).hasClass('colomat-close')){
443			return;
444		}
445
446		//toggle group highlander must be one
447		if(jQuery(this).data('togglegroup') && jQuery(this).data('togglegroup').toString().indexOf('-highlander') != '-1' && jQuery(this).hasClass('must-be-one') && jQuery(this).hasClass('colomat-close')){
448			return;
449		}
450
451		var id = jQuery(this).attr('id');
452
453		//deal with any scroll to links
454		if(jQuery(this).hasClass('colomat-close') && jQuery(this).hasClass('scroll-to-trigger')){
455			offset_top = jQuery('#scrollonclose-'+id).attr('name');
456			if (offset_top == 'auto') {
457				var target_offset = jQuery('#'+id).offset();
458				offset_top = target_offset.top;
459			}
460		}
461
462		var id_arr = id.split('-');
463
464		//deal with extra tirggers
465		if (id_arr[0].indexOf('extra') != '-1') {
466			//console.log('this is an extra trigger');
467			pre = id_arr.splice(0, 1);
468			id = id_arr.join('-');
469
470			//deal with any scroll to links from the Extra Collapse Trigger
471			if(jQuery(this).hasClass('scroll-to-trigger')){
472				var target_offset = jQuery('#'+id).offset();
473				offset_top = target_offset.top;
474			}
475
476			//deal with any scroll to links from the Title Trigger
477			if(jQuery('#'+id).hasClass('scroll-to-trigger')){
478				offset_top = jQuery('#scrollonclose-'+id).attr('name');
479				if (offset_top == 'auto') {
480					var target_offset = jQuery('#'+id).offset();
481					offset_top = target_offset.top;
482				}
483			}
484
485			//toggle master trigger arrow
486			jQuery('#'+id).toggleClass('colomat-close');
487
488			//toggle any other extra trigger arrows
489			jQuery('[id^=extra][id$='+id+']').toggleClass('colomat-close');
490		}
491
492		else if(id.indexOf('bot-') != '-1'){
493			id = id.substr(4);
494			jQuery('#'+id).toggleClass('colomat-close');
495
496			//deal with any scroll to links from the Internal Collapse Trigger
497			if(jQuery(this).hasClass('scroll-to-trigger')){
498				var target_offset = jQuery('#'+id).offset();
499				offset_top = target_offset.top;
500			}
501
502			//deal with any scroll to links from the Title Trigger
503			if(jQuery('#'+id).hasClass('scroll-to-trigger')){
504				offset_top = jQuery('#scrollonclose-'+id).attr('name');
505				if (offset_top == 'auto') {
506					var target_offset = jQuery('#'+id).offset();
507					offset_top = target_offset.top;
508				}
509			}
510		}
511		else{
512			jQuery(this).toggleClass('colomat-close');
513			//toggle any extra triggers
514			jQuery('[id^=extra][id$='+id+']').toggleClass('colomat-close');
515		}
516
517		//check if the title needs to be swapped out
518		if(jQuery("#swap-"+id).length > 0){
519			swapTitle(jQuery('#'+id), "#swap-"+id);
520		}
521
522		//check if the excerpt needs to be swapped out
523		if(jQuery("#swapexcerpt-"+id).length > 0){
524			swapTitle("#excerpt-"+id, "#swapexcerpt-"+id);
525		}
526
527		//external triggers
528		jQuery('[id^=extra][id$='+id+']').each( function( index ){
529			if(jQuery(this).data('swaptitle')){
530				old_swap_title = jQuery(this).data('swaptitle');
531				old_title = jQuery(this).html();
532				jQuery(this).html(old_swap_title);
533				jQuery(this).data('swaptitle', old_title);
534			}
535		});
536
537		//add visited class
538		jQuery(this).addClass('colomat-visited');
539
540		//toggle parent highlight class
541		var parentID = 'parent-'+id;
542		jQuery('#' + parentID).toggleClass('colomat-parent-highlight');
543
544		//check for snap-shut
545		if(!jQuery(this).hasClass('colomat-close') && jQuery(this).hasClass('snap-shut')){
546			jQuery('#target-'+id).hide();
547		}
548		else{
549			toggleState (jQuery(this), id, true, id);
550		}
551
552		//deal with grouped items if needed
553		if(jQuery(this).attr('rel') !== undefined){
554			var rel = jQuery(this).attr('rel').toString();
555			if(rel.indexOf('-highlander') != '-1'){
556				closeOtherRelMembers(rel, id);
557			}
558			else{
559				closeOtherGroups(rel);
560			}
561		}
562
563		if(jQuery(this).data('togglegroup') !== undefined){
564			var togname = jQuery(this).data('togglegroup').toString();
565			if(togname.indexOf('-highlander') != '-1'){
566				closeOtherTogMembers(togname, id);
567			}
568		}
569
570		if(offset_top){
571			jQuery('html, body').animate({scrollTop:offset_top}, 500);
572		}
573	});
574
575
576	jQuery(document).on(com_binding, '.expandall', function(event) {
577		if(jQuery(this).attr('rel') !== undefined){
578			var rel = jQuery(this).attr('rel');
579			var loop_items = jQuery('.collapseomatic:not(.colomat-close)[rel="' + rel +'"]');
580		}
581		else if(jQuery(this).attr('data-togglegroup') !== undefined){
582			var toggroup = jQuery(this).attr('data-togglegroup');
583			var loop_items = jQuery('.collapseomatic:not(.colomat-close)[data-togglegroup="' + toggroup +'"]');
584		}
585		else{
586			var loop_items = jQuery('.collapseomatic:not(.colomat-close)');
587		}
588
589		colomat_expandall(loop_items);
590	});
591
592	jQuery(document).on(com_binding, '.collapseall', function(event) {
593		if(jQuery(this).attr('rel') !== undefined){
594			var rel = jQuery(this).attr('rel');
595			var loop_items = jQuery('.collapseomatic.colomat-close[rel="' + rel +'"]');
596		}
597		else if(jQuery(this).attr('data-togglegroup') !== undefined){
598			var toggroup = jQuery(this).attr('data-togglegroup');
599			var loop_items = jQuery('.collapseomatic.colomat-close[data-togglegroup="' + toggroup +'"]');
600		}
601		else {
602			var loop_items = jQuery('.collapseomatic.colomat-close');
603		}
604
605		colomat_collapseall(loop_items);
606	});
607
608	//handle new page loads with anchor
609	var fullurl = document.location.toString();
610	if (fullurl.match('#(?!\!)')) {
611		hashmaster(fullurl);
612	}
613
614	//handle no-link triggers within the same page
615	jQuery(document).on('click', 'a.colomat-nolink', function(event) {
616		event.preventDefault();
617	});
618
619	//manual hashtag changes in url
620	jQuery(window).on('hashchange', function (e) {
621		fullurl = document.location.toString();
622		if (fullurl.match('#(?!\!)')) {
623			hashmaster(fullurl);
624		}
625	});
626
627	//master url hash funciton
628	function hashmaster(fullurl){
629		// the URL contains an anchor but not a hash-bang
630		if (fullurl.match('#(?!\!)')) {
631			// click the navigation item corresponding to the anchor
632			var anchor_arr = fullurl.split(/#(?!\!)/);
633
634			if(anchor_arr.length > 1){
635				junk = anchor_arr.splice(0, 1);
636				anchor = anchor_arr.join('#');
637			}
638			else{
639				anchor = anchor_arr[0];
640			}
641
642			if( jQuery('#' + anchor).length ){
643				//expand any nested parents
644				jQuery('#' + anchor).parents('.collapseomatic_content').each(function(index) {
645					parent_arr = jQuery(this).attr('id').split('-');
646					junk = parent_arr.splice(0, 1);
647					parent = parent_arr.join('-');
648					if(!jQuery('#' + parent).hasClass('colomat-close')){
649						jQuery('#' + parent).click();
650					}
651				})
652				//now expand the target anchor
653				if(!jQuery('#' + anchor).hasClass('colomat-close')){
654					jQuery('#' + anchor).click();
655				}
656			}
657
658			if(typeof colomatoffset !== 'undefined'){
659				var anchor_offset = jQuery('#' + anchor).offset();
660				colomatoffset = colomatoffset + anchor_offset.top;
661				jQuery('html, body').animate({scrollTop:colomatoffset}, 50);
662			}
663
664		}
665	}
666});

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.