1function validmailaddr(str) 2{ 3 return (str.match(/^[a-z0-9!#$%&'*+\/=?^_`{|}~-]+(\.[a-z0-9!#$%&'*+\/=?^_`{|}~-]+)*@[a-z]([a-z0-9-]*[a-z0-9])?(\.[a-z]([a-z0-9-]*[a-z0-9])?)*\.[a-z]{2,6}$/i)); 4} 5 6function clickclear(selector) 7{ 8 var defvalue = $(selector).attr("title"); 9 10 $(selector).focus(function(){ 11 if ($(this).val()==defvalue) { 12 $(this).css({color: 'black'}); 13 $(this).val(""); 14 } 15 }); 16 17 $(selector).blur(function(){ 18 if ($(this).val()=="") { 19 $(this).val(defvalue); 20 $(this).css({color: 'silver'}); 21 } 22 }); 23 24 if ($(selector).val() != defvalue) { 25 $(selector).css({color: 'black'}); 26 } 27} 28 29function validrequired(selector, defTitle) 30{ 31 var title = defTitle || $(selector).attr("title"); 32 if ($(selector).val()=="" || $(selector).val()==title) { 33 alert("Zadajte pole " + title + "!"); 34 $(selector).focus(); 35 return false; 36 } else { 37 return true; 38 } 39} 40 41function validemail(selector) 42{ 43 var title = $(selector).attr("title"); 44 if ($(selector).val()!="" && !validmailaddr($(selector).val())) { 45 alert("Zadajte správnu e-mail adresu!"); 46 $(selector).focus(); 47 return false; 48 } else { 49 return true; 50 } 51} 52 53/** 54 * Adds events to "Spustit Radio" button 55 */ 56function mp3PlayerSetup() 57{ 58 //set global var 59 window.mp3playerWinowName = 'gi_mp3player_window'; 60 61 $('#mp3-radio-button, .mp3-radio-playable').click(function(e){ 62 var url = ($(e.target).data('radio-url')); 63 mp3PlayerOpenUrl(url); 64 }); 65} 66 67/** 68 * Opens a popup window with mp3 player that plays random songs 69 */ 70function mp3PlayerOpenUrl(url) 71{ 72 var windowHeight = 50; //javascript v radio.php updatuje tuto hodnotu 73 var googleAdsWidth = 336; 74 var googleAdsMargin = 15; 75 var windowWidth = googleAdsWidth + 2*googleAdsMargin; 76 var features = 'height='+windowHeight+',width='+windowWidth+','; 77 features += 'location=no,menubar=no,resizable=no,scrollbars=no,status=no,toolbar=no'; 78 window.open(url, window.mp3playerWinowName, features); 79} 80 81/** 82 * Simple slideshow step 83 * @returns void 84 */ 85function simpleSlideShowStep(){ 86 var slideShow = $('.SimpleSlideShow'); 87 var currentElement = slideShow.find('.SlideShowNav .Active'); 88 var nextElement = currentElement.next().first(); 89 90 if(nextElement.length == 0) 91 { 92 nextElement = slideShow.find('.SlideShowNav a:first-of-type'); 93 } 94 95 slideShow.find('.SlideShowNav a').removeClass('Active'); 96 nextElement.addClass('Active'); 97 98 99 slideShow.find('.SlideShowNav a').removeClass('active'); 100 slideShow.find('.SlideshowImage.Active').fadeOut('slow'); 101// slideShow.find('.SlideItem.active').removeAttr('style'); 102 slideShow.find('.SlideshowImage').removeClass('Active'); 103 nextElement.addClass('active'); 104 $(nextElement.data('href')).fadeIn('slow'); 105 $(nextElement.data('href')).addClass('Active'); 106} 107 108$(document).ready(function() { 109 110 mp3PlayerSetup(); 111 112 //stranka kapela: button zobrazit kontakty 113 $("body.page-kapela button#kontakt-show").on("click", function(){ 114 $(".kontakt-row > .kontakt-value > span.partial").hide(); 115 $(".kontakt-row > .kontakt-value > span.full").show(); 116 $(this).hide(); 117 //counter 118 $.ajax({ 119 url: URL_ROOT + "/kapela-kontakty-show.php", 120 method: "POST", 121 data: {kapelaId: KAPELA_ID} 122 }); 123 }); 124 125 //main menu 126 $("#top UL LI:first A").addClass("first"); 127 128 //side nav 129 $(".navheader>A").click(function(){ 130 $(".navheader .subnav").hide(); 131 $(".navheader").removeClass("active"); 132 $(this).parents('.navheader').addClass("active").find(".subnav").show(); 133 }); 134 135 // 136 // contact form 137 // 138 clickclear("#contact-form #name"); 139 clickclear("#contact-form #mail"); 140 clickclear("#contact-form #tel"); 141 clickclear("#contact-form #text"); 142 143 $("#contact-form").submit(function(){ 144 if (!validrequired("#contact-form #name")) { 145 return false; 146 } 147 if (!validrequired("#contact-form #mail")) { 148 return false; 149 } 150 if (!validemail("#contact-form #mail")) { 151 return false; 152 } 153 if (!validrequired("#contact-form #text")) { 154 return false; 155 } 156 if (!validrequired("#contact-form #g-recaptcha-response", 'kontrola reCAPTCHA')) { 157 return false; 158 } 159 }); 160 161 162 // 163 // spolupraca form 164 // 165 clickclear("#spolupraca-form #name"); 166 clickclear("#spolupraca-form #mail"); 167 clickclear("#spolupraca-form #tel"); 168 clickclear("#spolupraca-form #text"); 169 170 $("#spolupraca-form").submit(function(){ 171 if (!validrequired("#spolupraca-form #name")) { 172 return false; 173 } 174 if (!validrequired("#spolupraca-form #mail")) { 175 return false; 176 } 177 if (!validemail("#spolupraca-form #mail")) { 178 return false; 179 } 180 if (!validrequired("#spolupraca-form #text")) { 181 return false; 182 } 183 if (!validrequired("#spolupraca-form #g-recaptcha-response", 'kontrola reCAPTCHA')) { 184 return false; 185 } 186 }); 187 188 189 // 190 // login form 191 // 192 $("#login-form").submit(function(){ 193 if (!validrequired("#login-form #username")) { 194 return false; 195 } 196 if (!validrequired("#login-form #password")) { 197 return false; 198 } 199 200 var path = $("#login-form #login-form-g").val(); 201 $.post(path, {username: $("#login-form #username").val(), password: $("#login-form #password").val()}, function(data, textStatus){ 202 if ("success" == textStatus) { 203 if (-1 == data.indexOf("Zadali ste nesprávne užÃvateľské meno alebo heslo")) { 204 window.location.href = path; 205 } else { 206 alert("Zadali ste nesprávne užÃvateľské meno alebo heslo."); 207 $("#login-form #password").val("").focus(); 208 } 209 } 210 }); 211 212 return false; 213 }); 214 215 // smoothscroll init 216 // for use smoothScroll - <a data-scroll href="#mylocation"></a> 217 smoothScroll.init(); 218 219 // kapela light box images 220 $('.obrazky').magnificPopup({ 221 delegate: 'a', 222 type: 'image', 223 tLoading: 'Loading image #%curr%...', 224 mainClass: 'mfp-img-mobile mfp-no-margins mfp-with-zoom', 225 gallery: { 226 enabled: true, 227 navigateByImgClick: true,
228 preload: [0,1], // Will preload 0 - before current, and 1 after the current image 229 tPrev: 'Späť', 230 tNext: 'Vpred', 231 tCounter: '%curr% z %total%' 232 }, 233 image: { 234 tError: '<a href="%url%">The image #%curr%</a> could not be loaded.', 235 titleSrc: function(item) { 236 return item.el.attr('title') + '<small>by Marsel Van Oosten</small>'; 237 } 238 }, 239 zoom: { 240 enabled: true, 241 duration: 300 // don't foget to change the duration also in CSS 242 } 243 }); 244 245 //zoom for all images, set class ZoomImage for <a> 246 $('a.ZoomImage').magnificPopup({ 247 type: 'image', 248 closeOnContentClick: true, 249 closeBtnInside: false, 250 fixedContentPos: true, 251 mainClass: 'mfp-no-margins mfp-with-zoom', // class to remove default margin from left and right side 252 image: { 253 verticalFit: true, 254 }, 255 zoom: { 256 enabled: true, 257 duration: 300 // don't foget to change the duration also in CSS 258 } 259 }); 260 261 // youtube lightbox 262 $('.popupYoutube').magnificPopup({ 263 disableOn: 700, 264 type: 'iframe', 265 mainClass: 'mfp-fade', 266 removalDelay: 160, 267 preloader: false, 268 fixedContentPos: false 269 }); 270 271 /* slideshow */ 272 var slideShowSpeed = 7000 // 7sec 273 var slideShowTimer = setInterval(simpleSlideShowStep, slideShowSpeed); 274 275 $('.SimpleSlideShow .SlideshowImages .Active').show(); 276 277 $('.SimpleSlideShow .SlideShowNav a').click(function(){ 278 var clickedEl = $(this); 279 var slideShow = clickedEl.closest('.SimpleSlideShow'); 280 281 if(!clickedEl.hasClass('Active')) 282 { 283 slideShow.find('.SlideShowNav a').removeClass('Active'); 284 slideShow.find('.SlideshowImage.Active').fadeOut('slow'); 285 slideShow.find('.SlideshowImage').removeClass('Active'); 286 clickedEl.addClass('Active'); 287 $(clickedEl.data('href')).fadeIn('slow'); 288 289 $(clickedEl.data('href')).addClass('Active'); 290 291 clearInterval(slideShowTimer); 292 slideShowTimer = setInterval(simpleSlideShowStep, slideShowSpeed); 293 } 294 }); 295 296 // media toggle 297 $('.MediaToggleHeading a').click(function(){ 298 var $toggleSection = $('#'+$(this).data('section')); 299 300 if($(this).parent().hasClass('Open')){ 301 $('.MediaToggleHeading.Open').removeClass('Open'); 302 $toggleSection.hide('slow'); 303 } else { 304 $('.MediaToggleHeading.Open').removeClass('Open'); 305 $(this).parent().addClass('Open'); 306 $('.ToggleList').hide('slow'); 307 $toggleSection.slideToggle('slow'); 308 } 309 }); 310}); // ready
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.