PageSourceSearch

https://thearc.org/wp-content/themes/enfold/config-gutenberg/js/avia_blocks_front.js?ver=7.1

js thearc.org collected 2026-09-24 08:37:53 UTC 2,717 bytes, 99 lines download raw bytes

1/**
2 * Holds frontend script necessary to support WC blocks
3 *
4 */
5( function($)
6{
7
8	"use strict";
9
10	//	Add a predefined color to element
11	var elements = $( '.has-background, .has-text-color' );
12
13	elements.each( function( i )
14	{
15		var element = $(this);
16		if( ! ( element.hasClass( 'has-background' ) || element.hasClass( 'has-text-color' ) ) )
17		{
18			return;
19		}
20
21		var classList = element.attr( 'class' ).split( /\s+/ );
22		var color = '';
23		var style = '';
24
25		if( element.hasClass( 'has-background' ) )
26		{
27			$.each( classList, function( index, item )
28			{
29				item = item.trim().toLowerCase();
30				if( 0 == item.indexOf( 'has-col-' ) && -1 != item.indexOf( '-background-color' ) )
31				{
32					color = item.replace( 'has-col-', '' );
33					color = color.replace( '-background-color', '' );
34					color = color.replace( /-|[^0-9a-fA-F]/g, '' );
35					if( color.length == 3 || color.length == 6 )
36					{
37						element.css( { 'background-color': '', 'border-color': '' } );		//	force hex instead rgb
38						style = 'undefined' != typeof element.attr( 'style' ) ? element.attr( 'style' ) + ';' : '';
39						element.attr( 'style', style + ' background-color: #' + color + '; border-color: #' + color + ';' );
40					}
41				}
42			});
43		}
44
45		if( element.hasClass( 'has-text-color' ) )
46		{
47			$.each( classList, function( index, item )
48			{
49				item = item.trim().toLowerCase();
50				if( 0 == item.indexOf( 'has-col-' ) && -1 == item.indexOf( '-background-color' ) && -1 != item.indexOf( '-color' ) )
51				{
52					var color = item.replace( 'has-col-', '' );
53					color = color.replace( '-color', '' );
54					color = color.replace( /-|[^0-9a-fA-F]/g, '' );
55					if( color.length == 3 || color.length == 6 )
56					{
57						element.css( 'color', '' );		//	force hex instead rgb
58						style = 'undefined' != typeof element.attr( 'style' ) ? element.attr( 'style' ) + ';' : '';
59						element.attr( 'style', style + ' color: #' + color + ';' );
60					}
61				}
62			});
63		}
64
65	});
66
67	//	add a custom font size to element
68	elements = $('[class^="has-fs-"], [class$="-font-size"]');
69
70	elements.each( function( i )
71	{
72		var element = $(this);
73
74		var classList = element.attr( 'class' ).split( /\s+/ );
75
76		$.each( classList, function( index, item )
77		{
78			item = item.trim().toLowerCase();
79
80			if( 0 == item.indexOf( 'has-fs-' ) && -1 != item.indexOf( '-font-size' ) )
81			{
82				item = item.replace( 'has-fs-', '' );
83				item = item.replace( '-font-size', '' );
84				item = item.split( '-' );
85
86				if( item.length != 2 )
87				{
88					return;
89				}
90
91				var style = 'undefined' != typeof element.attr( 'style' ) ? element.attr( 'style' ) + ';' : '';
92				element.attr( 'style', style + ' font-size:' + item[0] + item[1] + ';');
93			}
94		});
95
96	});
97
98})( jQuery );
99

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.