PageSourceSearch

https://reservasc.portosantoline.pt/pt/wp-content/themes/base/js/cw-public.js?ver=1.0.28925

js portosantoline.pt collected 2026-10-02 07:20:25 UTC 4,046 bytes, 131 lines download raw bytes

1(function($){
2
3	function parseURL(url) {
4		var a = document.createElement('a');
5		a.href = url;
6		return {
7			source: url,
8			protocol: a.protocol.replace(':', ''),
9			host: a.hostname,
10			port: a.port,
11			query: a.search,
12			params: (function () {
13				var ret = {},
14					seg = a.search.replace(/^\?/, '').split('&'),
15					len = seg.length,
16					i = 0,
17					s;
18				for (; i < len; i++) {
19					if (!seg[i]) {
20						continue;
21					}
22					s = seg[i].split('=');
23					ret[s[0]] = s[1];
24				}
25				return ret;
26			})(),
27			file: (a.pathname.match(/\/([^\/?#]+)$/i) || [, ''])[1],
28			hash: a.hash.replace('#', ''),
29			path: a.pathname.replace(/^([^\/])/, '/$1'),
30			relative: (a.href.match(/tps?:\/\/[^\/]+(.+)/) || [, ''])[1],
31			segments: a.pathname.replace(/^\//, '').split('/')
32		};
33	}
34
35	$(function(){
36		/**
37		 * Slide toggle widget area with sliding animation specified in
38		 * field open-out data property
39		 * @param field - widget area icon
40		 */
41		function slide_widget_area( field ) {
42			var widget_container = field.closest('.cw-widget-area-container');
43			var widget_area = $('.cw-widget-area', widget_container);
44			var open_out_animation = field.data('open-out');
45			var duration = 800;
46
47			widget_area.toggle('slide', {
48				direction: open_out_animation,
49			}, duration);
50		}
51		$('body')
52		.on('click', '.cw-accept-cookies', function() {
53			var now = new Date();
54			var expires = new Date(parseInt(cw_base_theme_public.accept_cookies_expires));
55			var url = parseURL(cw_base_theme_public.accept_cookies_domain);
56			var val = "path=/; expires=" + expires.toUTCString() + '; domain=' + url.host;
57            document.cookie = cw_base_theme_public.accept_cookies_name + '=;' + val;
58				$('.cw-cookie-warning').addClass('hide');
59				
60		})
61		.on('click', '#nav-menu-toggle', function() {
62			$(this).toggleClass('open');
63			$('#main').toggleClass('cw-rwd-small-hidden');
64			$('#sub.cw-rwd-small').toggleClass('cw-rwd-small-hidden');
65			$('#top.cw-rwd-small').toggleClass('cw-rwd-small-hidden');
66		})
67		.on('click', '.cw-widget-area-icon', function() {
68			slide_widget_area( $(this) );
69		});
70
71		$('.spot')
72		/**
73	 	* Function for Closing a spot 
74	 	*/
75		.on('click', '.close', function(e) {
76			var _this = this;
77			var args = {
78				'cw-spot-close': $(this).data('close-id')
79			};
80			$(_this).closest('.spot').fadeToggle();
81			$.post('?', args)
82				.success(function() {
83				// success function
84			});
85		e.preventDefault();
86		});
87		
88		// Ugly hack to fix problem with åäö in search form
89		$('input[id="s"]').each(function(){ // yes, input[id="s"].  There can be several.  if we use #s we only get the first 
90			$(this).val( decodeURIComponent($(this).val()) ); 
91		});
92
93		$(document).foundation();
94	});
95})(jQuery);
96
97/**
98 * Function to show error message.
99 * Can be overriden by defining a cw_show_error_customized in a child plugin
100 * 
101 * @param message string The error message to show
102 * @param context string | element | jQuery context in which the error was generated.
103 */
104function cw_show_error(message, context){
105	if( typeof cw_show_error_customized !== 'undefined' && jQuery.isFunction(cw_show_error_customized) ){
106		cw_show_error_customized(message, context);
107	} else {
108		var message_html = jQuery('<div/>') // create a container
109			.html(message) // set the contents from the message
110			.find('script') // find script blocks
111			.remove() // and remove them
112			.end(); // back to the original collection but without script blocks
113		// Now get just the text from there
114		alert( message_html.text() );
115	}
116}
117
118/**
119 * Function to show success message.
120 * Can be overriden by defining a cw_show_success_customized in a child plugin
121 * 
122 * @param message string The message to show
123 * @param context string | element | jQuery context in which the message was generated.
124 */
125function cw_show_success(message, context){
126	if( typeof cw_show_success_customized !== 'undefined' && jQuery.isFunction(cw_show_success_customized) ){
127		cw_show_success_customized(message, context);
128	} else {
129		alert(jQuery('<div>' + message + '</div>').text());		
130	}
131}

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.