Sindbad~EG File Manager

Current Path : /var/www/ispania.gr/templates/rslibro/js/
Upload File :
Current File : /var/www/ispania.gr/templates/rslibro/js/template.js

/**
 * @package RSLibro!
 * @copyright (C) 2016 www.rsjoomla.com
 * @license GPL, http://www.gnu.org/licenses/gpl-3.0.html
 */

!function (jQuery) {
	var timer = null;
	jQuery(document).ready(function() {
		// Initialize menu
		setTimeout(function() {
			RSTemplate.initMenu();
		}, 100);
		
		// Animate menu
		RSTemplate.animateMenu();
		
		// Toggle submenu items
		RSTemplate.toggleSubmenuItems();
		
		// Turn radios into btn-group
		RSTemplate.transformBtnGroup();
		
		// Fix for Bootstrap collapse (accordion)
		RSTemplate.fixAccordions();
		
		// Fix for Bootstrap carousel slide
		RSTemplate.fixCarousel();
		
		// Fix for Bootstrap carousel conflict width Mootools
		RSTemplate.fixMootoolsCarousel();
		
		// IE specific fixes
		RSTemplate.fixIE();
		
		// Jump to tab
		RSTemplate.tabsAnchorJump();
		
		// Tooltip
		RSTemplate.initTooltip();
		
		// Fade-in alerts
		RSTemplate.fadeInAlerts();
		
		// Fade content
		if (RSTemplate.hasContentFader()) {
			RSTemplate.fadeContent();
		}
		
		// Ripple effect
		RSTemplate.initRipple();
		
		// Border effect
		RSTemplate.initAnimateBorder();
		
		// Replace default button from file input
		RSTemplate.initAnimateInputFile();
		
		// Go to top button
		RSTemplate.initGoToTop();
		
		// Animate progress bars
		RSTemplate.animateProgressBars();
		
		// Animate checkbox
		RSTemplate.initAnimateCheckbox();

		// Animate radio
		RSTemplate.initAnimateRadio();
		
		// Roundabout
		RSTemplate.initRoundabout({
			minScale: 0.75,
			minOpacity: 1,
			autoplay: true,
			autoplayPauseOnHover: true,
			autoplayDuration: 3500,
			responsive: true
		});
	});
	
	jQuery(window).resize(function() {
		
		// Window resize delay
		if (timer != null) clearTimeout(timer);
			timer = setTimeout(function() {
				
				// Adjust menu
				RSTemplate.adjustMenu();
				
				// Toggle submenu items
				RSTemplate.toggleSubmenuItems();
				
				// Roundabout
				RSTemplate.initRoundabout({
					minScale: 0.75,
					minOpacity: 1,
					autoplay: true,
					autoplayPauseOnHover: true,
					autoplayDuration: 3500,
					responsive: true
				});
		}, 100);
	});
}(window.jQuery)

