PageSourceSearch

https://www.journalventilo.fr/wp-content/plugins/wp-filebase/js/common.js?ver=3.4.4

js journalventilo.fr collected 2026-10-02 06:10:36 UTC 4,378 bytes, 262 lines download raw bytes

1var wpfbFileInfos = [];
2
3
4
5function wpfilebase_filedetails(id) {
6
7	id = 'wpfilebase-filedetails' + id;
8
9	if('undefined' != typeof jQuery && jQuery('#'+id).length > 0) { jQuery('#'+id).slideToggle(); }
10
11	else {
12
13		var dtls = document.getElementById('wpfilebase-filedetails' + id);
14
15		if(dtls) dtls.style.display = (dtls.style.display!='none') ? 'none' : 'block';
16
17	}
18
19	return false;	
20
21}
22
23
24
25function wpfb_getFileInfo(url)
26
27{
28
29	var i,fi,uesc=unescape(url);
30
31	for(i = 0; i < wpfbFileInfos.length; i++) {
32
33		fi = wpfbFileInfos[i];
34
35		if(fi.url == url || fi.url == uesc)	return fi;
36
37	}
38
39	try{// to get url by ajax request
40
41		// wpfbfid
42
43		fi = jQuery.parseJSON(jQuery.ajax({url:wpfbConf.ajurl,data:{wpfb_action:"fileinfo",url:uesc},async:false}).responseText);
44
45		if(typeof(fi) == 'object' && fi.id > 0) {
46
47			wpfbFileInfos.push(fi);
48
49			return fi;		
50
51		}
52
53	}
54
55	catch(err){}	
56
57	return null;
58
59}
60
61
62
63function wpfb_ondownload(url) {
64
65	if(typeof(url) == 'object') url = url.data;
66
67	if(typeof(wpfb_ondl) == 'function' && 'string' == typeof(url) && url.length < 1024) { // on img load fail, url is the response body (404 ERROR page)??
68
69		var fi = wpfb_getFileInfo(url);
70
71		if(fi != null) {
72
73			try { wpfb_ondl(fi.id,'/'+wpfbConf.db+'/'+fi.path,fi.path); }
74
75			catch(err){}
76
77		}
78
79	}
80
81}
82
83
84
85function wpfb_onclick(event) {
86
87	wpfb_ondownload(event);	
88
89	if(wpfbConf.hl) { window.location=event.data; return false; } // hide links
90
91	return true;
92
93}
94
95
96
97function wpfb_processlink(index, el) {
98
99	var url=el.getAttribute('href'),i;
100
101	el = jQuery(el);
102
103	if((i=url.indexOf('#')) > 0) {
104
105		var fid = url.substr(i);
106
107		fid = fid.substr(fid.lastIndexOf('-')+1);
108
109		el.attr('wpfbfid', fid);
110
111		url = url.substr(0, i); // remove hash, not actually needed
112
113	}
114
115	el.unbind('click').click(url, wpfb_onclick); // bind onclick
116
117	if(wpfbConf.cm && typeof(wpfb_addContextMenu) == 'function') wpfb_addContextMenu(el, url);
118
119	if(wpfbConf.hl) url = 'javascript:;';
120
121	el.attr('href', url);
122
123}
124
125
126
127function wpfb_processimg(index, el)
128
129{
130
131	jQuery(el).unbind('load').load(el.src, wpfb_ondownload);
132
133}
134
135
136
137function wpfb_setupLinks() {
138
139	var i,els,h,rePl,reQs,reHs;
140
141	if(('undefined' === typeof wpfbConf) || !wpfbConf.ql) return;
142
143
144
145	reQs = /\?wpfb_dl=([0-9]+)$/;
146
147	reHs = /#wpfb-file-([0-9]+)$/;
148
149	rePl = new RegExp('^'+wpfbConf.hu+wpfbConf.db+'/');	
150
151	
152
153	els = document.getElementsByTagName('a');
154
155	for(i=0;i<els.length;i++){
156
157		h = els[i].getAttribute('href');
158
159		if(h && (h.search(reQs)>0 || h.search(reHs)>0 || h.search(rePl)==0)) {
160
161			if('undefined' != typeof els[i].wpfbProcessed) continue;
162
163			els[i].wpfbProcessed = true;
164
165			wpfb_processlink(i,els[i]);
166
167		}
168
169	}
170
171	
172
173	els = document.getElementsByTagName('img');
174
175	for(i=0;i<els.length;i++){
176
177		h = els[i].getAttribute('src');
178
179		if(h && (h.search(reQs)>0 || h.search(rePl)==0)) {
180
181			if('undefined' != typeof els[i].wpfbProcessed) continue;
182
183			els[i].wpfbProcessed = true;
184
185			wpfb_processimg(i,els[i]);
186
187		}
188
189	}
190
191}
192
193
194
195if(typeof(jQuery) !== 'undefined')	jQuery(document).ready(wpfb_setupLinks);
196
197else if (window.addEventListener)  window.addEventListener('load', wpfb_setupLinks, false);
198
199else if (window.attachEvent) window.attachEvent('onload', wpfb_setupLinks);
200
201else setTimeout(wpfb_setupLinks, 500);
202
203
204
205/*
206
207var wpfb_setupLinksTimer = -1; 
208
209document.addEventListener("DOMSubtreeModified", function(e) {
210
211	if(wpfb_setupLinksTimer !== -1)
212
213		clearTimeout(wpfb_setupLinksTimer);
214
215	wpfb_setupLinksTimer = setTimeout(function() {
216
217		wpfb_setupLinks();
218
219		wpfb_setupLinksTimer = -1;
220
221	}, 300);
222
223}, false);
224
225*/
226
227setInterval(wpfb_setupLinks, 500);
228
229
230
231function wpfb_setupFormAutoSave(form)
232
233{
234
235	var theForm = jQuery(form);
236
237	theForm.dis
238
239	var form_name = theForm.attr('name');
240
241	var settingName = form_name ? form_name :'batch_presets';
242
243	// serialization (save/load)
244
245	theForm.find('*[name^="file_"]').prop('disabled',true).change(function(){
246
247		var formData = theForm.serialize().replace(/file_user_roles%5B%5D=.+?&/gi,''); // fix: remove user roles, serialization does not work properly!
248
249		jQuery.ajax({url: wpfbConf.ajurl, type:"POST", data:{wpfb_action:'set-user-setting',name:settingName,value: formData }});
250
251	});	
252
253	jQuery.ajax({url: wpfbConf.ajurl, data:{wpfb_action:'get-user-setting',name:settingName}, dataType:'json', success: (function(data){
254
255			theForm.find('*[name^="file_"]').prop('disabled', false);
256
257		if(data) theForm.deserialize(data);
258
259	})});
260
261}
262

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.