PHP Classes

File: public/assets/local/js/function.min.js

Recommend this page to a friend!
  Classes of Aby Dahana  >  Aksara  >  public/assets/local/js/function.min.js  >  Download  
File: public/assets/local/js/function.min.js
Role: Auxiliary data
Content type: text/plain
Description: Auxiliary data
Class: Aksara
A CodeIgniter based API and CRUD generator
Author: By
Last change: Initial commit for update 4.2.8

The update under this commit:
1. Core: refine the grid view and validation statement;
2. Enlarge the group privileges modal;
3. Add the sample individual user privileges;
4. Refine the core module views;
5. Change the login component to use view instead.
Initial commit for update 4.2.8

1. Adds the token to the json response when it's requested from CRUD form;
2. Core: Refine the permission redirection, adds the parameter to the grid_view method;
3. Templates, add the ID to the menu element to keep the active links;
4. Refine the core modules order;
5.
Initial commit for update 4.2.8

1. Core improvements;
2. Menu generator improvements;
3. Validation for file upload improvements;
4. Adds the failed login attempts blocking with customizable attempt count and blocking time;
5. Login page improvements, removing the login component due to the easy customization;
6. Removing unused JS plugins;
7. Routing machine preparation for maps rendering;
8. Preparing the market addons to be able to auto update the installed modules and themes;
9. Changes for uploader plugin with Aksara custom uploader since the previous version used to be paid version (fileuploader by innostudio);
10. Improve the carousel slideshow CMS that previously missing the order when uploaded file is skipping the first slide;
Initial commit for update 4.2.8

Updating the grid view
Adding the datetimepicker plugin
Initial commit for update 4.2.8

Change the phrase
Initial commit for update version 4.2.8

1. \aksara\Laboratory\Core.php: assign the method of "parent_module" related to view template and permission, add the option parameter for "set_title" to set the individual title for current action (index, create, read, update), improve the autocomplete function;

2. \aksara\Laboratory\Model.php: add the method to get error message, throwing an error message than error exception;

3. \aksara\Laboratory\Permission.php: change the thrown error method when validate AJAX request;

4. \aksara\Laboratory\Template.php: correct the view path finder of sub-modules;

5. Change the template of core modules;

6. Add the reverse geocoding for openlayers when updating the layer feature;

7. Minor updates for core plugins.
Revert "Initial commit for updat 4.2.8"

This reverts commit 5d2eaabba9d42ad8dc108eaf4303b2d58a50a735.
Initial commit for update 3.2.8

1. \aksara\Laboratory\Core.php: assign the method of "parent_module" related to view template and permission, add the option parameter for "set_title" to set the individual title for current action (index, create, read, update), improve the autocomplete function;

2. \aksara\Laboratory\Model.php: add the method to get error message, throwing an error message than error exception;

3. \aksara\Laboratory\Permission.php: change the thrown error method when validate AJAX request;

4. \aksara\Laboratory\Template.php: correct the view path finder of sub-modules;

5. Change the template of core modules;

6. Add the reverse geocoding for openlayers when updating the layer feature;

7. Minor updates for core plugins.
Revert "Revert "Revert "Initial commit for updat 4.2.8"""

This reverts commit 73226fbaf324b253ed2c3888e8eabd81ca8ef946.
Revert "Revert "Initial commit for updat 4.2.8""

This reverts commit 94a714c958f637d932a6bea4bb15a884ddef733e.
Revert "Initial commit for updat 4.2.8"

This reverts commit 5d2eaabba9d42ad8dc108eaf4303b2d58a50a735.
Revert "Revert "Initial commit for updat 4.2.8""

This reverts commit 91ca274f4924f2ba97344ab5d80cb64f6a1a1274.
Revert "Initial commit for updat 4.2.8"

This reverts commit 5d2eaabba9d42ad8dc108eaf4303b2d58a50a735.
Initial commit for updat 4.2.8

1. \aksara\Laboratory\Core.php: assign the method of "parent_module" related to view template and permission, add the option parameter for "set_title" to set the individual title for current action (index, create, read, update), improve the autocomplete function;

2. \aksara\Laboratory\Model.php: add the method to get error message, throwing an error message than error exception;

3. \aksara\Laboratory\Permission.php: change the thrown error method when validate AJAX request;

4. \aksara\Laboratory\Template.php: correct the view path finder of sub-module;

5. Change the template of core module;

6. Add the reverse geocoding for openlayers when updating the layer feature;

7. Minor update for core plugins.
Initial commit for update 4.2.8

Files changed:
1. \aksara\Common.php (remove the single quote string replacement);
2. \aksara\laboratory\Core.php (correcting the response for API request);
3. \aksara\laboratory\Template.php (adds the API documentation for administration menu);
4. Adds the required validation for some modules;
5. Adds the API Documentation under the API module;
6. Adds the parameter from the data atribut when using swiperJS;
7. Change the structure of session table.
8. Minor changes for installation page;
9. Minor changes for core modules.
Replace the Owl Carousel with SwiperJS
Initial commit for update 4.2.8

Add the SwiperJS module
Initial update for 4.2.8

Change the port of market domain with secure port;
Update the datepicker format;
Add the default country for the database.
Date: 5 days ago
Size: 48,601 bytes
 

Contents

Class file image Download
/**
 * Function
 *
 * @version			1.0.1
 *
 * @author			Aby Dahana
 * @profile			abydahana.github.io
 *
 * Property of Aksara Laboratory
 * www.aksaracms.com
 */

var UA												= ($(window).outerWidth() < 1024 ? 'mobile' : 'desktop'),
	exception										= null,
	XFBML											= (typeof FB !== 'undefined' && typeof FB.XFBML !== 'undefined' ? FB.XFBML : null),
	prevScrollpos									= window.pageYOffset;

/**
 * hide navbar on scroll down, restore on scroll up
 */
window.onscroll										= function()
{
	var currentScrollPos							= window.pageYOffset,
		navbar										= document.getElementById('hide-on-scroll');
		
	if(navbar && window.navigator.userAgent.indexOf('Trident/') === -1)
	{
		if(prevScrollpos > currentScrollPos)
		{
			navbar.style.top						= 0;
		}
		else if(currentScrollPos > navbar.offsetHeight)
		{
			navbar.style.top						= '-' + navbar.offsetHeight + 'px';
		}
		
		prevScrollpos								= currentScrollPos;
	}
};

/**
 * in_array_r
 * this mean to check item availability recursively
 *
 * @param	string	needle
 * @param	object	haystack
 * @param	bool	strict
 * @return	bool
 */
function in_array_r(needle, haystack, strict)
{
	var found										= false;
	$.each(haystack, function(key, item)
	{
		if((strict ? item === needle : item == needle) || ($.isArray(item) && in_array_r(needle, item, strict)))
		{
			found									= true;
		}
	});
	return found
}

/**
 * go_to
 * overtake the helper function from php to used in javascript
 *
 * @param	string	url
 * @param	object	params
 * @return	string
 */
