PageSourceSearch

https://laopcion.com.mx/__export/sites/laopcion/desktop/scripts/Home.js?v=0.35002600%201790287422

js laopcion.com.mx collected 2026-09-24 22:03:53 UTC 31,962 bytes, 1,080 lines download raw bytes

1var hra_header = hra_header || {};
2
3hra_header.div = document.getElementById( "header" );
4hra_header.nav = document.getElementById( "nav" );
5hra_header.scrollTop = 0;
6hra_header.stickyLimit = hra_header.div.offsetTop + 400;
7hra_header.navigation = hra_header.div.querySelector('.header__subnav');
8hra_header.search = hra_header.div.querySelector('.header__search-form');
9hra_header.searchAction = hra_header.div.querySelector('.header__search-button');
10hra_header.searchButton = hra_header.div.querySelector('.hrafa__search_cool');
11
12hra_header.fn = {
13    start: function() {
14        hra_header.searchAction.addEventListener('click', hra_header.fn.onToggleSearch, false);
15
16        hra_header.navigation.addEventListener('click', hra_header.fn.onToggleSubMenu, false);
17
18        window.addEventListener('scroll', hra_header.fn.onScroll, false);
19
20        hra_header.fn.detectSite();
21    },
22    onToggleSearch: function() {
23        if (hra_header.search.classList.contains('header__search-form--active')) {
24            hra_header.search.classList.remove('header__search-form--active');
25        } else {
26            hra_header.search.classList.add('header__search-form--active');
27        }
28    },
29    onToggleSubMenu: function() {
30        if (hra_header.navigation.classList.contains('header__subnav--active')) {
31            hra_header.navigation.classList.remove('header__subnav--active');
32        } else {
33            hra_header.navigation.classList.add('header__subnav--active');
34        }
35    },
36    onScroll: function() {
37        hra_header.scrollTop = window.pageYOffset;
38
39		if( hra_header.scrollTop > hra_header.stickyLimit ){
40
41			setTimeout(function(){
42				hra_header.div.classList.add( "header--sticky" );
43				document.querySelector( "body" ).classList.add( "padding--for--sticky" );
44			}, 150);
45		} else {
46			if( hra_header.div.classList.contains( "header--sticky" ) ){
47				setTimeout(function(){
48					hra_header.div.classList.remove( "header--sticky" );
49					document.querySelector( "body" ).classList.remove( "padding--for--sticky" );
50				}, 150);
51			}
52		}
53    },
54    detectSite: function() {
55        var $_ul = hra_header.nav.querySelector('ul');
56        var $_li = $_ul.querySelectorAll('li');
57
58        $_li.forEach((e) => {
59            var $e = e;
60            var $_href = $e.querySelector('a').getAttribute('href');
61
62            if ($_href == window.location.href) {
63                if ( ! $e.querySelector('a').classList.contains('selected')) {
64                    $e.querySelector('a').classList.add('selected');
65                }
66            }
67        });
68
69    }
70};
71
72try {
73    hra_header.fn.start();
74} catch(e) {
75    console.error('HRA-Header-Error: '+e);
76}
77(function(){
78	'use strict';
79
80	var Buttons = null,
81		ShareUrl = window.location.href;
82
83	function __construct(){
84		Buttons = document.querySelectorAll( "[data-share]:not(.created)" );
85
86		for( var i = 0, k = Buttons.length; i < k; i++ ){
87			Buttons[i].addEventListener( "click", onClick.bind( Buttons[i] ), false );
88			Buttons[i].classList.add( "created" );
89		}
90	}
91
92	__construct.prototype = {
93		reinit: __construct
94	};
95
96	function onClick( event ){
97		event.preventDefault();
98		var _this = this;
99
100		ShareUrl = _this.dataset.url || window.location.href;
101
102		switch ( _this.dataset.share ) {
103			case 'facebook':
104				window.open('https://www.facebook.com/sharer/sharer.php?u=' + ShareUrl, '_blank', 'height=368,width=600,left=100,top=100,menubar=0' );
105			break;
106			case 'facebook_ui':
107				var FB = window.FB || undefined;
108				if( FB && FB.ui ){
109					FB.ui({
110						method: 'feed',
111						link: ShareUrl,
112						caption: encodeURIComponent( _this.dataset.caption || "" ),
113						picture: _this.dataset.picture || "",
114						name: encodeURIComponent( _this.dataset.title || "" ),
115						description: encodeURIComponent( _this.dataset.description || "" )
116					}, function(response){});
117				}else{
118					onClick.apply({
119						dataset: {
120							share: "facebook",
121							link: ShareUrl
122						}
123					})
124				}
125			break;
126			case 'twitter':
127				window.open('https://twitter.com/intent/tweet?text=No te pierdas esta noticia '+ encodeURIComponent( _this.dataset.title || "" ) + '&url=' + ShareUrl + '&via=laopcion&related=laopcion', '_blank', 'height=260,width=500,left=100,top=100,menubar=0');
128			break;
129			case 'copy':
130				setTimeout(function(){
131					onCopy.apply( _this );
132				}, 100);
133			break;
134			case 'simple_copy':
135				var btn = this;
136
137				setTimeout(function(){
138					ShareUrl = _this.dataset.url || window.location.href;
139					onSimpleCopy( ShareUrl );
140				}, 100);
141
142				btn.classList.remove( btn.dataset.firsticonclass );
143				btn.classList.add( btn.dataset.secondiconclass );
144
145				setTimeout(function(){
146					btn.classList.add( btn.dataset.firsticonclass );
147					btn.classList.remove( btn.dataset.secondiconclass );
148				}, 2000 );
149			break;
150		}
151	}
152
153	function onCopy(){
154		var parent = this.parentNode,
155			input = parent.querySelector( "input" );
156
157		if( parent.classList.contains( "active" ) ){
158			parent.classList.remove( "active" );
159		}else{
160			parent.classList.add( "active" );
161
162			if( input ){
163				input.select();
164				document.execCommand( 'copy' );
165			}else{
166				onSimpleCopy( this.dataset.url || window.location.href );
167			}
168		}
169	}
170
171	function onSimpleCopy( url ){
172		var input = document.createElement( "input" );
173		var inputID = "temp_"+(new Date().getTime());
174		input.id = inputID;
175		input.value = url;
176		document.body.appendChild( input );
177
178
179
180		if ( navigator.userAgent.match(/ipad|ipod|iphone/i) ) {
181			  var el = document.querySelector( "#"+inputID );
182			  var editable = el.contentEditable;
183			  var readOnly = el.readOnly;
184			  el.contentEditable = true;
185			  el.readOnly = false;
186			  var range = document.createRange();
187			  range.selectNodeContents(el);
188			  var sel = window.getSelection();
189			  sel.removeAllRanges();
190			  sel.addRange(range);
191			  el.setSelectionRange(0, 999999);
192			  el.contentEditable = editable;
193			el.readOnly = readOnly;
194		} else {
195			input.select();
196		}
197
198		document.execCommand( 'copy' );
199		setTimeout(function(){
200			document.body.removeChild( input );
201		}, 100);
202	}
203
204    window.Sharer = new __construct();
205})( window );
206(function( window ){
207	'use strict';
208
209    var int_inner = 0;
210	var Poll = function ( Poll, options ) {
211
212		var defaults = {
213			elements: {
214				button: "[data-pollitem]",
215				buttonSubmit: "[data-pollsubmit]",
216				totalVotes: "[data-totalvotes]",
217				toggle: {
218					toggleButton:  "[data-toggleresults]",
219					viewText: "Ver resultados",
220					hideText: "Ocultar resultados"
221				}
222			},
223			css: {
224				poll:{
225					generated: "poll--generated",
226					results: "poll--results",
227					loading: "poll--loading",
228				},
229				item: {
230					selected: "poll__item--selected",
231					bar: "poll__bar",
232					percent: "poll__percent",
233				},
234				submit: {
235					disabled: "poll__submit--disabled"
236				},
237				toggle: {
238					results: "poll__toggle"
239				}
240			},
241			onClickItem: function( poll, item ){},
242			onClickSubmit: function( poll, button ){},
243			onSuccess: function( poll ){},
244			onError: function( poll, error ){},
245			onLoading: function( poll ){},
246			onClose: function( poll ){},
247			onResults: function( poll, buttons, percents, winnerIndex ){},
248			onReset: function( poll ){}
249		},
250		_this = this,
251		Settings = extend( defaults, options ),
252		PollItemsSelected;
253
254		function extend() {
255			var extended = {};
256			var deep = false;
257			var i = 0;
258			var length = arguments.length;
259
260			if ( Object.prototype.toString.call( arguments[0] ) === '[object Boolean]' ) {
261				deep = arguments[0];
262				i++;
263			}
264
265			var merge = function (obj) {
266				for ( var prop in obj ) {
267					if ( Object.prototype.hasOwnProperty.call( obj, prop ) ) {
268						if ( deep && Object.prototype.toString.call(obj[prop]) === '[object Object]' ) {
269							extended[prop] = extend( true, extended[prop], obj[prop] );
270						} else {
271							extended[prop] = obj[prop];
272						}
273					}
274				}
275			};
276
277			for ( ; i < length; i++ ) {
278				var obj = arguments[i];
279				merge(obj);
280			}
281
282			return extended;
283
284		};
285
286		function getCookie( name ){
287			var name = name + "=",
288				cookies = document.cookie.split(';');
289
290			for( var i = 0, k = cookies.length; i < k; i++ ){
291				var cookie = cookies[ i ];
292				while( cookie.charAt( 0 ) == ' ' ){
293					cookie = cookie.substring( 1 );
294				}
295				if( cookie.indexOf( name ) == 0 ){
296					return cookie.substring( name.length, cookie.length );
297				}
298			}
299			return false;
300		}
301
302		function setCookie( name, value, days ){
303			var expires;
304			if( days ){
305				var date = new Date();
306				date.setTime( date.getTime() + ( days * 24 * 60 * 60 * 1000 ) );
307				expires = "; expires=" + date.toGMTString();
308			}else{
309				expires = "";
310			}
311			document.cookie = name + "=" + value + expires + "; path=/";
312		}
313
314		function isExpired(){
315			return new Date( Poll.dataset.close ) < new Date();
316		}
317
318		function isClosed () {
319			return getCookie( Poll.dataset.path ) || Poll.dataset.status == 'cerrada' || Poll.dataset.status == 'inactiva' || isExpired();
320		}
321
322		function initialize(){
323			if( Poll.classList.contains( Settings.css.poll.generated ) ){
324				return;
325			}
326
327			var botones = Poll.querySelectorAll( Settings.elements.button );
328			if( isClosed () ){
329
330				var cookiValue = getCookie( Poll.dataset.path );
331				if( cookiValue !== false ){
332					cookiValue = cookiValue.split( "," );
333
334					for( var i = 0, k = botones.length; i < k; i++ ){
335						if( cookiValue.indexOf( i+"" ) >= 0 ){
336							botones[ i ].classList.add( Settings.css.item.selected );
337						}
338					}
339					
340					var footer = document.querySelector('.poll__footer');
341					if( footer && int_inner == 0){
342						var  footerP = footer.querySelector('p');
343						if( footerP ){
344							footerP.innerHTML += '<br />Gracias por votar!';
345						}
346						int_inner++;
347					}
348				}
349
350				Settings.onClose.apply( _this, [ Poll ] );
351
352				return;
353			}
354
355			for( var i = 0, k = botones.length; i < k; i++ ){
356				botones[ i ].addEventListener( "click", onClickItem, false );
357			}
358			var submit = Poll.querySelectorAll( Settings.elements.buttonSubmit );
359			for( var i = 0, k = submit.length; i < k; i++ ){
360				submit[ i ].addEventListener( "click", onClickSubmit, false );
361			}
362
363
364			Poll.classList.add( Settings.css.poll.generated );
365		}
366
367		function onClickItem(){
368			if( Poll.classList.contains( Settings.css.poll.results ) ||
369				Poll.classList.contains( Settings.css.poll.loading ) ){
370				return;
371			}
372			this.classList[  this.classList.contains( Settings.css.item.selected )?"remove":"add" ]( Settings.css.item.selected );
373			Settings.onClickItem.apply( _this, [ Poll, this ] );
374		}
375
376		function onClickSubmit(){
377			Settings.onClickSubmit.apply( _this, [ Poll, this ] );
378		}
379
380		this.submitVote = function(){
381
382			PollItemsSelected = Poll.querySelectorAll( "."+Settings.css.item.selected );
383			if(PollItemsSelected.length <= 0) return;
384			var submit = Poll.querySelector( Settings.elements.buttonSubmit );
385
386			if( submit ){
387				submit.disabled = true;
388				submit.classList.add( Settings.css.submit.disabled );
389			}
390
391			Settings.onLoading( Poll );
392			Poll.classList.add( Settings.css.poll.loading );
393
394
395			var	params = "?path="+Poll.dataset.path,
396				cookieValue = [];
397
398			for (var i = 0; i < PollItemsSelected.length; i++) {
399				PollItemsSelected[i].dataset.votes = (PollItemsSelected[i].dataset.votes*1)+1;
400				params += "&answer="+PollItemsSelected[i].dataset.id;
401				params += "&date="+PollItemsSelected[i].dataset.date;
402				cookieValue.push( PollItemsSelected[i].dataset.id );
403			}
404
405			var totalPersonVotes = Poll.querySelectorAll( Settings.elements.totalVotes );
406			for (var i = 0; i < totalPersonVotes.length; i++) {
407				totalPersonVotes[i].innerHTML = parseInt( totalPersonVotes[i].dataset.totalvotes, 10 ) + 1;
408			};
409
410			var xhttp = new XMLHttpRequest();
411			xhttp.onreadystatechange = function() {
412				if ( this.readyState == 4 && this.status == 200 ) {
413					var response = JSON.parse( this.responseText );
414					if( response.result == "success" ){
415						Settings.onSuccess.apply( _this, [ Poll ]  );
416						setCookie( Poll.dataset.path, cookieValue.join( "," ), 30  );
417					}else{
418						Settings.onError.apply( _this, [ Poll, response.message ] );
419					}
420					Poll.classList.remove( Settings.css.poll.loading );
421				} else if( this.status != 200 && this.readyState == 4 ){
422					Settings.onError.apply( _this, [ Poll, this.status ] );
423					Poll.classList.remove( Settings.css.poll.loading );
424				}
425			};
426			xhttp.open( "GET", "/ajax/votePollJSON.html"+params, true );
427			xhttp.send();
428		}
429
430
431		this.onResults = function(){
432			var totalVotes = 0;
433			var votes = [];
434			var arrPercents = [];
435			var winnerIndex = 0;
436			var buttonList = Poll.querySelectorAll( Settings.elements.button );
437
438			for (var i = 0, curr; i < buttonList.length; i++) {
439				curr = buttonList[i];
440				totalVotes += +curr.dataset.votes;
441			};
442			for (var i = 0, curr, currpercent; i < buttonList.length; i++) {
443				curr = buttonList[i];
444
445				if( (curr.dataset.votes*1) == 0 ){
446					arrPercents.push( 0 );
447				}else{
448					arrPercents.push( parseInt( Math.floor( (curr.dataset.votes*1) / totalVotes * 100 ) ) );
449				}
450
451			};
452
453			winnerIndex = arrPercents.indexOf( Math.max.apply(null, arrPercents) );
454
455			var submit = Poll.querySelector( Settings.elements.buttonSubmit );
456			if( submit ){
457				submit.disabled = true;
458				submit.classList.add( Settings.css.submit.disabled );
459			}
460
461			Settings.onResults.apply( _this, [ Poll, buttonList, arrPercents, winnerIndex ] );
462			Poll.classList.add( Settings.css.poll.results );
463		}
464
465		initialize();
466	};
467
468
469	window.Poll = Poll;
470})( window );
471
472(function( window ){
473	'use strict';
474
475	var PollsHRA = function ( Selector, callback ) {
476		function init(){
477			var Polls = document.querySelectorAll( ".hra-poll" );
478
479			for( var i = 0, k = Polls.length; i < k; i++ ){
480				generate( Polls[ i ] );
481			}
482		}
483
484		function generate( Poll ){
485			if( Poll.classList.contains( "generated" ) ){
486				return;
487			}
488
489			var Path = Poll.dataset.path,
490				Date = Poll.dataset.date,
491				PollParams = "?path="+Path+"&date="+Date;
492
493			var xhttp = new XMLHttpRequest();
494			xhttp.onreadystatechange = function() {
495				if ( this.readyState == 4 && this.status == 200 ) {
496					Poll.innerHTML = this.responseText;
497
498					var PollType = Poll.querySelector( "[data-type]" );
499
500					if( PollType ){
501						checkAndTrigger( PollType.dataset.type );
502					}else{
503						console.error( "Error al cargar la encuesta", Poll );
504					}
505				}else if( this.readyState == 4 && this.status != 200 ){
506					console.error( "Error al cargar la encuesta", Path, Template );
507				}
508			};
509			xhttp.open( "GET", "/ajax/get_news_body_poll.html"+PollParams, true );
510			xhttp.send();
511
512			Poll.classList.add( "generated" );
513		}
514
515		function checkAndTrigger( Style ){
516			switch( Style ){
517				case "simple": PollSimple.reinit(); break;
518				case "versus": PollVersus.reinit(); break;
519			}
520		}
521
522		init();
523
524		this.reinit = init;
525	};
526
527
528	window.PollsHRA = new PollsHRA();
529})( window );
530
531(function( window, Poll ){
532	'use strict';
533
534	var PollSimple = null;
535
536	function __construct(){
537		PollSimple = document.querySelectorAll( ".poll--simple" );
538
539		for (var i = 0, k = PollSimple.length; i < k; i++){
540			new Poll( PollSimple[i], {
541				elements: {
542					button: ".poll__item",
543					buttonSubmit: ".poll__submit",
544					toggle: {
545						toggleButton: ".poll__toggle",
546						viewText: "Ver resultados",
547						hideText: "Ocultar resultados"
548					}
549				},
550				onClickItem: function( poll, item ){
551					if( poll.dataset.multiple != "true" ){
552						this.submitVote();
553					}
554				},
555				onClickSubmit: function( poll, item ){
556					this.submitVote();
557				},
558				onSuccess: function( poll ){
559					this.onResults();
560					var footer = poll.querySelector('.poll__footer');
561					if( footer ){
562						/*var votes = poll.querySelector('.poll__votes');
563						if( votes ){
564							votes.textContent = parseInt(votes.textContent) + 1;
565							var vote_kind = poll.querySelector('.poll__kind'),
566								ref_poll = (votes.textContent > 1) ? 'votaron' : 'votó',
567								people_poll = (votes.textContent > 1) ? 'personas' : 'persona',
568								vote_people = poll.querySelector('.poll__people');
569
570							vote_kind.innerHTML = ref_poll;
571							vote_people.innerHTML = people_poll;
572						}
573						footer.classList.remove('hide');*/
574
575						var  footerP = footer.querySelector('p');
576						if( footerP ){
577							footerP.innerHTML += '<br />Gracias por votar!';
578						}
579					}
580				},
581				onError: function( poll, error ){
582					this.onSuccess();
583				},
584				onLoading: function( poll ){},
585				onClose: function(){
586					this.onResults();
587				},
588				onResults: function( poll, buttons, percents, winnerIndex ){
589					buttons[ winnerIndex ].classList.add( 'poll__item--win' );
590					var total = 0;
591
592					for ( var i = 0; i < percents.length; i++ ) {
593						total += percents[i];
594					}
595
596					if ( total == 99 ){
597						percents[winnerIndex]++;
598					}
599
600					for ( var i = 0; i < percents.length; i++ ) {
601						buttons[ i ].querySelector('.poll__percent').textContent = percents[ i ] + "%";
602						buttons[ i ].querySelector('.poll__bar').style.transform = 'scaleX('+ (buttons[ i ].offsetWidth * percents[ i ] / 100)+' )';
603					}
604				},
605				onReset: function( poll ){
606					poll.querySelector( '.poll__item--win' ).classList.remove( 'poll__item--win' );
607					var voteButton = poll.querySelector( '.poll__submit' );
608					if( voteButton ) {
609						voteButton.classList.remove( 'poll__submit--disabled' );
610						voteButton.disabled = false;
611					}
612					var percents = poll.querySelectorAll( '.poll__percent' );
613					var bars = poll.querySelectorAll( '.poll__bar' );
614					for (var i = 0; i < percents.length; i++)
615						percents[ i ].textContent = '';
616					for (var i = 0; i < bars.length; i++)
617						bars[i].style.transform = 'scaleX(0)';
618				}
619			});
620
621			PollSimple[i].classList.add( "generated" );
622			
623			const buttons = document.querySelectorAll('.poll__items > button');
624            console.log(buttons);
625        
626            buttons.forEach(button => {
627                const imageUrl = button.getAttribute('data-bg');
628                console.log(imageUrl);
629                if (imageUrl) {
630                    button.style.position = 'relative';
631                    button.style.setProperty('--bg-image', `url('${imageUrl}')`);
632        
633                    // Si necesitas más lógica para manejar los pseudo-elementos, puedes agregarla aquí.
634                }
635            });
636		}
637	}
638
639	__construct.prototype = {
640		reinit: __construct
641	}
642
643	window.PollSimple = new __construct();
644
645})( window, Poll );
646
647(function( window, Poll ){
648	'use strict';
649
650	var PollVersus = null;
651
652	function __construct(){
653		PollVersus = document.querySelectorAll( ".poll--versus:not(.generated)" );
654
655		for (var i = 0, k = PollVersus.length; i < k; i++){
656			generate( PollVersus[ i ] );
657		}
658	}
659
660	function generate( CurrentPoll ){
661		new Poll( CurrentPoll, {
662			elements: {
663				button: ".poll__data",
664			},
665			onClickItem: function( poll, item ){
666				this.submitVote();
667			},
668			onSuccess: function( poll ){
669				this.onResults();
670			},
671			onError: function( poll, error ){
672				this.onResults();
673			},
674			onLoading: function( poll ){},
675			onClose: function(){
676				this.onResults();
677			},
678			onResults: function( poll, buttons, percents, winnerIndex ){
679				poll.querySelectorAll( ".poll__item" )[ winnerIndex ].classList.add( "poll__item--win" );
680				poll.querySelectorAll( ".poll__data" )[ winnerIndex ].classList.add( "poll__data--win" );
681
682				var total = 0;
683
684				for ( var i = 0; i < percents.length; i++ ) {
685					total += percents[i];
686				}
687
688				if ( total == 99 ){
689					percents[winnerIndex]++;
690				}
691
692				poll.querySelector( ".poll__item--right" ).style.width = percents[ 1 ]+"%";
693
694				for ( var i = 0; i < percents.length; i++ ) {
695					buttons[ i ].querySelector('.poll__percent').innerHTML = percents[ i ] + "<small>%</small>";
696				}
697			}
698		});
699
700		CurrentPoll.classList.add( "generated" );
701	}
702
703	__construct.prototype = {
704		reinit: __construct
705	}
706
707	window.PollVersus = new __construct();
708
709})( window, Poll );
710var hra_lazyload = hra_lazyload || {};
711
712hra_lazyload.images = [];
713hra_lazyload.config = { rootMargin: '50px 0px', threshold: 0.01 };
714hra_lazyload.observer = null;
715hra_lazyload.imagePath = null;
716
717hra_lazyload.fn = {
718	start: function() {
719		hra_lazyload.images = document.querySelectorAll('[data-lazyload]:not(.generated)');
720
721		if (hra_lazyload.images.length == 0) {
722			return;
723		}
724
725		if ('IntersectionObserver' in window) {
726			hra_lazyload.observer = new IntersectionObserver(hra_lazyload.fn.onIntersection, hra_lazyload.config);
727			for (var i = 0, k = hra_lazyload.images.length; i < k; i++) {
728				hra_lazyload.observer.observe(hra_lazyload.images[i]);
729			}
730		} else {
731			hra_lazyload.fn.load();
732		}
733	},
734	onIntersection: function(List) {
735		for (var i = 0, k = List.length, image; i < k; i++) {
736			image = List[i];
737
738			if (image.intersectionRatio > 0) {
739				hra_lazyload.observer.unobserve(image.target);
740				hra_lazyload.fn.set.apply(image.target);
741			}
742		}
743	},
744	set: function() {
745		hra_lazyload.imagePath = this.getAttribute('data-lazyload');
746		if (this.classList.contains('generated') || ! hra_lazyload.imagePath) {
747			return;
748		}
749
750		this[this.tagName !== "LINK" ? 'src' : 'href'] = hra_lazyload.imagePath;
751		this.removeAttribute('data-lazyload');
752		this.classList.add('generated');
753	},
754	load: function() {
755		for (var i = 0, k = hra_lazyload.images.length; i < k; i++) {
756			hra_lazyload.fn.set.apply(hra_lazyload.images[i])
757		}
758	}
759
760};
761
762try {
763	hra_lazyload.fn.start();
764} catch (e) {
765	console.error('HRA-LazyLoad-Error: '+ e);
766}
767(function( window ){
768	'use strict';
769
770	var Triggers              = null;
771	var isTemplateGenerated   = false;
772	var ModalTemplate         = null;
773	var ModalTemplateImage    = null;
774	var ModalTemplateSection  = null;
775	var ModalTemplateTitle    = null;
776	var ModalTemplateFacebook = null;
777	var ModalTemplateTwitter  = null;
778	var ModalTemplateEmail    = null;
779	var ModalTemplateWhatsapp = null;
780	var LastItemOpened        = null;
781
782	/**
783	 * Constructor
784	 */
785	function Constructor(){
786		Triggers = document.querySelectorAll( "[data-sharebtns]:not(.generated)" );
787
788		for( var i = 0, k = Triggers.length; i < k; i++ ){
789			Triggers[ i ].addEventListener( "click", onClick, false );
790			Triggers[ i ].classList.add( "generated" );
791		}
792	}
793
794	/**
795	 * On click
796	 */
797	function onClick() {
798		var _this = this;
799		if( navigator.share ){
800			navigator.share({
801				title: this.dataset.title,
802				url: this.dataset.url || window.location.href,
803			});
804		} else if ( ! isTemplateGenerated ){
805			createModalTemplate();
806			setTimeout(function(){
807				onClick.apply( _this );
808			}, 10);
809		} else {
810			openModal.apply( _this );
811		}
812	}
813	
814	function openModal(){
815		if ( this != LastItemOpened ) {
816			configModal( this.dataset );
817			LastItemOpened = this;
818		}
819		ModalTemplate.classList.add( 'sharemodal--open' );
820	}
821	
822	function closeModal(){
823		ModalTemplate.classList.remove( 'sharemodal--open' );
824	}
825	function getFacebookLink( url ) {
826		return "https://www.facebook.com/sharer/sharer.php?u=" + url + '?utm_source=mobile&utm_medium=facebook&utm_campaign=compatir';
827	}
828	function getTwitterLink( url, title ) {
829		return 'https://twitter.com/intent/tweet?text=' + encodeURIComponent( title ) + '&url=' + encodeURIComponent( url + '?utm_source=mobile&utm_medium=twitter&utm_campaign=compatir' ) + '&via=laopcion&related=laopcion';
830	}
831	function getWhatsappLink( url, title ) {
832		return 'https://api.whatsapp.com/send?text=' + encodeURIComponent( title + ' ' + url + '?utm_source=mobile&utm_medium=whatsapp&utm_campaign=compatir' );
833	}
834	function getEmailLink( url, title ) {
835		return 'mailto:?&body=' + encodeURIComponent( title + ' ' + url + '?utm_source=mobile&utm_medium=mail&utm_campaign=compatir' );
836	}
837	
838	function configModal( data ) {
839		data.url   = data.url || window.location.href;
840		data.title = data.title || document.title;
841		
842		ModalTemplateImage.style.backgroundImage = 'url('+data.image+')';
843		ModalTemplateSection.textContent         = data.section;
844		ModalTemplateTitle.textContent           = data.title;
845		ModalTemplateFacebook.href               = getFacebookLink( data.url );
846		ModalTemplateTwitter.href                = getTwitterLink( data.url, data.title );
847		ModalTemplateEmail.href                  = getEmailLink( data.url, data.title );
848		ModalTemplateWhatsapp.href               = getWhatsappLink( data.url, data.title );
849	}
850	
851	function createElement( type, attributes, children, onClick ) {
852		var el = document.createElement( type );
853		
854		for ( var key in attributes ) {
855			el.setAttribute( key, attributes[ key ] );
856		}
857		
858		if ( typeof onClick == "function" ){
859			el.addEventListener( 'click', onClick, false );
860		}
861		
862		if ( children ) {
863			for ( var i = 0, k = children.length; i < k; i++ ) {
864				if ( typeof children[i] === 'string' ) {
865					el.appendChild( document.createTextNode( children[i] ) );
866				} else {
867					el.appendChild( children[i] );
868				}
869			}
870		}
871		
872		return el;
873	}
874	
875	function createModalTemplate() {
876		
877		var sharemodal = document.createElement( "div" );
878		sharemodal.classList.add( "sharemodal" );
879
880		var sharemodal__shadow = document.createElement( "span" );
881		sharemodal__shadow.classList.add( "sharemodal__shadow" );
882		sharemodal__shadow.addEventListener( 'click', closeModal, false );	
883
884		var sharemodal__content = document.createElement( "span" );
885		sharemodal__content.classList.add( "sharemodal__content" );
886
887		var sharemodal__news = document.createElement( "div" );
888		sharemodal__news.classList.add( "sharemodal__news" );
889
890		var sharemodal__newsmedia = document.createElement( "figure" );
891		sharemodal__newsmedia.classList.add( "sharemodal__newsmedia" );
892
893		var sharemodal__newsdata = document.createElement( "div" );
894		sharemodal__newsdata.classList.add( "sharemodal__newsdata" );
895		
896		var sharemodal__newssection = document.createElement( "span" );
897		sharemodal__newssection.classList.add( "sharemodal__newssection" );
898
899		var sharemodal__newstitle = document.createElement( "span" );
900		sharemodal__newstitle.classList.add( "sharemodal__newstitle" );
901
902		var sharemodal__social = document.createElement( "div" );
903		sharemodal__social.classList.add( "sharemodal__social" );
904
905		var sharemodal__iconowhatsapp = document.createElement( "a" );
906		sharemodal__iconowhatsapp.classList.add( "hrafa", "hrafa__whatsapp" );
907		sharemodal__iconowhatsapp.setAttribute( "href", "#" );
908		sharemodal__iconowhatsapp.setAttribute( "target", "_blank" );
909		sharemodal__iconowhatsapp.setAttribute( "title", "Compartir por Whatsapp" );
910
911		var sharemodal__iconofacebook = document.createElement( "a" );
912		sharemodal__iconofacebook.classList.add( "hrafa", "hrafa__facebook" );
913		sharemodal__iconofacebook.setAttribute( "href", "#" );
914		sharemodal__iconofacebook.setAttribute( "target", "_blank" );
915		sharemodal__iconofacebook.setAttribute( "title", "Compartir por facebook" );
916
917		var sharemodal__iconotwitter = document.createElement( "a" );
918		sharemodal__iconotwitter.classList.add( "hrafa", "hrafa__twitter" );
919		sharemodal__iconotwitter.setAttribute( "href", "#" );
920		sharemodal__iconotwitter.setAttribute( "target", "_blank" );
921		sharemodal__iconotwitter.setAttribute( "title", "Compartir por twitter" );
922
923		var sharemodal__iconomail = document.createElement( "a" );
924		sharemodal__iconomail.classList.add( "hrafa", "hrafa__mail" );
925		sharemodal__iconomail.setAttribute( "href", "#" );
926		sharemodal__iconomail.setAttribute( "target", "_blank" );
927		sharemodal__iconomail.setAttribute( "title", "Compartir por mail" );
928	
929
930
931		sharemodal__social.appendChild( sharemodal__iconowhatsapp );
932		sharemodal__social.appendChild( sharemodal__iconofacebook );
933		sharemodal__social.appendChild( sharemodal__iconotwitter );
934		sharemodal__social.appendChild( sharemodal__iconomail );
935
936		sharemodal__newsdata.appendChild( sharemodal__newssection );
937		sharemodal__newsdata.appendChild( sharemodal__newstitle );
938		
939		sharemodal__news.appendChild( sharemodal__newsmedia );
940		sharemodal__news.appendChild( sharemodal__newsdata );
941
942		sharemodal__content.appendChild( sharemodal__news );
943		sharemodal__content.appendChild( sharemodal__social );
944
945		sharemodal.appendChild( sharemodal__shadow );
946		sharemodal.appendChild( sharemodal__content );
947
948		document.body.appendChild( sharemodal );
949
950
951
952		
953		ModalTemplate = document.querySelector( '.sharemodal' );
954		
955		ModalTemplateImage    = ModalTemplate.querySelector( '.sharemodal__newsmedia' );
956		ModalTemplateSection  = ModalTemplate.querySelector( '.sharemodal__newssection' );
957		ModalTemplateTitle    = ModalTemplate.querySelector( '.sharemodal__newstitle' );
958		ModalTemplateFacebook = ModalTemplate.querySelector( '.hrafa__facebook' );
959		ModalTemplateTwitter  = ModalTemplate.querySelector( '.hrafa__twitter' );
960		ModalTemplateEmail    = ModalTemplate.querySelector( '.hrafa__mail' );
961		ModalTemplateWhatsapp = ModalTemplate.querySelector( '.hrafa__whatsapp' );
962		
963		isTemplateGenerated = true;
964	}
965
966	/**
967	 * Prototypes
968	 */
969	Constructor.prototype = {
970		reinit: Constructor
971	};
972
973	/**
974	 * Export and Init
975	 */
976	 window.ShareMobilePage = new Constructor();
977
978})( window );var hra_suscribe = hra_suscribe || {};
979hra_suscribe.me = null;
980
981hra_suscribe.fn = {
982	start: function() {
983		hra_suscribe.me = document.querySelectorAll('.form__suscribe');
984
985		for (var i = 0, k = hra_suscribe.me.length; i < k; i++) {
986			if (hra_suscribe.me[i].classList.contains('generated')) {
987				return;
988			}
989
990			hra_suscribe.fn.generate(hra_suscribe.me[i]);
991		}
992	},
993	valid: function(email) {
994		return /^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/.test(email);
995	},
996	generate: function(Suscribe) {
997		Suscribe.addEventListener('submit', hra_suscribe.fn.onSubmit.bind(Suscribe), false);
998		Suscribe.classList.add('generated');
999	},
1000	onSubmit: function(e) {
1001		e.preventDefault();
1002
1003		var Form = this,
1004			Input = Form.querySelector('input');
1005
1006		if (hra_suscribe.fn.valid(Input.value)) {
1007			hra_suscribe.fn.send(Input.value, function(){
1008				hra_suscribe.fn.showSuccess(Form, Input);
1009			/*}, function() {
1010				hra_suscribe.fn.showError(Input.parentNode, 'Hubo un error inesperado, intenta nuevamente.');
1011			});*/
1012			}, Input.parentNode);
1013		} else {
1014			hra_suscribe.fn.showError(Input.parentNode, 'Debes ingresar un e-mail válido');
1015			return false;
1016		}
1017	},
1018	showSuccess: function(Form, Input) {
1019		Form.classList.add('suscribe--success');
1020		var Button = Form.querySelector( "button" );
1021		Button.parentNode.removeChild( Button );
1022		var HraFA = Form.querySelector( ".hrafa" );
1023		HraFA.parentNode.removeChild( HraFA );
1024		hra_suscribe.fn.hideError( Input );
1025		hra_suscribe.fn.addSuccess( Input.parentNode, "Ya te has suscrito a nuestro newsletter." );
1026		Input.parentNode.removeChild( Input );
1027	},
1028	showError: function(field, error) {
1029		hra_suscribe.fn.hideError( field );
1030		var Temp = document.createElement( "p" );
1031		Temp.classList.add( "hint", "error" );
1032		Temp.textContent = error;
1033
1034		field.appendChild( Temp );
1035	},
1036	hideError: function(field) {
1037		var Error = field.querySelector(".hint.error");
1038		if (Error){
1039			Error.parentNode.removeChild(Error);
1040		}
1041	},
1042	addSuccess: function(field, msg) {
1043		hra_suscribe.fn.hideError( field );
1044		var Temp = document.createElement( "p" );
1045		Temp.classList.add( "hint", "success" );
1046		Temp.style.color = "#fff";
1047		Temp.textContent = msg;
1048
1049		field.appendChild( Temp );
1050	},
1051	send: function(value, success_callback, error_callback) {
1052		var req = new XMLHttpRequest();
1053		req.onreadystatechange = function() {
1054			if ( req.readyState == 4 && req.status == 200) {
1055				var reqJson = JSON.parse( req.responseText );
1056				if( reqJson && reqJson.status == "ok" ){
1057					if( success_callback ){
1058						success_callback();
1059					}
1060				}else{
1061					/*if( error_callback ){
1062						error_callback();
1063					}*/
1064					
1065					hra_suscribe.fn.showError(error_callback, reqJson.message);
1066				}
1067			}
1068		};
1069		var k__rand = Math.floor(Math.random() * 1000000);
1070		req.open( "GET", "/ajax/suscribe_newsletter.html?email="+value+"&newsletterID=1&m="+k__rand );
1071		req.setRequestHeader( "Content-Type", "application/x-www-form-urlencoded" );
1072		req.send();
1073	}
1074}
1075
1076try {
1077	hra_suscribe.fn.start();
1078} catch (e) {
1079	console.error('HRA-Suscribe-Error '+e);
1080}

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.