var RSTemplate = {
	fadeContent: function() {
		try {
			window.sr = new scrollReveal({ vFactor: 0.10 });
		} catch (error) {}
	},
	hasContentFader: function() {
		return (typeof scrollReveal != 'undefined');
	},
	showPreloader: function(animation_class) {
		try {
			(function() {
				var page_wrap	= document.getElementById('rstpl-pagewrap'),
					loader		= jQuery('.pageload-overlay'),
					spinner		= jQuery('.pageload-overlay > div');
					
				jQuery(window).load(function() {
					setTimeout(function() {
						page_wrap.style.visibility = 'visible';
						spinner.hide();
						loader.addClass(animation_class);
						
						setTimeout(function() {
							loader.hide();
						}, 1000);
					}, 1000);
				});
			})();
		} catch (error) {
			document.getElementById('rstpl-pagewrap').style.visibility = 'visible';
		}
	},
	transformBtnGroup: function() {
		jQuery('.radio.btn-group label').addClass('btn');
		jQuery('.btn-group label:not(.active)').click(function() {
			var label = jQuery(this);
			var input = jQuery('#' + label.attr('for'));

			if (!input.prop('checked')) {
				label.closest('.btn-group').find('label').removeClass('active btn-success btn-danger btn-primary');
				if (input.val() == '') {
					label.addClass('active btn-primary');
				} else if (input.val() == 0) {
					label.addClass('active btn-danger');
				} else {
					label.addClass('active btn-success');
				}
				input.prop('checked', true).trigger('change');
			}
		});
		jQuery('.btn-group input[checked=checked]').each(function() {
			if (jQuery(this).val() == '') {
				jQuery('label[for=' + jQuery(this).attr('id') + ']').addClass('active btn-primary');
			} else if (jQuery(this).val() == 0) {
				jQuery('label[for=' + jQuery(this).attr('id') + ']').addClass('active btn-danger');
			} else {
				jQuery('label[for=' + jQuery(this).attr('id') + ']').addClass('active btn-success');
			}
		});
	},
	fadeInAlerts: function() {
		window.setTimeout(function () {
			jQuery('.alert').addClass('in');
		}, 400);
	},
	fixAccordions: function() {
		jQuery('.rstpl-box-accordion, .accordion').each(function() {
			jQuery(this).find('.accordion-toggle').each(function(i,title) {
				if (jQuery(title).parent().siblings('.accordion-body').hasClass('in') === false)
					jQuery(title).addClass('collapsed');
			});
		});
		jQuery('.accordion-toggle').click(function() {
			jQuery(this).parents('.rstpl-box-accordion, .accordion').each(function() {
				jQuery(this).find('.accordion-toggle').each(function(i,title) {
					jQuery(title).addClass('collapsed');
				});
			});
		});
	},
	fixCarousel: function() {
		// Add reset if function does not exist in Carousel
		if (jQuery.fn.carousel.Constructor.prototype.reset == undefined) {
			jQuery.fn.carousel.Constructor.prototype.reset = function() { this.sliding = false; }
		}
	},
	fixMootoolsCarousel: function() {
		if (typeof MooTools != 'undefined' ) {
			jQuery('.carousel').each(function(index, element) {
				jQuery(this)[0].slide = null;
			});
		}
	},
	tabsAnchorJump: function() {
		// Jump to tab based on anchor
		try {
			if (location.hash) {
				jQuery('a[href=' + location.hash + ']').tab('show');
				if (jQuery('a[href=' + location.hash + ']').length) {
					jQuery('html,body').animate({
						scrollTop: jQuery('a[href=' + location.hash + ']').offset().top
					}, 1000);
				}
			}
		} catch (err) {}
	},
	initTooltip: function() {
		jQuery('*[rel=tooltip]').tooltip();
	},
	initGoToTop: function() {
		var offset			= 300,
		offset_opacity		= 1200,
		scroll_top_duration	= 700,
		back_to_top			= jQuery('.rstpl-go-top');

        jQuery(window).scroll(function(){
            (jQuery(this).scrollTop() > offset) ? back_to_top.addClass('rstpl-go-top-is-visible') : back_to_top.removeClass('rstpl-go-top-is-visible rstpl-go-top-fade-out');
            if (jQuery(this).scrollTop() > offset_opacity) {
                back_to_top.addClass('rstpl-go-top-fade-out');
            }
        });

        back_to_top.on('click', function(event) {
            event.preventDefault();
            jQuery('body,html').animate({
                scrollTop: 0,
                }, scroll_top_duration
           );
        });
	},
	animateProgressBars: function() {
		var progress_bars = jQuery('.progress');
		
		progress_bars.each(function() {
			var progress_bar			= jQuery(this).find('.bar');
			var	progress_bars_limit		= jQuery(progress_bar).attr('data-limit');
			var	progress_bars_duration	= jQuery(progress_bar).attr('data-duration');

			// Duration fallback
			typeof progress_bars_limit		=== 'undefined' ? progress_bars_limit = progress_bar.width() : progress_bars_limit;
			typeof progress_bars_duration	=== 'undefined' ? progress_bars_duration = 600 : progress_bars_duration;
			
			progress_bar.width(0);
			
			var progressBarsWaypoint	= new Waypoint({

				element: jQuery(this),
				handler: function(direction){
					typeof jQuery(progress_bar).attr('data-limit')	=== 'undefined' ? progress_bar.velocity({width: progress_bars_limit+'px'}, {duration: parseInt(progress_bars_duration)}) : progress_bar.velocity({width: progress_bars_limit+'%'}, {duration: parseInt(progress_bars_duration)});
				},
				offset: 'bottom-in-view',
			});
		});
	},
	initMenu: function() {
		var	menu = jQuery('.rstpl-main-menu-position .nav.menu, .rstpl-main-menu-full-width-position .nav.menu');
		
		if (menu.length) {
			var navbar			= menu.closest('.navbar').first(),
				menu_wrapper	= menu.parent();
				
			if (jQuery(window).width() < 980) {
				menu_wrapper.css('visibility', 'visible');
				
				if (menu_wrapper.hasClass('fixed-mobile')) {
					var initial_side_offset = (-1) * menu.outerWidth(),
						initial_top_offset	= (-1) * menu.outerHeight();
				} else {
					var initial_side_offset	= (-1) * ((jQuery(window).width() - navbar.width()) / 2 + menu.outerWidth()),
						initial_top_offset	= (-1) * (menu.outerHeight() + navbar.offset().top);
				}
				
				if (menu_wrapper.hasClass('rstpl-menu-left-mobile')) {
					menu_wrapper.css('left', initial_side_offset);
				} else if (menu_wrapper.hasClass('rstpl-menu-right-mobile')) {
					menu_wrapper.css({'right': initial_side_offset});
				} else if (menu_wrapper.hasClass('rstpl-menu-top-mobile')) {
					menu_wrapper.css({'top': initial_top_offset});
				}
				if (menu_wrapper.hasClass('opened')) {
					menu_wrapper.removeClass('opened');
				}
				if (jQuery('#first-bar').hasClass('left-bar')) {
					jQuery('#first-bar').removeClass('left-bar');
				}
				if (jQuery('#second-bar').hasClass('right-bar')) {
					jQuery('#second-bar').removeClass('right-bar');
				}
				if (jQuery('#third-bar').hasClass('bottom-bar')) {
					jQuery('#third-bar').removeClass('bottom-bar');
				}
			} else {
				if (menu_wrapper.hasClass('rstpl-menu-left-mobile')) {
					menu_wrapper.css('left', 'auto');
				} else if (menu_wrapper.hasClass('rstpl-menu-right-mobile')) {
					menu_wrapper.css('right', 'auto');
				}
			}
		}
	},
	adjustMenu: function() {
		var	menu = jQuery('.rstpl-main-menu-position .nav.menu, .rstpl-main-menu-full-width-position .nav.menu');
		
		if (menu.length) {
			var navbar			= menu.closest('.navbar').first(),
				menu_wrapper	= menu.parent();
				
			if (jQuery(window).width() < 980) {
				if (menu_wrapper.hasClass('fixed-mobile')) {
					initial_side_offset	= (-1) * menu.outerWidth();
					final_side_offset	= 0;
					initial_top_offset	= (-1) * menu.outerHeight();
					final_top_offset	= 0;
				} else {
					initial_side_offset	= (-1) * ((jQuery(window).width() - navbar.width()) / 2 + menu.outerWidth()),
					final_side_offset	= (-1) * (jQuery(window).width() - navbar.width()) / 2,
					initial_top_offset	= (-1) * (menu.outerHeight() + navbar.offset().top),
					final_top_offset	= (-1) * navbar.offset().top;
				}
				
				if (menu_wrapper.hasClass('rstpl-menu-left-mobile')) {
					if (menu_wrapper.hasClass('opened')) {
						menu_wrapper.css({'left': final_side_offset});
					} else {
						menu_wrapper.css({'left': initial_side_offset});
					}
				} else if (menu_wrapper.hasClass('rstpl-menu-right-mobile')) {
					if (menu_wrapper.hasClass('opened')) {
						menu_wrapper.css({'right': final_side_offset});
					} else {
						menu_wrapper.css({'right': initial_side_offset});
					}
				} else if (menu_wrapper.hasClass('rstpl-menu-top-mobile')) {
					if (menu_wrapper.hasClass('opened')) {
						menu_wrapper.css({'top': final_top_offset});
					} else {
						menu_wrapper.css({'top': initial_top_offset});
					}
				}
			} else {
				if (menu_wrapper.hasClass('rstpl-menu-left-mobile')) {
					menu_wrapper.css('left', 'auto');
				} else if (menu_wrapper.hasClass('rstpl-menu-right-mobile')) {
					menu_wrapper.css('right', 'auto');
				}
			}
		}
	},
	animateMenu: function() {
		var	menu = jQuery('.rstpl-main-menu-position .nav.menu, .rstpl-main-menu-full-width-position .nav.menu');
		
		if (menu.length) {
			
			jQuery('body').on('click', '.rstpl-main-menu a.btn-toggle', function() {
				var navbar			= menu.closest('.navbar').first(),
					menu_wrapper	= menu.parent();
					
				menu_wrapper.toggleClass('opened');
				
				if (menu_wrapper.hasClass('fixed-mobile')) {
					initial_side_offset	= (-1) * menu.outerWidth();
					final_side_offset	= 0;
					initial_top_offset	= (-1) * menu.outerHeight();
					final_top_offset	= 0;
				} else {
					initial_side_offset	= (-1) * ((jQuery(window).width() - navbar.width()) / 2 + menu.outerWidth()),
					final_side_offset	= (-1) * (jQuery(window).width() - navbar.width()) / 2,
					initial_top_offset	= (-1) * (menu.outerHeight() + navbar.offset().top),
					final_top_offset	= (-1) * navbar.offset().top;
				}
				
				if (menu_wrapper.hasClass('rstpl-menu-left-mobile')) {
					if (menu_wrapper.hasClass('opened')) {
						menu_wrapper.animate({'left': final_side_offset}, 200);
					} else {
						menu_wrapper.animate({'left': initial_side_offset}, 200);
					}
				} else if (menu_wrapper.hasClass('rstpl-menu-right-mobile')) {
					if (menu_wrapper.hasClass('opened')) {
						menu_wrapper.animate({'right': final_side_offset}, 200);
					} else {
						menu_wrapper.animate({'right': initial_side_offset}, 200);
					}
				} else if (menu_wrapper.hasClass('rstpl-menu-top-mobile')) {
					if (menu_wrapper.hasClass('opened')) {
						menu_wrapper.animate({'top': final_top_offset}, 200);
					} else {
						menu_wrapper.animate({'top': initial_top_offset}, 200);
					}
				}
				jQuery('#first-bar').toggleClass('left-bar');
				jQuery('#second-bar').toggleClass('right-bar');
				jQuery('#third-bar').toggleClass('bottom-bar');
			});
		}
	},
	toggleSubmenuItems: function() {
		jQuery.each(jQuery('.rstpl-main-menu .dropdown-menu'), function() {
			var curr_dropdown = jQuery(this);
			
			if (curr_dropdown.parent().find('a').first().hasClass('rippled')) {
				rippled = true;
			}
			
			if ((jQuery(window).width() < 980)) {
				if (curr_dropdown.prev('a.dropdown-toggle').length == 0) {
					curr_dropdown.prev('a, .nav-header, .separator').first().after('<a class="dropdown-toggle" href="javascript:void(0);"><span></span></a>');
					curr_dropdown.parent().children('.dropdown-toggle').on('click', function() {
						curr_dropdown.toggleClass('dropped');
						curr_dropdown.parent().toggleClass('dropped');
					});
				}
				
				curr_dropdown.parent().find('a').first().removeClass('rippled');
				
			} else if (jQuery(window).width() >= 980) {
				jQuery('.rstpl-main-menu .dropdown-toggle').remove();
				
				curr_dropdown.parent().find('a').first().addClass('rippled');
			}
		});
	},
	fixIE: function() {
		var userAgent			= navigator.userAgent;
		jQuery.browser			= {};
		jQuery.browser.msie8	= /MSIE 8.0/.test(userAgent);
		jQuery.browser.msie9	= /MSIE 9.0/.test(userAgent);
		
		// Placeholder fix for IE9
		if (jQuery.browser.msie9) {
			jQuery('input, textarea').placeholder();
		}
		
		// Last-child fix for IE8
		if (jQuery.browser.msie8) {
			jQuery('.dropdown-submenu > .dropdown-menu li:last-child').addClass('last-child');
			jQuery('.rstpl-box-pricing .table tr:last-child').addClass('last-child');
		}
	},
	initRipple: function() {
		var userAgent			= navigator.userAgent;
		jQuery.browser			= {};
		jQuery.browser.msie8	= /MSIE 8.0/.test(userAgent);
		jQuery.browser.msie9	= /MSIE 9.0/.test(userAgent);
		
		if (!jQuery.browser.msie8 && !jQuery.browser.msie9) {
			jQuery('.btn').ripple();
			
			if (jQuery(window).width() >= 980) {
				jQuery('.rstpl-main-menu-position .dropdown-menu > li > a, .rstpl-main-menu-full-width-position .dropdown-menu > li > a').ripple();
			}
			
			jQuery('.pager li > a').ripple();
		}
	},
	initAnimateBorder: function() {
		var userAgent			= navigator.userAgent;
		jQuery.browser			= {};
		jQuery.browser.msie8	= /MSIE 8.0/.test(userAgent);
		jQuery.browser.msie9	= /MSIE 9.0/.test(userAgent);
		
		if (!jQuery.browser.msie8 && !jQuery.browser.msie9) {
			if (jQuery('body').hasClass('site') || jQuery('body').hasClass('rstpl-tmpl-component')) {
				jQuery.each(jQuery('input[type="text"], input[type="password"], input[type="datetime"], input[type="datetime-local"], input[type="date"], input[type="month"], input[type="time"], input[type="week"], input[type="number"], input[type="email"], input[type="url"], input[type="search"], input[type="tel"], input[type="color"], input[type="file"]:not([class^="rsdir-"]), select:not(.rsform-selectized-box), textarea, .btn.dropdown-toggle, .rstpl-top-position a, .rstpl-footer-fluid-position a, .rstpl-footer-position a').not('.as-input, .rstpl-social-icons a, .rsblog_cover_actions #jform_image'), function() {
					if (!jQuery(this).is("[id$='selectized']") && !jQuery(this).is("[id^='rs-range-slider']")) {
						jQuery(this).animateBorder();
					}
				});
			}
			jQuery(document).ajaxStop(function() {
				if (jQuery('body').hasClass('site') || jQuery('body').hasClass('rstpl-tmpl-component')) {
					jQuery.each(jQuery('input[type="text"], input[type="password"], input[type="datetime"], input[type="datetime-local"], input[type="date"], input[type="month"], input[type="time"], input[type="week"], input[type="number"], input[type="email"], input[type="url"], input[type="search"], input[type="tel"], input[type="color"], input[type="file"], select:not(.rsform-selectized-box), textarea, .btn.dropdown-toggle, .rstpl-top-position a, .rstpl-footer-fluid-position a, .rstpl-footer-position a').not('.as-input, .rstpl-social-icons a, .rsblog_cover_actions #jform_image'), function() {
						if (!jQuery(this).is("[id$='selectized']") && !jQuery(this).is("[id^='rs-range-slider']")) {
							jQuery(this).animateBorder();
						}
					});
				}
			});
			jQuery('.editor').each(function() {
				var editor = jQuery(this);
				
				editor.find('.animated-border').addClass('hidden');
				editor.find('.toggle-editor .btn').click(function() {
					editor.find('.animated-border').toggleClass('hidden');
				});
			});
		}
	},
	initAnimateInputFile: function() {
		jQuery.each(jQuery('input[type="file"]:not([class^="rsdir-"]):not(.rsblog_cover_actions #jform_image):not(.rsform-upload-box)'), function() {
			jQuery(this).before('<span class="rstpl-input-file"></span>');
			jQuery(this).parent().css('min-width', jQuery(this).outerWidth());
			jQuery(this).prev().text('Browse...');
			jQuery(this).on('change', function() {
				jQuery(this).prev().text(jQuery(this).val().replace('C:\\fakepath\\', ''));
			});
		});
	},
	initAnimateRadio: function() {
		var userAgent			= navigator.userAgent;
		jQuery.browser			= {};
		jQuery.browser.msie8	= /MSIE 8.0/.test(userAgent);
		jQuery.browser.msie9	= /MSIE 9.0/.test(userAgent);
		
		if (!jQuery.browser.msie8 && !jQuery.browser.msie9) {
			jQuery.each(jQuery('input[type="radio"]:not(.rsform-advradio)'), function() {
				jQuery(this).after('<span class="animated-radio"></span>');
			});
			
			jQuery('.animated-radio').on('click', function() {
				if (jQuery(this).parent().prop('tagName').toLowerCase() != 'label') {
					if (!jQuery(this).prev('input').first().prop('checked')) {
						jQuery(this).prev('input').first().prop('checked', true);
					}
				}
			});
		}
	},
	initAnimateCheckbox: function() {
		var userAgent			= navigator.userAgent;
		jQuery.browser			= {};
		jQuery.browser.msie8	= /MSIE 8.0/.test(userAgent);
		jQuery.browser.msie9	= /MSIE 9.0/.test(userAgent);
		
		if (!jQuery.browser.msie8 && !jQuery.browser.msie9) {
			jQuery.each(jQuery('input[type="checkbox"]:not(.rsform-advcheckbox):not(.rsform-switcher-box)'), function() {
				jQuery(this).after('<span class="animated-checkbox"></span>');
			});
			jQuery('.animated-checkbox').on('click', function() {
				if (jQuery(this).parent().prop('tagName').toLowerCase() != 'label') {
					if (jQuery(this).prev('input').first().prop('checked')) {
						jQuery(this).prev('input').first().prop('checked', false);
					} else {
						jQuery(this).prev('input').first().prop('checked', true);
					}
				}
			});
		}
	},
	initRoundabout: function(params) {
		jQuery('.rstpl-roundabout-wrapper').each(function () {
			jQuery(this).find(jQuery('.rstpl-roundabout-description')).each(function() {
				jQuery(this).removeAttr('style');
			});
			jQuery(this).find(jQuery('.rstpl-roundabout')).children().each(function() {
				jQuery(this).removeAttr('style');
			});

			var descriptions_container	= jQuery(this).find(jQuery('.rstpl-roundabout-descriptions')),
				descriptions			= descriptions_container.children('div'),
				prev					= jQuery(this).find(jQuery('.rstpl-roundabout-control.left')),
				next					= jQuery(this).find(jQuery('.rstpl-roundabout-control.right')),
				items_container			= jQuery(this).find(jQuery('.rstpl-roundabout'));
			
			descriptions_container.css('min-height', descriptions_container.outerHeight() + 'px');
			
			jQuery.extend(params, {btnPrev: prev, btnNext: next});
			
			items_container.roundabout('destroy');
			items_container.unbind('animationStart');
			items_container.unbind('animationEnd');
			
			items_container.roundabout(params);
			
			items_container.bind('animationStart', function() {
				jQuery(descriptions.get(items_container.roundabout('getChildInFocus'))).fadeOut('fast');
			});
			
			items_container.bind('animationEnd', function() {
				jQuery(descriptions.get(items_container.roundabout('getChildInFocus'))).fadeIn('fast');
			});
		});
	}	
};

Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists