PageSourceSearch

https://ouarzazate.city/wp-content/plugins/ultimate-maps-by-supsystic/js/core.js

js ouarzazate.city collected 2026-10-02 12:47:13 UTC 13,013 bytes, 382 lines download raw bytes

1if(typeof(UMS_DATA) == 'undefined')
2	var UMS_DATA = {};
3if(isNumber(UMS_DATA.animationSpeed)) 
4    UMS_DATA.animationSpeed = parseInt(UMS_DATA.animationSpeed);
5else if(jQuery.inArray(UMS_DATA.animationSpeed, ['fast', 'slow']) == -1)
6    UMS_DATA.animationSpeed = 'fast';
7UMS_DATA.showSubscreenOnCenter = parseInt(UMS_DATA.showSubscreenOnCenter);
8var sdLoaderImgUms = '<img src="'+ UMS_DATA.loader+ '" />';
9var g_umsAnimationSpeed = 300;
10
11jQuery.fn.showLoaderUms = function() {
12    return jQuery(this).html( sdLoaderImgUms );
13};
14jQuery.fn.appendLoaderUms = function() {
15    jQuery(this).append( sdLoaderImgUms );
16};
17jQuery.sendFormUms = function(params) {
18	// Any html element can be used here
19	return jQuery('<br />').sendFormUms(params);
20};
21/**
22 * Send form or just data to server by ajax and route response
23 * @param string params.fid form element ID, if empty - current element will be used
24 * @param string params.msgElID element ID to store result messages, if empty - element with ID "msg" will be used. Can be "noMessages" to not use this feature
25 * @param function params.onSuccess funstion to do after success receive response. Be advised - "success" means that ajax response will be success
26 * @param array params.data data to send if You don't want to send Your form data, will be set instead of all form data
27 * @param array params.appendData data to append to sending request. In contrast to params.data will not erase form data
28 * @param string params.inputsWraper element ID for inputs wraper, will be used if it is not a form
29 * @param string params.clearMsg clear msg element after receive data, if is number - will use it to set time for clearing, else - if true - will clear msg element after 5 seconds
30 */
31jQuery.fn.sendFormUms = function(params) {
32    var form = null;
33    if(!params)
34        params = {fid: false, msgElID: false, onSuccess: false};
35
36    if(params.fid)
37        form = jQuery('#'+ fid);
38    else
39        form = jQuery(this);
40    
41    /* This method can be used not only from form data sending, it can be used just to send some data and fill in response msg or errors*/
42    var sentFromForm = (jQuery(form).tagName() == 'FORM');
43    var data = new Array();
44    if(params.data)
45        data = params.data;
46    else if(sentFromForm)
47        data = jQuery(form).serialize();
48    
49    if(params.appendData) {
50		var dataIsString = typeof(data) == 'string';
51		var addStrData = [];
52        for(var i in params.appendData) {
53			if(dataIsString) {
54				if(toeInArray(typeof(params.appendData[i], ['object', 'array']))) {
55					for(var j in params.appendData[i]) {
56						addStrData.push(i+ '['+ j+ ']'+ '='+ params.appendData[i][j]);
57					}
58				} else {
59					addStrData.push(i+ '='+ params.appendData[i]);
60				}
61				
62			} else
63				data[i] = params.appendData[i];
64        }
65		if(dataIsString)
66			data += '&'+ addStrData.join('&');
67    }
68    var msgEl = null;
69    if(params.msgElID) {
70        if(params.msgElID == 'noMessages')
71            msgEl = false;
72        else if(typeof(params.msgElID) == 'object')
73           msgEl = params.msgElID;
74       else
75            msgEl = jQuery('#'+ params.msgElID);
76    }
77	if(typeof(params.inputsWraper) == 'string') {
78		form = jQuery('#'+ params.inputsWraper);
79		sentFromForm = true;
80	}
81	if(sentFromForm && form) {
82        jQuery(form).find('*').removeClass('umsInputError');
83    }
84	if(msgEl && !params.btn) {
85		jQuery(msgEl).removeClass('umsSuccessMsg')
86			.removeClass('umsErrorMsg')
87			.showLoaderUms();
88	} 
89	if(params.btn) {
90		jQuery(params.btn).attr('disabled', 'disabled');
91		// Font awesome usage
92		params.btnIconElement = jQuery(params.btn).find('.fa').length ? jQuery(params.btn).find('.fa') : jQuery(params.btn);
93		if(jQuery(params.btn).find('.fa').length) {
94			params.btnIconElement
95				.data('prev-class', params.btnIconElement.attr('class'))
96				.attr('class', 'fa fa-spinner fa-spin');
97		}
98	}
99    var url = '';
100	if(typeof(params.url) != 'undefined')
101		url = params.url;
102    else if(typeof(ajaxurl) == 'undefined')
103        url = UMS_DATA.ajaxurl;
104    else
105        url = ajaxurl;
106    
107    jQuery('.umsErrorForField').hide(UMS_DATA.animationSpeed);
108	var dataType = params.dataType ? params.dataType : 'json';
109	// Set plugin orientation
110	if(typeof(data) == 'string') {
111		data += '&pl='+ UMS_DATA.UMS_CODE;
112		data += '&reqType=ajax';
113	} else {
114		data['pl'] = UMS_DATA.UMS_CODE;
115		data['reqType'] = 'ajax';
116	}
117	
118    jQuery.ajax({
119        url: url,
120        data: data,
121        type: 'POST',
122        dataType: dataType,
123        success: function(res) {
124            toeProcessAjaxResponseUms(res, msgEl, form, sentFromForm, params);
125			if(params.clearMsg) {
126				setTimeout(function(){
127					if(msgEl)
128						jQuery(msgEl).animateClear();
129				}, typeof(params.clearMsg) == 'boolean' ? 5000 : params.clearMsg);
130			}
131        }
132    });
133};
134/**
135 * Hide content in element and then clear it
136 */
137jQuery.fn.animateClear = function() {
138	var newContent = jQuery('<span>'+ jQuery(this).html()+ '</span>');
139	jQuery(this).html( newContent );
140	jQuery(newContent).hide(UMS_DATA.animationSpeed, function(){
141		jQuery(newContent).remove();
142	});
143};
144/**
145 * Hide content in element and then remove it
146 */
147jQuery.fn.animateRemoveUms = function(animationSpeed, onSuccess) {
148	animationSpeed = animationSpeed == undefined ? UMS_DATA.animationSpeed : animationSpeed;
149	jQuery(this).hide(animationSpeed, function(){
150		jQuery(this).remove();
151		if(typeof(onSuccess) === 'function')
152			onSuccess();
153	});
154};
155function toeProcessAjaxResponseUms(res, msgEl, form, sentFromForm, params) {
156    if(typeof(params) == 'undefined')
157        params = {};
158    if(typeof(msgEl) == 'string')
159        msgEl = jQuery('#'+ msgEl);
160    if(msgEl)
161        jQuery(msgEl).html('');
162	if(params.btn) {
163		jQuery(params.btn).removeAttr('disabled');
164		if(params.btnIconElement) {
165			params.btnIconElement.attr('class', params.btnIconElement.data('prev-class'));
166		}
167	}
168    /*if(sentFromForm) {
169        jQuery(form).find('*').removeClass('umsInputError');
170    }*/
171    if(typeof(res) == 'object') {
172        if(res.error) {
173            if(msgEl) {
174                jQuery(msgEl).removeClass('umsSuccessMsg')
175					.addClass('umsErrorMsg');
176            }
177			var errorsArr = [];
178            for(var name in res.errors) {
179                if(sentFromForm) {
180					var inputError = jQuery(form).find('[name*="'+ name+ '"]');
181                    inputError.addClass('umsInputError');
182					if(inputError.attr('placeholder')) {
183						//inputError.attr('placeholder', res.errors[ name ]);
184					}
185					if(!inputError.data('keyup-error-remove-binded')) {
186						inputError.keydown(function(){
187							jQuery(this).removeClass('umsInputError');
188						}).data('keyup-error-remove-binded', 1);
189					}
190                }
191                if(jQuery('.umsErrorForField.toe_'+ nameToClassId(name)+ '').exists())
192                    jQuery('.umsErrorForField.toe_'+ nameToClassId(name)+ '').show().html(res.errors[name]);
193                else if(msgEl)
194                    jQuery(msgEl).append(res.errors[name]).append('<br />');
195				else
196					errorsArr.push( res.errors[name] );
197            }
198			if(errorsArr.length && params.btn) {
199				jQuery('<div />').html( errorsArr.join('<br />') ).appendTo('body').dialog({
200					modal: true
201				,	width: '500px'
202				});
203			}
204        } else if(res.messages.length) {
205            if(msgEl) {
206                jQuery(msgEl).removeClass('umsErrorMsg')
207					.addClass('umsSuccessMsg');
208                for(var i = 0; i < res.messages.length; i++) {
209                    jQuery(msgEl).append(res.messages[i]).append('<br />');
210                }
211            }
212        }
213    }
214    if(params.onSuccess && typeof(params.onSuccess) == 'function') {
215        params.onSuccess(res);
216    }
217}
218
219function getDialogElementUms() {
220	return jQuery('<div/>').appendTo(jQuery('body'));
221}
222
223function toeOptionUms(key) {
224	if(UMS_DATA.options && UMS_DATA.options[ key ] && UMS_DATA.options[ key ].value)
225		return UMS_DATA.options[ key ].value;
226	return false;
227}
228function toeLangUms(key) {
229	if(UMS_DATA.siteLang && UMS_DATA.siteLang[key])
230		return UMS_DATA.siteLang[key];
231	return key;
232}
233function toePagesUms(key) {
234	if(typeof(UMS_DATA) != 'undefined' && UMS_DATA[key])
235		return UMS_DATA[key];
236	return false;;
237}
238/**
239 * This function will help us not to hide desc right now, but wait - maybe user will want to select some text or click on some link in it.
240 */
241function toeOptTimeoutHideDescriptionUms() {
242	jQuery('#umsOptDescription').removeAttr('toeFixTip');
243	setTimeout(function(){
244		if(!jQuery('#umsOptDescription').attr('toeFixTip'))
245			toeOptHideDescriptionUms();
246	}, 500);
247}
248/**
249 * Show description for options
250 */
251function toeOptShowDescriptionUms(description, x, y, moveToLeft) {
252    if(typeof(description) != 'undefined' && description != '') {
253        if(!jQuery('#umsOptDescription').length) {
254            jQuery('body').append('<div id="umsOptDescription"></div>');
255        }
256		if(moveToLeft)
257			jQuery('#umsOptDescription').css('right', jQuery(window).width() - (x - 10));	// Show it on left side of target
258		else
259			jQuery('#umsOptDescription').css('left', x + 10);
260        jQuery('#umsOptDescription').css('top', y);
261        jQuery('#umsOptDescription').show(200);
262        jQuery('#umsOptDescription').html(description);
263    }
264}
265/**
266 * Hide description for options
267 */
268function toeOptHideDescriptionUms() {
269	jQuery('#umsOptDescription').removeAttr('toeFixTip');
270    jQuery('#umsOptDescription').hide(200);
271}
272function toeInArrayUms(needle, haystack) {
273	if(haystack) {
274		for(var i in haystack) {
275			if(haystack[i] == needle)
276				return true;
277		}
278	}
279	return false;
280}
281function toeShowDialogCustomized(element, options) {
282	options = jQuery.extend({
283		resizable: false
284	,	width: 500
285	,	height: 300
286	,	closeOnEscape: true
287	,	open: function(event, ui) {
288			jQuery('.ui-dialog-titlebar').css({
289				'background-color': '#222222'
290			,	'background-image': 'none'
291			,	'border': 'none'
292			,	'margin': '0'
293			,	'padding': '0'
294			,	'border-radius': '0'
295			,	'color': '#CFCFCF'
296			,	'height': '27px'
297			});
298			jQuery('.ui-dialog-titlebar-close').css({
299				'background': 'url("'+ UMS_DATA.cssPath+ 'img/tb-close.png") no-repeat scroll 0 0 transparent'
300			,	'border': '0'
301			,	'width': '15px'
302			,	'height': '15px'
303			,	'padding': '0'
304			,	'border-radius': '0'
305			,	'margin': '7px 7px 0'
306			}).html('');
307			jQuery('.ui-dialog').css({
308				'border-radius': '3px'
309			,	'background-color': '#FFFFFF'
310			,	'background-image': 'none'
311			,	'padding': '1px'
312			,	'z-index': '300000'
313			,	'position': 'fixed'
314			,	'top': '60px'
315			});
316			jQuery('.ui-dialog-buttonpane').css({
317				'background-color': '#FFFFFF'
318			});
319			jQuery('.ui-dialog-title').css({
320				'color': '#CFCFCF'
321			,	'font': '12px sans-serif'
322			,	'padding': '6px 10px 0'
323			});
324			if(options.openCallback && typeof(options.openCallback) == 'function') {
325				options.openCallback(event, ui);
326			}
327			jQuery('.ui-widget-overlay').css({
328				'z-index': jQuery( event.target ).parents('.ui-dialog:first').css('z-index') - 1
329			,	'background-image': 'none'
330			});
331			if(options.modal && options.closeOnBg) {
332				jQuery('.ui-widget-overlay').unbind('click').bind('click', function() {
333					jQuery( element ).dialog('close');
334				});
335			}
336		}
337	}, options);
338	return jQuery(element).dialog(options);
339}
340/**
341 * @see html::slider();
342 **/
343function toeSliderMove(event, ui) {
344	var id = jQuery(event.target).attr('id');
345	// TODO: Make it int values show on create
346	var value = typeof(ui.value) === 'undefined' ? jQuery('#toeSliderInput_'+ id).val() : ui.value;
347	var units = value == 1 ? jQuery('#toeSliderDisplay_'+ id).data('units') : jQuery('#toeSliderDisplay_'+ id).data('units-plur');
348	jQuery('#toeSliderDisplay_'+ id).html( value+ ' '+ units );
349    jQuery('#toeSliderInput_'+ id).val( value ).change();
350}
351function setBrowserUrl(url) {
352	if (typeof (history.pushState) != 'undefined') {
353        var obj = {Title: document.title, Url: url};
354        history.pushState(obj, obj.Title, obj.Url);
355    }
356}
357function createAjaxLinkUms(param) {
358	return UMS_DATA.ajaxurl+ '?'+ paramUms(param);
359}
360function paramUms(param) {
361	var param = jQuery.extend({}, param);
362	param['pl'] = UMS_DATA.UMS_CODE;
363	return jQuery.param( param );
364}
365/* TinyMCE Editor */
366function umsGetTxtEditorVal(id) {
367	var elem = jQuery('#'+ id)
368	,	content = typeof(tinyMCE) !== 'undefined' && tinyMCE.get( id ) && !elem.is(':visible')
369			? tinyMCE.get( id ).getContent()
370			: elem.val();
371	return content;
372}
373function umsSetTxtEditorVal(id, content) {
374	var elem = jQuery('#'+ id);
375
376	if(typeof(tinyMCE) !== 'undefined' && tinyMCE && tinyMCE.get( id ) && !elem.is(':visible')) {
377		tinyMCE.get( id ).setContent(content);
378	} else {
379		elem.val( content );
380	}
381
382}

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.