function go_to(path, params)
{
	var url											= window.location.href.split(/[?#]/)[0],
		query_string								= {};
	$.each(params, function(key, val)
	{
		if(val)
		{
			query_string[key]						= val;
		}
	});
	
	if(Object.keys(query_string).length <= 1)
	{
		query_string								= null;
	}
	
	return url.replace(/\/$/, '') + (path ? '/' + path : '') + (query_string ? '?' + $.param(query_string) : '');
}

/**
 * get_query_string
 * get the query string value from url
 *
 * @param	string	keyword,
 * @param	string	url
 *
 * @return	string
 */
function get_query_string(keyword, url)
{
	if(!url)
	{
		/* no url set, use window location */
		url											= window.location;
	}
	else
	{
		url											= new URL(url);
	}
	
	/* extract parameter */
	var params										= new URLSearchParams(url.search);
	
	/* get query string value based on given keyword */
	return params.get(keyword);
}

/**
 * htmlspecialchars
 * rewrite PHP function to javascript format
 */
function htmlspecialchars(string)
{
	if(typeof(string) == "string")
	{
		string										= string.replace(/&/g, "&amp;")
		.replace(/"/g, "&quot;")
		.replace(/'/g, "&#039;")
		.replace(/</g, "&lt;")
		.replace(/>/g, "&gt;");
	}
	return string;
}

/**
 * rgb_to_hex
 * convert the rgb into hex
 */
function rgb_to_hex(rgb)
{
	rgb												= rgb.match(/^rgba?[\s+]?\([\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?/i);
	return (rgb && rgb.length === 4 ? "#" + ("0" + parseInt(rgb[1],10).toString(16)).slice(-2) + ("0" + parseInt(rgb[2],10).toString(16)).slice(-2) + ("0" + parseInt(rgb[3],10).toString(16)).slice(-2) : '');
}

/**
 * rgba_to_hex
 * convert the rgba into hex
 */
function rgba_to_hex(rgba, a)
{
	var isPercent,
		rgb											= rgba.replace(/\s/g, '').match(/^rgba?\((\d+),(\d+),(\d+),?([^,\s)]+)?/i),
		alpha										= (rgb && rgb[4] || "").trim(),
		hex											= (rgb ? (rgb[1] | 1 << 8).toString(16).slice(1) + (rgb[2] | 1 << 8).toString(16).slice(1) + (rgb[3] | 1 << 8).toString(16).slice(1) : rgba);

	if(alpha !== '')
	{
		a											= alpha;
	}
	else
	{
		a											= 01;
	}
	
	a												= ((a * 255) | 1 << 8).toString(16).slice(1),
	hex												= hex;
	
	return hex;
}

/**
 * hex_to_rgba
 * convert the hex into rgba
 */
function hex_to_rgba(hex, a)
{
	if(!hex) return false;
	
	var c;
	if(/^#([A-Fa-f0-9]{3}){1,2}$/.test(hex))
	{
		c											= hex.substring(1).split('');
		if(c.length== 3)
		{
			c										= [c[0], c[0], c[1], c[1], c[2], c[2]];
		}
		c											= '0x'+c.join('');
		
		return 'rgba(' + [(c>>16)&255, (c>>8)&255, c&255].join(',')+',' + (a ? a : 1) + ')';
	}
	throw new Error('Bad Hex');
}

/**
 * jExec
 * execute the jQuery script inline the document
 */
function jExec(script)
{
	return script;
}

/**
 * throw_exception
 * Pop the message up
 */
function throw_exception(code, messages)
{
	if(!messages)
	{
		return false;
	}
	
	if($.inArray(code, [200, 301]) !== -1)
	{
		var color									= 'success',
			icon									= 'mdi mdi-check';
	}
	else if($.inArray(code, [403, 404]) !== -1)
	{
		var color									= 'warning',
			icon									= 'mdi mdi-alert-octagram-outline';
	}
	else
	{
		var color									= 'danger',
			icon									= 'mdi mdi-emoticon-sad-outline';
	}
	
	$('.alert.exception').fadeOut(100, function()
	{
		$(this).remove()
	}),
	$('<div class="alert alert-' + color + ' fade show exception text-center rounded-0 fixed-top"><i class="' + icon + '"></i> ' + messages + '</div>').appendTo('body'),
	clearTimeout(exception);
	exception										= setTimeout(function()
	{
		$('.alert.exception').trigger('click')
	}, 5000)
}

function _response_template(_this, response, meta, back_btn)
{
	if(typeof response !== 'object')
	{
		$(config.content_wrapper).html
		(
			'<div class="container-fluid">' +
				'<div class="row bg-dark full-height">' +
					'<div class="col-12">' +
						'<div class="pt-3 pb-3 text-success text-monospace">' +
							'<p class="mb-0">' +
								'[info@localhost ~]# aksara -tell readonly' +
							'</p>' +
							'<p class="mb-0 text-danger">' +
								(phrase.no_response_could_be_loaded ? phrase.no_response_could_be_loaded : 'No response could be loaded') +
								'<br />' +
								(phrase.make_sure_to_check_the_following_mistake ? phrase.make_sure_to_check_the_following_mistake : 'Make sure to check the following mistake') + ':' +
								'<ol class="text-danger">' +
									'<li>' +
										(phrase.module_structure ? phrase.module_structure : 'Module structure') + ',' +
									'</li>' +
									'<li>' +
										(phrase.incorrect_view_path ? phrase.incorrect_view_path : 'Incorrect view path') + ',' +
									'</li>' +
									'<li>' +
										(phrase.database_table_existence ? phrase.database_table_existence : 'Database table existence') + ',' +
									'</li>' +
									'<li>' +
										(phrase.something_caused_by_typo ? phrase.something_caused_by_typo : 'Somethiing caused by typo') + '.' +
									'</li>' +
								'</ol>' +
							'</p>' +
							'<p class="mb-0">' +
								'[info@localhost ~]# <blink>_</blink>' +
							'</p>' +
						'</div>' +
					'</div>' +
				'</div>' +
			'</div>'
		),
		$('.will-be-replace-with-title').text((phrase.error ? phrase.error : 'Error')),
		$('#will-be-replace-with-icon').removeAttr('class').addClass('mdi mdi-alert-outline'),
		$('#description-collapse').removeClass('show'),
		$('.full-height').css
		({
			minHeight: $(window).outerHeight(true) - (($('#breadcrumb-wrapper').length ? $('#breadcrumb-wrapper').outerHeight(true) : ($('.navbar').length ? $('.navbar').outerHeight(true) : 0)) + ($('.alias-table-header').length ? $('.alias-table-header').outerHeight(true) : 0) + ($('.alias-description-collapse').length ? $('.alias-description-collapse').outerHeight(true) : 0) + ($('.full-height-callout').length ? $('.full-height-callout').outerHeight(true) : 0) + ($('.alias-announcements-ticker').length ? 30 : 0))
		}),
		(UA === 'mobile' ? ($('html').removeClass('overflow-hidden'), $('body').removeClass('sidebar-expanded sidebar-hovered'), $('.navbar-toggler').not('.collapsed').trigger('click'), $('.navbar-collapse').removeClass('show').prev('.navbar-toggler').addClass('collapsed')) : null);
		return;
	}
	else if(typeof response.responseJSON !== 'undefined')
	{
		response									= response.responseJSON;
	}
	
	/* redirect */
	if(301 == response.status || (403 == response.status && response.target) || (404 == response.status && response.target))
	{
		/* redirect if needed */
		if(response.redirect)
		{
			return window.location.replace(response.target)
		}
		
		/* throw exception */
		throw_exception(response.status, response.message),
		
		/* or load target page instead */
		$.ajax
		({
			method: 'POST',
			context: this,
			url: response.target,
			data:
			{
				prefer: (_this.attr('data-prefer-result') ? _this.attr('data-prefer-result') : (UA === 'mobile' ? 'html' : null))
			},
			beforeSend: function(progress)
			{
				/* additional command if any */
			},
			complete: function(progress)
			{
				/* additional command if any */
			},
			statusCode:
			{
				301: function(new_response, status, error)
				{
					_response_template(_this, new_response, meta)
				},
				403: function(new_response, status, error)
				{
					_response_template(_this, new_response, meta)
				},
				404: function(new_response, status, error)
				{
					_response_template(_this, new_response, meta)
				},
				500: function(new_response, status, error)
				{
					/* throw log to console */
					$(config.content_wrapper).html
					(
						'<div class="container-fluid">' +
							'<div class="mt-3 mb-3 p-3 bg-dark rounded">' +
								'<pre class="text-warning mb-0" style="white-space:pre-wrap">' +
									(typeof new_response.responseJSON !== 'undefined' ? JSON.stringify(new_response.responseJSON, null, 4) : (error ? error : (phrase.consider_to_check_your_internet_connection ? phrase.consider_to_check_your_internet_connection : 'Consider to check your internet connection'))) +
								'</pre>' +
							'</div>' +
						'</div>'
					),
					throw_exception(new_response.status, (error ? error : (phrase.consider_to_check_your_internet_connection ? phrase.consider_to_check_your_internet_connection : 'Consider to check your internet connection'))),
					$('.will-be-replace-with-title').text((phrase.error ? phrase.error : 'Error')),
					$('#will-be-replace-with-icon').removeAttr('class').addClass('mdi mdi-alert-outline'),
					$('#description-collapse').removeClass('show'),
					$('*').modal('hide'),
					$('body').css
					({
						cursor: 'default'
					})
				}
			}
		})
		.done(function(new_response)
		{
			_response_template(_this, new_response, meta)
		})
	}
	
	/* throw exception */
	else if(403 == response.status || 404 == response.status)
	{
		/* check if the clicked element not showing the working progress */
		if(_this.hasClass('show-progress'))
		{
			/* stop the progress indicator from the clicked element */
			if(_this.find('i.--mdi-working').length)
			{
				/* revert to previous icon */
				_this.find('i.--mdi-working').removeAttr('class').addClass(meta.btn_icon)
			}
		}
		
		$('.will-be-replace-with-title').text(' ' + meta.title),
		$('#will-be-replace-with-icon').removeAttr('class').addClass(meta.icon),
		$('.mdi').removeClass('mdi-spin'),
		throw_exception(response.status, response.message)
	}
	else
	{
		if(typeof response._token !== 'undefined')
		{
			sessionStorage.setItem('_token', response._token)
		}
		
		/* check if the response is contain a exception message */
		if(typeof response.message !== 'undefined')
		{
			/* stop the progress indicator from the clicked element */
			if(_this.find('i.--mdi-working').length)
			{
				/* revert to previous icon */
				_this.find('i.--mdi-working').removeAttr('class').addClass(meta.btn_icon)
			}
			
			/* replace title, icon and description */
			$('.will-be-replace-with-title').text(' ' + meta.title),
			$('#will-be-replace-with-icon').removeAttr('class').addClass(meta.icon),
			$('*').modal('hide');
			
			/* finally, throw the exception */
			return throw_exception(response.status, response.message)
		}
		else if(!_this.hasClass('--prevent-modify'))
		{
			/* push to browser tab title */
			document.title							= (typeof response.meta !== 'undefined' && typeof response.meta.title !== 'undefined' ? response.meta.title : (phrase.error ? phrase.error : 'Error')) + ' | ' + config.app_name,
			
			/* store into browser history */
			(!back_btn ? history.pushState({path: response.current_page}, response.meta.title, response.current_page) : null),
			
			/* display the html result into page wrapper */
			$(config.content_wrapper).html((!response.html && typeof response.results !== 'undefined' && typeof response.results.table_data !== 'undefined' ? component.table(response) : (!response.html && typeof response.results !== 'undefined' && typeof response.results.form_data !== 'undefined' ? ('read' == response.method ? component.view(_this, response) : component.form(_this, response)) : response.html))),
			
			/* replace title, icon and description */
			$('.will-be-replace-with-title').text(' ' + response.meta.title),
			$('#will-be-replace-with-icon').removeAttr('class').addClass(response.meta.icon),
			$('#refresh-btn').attr('href', (response.current_page ? response.current_page : _this.attr('href')));
			if(response.meta.description)
			{
				$('#description-btn').removeClass('d-none'),
				$('#description-collapse').html(response.meta.description).addClass('show')
			}
			else
			{
				$('#description-btn').addClass('d-none'),
				$('#description-collapse').html('').removeClass('show')
			}
			
			/* add the breadcrumb */
			component.breadcrumb(response.breadcrumb),

			/* reset the body position to top */
			$('html, body').animate
			({
				scrollTop: 0
			}, 200)
		}
		
		var is_index								= false;
		
		if(typeof response.method !== 'undefined' && response.method == 'index')
		{
			is_index								= true;
		}
		
		/* reactivate the plugin */
		_reactivate(is_index)
	}
}

/**
 * _reactivate
 *
 * because this website is adopt SPA concept, sometime it's
 * require to re-trigger the plugins
 */
function _reactivate(is_index)
{
	if(typeof get_conversation !== 'undefined')
	{
		clearInterval(get_conversation)
	}
	
	/**
	 * alert user if they using unstable browser
	 */
	if($('input[type=file]').length)
	{
		var ua										= navigator.userAgent || navigator.vendor || window.opera;
		if(ua.toLowerCase().indexOf('fban') > -1 || ua.toLowerCase().indexOf('fbav') > -1 || ua.toLowerCase().indexOf('instagram') > -1)
		{
			alert((phrase.your_browser_might_experiences_problem_related_to_file_reading_permissions_on_your_device ? phrase.your_browser_might_experiences_problem_related_to_file_reading_permissions_on_your_device : 'This browser might experience problems related to file reading permissions on your device.'))
		}
	}
	
	/**
	 * detect if device browser is mobile
	 */
	if(UA != 'mobile')
	{
		/* scrollable sidebar */
		$('#sidebar-wrapper').mCustomScrollbar
		({
			autoHideScrollbar: true,
			axis: 'y',
			scrollInertia: 200,
			setHeight: $(window).outerHeight(true) - (($('#breadcrumb-wrapper').length ? $('#breadcrumb-wrapper').outerHeight(true) : ($('.navbar').length ? $('.navbar').outerHeight(true) : 0)) + ($('.alias-announcements-ticker').length ? 30 : 0)),
			updateOnContentResize: true
		}),
		
		/* scrollable table (index of CRUD) */
		$('.alias-table-index').mCustomScrollbar
		({
			autoHideScrollbar: true,
			axis: 'yx',
			scrollInertia: 200,
			setHeight: $(window).outerHeight(true) - (($('#breadcrumb-wrapper').length ? $('#breadcrumb-wrapper').outerHeight(true) : ($('.navbar').length ? $('.navbar').outerHeight(true) : ($('.navbar').length ? $('.navbar').outerHeight(true) : 0))) + ($('.alias-table-header').length ? $('.alias-table-header').outerHeight(true) : 0) + ($('.alias-description-collapse:visible').length ? $('.alias-description-collapse').outerHeight(true) : 0) + ($('.alias-table-toolbar').length ? $('.alias-table-toolbar').outerHeight(true) : 0) + ($('.alias-pagination').length ? $('.alias-pagination').outerHeight(true) : 0) + ($('.alias-announcements-ticker').length ? 30 : 0)),
			updateOnContentResize: true
		}),
		
		/* scrollable table (index of CRUD) */
		$('.alias-grid-container').mCustomScrollbar
		({
			autoHideScrollbar: true,
			axis: 'yx',
			scrollInertia: 200,
			setHeight: $(window).outerHeight(true) - (($('#breadcrumb-wrapper').length ? $('#breadcrumb-wrapper').outerHeight(true) : ($('.navbar').length ? $('.navbar').outerHeight(true) : ($('.navbar').length ? $('.navbar').outerHeight(true) : 0))) + ($('.alias-table-header').length ? $('.alias-table-header').outerHeight(true) : 0) + ($('.alias-description-collapse:visible').length ? $('.alias-description-collapse').outerHeight(true) : 0) + ($('.alias-table-toolbar').length ? $('.alias-table-toolbar').outerHeight(true) : 0) + ($('.alias-pagination').length ? $('.alias-pagination').outerHeight(true) : 0) + ($('.alias-announcements-ticker').length ? 30 : 0)),
			updateOnContentResize: true
		}),
		
		/* scrollable notification */
		$('.notification-item').mCustomScrollbar
		({
			autoHideScrollbar: true,
			axis: 'y',
			scrollInertia: 200,
			setHeight: $(window).outerHeight(true) - (($('#breadcrumb-wrapper').length ? $('#breadcrumb-wrapper').outerHeight(true) : ($('.navbar').length ? $('.navbar').outerHeight(true) : ($('.navbar').length ? $('.navbar').outerHeight(true) : 0))) + 100),
			updateOnContentResize: true
		})
	}
	
	/**
	 * make the navbar transparent if first full-screen map and carousel is exists
	 */
	if($('.navbar').first().next(config.content_wrapper).children('.carousel').length || $('.navbar').first().next(config.content_wrapper).children('.leading').length)
	{
		$('.navbar').first().addClass('bg-transparent'),
		$('.navbar').first().next(config.content_wrapper).css('margin-top', 0)
	}
	else
	{
		$('.navbar').first().removeClass('bg-transparent'),
		$('.navbar').first().next(config.content_wrapper).css('margin-top', $('.navbar').first().outerHeight(true))
	}
	
	/* modal */
	/*if($('.modal-dialog:visible').outerHeight(true) > $(window).outerHeight(true))
	{
		$('.modal-body').mCustomScrollbar
		({
			autoHideScrollbar: true,
			axis: 'y',
			scrollInertia: 200,
			setHeight: $(window).outerHeight(true) - (($('.modal-dialog').length ? parseInt($('.modal-dialog').css('marginTop')) * 2 : 0) + ($('.modal-header').length ? $('.modal-header').actual('outerHeight') : 0) + ($('.modal-footer').length ? $('.modal-footer').actual('outerHeight') : 0)),
			updateOnContentResize: true
		})
	}*/
	
	/**
	 * sometime the component need to be resolve when the
	 * browser window is resized
	 */
	$(window).on('resize', function()
	{
		/**
		 * check again the device browser
		 */
		if(UA != 'mobile')
		{
			/* applied only for non-mobile browser */
			
			/* sidebar */
			$('#sidebar-wrapper').height($(window).outerHeight(true) - (($('#breadcrumb-wrapper').length ? $('#breadcrumb-wrapper').outerHeight(true) : ($('.navbar').length ? $('.navbar').outerHeight(true) : 0))) + ($('.alias-announcements-ticker').length ? 30 : 0)),
			
			/* index table */
			$('.alias-table-index').height($(window).outerHeight(true) - (($('#breadcrumb-wrapper').length ? $('#breadcrumb-wrapper').outerHeight(true) : ($('.navbar').length ? $('.navbar').outerHeight(true) : 0)) + ($('.alias-table-header').length ? $('.alias-table-header').outerHeight(true) : 0) + ($('.alias-description-collapse:visible').length ? $('.alias-description-collapse').outerHeight(true) : 0) + ($('.alias-table-toolbar').length ? $('.alias-table-toolbar').outerHeight(true) : 0) + ($('.alias-pagination').length ? $('.alias-pagination').outerHeight(true) : 0) + ($('.alias-announcements-ticker').length ? 30 : 0))),
			
			/* modal */
			/*$('.modal-body').height($(window).outerHeight(true) - (($('.modal-dialog').length ? parseInt($('.modal-dialog').css('marginTop')) * 2 : 0) + ($('.modal-header').length ? $('.modal-header').actual('outerHeight') : 0) + ($('.modal-footer').length ? $('.modal-footer').actual('outerHeight') : 0))),*/
	
			$('.full-height').css
			({
				minHeight: $(window).outerHeight(true) - (($('#breadcrumb-wrapper').length ? $('#breadcrumb-wrapper').outerHeight(true) : ($('.navbar:not(.bg-transparent)').length ? $('.navbar:not(.bg-transparent)').outerHeight(true) : 0)) + ($('.alias-table-header').length ? $('.alias-table-header').outerHeight(true) : 0) + ($('.alias-description-collapse').length ? $('.alias-description-collapse').outerHeight(true) : 0) + ($('.full-height-callout').length ? $('.full-height-callout').outerHeight(true) : 0) + ($('.alias-announcements-ticker').length ? 30 : 0))
			})
		}
	})
	.on('scroll', function(e)
	{
		if($('.navbar').first().next(config.content_wrapper).children('.carousel').length || $('.navbar').first().next(config.content_wrapper).children('.leading').length)
		{
			var element								= ($('.navbar').first().next(config.content_wrapper).children('.carousel').length ? $('.navbar').first().next(config.content_wrapper).children('.carousel') : ($('.navbar').first().next(config.content_wrapper).children('.leading').length ? $('.navbar').first().next(config.content_wrapper).children('.leading') : null)),
				toe									= element.offset().top,
				boe									= element.offset().top + element.outerHeight(),
				bos									= $(window).scrollTop() + $(window).innerHeight(),
				tos									= $(window).scrollTop();

			if((bos > toe) && (tos < boe) && !$('body').hasClass('sidebar-expanded'))
			{
				$('.navbar').first().addClass('bg-transparent')
			}
			else
			{
				$('.navbar').first().removeClass('bg-transparent')
			}
		}
	}),
	
	$('.full-height').css
	({
		minHeight: $(window).outerHeight(true) - (($('#breadcrumb-wrapper').length ? $('#breadcrumb-wrapper').outerHeight(true) : ($('.navbar:not(.bg-transparent)').length ? $('.navbar:not(.bg-transparent)').outerHeight(true) : 0)) + ($('.alias-table-header').length ? $('.alias-table-header').outerHeight(true) : 0) + ($('.alias-description-collapse').length ? $('.alias-description-collapse').outerHeight(true) : 0) + ($('.full-height-callout').length ? $('.full-height-callout').outerHeight(true) : 0) + ($('.alias-announcements-ticker').length ? 30 : 0))
	}),
	
	/**
	 * remove and trigger everything that may be needed
	 * wrap it with document.ready if error's persists
	 */
	
	/**
	 * focus to first field, expect there's modal open. to trigger focus the field inside modal, check the correspondent of shown.bs.modal from the global.min.js
	 */
	($(':input').blur(), (UA != 'mobile' ? ($('form.--validate-form').find('.autofocus').length ? $('form.--validate-form').find('.autofocus').focus() : $('form.--validate-form').find(':input.form-control:enabled:visible:first').focus()) : null)),
	
	/**
	 * expand sidebar if it autocollapsed in previous request
	 */
	(UA != 'mobile' && $('body').hasClass('sidebar-collapsed auto-collapse') ? $('body').removeClass('sidebar-collapsed auto-collapse sidebar-hovered') : null),
	
	/**
	 * disable input autocomplete
	 */
	$('input, textarea').attr('autocomplete', 'off'),
	$('input[type=password]').attr('autocomplete', 'new-password'),
	
	/**
	 * remove the DOM's element that used before
	 */
	(UA === 'mobile' ? ($('html').removeClass('overflow-hidden'), $('body').removeClass('sidebar-expanded sidebar-hovered'), $('.navbar-toggler').not('.collapsed').trigger('click'), $('.navbar-collapse').removeClass('show').prev('.navbar-toggler').addClass('collapsed')) : null),
	$('.dcalendarpicker, #sortableListsBase, .autocomplete-suggestions, .note-popover').remove(),
	
	/**
	 * dispose the bootstrap tooltip and popover before it will push again
	 */
	$('*').tooltip('dispose'),
	$('*').popover('dispose'),
	
	/**
	 * dispose previous autocomplete element
	 */
	(typeof $.fn.autocomplete !== 'undefined' ? $('[role=autocomplete]').autocomplete('dispose') : ''),
	
	/**
	 * fix the hidden button that break the radius in button group
	 */
	($('.btn-group').find('.btn:hidden:first').nextAll('.btn:visible:first').length ? $('.btn-group').find('.btn:hidden:first').nextAll('.btn:visible:first').addClass('rounded-left') : $('.btn-group').find('.btn').not(':first').removeClass('rounded-left')),
	($('.btn-group').find('.btn:hidden:last').prevAll('.btn:visible:first').length ? $('.btn-group').find('.btn:hidden:last').prevAll('.btn:visible:first').addClass('rounded-right') : $('.btn-group').find('.btn').not(':last').removeClass('rounded-right')),
	
	/**
	 * floating label
	 *//*
	$('label').each(function()
	{
		var _this									= $(this),
			height									= _this.actual('outerHeight', {includeMargin: true}),
			margin									= parseInt(_this.css('marginBottom'));
		if(_this.next('input.form-control, textarea.form-control').length)
		{
			if(_this.next('input.form-control, textarea.form-control').val() || _this.next('input.form-control, textarea.form-control').attr('placeholder'))
			{
				_this.animate
				({
					marginTop: 0,
					marginBottom: margin
				}, 100)
			}
			else
			{
				_this.animate
				({
					marginTop: height + margin,
					marginBottom: -height
				}, 100)
			}
		}
		_this.next('input.form-control, textarea.form-control').on('keyup keydown paste cut change', function()
		{
			if($(this).val() || $(this).attr('placeholder'))
			{
				_this.animate
				({
					marginTop: 0,
					marginBottom: margin
				}, 100)
			}
			else
			{
				_this.animate
				({
					marginTop: height + margin,
					marginBottom: -height
				}, 100)
			}
		})
	}),*/
	
	/**
	 * make textarea autogrow
	 */
	$('textarea').each(function()
	{
		$(this).css
		({
			height: (this.scrollHeight > $(this).actual('outerHeight') ? (this.scrollHeight + 2) : $(this).actual('outerHeight')),
			overflowY: 'hidden'
		})
	})
	.on('input', function()
	{
		if(!$(this).hasClass('no-resize'))
		{
			this.style.height						= 'auto';
			this.style.height						= (this.scrollHeight + 2) + 'px';
		}
	}),
	
	/**
	 * select2 plugin
	 */
	$('select').each(function()
	{
		if($(this).next('.select2').length) return;
		
		var _length									= $(this).children('option').length;
		
		if($(this).attr('data-limit') && $(this).attr('data-href'))
		{
			var name								= $(this).attr('name'),
				href								= $(this).attr('data-href'),
				selected							= $(this).attr('data-selected');
			
			$(this).select2
			({
				ajax:
				{
					url: href,
					method: 'POST',
					data: function (params)
					{
						var query					=
						{
							search: params.term,
							page: params.page || 1,
							method: 'ajax_select',
							source: name,
							selected: selected
						};
						
						return query;
					}
				},
				width: ($(this).closest('.form-group').length ? $(this).closest('.form-group').actual('outerWidth') - (($(this).siblings('.input-group-prepend').length ? $(this).siblings('.input-group-prepend').actual('outerWidth') : 0) + ($(this).siblings('.input-group-append').length ? $(this).siblings('.input-group-append').actual('outerWidth') : 0)) : $(this).actual('outerWidth')) - 1,
				placeholder: $(this).attr('placeholder'),
				dropdownCssClass: ($(this).hasClass('form-control-sm') ? 'select2-dropdown-sm' : ''),
				minimumResultsForSearch: (_length > 10 ? 0 : Infinity),
				templateSelection: function(response)
				{
					if(!$(response.element).data('icon'))
					{
						return response.text
					}
					return $('<span class="text-truncate"><i class="' + $(response.element).data('icon') + '"></i> ' + response.text + '</span>')
				},
				templateResult: function(response)
				{
					if(!$(response.element).data('icon'))
					{
						return response.text
					}
					return $('<span class="text-truncate"><i class="' + $(response.element).data('icon') + '"></i> ' + response.text + '</span>')
				}
			})
			.on('change', function(e)
			{
				var autosubmit						= ($(this).closest('form').attr('data-autosubmit') == 0 || $(this).closest('form').attr('data-autosubmit') == 'false' ? false : true);
				if(autosubmit && $(this).closest('form').hasClass('--xhr-form'))
				{
					$(this).closest('form.--xhr-form').trigger('submit')
				}
			})
		}
		else
		{
			$(this).select2
			({
				width: ($(this).closest('.form-group').length ? $(this).closest('.form-group').actual('outerWidth') - (($(this).siblings('.input-group-prepend').length ? $(this).siblings('.input-group-prepend').actual('outerWidth') : 0) + ($(this).siblings('.input-group-append').length ? $(this).siblings('.input-group-append').actual('outerWidth') : 0)) : $(this).actual('outerWidth')) - 1,
				placeholder: $(this).attr('placeholder'),
				dropdownCssClass: ($(this).hasClass('form-control-sm') ? 'select2-dropdown-sm' : ''),
				minimumResultsForSearch: (_length > 10 ? 0 : Infinity),
				templateSelection: function(response)
				{
					if(!$(response.element).data('icon'))
					{
						return response.text
					}
					return $('<span class="text-truncate"><i class="' + $(response.element).data('icon') + '"></i> ' + response.text + '</span>')
				},
				templateResult: function(response)
				{
					if(!$(response.element).data('icon'))
					{
						return response.text
					}
					return $('<span class="text-truncate"><i class="' + $(response.element).data('icon') + '"></i> ' + response.text + '</span>')
				}
			})
			.on('change', function(e)
			{
				var autosubmit						= ($(this).closest('form').attr('data-autosubmit') == 0 || $(this).closest('form').attr('data-autosubmit') == 'false' ? false : true);
				if(autosubmit && $(this).closest('form').hasClass('--xhr-form'))
				{
					$(this).closest('form.--xhr-form').trigger('submit')
				}
			})
		}
	}),
	
	$('body').on('keyup', '.select2-search__field', function(e)
	{
		$('.select2-results').mCustomScrollbar('update')
	}),
	
	/**
	 * triggering mousewheel
	 */
    $('input[type=number]').bind('DOMMouseScroll mousewheel', function(e)
	{
		$(this).trigger('change')
    });
	
	/**
	 * trigger stopped carousel to slide
	 */
	if($('[data-ride=carousel]').length)
	{
		$('[data-ride=carousel]').carousel(),
		$('[data-ride=carousel]').bind('slide.bs.carousel')
	}
	
	/**
	 * load wysiwyg editor plugin
	 */
	if($('[role=wysiwyg]').length)
	{
		require.css([config.asset_url + 'summernote/summernote.min.css']),
		require.js([config.asset_url + 'summernote/summernote.min.js'], function()
		{
			$('[role=wysiwyg]').each(function()
			{
				if($(this).attr('disabled') || $(this).attr('readonly')) return;
				
				$(this).summernote
				({
					dialogsInBody: true,
					dialogsFade: false,
					disableDragAndDrop: true,
					toolbar:
					[
						['style', ['bold', 'italic', 'underline']],
						['para', ['ul', 'ol', 'paragraph']],
						(UA !== 'mobile' ? ['insert', ['link', 'table', 'picture', 'video']] : null),
						(UA !== 'mobile' ? ['misc', ['clear', 'help']] : null)
					],
					placeholder: ($(this).attr('placeholder') ? $(this).attr('placeholder') : (phrase.your_content_goes_here ? phrase.your_content_goes_here : 'Your content goes here...')),
					disableResizeEditor: true,
					callbacks:
					{
						onDialogShown: function(e)
						{
							$('.modal-dialog').addClass('modal-dialog-centered'),
							$('.form-control-file').addClass('form-control')
						}
					}
				})
			})
		})
	}
	
	/**
	 * load swiperJS
	 */
	if($('.swiper').length)
	{
		require.css([config.asset_url + 'swiper/swiper-bundle.min.css']),
		require.js([config.asset_url + 'swiper/swiper-bundle.min.js'], function()
		{
			$('.swiper').each(function()
			{
				var _this							= $(this),
					_unique							= Math.floor(Math.random() * 9999),
					_autoplay						= (1 == _this.attr('data-autoplay') || 'true' == _this.attr('data-autoplay') ? true : false);
				
				_this.addClass('swiper_' + _unique);
				
				if(typeof _this.attr('data-navigation') !== 'undefined')
				{
					$('<div class="swiper-button-prev"></div><div class="swiper-button-next"></div>').appendTo(_this)
				}
				
				if(_autoplay)
				{
					_autoplay						= 
					{
						delay: (typeof _this.attr('data-delay') !== 'undefined' ? parseInt(_this.attr('data-delay')) : 3000),
						pauseOnMouseEnter: true,
						disableOnInteraction: false
					};
				}
				
				var swiper							= new Swiper('.swiper_' + _unique,
				{
					slidesPerView: (typeof _this.attr('data-items') !== 'undefined' ? parseInt(_this.attr('data-items')) : 'auto'),
					autoplay: _autoplay,
					spaceBetween: (typeof _this.attr('data-space-between') !== 'undefined' ? parseInt(_this.attr('data-space-between')) : 15),
					breakpoints:
					{
						640:
						{
							slidesPerView: (typeof _this.attr('data-items') !== 'undefined' ? _this.attr('data-items') : 'auto'),
							spaceBetween: (typeof _this.attr('data-space-between') !== 'undefined' ? parseInt(_this.attr('data-space-between')) : 15)
						},
						768:
						{
							slidesPerView: (typeof _this.attr('data-sm-items') !== 'undefined' ? _this.attr('data-sm-items') : 'auto'),
							spaceBetween: (typeof _this.attr('data-space-between') !== 'undefined' ? parseInt(_this.attr('data-space-between')) : 15)
						},
						1024:
						{
							slidesPerView: (typeof _this.attr('data-md-items') !== 'undefined' ? _this.attr('data-md-items') : 'auto'),
							spaceBetween: (typeof _this.attr('data-space-between') !== 'undefined' ? parseInt(_this.attr('data-space-between')) : 15)
						},
						1280:
						{
							slidesPerView: (typeof _this.attr('data-lg-items') !== 'undefined' ? _this.attr('data-lg-items') : 'auto'),
							spaceBetween: (typeof _this.attr('data-space-between') !== 'undefined' ? parseInt(_this.attr('data-space-between')) : 15)
						}
					},
					navigation:
					{
						prevEl: '.swiper-button-prev',
						nextEl: '.swiper-button-next'
					}
				})
			})
		})
	}
	
	/**
	 * load video player (mediaelement.js)
	 */
	if($('[role=videoplayer]').length)
	{
		require.css([config.asset_url + 'mediaelement/mediaelement.min.css']),
		require.js([config.asset_url + 'mediaelement/mediaelement.min.js'], function()
		{
			$('[role=videoplayer]').mediaelementplayer
			({
				autoplay: true,
				enableKeyboard: false,
				toggleCaptionsButtonWhenOnlyOne: true
			})
		})
	}
	
	/**
	 * load datepicker plugin
	 */
	if($('[role=datepicker]').length)
	{
		$('input[role=datepicker]').each(function()
		{
			$(this).datepicker
			({
				format: ($(this).attr('data-format') ? $(this).attr('data-format') : 'yyyy-mm-dd'),
				autoclose: true,
				zIndexOffset: 1090
			})
			.on('changeDate', function(e)
			{
			})
		})
	}
	
	/**
	 * load datetimepicker plugin
	 */
	if($('[role=datetimepicker]').length)
	{
		require.css([config.asset_url + 'datetimepicker/datetimepicker.min.css']),
		require.js([config.asset_url + 'moment/moment.min.js', config.asset_url + 'datetimepicker/datetimepicker.min.js'], function()
		{
			$('[role=datetimepicker]').each(function()
			{
				$(this).attr('readonly', true),
				$(this).datetimepicker
				({
					allowInputToggle: true,
					ignoreReadonly: true,
					showClose: true,
					showTodayButton: true,
					format: 'DD MMMM YYYY HH:mm:ss'
				})
			})
		})
	}
	
	/**
	 * colorpicker datepicker plugin
	 */
	if($('[role=colorpicker]').length)
	{
		require.css([config.asset_url + 'colorpicker/colorpicker.min.css']),
		require.js([config.asset_url + 'colorpicker/colorpicker.min.js'], function()
		{
			$('[role=colorpicker]').colorpicker
			({
				format: 'hex'
			})
			.on('changeColor', function (e)
			{
				if($(this).find('.background-color-picker').length)
				{
					$(this).closest('.background-color').css
					({
						background: e.color
					})
				}
				else if($(this).find('.text-color-picker').length)
				{
					$(this).closest('.background-color').find('.text-color').css
					({
						color: e.color
					})
				}
			})
		})
	}
	
	/**
	 * load price format plugin
	 */
	if($('[role=price]').length)
	{
		require.js([config.asset_url + 'price/price.min.js'], function()
		{
			$('[role=price]').autoNumeric()
		}),
		$('[role=price]').on('focus', function(e)
		{
			$(this).select()
		})
	}
	
	/**
	 * uploader plugin
	 */
	if($('[role=uploader]').length)
	{
		$('[role=uploader]').each(function()
		{
			var _this								= $(this);
			var files								= [];
			
			try
			{
				files								= JSON.parse(_this.attr('data-fileuploader-files'));
			}
			catch (e)
			{
			}
			
			_this.removeAttr('data-fileuploader-files');
			
			if(files)
			{
				$.each(files, function(key, val)
				{
					var extension					= val.name.substr((val.name.lastIndexOf('.')));
					
					$('<div class="row uploader-list mb-2 d-flex align-items-center"><div class="col-2 pr-0"><a href="' + val.url + '" target="_blank" download="' + val.name + '">' + (val.icon ? '<img src="' + val.icon + '" class="img-fluid rounded" style="max-height:32px" />' : '<button type="button" class="btn btn-primary">' + extension + '</button>') + '</a></div><div class="col-10 relative"><button type="button" class="btn btn-sm absolute right mr-3" onclick="jExec($(this).closest(\'.form-group\').find(\'.custom-file-label\').text(($(this).closest(\'.form-group\').find(\'textarea\').length - 1) + \' \' + (($(this).closest(\'.form-group\').find(\'textarea\').length - 1) > 1 ? (phrase.files_were_chosen ? phrase.files_were_chosen : \'files were chosen\') : (phrase.file_was_chosen ? phrase.file_was_chosen : \'file was chosen\'))),$(this).closest(\'.uploader-list\').remove(),$(\'*\').tooltip(\'hide\'))" data-toggle="tooltip" title="' + (phrase.remove ? phrase.remove : 'Remove') + '"><i class="mdi mdi-delete text-danger"></i></button><textarea name="' + _this.attr('data-name').replace('[]', '') + '_label[' + val.file + ']" class="form-control form-control-sm" rows="1">' + val.name + '</textarea></div></div>').insertBefore(_this.closest('.input-group'))
				}),
				
				_this.next('.custom-file-label').text(files.length + ' ' + (files.length > 1 ? (phrase.files_were_chosen ? phrase.files_were_chosen : 'files were chosen') : (phrase.file_was_chosen ? phrase.file_was_chosen : 'file was chosen'))),
				
				$('[data-toggle=tooltip]').tooltip()
			}
			
			_this.on('change', function(e)
			{
				/* prevent browser to take place as well */
				e.preventDefault();
				
				var _this							= $(this);
				
				if(this.files && this.files[0])
				{
					var file						= this.files[0];
					var extension					= file.name.substr((file.name.lastIndexOf('.')));
					
					if(_this.attr('accept') && $.inArray(extension, _this.attr('accept').split(',')) === -1)
					{
						return throw_exception(403, (phrase.allowed_file_type ? phrase.allowed_file_type : 'Allowed file type') + ' <b>' + _this.attr('accept') + '</b>.');
					}
					else if((file.size / 1024) > config.max_upload_size)
					{
						return throw_exception(403, file.name + ' ' + (phrase.is_too_large ? phrase.is_too_large : 'is too large!'));
					}
					
					var reader						= new FileReader;
					
					reader.readAsDataURL(this.files[0]);
					
					reader.onload					= function(response)
					{
						if(!response.target.error)
						{
							$('<div class="row uploader-list mb-2 d-flex align-items-center"><div class="col-2 pr-0"><a href="' + response.target.result + '" target="_blank" download="' + file.name + '">' + ($.inArray(extension, ['.jpg', '.jpeg', '.png', '.gif']) !== -1 ? '<img src="' + response.target.result + '" class="img-fluid rounded" style="max-height:32px" />' : '<button type="button" class="btn btn-primary">' + extension + '</button>') + '</a></div><div class="col-10 relative uploader-file-input"><button type="button" class="btn btn-sm absolute right mr-3" onclick="jExec($(this).closest(\'.form-group\').find(\'.custom-file-label\').text(($(this).closest(\'.form-group\').find(\'textarea\').length - 1) + \' \' + (($(this).closest(\'.form-group\').find(\'textarea\').length - 1) > 1 ? (phrase.files_were_chosen ? phrase.files_were_chosen : \'files were chosen\') : (phrase.file_was_chosen ? phrase.file_was_chosen : \'file was chosen\'))),$(this).closest(\'.uploader-list\').remove(),$(\'*\').tooltip(\'hide\'))" data-toggle="tooltip" title="' + (phrase.remove ? phrase.remove : 'Remove') + '"><i class="mdi mdi-delete text-danger"></i></button><textarea name="' + _this.attr('data-name').replace('[]', '') + '_label[]" class="form-control form-control-sm" rows="1">' + file.name + '</textarea></div></div>').insertBefore(_this.closest('.input-group')),
							
							_this.clone().attr('name', _this.attr('data-name')).css('display', 'none').removeAttr('data-name role').appendTo(_this.closest('.uploader-input').prev('.uploader-list').find('.uploader-file-input')),
							
							_this.next('.custom-file-label').text(_this.closest('.form-group').find('textarea').length + ' ' + (_this.closest('.form-group').find('textarea').length > 1 ? (phrase.files_were_chosen ? phrase.files_were_chosen : 'files were chosen') : (phrase.file_was_chosen ? phrase.file_was_chosen : 'file was chosen'))),
							
							$('[data-toggle=tooltip]').tooltip()
						}
					}
				}
			})
		})
	}
	
	/**
	 * checkbox
	 */
	if($('[role=checker]').length)
	{
		$('[role=checker]').each(function()
		{
			var _parent								= $(this).attr('data-parent');
			if($(this).closest(_parent).find(':checkbox.checker-children:checked').length)
			{
				$(this).prop('checked', true)
			}
			else
			{
				$(this).prop('checked', false)
			}
		})
	}
	
	/**
	 * autocomplete plugin
	 */
	if($('[role=autocomplete]').length)
	{
		$('[role=autocomplete]').each(function()
		{
			var _this								= $(this);
			require.js([config.asset_url + 'autocomplete/autocomplete.min.js'], function()
			{
				_this.autocomplete
				({
					serviceUrl: (_this.attr('data-href') ? _this.attr('data-href') : _this.closest('form').attr('action')),
					params:
					{
						method: 'autocomplete',
						origin: _this.attr('name')
					},
					minChars: 3,
					zIndex: 9999999,
					noSuggestionNotice: (phrase.nothing_found ? phrase.nothing_found : 'Nothing found'),
					triggerSelectOnValidInput: false,
					onSelect: function(suggestion)
					{
						if(typeof suggestion.target !== 'undefined' && suggestion.target)
						{
							/* create and click the temporary link */
							$('<a href="' + suggestion.target + '" class="--xhr"></a>').appendTo('body').trigger('click').remove()
						}
						else if(_this.closest('form').hasClass('--xhr-form'))
						{
							_this.closest('form.--xhr-form').trigger('submit')
						}
						else if(_this.hasClass('on-autocomplete-trigger'))
						{
							$('input[data-mask-input=autocomplete]').remove(),
							$('<input type="hidden" name="' + _this.attr('name') + '" value="' + suggestion.value + '" data-mask-input="autocomplete" />').insertAfter(_this)
						}
					},
					onSearchComplete: function(query, suggestion)
					{
						/* additional trigger on search complete */
					}
				})
			})
		})
	}
	
	/**
	 * fetch additional file to initialize openlayers map
	 */
	if($('[role=map]').length)
	{
		$('[role=map]').each(function()
		{
			var _this								= $(this);
			
			require.css([config.asset_url + 'openlayers/ol.min.css', config.asset_url + 'openlayers/ol-geocoder/ol-geocoder.min.css', config.asset_url + 'openlayers/ol-popup/ol-popup.min.css']),
			('google' == config.openlayers_search_provider ? require.js('https://maps.googleapis.com/maps/api/js?key=' + config.openlayers_search_key + '&libraries=places') : ''),
			require.js([config.asset_url + 'openlayers/ol.min.js', config.asset_url + 'openlayers/ol-geocoder/ol-geocoder.min.js', config.asset_url + 'openlayers/ol-popup/ol-popup.min.js', config.asset_url + 'local/js/openlayers.min.js'], function()
			{
				if(typeof openlayers !== 'undefined')
				{
					openlayers.render(_this),
					$('.ol-zoom-in, .ol-zoom-out, .ol-zoom-extent button, .ol-track button, .ol-attribution button, .ol-rotate-reset button').tooltip
					({
						placement: 'right'
					})
				}
			})
		})
	}
	
	/**
	 * newsticker
	 */
	if($('[role=announcements]').length)
	{
		$('[role=announcements]').each(function()
		{
			var _this								= $(this);
			require.js([config.asset_url + 'webticker/webticker.min.js'], function()
			{
				_this.webTicker
				({
					speed: 128,
					startEmpty: false,
					duplicate: true
				})
			})
		})
	}
	
	/**
	 * fetch additional file to initialize syntax highlighter
	 */
	if($('pre code').length)
	{
		require.css([config.asset_url + 'prism/prism.min.css']),
		require.js([config.asset_url + 'prism/prism.min.js'], function()
		{
			Prism.highlightAll()
		})
	}
	
	/**
	 * fetch additional file to initialize iconpicker
	 */
	if($('[role=iconpicker]').length)
	{
		require.css([config.asset_url + 'bootstrap-iconpicker/css/bootstrap-iconpicker.min.css']),
		require.js([config.asset_url + 'bootstrap-iconpicker/js/iconset/materialdesignicons.3.3.92.min.js', config.asset_url + 'bootstrap-iconpicker/js/bootstrap-iconpicker.min.js'], function()
		{
			$('[role=iconpicker]').iconpicker
			({
				searchText: (phrase.search ? phrase.search : 'Search')
			})
		})
	}
	
	/**
	 * fetch additional file if to initialize sortable
	 */
	if($('[role=sortable-menu]').length)
	{
		$('[role=sortable-menu]').each(function()
		{
			var _this								= $(this),
				maxDepth							= 10;
			require.css([config.asset_url + 'sortable/sortable.min.css']),
			require.js([config.asset_url + 'sortable/sortable.min.js'], function()
			{
				_this.sortable
				({
					maxDepth: maxDepth,
					selector: "ul",
					list: "li",
					onChange: function(e)
					{
						_this.next('.serialized_data').val(JSON.stringify(_this.sortableToHierarchy()))
					}
				})
				.on('click', '.item-add', function(e)
				{
					if($(this).parents('ul').length >= maxDepth) return;
					
					var new_item					= _this.find('li.item-placeholder').prop('outerHTML'),
						new_item					= new_item.replace('{{id}}', $(this).parents('ul').children('li').length),
						new_item					= new_item.replace(' item-placeholder hidden"', '');
					if($(this).hasClass('children'))
					{
						if($(this).closest('li').find('ul:first').length)
						{
							$(new_item).appendTo($(this).closest('li').find('ul:first'))
						}
						else
						{
							$('<ul>' + new_item + '</ul>').appendTo($(this).closest('li'))
						}
					}
					else
					{
						$(new_item).appendTo(_this)
					}
					$('[role=iconpicker]').iconpicker
					({
						searchText: (phrase.search ? phrase.search : 'Search')
					}),
					_this.trigger('change'),
					$('[data-toggle=tooltip]').tooltip()
				})
				.on('click', '.item-remove', function(e)
				{
					e.preventDefault(),
					$(this).closest('li').slideToggle(200, function()
					{
						$(this).remove(),
						_this.trigger('change')
					});
				})
				.on('change', '.menu-icon', function()
				{
					var _icon						= $(this).find('i').attr('class');
					$(this).closest('li').attr('data-icon', _icon).parents(_this).trigger('change')
				})
				.on('change keyup', '.menu-label', function(e)
				{
					$(this).closest('li').attr('data-label', $(this).val()).parents(_this).trigger('change')
				})
				.on('change keyup', '.menu-slug', function()
				{
					$(this).closest('li').attr('data-slug', $(this).val()).parents(_this).trigger('change')
				})
				.on('click touch', '.menu-newtab', function()
				{
					$(this).closest('li').attr('data-newtab', ($(this).is(':checked') ? 1 : 0)).parents(_this).trigger('change')
				})
				.on('change', function(e)
				{
					_this.next('.serialized_data').val(JSON.stringify(_this.sortableToHierarchy()))
				});
			})
		})
	}
	
	/**
	 * sortable
	 */
	if($('[role=sortable]').length)
	{
		$('[role="sortable"]').each(function()
		{
			var _this								= $(this);
			require.css([config.asset_url + 'sortable/sortable.min.css']),
			require.js([config.asset_url + 'sortable/sortable.min.js'], function()
			{
				_this.sortable
				({
					maxDepth: 0,
					selector: (_this.attr('data-selector') ? _this.attr('data-selector') : 'ul'),
					list: (_this.attr('data-list') ? _this.attr('data-list') : 'li'),
					onChange: function(e)
					{
						return;
					}
				})
			})
		})
	}
	
	/**
	 * retrigger fetching parameter of API
	 */
	if($('.fetch-parameter').length)
	{
		$('.fetch-parameter').trigger('change')
	}
	
	/**
	 * reinitialize XFBML after ajax call
	 */
	if(XFBML)
	{
		XFBML.parse()
	}
	
	/**
	 * load tooltip and popover
	 */
	$('[data-toggle=tooltip]').tooltip(),
	$('[data-toggle=popover]').popover(),
	
	/**
	 * create a typewriter effect
	 */
	$('.typewriter').each(function()
	{
		var _this									= $(this);
		require.js([config.asset_url + 'typewriter/typewriter.min.js'], function()
		{
			_this.typewriter
			({
				delay: 75,
				extra_char: '<blink>|</blink>'
			})
		})
	}),
	
	/**
	 * check parent item and open if it's link were active
	 */
	$('.sidebar-menu .nav-item.active').each(function()
	{
		$(this).parents('li').addClass('active is-parent'),
		$(this).parents('ul').addClass('show').prev('.nav-link').addClass('is-expanded')
	}),
	
	/**
	 * retrigger the required event
	 */
	(typeof _retrigger !== 'undefined' && typeof _retrigger === 'function' ? _retrigger() : null)
};
For more information send a message to info at phpclasses dot org.