PageSourceSearch

https://rgp.com/wp-content/themes/salient-child/js/safari-animation-bypass.js?ver=1789742368

js rgp.com collected 2026-09-24 23:15:10 UTC 3,446 bytes, 118 lines download raw bytes

1/**
2 * Safari: show Salient fade-in entrance animations in their end state only.
3 * Does not disable GSAP careers animations, reveals, grow-in, etc.
4 */
5(function () {
6	'use strict';
7
8	var FADE_IN_SELECTOR =
9		'[data-animation="fade-in"],' +
10		'[data-animation="fade-in-from-bottom"],' +
11		'[data-animation="slight-fade-in-from-bottom"],' +
12		'[data-animation="fade-in-from-left"],' +
13		'[data-animation="fade-in-from-right"],' +
14		'.img-with-aniamtion-wrap[data-animation="fade-in"],' +
15		'.img-with-aniamtion-wrap[data-animation="fade-in-from-bottom"],' +
16		'.img-with-aniamtion-wrap[data-animation="fade-in-from-left"],' +
17		'.img-with-aniamtion-wrap[data-animation="fade-in-from-right"]';
18
19	function isSafariBrowser() {
20		var ua = navigator.userAgent;
21		if ( /Chrome|CriOS|Chromium|Edg|OPR|Firefox|FxiOS/i.test( ua ) ) {
22			return false;
23		}
24		return /Safari/i.test( ua ) && /AppleWebKit/i.test( ua );
25	}
26
27	function isFadeInAnimation( animation ) {
28		if ( ! animation || animation === 'none' || animation === 'false' ) {
29			return false;
30		}
31		return (
32			animation === 'fade-in' ||
33			animation === 'fade-in-from-bottom' ||
34			animation === 'slight-fade-in-from-bottom' ||
35			animation === 'fade-in-from-left' ||
36			animation === 'fade-in-from-right'
37		);
38	}
39
40	if ( ! isSafariBrowser() ) {
41		return;
42	}
43
44	document.documentElement.classList.add( 'rgp-safari-fade-in-final' );
45
46	function finalizeFadeInAnimations( $ ) {
47		if ( ! $ || ! $.fn ) {
48			return;
49		}
50
51		$( 'body' ).addClass( 'rgp-safari-fade-in-final' );
52
53		$( FADE_IN_SELECTOR ).each( function () {
54			var $el = $( this );
55			var animation = $el.attr( 'data-animation' );
56
57			if ( $el.is( 'img.img-with-animation' ) ) {
58				if ( ! isFadeInAnimation( animation ) ) {
59					return;
60				}
61				var $animate = $el.parents( '.hover-wrap' ).length ? $el.parents( '.hover-wrap' ).first() : $el;
62				$animate.css( { opacity: 1, transform: 'none' } );
63				$el.css( { opacity: 1, transform: 'none' } );
64				$el.addClass( 'animated-in' );
65				$el.closest( '.img-with-aniamtion-wrap' ).addClass( 'animated-in' );
66				$el.attr( 'data-animation', 'none' );
67				return;
68			}
69
70			if ( $el.hasClass( 'img-with-aniamtion-wrap' ) && isFadeInAnimation( animation ) ) {
71				$el.find( '.hover-wrap, .hover-wrap-inner, img.img-with-animation' ).css( {
72					opacity: 1,
73					transform: 'none',
74				} );
75				$el.addClass( 'animated-in' );
76				$el.find( 'img.img-with-animation' ).addClass( 'animated-in' ).attr( 'data-animation', 'none' );
77				$el.attr( 'data-animation', 'none' );
78				return;
79			}
80
81			if ( ! isFadeInAnimation( animation ) ) {
82				return;
83			}
84
85			if ( $el.hasClass( 'col' ) || $el.hasClass( 'wpb_column' ) || $el.hasClass( 'has-animation' ) ) {
86				$el.addClass( 'animated-in triggered-animation' );
87				$el.css( { opacity: 1, transform: 'none' } );
88				$el.find( '.vc_column-inner' ).css( { opacity: 1, transform: 'none' } );
89				$el.attr( 'data-animation', 'none' );
90			}
91		} );
92	}
93
94	function bindFinalize() {
95		if ( ! window.jQuery ) {
96			return;
97		}
98		var $ = window.jQuery;
99
100		$( function () {
101			finalizeFadeInAnimations( $ );
102		} );
103
104		$( window ).on( 'load nectar-waypoints-reinit nectar-tab-changed', function () {
105			finalizeFadeInAnimations( $ );
106		} );
107
108		setTimeout( function () {
109			finalizeFadeInAnimations( $ );
110		}, 600 );
111	}
112
113	if ( document.readyState === 'loading' ) {
114		document.addEventListener( 'DOMContentLoaded', bindFinalize );
115	} else {
116		bindFinalize();
117	}
118})();

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.