ACC SHELL

Path : /srv/www/vhosts/centrumlb/administrace/js/
File Upload :
Current File : /srv/www/vhosts/centrumlb/administrace/js/functions.js

// initialise plugins
$(document).ready(function(){ 
    $("ul.sf-menu").superfish({
	pathClass:  'current'
    });
});
        
$(document).ready(function(){
    $(".stripe tr").mouseover(function(){
	$(this).addClass("over");
    }).mouseout(function(){
	$(this).removeClass("over");
    });
    $(".stripe tr:even").addClass("alt");
});
        
$(function () { // this line makes sure this code runs on page load
    $('.checkall').click(function () {
	$(this).parents('table.sample').find(':checkbox').attr('checked', this.checked);
    });
});
        
$(document).ready(function(){
	
    //Minimize Content Box
		
    $(".content-box-header h3").css({
	"cursor":"s-resize"
    }); // Give the h3 in Content Box Header a different cursor
    $(".closed-box .content-box-content").hide(); // Hide the content of the header if it has the class "closed"
    $(".closed-box .content-box-tabs").hide(); // Hide the tabs in the header if it has the class "closed"
		
    $(".content-box-header h3").click( // When the h3 is clicked...
	function () {
	    $(this).parent().next().toggle(); // Toggle the Content Box
	    $(this).parent().parent().toggleClass("closed-box"); // Toggle the class "closed-box" on the content box
	    $(this).parent().find(".content-box-tabs").toggle(); // Toggle the tabs
	}
	);

    // Content box tabs:
		
    $('.content-box .content-box-content div.tab-content').hide(); // Hide the content divs
    $('ul.content-box-tabs li a.default-tab').addClass('current'); // Add the class "current" to the default tab
    $('.content-box-content div.default-tab').show(); // Show the div with class "default-tab"
		
    $('.content-box ul.content-box-tabs li a').click( // When a tab is clicked...
	function() {
	    $(this).parent().siblings().find("a").removeClass('current'); // Remove "current" class from all tabs
	    $(this).addClass('current'); // Add class "current" to clicked tab
	    var currentTab = $(this).attr('href'); // Set variable "currentTab" to the value of href of clicked tab
	    $(currentTab).siblings().hide(); // Hide all content divs
	    $(currentTab).show(); // Show the content div with the id equal to the id of clicked tab
	    return false;
	}
	);

    //Close button:
		
    $(".close").click(
	function () {
	    $(this).parent().fadeTo(400, 0, function () { // Links with the class "close" will close parent
		$(this).slideUp(400);
	    });
	    return false;
	}
	);
		
    //Tooltips:
        
    $("a.help").simpletooltip()
		
    //Hide (Collapse) the toggle containers on load
    $(".toggle_container").hide();

    //Switch the "Open" and "Close" state per click
    $("p.trigger").toggle(function(){
	$(this).addClass("active");
    }, function () {
	$(this).removeClass("active");
    });

    //Slide up and down on click
    $("p.trigger").click(function(){
	$(this).next(".toggle_container").slideToggle("slow");
    });




});
        
//Tabs:

$(function() {

    $('#container-1').tabs();
                

});
        
/*
 * FANCY BOX
 */
$(document).ready(function(){
    $("a[rel=galerie]").fancybox({
	'transitionIn'	: 'none',
	'transitionOut'	: 'none',
	'titlePosition' 	: 'over',
	'titleFormat'	: function(title, currentArray, currentIndex, currentOpts) {
	    return '<span id="fancybox-title-over">Image ' + (currentIndex + 1) + ' / ' + currentArray.length + (title.length ? ' &nbsp; ' + title : '') + '</span>';
	}
    });
    $("a[rel=galerie1]").fancybox({
	'transitionIn'	: 'none',
	'transitionOut'	: 'none',
	'titlePosition' 	: 'over',
	'titleFormat'	: function(title, currentArray, currentIndex, currentOpts) {
	    return '<span id="fancybox-title-over">Image ' + (currentIndex + 1) + ' / ' + currentArray.length + (title.length ? ' &nbsp; ' + title : '') + '</span>';
	}
    });
});
/*
 * END OF FANCY BOX
 */




/*
 * DIALOGOVÉ OKNO - OBECNÉ POTVRZOVÁNÍ
 */
$(document).ready(function() {

    $("#dialog").dialog({
	autoOpen: false,
	modal: true
    });

    $(".potvrzujiciLink").click(function(e) {
	e.preventDefault();
	var targetUrl = $(this).attr("href");

	$("#dialog").dialog({
	    autoOpen: false,
	    modal: true,
	    buttons : {
		"OK" : function() {
		    window.location.href = targetUrl;
		},
		"Zrušit" : function() {
		    $(this).dialog("close");
		}
	    }
	});

	$("#dialog").dialog("open");
    });
});
/*
 * END OF DIALOGOVÉ OKNO - OBECNÉ POTVRZOVÁNÍ
 */
/*
 * DIALOGOVÉ OKNO - ZRUŠENÍ PŘIŘAZENÍ
 */
