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.7

##### Bug Fixed:
Core: Fix the CRUD function both back end and front end;
Core: Fix the query string parameter for each returned data;
Core: Fix the table data that return nothing when no data exists;
Model: Fix the multiple database connection when switching the main connection to the second connection;
Model: Fix the field check when table using alias;
Javascript: Fix the query string extraction that return null value;
Javascript: Fix the geocoding (place search) on the map when using Google or OpenStreet provider;
Galleries: Fix the link that turned image not found when clicked from gallery category;
Dashboard: Fix RecursiveIterator that return error when catch unreadable upload folder;

##### Changes:
Modules: Change the "not found" page message to matched with modules;
Group: Replace the module structure for permission with path;
Permission: Change the permission check with module path;
Permission: Remove the field of module, submodule and controller and replaced with path instead;
Activity Log: Remove the field of module, submodule and controller and replaced with path instead;
Group Privileges: Remove the field of module, submodule and controller and replaced with path instead;

##### Improvements:
Core: Replace the permission with module path so it will work with unlimited sub module;
Core: Add title trim to prevent blank title when the requested data was not found;
Core: Block the Internet Explorer under version 11 that no longer supports common used javascript;
Modules: Change the "not found" page message to matched with modules;
Installer: Add the character restriction for encryption key and cookie name to prevent breaking the configuration parameter;
Javascript: Increase the maximum depth of menu builder;
Seeder: Apply column modification related to app__activity_logs, app__groups_privileges and app__settings table;
Redesign the "not found" page;
Add new language phrases;

##### New Features:
Galleries: Add the slide view for next and previous image if available;
Settings: Add the action sound toggle;
Addon: Install the add on directly from the Aksara Market;
Addon: Customize the installed theme;
Authentication: Add the annually sign in when active years is presents;
Initial commit for update 4.2.7

