PageSourceSearch

https://www.capeb.fr/www/capeb/content/master/js/master.js?1790290582

js capeb.fr collected 2026-09-24 22:57:07 UTC 5,223 bytes, 164 lines download raw bytes

1/*********************************************************************************************
2/**	* Grand Central ajax call (everything goes in POST, but current GET is rerooted)
3 	* @author	[email protected]
4**#******************************************************************************************/
5(function($)
6{
7//	Here we go!
8	$.ajx = function(options, callbacks, element)
9	{
10	//	Use "plugin" to reference the current instance of the object
11		var plugin = this;
12	//	this will hold the merged default, and user-provided options
13		plugin.settings = {}
14		var $element = $(element), // reference to the jQuery version of DOM element
15		element = element;	// reference to the actual DOM element
16
17	//	Plugin's variables
18		var vars = {
19		}
20
21	//	The "constructor"
22		plugin.init = function()
23		{
24		//	the plugin's final properties are the merged default and user-provided options (if any)
25			plugin.settings = $.extend({}, vars, options);
26
27		//	Some vars
28			mime = (typeof(plugin.settings.mime) != 'undefined') ? plugin.settings.mime : 'html';
29			async = (typeof(plugin.settings.async) != 'undefined') ? plugin.settings.async : true;
30			url = SITE_URL+'/ajax.'+mime;
31
32		//	Reroute the _GET (currently declared in the master)
33			if (typeof(_GET) != 'undefined') plugin.settings._GET = _GET;
34
35		//	Call
36			$.ajax(
37			{
38				type:'POST',
39				url:url,
40				async:async,
41				context:this,
42				data:plugin.settings,
43			})
44			.done(function(html)
45			{
46			//	Return HTML
47				if ($element.length) $element.html(html);
48			//	Execute callback (make sure the callback is a function)
49				if ((typeof(callbacks) != 'undefined') && (typeof(callbacks['done']) == "function")) callbacks['done'].call($element, html);
50			})
51			.fail(function( jqXHR, textStatus )
52			{
53			//	console.log( "Request failed: " + textStatus );
54				console.log( "Request failed: " + jqXHR.responseText );
55			});
56
57		}
58
59	//	Fire up the plugin!
60		plugin.init();
61	}
62
63//	Add the plugin to the jQuery.fn object
64	$.fn.ajx = function(options, callbacks)
65	{
66		return this.each(function()
67		{
68		//	if (undefined == $(this).data('ajx'))
69		//	{
70				var plugin = new $.ajx(options, callbacks, this);
71				$(this).data('ajx', plugin);
72		//	}
73		});
74	}
75
76/*********************************************************************************************
77/**	* Lazyload
78 	* @author	@mvdandrieux
79**#******************************************************************************************/
80//	Get rid of the original image in javascript (leave it in the DOM for SEO)
81	$('[data-original]').attr('src', '').css('background-image', '');
82//	Lasyload !
83    $('[data-original]').lazyload(
84	{
85    	effect : "fadeIn"
86	});
87/*********************************************************************************************
88/**	* Interstate font windows
89 	* @author	@mvdandrieux
90**#******************************************************************************************/
91var windowsRegexp = new RegExp('Windows');
92var windowsOs = (window.navigator.appVersion && window.navigator.appVersion.match(windowsRegexp)) || (window.navigator.userAgent && window.navigator.userAgent.match(windowsRegexp));
93if (windowsOs) $('body').addClass('windows');
94
95/*********************************************************************************************
96/**	* External links and pdf open in new tab
97 	* @author	@mvdandrieux
98**#******************************************************************************************/
99
100$('a').each(function() {
101	var a = new RegExp(window.location.host);
102	var b = new RegExp('\.pdf$');
103	var c = new RegExp('mailto:');
104	var d = new RegExp('tel:');
105	if((!a.test(this.href) || b.test(this.href)) && !c.test(this.href) && !d.test(this.href)) {
106		$(this).click(function(event) {
107			event.preventDefault();
108			event.stopPropagation();
109			window.open(this.href, '_blank');
110		});
111	}
112});
113
114/****************************************************************************************************
115	capep popup async load
116****************************************************************************************************/
117  var $open = $('[data-open="capeb-popup"]');
118	$open.on('click', function() {
119		var $popup = $('.capeb-popup');
120		if ($popup.length == 0) {
121			$('body').addClass('spin')
122
123			var url = SITE_URL + '/api.html/v1/capebPopup'
124			$.ajax({
125				type: 'GET',
126				url: url,
127				success: function (data) {
128					$('body').append(data)
129					setTimeout(function() {
130						$('body').removeClass('spin')
131						$('body').addClass('overlayed')
132					}, 100)
133				}
134			});
135		}
136	});
137
138
139/****************************************************************************************************
140	data-scroll elements
141****************************************************************************************************/
142var $scrollTo = $('[data-scroll]');
143$scrollTo.on('click', function() {
144	var $this = $(this);
145	var target = $this.attr('data-scroll');
146	var $target = $('#' + target)[0];
147	var offsetTop;
148	if (window.innerWidth > 768) {
149		if ($('body').hasClass('scrolled')) {
150			offsetTop = $target.offsetTop - 145;
151		}
152		else {
153			offsetTop = $target.offsetTop - 235;
154		}
155	}
156	else {
157		offsetTop = $target.offsetTop + 75;
158	}
159  $('html, body').animate({
160    scrollTop: offsetTop
161  }, 500);
162});
163
164})( jQuery );

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.