<commit_before>/* Try to reload the image 5 times with a 1 second pause.
Do this by replacing to image source.
After 5 tries just display the alt text to contact Bynder. */

(function ($) {
	var retries = 5;
	$( document).ready(function(){
		$('.field-items .field-item img').one('error', function() {
			var $image = $(this);
			$image.attr('title', 'The image could not be retrieved, please contact Bynder Support');
			$image.attr('alt', 'The image could not be retrieved, please contact Bynder Support');
			if (typeof $image !== 'undefined') {
				if (typeof $image.attr('src') !== 'undefined') {
					$image.attr('src', retryToLoadImage($image));
				}
			}
		});
	});

	function retryToLoadImage($img) {
		var $newImg = $('<img>');
		var $src = ($img.attr('src')) || '';
		$newImg.attr('src', $src);
		$newImg.one('error', function() {
			window.setTimeout(function(){
				if (retries > 0) {
					retries--;
					retryToLoadImage($newImg);
				}
			}, 1000);
		});

		$newImg.one('load', function() {
			return $newImg.attr('src');
		});
	}
})(jQuery);<commit_msg>reload on the fly generated images automatical<commit_after>/* Try to reload the image with a 3 second interval.
Do this by replacing to image source. */
jQuery(document).ready(function() {
    jQuery('.field-items .field-item img').error(function() {
        $img = jQuery(this);
        setTimeout(function() {
            $img.attr('src', $img.attr('src'));
        }, 3000);
    });
});
{'fraction_non_alphanumeric': 0.18480492813141683, 'fraction_numerical': 0.009582477754962354, 'mean_word_length': 3.443768996960486, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4761748', 'n_tokens_mistral': 524, 'n_tokens_neox': 458, 'n_words': 132}