//CALENDAR START $(document).ready(function(){ $("div.modulbox.kalendar ul.tabs li a, div.modulbox.kalendar-big ul.tabs li a").click(function(){ //var type = $(this).text(); //$("div.modulbox.kalendar ul.tabs li a").removeClass(); $(this).parent().parent().find('li a').removeClass(); $(this).addClass('current'); $.fn.show_calendar('',$(this)); }); $("a.event, strong.today a").live("click",function(e,x){ $.fn.show_calendar_news($(this).text(),$(this)); var selected = $(this).parents("div.modulbox").find("strong.select"); var htmlsel = ""+selected.text()+""; selected.parent().html(htmlsel); $("a.event").removeClass('select'); var html = ""+$(this).text()+""; $(this).parent().html(html); }); (function( $ ) { $.fn.show_calendar = function( dates, objct ) { var parents = $(objct).parents("div.modulbox"); var type = parents.find('ul.tabs li a.current').text(); var cal_type = parents.attr('class'); //$("div.modulbox.kalendar ul.tabs li a.current").text(); $.ajax({ type: 'POST', data: { 'dates':dates, 'type':type, 'cal_type':cal_type }, url: "/sk/ajax/calendar/", success: function(data){ //} if(data) { //alert(data); var obj = jQuery.parseJSON(data); $.current = obj.current; var parents = $(objct).parents('div.modulbox');console.log(obj.calendar); parents.find('div.content-box div div:first').html(obj.calendar); parents.find("div.content-box div div.news").html(obj.news); $('.calendar .content-box div div:first').html(''); $('.calendar .content-box div div:first').html(obj.calendar); if(!parents.hasClass('kalendar-big')){ $('#right .news').html(obj.news); } //$('div.modulbox.kalendar div.content-box div div.news').html(obj.news); //$('div.modulbox.kalendar div.content-box div div').html(obj.calendar); //$('div.modulbox.kalendar div.content-box div div.news').html(obj.news); } } }); } $.fn.show_calendar_news = function( day, objct) { var parents = $(objct).parents("div.modulbox"); var type = parents.find('ul.tabs li a.current').text();//$("div.modulbox.kalendar ul.tabs li a.current").text(); var cal_type = parents.attr('class'); $.ajax({ type: 'POST', data: { 'dates':$.current, 'day_selected':day, 'type':type, 'cal_type':cal_type }, url: "http://www.uszz.sk/sk/ajax/calendar_news/", success: function(data){ //} if(data) { var obj = jQuery.parseJSON(data); parents.find("div.content-box > div > div.news:first").html(obj.news); $('.calendar .content-box div div.news:first').html(''); $('.calendar .content-box div div.news:first').html(obj.news); //$('div.modulbox.kalendar div.content-box div div.news').html(obj.news); } } }); } })( jQuery ); $.current="2017/11"; }); /* $(function() { if($(".calendar-news ul li").length >= 3) { $(".calendar-news").jCarouselLite({ vertical: true, hoverPause:true, visible: 3, auto:3000, speed:1000, btnNext: ".cal-next", btnPrev: ".cal-prev" }); } }); //CALENDAR END //SLIDER-SPRAVY START $(function() { $(".partneri").jMyCarousel({ visible: '100%' }); $("#slider-spravy").jMyCarousel({ visible: '100%' }); });*/ //SLIDER-SPRAVY END //FANCYBOX START $(document).ready(function() { $("a[rel=galeria]").fancybox({ 'transitionIn' : 'none', 'transitionOut' : 'none', 'titlePosition' : 'over', 'titleFormat' : function(title, currentArray, currentIndex, currentOpts) { return ''+(title.length ? '   ' + title : '')+' Obrázok ' + (currentIndex + 1) + ' / ' + currentArray.length + ''; } }); $("a[rel=galeria-slider]").fancybox({ 'transitionIn' : 'none', 'transitionOut' : 'none', 'titlePosition' : 'over', 'titleFormat' : function(title, currentArray, currentIndex, currentOpts) { return ''+(title.length ? '   ' + title : '')+' Obrázok ' + (currentIndex + 1) + ' / ' + currentArray.length + ''; } }); $(".show-comments").click(function(){ $("#comments").slideToggle("fast"); $(this).toggleClass("active"); return false; }); }); //FANCYBOX END //kotvy $(document).ready(function() { if($('.kotvy h2').length >=3) { $('.kotvy h2').addClass('rychla-nav'); if($(".kotvy h2").is(".rychla-nav") == true ){ $("#right").prepend('

Obsah stránky

