PageSourceSearch

https://toravoda.org.il/wp-content/themes/enfold/config-templatebu…/toggles/toggles.js?ver=6.7.9

js toravoda.org.il collected 2026-10-02 05:09:13 UTC 3,898 bytes, 149 lines download raw bytes

1// -------------------------------------------------------------------------------------------
2// Toggle shortcode javascript
3// -------------------------------------------------------------------------------------------
4(function($)
5{ 
6	"use strict";
7	
8	$.fn.avia_sc_toggle = function(options)
9	{
10		var defaults =
11		{
12			single: '.single_toggle',
13			heading: '.toggler',
14			content: '.toggle_wrap',
15			sortContainer:'.taglist'
16		};
17	
18		var win = $(window),
19			options = $.extend(defaults, options);
20	
21		return this.each(function()
22		{
23			var container 	= $(this).addClass('enable_toggles'),
24				toggles		= $(options.single, container),
25				heading 	= $(options.heading, container),
26				allContent 	= $(options.content, container),
27				sortLinks	= $(options.sortContainer + " a", container);
28	
29			heading.each(function(i)
30			{
31				var thisheading =  $(this), content = thisheading.next(options.content, container);
32	
33				function scroll_to_viewport()
34				{
35				    //check if toggle title is in viewport. if not scroll up
36				    var el_offset = content.offset().top,
37				        scoll_target = el_offset - 50 - parseInt($('html').css('margin-top'),10);
38	
39				    if(win.scrollTop() > el_offset)
40				    {
41				        $('html:not(:animated),body:not(:animated)').animate({scrollTop: scoll_target},200);
42				    }
43				}
44	
45				if(content.css('visibility') != "hidden")
46				{
47					thisheading.addClass('activeTitle');
48				}
49	
50				thisheading.on('click', function()
51				{
52					if(content.css('visibility') != "hidden")
53					{
54						content.slideUp(200, function()
55						{
56							content.removeClass('active_tc').attr({style:''});
57							win.trigger('av-height-change');
58							win.trigger('av-content-el-height-changed', this );
59							
60							location.replace(thisheading.data('fake-id') + "-closed");
61						});
62						thisheading.removeClass('activeTitle');
63	
64					}
65					else
66					{
67						if(container.is('.toggle_close_all'))
68						{
69							allContent.not(content).slideUp(200, function()
70							{
71								$(this).removeClass('active_tc').attr({style:''});
72								scroll_to_viewport();
73							});
74							heading.removeClass('activeTitle');
75						}
76						
77						content.addClass('active_tc');
78						
79						setTimeout(function(){
80							
81							content.slideDown(200,
82							
83								function()
84								{
85			                        if(!container.is('.toggle_close_all'))
86			                        {
87			                            scroll_to_viewport();
88			                        }
89			                        
90			                        win.trigger('av-height-change');
91									win.trigger('av-content-el-height-changed', this );
92								}
93							
94							);
95						
96						}, 1);
97						
98						thisheading.addClass('activeTitle');
99						location.replace(thisheading.data('fake-id'));
100					}
101					
102					
103					
104				});
105			});
106	
107	
108			sortLinks.click(function(e){
109	
110				e.preventDefault();
111				var show = toggles.filter('[data-tags~="'+$(this).data('tag')+'"]'),
112					hide = toggles.not('[data-tags~="'+$(this).data('tag')+'"]');
113	
114					sortLinks.removeClass('activeFilter');
115					$(this).addClass('activeFilter');
116					heading.filter('.activeTitle').trigger('click');
117					show.slideDown();
118					hide.slideUp();
119			});
120	
121	
122			function trigger_default_open(hash)
123			{
124				if(!hash && window.location.hash) hash = window.location.hash;
125				if(!hash) return;
126				
127				var open = heading.filter('[data-fake-id="'+hash+'"]');
128	
129				if(open.length)
130				{
131					if(!open.is('.activeTitle')) open.trigger('click');
132					window.scrollTo(0, container.offset().top - 70);
133				}
134			}
135			trigger_default_open(false);
136			
137			$('a').on('click',function(){
138	            var hash = $(this).attr('href');
139	            if(typeof hash != "undefined" && hash)
140	            {
141	                hash = hash.replace(/^.*?#/,'');
142	                trigger_default_open('#'+hash);
143	            }
144	        });
145	
146		});
147	};
148	
149}(jQuery));

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.