1. Core: Fix the CRUD function both back end and front end;
2. Core: Fix the query string parameter for each returned data;
3. Core: Block the Internet Explorer under version 11 that no longer supports common used javascript;
4. Model: Fix the multiple database connection when switching the main connection to the second connection;
5. Javascript: Fix the query string extraction that return null value;
6. Galleries: Add the slide view for next and previous image if available;
Date: 1 month ago
Size: 44,505 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;
		}
	});
	
	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)
	{
		$('html, body').animate
		({
			scrollTop: 0
		}, 200);
		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.this_browser_might_experience_problems_related_to_file_reading_permissions_on_your_device ? phrase.this_browser_might_experience_problems_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 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'),
				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'),
				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;
				
				var _this							= $(this);
				_this.summernote
				({
					airMode: (UA == 'mobile' ? true : false),
					dialogsInBody: true,
					dialogsFade: false,
					disableDragAndDrop: true,
					toolbar:
					[
						['style', ['bold', 'italic', 'underline']],
						['para', ['ul', 'ol', 'paragraph']],
						(UA != 'mobile' ? ['insert', ['link', 'picture', 'table']] : null),
						['clear']
					],
					placeholder: (_this.attr('placeholder') ? _this.attr('placeholder') : (phrase.your_content_goes_here ? phrase.your_content_goes_here : 'Your content goes here...')),
					disableResizeEditor: true,
					callbacks:
					{
						onImageUpload: function(image)
						{
							var data				= new FormData();
							data.append("image", image[0]);
							$.ajax
							({
								url: config.base_url + 'xhr/summernote/upload',
								contentType: false,
								processData: false,
								data: data,
								method: 'POST',
								beforeSend: function()
								{
								},
								success: function(response)
								{
									_this.summernote('insertImage', response.source)
								}
							})
						},
						onMediaDelete: function(image)
						{
							$.ajax
							({
								url: config.base_url + 'xhr/summernote/delete',
								method: 'POST',
								data:
								{
									source: image[0].src
								}
							})
						}
					}
				})
			})
		})
	}
	
	/**
	 * load owl carousel
	 */
	if($('.owl-carousel').length)
	{
		require.css([config.asset_url + 'owlcarousel/assets/owl.carousel.min.css', config.asset_url + 'owlcarousel/assets/owl.theme.default.min.css']),
		require.js([config.asset_url + 'owlcarousel/owl.carousel.min.js'], function()
		{
			$('.owl-carousel').each(function()
			{
				var _this							= $(this);
				$(this).owlCarousel
				({
					navText: ['<i class="mdi mdi-chevron-left"></i>', '<i class="mdi mdi-chevron-right"></i>'],
					nav: (_this.attr('data-nav') ? true : false),
					dots: (_this.attr('data-dot') ? true : false),
					merge:true,
					responsive:
					{
						0:
						{
							items: (_this.attr('data-items') ? _this.attr('data-items') : 1)
						},
						640:
						{
							items: (_this.attr('data-sm-items') ? _this.attr('data-sm-items') : 2)
						},
						1024:
						{
							items: (_this.attr('data-md-items') ? _this.attr('data-md-items') : 3)
						},
						1280:
						{
							items: (_this.attr('data-lg-items') ? _this.attr('data-lg-items') : 4),
							mergeFit:true
						}
					}
				})
			})
		})
	}
	
	/**
	 * 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)
	{
		$('[role=datepicker]').datepicker
		({
			format: 'yyyy-mm-dd',
			autoclose: true,
			zIndexOffset: 1090
		})
		.on('changeDate', function(e)
		{
		})
	}
	
	/**
	 * 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. this is paid plugin but we used the old one
	 */
	if($('[role=uploader]').length)
	{
		$('[role=uploader]').each(function()
		{
			var _this								= $(this);
			
			$(this).fileuploader
			({
				addMore: ($(this).hasClass("multiple") ? true : false),
				limit: ($(this).hasClass("multiple") ? null : 1),
				extensions: $(this).hasClass("images") ? config.image_extension_allowed : config.document_extension_allowed,
				theme: $(this).hasClass("images") ? "thumbnails" : "default",
				beforeRender: function(parentEl, inputEl)
				{
					_this.closest('.fileuploader').find('input[name=fileuploader-list-images]').not(':first').remove(),
					_this.closest('.fileuploader').find('.fileuploader-input').remove(),
					_this.closest('.fileuploader').find('.fileuploader-items').remove()
					/* additional command if any */
				},
				dialogs:
				{
					alert: function(response)
					{
						/* throw warning exception */
						throw_exception(403, response)
					}
				},
				captions:
				{
					button: function(options)
					{
						return (phrase.choose ? phrase.choose : 'Choose') + ' ' + (options.limit == 1 ? (phrase.file ? phrase.file : 'file') : (phrase.files ? phrase.files : 'file'))
					},
					feedback: function(options)
					{
						return (phrase.choose ? phrase.choose : 'Choose') + ' ' + (options.limit == 1 ? (phrase.file ? phrase.file : 'file') : (phrase.files ? phrase.files : 'files')) + ' ' + (phrase.to_upload ? phrase.to_upload : 'to upload')
					},
					feedback2: function(options)
					{
						return options.length + ' ' + (options.length > 1 ? ' ' + (phrase.files_were_chosen ? phrase.files_were_chosen : 'files were chosen') : ' ' + (phrase.file_was_chosen ? phrase.file_was_chosen : 'file was chosen'))
					},
					close: (phrase.close ? phrase.close : 'Close'),
					download: (phrase.download ? phrase.download : 'Download'),
					remove: (phrase.remove ? phrase.remove : 'Remove'),
					drop: (phrase.drag_file_to_upload ? phrase.drag_file_to_upload : 'Drag file to upload'),
					paste: '<div class="fileuploader-pending-loader"><div class="left-half" style="animation-duration: ${ms}s"></div><div class="spinner" style="animation-duration: ${ms}s"></div><div class="right-half" style="animation-duration: ${ms}s"></div></div>' + (phrase.pasting_file ? phrase.pasting_file : 'Pasting file...'),
					removeConfirmation: (phrase.are_you_sure_want_to_remove_the_selected_file ? phrase.are_you_sure_want_to_remove_the_selected_file : 'Are you sure want to remove the selected file?'),
					errors:
					{
						filesLimit: (phrase.maximum_file_limit_is ? phrase.maximum_file_limit_is : 'Maximum file limit is') + ' ${limit}.',
						filesType: (phrase.allowed_file_type ? phrase.allowed_file_type : 'Allowed file type') + ' <b>${extensions}</b>.',
						fileSize: '${name} ' + (phrase.is_too_large ? phrase.is_too_large : 'is too large!') + ' ' + (phrase.maximum_file_size_is ? phrase.maximum_file_size_is : 'Maximum file size is') + ' ${fileMaxSize} MB.',
						filesSizeAll: (phrase.file_is_too_large ? phrase.file_is_too_large : 'File is too large!')  + ' ' + (phrase.maximum_overall_file_size_is ? phrase.maximum_overall_file_size_is : 'Maximum overall file size is') + ' ${maxSize} MB.',
						fileName: (phrase.file_named ? phrase.file_named : 'File named') + ' ${name} ' + (phrase.has_been_chosen ? phrase.has_been_chosen : 'has been chosen'),
						folderUpload: (phrase.folder_upload_is_not_allowed ? phrase.folder_upload_is_not_allowed : 'Folder upload is not allowed')
					}
				}
			})
		})
	}
	
	/**
	 * 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')
				})
				.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('ul').addClass('show').prev('.nav-link').addClass('is-expanded')
	}),
	
	/**
	 * lazy load image
	 */
	$('.lazyload, img').lazyload
	({
		effect: 'fadeIn'
	})
};

For more information send a message to info at phpclasses dot org.