PageSourceSearch

https://bynh.sa/wp-content/themes/enfold/js/avia-snippet-widget.js

js bynh.sa collected 2026-09-24 13:03:44 UTC 2,430 bytes, 100 lines download raw bytes

1(function($)
2{
3	"use strict";
4
5	$( function()
6	{
7		$('.avia_auto_toc').each(function()
8		{
9			var $toc_section = $(this).attr('id');
10			var $levels = 'h1';
11			var $levelslist = new Array();
12			var $excludeclass = '';
13
14			var $toc_container = $(this).find('.avia-toc-container');
15
16			if( $toc_container.length )
17			{
18				var $levels_attr = $toc_container.attr('data-level');
19				var $excludeclass_attr = $toc_container.attr('data-exclude');
20
21				if( typeof $levels_attr != 'undefined' )
22				{
23					$levels = $levels_attr;
24				}
25
26				if( typeof $excludeclass_attr != 'undefined' )
27				{
28					$excludeclass = $excludeclass_attr.trim();
29				}
30			}
31
32			$levelslist = $levels.split(',');
33
34			$('.entry-content-wrapper').find( $levels ).each( function()
35			{
36				var headline = $( this );
37
38				if( headline.hasClass('av-no-toc') )
39				{
40					return;
41				}
42
43				if( $excludeclass != '' && ( headline.hasClass( $excludeclass ) || headline.parent().hasClass( $excludeclass ) ) )
44				{
45					return;
46				}
47
48				var $h_id = headline.attr('id');
49				var $tagname = headline.prop( 'tagName' ).toLowerCase();
50				var $txt = headline.text();
51				var $pos = $levelslist.indexOf($tagname);
52
53				if( typeof $h_id == 'undefined' )
54				{
55					var $new_id = av_pretty_url( $txt );
56					headline.attr( 'id', $new_id );
57					$h_id = $new_id;
58				}
59
60				var $list_tag = '<a href="#' + $h_id + '" class="avia-toc-link avia-toc-level-' + $pos + '"><span>' + $txt + '</span></a>';
61				$toc_container.append( $list_tag );
62			});
63
64            // Smooth Scrolling
65			$( ".avia-toc-smoothscroll .avia-toc-link" ).on( 'click', function(e)
66			{
67				e.preventDefault();
68
69				var $target = $(this).attr('href');
70				var $offset = 50;
71
72				// calculate offset if there is a sticky header
73				var $sticky_header = $('.html_header_top.html_header_sticky #header');
74
75				if( $sticky_header.length )
76				{
77					$offset = $sticky_header.outerHeight() + 50;
78				}
79
80				$('html,body').animate( { scrollTop: $($target).offset().top - $offset } );
81			});
82        });
83    });
84
85    function av_pretty_url(text)
86	{
87		return text.replace(/[ÄÖÜäöüß]/g, function(match) {
88									return {
89										"Ä": "Ae", "Ö": "Oe", "Ü": "Ue",
90										"ä": "ae", "ö": "oe", "ü": "ue",
91										"ß": "ss"
92									}[match];
93								})
94					.toLowerCase()
95					.replace( /[^a-z0-9]+/g, "-" )
96					.replace( /^-+|-+$/g, "-" )
97					.replace( /^-+|-+$/g, '' );
98    }
99
100})( 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.