PageSourceSearch

https://www.cooperativaciencia.cl/wp-content/themes/cooperativa/includes/js/galeria/gal.class.js

js cooperativaciencia.cl collected 2026-10-02 04:40:58 UTC 3,805 bytes, 148 lines download raw bytes

1/*CONSTRUCCION DE GALERIAS DESDE JSON + PLUGIN : OWL*/
2var Galerias = {
3
4_cantidadInicial: 0,
5_cantidadAumento: 0,
6_incremento: 5,
7_control: 1,
8_carga: "INICIO",
9_json_url: "",
10_DOM_objeto_id: "",
11_DOM_file_url: "",
12_DOM_sec: "",
13_DOM_tit: "",
14_PID: false,
15desdeURL: false,
16_tamano: '',
17_image: '',
18_isMobile: false,
19
20
21/* v 1.3 */
22_feed_type: "json",
23_object: "",
24_error_msg: "",
25_error: false,
26_plugins_:{'carousel':'owl-carousel'},
27_gtm_:'',
28_plugin:'',
29_ads_:{'status':0,'frecuency':5,'refresh':true},
30_classMobile :"galeria-mobile",
31
32setup: function(_object, _i, _dom_id) {
33console.log(_object);
34(_object) ? this._object = _object : null;
35(_i) ? this._cantidadAumento = _i : null;
36(_dom_id) ? this._DOM_objeto_id = _dom_id : null;
37(_object && _dom_id) ? this.init() : null;
38
39return false;
40},
41
42init: function() {
43this._PID = window.location.hash.substring(12);
44(this._PID) ? this._carga = "URL" : null;
45if (this._carga === "SCROLL") {
46this.cargaItemDesdeScroll();
47} else if (this._carga === "FULL") {
48this.cargaItemDesdeScroll();
49} else if ((this._carga === "URL") && (this._PID)) {
50this.getObject();
51} else {
52this.getObject();
53}
54return false;
55},
56
57getObject: function() {
58(this._object.length > 0) ? this.parseHtmlNodeFromJson(this._object) : this._error = true;
59
60
61},
62
63
64
65parseHtmlNodeFromJson: function(_obj) {
66let _htmlNode = "";
67let _contador = 1;
68let _hash = 'data-hash="&img=foto_' + _contador + '"';
69for (var i = 0; i < this._object.length; i++) {
70_htmlNode += '<figure  itemscope="" itemtype="http://schema.org/ImageObject" data-index="' + i + '" class"gallery-node" id="gallery-element-' + this._object[i].imagen.id + '">';
71_htmlNode += '<a href="javascript:void(0)" data-size="0x0" itemprop="contentUrl" target="_self"><picture> ';
72_htmlNode += '<div class="slide-number" id="slide-number">' + _contador + ' / ' +this._object.length+' <span id="numero_id"></span></div>';
73_htmlNode += '<img src=\"' + this._object[i].imagen.sizes.medium_large + '\" alt=\"' + this._object[i].imagen.caption + '\" title=\"' + this._object[i].imagen.caption + '\" itemprop="thumbnail">';
74_htmlNode += '</picture></a>';          
75_htmlNode += '<div class="credito-bajada-foto">' + this._object[i].imagen.caption + '</div>';          
76_htmlNode += '</figure>';
77_contador++;
78this._contador = _contador;
79}
80
81const __el = document.querySelector("#" + this._DOM_objeto_id);
82__el.innerHTML = _htmlNode;
83
84console.log(this.isMobile());
85(this.isMobile()) ? __el.classList.add(this._classMobile) : null; 
86
87/* Init Plugin */
88this.initPlugin('owl-carousel'); 
89
90return ;
91
92},
93
94
95
96initPlugin:function(_plugin){  
97    
98
99    this._plugin = $(".owl-carousel").owlCarousel({items:1,nav:true,URLhashListener:false,startPosition:false,dots:true});    
100    this._plugin.on('changed.owl.carousel',function(e){      
101        let control = Galerias.pushDatalayer();      
102    });
103},
104
105pushDatalayer: function(){ 
106    //this._gtm_._ga_url = this._gtm_._ga_url+"?img"+this._contador;
107    dataLayer.push(this._gtm_);
108    return false;
109},
110
111// Galerias 2024 
112
113
114detect: function(URL) {
115var image = new Image();
116image.src = URL;
117image.onload = function() {
118var result = image.width + 'x' + image.height;
119Galerias.recibe_tam(result);
120}
121;
122},
123
124recibe_tam: function(tam) {
125//console.log("recibe tam:"+tam);  
126this._tamano = tam;
127return this._tamano;
128},
129
130
131/* UTILS  */
132
133isMobile:function() { return /Mobi|Android|iPhone|iPad|iPod/i.test(navigator.userAgent);},
134
135crearItemDesdeURL: function() {
136this.desdeURL = (this._PID) ? true : false;
137return (this._PID) ? this.parseHtmlNodeFromJson() : null;
138},
139cargaItemDesdeScroll: function() {
140this._cantidadAumento = this._cantidadAumento + this._incremento;
141//indice = indice + (this._cantidadAumento ++);
142this.parseHtmlNodeFromJson();
143this._control++;
144return false;
145},
146errorCtrl: function(_e) {},
147};
148//Fin Clase

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.