1function validPhoneNr(inputtxt) { 2 var phoneno = /^\(?([0-9]{3})\)?[- ]?([0-9]{3})[- ]?([0-9]{3})$/; 3 if ((inputtxt.match(phoneno))) { 4 return true; 5 } 6 else { 7 return false; 8 } 9} 10 11$('body').append("szerokoÅÄ okna jest: " + $(window).width() + "px"); 12 13$(".img-wyjasnienie").addClass("tooltip"); 14 15 16 17 18function sprawdzDaneWiadomosci(form) { 19 var data = {}; 20 data.email = form.find('input[name=email]').val(); 21 data.temat = form.find('input[name=temat]').val(); 22 data.wiadomosc = form.find('textarea[name=wiadomosc]').val(); 23 24 if (data.email.indexOf('@') < 0) 25 return 'Podany adres e-mail jest nieprawidÅowy'; 26 27 if (data.temat.length < 3) 28 return 'Temat wiadomoÅci jest zbyt krótki - 3 znaki minimalnie, obecnie: ' + data.temat.length; 29 30 if (data.temat.length > 60) 31 return "Temat wiadomoÅci jest zbyt dÅugi - 60 znaków maksymalnie, obecnie: " + data.temat.length; 32 33 if (data.wiadomosc.length < 10) 34 return "TreÅÄ wiadomoÅci jest zbyt krótka - 10 znaków minimalnie, obecnie: " + data.wiadomosc.length; 35 36 if (data.wiadomosc.length > 1000) 37 return "TreÅÄ wiadomoÅci jest zbyt dÅuga - 1000 znaków maksymalnie, obecnie: " + data.wiadomosc.length; 38 39 return ''; 40} 41 42; 43(function ($) { 44 var isOpera = !!window.opera || navigator.userAgent.indexOf(' OPR/') >= 0; 45 // Opera 8.0+ (UA detection to detect Blink/v8-powered Opera) 46 var isFirefox = typeof InstallTrigger !== 'undefined'; // Firefox 1.0+ 47 var isSafari = Object.prototype.toString.call(window.HTMLElement).indexOf('Constructor') > 0; 48 // At least Safari 3+: "[object HTMLElementConstructor]" 49 var isChrome = !!window.chrome && !isOpera; 50 $.fn.fixMe = function () { 51 return this.each(function () { 52 var $this = $(this), 53 $t_fixed; 54 55 function init() { 56 $("#content #helper_div").hide(); // usuniecie .fixed_white 57 58 $this.wrap('<div class="container" />'); 59 $t_fixed = $this.clone(); 60 $t_fixed.find("tbody").remove().end().addClass("fixed").insertBefore($this); 61 resizeFixed(); 62 } 63 64 function resizeFixed() { 65 $t_fixed.find("th").each(function (index) { 66 if (isChrome) { 67 $(this).css("width", $this.find("th").eq(index).width() + 1 + "px"); 68 } else { 69 $(this).css("width", $this.find("th").eq(index).outerWidth() - 1 + "px"); 70 } 71 }); 72 } 73 74 function scrollFixed() { 75 var offset = $(this).scrollTop(), 76 tableOffsetTop = $this.offset().top, 77 tableOffsetBottom = tableOffsetTop + $this.height() - $this.find("thead").height(); 78 79 if (offset < tableOffsetTop || offset > tableOffsetBottom) { 80 $this.find('thead').css('visibility', 'visible'); 81 // $this.find('thead th').css('border-color', '#333'); 82 $t_fixed.hide(); 83 } 84 else if (offset >= tableOffsetTop && offset <= tableOffsetBottom && $t_fixed.is(":hidden")) { 85 $this.find('thead').css('visibility', 'hidden'); 86 // $this.find('thead th').css('border-top-color', '#fff'); 87 // $this.find('thead th').css('border-left-color', '#fff'); 88 // $this.find('thead th').css('border-right-color', '#fff'); 89 // $this.find('thead th[colspan]').css('border-bottom-color', '#fff'); 90 //$this.find('thead tr:first-child td').css('border-color', '#333 !important'); 91 $t_fixed.show(); 92 } 93 } 94 95 $(window).resize(resizeFixed); 96 $(window).scroll(scrollFixed); 97 init(); 98 }); 99 }; 100})(jQuery); 101 102 103(function ($) { 104 $.fn.enableHScroll = function () { 105 function handler(el) {
106 var lastPos = el 107 .on('scroll', function () { 108 var newPos = $(this).scrollLeft(); 109 if (newPos !== lastPos) { 110 $(this).trigger('scrollh', newPos - lastPos); 111 lastPos = newPos; 112 } 113 }) 114 .scrollLeft(); 115 } 116 117 return this.each(function () { 118 var el = $(this); 119 if (!el.data('hScrollEnabled')) { 120 el.data('hScrollEnabled', true); 121 handler(el); 122 } 123 }); 124 } 125}(jQuery)); 126 127function queryParam(key) { 128 key = key.replace(/[*+?^$.\[\]{}()|\\\/]/g, "\\$&"); 129 var match = location.search.match(new RegExp("[?&]" + key + "=([^&]+)(&|$)")); 130 return match && decodeURIComponent(match[1].replace(/\+/g, " ")); 131} 132 133var KLUCZ_ZRODLO_WEJSCIA = 'zrodlo'; 134 135function wyslijEventJesliAdwords() { 136 var zrodloWejscia = Cookies.getJSON(KLUCZ_ZRODLO_WEJSCIA) || {}; 137 138 if (zrodloWejscia.zrodlo == 'adwords') { 139 ga('send', 'event', 'dodanie_ogloszenia_z_adwords', zrodloWejscia.kampania); 140 } else if (zrodloWejscia.zrodlo == 'facebook') { 141 ga('send', 'event', 'dodanie_ogloszenia_z_facebooka', zrodloWejscia.kampania); 142 } 143} 144 145function ustawCookieZrodlo(zrodlo, kampania, medium) { 146 var aktualne = Cookies.getJSON(KLUCZ_ZRODLO_WEJSCIA) || {}; 147 148 aktualne.zrodlo = zrodlo; 149 aktualne.kampania = kampania; 150 aktualne.medium = medium; 151 aktualne.dataWejscia = new Date().getTime(); 152 153 Cookies.set(KLUCZ_ZRODLO_WEJSCIA, aktualne, { expires: 180 }); 154} 155 156$(document).on('ready', function (e) { 157 // dodanie identyfikatora AdWords do ciasteczek przeglÄ darki jeÅli istnieje w query params 158 var gclidAdwords = queryParam('gclid'); 159 if (gclidAdwords) { 160 ustawCookieZrodlo('adwords', gclidAdwords); 161 } 162 163 var utmZrodlo = queryParam('utm_source'); 164 if (utmZrodlo == 'facebook') { 165 var utmKampania = queryParam('utm_campaign'); 166 var utmMedium = queryParam('utm_medium'); 167 if (utmKampania) { 168 ustawCookieZrodlo(utmZrodlo, utmKampania, utmMedium); 169 } 170 } 171 172 var element1 = document.getElementById('ogloszenia_nieruchomosci_dodaj'); 173 var element2 = document.getElementById('ogloszenia_inne_dodaj'); 174 if (typeof (element1) != 'undefined' && element1 != null) { 175 console.log($("option:selected")); 176 $("option:selected").removeAttr("selected"); 177 } else if (typeof (element2) != 'undefined' && element2 != null) { 178 $("#uslugi_wybor").click(); 179 } 180 181 182 $('select[name=wojewodztwo]').change(function () { 183 if (this.value == 0) { 184 185 $('select[name=wojewodztwo]').addClass("noChange"); 186 } else { 187 $('select[name=wojewodztwo]').removeClass("noChange"); 188 } 189 }); 190 191 192 $(document).on('click', '.zamknij_niezalogowany_kontener', function (e) { 193 $(".dodawanie_niezalogowany_kontener").hide(); 194 }); 195 196 $(document).on('click', '.zamknij_niepotwierdzony_kontener', function (e) { 197 $(".dodawanie_niepotwierdzony_kontener").hide(); 198 }); 199 200 if ($("#drzewo_kategorii").length > 0) { 201 //$("#drzewo_kategorii").css("position", "fixed"); 202 203 var dodatek = 40; 204 if ($(".h1_back").length > 0) { 205 dodatek = $(".h1_back").height() + 50 + 40; 206 //$("#drzewo_kategorii").css("top", 85 + $(".h1_back").height() + $(".h1_back").css("padding-top") + $(".h1_back").css("padding-bottom")); 207 } else { 208 //$("#drzewo_kategorii").css("top", 85); 209 } 210 if ($("#content").height() < $("#drzewo_kategorii").height()) { 211 $("#content").height($("#drzewo_kategorii").height() + dodatek); 212 } 213 214 //$("#drzewo_kategorii").css("left", $("#drzewo_kategorii").offset().left); 215 } 216 217 $(document).on('click', '.wyczysc_formularz_a', function (e) { 218 e.preventDefault(); 219 var link = $(this).data('href'); 220 $.ajax({
221 url: link, 222 type: 'POST', 223 context: $(this), 224 data: { data: "a" }, 225 success: function (result) { 226 var element = document.getElementById('ogloszenia_pracownika_szukam_dodaj'); 227 console.log(element) 228 var element1 = document.getElementById('ogloszenia_nieruchomosci_dodaj'); 229 console.log(element1) 230 var element2 = document.getElementById('ogloszenia_inne_dodaj'); 231 console.log(element2) 232 var element3 = document.getElementById('pracownika_szukam_szukaj'); 233 console.log(element3) 234 var element4 = document.getElementById('ogloszenia_samochody_dodaj'); 235 console.log(element4) 236 if (typeof (element) != 'undefined' && element != null) { 237 $('#ogloszenia_pracownika_szukam_dodaj').find('textarea, input[type=text]').val(''); 238 $('#ogloszenia_pracownika_szukam_dodaj input[type=checkbox]').each( 239 function (k, v) { 240 if ($(v).is(':checked')) { 241 $(v).click(); 242 } 243 } 244 ); 245 $('.ui-menu-item').each( 246 function (k, v) { 247 if ($(v).text() == "Inna") { 248 $(v).click(); 249 } 250 }) 251 $('input#telefon').val(''); 252 $('#wyczysc-lokalizacja').click(); 253 } else if (typeof (element1) != 'undefined' && element1 != null) { 254 $('#ogloszenia_nieruchomosci_dodaj').find('textarea, input[type=text]').val(''); 255 $('#ogloszenia_nieruchomosci_dodaj input[type=checkbox]').each( 256 function (k, v) { 257 if ($(v).is(':checked')) { 258 $(v).click(); 259 } 260 } 261 ); 262 $('#wyczysc-lokalizacja').click(); 263 $('input#telefon').val(''); 264 $("option:selected").removeAttr("selected"); 265 window.location.reload(); 266 } else if (typeof (element2) != 'undefined' && element2 != null) { 267 $('#ogloszenia_inne_dodaj').find('textarea, input[type=text]').val(''); 268 $('#ogloszenia_inne_dodaj input[type=checkbox]').each( 269 function (k, v) { 270 if ($(v).is(':checked')) { 271 $(v).click(); 272 } 273 } 274 ); 275 $('#wyczysc-lokalizacja').click(); 276 $('input#telefon').val(''); 277 $("#uslugi_wybor").click(); 278 window.location.reload(); 279 } else if (typeof (element3) != 'undefined' && element3 != null) { 280 $('#pracownika_szukam_szukaj').find('textarea, input[type=text]').val(''); 281 $('#pracownika_szukam_szukaj input[type=checkbox]').each( 282 function (k, v) { 283 if ($(v).is(':checked')) { 284 $(v).click(); 285 } 286 } 287 ); 288 $('#wyczysc-lokalizacja').click(); 289 $('.ui-menu-item').each( 290 function (k, v) { 291 if ($(v).text() == "--") { 292 $(v).click(); 293 } 294 }) 295 $('#ogloszenie_id').val(''); 296 } else if (typeof (element4) != 'undefined' && element4 != null) { 297 $('#ogloszenia_samochody_dodaj').find('textarea, input[type=text]').val(''); 298 $('#ogloszenia_samochody_dodaj').find('textarea, input[type=number]').val(''); 299 $('#ogloszenia_samochody_dodaj input[type=checkbox]').each( 300 function (k, v) { 301 if ($(v).is(':checked')) { 302 $(v).click(); 303 } 304 } 305 ); 306 $('#wyczysc-lokalizacja').click(); 307 $('input[type=tel]').val(''); 308 } else { 309 window.location.reload(); 310 } 311 312 }, 313 error: function (result) { 314 } 315 }); 316 });
317 318 $(document).on('click', '.akceptacja_regulaminu', function (e) { 319 e.preventDefault(); 320 /* MB, 2015-11-05 - usuwam przymus zaznaczenia checkbox-a 321 if (!$("input[name=akceptacja]").is(":checked")) { 322 alert("Musisz potwierdziÄ zapoznanie siÄ z regulaminem"); 323 } else {*/ 324 var link = $(this).data('href'); 325 $.ajax({ 326 url: link, 327 type: 'POST', 328 context: $(this), 329 data: { data: "a" }, 330 success: function (result1) { 331 if (result1 == "ok") { 332 window.location.reload(); 333 } else { 334 alert(result1); 335 } 336 }, 337 error: function (result1) { 338 } 339 }); 340 //} MB 341 342 }); 343 344 345 //DJ.2016-07-05. Dodanie obsÅugi dla odroczenia potwierdzenia przy oknie potwierdzania aktualnego regulaminu. 346 $(document).on('click', '.akceptacja_regulaminu_pozniej', function (e) { 347 e.preventDefault(); 348 var link = $(this).data('href'); 349 $.ajax({
350 url: link, 351 type: 'POST', 352 context: $(this), 353 data: { data: "a" }, 354 success: function (result2) { 355 if (result2 == "ok") { 356 window.location.reload(); 357 } else { 358 alert(result2); 359 } 360 }, 361 error: function (result2) { 362 } 363 }); 364 365 366 }); 367 368 //MB, 2015-11-30 - drobna modyfikacja na potrzebny zmian w strukturze html 369 $(document).on('click', '.logowanie_okno_link', function (e) { 370 e.preventDefault(); 371 //var left = $("#upper_menu_kontener").offset().left; 372 //$(this).parent().children(".okno_wysuwane_logowanie").css("right", left); 373 if ($(".mb-login.okno_wysuwane_logowanie").is(":visible")) { 374 $(".mb-login.okno_wysuwane_logowanie").fadeOut(); 375 } else { 376 $(".mb-login.okno_wysuwane_logowanie").fadeIn(); 377 } 378 379 }); 380 381 $(document).on('click', '.zamknij_logowanie', function (e) {//MB, 2015-11-30 - drobna modyfikacja na potrzebny zmian w strukturze html 382 e.preventDefault(); 383 $(".okno_wysuwane_logowanie").fadeOut(); 384 385 }); 386 console.log('dafuq1'); 387 $(document).on('change', 'input[name=zalacznik_1]', function (e) { 388 $("input[name=zalacznik_2]").show(); 389 }); 390 391 $(document).on('change', 'input[name=zalacznik_2]', function (e) { 392 $("input[name=zalacznik_3]").show(); 393 }); 394 395 $(document).on('change', 'input[name=zalacznik_3]', function (e) { 396 $("input[name=zalacznik_4]").show(); 397 }); 398 399 $(document).on('change', 'input[name=zalacznik_4]', function (e) { 400 $("input[name=zalacznik_5]").show(); 401 }); 402 403 $(document).on('click', '.wstecz_a', function (e) { 404 e.preventDefault(); 405 var ref = document.referrer; 406 if (ref.indexOf("/szukaj") > -1) { 407 window.location.href = (ref + "&back=1"); 408 } else { 409 window.history.back(); 410 } 411 412 }); 413 414 $(document).on('submit', '#logowanie_na_skroty', function (e) { 415 e.preventDefault(); 416 417 var link = $(this).attr('action'); 418 $.ajax({
419 url: link, 420 type: 'POST', 421 context: $(this), 422 data: $(this).serialize(), 423 success: function (result) { 424 if (result == 'JesteÅ już zalogowany.') { 425 window.location.reload(); 426 } 427 else if (result.indexOf("ok") == 0) { 428 // alert("Logowanie zakoÅczone sukcesem"); 429 window.location.reload(); 430 } else { 431 console.log(result); 432 alert(result); 433 } 434 }, 435 error: function (result) { 436 alert("WystÄ piÅ bÅÄ d podczas wysyÅania formularza."); 437 } 438 }); 439 440 }); 441 442 /* MB, - 2015-11-12 - powtórzenie kodu 443 $(document).on('submit', '#logowanie_na_skroty', function (e) { 444 e.preventDefault(); 445 446 var link = $(this).attr('action'); 447 $.ajax({url: link, type: 'POST', context: $(this), data: $(this).serialize(), success: function (result) { 448 if (result == 'JesteÅ już zalogowany.') { 449 window.location.reload(); 450 } 451 if (result.indexOf("ok") == 0) { 452 //alert("Logowanie zakoÅczone sukcesem"); 453 window.location.reload(); 454 } else { 455 alert(result); 456 } 457 }, 458 error: function (result) { 459 alert("WystÄ piÅ bÅÄ d podczas wysyÅania formularza."); 460 }}); 461 462 });*/ 463 464 /** 465 * MB, 2015-10-11 - ZarzÄ dza wysyÅaniem hasÅa przez ajax 466 */ 467 $(document).on('click', '#zapomnialem_hasla', function (e) { 468 var confirm = window.confirm('Czy na pewno chcesz zresetowaÄ hasÅo?'); 469 if (confirm == true) { 470 var link = $(this).data('href'); 471 $.ajax({
472 url: link, 473 type: 'POST', 474 data: { 475 'email': $('#logowanie_na_skroty input[name=login]').val(), 476 }, 477 success: function (result) { 478 if (result == 1) { 479 alert('Na Twój adres email zostaÅa wysÅana wiadomoÅÄ!'); 480 } else { 481 alert('WystÄ piÅ bÅÄ d. ProszÄ spróbowaÄ ponownie.'); 482 } 483 }, 484 error: function (result) { 485 alert("WystÄ piÅ bÅÄ d. ProszÄ spróbowaÄ ponownie."); 486 } 487 }); 488 } 489 490 return false; 491 }); 492 493 /** 494 * DJ, 2016-07-28 - DuplikujÄ funkjÄ aby wykorzystaÄ jÄ w formularzu logowania. 495 */ 496 $(document).on('click', '#zapomnialem_hasla_formularz', function (e) { 497 var confirm = window.confirm('Czy na pewno chcesz zresetowaÄ hasÅo?'); 498 if (confirm == true) { 499 var link = $(this).attr('href'); 500 $.ajax({
501 url: link, 502 type: 'POST', 503 data: { 504 'email': $('#logowanie_formularz input[name=login]').val(), 505 }, 506 success: function (result) { 507 if (result == 1) { 508 alert('Na Twój adres email zostaÅa wysÅana wiadomoÅÄ z nowym hasÅem!'); 509 } else { 510 alert(result); 511 } 512 }, 513 error: function (result) { 514 alert("WystÄ piÅ bÅÄ d. ProszÄ spróbowaÄ ponownie."); 515 } 516 }); 517 } 518 519 return false; 520 }); 521 522 523 // if ($("#ogloszenia_tabela").length > 0) { 524 // var leftCord = $("#ogloszenia_tabela").css("left"); 525 // $("#content").scroll(function () { 526 // if ($(window).width() < 1200) { 527 // if ($(this).scrollLeft() > 0) { 528 // $("#ogloszenia_tabela").css("left", -1 * $(this).scrollLeft()); 529 // } else { 530 // $("#ogloszenia_tabela").css("left", leftCord); 531 // } 532 // } 533 // }); 534 535 536 // $("#ogloszenia_tabela tr").each(function () { 537 // var max = 0; 538 // if ($(this).children("td").length > 0) { 539 // $(this).children("td").each(function () { 540 // if (parseFloat($(this).children("a").height()) > max) { 541 // max = parseFloat($(this).children("a").height()); 542 // } 543 // }); 544 // 545 // $(this).children("td").each(function () { 546 // $(this).children("a").height(max); 547 // $(this).children("a").width($(this).width()); 548 // }); 549 // } 550 // }); 551 $("#ogloszenia_tabela").fixMe(); 552 // } 553 554 555 if ($("#img_msg").length > 0 || $("#img_mgs").length > 0) { 556 $("#img_msg").tooltip(); 557 558 $(document).on('click', '#img_msg', function (e) { 559 $("#showForm").show(); 560 }); 561 562 $(document).on('click', '.sort_naglowek_a', function (e) { 563 console.log("a"); 564 $("#loader").show(); 565 }); 566 567 $(document).on('submit', '#formularz_kontaktowy_ogloszenie', function (e) { 568 e.preventDefault(); 569 var formData = new FormData($(this)[0]); 570 var wynik = sprawdzDaneWiadomosci($(this)); 571 if (wynik == '') { 572 var _form = $(this); 573 var link = $(this).attr('action'); 574 $.ajax({
575 url: link, 576 type: 'POST', 577 data: formData, 578 //async: false, MB, 2015-11-20 (N1) 579 cache: false, 580 contentType: false, 581 enctype: 'multipart/form-data', 582 processData: false, 583 success: function (result) { 584 if (result.indexOf("ok") == 0) { 585 alert("WiadomoÅÄ zostaÅa wysÅana."); 586 587 window.location.reload(); // MB, 2015-11-12 - obejÅcie resetowanie, ponowne wczytanie strony 588 /* MB, 2015-11-12 589 $(".full_instrukcja").hide(); 590 $("input[name=email]").val(""); 591 $("input[name=temat]").val(""); 592 $("input[name=zalacznik]").val(""); 593 $("input[name=kopia]").prop("checked", false); 594 $("textarea[name=tresc]").val(""); 595 */ 596 } else { 597 alert(result); 598 } 599 }, 600 error: function (result) { 601 alert("WystÄ piÅ bÅÄ d podczas wysyÅania formularza na serwer."); 602 } 603 }); 604 } 605 else 606 alert(wynik); 607 608 return false; 609 610 }); 611 612 // $(document).on('submit', '#formularz_kontaktowy_ogloszenie', function(e) { 613 // e.preventDefault(); 614 // 615 // var link = $(this).attr('action'); 616 // $.ajax({url: link, type: 'POST', context: $(this), data: $(this).serialize(), success: function(result) { 617 // if (result.indexOf("ok") == 0) { 618 // alert("WiadomoÅÄ zostaÅa wysÅana."); 619 // $(".full_instrukcja").hide(); 620 // $("input[name=email]").val(""); 621 // $("input[name=temat]").val(""); 622 // $("textarea[name=tresc]").val(""); 623 // } else { 624 // alert(result); 625 // } 626 // }, 627 // error: function(result) { 628 // alert("WystÄ piÅ bÅÄ d podczas wysyÅania formularza."); 629 // }}); 630 // 631 // }); 632 633 } 634 635 636 $(document).on('click', '.ppk', function (e) { 637 e.preventDefault(); 638 639 var link = $(this).data('href'); 640 $.ajax({
641 url: link, 642 type: 'POST', 643 context: $(this), 644 data: { data: "data" }, 645 success: function (result) { 646 if (result != '') { 647 $(this).children('.pokaz_txt').remove(); 648 $(this).children().unwrap(); 649 650 $(".numer_telefonu_span").html(result); 651 } 652 }, 653 error: function (result) { 654 alert("WystÄ piÅ bÅÄ d podczas wysyÅania formularza."); 655 } 656 }); 657 658 }); 659 660 $(window).resize(function () { 661 if ($(window).width() < 1200) { 662 $("#content").css("overflow-x", 'scroll'); 663 } else { 664 $("#content").css("overflow-x", 'hidden'); 665 } 666 }); 667 668 if ($(window).width() < 1200) { 669 $("#content").css("overflow-x", 'scroll'); 670 } 671 672 $('.menu_element a').each(function () { 673 var href = window.location.href; 674 675 676 if ($(this).attr("href") == href) { 677 if ($(this).parent().prop("class") == 'element_rozwijany') { 678 $(this).parent().parent().parent().css("background", "teal"); 679 } 680 $(this).parent().css("background", "#3D9999"); 681 } else { 682 if (href.indexOf("?") > -1) { 683 var spl = href.split("?"); 684 href = spl[0]; 685 } 686 687 if ($(this).attr("href") == href) { 688 if ($(this).parent().prop("class") == 'element_rozwijany') { 689 $(this).parent().parent().parent().css("background", "teal"); 690 } 691 $(this).parent().css("background", "#3D9999"); 692 } else { 693 if (href.indexOf("&") > -1) { 694 var spl2 = href.split("&"); 695 href = spl2[0]; 696 } 697 if ($(this).attr("href") == href) { 698 if ($(this).parent().prop("class") == 'element_rozwijany') { 699 $(this).parent().parent().parent().css("background", "teal"); 700 } 701 $(this).parent().css("background", "#3D9999"); 702 } 703 } 704 705 706 } 707 }); 708 709 $(document).on('mouseenter', 'div.menu_element a.rozwijane', function (e) { 710 $(".menu_rozwijane").hide(); 711 $(this).parent().children('.menu_rozwijane').show(); 712 }); 713 714 $(document).on('mouseenter', '#helper_div', function (e) { 715 $(".menu_rozwijane").hide(); 716 }); 717 718 $(document).on('mouseenter', '#content', function (e) { 719 $(".menu_rozwijane").hide(); 720 }); 721 722 723 $(document).on('click', 'div.menu_element a.rozwijane', function (e) { 724 if ($(this).parent().children('.menu_rozwijane').is(":visible")) { 725 $(this).parent().children('.menu_rozwijane').hide(); 726 } else { 727 $(this).parent().children('.menu_rozwijane').show(); 728 } 729 }); 730 731 /* 732 $(document).on('mouseout', 'div.menu_element a.rozwijane', function(e) { 733 if (!$(this).parent().children('.menu_rozwijane').is(":hover")) { 734 $(this).parent().children('.menu_rozwijane').hide(); 735 } 736 }); 737 */ 738 $(document).on('mouseleave', '.menu_rozwijane', function (e) { 739 if (!$(this).parent('.menu_element').is(":hover")) { 740 $(this).hide(); 741 } 742 }); 743 744 $(document).on('click', 'a.rozwijane', function (e) { 745 e.preventDefault(); 746 return false; 747 }); 748 749 //MB, 2015-11-03 750 //var values = {}; 751 //$('#dodaj_ogloszenie_div input, #dodaj_ogloszenie_div select, #dodaj_ogloszenie_div textarea').focusin(function(){ 752 // values[$(this).attr('name')] = $(this).val(); 753 //}); 754 755 /*$('#dodaj_ogloszenie_div').on('change', 'input, select, textarea', function(){ 756 var type = $(this).attr('type'); 757 //console.log(type); 758 if(type == 'submit') 759 return false; 760 761 var value = $(this).val(); 762 /* 763 if(value == '') 764 { 765 $(this).css('border', '1px solid red'); 766 } 767 else if(value == values[$(this).attr('name')]) 768 { 769 $(this).css('border', '1px solid yellow'); 770 } 771 else*/ 772 /*if(value != '' && value != '--') 773 { 774 $(this).addClass('changed'); 775 } 776 else 777 $(this).removeClass('changed');*/ 778 779 //console.log(value); 780 /*});*/ 781 782 783}); 784$(function () { 785 $("#useroptions-close").on("click", function () { 786 $(".useroptions ul").fadeOut("normal"); 787 });
788}); 789 790$('.pane-hScroll').scroll(function () { 791 $('.pane-vScroll').width($('.pane-hScroll').width() + $('.pane-hScroll').scrollLeft()); 792}); 793 794//funkcja umożliwiajÄ ca okreÅlenie limitu dla pola typu textarea 795function textarealimit(textarea, rows, chars, rowsleft_id, charsleft_id) { 796 var newValue; 797 var valueSegments = textarea.value.split('\n'); 798 if (rows != undefined && valueSegments.length > rows) { // too many rows 799 newValue = valueSegments.slice(0, rows).join("\n"); 800 } 801 if (chars != undefined && textarea.value.length > chars) { // too many chars 802 if (newValue != undefined) 803 newValue = newValue.substring(0, chars); 804 else 805 newValue = textarea.value.substring(0, chars); 806 } 807 if (newValue != undefined) textarea.value = newValue; 808 809 if (rowsleft_id != undefined) { 810 if (textarea.value == "") document.getElementById(rowsleft_id).innerHTML = rows; 811 else if (rows - valueSegments.length >= 0) document.getElementById(rowsleft_id).innerHTML = rows - valueSegments.length; 812 } 813 if (charsleft_id != undefined) { 814 if (chars != undefined) document.getElementById(charsleft_id).innerHTML = chars - textarea.value.length; 815 } 816} 817 818 819var limitLinesValues = {}; 820 821function limitLines(obj, e) { 822 if (!(obj.name in limitLinesValues)) { 823 limitLinesValues[obj.name] = obj.value; 824 } 825 826 if (obj.scrollHeight > obj.clientHeight) { 827 obj.value = limitLinesValues[obj.name]; 828 } else { 829 limitLinesValues[obj.name] = obj.value 830 } 831} 832 833function przekieruj(sciezka) { 834 window.location.href = window.location.protocol + '//' + window.location.hostname + sciezka; 835} 836 837function przekierujDoMoichOgloszen(kategoria) { 838 przekieruj('/' + kategoria + '/moje-ogloszenia'); 839} 840/******************************************************************************/ 841/* Notimeo.pl custom js */ 842/******************************************************************************/ 843$(function () { 844 DisableAreaClosing.init(); 845 FormFields.init(); 846 Submits.init(); 847 Hightlight.init(); 848 SmsPayment.init(); 849 850 if ($('#openModal').length > 0) { 851 PopUp.init(); 852 } 853}); 854 855$(window).load(function () { 856 UnsetDisabledButton.init(); 857}); 858var PopUp = { 859 openModal: $('#openModal'), 860 tabModelMsg: [], 861 openBackground: $('#popup-background'), 862 closeModal: $('#close'), 863 864 init: function () { 865 PopUp.event(); 866 }, 867 868 event: function () { 869 870 PopUp.closeModal.on('click', function (e) { 871 e.preventDefault(); 872 PopUp.closePopup(); 873 }); 874 }, 875 closePopup: function (calback) { 876 if ($.isFunction(calback)) { 877 calback() 878 } 879 PopUp.openModal.removeAttr('style'); 880 PopUp.openBackground.removeAttr('style'); 881 /** 882 * Added by kmadenski - UsuniÄcie specyficznej klasy, która jest nakÅadana w PopUp 'promocja z podstrony ogloszenia-wynajem/dodaj' 883 * @date 2017-09-04 884 */ 885 886 /** 887 * End edit by kmadenski 888 */ 889 890 }, 891 popupCreate: function (result, msg, callback) { 892 893 PopUp.popupHeaderCreate(msg); 894 $('#openModelContent').html('<p>' + result + '</p>'); 895 PopUp.openBackground.css('display', 'block'); 896 PopUp.openModal.css('display', 'block'); 897 898 if ($.isFunction(callback)) { 899 callback(); 900 } 901 }, 902 popupHeaderCreate: function (msg) { 903 if (!msg) { 904 msg = ''; 905 } 906 var header = $('#header-popup'); 907 if (msg !== undefined) { 908 header.text(msg); 909 } else { 910 911 } 912 913 } 914}; 915 916var UnsetDisabledButton = { 917 disabledButton: [], 918 919 init: function () { 920 var input = $('.disable_on_js_off'); 921 922 $.each(input, function (key, item) { 923 var buttonItem = $(item); 924 925 if (buttonItem.attr('disabled') === 'disabled') { 926 UnsetDisabledButton.disabledButton.push(buttonItem); 927 } 928 }); 929 930 UnsetDisabledButton.unsetDisabled() 931 }, 932 933 unsetDisabled: function () { 934 if (UnsetDisabledButton.disabledButton.length > 0) { 935 $.each(UnsetDisabledButton.disabledButton, function (key, item) { 936 item.removeAttr('disabled'); 937 }); 938 } 939 } 940}; 941 942var DisableAreaClosing = { 943 area_class: 'area_hideshow', 944 init: function () { 945 DisableAreaClosing.events(); 946 // DisableAreaClosing.checkValues();
947 }, 948 checkValues: function () { 949 $('.' + DisableAreaClosing.area_class).each(function () { 950 var area = $(this); 951 var areaContent = area.find('.area_hideshow__content'); 952 var areaHead = area.find('.area_hideshow__head'); 953 var fieldsInsideArea = []; 954 955 area.find('textarea').each(function () { 956 var textarea = $(this); 957 958 fieldsInsideArea.push(textarea.val()); 959 }); 960 961 area.find('select').each(function () { 962 var select = $(this); 963 var firstOpt = select.children()[0]; 964 965 if (select.val() !== $(firstOpt).attr('value')) { 966 fieldsInsideArea.push(select.val()); 967 } 968 }); 969 970 area.find('input').each(function () { 971 var input = $(this); 972 973 if ( 974 input.attr('type') !== 'submit' 975 && input.attr('type') !== 'button' 976 && input.attr('type') !== 'checkbox' 977 && input.attr('type') !== 'radio' 978 ) { 979 fieldsInsideArea.push(input.val()); 980 } 981 982 if (input.attr('type') === 'checkbox') { 983 if (input.is(':checked') && input.attr('name') !== 'czy_dokladny_rok') { 984 fieldsInsideArea.push(input.val()); 985 } 986 } 987 }); 988 989 area.find('.area_hideshow__value').each(function () { 990 var value = $.trim($(this).text()); 991 992 if (value !== '--') { 993 fieldsInsideArea.push(value); 994 } 995 }); 996 997 var empty = true; 998 999 $.each(fieldsInsideArea, function (key, item) { 1000 if (item !== '' && item !== null && item !== '-1' && item !== '--') { 1001 empty = false; 1002 1003 areaContent.removeAttr('style'); 1004 areaContent.css('display', 'block'); 1005 1006 areaHead.text('Ukryj'); 1007 areaHead.addClass('clicked'); 1008 areaHead.css('visibility', 'hidden'); 1009 } 1010 1011 return (2); 1012 }); 1013 1014 if (empty) { 1015 areaHead.css('visibility', 'visible'); 1016 } 1017 1018 area.removeAttr('style'); 1019 }); 1020 }, 1021 events: function () { 1022 $('.' + DisableAreaClosing.area_class).each(function () { 1023 var area = $(this); 1024 1025 setTimeout(function () { 1026 var head = area.find(DisableAreaClosing.area_class + '__head'); 1027 1028 head.each(function () { 1029 $(this).closest('.area_hideshow') 1030 .find(DisableAreaClosing.area_class + '__content') 1031 .removeAttr('style'); 1032 }); 1033 1034 head.unbind('click'); 1035 head.click(function () { 1036 var $this = $(this); 1037 var $content = $this.closest(DisableAreaClosing.area_class) 1038 .find(DisableAreaClosing.area_class + '__content'); 1039 1040 if ($content.is(':hidden')) { 1041 $content.slideDown(500); 1042 $this.addClass('clicked').text('Ukryj'); 1043 } else { 1044 $content.slideUp(500); 1045 $this.removeClass('clicked').text('WiÄcej'); 1046 } 1047 }); 1048 1049 DisableAreaClosing.checkValues(); 1050 }, 10); 1051 1052 area.find('textarea, select, input').each(function () { 1053 // define form field variable 1054 var input = $(this); 1055 1056 // check values on any input change 1057 input.change(function () { 1058 DisableAreaClosing.checkValues(); 1059 }); 1060 }); 1061 }); 1062 } 1063}; 1064 1065/** 1066 * This class is used for form. It adds some additional functionalities for its 1067 * fields. 1068 */ 1069var FormFields = { 1070 /** 1071 * Initializing method. 1072 */ 1073 init: function () { 1074 FormFields.events(); 1075 }, 1076 /** 1077 * Method catching JS events. 1078 */ 1079 events: function () { 1080 $('.js-numeric_form_field').each(function () { 1081 var input = $(this); 1082 var maxLen = parseInt(input.attr('data-maxlen')); 1083 1084 if (isNaN(maxLen)) { 1085 return true; 1086 } 1087 1088 input.val( 1089 input.val().substr(0, maxLen) 1090 ); 1091 }).on("keydown", function (e) { 1092 var input = $(this); 1093 var inputLen = input.val().length + 1; 1094 var keyCode = (e.which) ? e.which : e.keyCode; 1095 var maxLen = parseInt(input.attr('data-maxlen')); 1096 1097 if (isNaN(maxLen)) { 1098 return true; 1099 } 1100 1101 return keyCode === 8 // backspace 1102 || keyCode === 9 // TAB key 1103 || keyCode === 46 // DEL key 1104 || keyCode >= 37 && keyCode <= 40 // arrows 1105 || inputLen <= maxLen && keyCode >= 48 && keyCode <= 57 // numbers 1106 || inputLen <= maxLen && keyCode >= 96 && keyCode <= 105 // numbers from keypad 1107 ; 1108 }); 1109 } 1110}; 1111 1112/** 1113 * This class is used for submitting form by submits which are outside that form. 1114 */ 1115var Submits = { 1116 /** 1117 * Initialize function 1118 */ 1119 init: function () { 1120 Submits.events(); 1121 }, 1122 /** 1123 * Method catching JS events. 1124 */ 1125 events: function () { 1126 $('input[type=submit]').click(function (e) { 1127 var $input = $(this); 1128 var formName = $input.attr('form'); 1129 1130 if (typeof formName !== 'undefined') { 1131 e.preventDefault(); 1132 1133 $('form#' + formName).submit(); 1134 } 1135 }); 1136 } 1137}; 1138 1139/** 1140 * This class is used to secure and block ad creation spam which can be 1141 * initialized by repeatedly clicking "Add ad" button. 1142 */ 1143var AdAddSecurity = { 1144 /** 1145 * Check whether particular button is already blocked. 1146 * @param {jQuery} $btn 1147 * @returns {boolean} 1148 */ 1149 isBlocked: function ($btn) { 1150 return $btn.data('clicked') !== '' && $btn.data('clicked') !== undefined; 1151 }, 1152 /** 1153 * Block and secure form button. 1154 * @param {jQuery} $btn 1155 */ 1156 secure: function ($btn) { 1157 $btn.data('clicked', $btn.val()); 1158 $btn.val('WysyÅanie...'); 1159 }, 1160 1161 /** 1162 * Make button clicable again. 1163 * @param {jQuery} $btn 1164 */ 1165 free: function ($btn) { 1166 $btn.val($btn.data('clicked')); 1167 $btn.data('clicked', ''); 1168 } 1169}; 1170 1171var Hightlight = { 1172 init: function () { 1173 this.events(); 1174 }, 1175 events: function () { 1176 $('.js-wyroznij_ogloszenie').click(function (e) { 1177 e.preventDefault(); 1178 1179 PopUp.popupCreate( 1180 $('.wyroznij_ogloszenie-popup_content').html(), 1181 'Wyróżnij ogÅoszenie', 1182 function () { 1183 WyroznijOgloszeniaPopup.init(); 1184 } 1185 ); 1186 }); 1187 1188 } 1189}; 1190 1191var WyroznijOgloszeniaPopup = { 1192 init: function () { 1193 this.events(); 1194 }, 1195 events: function () { 1196 $('.js-test_email').click(function () { 1197 var email = $('.testowany_email').val(); 1198 var idOgloszenia = $(this).data('id_ogloszenia'); 1199 var typOgloszenia = $(this).data('typ_ogloszenia'); 1200 1201 $.get('/platnosci/sprawdz_email_dla_ogloszenia', { 1202 'email': email, 1203 'id_ogloszenia': idOgloszenia, 1204 'typ_ogloszenia': typOgloszenia 1205 }, function (data) { 1206 if (data === 'true') { 1207 $('.wyroznij_ogloszenie-form').show(); 1208 $('.wybor-typu-info').show(); 1209 $('.wybor-adresu-email-info').hide(); 1210 $('.wyroznij_ogloszenie-form .error').hide(); 1211 $('.wyroznij_ogloszenie-form-email-test').hide(); 1212 } 1213 else { 1214 $('.wyroznij_ogloszenie-form .error').show(); 1215 } 1216 }); 1217 }); 1218 1219 $('.js-typ-wyroznienia').click(function () { 1220 var typWyroznienia = $(this).data('typ_wyroznienia'); 1221 alert(typWyroznienia); 1222 }); 1223 } 1224}; 1225 1226var SmsPayment = { 1227 init: function () { 1228 this.events(); 1229 }, 1230 events: function () { 1231 // clicked on the SEND button 1232 $(document).on('click', 'button.js-wyroznij_ogloszenie-form', function (e) { 1233 e.preventDefault(); 1234 1235 var $btn = $(this); 1236 var $container = $('.wyroznij_ogloszenie-form'); 1237 var type = $container.find('input[name=type]').val(); 1238 var id = $container.find('input[name=id]').val(); 1239 var $codeInput = $container.find('input[name=code]'); 1240 var code = $codeInput.val(); 1241 var $checking = $('<p class="wyroznij_ogloszenie-loading">Sprawdzanie kodu...</p>'); 1242 1243 $btn.attr('disabled', 'disabled'); 1244 $codeInput.attr('disabled', 'disabled'); 1245 $container.append($checking); 1246 1247 $.ajax({
1248 url: '/platnosci/ajax_sms_validation', 1249 type: 'POST', 1250 data: { type: type, code: code, id: id }, 1251 dataType: 'json' 1252 }).done(function (response) { 1253 $checking.remove(); 1254 $btn.removeAttr('disabled'); 1255 $codeInput.removeAttr('disabled'); 1256 1257 PopUp.closePopup(); 1258 PopUp.popupCreate(response.msg, response.header); 1259 }); 1260 }); 1261 } 1262}; 1263 1264 1265 1266 1267/******************************************************************************/ 1268/* end Notimeo.pl custom js */ 1269/******************************************************************************/
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.