1(function($) { 2 window.custom_animate_element = function ( $element ) { 3 var animation_style = $element.attr('data-animation-style'); 4 var animation_repeat = $element.attr('data-animation-repeat'); 5 var animation_duration = $element.attr('data-animation-duration'); 6 var animation_delay = $element.attr('data-animation-delay'); 7 var animation_intensity = $element.attr('data-animation-intensity'); 8 var animation_starting_opacity = $element.attr('data-animation-starting-opacity'); 9 var animation_speed_curve = $element.attr('data-animation-speed-curve'); 10 11 // Remove all the animation data attributes once the variables have been set 12 custom_remove_animation_data( $element ); 13 14 // Opacity can be 0 to 1 so the starting opacity is equal to the percentage number multiplied by 0.01 15 var starting_opacity = isNaN( parseInt( animation_starting_opacity ) ) ? 0 : parseInt( animation_starting_opacity ) * 0.01; 16 17 // Check if the animation speed curve is one of the allowed ones and set it to the default one if it is not 18 if ( $.inArray( animation_speed_curve, ['linear', 'ease', 'ease-in', 'ease-out', 'ease-in-out'] ) === -1 ) { 19 animation_speed_curve = 'ease-in-out'; 20 } 21 22 $element.css({ 23 'animation-duration' : animation_duration, 24 'animation-delay' : animation_delay, 25 'opacity' : starting_opacity, 26 'animation-timing-function' : animation_speed_curve 27 }); 28 29 var intensity_css = {}; 30 var intensity_percentage = isNaN( parseInt( animation_intensity ) ) ? 50 : parseInt( animation_intensity ); 31 32 // All the animations that can have intensity 33 var intensity_animations = ['slide', 'zoom', 'flip', 'fold', 'roll']; 34 35 var original_animation = false; 36 var original_direction = false; 37 38 // Check if current animation can have intensity 39 for ( var i = 0; i < intensity_animations.length; i++ ) { 40 var animation = intensity_animations[i]; 41 42 // As the animation style is a combination of type and direction check if 43 // the current animation contains any of the allowed animation types 44 if ( ! animation_style || animation_style.substr( 0, animation.length ) !== animation ) { 45 continue; 46 } 47 48 // If it does set the original animation to the base animation type 49 var original_animation = animation; 50 51 // Get the remainder of the animation style and set it as the direction 52 var original_direction = animation_style.substr( animation.length, animation_style.length ); 53 54 // If that is not empty convert it to lower case for better readability's sake 55 if ( '' !== original_direction ) { 56 original_direction = original_direction.toLowerCase(); 57 } 58 59 break; 60 } 61 62 if ( original_animation !== false && original_direction !== false ) { 63 intensity_css = custom_process_animation_intensity( original_animation, original_direction, intensity_percentage ); 64 } 65 66 if ( ! $.isEmptyObject( intensity_css ) ) { 67 $element.css( intensity_css ); 68 } 69 70 $element.addClass( 'et_animated' ); 71 $element.addClass( animation_style ); 72 $element.addClass( animation_repeat ); 73 74 // Remove the animation after it completes if it is not an infinite one 75 if ( ! animation_repeat ) { 76 var animation_duration_ms = parseInt( animation_duration ); 77 var animation_delay_ms = parseInt( animation_delay ); 78 79 setTimeout( function() { 80 custom_remove_animation( $element ); 81 }, animation_duration_ms + animation_delay_ms ); 82 } 83 } 84 85 window.custom_process_animation_data = function( waypoints_enabled ) { 86 if ( 'undefined' !== typeof et_animation_data && et_animation_data.length > 0 ) { 87 $('body').css('overflow-x', 'hidden'); 88 $('#page-container').css('overflow-y', 'hidden'); 89 90 for ( var i = 0; i < et_animation_data.length; i++ ) { 91 var animation_entry = et_animation_data[i]; 92 93 if ( 94 ! animation_entry.class || 95 ! animation_entry.style || 96 ! animation_entry.repeat || 97 ! animation_entry.duration || 98 ! animation_entry.delay || 99 ! animation_entry.intensity || 100 ! animation_entry.starting_opacity || 101 ! animation_entry.speed_curve 102 ) { 103 continue; 104 } 105 106 var $animated = $('.' + animation_entry.class); 107 108 $animated.attr({ 109 'data-animation-style' : animation_entry.style, 110 'data-animation-repeat' : 'once' === animation_entry.repeat ? '' : 'infinite',
111 'data-animation-duration' : animation_entry.duration, 112 'data-animation-delay' : animation_entry.delay, 113 'data-animation-intensity' : animation_entry.intensity, 114 'data-animation-starting-opacity': animation_entry.starting_opacity, 115 'data-animation-speed-curve' : animation_entry.speed_curve 116 }); 117 } 118 } 119 } 120 121 window.custom_process_animation_intensity = function( animation, direction, intensity ) { 122 var intensity_css = {}; 123 124 switch( animation ) { 125 case 'slide': 126 switch( direction ) { 127 case 'top': 128 var percentage = intensity * -2; 129 130 intensity_css = { 131 transform: 'translate3d(0, ' + percentage + '%, 0)' 132 }; 133 134 break; 135 136 case 'right': 137 var percentage = intensity * 2; 138 139 intensity_css = { 140 transform: 'translate3d(' + percentage + '%, 0, 0)' 141 }; 142 143 break; 144 145 case 'bottom': 146 var percentage = intensity * 2; 147 148 intensity_css = { 149 transform: 'translate3d(0, ' + percentage + '%, 0)' 150 }; 151 152 break; 153 154 case 'left': 155 var percentage = intensity * -2; 156 157 intensity_css = { 158 transform: 'translate3d(' + percentage + '%, 0, 0)' 159 }; 160 161 break; 162 163 default: 164 var scale = ( 100 - intensity ) * 0.01; 165 166 intensity_css = { 167 transform: 'scale3d(' + scale + ', ' + scale + ', ' + scale + ')' 168 }; 169 break; 170 } 171 break; 172 173 case 'zoom': 174 var scale = ( 100 - intensity ) * 0.01; 175 176 switch( direction ) { 177 case 'top': 178 intensity_css = { 179 transform: 'scale3d(' + scale + ', ' + scale + ', ' + scale + ')' 180 }; 181 182 break; 183 184 case 'right': 185 intensity_css = { 186 transform: 'scale3d(' + scale + ', ' + scale + ', ' + scale + ')' 187 }; 188 189 break; 190 191 case 'bottom': 192 intensity_css = { 193 transform: 'scale3d(' + scale + ', ' + scale + ', ' + scale + ')' 194 }; 195 196 break; 197 198 case 'left': 199 intensity_css = { 200 transform: 'scale3d(' + scale + ', ' + scale + ', ' + scale + ')' 201 }; 202 203 break; 204 205 default: 206 intensity_css = { 207 transform: 'scale3d(' + scale + ', ' + scale + ', ' + scale + ')' 208 }; 209 break; 210 } 211 212 break; 213 214 case 'flip': 215 switch ( direction ) { 216 case 'right': 217 var degree = Math.ceil( ( 90 / 100 ) * intensity ); 218 219 intensity_css = { 220 transform: 'perspective(2000px) rotateY(' + degree+ 'deg)' 221 }; 222 break; 223 224 case 'left': 225 var degree = Math.ceil( ( 90 / 100 ) * intensity ) * -1; 226 227 intensity_css = { 228 transform: 'perspective(2000px) rotateY(' + degree+ 'deg)' 229 }; 230 break; 231 232 case 'top': 233 default: 234 var degree = Math.ceil( ( 90 / 100 ) * intensity ); 235 236 intensity_css = { 237 transform: 'perspective(2000px) rotateX(' + degree+ 'deg)' 238 }; 239 break; 240 241 case 'bottom': 242 var degree = Math.ceil( ( 90 / 100 ) * intensity ) * -1; 243 244 intensity_css = { 245 transform: 'perspective(2000px) rotateX(' + degree+ 'deg)' 246 }; 247 break; 248 } 249 250 break; 251 252 case 'fold': 253 switch( direction ) { 254 case 'top': 255 var degree = Math.ceil( ( 90 / 100 ) * intensity ) * -1; 256 257 intensity_css = { 258 transform: 'perspective(2000px) rotateX(' + degree + 'deg)' 259 }; 260 261 break; 262 case 'bottom': 263 var degree = Math.ceil( ( 90 / 100 ) * intensity ); 264 265 intensity_css = { 266 transform: 'perspective(2000px) rotateX(' + degree + 'deg)' 267 }; 268 269 break; 270 271 case 'left': 272 var degree = Math.ceil( ( 90 / 100 ) * intensity ); 273 274 intensity_css = { 275 transform: 'perspective(2000px) rotateY(' + degree + 'deg)' 276 }; 277 278 break; 279 case 'right': 280 default: 281 var degree = Math.ceil( ( 90 / 100 ) * intensity ) * -1; 282 283 intensity_css = { 284 transform: 'perspective(2000px) rotateY(' + degree + 'deg)' 285 }; 286 287 break; 288 } 289 290 break; 291 292 case 'roll': 293 switch( direction ) { 294 case 'right': 295 case 'bottom':
296 var degree = Math.ceil( ( 360 / 100 ) * intensity ) * -1; 297 298 intensity_css = { 299 transform: 'rotateZ(' + degree + 'deg)' 300 }; 301 302 break; 303 case 'top': 304 case 'left': 305 var degree = Math.ceil( ( 360 / 100 ) * intensity ); 306 307 intensity_css = { 308 transform: 'rotateZ(' + degree + 'deg)' 309 } 310 311 break; 312 default: 313 var degree = Math.ceil( ( 360 / 100 ) * intensity ); 314 315 intensity_css = { 316 transform: 'rotateZ(' + degree + 'deg)' 317 }; 318 319 break; 320 } 321 322 break; 323 } 324 325 return intensity_css; 326 } 327 328 window.custom_has_animation_data = function ( $element ) { 329 var has_animation = false; 330 331 if ( 'undefined' !== typeof et_animation_data && et_animation_data.length > 0 ) { 332 for ( var i = 0; i < et_animation_data.length; i++ ) { 333 var animation_entry = et_animation_data[i]; 334 335 if ( ! animation_entry.class ) { 336 continue; 337 } 338 339 if ( $element.hasClass( animation_entry.class ) ) { 340 has_animation = true; 341 break; 342 } 343 } 344 } 345 346 return has_animation; 347 } 348 349 window.custom_get_animation_classes = function() { 350 return [ 351 'et_animated', 'infinite', 'et-waypoint', 352 'fade', 'fadeTop', 'fadeRight', 'fadeBottom', 'fadeLeft', 353 'slide', 'slideTop', 'slideRight', 'slideBottom', 'slideLeft', 354 'bounce', 'bounceTop', 'bounceRight', 'bounceBottom', 'bounceLeft', 355 'zoom', 'zoomTop', 'zoomRight', 'zoomBottom', 'zoomLeft', 356 'flip', 'flipTop', 'flipRight', 'flipBottom', 'flipLeft', 357 'fold', 'foldTop', 'foldRight', 'foldBottom', 'foldLeft', 358 'roll', 'rollTop', 'rollRight', 'rollBottom', 'rollLeft' 359 ]; 360 } 361 362 window.custom_remove_animation = function( $element ) { 363 var animation_classes = custom_get_animation_classes(); 364 365 $element.removeClass( animation_classes.join(' ') ); 366 $element.css({ 367 'animation-delay' : '', 368 'animation-duration' : '', 369 'animation-timing-function' : '', 370 'opacity' : '', 371 'transform' : '' 372 }); 373 } 374 375 window.custom_remove_animation_data = function( $element ) { 376 var attr_name; 377 var data_attrs_to_remove = []; 378 var data_attrs = $element.get(0).attributes; 379 380 for ( var i = 0; i < data_attrs.length; i++ ) { 381 if ( 'data-animation-' === data_attrs[i].name.substring( 0, 15 ) ) { 382 data_attrs_to_remove.push( data_attrs[i].name ); 383 } 384 } 385 386 $.each( data_attrs_to_remove, function( index, attr_name ) { 387 $element.removeAttr( attr_name ); 388 } ); 389 }; 390})(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.