PageSourceSearch

https://ine.es/menus/_b/js/social.js

js ine.es collected 2026-09-24 07:27:10 UTC 6,990 bytes, 213 lines download raw bytes

1var social_win_width=screen.width*0.75;
2var social_win_height=screen.height*0.75;
3var social_win_top=(screen.height-social_win_height)/2
4var social_win_left=(screen.width-social_win_width)/2
5
6var social_window_param="resizable=1, titlebar=0, scrollbars=1, status=0, menubar=0, toolbar=0, location=0"
7      + ", left=" +  social_win_left
8      + ", top=" +  social_win_top
9      + ", height=" +  social_win_height
10      + ", width=" +  social_win_width
11
12function shareMail(evnt){
13	try{
14	  evnt.target.closest(".dropdown-menu").previousElementSibling.classList.remove("active")
15
16		/*cc=,bcc=,subject=,body=*/
17	  url="mailto:"
18
19	  msg=""
20	  if (typeof data_social_text != 'undefined')
21		  msg += data_social_text;
22		
23	  else if (typeof evnt.target.getAttribute("data-social-text") != 'undefined')
24		  	msg += evnt.target.getAttribute("data-social-text");
25
26  	  msg += ' - ' + document.head.querySelector("title").innerText;
27	  url += "?subject=" + window.encodeURIComponent(msg)
28
29	  msg=  selectUrl(evnt);//window.location.href ;
30	  url+="&body=" +window.encodeURIComponent(msg)
31
32	  window.open(url, evnt.target.target, social_window_param);
33	}catch(err){}
34	return false;
35}
36
37function shareWhatsapp(evnt){
38	try{
39	  evnt.target.closest(".dropdown-menu").previousElementSibling.classList.remove("active")
40
41	  url="https://api.whatsapp.com/send?text=";
42	  msg="";
43	  if (typeof data_social_text != 'undefined')
44		  msg+=data_social_text;
45	  else if (typeof evnt.target.getAttribute("data-social-text") != 'undefined')
46		  	msg+=evnt.target.getAttribute("data-social-text");
47
48	  if (msg.indexOf(document.head.querySelector("title").innerText)<0)
49		  msg +=  ' - ' + document.head.querySelector("title").innerText;
50	  msg+= "\n" + selectUrl(evnt);//window.location.href ;
51	  win=window.open(url + window.encodeURIComponent(msg), evnt.target.target, social_window_param);
52	  win.focus();
53	}catch(err){}
54	return false;
55}
56
57function shareTwitter(evnt){
58	try{
59	  evnt.target.closest(".dropdown-menu").previousElementSibling.classList.remove("active")
60
61	  aux=evnt.target.getAttribute("data-social-text");
62	  url="https://twitter.com/intent/tweet"
63	  if (typeof data_social_text != 'undefined')
64		  url+="?text=" + data_social_text;
65	  else if (typeof aux != 'undefined'){
66		  	url+="?text=" + encodeURIComponent(aux)  ;
67			titulo=document.head.querySelector("title").innerText;
68	  		if (aux.indexOf(titulo)<0){
69				titulo=encodeURIComponent( ' - ' + titulo);
70	  			url+= titulo;
71			}
72		}else
73	  		url+="?text=" + encodeURIComponent(document.head.querySelector("title").innerText);
74	  if (typeof data_social_hashtags != 'undefined')
75		  url+="&hashtags=" + data_social_hashtags;
76	  else if (evnt.target.getAttribute("data-social-hashtags"))
77		  	url+="&hashtags="  + evnt.target.getAttribute("data-social-hashtags");
78
79	  if (typeof data_social_via != 'undefined')
80		  url+="&via=" + data_social_via;
81	  else if (evnt.target.getAttribute("data-social-via"))
82		  url+="&via="+ evnt.target.getAttribute("data-social-via")
83
84	  if (typeof data_social_related != 'undefined')
85		  url+="&related=" + data_social_related;
86	  else if (evnt.target.getAttribute("data-social-related"))
87	    url+="&related="+ evnt.target.getAttribute("data-social-related")
88
89	  url+="&url=" + selectUrl(evnt);//window.location.href ;
90	  win=window.open(url, evnt.target.target, social_window_param);
91	  win.focus();
92	}catch(err){}
93	return false;
94}
95
96function shareFacebook(evnt){
97	try{
98	  evnt.target.closest(".dropdown-menu").previousElementSibling.classList.remove("active")
99
100	  url="https://www.facebook.com/sharer/sharer.php";
101	  msg= "?u=" +  window.encodeURIComponent(selectUrl(evnt));//window.location.href ;
102	  if (typeof data_social_text != 'undefined')
103		  msg+="&title=" + data_social_text;
104	  else if (typeof evnt.target.getAttribute("data-social-text") != 'undefined')
105		  msg+="&title=" + encodeURIComponent(evnt.target.getAttribute("data-social-text"))  + encodeURIComponent(document.head.querySelector("title").innerText);
106	  else
107		  msg+="&title=" + encodeURIComponent( ' - ' + document.head.querySelector("title").innerText);
108	  win=window.open(url +msg, evnt.target.target, social_window_param);
109	  win.focus();
110	}catch(err){}
111	return false;
112}
113
114function shareLinkedin(evnt){
115	try{
116	  evnt.target.closest(".dropdown-menu").previousElementSibling.classList.remove("active")
117
118	  url="https://www.linkedin.com/sharing/share-offsite/?";
119	  msg= "url=" +  window.encodeURIComponent(selectUrl(evnt));//window.location.href) ;
120	  win=window.open(url + msg, evnt.target.target, social_window_param);
121	  win.focus();
122	}catch(err){}
123	return false;
124}
125
126function shareClipboard(evnt){
127	var copyText =null;
128	try{
129		  evnt.target.closest(".dropdown-menu").previousElementSibling.classList.remove("active")
130
131		  copyText = document.createElement('input');
132
133		  copyText.textContent = selectUrl(evnt);//window.location.href;
134		  copyText.value=selectUrl(evnt);//window.location.href;
135		  copyText.style.position = "absolute";
136		  copyText.style.left = "-9999999px";
137		  copyText.style.top = "0";
138          document.body.appendChild(copyText)
139           copyText.focus();
140		  copyText.select();
141		  copyText.setSelectionRange(0, copyText.value.length);
142
143		  document.execCommand("copy");
144		  alerta("Texto copiado", "&iexcl;Atenci&oacute;n&excl;")
145	}catch(err){}
146
147	copyText.remove();
148	return false;
149}
150
151function shortUrl_click(evnt){
152	evnt.preventDefault();
153	shortUrl(evnt);
154}
155
156ine.isReady(function () {
157	let stwi = document.getElementById("shareTwitter");
158	let swha = document.getElementById("shareWhatsapp");
159	let sfac = document.getElementById("shareFacebook");
160	let slin = document.getElementById("shareLinkedin");
161	let smai = document.getElementById("shareMail");
162	let scli = document.getElementById("shareClipboard");
163	if(stwi){
164		stwi.addEventListener("click", function (e) {
165			e.preventDefault();
166			shortUrl(e, shareTwitter)
167		});
168	}
169	if(swha){
170		document.getElementById("shareWhatsapp").addEventListener("click", function (e) {
171			e.preventDefault();
172			shortUrl(e, shareWhatsapp)
173		});
174	}
175	if(sfac){
176		document.getElementById("shareFacebook").addEventListener("click", function (e) {
177			e.preventDefault();
178			shortUrl(e, shareFacebook)
179		});
180	}
181	if(slin){
182		document.getElementById("shareLinkedin").addEventListener("click", function (e) {
183			e.preventDefault();
184			shortUrl(e, shareLinkedin)
185		});
186	}
187	if(smai){
188		document.getElementById("shareMail").addEventListener("click", function (e) {
189			e.preventDefault();
190			shortUrl(e, shareMail)
191		});
192	}
193	if(scli){
194		document.getElementById("shareClipboard").addEventListener("click", function (e) {
195			e.preventDefault();
196			shortUrl(e, shareClipboard);
197		});
198	}
199
200	if(!_NO_CAB_){
201		['click', 'keydown'].forEach(function(evtname){
202			document.body.addEventListener(evtname, function(e){
203				if(!e.target.closest(".main-menu .secondList") || e.keyCode == 27){
204					document.getElementById("shareBtn").classList.remove("active")
205				}
206			}, {passive: true })
207		});
208	}
209});
210
211
212
213

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.