PageSourceSearch

https://www.visitfuerteventura.com/modules/custom/hic_header/js/hic_header_loader.js?tm9kk1

js visitfuerteventura.com collected 2026-10-02 11:35:18 UTC 5,137 bytes, 120 lines download raw bytes

1(function($, once) {
2
3    var pageHeaderVideos = $.makeArray($('div[data-video_dynamic="true"]').map(function() {
4		return {
5			nid: $(this).data('nid'),
6			videoid: $(this).data('videoid'),
7			customization_exists: $(this).data('customizationexists'),
8			loaded: false
9		};
10	}));
11
12	window.addEventListener('resize', () => {
13		var unloadedVideos = pageHeaderVideos.filter(v => v.loaded == false);
14		if (typeof unloadedVideos !== 'undefined' ) {
15			Drupal.attachBehaviors();
16		}
17	});
18
19    Drupal.behaviors.loadHeaderAjax = {
20        attach: function() {
21            var attempt = 0;
22            var maxAttempts = 50;
23            var get_blocks = null;
24            var container_customization_exists =  document.getElementById('video_dynamic').dataset.customizationexists;
25            var get_blocks_id = setInterval(
26                function() {
27                    setBottomPosition();
28                    get_blocks = getCookie('dmp-get-blocks');
29                    if ((get_blocks !== null && get_blocks === '1') || container_customization_exists !== 1) {
30                        var loader = function() {
31                            var container = $(this);
32                            var container_nid = container.data('nid');
33                            var container_typedinamic = container.data('typedinamic');
34                            var container_video_id = container.data('videoid');
35                            var url = window.location.href;
36                            var isVideoLoaded =  pageHeaderVideos.filter(v => v.videoid === container_video_id).shift().loaded;
37							var width = window.innerWidth > 0 ? window.innerWidth : screen.width;
38							if (!isVideoLoaded && ((width > 992 && container_video_id.endsWith("desktop")) || (width <= 992 && container_video_id.endsWith("mobile")))) {
39
40								$.post({
41									url: Drupal.url('hic-header-video-loader'),
42									data: JSON.stringify({
43										nid: container_nid,
44										videoid: container_video_id,
45                                        typedinamic: container_typedinamic,
46                                        url: url
47									}),
48									contentType: 'application/json',
49									success: function(data) {
50										if (container.find("article").length == 0)
51											container.append(data);
52										pageHeaderVideos.filter(function(block) {
53											return block.videoid === container_video_id;
54										}).shift().loaded = true;
55										Drupal.attachBehaviors();
56									},
57									error: function(error) {
58									}
59								})
60							}
61                        };
62                        $('div[data-video_dynamic="true"]').each(loader);
63                        var scrollFilter = function(block) {
64                            return block.loaded === false &&
65                                $('div[data-videoid="' + block.videoid + '"]').visible(true);
66                        };
67
68                        window.addEventListener('scroll', function (context) {
69                            const videoElements = pageHeaderVideos.filter(scrollFilter).map(function () {
70                                return document.querySelector(`div[data-videoid="${this.videoid}"]`);
71                            }).filter(element => element !== null);
72
73                            const elements = once('customBehavior', videoElements, context);
74                            elements.forEach(function (element) {
75                                loader.call(element);
76                            });
77                         });
78                        clearInterval(get_blocks_id);
79                    } else {
80                        //meter aqui la aceptacion de cookies
81                        cookie_agreed = getCookie('cookie-agreed');
82                        if (cookie_agreed == '2') {
83                            cookie_agreed_categories = getCookie('cookie-agreed-categories');
84                            if (attempt < maxAttempts) {
85                                attempt++;
86                            } else {
87                                // the execution goes on but we have not got a new campaign...
88                                clearInterval(get_blocks_id);
89                            }
90                        }
91                    }
92                }, 50);
93        }
94    };
95
96    function getCookie(name) {
97        var nameEQ = name + "=";
98        var ca = document.cookie.split(';');
99        for (var i = 0; i < ca.length; i++) {
100            var c = ca[i];
101            while (c.charAt(0) == ' ')
102                c = c.substring(1, c.length);
103            if (c.indexOf(nameEQ) == 0)
104                return c.substring(nameEQ.length, c.length);
105        }
106        return null;
107    }
108
109    function setBottomPosition() {
110        let htmlStyles = window.getComputedStyle(document.querySelector("html"));
111        let heightModal = htmlStyles.getPropertyValue("--heightDialog");
112        if ($('#sliding-popup').length > 0) {
113            let modalH = $('.eu-cookie-compliance-content').outerHeight() + 'px';
114            document.documentElement.style.setProperty("--heightDialog", modalH);
115        }
116
117    }
118
119
120})(jQuery, once);

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.