1var siescigam = siescigam || { 2 el: { 3 body: $('body'), 4 loader: $('.loader') 5 }, 6 class: { 7 error: 'error', 8 infoError: 'info-error', 9 active: 'active', 10 formGroup: 'formRow' 11 }, 12 helper: { 13 combineSerialisedFormData: function (strEscapedSerialisedFormData) { 14 var arrFormData = strEscapedSerialisedFormData.split("&"); 15 var dictCombinedKeys = {}; 16 for (var i = 0; i < arrFormData.length; i++) { 17 var arrParam = arrFormData[i].split("="); 18 var strKey = arrParam[0]; 19 var strValue = arrParam[1]; 20 21 if (strKey !== "" && strValue !== "") { 22 if (typeof (dictCombinedKeys[strKey]) === "undefined") { 23 if (strValue !== '0') 24 dictCombinedKeys[strKey] = strValue; 25 } 26 else { 27 if (strValue !== '0') 28 dictCombinedKeys[strKey] += "," + strValue; 29 } 30 } 31 } 32 33 var arrKeyValuePairs = []; 34 for (var key in dictCombinedKeys) { 35 if (dictCombinedKeys.hasOwnProperty(key)) { 36 arrKeyValuePairs.push(key + "=" + dictCombinedKeys[key]); 37 } 38 } 39 40 return arrKeyValuePairs.join("&"); 41 }, 42 scrollToClass: function (elClass) { 43 var elOffsetTop = $("body ." + elClass).offset().top; 44 $("html, body").animate({scrollTop: elOffsetTop - $('.headerFixed').height() - 60}, 400); 45 }, 46 countMaxChar: function () { 47 var $textareaMax = $('textarea[maxlength]'); 48 49 if($textareaMax.attr('class')) { 50 var $counter = $textareaMax.parent().find('.textarea-count'), 51 max = $textareaMax.attr('maxlength'), 52 len = $textareaMax.val().length; 53 54 $counter.text(len + '/' + max); 55 56 $textareaMax.keyup(function () { 57 var $this = $(this), 58 $counter = $this.parent().find('.textarea-count'), 59 max = $this.attr('maxlength'), 60 len = $this.val().length; 61 62 $counter.text(len + '/' + max); 63 }); 64 } 65 }, 66 getParameterByName: function(name, url) { 67 if (!url) url = window.location.href; 68 name = name.replace(/[\[\]]/g, '\\$&'); 69 var regex = new RegExp('[?&]' + name + '(=([^&#]*)|&|#|$)'), 70 results = regex.exec(url); 71 if (!results) return null; 72 if (!results[2]) return ''; 73 return decodeURIComponent(results[2].replace(/\+/g, ' ')); 74 } 75 }, 76 slug: { 77 build: function (s, opt) { 78 s = String(s); 79 opt = Object(opt); 80 81 var defaults = { 82 'delimiter': '-', 83 'limit': undefined, 84 'lowercase': true, 85 'replacements': {}, 86 'transliterate': (typeof(XRegExp) === 'undefined') ? true : false 87 }; 88 89 // Merge options 90 for (var k in defaults) { 91 if (!opt.hasOwnProperty(k)) { 92 opt[k] = defaults[k]; 93 } 94 } 95 96 var char_map = { 97 // Latin symbols 98 '©': '(c)', 99 100 // Polish 101 'Ä': 'A', 'Ä': 'C', 'Ä': 'e', 'Å': 'L', 'Å': 'N', 'Ã': 'o', 'Å': 'S', 'Ź': 'Z', 102 'Å»': 'Z', 103 'Ä ': 'a', 'Ä': 'c', 'Ä': 'e', 'Å': 'l', 'Å': 'n', 'ó': 'o', 'Å': 's', 'ź': 'z', 104 'ż': 'z' 105 }; 106 107 // Make custom replacements 108 for (var k in opt.replacements) { 109 s = s.replace(RegExp(k, 'g'), opt.replacements[k]); 110 } 111 112 // Transliterate characters to ASCII 113 if (opt.transliterate) { 114 for (var k in char_map) { 115 s = s.replace(RegExp(k, 'g'), char_map[k]); 116 } 117 } 118 119 // Replace non-alphanumeric characters with our delimiter 120 var alnum = (typeof(XRegExp) === 'undefined') ? RegExp('[^a-z0-9]+', 'ig') : XRegExp('[^\\p{L}\\p{N}]+', 'ig'); 121 s = s.replace(alnum, opt.delimiter); 122 123 // Remove duplicate delimiters 124 s = s.replace(RegExp('[' + opt.delimiter + ']{2,}', 'g'), opt.delimiter); 125 126 // Truncate slug to max. characters 127 s = s.substring(0, opt.limit); 128 129 // Remove delimiter from ends 130 s = s.replace(RegExp('(^' + opt.delimiter + '|' + opt.delimiter + '$)', 'g'), ''); 131 132 return opt.lowercase ? s.toLowerCase() : s; 133 }, 134 init: function () { 135 $('.js-build-slug').focusout(function () { 136 var val = $(this).val(); 137 138 $('.js-slug').val(siescigam.slug.build(val)); 139 }); 140 } 141 }, 142 scrollFirstError: function () { 143 var scrollFirstError = $("body ." + siescigam.class.infoError + ":first").parents('.' + siescigam.class.formGroup).offset().top; 144 $("html, body").animate({scrollTop: scrollFirstError - $('.headerFixed').height() - 60}, 400); 145 }, 146 removeErrorMSG: function (field) { 147 var $this = $("[name=" + field + "]"); 148 $this.parent().removeClass(siescigam.class.error).find('.' + siescigam.class.infoError).fadeOut(300, function () { 149 $(this).remove(); 150 }); 151 }, 152 createErrorMSG: function (errors) { 153 $('.' + siescigam.class.formGroup).removeClass(siescigam.class.error); 154 $('.' + siescigam.class.infoError).remove(); 155 156 if (typeof errors === 'object') { 157 $.each(errors, function (field, error_msg) { 158 159 switch (field) { 160 case 'slug': 161 field = 'title'; 162 break; 163 } 164 165 var $this = $("[name=" + field + "]"), 166 added_val; 167 168 if ($this.parents('.' + siescigam.class.formGroup).hasClass('is-no-label')) 169 added_val = -9; 170 else 171 added_val = 15; 172 173 if ($this.parents('.' + siescigam.class.formGroup).hasClass(siescigam.class.formGroup)) { 174 $this.parents('.' + siescigam.class.formGroup).addClass(siescigam.class.error) 175 .append('<span class="' + siescigam.class.infoError + '">' + error_msg + '</span>') 176 .find('.' + siescigam.class.infoError).fadeIn(300).css({'top': -($this.parents('.' + siescigam.class.formGroup).find('.' + siescigam.class.infoError).height() - added_val)}); 177 } else { 178 $this.parents('.form-part').addClass(siescigam.class.error) 179 .append('<span class="' + siescigam.class.infoError + '">' + error_msg + '</span>') 180 .find('.' + siescigam.class.infoError).fadeIn(300).css({'top': -($this.parents('.' + siescigam.class.formGroup).find('.' + siescigam.class.infoError).height())}); 181 } 182 }); 183 184 siescigam.scrollFirstError(); 185 } else { 186 toastr.error('WystÄ piÅ nieoczekiwany bÅÄ d, jeżeli bÄdzie siÄ powtarzaÅ skontaktuj siÄ z nami.'); 187 } 188 }, 189 loader: function (show) { 190 var $el = siescigam.el.loader; 191 192 if (typeof show === 'undefined') 193 show = false;
194 195 if (show) { 196 $el.fadeIn(200); 197 } else { 198 $el.fadeOut(200); 199 } 200 }, 201 pagination: { 202 paged: 0, 203 page: 0, 204 results: 0, 205 shown: 0, 206 get: function () { 207 208 } 209 }, 210 uploads: { 211 createImagesJSON: function () { 212 var $imagesList = $('.js-files-list'), 213 removeJSON = JSON.parse($('input[name=images_remove]').val()); 214 215 images_json = []; 216 $imagesList.find('.item.is-load').each(function (index) { 217 var thisJSON = JSON.parse($(this).attr('data-json')); 218 219 thisJSON.order = index; 220 221 if (index === 0) 222 thisJSON.is_default = true; 223 else 224 thisJSON.is_default = false; 225 226 images_json.push(thisJSON); 227 }); 228 229 if (removeJSON.length > 0) 230 $.each(removeJSON, function (index, value) { 231 images_json.push(value); 232 }); 233 234 $('input[name=images_json]').val(JSON.stringify(images_json)); 235 }, 236 updateImagesDIV: function (file) { 237 var $el = $('.js-files-list').find('.item:not(.is-load):first'); 238 239 $el.css('background-image', 'url(' + file.thumbnail_url + ')').addClass('is-load').attr('data-json', JSON.stringify(file)); 240 }, 241 removeImagesDIV: function ($el, maxNumberOfFiles) { 242 var $inputRemoveImages = $('input[name=images_remove]'), 243 elJSON = JSON.parse($el.attr('data-json')), 244 removeJSON = JSON.parse($inputRemoveImages.val()); 245 246 if (maxNumberOfFiles) { 247 $el.css('background-image', '').removeClass('is-load'); 248 $el.appendTo('.js-files-list'); 249 } else { 250 $el.remove(); 251 } 252 253 elJSON.action = 'delete'; 254 removeJSON.push(elJSON); 255 $inputRemoveImages.val(JSON.stringify(removeJSON)); 256 this.createImagesJSON(); 257 }, 258 init: function () { 259 var images_json = [], 260 $imagesList = $('.js-files-list'), 261 $imagesJSON = $("#images_json"), 262 imagesAddedCount = $imagesList.find('.item.is-load').length, 263 onlyView = false, 264 startJSON, 265 $theme; 266 267 $theme = $('<div class="item"></div>') 268 .append( 269 $('<div class="buttons"></div>') 270 .append( 271 $('<span></span>') 272 .addClass('remove') 273 .text('UsuÅ') 274 ) 275 ); 276 277 if (typeof maxNumberOfFiles === 'undefined') { 278 maxNumberOfFiles = 7; 279 } else if (maxNumberOfFiles === 'boolean') { 280 maxNumberOfFiles = false; 281 } 282 283 if (typeof urlUploadFile === 'undefined') { 284 onlyView = true; 285 $imagesList.addClass('only-view'); 286 } 287 288 if (typeof maxNumberOfFiles === 'number') { 289 $theme 290 .append( 291 $('<div></div>') 292 .addClass('text') 293 .html('<u>kliknij</u><br>aby dodaÄ<br>zdjÄcie') 294 ); 295 296 for (var i = 0; i < maxNumberOfFiles; i++) { 297 $imagesList.prepend($theme.clone()); 298 } 299 } 300 301 if ($imagesJSON.length > 0) { 302 303 if ($imagesJSON.val() !== '') { 304 var removeJSON = []; 305 306 if (typeof fileJSON !== 'undefined') { 307 startJSON = JSON.parse(fileJSON); 308 } else { 309 startJSON = JSON.parse($imagesJSON.val()); 310 } 311 312 $.each(startJSON, function (index, value) { 313 314 switch (value.action) { 315 case 'add_new': 316 case 'saved': 317 if (typeof maxNumberOfFiles !== 'number') 318 $imagesList.append($theme.clone()); 319 320 siescigam.uploads.updateImagesDIV(value); 321 break; 322 case 'delete': 323 removeJSON.push(value); 324 break; 325 } 326 }); 327 $('input[name=images_remove]').val(JSON.stringify(removeJSON)); 328 siescigam.uploads.createImagesJSON(); 329 } 330 331 if (!onlyView) { 332 $('body').on('click', '#dropzone, .js-files-list .item:not(.is-load)', function (e) { 333 e.stopPropagation(); 334 $("#fileupload").trigger('click'); 335 }); 336 337 $imagesList.on('click', '.remove', function (e) { 338 e.stopPropagation(); 339 siescigam.uploads.removeImagesDIV($(this).parents('.item'), maxNumberOfFiles); 340 imagesAddedCount--; 341 }); 342 343 $imagesList.sortable({ 344 items: ".is-load", 345 update: function () { 346 siescigam.uploads.createImagesJSON(); 347 } 348 }); 349 $imagesList.disableSelection(); 350 351 $('#fileupload').fileupload({ 352 url: urlUploadFile, 353 formData: {_token: $('meta[name="csrf-token"]').attr('content')}, 354 autoUpload: true, 355 dataType: 'json', 356 maxNumberOfFiles: maxNumberOfFiles, 357 maxFileSize: 3145728, 358 dropZone: $('#dropzone'), 359 //acceptFileTypes: /(\.|\/)(gif|jpe?g|png)$/i, 360 add: function (e, data) { 361 siescigam.loader(true); 362 if (maxNumberOfFiles) { 363 if (imagesAddedCount < maxNumberOfFiles) { 364 imagesAddedCount++; 365 data.submit(); 366 } else { 367 toastr.warning('Nie można dodaÄ wiÄcej zdjÄÄ.'); 368 return false;
369 } 370 } else { 371 imagesAddedCount++; 372 data.submit(); 373 } 374 }, 375 done: function (e, data) { 376 if (typeof data.result.error === 'undefined') { 377 $.each(data.result, function (index, file) { 378 images_json.push(file); 379 if (typeof maxNumberOfFiles !== 'number') 380 $imagesList.append($theme.clone()); 381 382 $imagesJSON.val(JSON.stringify(images_json)); 383 siescigam.uploads.updateImagesDIV(file); 384 siescigam.uploads.createImagesJSON(); 385 386 toastr.success('ZdjÄcie ' + file.file_real_name + ' zostaÅo dodane.'); 387 }); 388 } else { 389 imagesAddedCount--; 390 toastr.warning(data.result.error); 391 } 392 siescigam.loader(false); 393 }, 394 fail: function (e, data) { 395 imagesAddedCount--; 396 toastr.error('WystÄ piÅ nieoczekiwany bÅÄ d, jeżeli bÄdzie siÄ powtarzaÅ skontaktuj siÄ z nami.'); 397 siescigam.loader(false); 398 } 399 400 }); 401 } 402 } 403 } 404 }, 405 calendars: { 406 el: { 407 categories: $('.categories'), 408 options: $('.options'), 409 search: $('.search'), 410 theme: $('.theme-item li'), 411 grid: $('.calendarGrid ul'), 412 pagination: $('.pagination'), 413 nameFilter: { 414 'TYPE_CARS': 'imprezy samochodowe', 415 'TYPE_CARS_4X4': 'imprezy 4x4', 416 'TYPE_MOTORS': 'imprezy motocyklowe' 417 } 418 }, 419 class: {}, 420 search: { 421 curentPage: 1, 422 lastPage: 0, 423 dataForm: false, 424 icheckLastChange: 0, 425 createPagination: function (pages, curentPage, per_page, total, total_with_changes) { 426 var pagination = siescigam.calendars.el.pagination; 427 428 if (pages > 1) { 429 pagination.show(0); 430 pagination.find('.current').html('<span>' + curentPage + '</span> z ' + pages); 431 pagination.find('.js-from').html(curentPage * per_page); 432 pagination.find('.js-to').html(total); 433 434 if (curentPage === 1) { 435 pagination.find('.first').hide(0); 436 pagination.find('.prev').hide(0); 437 } else { 438 pagination.find('.first').show(0); 439 pagination.find('.prev').show(0); 440 } 441 442 if (curentPage === pages) { 443 pagination.find('.next').hide(0); 444 pagination.find('.last').hide(0); 445 } else { 446 pagination.find('.next').show(0); 447 pagination.find('.last').show(0); 448 } 449 } else { 450 pagination.hide(0); 451 } 452 siescigam.calendars.search.curentPage = curentPage; 453 siescigam.calendars.search.lastPage = pages; 454 }, 455 createList: function (items) { 456 457 if (typeof items !== 'undefined') { 458 siescigam.calendars.el.grid.html(''); 459 460 $.each(items, function (index, data) { 461 var theme = siescigam.calendars.el.theme.clone(); 462 463 switch (data.status) { 464 case 'NEW': 465 theme.find('.calendarRow').prepend( 466 $('<div class="label green"><a>Nowa</a></div>') 467 ).find('.mask').addClass('green').html('<span>Nowo dodana impreza</span>'); 468 break; 469 case 'CANCELED': 470 theme.find('.calendarRow').prepend( 471 $('<div class="label red"><a>OdwoÅana</a></div>') 472 ).find('.mask').addClass('red').html('<span>Uwaga! Impreza odwoÅana</span>'); 473 break; 474 case 'CHANGE_DATE_NEW': 475 476 break; 477 case 'CHANGE_DATE_OLD': 478 theme.find('.calendarRow').prepend( 479 $('<div class="label orange"><a>Uwaga</a></div>') 480 ).find('.mask').addClass('orange').html('<span>Uwaga! Impreza przeniesiona z ' + data.date_start + ' na ' + data.new_date_start + '!</span>'); 481 break; 482 } 483 484 theme.find('.mask').attr('href', data.url); 485 486 theme.find('.columnDate').prepend( 487 $('<div></div>').html(data.date_start), 488 $('<div></div>').html(data.date_end) 489 ).find('.gray').html(data.days); 490 491 theme.find('.columnLogo a').attr('href', data.url) 492 .find('img').attr('src', data.image); 493 494 theme.find('.js-region strong').html(data.region); 495 theme.find('.js-city').html(data.city); 496 497 theme.find('.js-title a').attr('href', data.url).html(data.title); 498 theme.find('.js-short-desc').html(data.short_description); 499 theme.find('.js-tags').html(data.tags); 500 501 502 siescigam.calendars.el.grid.append(theme); 503 }); 504 } else { 505 siescigam.calendars.el.grid.html('<li style="color: #ff9100;font-size: 18px;text-align: center; padding: 15px;text-transform: uppercase;">Przykro nam, nic dla Ciebie nie znaleźliÅmy. ZmieÅ kryteria wyszukiwania.</li>'); 506 } 507 siescigam.loader(false); 508 }, 509 get: function (page) { 510 var filter = siescigam.calendars.dataForm; 511 siescigam.loader(true); 512 513 if (typeof page === 'undefined') { 514 page = 1; 515 } 516 517 $.ajax({ 518 url: base_url + 'kalendarz/szukaj?page=' + page, 519 type: "POST", 520 // dataType : 'json', 521 data: (filter ? siescigam.helper.combineSerialisedFormData(filter) : null),
522 success: function (result) { 523 siescigam.calendars.search.createList(result.data); 524 siescigam.calendars.search.createPagination(result.pages, page, result.per_page, result.total_events, result.total_events_with_changes); 525 }, 526 error: function (xhr, resp, text) { 527 console.log(xhr, resp, text); 528 }, 529 complete: function () { 530 } 531 }); 532 }, 533 init: function () { 534 var $search = siescigam.calendars.el.search; 535 siescigam.calendars.dataForm = $search.serialize(); 536 537 this.get(); 538 539 siescigam.calendars.el.categories.find('a').click(function (e) { 540 e.preventDefault(); 541 542 var $this = $(this), 543 type = $this.attr('data-type'); 544 545 siescigam.calendars.el.categories.find('a').removeClass('active'); 546 $this.addClass('active'); 547 548 siescigam.calendars.el.options.find('li .min').html(siescigam.calendars.el.nameFilter[type]); 549 550 siescigam.calendars.el.options.find('li').removeClass('active'); 551 siescigam.calendars.el.options.find('li:first').addClass('active'); 552 553 $search.find('input[name="rodzaj"]').val(type); 554 555 siescigam.calendars.dataForm = $search.serialize(); 556 siescigam.calendars.search.get(1); 557 }); 558 559 siescigam.calendars.el.options.find('a').click(function (e) { 560 e.preventDefault(); 561 562 var $this = $(this); 563 siescigam.calendars.el.options.find('li').removeClass('active'); 564 $this.parent().addClass('active'); 565 $search.find('input[name="tylko_promo"]').val($this.attr('data-promo')); 566 567 siescigam.calendars.dataForm = $search.serialize(); 568 siescigam.calendars.search.get(1); 569 }); 570 571 $search.find('.icheck').on('ifChanged', function (event) { 572 573 if (event.timeStamp - siescigam.calendars.search.icheckLastChange > 450) { 574 $search.delay(500).queue(function () { 575 576 siescigam.calendars.dataForm = $search.serialize(); 577 siescigam.calendars.search.get(1); 578 579 $search.dequeue(); 580 581 }); 582 } 583 siescigam.calendars.search.icheckLastChange = event.timeStamp; 584 }); 585 586 $search.find('input[type="text"]').on('change', function () { 587 siescigam.calendars.dataForm = $search.serialize(); 588 siescigam.calendars.search.get(1); 589 }); 590 591 siescigam.calendars.el.pagination.find('.first').click(function () { 592 siescigam.calendars.search.get(1); 593 siescigam.helper.scrollToClass('articleContainer'); 594 }); 595 siescigam.calendars.el.pagination.find('.prev').click(function () { 596 siescigam.calendars.search.get(siescigam.calendars.search.curentPage - 1); 597 siescigam.helper.scrollToClass('articleContainer'); 598 }); 599 siescigam.calendars.el.pagination.find('.next').click(function () { 600 siescigam.calendars.search.get(siescigam.calendars.search.curentPage + 1); 601 siescigam.helper.scrollToClass('articleContainer'); 602 }); 603 siescigam.calendars.el.pagination.find('.last').click(function () { 604 siescigam.calendars.search.get(siescigam.calendars.search.lastPage); 605 siescigam.helper.scrollToClass('articleContainer'); 606 }); 607 608 $search.find('input[name="typ"]').on('ifChecked', function (event) { 609 if (event.currentTarget.value === '0') { 610 $search.find('input[name="typ"]:not([value="
6100"])').each(function () { 611 $(this).iCheck('uncheck'); 612 }); 613 } else { 614 $search.find('input[name="typ"][value="0"]').iCheck('uncheck'); 615 } 616 }); 617 } 618 } 619 }, 620 classifieds: { 621 el: { 622 form: $('form.formAddClassifieds'), 623 viewBtn: $('.js-view'), 624 viewWrap: $('.view-wrap'), 625 summary: $('.js-summary'), 626 summaryTxt: $('.js-summary-txt'), 627 showData: $('.js-show-data') 628 }, 629 form: { 630 send: function ($form, e) { 631 var type = $form.find('input[name=type]').val(); 632 siescigam.loader(true); 633 634 if (typeof type !== 'undefined') { 635 var errorInfo = 0, 636 $imagesList = $('.js-files-list'), 637 imagesAddedCount = $imagesList.find('.item.is-load').length; 638 639 switch (type) { 640 case 'CLASSIFIEDS_SELL': 641 case 'CLASSIFIEDS_PARTS': 642 case 'CLASSIFIEDS_RENT': 643 if (imagesAddedCount === 0) { 644 errorInfo = 'Nie zapomnij o zdjÄciach, musisz dodaÄ przynajmniej 1 zdjÄcie'; 645 } 646 break; 647 case 'TYPE_IMAGE': 648 if (imagesAddedCount <= 4) { 649 errorInfo = 'Nie zapomnij o zdjÄciach, musisz dodaÄ przynajmniej 5 zdjÄÄ'; 650 } 651 break; 652 case 'TYPE_VIDEO': 653 if (imagesAddedCount === 0) { 654 errorInfo = 'Musisz dodaÄ zdjecie domyÅlne'; 655 } 656 break; 657 } 658 659 if (errorInfo !== 0) { 660 toastr.error(errorInfo); 661 siescigam.loader(false); 662 return; 663 } 664 } 665 $.ajax({ 666 type: $form.attr('method'), 667 url: $form.attr('action'), 668 data: $form.serialize() 669 }) 670 .success(function (result) { 671 if (typeof result.errors === 'object') { 672 if (result.errors.promo) { 673 toastr.warning(result.errors.promo); 674 } else { 675 siescigam.createErrorMSG(result.errors); 676 toastr.warning('ZnaleźliÅmy bÅÄdy w Twoim formularzu.'); 677 } 678 } 679 680 if (typeof result.redirect === 'string') { 681 window.location.replace(result.redirect); 682 } 683 }) 684 .fail(function (result) { 685 686 if (typeof result.responseJSON.redirect === 'string') { 687 window.location.replace(result.responseJSON.redirect); 688 } else { 689 toastr.error('WystÄ piÅ nieoczekiwany bÅÄ d, jeżeli bÄdzie siÄ powtarzaÅ skontaktuj siÄ z nami.'); 690 } 691 }) 692 .always(function () { 693 siescigam.loader(false); 694 }); 695 } 696 }, 697 summaryPromo: function () { 698 var txtString = '', 699 price = 0; 700 701 $('[name^=promo]:checked').each(function (index, value) { 702 price = parseFloat(price) + parseFloat($(value).attr('data-price')); 703 txtString = txtString + $(value).attr('data-option-txt') + ", "; 704 }); 705 706 siescigam.classifieds.el.summary.html(price); 707 siescigam.classifieds.el.summaryTxt.html(txtString.slice(0, -2)); 708 }, 709 showData: function () { 710 this.el.showData.click(function (e) { 711 var $this = $(this), 712 beforeLink = '', 713 dataType = $this.attr('data-show-type'), 714 dataShow = $this.attr('data-show'); 715 716 if (!$this.hasClass(siescigam.class.active)) { 717 e.preventDefault(); 718 } 719 720 switch (dataType) { 721 case 'mail': 722 beforeLink = 'mailto:'; 723 break; 724 case 'phone': 725 beforeLink = 'tel:'; 726 break; 727 } 728 729 $this.attr('href', beforeLink + dataShow).addClass(siescigam.class.active).html('<strong>' + dataShow + '</strong>'); 730 }); 731 }, 732 init: function () { 733 $('.formSend a').click(function () { 734 siescigam.loader(true); 735 }); 736 737 this.el.form.find('.button').click(function (e) { 738 var $form = $(this).parents('form'); 739 if ($form.attr('data-send-by-ajax') !== 'no') { 740 e.preventDefault(); 741 siescigam.classifieds.form.send($form, e); 742 } 743 }); 744 745 this.el.viewBtn.click(function () { 746 var $this = $(this), 747 imgView = $this.attr('data-img-view'); 748 749 siescigam.classifieds.el.viewWrap.html( 750 $('<img src="' + imgView + '" />') 751 ); 752 }); 753 754 $('[name^=promo]').on('ifChanged', function (event) { 755 var $this = $(this), 756 name = $this.attr('name'), 757 value = $this.val(), 758 only = $this.attr('data-option-only'); 759 760 $('[name=' + name + ']:not([value=' + value + '])').removeAttr('checked').iCheck('update'); 761 762 if (only === 'true') { 763 $('[data-option-only=false]').removeAttr('checked').iCheck('update'); 764 } else { 765 $('[data-option-only=true]').removeAttr('checked').iCheck('update'); 766 } 767 768 siescigam.classifieds.summaryPromo(); 769 }); 770 771 siescigam.classifieds.summaryPromo(); 772 773 // CHANGE CATEGORY, LOAD TYPE EVENTS // 774 $('#field-category').change(function () { 775 var platformGroup = $('#field-platform').parents('.formRow'); 776 777 switch ($(this).val()) { 778 case 'TYPE_E_SPORT': 779 platformGroup.show(); 780 break; 781 default: 782 platformGroup.hide(); 783 break; 784 } 785 if(typeof typeEvent !== 'undefined') { 786 var $select = $('#field-type_of_event'); 787 $select.html(''); 788 789 $select.append($('<option>', { 790 value: '', 791 text : 'Wybierz' 792 })); 793 794 $.each(typeEvent[$(this).val()]['type_of_event'], function(value, text){ 795 $select.append($('<option>', { 796 value: value, 797 text : text 798 })) 799 }); 800 } 801 }); 802 // / CHANGE CATEGORY, LOAD TYPE EVENTS // 803 804 // SHOW/HIDE REGIONS // 805 var $elInPoland = $('input[name="in_poland"]'), 806 $inputCountry = $('input[name="country"]').parent(), 807 $selectRegion = $('#form_region').parent(); 808 809 $elInPoland.on('ifChecked', function () { 810 $selectRegion.hide(0).find('select').val(0); 811 $inputCountry.show(0).find('input').val(''); 812 }); 813 $elInPoland.on('ifUnchecked', function () { 814 $selectRegion.show(0).find('select').val(0); 815 $inputCountry.hide(0).find('input').val(''); 816 }); 817 // / SHOW/HIDE REGIONS // 818 } 819 }, 820 tracks: { 821 map: { 822 style: [ 823 { 824 "elementType": "geometry", 825 "stylers": [ 826 { 827 "color": "#212121" 828 } 829 ] 830 }, 831 { 832 "elementType": "labels.icon", 833 "stylers": [ 834 { 835 "visibility": "off" 836 } 837 ] 838 }, 839 { 840 "elementType": "labels.text.fill", 841 "stylers": [ 842 { 843 "color": "#757575" 844 } 845 ] 846 }, 847 { 848 "elementType": "labels.text.stroke", 849 "stylers": [ 850 { 851 "color": "#212121" 852 } 853 ] 854 }, 855 { 856 "featureType": "administrative", 857 "elementType": "geometry", 858 "stylers": [ 859 { 860 "color": "#757575" 861 } 862 ] 863 }, 864 { 865 "featureType": "administrative.country", 866 "elementType": "labels.text.fill", 867 "stylers": [ 868 { 869 "color": "#9e9e9e" 870 } 871 ] 872 }, 873 { 874 "featureType": "administrative.land_parcel", 875 "stylers": [ 876 { 877 "visibility": "off" 878 } 879 ] 880 }, 881 { 882 "featureType": "administrative.locality", 883 "elementType": "labels.text.fill", 884 "stylers": [ 885 { 886 "color": "#bdbdbd" 887 } 888 ] 889 }, 890 { 891 "featureType": "poi", 892 "elementType": "labels.text.fill", 893 "stylers": [ 894 { 895 "color": "#757575" 896 } 897 ] 898 }, 899 { 900 "featureType": "poi.park", 901 "elementType": "geometry", 902 "stylers": [ 903 { 904 "color": "#181818" 905 } 906 ] 907 }, 908 { 909 "featureType": "poi.park", 910 "elementType": "labels.text.fill", 911 "stylers": [ 912 { 913 "color": "#616161" 914 } 915 ] 916 }, 917 { 918 "featureType": "poi.park", 919 "elementType": "labels.text.stroke", 920 "stylers": [ 921 {
922 "color": "#1b1b1b" 923 } 924 ] 925 }, 926 { 927 "featureType": "road", 928 "elementType": "geometry.fill", 929 "stylers": [ 930 { 931 "color": "#2c2c2c" 932 } 933 ] 934 }, 935 { 936 "featureType": "road", 937 "elementType": "labels.text.fill", 938 "stylers": [ 939 { 940 "color": "#8a8a8a" 941 } 942 ] 943 }, 944 { 945 "featureType": "road.arterial", 946 "elementType": "geometry", 947 "stylers": [ 948 { 949 "color": "#373737" 950 } 951 ] 952 }, 953 { 954 "featureType": "road.highway", 955 "elementType": "geometry", 956 "stylers": [ 957 { 958 "color": "#3c3c3c" 959 } 960 ] 961 }, 962 { 963 "featureType": "road.highway.controlled_access", 964 "elementType": "geometry", 965 "stylers": [ 966 { 967 "color": "#4e4e4e" 968 } 969 ] 970 }, 971 { 972 "featureType": "road.local", 973 "elementType": "labels.text.fill", 974 "stylers": [ 975 { 976 "color": "#616161" 977 } 978 ] 979 }, 980 { 981 "featureType": "transit", 982 "elementType": "labels.text.fill", 983 "stylers": [ 984 { 985 "color": "#757575" 986 } 987 ] 988 }, 989 { 990 "featureType": "water", 991 "elementType": "geometry", 992 "stylers": [ 993 { 994 "color": "#000000" 995 } 996 ] 997 }, 998 { 999 "featureType": "water", 1000 "elementType": "labels.text.fill", 1001 "stylers": [ 1002 { 1003 "color": "#3d3d3d" 1004 } 1005 ] 1006 } 1007 ], 1008 icon: { 1009 url: base_url + 'img/markers.png', 1010 }, 1011 iconBlue: { 1012 url: base_url + 'img/markers_red.png', 1013 } 1014 }, 1015 markers: [], 1016 hideAllInfoWindows: function (map) { 1017 siescigam.tracks.markers.forEach(function (marker) { 1018 marker.infowindow.close(map, marker); 1019 }) 1020 }, 1021 setMarkers: function (map) { 1022 var bounds = new google.maps.LatLngBounds(); 1023 1024 $.each(trackJSON, function (index, track) { 1025 var infoWindowContent = new google.maps.InfoWindow({ 1026 content: '<div class="infowindow-track">' + 1027 '<h3>' + track['name'] + '</h3>' + 1028 '<a href="' + track['page'] + '" class="button-more">szczegóÅy</a>' + 1029 '</div>' 1030 }); 1031 var marker = new google.maps.Marker({ 1032 position: { 1033 lat: parseFloat(track['coordinates']['latitude']), 1034 lng: parseFloat(track['coordinates']['longitude']) 1035 }, 1036 map: map, 1037 icon: { 1038 url: (track.type === 'CIRCLE' ? siescigam.tracks.map.iconBlue.url : siescigam.tracks.map.icon.url), 1039 size: new google.maps.Size(20, 20), 1040 origin: new google.maps.Point(0, 0), 1041 anchor: new google.maps.Point(10, 10) 1042 }, 1043 title: track['name'], 1044 zIndex: parseFloat(index) + 100, 1045 infowindow: infoWindowContent 1046 }); 1047 1048 bounds.extend(marker.position); 1049 siescigam.tracks.markers.push(marker); 1050 1051 google.maps.event.addListener(marker, 'click', function () { 1052 siescigam.tracks.hideAllInfoWindows(map); 1053 this.infowindow.open(map, this); 1054 }); 1055 }); 1056 1057 map.fitBounds(bounds); 1058 1059 }, 1060 page: function () { 1061 var idMap = 'googleMap', 1062 $elMap = $('#' + idMap), 1063 latitude = $elMap.attr('data-lat'), 1064 longitude = $elMap.attr('data-lng'), 1065 positionMap = {lat: parseFloat(latitude), lng: parseFloat(longitude)}; 1066 1067 if (typeof google !== 'undefined' && document.getElementById(idMap) !== null) { 1068 var map = new google.maps.Map(document.getElementById(idMap), { 1069 zoom: 14, 1070 styles: this.map.style, 1071 center: positionMap 1072 }); 1073 var marker = new google.maps.Marker({ 1074 position: positionMap, 1075 icon: { 1076 url: this.map.icon.url, 1077 size: new google.maps.Size(20, 20), 1078 origin: new google.maps.Point(0, 0), 1079 anchor: new google.maps.Point(10, 10) 1080 }, 1081 map: map 1082 }); 1083 } 1084 }, 1085 list: function () { 1086 var map = new google.maps.Map(document.getElementById('map'), { 1087 zoom: 5, 1088 styles: this.map.style, 1089 center: {lat: 51.7831487, lng: 19.1341253} 1090 }); 1091 1092 siescigam.tracks.setMarkers(map); 1093 } 1094 }, 1095 googleautocomplete: { 1096 autocomplete: null, 1097 componentForm: { 1098 street_number: 'short_name', 1099 route: 'long_name', 1100 locality: 'long_name', 1101 administrative_area_level_1: 'short_name', 1102 country: 'long_name', 1103 postal_code: 'short_name' 1104 }, 1105 fillInAddress: function () { 1106 var place = siescigam.googleautocomplete.autocomplete.getPlace(); 1107 // var showResults; 1108 1109 // if(typeof $('#field-autocomplete').attr('data-show-results') === 'string' && $('#field-autocomplete').attr('data-show-results') === 'false'){ 1110 // showResults = false;
1111 // }else{ 1112 // showResults = true; 1113 // } 1114 1115 for (var i = 0; i < place.address_components.length; i++) { 1116 var addressType = place.address_components[i].types[0]; 1117 if (siescigam.googleautocomplete.componentForm[addressType]) { 1118 var val = place.address_components[i][siescigam.googleautocomplete.componentForm[addressType]]; 1119 if (addressType === 'locality') { 1120 document.getElementById('field-city').value = val; 1121 // if(showResults) 1122 // document.getElementById('field-city-disabled').value = val; 1123 } 1124 if (addressType === 'administrative_area_level_1') { 1125 val = val.replace("województwo ", "").replace("Województwo ", ""); 1126 1127 var idRegion = $('option[data-slug="' + siescigam.slug.build(val) + '"]').attr('value'); 1128 if (idRegion) 1129 document.getElementById('form_region').value = idRegion; 1130 1131 1132 // document.getElementById('field-region').value = val; 1133 // if(showResults) 1134 // document.getElementById('field-region-disabled').value = val; 1135 } 1136 if (addressType === 'country' && $('#field-country').hasClass('inputLong')) { 1137 document.getElementById('field-country').value = val; 1138 } 1139 } 1140 } 1141 1142 document.getElementById('form_location_lat').value = place.geometry.location.lat(); 1143 document.getElementById('form_location_lng').value = place.geometry.location.lng(); 1144 }, 1145 init: function () { 1146 if (document.getElementById('form_location_lat') !== null) { 1147 siescigam.googleautocomplete.autocomplete = new google.maps.places.Autocomplete( 1148 (document.getElementById('field-autocomplete')), 1149 {types: ['geocode', 'establishment']}); 1150 1151 siescigam.googleautocomplete.autocomplete.addListener('place_changed', this.fillInAddress); 1152 } 1153 } 1154 }, 1155 disableArrowNumberInput: function () { 1156 this.el.body.on('focus', 'input[type=number]', function (e) { 1157 $(this).on('wheel', function (e) { 1158 e.preventDefault(); 1159 }); 1160 }); 1161 1162 this.el.body.on('blur', 'input[type=number]', function (e) { 1163 $(this).off('wheel'); 1164 }); 1165 1166 this.el.body.on('keydown', 'input[type=number]', function (e) { 1167 if (e.which == 38 || e.which == 40) 1168 e.preventDefault(); 1169 }); 1170 }, 1171 search: { 1172 init: function () { 1173 siescigam.googleautocomplete.init(); 1174 1175 $('.searchReset').click(function () { 1176 $('input[type="checkbox"]:not([value="0"]), input[type="radio"]:not([value="0"])').each(function () { 1177 $(this).iCheck('uncheck'); 1178 }); 1179 $('input[type="checkbox"][value="0"], input[type="radio"][value="0"], input[type="checkbox"][value="ALL"], input[type="radio"][value="ALL"], input[type="checkbox"][value=""], input[type="radio"][value=""]').each(function () { 1180 $(this).iCheck('check'); 1181 }); 1182 1183 $('input[type="text"], input[type="number"], input[type="data"], input[type="tel"]').val(''); 1184 1185 $('#regions').val('[]').trigger('change'); 1186 $('#field-wojew').val(''); 1187 }) 1188 } 1189 }, 1190 gallery: function () { 1191 $('.js-gallery').magnificPopup({
1192 delegate: '.js-photo', 1193 type: 'image', 1194 tClose: 'Zamknij (Esc)', 1195 tLoading: 'Åadowanie zdjÄcia #%curr%...', 1196 mainClass: 'mfp-img-mobile', 1197 gallery: { 1198 enabled: true, 1199 navigateByImgClick: true, 1200 preload: [0, 1], 1201 tPrev: 'Poprzednie (Lewa strzaÅka na klawiaturze)', 1202 tNext: 'NastÄpne (Prawa strzaÅka na klawiaturze)', 1203 tCounter: '%curr% z %total%' 1204 }, 1205 image: { 1206 titleSrc: function (item) { 1207 var photoAuthor = item.el.attr('data-author'), 1208 phototTitle = item.el.attr('title'); 1209 1210 return (typeof phototTitle !== 'undefined' ? phototTitle : '') + (typeof photoAuthor !== 'undefined' ? '<small>' + photoAuthor + '</small>' : ''); 1211 } 1212 } 1213 }); 1214 1215 $('#gallerySliderContainer').magnificPopup({ 1216 delegate: 'li', 1217 type: 'image', 1218 tClose: 'Zamknij (Esc)', 1219 tLoading: 'Åadowanie zdjÄcia #%curr%...', 1220 mainClass: 'mfp-img-mobile', 1221 gallery: { 1222 enabled: true, 1223 navigateByImgClick: true, 1224 preload: [0, 1], 1225 tPrev: 'Poprzednie (Lewa strzaÅka na klawiaturze)', 1226 tNext: 'NastÄpne (Prawa strzaÅka na klawiaturze)', 1227 tCounter: '%curr% z %total%' 1228 }, 1229 image: { 1230 titleSrc: function (item) { 1231 var photoAuthor = item.el.attr('data-author'), 1232 phototTitle = item.el.attr('title'); 1233 1234 return (typeof phototTitle !== 'undefined' ? phototTitle : '') + (typeof photoAuthor !== 'undefined' ? '<small>' + photoAuthor + '</small>' : ''); 1235 } 1236 } 1237 }); 1238 1239 $('#gallerySliderContainer').lightSlider({ 1240 gallery: true, 1241 item: 1, 1242 vertical: true, 1243 vThumbWidth: 96, 1244 verticalHeight: 415, 1245 thumbItem: 5, 1246 thumbMargin: 4, 1247 slideMargin: 0, 1248 responsive: [ 1249 { 1250 breakpoint: 1280, 1251 settings: { 1252 thumbItem: 5, 1253 vThumbWidth: 96, 1254 verticalHeight: 415 1255 } 1256 }, 1257 { 1258 breakpoint: 1280, 1259 settings: { 1260 thumbItem: 4, 1261 vThumbWidth: 96, 1262 verticalHeight: 360 1263 } 1264 }, 1265 { 1266 breakpoint: 800, 1267 settings: { 1268 vThumbWidth: 56, 1269 thumbItem: 8, 1270 verticalHeight: 310 1271 } 1272 }, 1273 { 1274 breakpoint: 480, 1275 settings: { 1276 vThumbWidth: 56, 1277 thumbItem: 4, 1278 verticalHeight: 210 1279 } 1280 }, 1281 { 1282 breakpoint: 380, 1283 settings: { 1284 vThumbWidth: 56, 1285 thumbItem: 4, 1286 verticalHeight: 145 1287 } 1288 } 1289 ] 1290 }); 1291 }, 1292 recommend: function () { 1293 $('.recommend a').click(function (e) { 1294 e.preventDefault(); 1295 1296 $('.popup--recommend').fadeIn(300); 1297 }); 1298 1299 $('.popup--recommend .popup__cover, .popup--recommend .popup__exit').click(function (e) { 1300 e.preventDefault(); 1301 1302 $('.popup--recommend').fadeOut(300); 1303 }); 1304 1305 $('.popup--recommend .popup__content').jsSocials({ 1306 url: canonical_url, 1307 showCount: false, 1308 showLabel: false, 1309 shareIn: "popup", 1310 shares: ["email", "twitter", "facebook", "googleplus", "linkedin", "pinterest"] 1311 }); 1312 }, 1313 cookie: function() { 1314 var $cookie = $('.cookie-bar'),
1315 show = (Cookies.get('cookie_acceptance') ? parseInt(Cookies.get('cookie_acceptance')) : 0); 1316 1317 if(show === 0) 1318 $cookie.show(0); 1319 1320 $cookie.find('.cookie-bar__btn').click(function () { 1321 $cookie.hide(0); 1322 Cookies.set('cookie_acceptance', 1, { expires: 7 }); 1323 }); 1324 }, 1325 popupModal: { 1326 show: function() { 1327 $.magnificPopup.open({ 1328 items: { 1329 src: $('#popup-modal'), 1330 type: 'inline', 1331 preloader: false, 1332 modal: true 1333 } 1334 }); 1335 }, 1336 init: function () { 1337 if (typeof popupModal !== 'undefined' && typeof displayMaxPopup !== 'undefined') { 1338 var show = (Cookies.get('show_popup') ? parseInt(Cookies.get('show_popup')) : 0); 1339 1340 if(show < displayMaxPopup || displayMaxPopup === 0) { 1341 if(displayMaxPopup === 0) { 1342 this.show(); 1343 } else { 1344 this.show(); 1345 Cookies.set('show_popup', show + 1, { expires: 7 }); 1346 } 1347 } 1348 } 1349 } 1350 }, 1351 colorEasyEditor: function () { 1352 // COLORS FOR EasyEditor // 1353 if (typeof EasyEditor !== 'undefined') { 1354 EasyEditor.prototype.colorBlack = function () { 1355 var _this = this; 1356 var settings = { 1357 buttonIdentifier: 'color-black', 1358 buttonTitle: 'Kolor tekstu czarny', 1359 buttonHtml: 'Kolor czarny', 1360 clickHandler: function () { 1361 _this.wrapSelectionWithNodeName({ 1362 nodeName: 'span', 1363 style: 'color: #000', 1364 class: 'color-black', 1365 keepHtml: true 1366 }); 1367 } 1368 }; 1369 1370 _this.injectButton(settings); 1371 }; 1372 EasyEditor.prototype.colorOrange = function () { 1373 var _this = this; 1374 var settings = { 1375 buttonIdentifier: 'color-orange', 1376 buttonTitle: 'Kolor tekstu pomaraÅczowy', 1377 buttonHtml: 'Kolor pomaraÅczowy', 1378 clickHandler: function () { 1379 _this.wrapSelectionWithNodeName({ 1380 nodeName: 'span', 1381 style: 'color: #ff9100', 1382 class: 'color-orange', 1383 keepHtml: true 1384 }); 1385 } 1386 }; 1387 1388 _this.injectButton(settings); 1389 }; 1390 EasyEditor.prototype.colorWhite = function () { 1391 var _this = this; 1392 var settings = { 1393 buttonIdentifier: 'color-white', 1394 buttonTitle: 'Kolor tekstu biaÅy', 1395 buttonHtml: 'Kolor bialy', 1396 clickHandler: function () { 1397 _this.wrapSelectionWithNodeName({ 1398 nodeName: 'span', 1399 style: 'color: #fff', 1400 class: 'color-white', 1401 keepHtml: true 1402 }); 1403 } 1404 }; 1405 1406 _this.injectButton(settings); 1407 }; 1408 EasyEditor.prototype.colorDarkGray = function () { 1409 var _this = this; 1410 var settings = { 1411 buttonIdentifier: 'color-dark-gray', 1412 buttonTitle: 'Kolor tekstu ciemny szary', 1413 buttonHtml: 'Kolor ciemny szary', 1414 clickHandler: function () { 1415 _this.wrapSelectionWithNodeName({ 1416 nodeName: 'span', 1417 style: 'color: #303030', 1418 class: 'color-dark-gray', 1419 keepHtml: true 1420 }); 1421 } 1422 }; 1423 1424 _this.injectButton(settings); 1425 }; 1426 EasyEditor.prototype.colorGray = function () { 1427 var _this = this; 1428 var settings = { 1429 buttonIdentifier: 'color-gray', 1430 buttonTitle: 'Kolor tekstu szary',
1431 buttonHtml: 'Kolor szary', 1432 clickHandler: function () { 1433 _this.wrapSelectionWithNodeName({ 1434 nodeName: 'span', 1435 style: 'color: #5e5e5e', 1436 class: 'color-gray', 1437 keepHtml: true 1438 }); 1439 } 1440 }; 1441 1442 _this.injectButton(settings); 1443 }; 1444 } 1445 // / COLORS FOR EasyEditor // 1446 }, 1447 zoomPhoto: function () { 1448 var $el = $('[data-zoom-url] img, [data-zoom-url] a, [data-zoom-url] span'); 1449 1450 $('body').append('<div id="photo-zoom" class="photo-zoom"><img src="" alt="" /></div>'); 1451 1452 var $elZoom = $('#photo-zoom'); 1453 1454 $el.mouseenter(function () { 1455 var $elImg = $elZoom.find('img'), 1456 $elParent = $(this).parent(), 1457 elOffset = $(this).offset(), 1458 elOffsetTop = elOffset.top, 1459 elOffsetLeft = elOffset.left, 1460 imgWidth = $elParent.attr('data-zoom-width'), 1461 imgHeight = $elParent.attr('data-zoom-height'), 1462 imgPosition = $elParent.attr('data-zoom-position'); 1463 1464 $elImg.attr('src', $elParent.attr('data-zoom-url')); 1465 1466 if (typeof imgWidth === 'undefined' && typeof imgHeight === 'undefined') { 1467 imgWidth = $elImg.width(); 1468 imgHeight = $elImg.height(); 1469 } 1470 1471 switch (imgPosition) { 1472 case "right": 1473 $elZoom.css({ 1474 'opacity': 1, 1475 'top': elOffsetTop + ($(this).height() / 2) - (imgHeight / 2) - 2, 1476 'left': elOffsetLeft + $(this).width() + 10 1477 }).fadeIn(0); // last 2 to border 1478 break; 1479 default: 1480 $elZoom.css({ 1481 'opacity': 1, 1482 'top': elOffsetTop - imgHeight - 10, 1483 'left': elOffsetLeft + ($(this).width() / 2) - (imgWidth / 2) - 2 1484 }).fadeIn(0); // last 2 to border 1485 break; 1486 } 1487 }) 1488 .mouseleave(function () { 1489 $elZoom.css({'opacity': 0}).find('img').attr('src', ''); 1490 }); 1491 }, 1492 sendFile: function (file, $el, type) { 1493 var data = new FormData(); 1494 data.append("file", file); 1495 data.append("_token", $('meta[name="csrf-token"]').attr('content')); 1496 1497 $.ajax({ 1498 url: base_url + '/media/uploader', 1499 data: data, 1500 cache: false, 1501 contentType: false, 1502 processData: false, 1503 type: 'POST', 1504 success: function (data) { 1505 switch (data['status']) { 1506 case 'ok': 1507 1508 switch (type) { 1509 case 'summernote': 1510 $el.summernote("editor.insertImage", data['url'], 'filename'); 1511 toastr.success('ZdjÄcie zostaÅo dodane'); 1512 break; 1513 } 1514 break; 1515 case 'error': 1516 toastr.error(data['error']); 1517 break; 1518 } 1519 }, 1520 error: function (jqXHR, textStatus, errorThrown) { 1521 toastr.error('ZdjÄcie nie zostaÅo dodane.<br /><br /><strong>SzczegóÅy bÅÄdu:</strong><br />' + textStatus + ' ' + errorThrown); 1522 } 1523 }); 1524 }, 1525 searchRegions: function () { 1526 var $regions = $('#regions'), 1527 $wojew = $('#field-wojew'), 1528 $radioLocation = $('input[name="location"]'); 1529 1530 $regions.select2({ 1531 width: '304px', 1532 placeholder: "Wybierz", 1533 tokenSeparators: [','] 1534 }); 1535 1536 $regions.on("change", function () { 1537 var serachString = $regions.val(); 1538 1539 if (serachString) 1540 $wojew.val(serachString.toString()); 1541 else 1542 $wojew.val(''); 1543 }); 1544 1545 $radioLocation.on('ifChanged', function (event) { 1546 switch (event.currentTarget.value) { 1547 case 'zagranica': 1548 $regions.val('[]').trigger('change'); 1549 $wojew.val('').parents('.formRow').hide(0); 1550 break; 1551 default: 1552 $wojew.parents('.formRow').show(0); 1553 break; 1554 } 1555 }); 1556 }, 1557 other: function () { 1558 $('.showGalleryPopup').magnificPopup({ 1559 type: 'image', 1560 tClose: 'Zamknij (Esc)',
1561 tLoading: 'Åadowanie zdjÄcia #%curr%...', 1562 mainClass: 'mfp-img-mobile', 1563 image: { 1564 titleSrc: function (item) { 1565 var photoAuthor = item.el.attr('data-author'), 1566 phototTitle = item.el.attr('title'); 1567 1568 return (typeof phototTitle !== 'undefined' ? phototTitle : '') + (typeof photoAuthor !== 'undefined' ? '<small>' + photoAuthor + '</small>' : ''); 1569 } 1570 } 1571 }); 1572 1573 if($itemID = siescigam.helper.getParameterByName('item_id')) { 1574 if($("#item-" + $itemID).attr('class')) { 1575 $('html, body').animate({ 1576 scrollTop: $("#item-" + $itemID).offset().top - 50 1577 }, 300); 1578 } 1579 } 1580 1581 if ($.fn.summernote) 1582 $('.summernote').summernote({ 1583 lang: "pl-PL", 1584 // toolbar 1585 toolbar: [ 1586 ['style', ['style']], 1587 ['font', ['bold', 'underline', 'clear']], 1588 // ['fontname', ['fontname']], 1589 ['color', ['color']], 1590 ['para', ['ul', 'ol', 'paragraph']], 1591 // ['table', ['table']], 1592 // ['insert', ['link', 'picture', 'video']], 1593 ['insert', ['link', 'picture']], 1594 // ['view', ['fullscreen', 'codeview', 'help']] 1595 ['view', ['fullscreen']] 1596 ], 1597 callbacks: { 1598 onImageUpload: function (files) { 1599 siescigam.sendFile(files[0], $('.summernote'), 'summernote'); 1600 }, 1601 onPaste: function (e) { 1602 var bufferText = ((e.originalEvent || e).clipboardData || window.clipboardData).getData('Text'); 1603 e.preventDefault(); 1604 document.execCommand('insertText', false, bufferText); 1605 } 1606 } 1607 }); 1608 1609 $('input[type="checkbox"], input[type="radio"]').iCheck({ 1610 checkboxClass: 'icheckbox_square-orange', 1611 radioClass: 'iradio_square-orange', 1612 increaseArea: '20%' 1613 }); 1614 }, 1615 init: function () { 1616 var bodyClass = siescigam.el.body.attr('class').split(' '); 1617 1618 this.search.init(); 1619 this.gallery(); 1620 this.recommend(); 1621 this.other(); 1622 this.cookie(); 1623 this.popupModal.init(); 1624 this.helper.countMaxChar(); 1625 1626 switch (bodyClass[0]) { 1627 case 'home': 1628 // this.calendars.types(); 1629 // this.calendars.search.init(); 1630 $('input[name="limit"]').val(8); 1631 this.zoomPhoto(); 1632 break; 1633 case 'page-calendars': 1634 // this.calendars.search.init(true); 1635 this.zoomPhoto(); 1636 this.searchRegions(); 1637 break; 1638 case 'page-classifieds': 1639 this.search.init(); 1640 this.zoomPhoto(); 1641 this.searchRegions(); 1642 break; 1643 case 'page-classifieds-show': 1644 this.classifieds.showData(); 1645 this.zoomPhoto(); 1646 break; 1647 case 'page-add-classifieds': 1648 this.disableArrowNumberInput(); 1649 this.classifieds.init(); 1650 this.uploads.init(); 1651 this.googleautocomplete.init(); 1652 this.colorEasyEditor(); 1653 break; 1654 case 'page-add-calendars': 1655 this.disableArrowNumberInput(); 1656 this.classifieds.init(); 1657 this.uploads.init(); 1658 this.googleautocomplete.init(); 1659 this.colorEasyEditor(); 1660 break; 1661 case 'page-create-gallery': 1662 this.classifieds.init(); 1663 this.uploads.init(); 1664 this.slug.init(); 1665 break; 1666 case 'page-track': 1667 this.tracks.page(); 1668 break; 1669 case 'page-tracks': 1670 this.tracks.list(); 1671 this.searchRegions(); 1672 break; 1673 default: 1674 1675 break; 1676 } 1677 } 1678}; 1679 1680$(window).load(function () { 1681 1682 $('.isotope').isotope({ 1683 itemSelector: '.item', 1684 layoutMode: 'masonry', 1685 masonry: { 1686 columnWidth: '.grid-sizer' 1687 } 1688 }); 1689 1690}); 1691 1692$(window).ready(function () { 1693 1694 siescigam.init(); 1695 1696 $(window).resize(); 1697 1698 // search 1699 1700 $(".search .searchShowing .show").click(function () { 1701 $(".search").addClass("active"); 1702 $(".search .searchContent").slideDown(); 1703 }); 1704 1705 $(".search .searchShowing .hide").click(function () { 1706 $(".search").removeClass("active"); 1707 $(".search .searchContent").slideUp(); 1708 }); 1709 1710 // 1711 1712 // mobile menu 1713 1714 $(".hamburger").click(function () { 1715 $(".mobile_menu_popup").show(0); 1716 $(".mobile_menu_popup").animate({"opacity": 1}, 0); 1717 $(".mobile_menu_popup_window").delay(0).addClass("show"); 1718 }); 1719 1720 $(".mobile_menu_popup a").click(function () { 1721 $(".mobile_menu_popup_window").removeClass("show"); 1722 $(".mobile_menu_popup").delay(200).animate({"opacity": 0}, 200); 1723 $(".mobile_menu_popup").delay(200).hide(0); 1724 }); 1725 1726 // $(".showGalleryPopup").click(function () { 1727 // $(".galleryPopup").show(0); 1728 // $(".galleryPopup").animate({"opacity": 1}, 0); 1729 // $(".galleryPopupWindow").delay(0).addClass("show"); 1730 // 1731 // // flexslider 1732 // 1733 // $('.flexslider').flexslider({ 1734 // animation: "fade", 1735 // slideshow: true, 1736 // slideshowSpeed: 5000, 1737 // keyboard: false, 1738 // controlNav: false, 1739 // directionNav: false, 1740 // start: function (slider) { 1741 // $(window).resize(); 1742 // } 1743 // }); 1744 // }); 1745 1746 // $(".galleryPopupClose a").click(function () { 1747 // $(".galleryPopupWindow").removeClass("show"); 1748 // $(".galleryPopup").delay(200).animate({"opacity": 0}, 200); 1749 // $(".galleryPopup").delay(200).hide(0); 1750 // }); 1751 1752 $('.mainSlider').slick({ 1753 dots: true, 1754 infinite: true, 1755 autoplay: true, 1756 autoplaySpeed: 7500, 1757 speed: 1000 1758 }); 1759 1760 $('.slide--speed-1').slick({ 1761 dots: false, 1762 infinite: true, 1763 autoplay: true, 1764 autoplaySpeed: 2000,
1765 speed: 1000 1766 }); 1767 1768 $('.slide--speed-2').slick({ 1769 dots: false, 1770 infinite: true, 1771 autoplay: true, 1772 autoplaySpeed: 8500, 1773 speed: 1200 1774 }); 1775 1776 $('.slide--speed-3').slick({ 1777 dots: false, 1778 infinite: true, 1779 autoplay: true, 1780 autoplaySpeed: 9900, 1781 speed: 1500 1782 }); 1783 1784 $('.advertSlide').slick({ 1785 dots: false, 1786 infinite: true, 1787 autoplay: true, 1788 autoplaySpeed: 3500, 1789 speed: 400, 1790 adaptiveHeight: true 1791 }); 1792 1793 $('.slide-partners').slick({ 1794 dots: false, 1795 infinite: true, 1796 speed: 1000, 1797 autoplay: true, 1798 autoplaySpeed: 3500, 1799 slidesToShow: 6, 1800 slidesToScroll: 6, 1801 responsive: [ 1802 { 1803 breakpoint: 1024, 1804 settings: { 1805 slidesToShow: 4, 1806 slidesToScroll: 4, 1807 infinite: true, 1808 dots: true 1809 } 1810 }, 1811 { 1812 breakpoint: 600, 1813 settings: { 1814 slidesToShow: 3, 1815 slidesToScroll: 3 1816 } 1817 }, 1818 { 1819 breakpoint: 480, 1820 settings: { 1821 slidesToShow: 2, 1822 slidesToScroll: 2 1823 } 1824 } 1825 ] 1826 }); 1827 1828}); 1829 1830$(window).resize(function () { 1831 1832 calc = $('.calcThumb').width(); 1833 $(".calcThumb").css("height", calc * 0.714); 1834 1835 calc2 = $('.calcThumb2').width(); 1836 $(".calcThumb2").css("height", calc2 * 0.714); 1837 1838 calc3 = $('.calcThumb3').width(); 1839 $(".calcThumb3").css("height", calc3 * 0.714); 1840 1841 calc4 = $('.calcThumb4').width(); 1842 $(".calcThumb4").css("height", calc4 + 10); 1843 1844 calc5 = $('.calcThumb5').width(); 1845 $(".calcThumb5").css("height", calc5 * 0.714); 1846 1847 calc6 = $('.calcThumb6').width(); 1848 $(".calcThumb6").css("height", calc6 * 0.714); 1849 1850 calc7 = $('.calcThumb7').width(); 1851 $(".calcThumb7").css("height", calc7 * 0.714); 1852 1853 calc8 = $('.calcThumb8').width(); 1854 $(".calcThumb8").css("height", calc8 * 0.714); 1855 $(".slickNav").css("height", calc7 * 0.714); 1856 1857}); 1858 1859$(window).scroll(function () { 1860 1861 if ($(this).scrollTop() > 240) { 1862 $(".headerFixed").addClass("active"); 1863 } 1864 else { 1865 $(".headerFixed").removeClass("active"); 1866 } 1867});
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.