'); $("h2.rychla-nav").each(function (i) { $(this).prepend(""); $("#rychla-nav").append("
  • »" + $(this).text() + "
  • "); }); } } }); //kotvy koniec $(function() { $("div.news ul.tabs").tabs("div.news div.content-box > div"); $("div.blog ul.tabs").tabs("div.blog div.content-box > div"); $("div.krajania-informuju#div1 ul.tabs").tabs("div.krajania-informuju#div1 div.content-box > div",{initialIndex: 0}); $("div.krajania-informuju#div2 ul.tabs").tabs("div.krajania-informuju#div2 div.content-box > div",{initialIndex: 0}); $("div.krajania-informuju#div3 ul.tabs").tabs("div.krajania-informuju#div3 div.content-box > div",{initialIndex: 0}); $("div.najcitanejsie ul.tabs").tabs("div.najcitanejsie div.content-box > div"); //$("div.kalendar ul.tabs").tabs("div.kalendar div.content-box > div"); $( "input.calendar" ).datepicker({ dateFormat: 'dd.mm.yy', yearRange: '1700:2017', changeMonth: true, changeYear: true }); }); (function( $ ) { $.fn.serializeObject = function() { var o = {}; var a = this.serializeArray(); $.each(a, function() { if (o[this.name]) { if (!o[this.name].push) { o[this.name] = [o[this.name]]; } o[this.name].push(this.value || ''); } else { o[this.name] = this.value || ''; } }); return o; }; $.fn.listing = function(mod,page) { mod = mod.toLowerCase(); //TODO check mod var values = { }; values = $('[name*="'+page_class+'"]').serializeObject(); values[page_class+'[page]'] = page; values[page_class+'[letter]'] = $.filter_letter; $.ajax({ type: 'POST', url: "http://www.uszz.sk/sk/ajax/"+mod+"/", data: values, success: function(data){ if(data) { parsed = jQuery.parseJSON(data); var html = ''; html = eval('parsed.'+mod); html += ""; $("div.modulbox."+mod+"-vypis div.content-box").html(html); $("div.strankovanie").html(parsed.pagination); } } }); }; })( jQuery ); $(document).ready(function(){ $('[name*="'+page_class+'[name]"]').change(function(){ $.fn.listing(page_class,0); }); $('a.letter').click(function(){ $.filter_letter = $(this).text(); $(this).addClass('selected'); $.fn.listing(page_class,0); }); $("div.strankovanie a").live('click',function(){ $.fn.listing(page_class,$(this).attr('href')); }); }); //$("div.dalsie-osobnosti ul.tabs li").click(function(){$.fn.modulbox_content(this,1)}); /*$(document).ready(function(){ $.fn.modulbox_content($("div.dalsie-osobnosti ul.tabs li"),1); });*/ (function( $ ) { $.fn.forum_delete_post = function( id, obj ) { if(id) { var values = { }; values[page_class+'[id]'] = id; $.ajax({ type: 'POST', url: "http://www.uszz.sk/sk/forum/delete_post/", data: values, success: function(data){ if(data) { if(data=='true') $(obj).parent().toggle(); } } }); } }; $.fn.forum_delete_topic = function( id, obj ) { if(id) { var values = { }; values[page_class+'[id]'] = id; $.ajax({ type: 'POST', url: "http://www.uszz.sk/sk/forum/delete_topic/", data: values, success: function(data){ if(data) { if(data=='true') $(obj).parent().parent().toggle(); } } }); } }; $.fn.forum_get_post = function( id, obj ) { if(id) { var values = { }; values[page_class+'[id]'] = id; $.ajax({ type: 'POST', url: "http://www.uszz.sk/sk/forum/get_post/", data: values, success: function(data){ if(data) { if(data) { $(obj).parent().prepend(data); $(obj).remove(); } } } }); } }; $.fn.forum_add_reaction = function( id,obj ) { if(id) { var react = $('.add-comment [name="Forum[reaction]"]'); //alert(react); if(react.length==0) { $(".add-comment").prepend('
    Reakcia na príspevok:
    '+$(obj).parent().parent().parent().html()+"
    "); $(".add-comment form").append(''); } else { val = $('.add-comment form input[name="Forum[reaction]"]').val(); if(val != id) { $(".add-comment div").html(''); $(".add-comment").prepend('
    Reakcia na príspevok:
    '+$(obj).parent().parent().parent().html()+"
    "); react.val(id); } } } }; })( jQuery ); $(document).ready(function() { var triggers = $(".modalInput").overlay({ closeOnClick: true }); (function( $ ) { $.fn.print_message = function( obj ) { $('div.message').html(''); html = ''; $.each(obj, function(key, value) { html += ''+value+''; }); $('div.message').html(html); }; })( jQuery ); //login $("#prihlasenie form").submit(function(e) { e.preventDefault(); var email = $('input[name="Login[email]"]', this).val(); var password = $('input[name="Login[password]"]', this).val(); var values = { }; values['Login[email]'] = email; values['Login[password]'] = password; $.ajax({ type: 'POST', url: "http://www.uszz.sk/sk/login/", data: values, success: function(data){ //} if(data) { var obj = jQuery.parseJSON(data); if(obj.success) location.reload(); else $.fn.print_message(obj); } } }); return e.preventDefault(); }); //lostpass $("#zabudnute-heslo form").submit(function(e) { e.preventDefault(); var email = $('input[name="Login[email]"]', this).val(); var values = { }; values['Login[email]'] = email; $.ajax({ type: 'POST', url: "http://www.uszz.sk/sk/login/lostpassword/", data: values, success: function(data){ //} if(data) { var obj = jQuery.parseJSON(data); $.fn.print_message(obj); } } }); return e.preventDefault(); }); });