$(document).ready(function() {

    $("#dialog-prirazeni").dialog({
	autoOpen: false,
	modal: true
    });

    $(".potvrzujiciLinkPrirazeni").click(function(e) {
	e.preventDefault();
	var targetUrl = $(this).attr("href");

	$("#dialog-prirazeni").dialog({
	    autoOpen: false,
	    modal: true,
	    buttons : {
		"OK" : function() {
		    window.location.href = targetUrl;
		},
		"Zrušit" : function() {
		    $(this).dialog("close");
		}
	    }
	});

	$("#dialog-prirazeni").dialog("open");
    });
});
/*
 * END OF DIALOGOVÉ OKNO - ZRUŠENÍ PŘIŘAZENÍ
 */


/*
 * MODÁLNÍ DIALOGOVÉ OKNO - SUPPORTNÍ FORMULÁŘ
 */
$(function() {
    // a workaround for a flaw in the demo system (http://dev.jqueryui.com/ticket/4375), ignore!
    $( "#dialog:ui-dialog" ).dialog( "destroy" );

    var //supp_predmet = $( "#supp_predmet" ),
    //email = $( "#email" ),
    text = $( "#supp_text" ),
    //password = $( "#password" ),
    allFields = $( [] ).add( text ),//.add( supp_predmet ),.add( email ).add( password ),
    tips = $( ".validateTips" );

    function updateTips( t ) {
	tips
	.text( t )
	.addClass( "ui-state-highlight" );
	setTimeout(function() {
	    tips.removeClass( "ui-state-highlight", 1500 );
	}, 500 );
    }

    function checkLength( o, n, min, max ) {
	if ( o.val().length > max || o.val().length < min ) {
	    o.addClass( "ui-state-error" );
	    updateTips( "Prosím, vyplňte požadované pole." );
	    return false;
	} else {
	    return true;
	}
    }


    $( "#dialog-form" ).dialog({
	autoOpen: false,
	height: 300,
	width: 350,
	modal: true,
	buttons: {
	    "Odeslat email": function() {
		var bValid = true;
		allFields.removeClass( "ui-state-error" );

		//bValid = bValid && checkLength( supp_predmet, "supp_predmet", 1, 9999999 );
		bValid = bValid && checkLength( text, "text", 1, 9999999 );
		if ( bValid ) {
		    document.supp_form.submit();
		}
	    },
	    "Zrušit" : function() {
		$( this ).dialog( "close" );
	    }
	},
	close: function() {
	    allFields.val( "" ).removeClass( "ui-state-error" );
	}
    });

    //$( "#Support" ).button().click(function() {
    $( "#Support" ).click(function() {
	$( "#dialog-form" ).dialog( "open" );
    });
});
/*
 * END OF MODÁLNÍ DIALOGOVÉ OKNO - SUPPORTNÍ FORMULÁŘ
 */

/*
 * MODÁLNÍ DIALOGOVÉ OKNO - STROM KATEGORIÍ
 */
$(function() {
    $( "#strom" ).dialog({
	autoOpen: false,
	modal: true
    });

    $( "#strombutton" ).click(function() {
	$( "#strom" ).dialog( "open" );
    });
});

/*
 * END OF MODÁLNÍ DIALOGOVÉ OKNO - STROM KATEGORIÍ
 */

/*
 * MODÁLNÍ DIALOGOVÉ OKNO - POTVRZENÍ HROMADNÉ AKCE
 */
$(function(){
    // jQuery UI Dialog
    //$.id_formulare;

    $('#dialog-hromadna-akce').dialog({
	autoOpen: false,
	width: 400,
	modal: true,
	resizable: false,
	buttons: {
	    "OK": function() {
		//alert($.id_formulare);
		//document.($.id_formulare).submit();
		document.getElementById($.id_formulare).submit();
	    //$('#'+id_formulare).submit();
	    //$(this).document.form.submit();

	    },
	    "Zrušit": function() {
		$(this).dialog("close");
	    }
	}
    });

    $('form.hromada').submit(function(){
	//$("#dialog-select").html($(this).val());
	$.id_formulare = ($(this).attr("id"));
	//alert (id_formulare);
	$('#dialog-hromadna-akce').dialog('open');
	return false;
    });
});

/*
 * Ajax zmena stavu kategorie
 */

$(document).ready(function (){
    $('.update_stav').click(function() {
                    
	var odkaz = $(this).attr('href');
	$.ajax({
	    type: "POST",
	    url: "/administrace/include/zmena_stavu.php",
	    data: $(this).attr('href'),
	    success: function(json){
		var data = jQuery.parseJSON(json);                                                      
		//alert('stav' + data.stav);
		$(".update_stav#" + data.id).attr('href', '?id='+data.id+'&stav='+data.stav);
		if (data.stav == 'Ne') {
		    //$(".update#" + data.id).attr('href', '?id='+data.id+'&stav='+data.stav);
		    $(".update_stav#" + data.id).text('Ne');
		}
		else {
		    //$(".update#" + data.id).attr('href', '?id='+data.id+'&stav='+data.stav);
		    $(".update_stav#" + data.id).text('Ano');
		}
                            
	    //$("#console").html('<div class="notification success png_bg"><a href="#" class="close"><img src="images/cross_grey_small.png" title="Close this notification" alt="close"></a><div>Aktuální stav panelů byl úspěšně uložen do databáze</div></div>').hide().fadeIn(1000);
	    }
	});
                    
    });
});

/*
 * prvek #checkAll oznaci vsechny .checkAll
 */
$(document).ready(function()
{
    $("#checkAll").click(function()				
    {
	var checked_status = this.checked;
	$(".checkAll").each(function()
	{
	    this.checked = checked_status;
	});
    });					
});
		
    

ACC SHELL 2018