1/* global jQuery, ecwd, ecwd_calendar */ 2 3/** 4 * Public JS functions 5 */ 6var functions_interval; 7 8if (typeof ecwd_js_init_call != "object") 9 var ecwd_js_init_call; 10if (typeof ecwd_js_init != "function") 11 var ecwd_js_init; 12(function ($) { 13 ecwd_js_init = function () { 14 ecwd_eventsOff(); 15 if (jQuery('#ecwd-calendar-main-css').length == 0) { 16 jQuery("<link/>", { 17 id: 'ecwd-calendar-main-css', 18 rel: "stylesheet", 19 type: "text/css", 20 href: ecwd.plugin_url + '/css/calendar.css?ver=1' 21 }).appendTo("head"); 22 } 23 var cwidth = jQuery(".calendar_main .ecwd_calendar").width(); 24 var view_click = 1; 25 var click = 1; 26 jQuery('a[href="#ecwd-modal-preview"]').click(function () { 27 setTimeout(function () { 28 showFilterSliderArrow(); 29 }, 1); 30 }); 31 32 clearTimeout(functions_interval); 33 functions_interval = setTimeout(function () { 34 show_filters(0); 35 showMiniCalendarEventOnHover(); 36 showFullCalendarEventOnHover(); 37 showWidgetEventDesc(); 38 calendarFullResponsive(); 39 showFilterSliderArrow(); 40 createSearchForm(); 41 upcomingEventsSlider(); 42 doMasonry(); 43 }, 1); 44 45 46 jQuery('.ecwd_reset_filters').click(function () { 47 jQuery(this).closest('.ecwd_filters').find('input:checkbox').attr('checked', false); 48 }); 49 jQuery('.ecwd-calendar-more-event').each(function () { 50 jQuery(this).find('.ecwd-more-events-container').ecwd_popup({ 51 button: jQuery(this).find('.more_events_link'), 52 title: jQuery(this).find('.ecwd-more-event-title').val(), 53 body_id: "ecwd-modal-preview", 54 body_class: "ecwd-excluded-events",
55 container_class: "ecwd_more_event", 56 after_popup_show: function (el) { 57 el.find('li.inmore').show(); 58 el.find('.more_events').find('li').on('click', function () { 59 el.find('li').find('.event-details-container').slideUp(); 60 if (jQuery(this).find('.event-details-container').is(":visible")) 61 jQuery(this).find('.event-details-container').slideUp(); 62 else 63 jQuery(this).find('.event-details-container').slideDown(); 64 }); 65 add_single_events_popup(); 66 }, 67 }); 68 }); 69 70 add_single_events_popup(); 71 72 jQuery('.ecwd_calendar_prev_next .next, .ecwd_calendar_prev_next .previous, .ecwd_calendar .type, .cpage, .current-month a, .ecwd_filter, .ecwd_reset_filters').on('click', function (e) { 73 var days = jQuery('input[name="ecwd_weekdays[]"]:checked').map(function () { 74 return this.value; 75 }).get(); 76 var cats = jQuery('input[name="ecwd_categories[]"]:checked').map(function () { 77 return this.value; 78 }).get(); 79 var tags = jQuery('input[name="ecwd_tags[]"]:checked').map(function () { 80 return this.value; 81 }).get(); 82 var venues = jQuery('input[name="ecwd_venues[]"]:checked').map(function () { 83 return this.value; 84 }).get(); 85 var organizers = jQuery('input[name="ecwd_organizers[]"]:checked').map(function () { 86 return this.value; 87 }).get(); 88 var el = jQuery(this); 89 if (!jQuery(this).is(':checkbox')) { 90 e.preventDefault(); 91 } 92 var navLink = jQuery(this); 93 if ((!navLink.attr('href') || navLink.attr('href') == 'undefined') && !navLink.is(':checkbox') && navLink.attr('class') != 'ecwd_reset_filters') { 94 navLink = jQuery(this).find('a'); 95 } 96 var main_div = navLink.closest('.calendar_main'); 97 98 var calendar_ids_class_1 = jQuery(main_div).find('div.ecwd_calendar').find('div:first-child').data("id"); 99 var calendar_ids_class_2 = jQuery(main_div).find('div.ecwd_calendar').find('div:first-child').data("type"); 100 101 var display = jQuery(main_div).find('div.ecwd_calendar').attr('class').split(' ')[0].split('-')[2]; 102 var calendar_ids = calendar_ids_class_1; 103 var query = jQuery(main_div).find('input.ecwd-search').val(); 104 var tag = jQuery('.ecwd_tags').val(); 105 var venue = jQuery('.ecwd_venues').val(); 106 var organizer = jQuery('.ecwd_organizers').val(); 107 var category = jQuery('.ecwd_categories').val(); 108 var displays = jQuery(main_div).find('.ecwd_displays').val(); 109 var date = jQuery(main_div).find('.ecwd_date').val(); 110 var page_items = jQuery(main_div).find('.ecwd_page_items').val(); 111 var event_search = jQuery(main_div).find('.event_search').val(); 112 var filters = jQuery(main_div).find('.ecwd_filters').val(); 113 jQuery(main_div).find('.ecwd_loader').show(); 114 jQuery.post(ecwd.ajaxurl, { 115 action: 'ecwd_ajax', 116 ecwd_calendar_ids: calendar_ids, 117 ecwd_link: navLink.attr('href'), 118 ecwd_type: calendar_ids_class_2, 119 ecwd_query: query, 120 ecwd_weekdays: days, 121 ecwd_categories: cats, 122 ecwd_tags: tags, 123 ecwd_venues: venues, 124 ecwd_organizers: organizers, 125 ecwd_category: category, 126 ecwd_tag: tag, 127 ecwd_venue: venue, 128 ecwd_organizer: organizer, 129 ecwd_displays: displays, 130 ecwd_prev_display: display, 131 ecwd_page_items: page_items, 132 ecwd_event_search: event_search, 133 ecwd_filters: filters, 134 ecwd_date: 1, 135 ecwd_date_filter: date, 136 ecwd_nonce: ecwd.ajaxnonce 137 }, function (data) { 138 $(main_div).find('div.ecwd_calendar').replaceWith(data); 139 $(main_div).find('.ecwd_loader').hide(); 140 if ($('.ecwd_open_event_popup').length > 0) { 141 $('.ecwd_open_event_popup').css({ 142 'cursor': 'pointer' 143 }); 144 } 145 }) 146 e.stopPropagation(); 147 }); 148 149 150 function createSearchForm() { 151 var scinpt = document.getElementById("ecwd-search-submit"); 152 if (scinpt !== null) { 153 //scinpt.addEventListener('focus', doSearch, false); 154 } 155 jQuery('.ecwd-search').on("keyup", function (e) { 156 if (e.keyCode == 13) { 157 doSearch(this); 158 } 159 }); 160 jQuery('.ecwd-search-submit').on("focus", function (e) { 161 doSearch(this); 162 }); 163 164 jQuery('.ecwd-tag-container .ecwd-dropdown-menu > div').click(function (e) { 165 jQuery('.ecwd_tags').val(jQuery(this).attr("data-term-tag")); 166 doSearch(this); 167 }); 168 jQuery('.ecwd-category-container .ecwd-dropdown-menu > div').click(function (e) { 169 jQuery('.ecwd_categories').val(jQuery(this).attr("data-term-category")); 170 doSearch(this); 171 }); 172 jQuery('.ecwd-venue-container .ecwd-dropdown-menu > div').click(function (e) { 173 jQuery('.ecwd_venues').val(jQuery(this).attr("data-term-venue")); 174 doSearch(this); 175 }); 176 jQuery('.ecwd-organizer-container .ecwd-dropdown-menu > div').click(function (e) { 177 jQuery('.ecwd_organizers').val(jQuery(this).attr("data-term-organizer")); 178 doSearch(this); 179 }); 180 } 181 182 183 function doSearch(el) { 184 185 var main_div = jQuery(el).closest('.calendar_main'); 186 var navLink = jQuery(main_div).find('.ecwd_current_link'); 187 var query = jQuery(main_div).find('input.ecwd-search').val(); 188 var tag = jQuery(main_div).find('.ecwd_tags').val(); 189 var venue = jQuery(main_div).find('.ecwd_venues').val(); 190 var organizer = jQuery(main_div).find('.ecwd_organizers').val(); 191 var category = jQuery(main_div).find('.ecwd_categories').val(); 192 var calendar_ids_class_1 = jQuery(main_div).find('div.ecwd_calendar').find('div:first-child').data("id"); 193 var calendar_ids_class_2 = jQuery(main_div).find('div.ecwd_calendar').find('div:first-child').data("type"); 194 var calendar_ids = calendar_ids_class_1; 195 var displays = jQuery(main_div).find('.ecwd_displays').val(); 196 var page_items = jQuery(main_div).find('.ecwd_page_items').val(); 197 var event_search = jQuery(main_div).find('.event_search').val(); 198 var filters = jQuery(main_div).find('.ecwd_filters').val(); 199 jQuery(main_div).find('.ecwd_loader').show(); 200 jQuery.post(ecwd.ajaxurl, { 201 action: 'ecwd_ajax', 202 ecwd_query: query, 203 ecwd_category: category, 204 ecwd_tag: tag, 205 ecwd_venue: venue, 206 ecwd_organizer: organizer, 207 ecwd_displays: displays, 208 ecwd_filters: filters, 209 ecwd_page_items: page_items, 210 ecwd_link: navLink.val(), 211 ecwd_calendar_ids: calendar_ids, 212 ecwd_event_search: event_search, 213 ecwd_date: 1, 214 ecwd_type: calendar_ids_class_2, 215 ecwd_calendar_search:1,//not filter 216 ecwd_nonce: ecwd.ajaxnonce 217 }, function (data) { 218 $(main_div).find('div.ecwd_calendar').replaceWith(data); 219 }); 220 jQuery('.ecwd-search-submit').blur(); 221 } 222 223 function showMiniCalendarEventOnHover() { 224 } 225 ; 226 227 var ulEvent, day; 228 var ulEventFull, dayFull; 229 jQuery('div.ecwd_calendar .has-events').on('click', function (e) { 230 dayFull = jQuery(this).attr('data-date').split('-'); 231 dayFull = dayFull[2]; 232 ulEventFull = jQuery(this).find('ul.events');
233 if (parseInt(jQuery(this).closest('.ecwd_calendar').width()) <= 300 || parseInt(jQuery(window).width()) <= 768 || jQuery(this).closest('.ecwd_calendar').hasClass('ecwd-widget-mini') || $(this).closest('.ecwd_calendar').hasClass('ecwd-page-mini')) { 234 if (dayFull == jQuery(this).closest('.ecwd_calendar').find('.ecwd-events-day-details').attr('data-dayNumber') 235 && jQuery(this).closest('.ecwd_calendar').find('.ecwd-events-day-details').is(':empty') == false) { 236 jQuery(this).closest('.ecwd_calendar').find('.ecwd-events-day-details').html(''); 237 } else { 238 showEvent(ulEventFull, this); 239 } 240 jQuery(this).closest('.ecwd_calendar').find('.ecwd-events-day-details').attr('data-dayNumber', dayFull); 241 } 242 }); 243 244 function showEvent(el, calendar) { 245 if (el.parent().parent().parent().parent().attr('class').indexOf("full") != -1) { 246 var obj = el; 247 if (el.length > 1) { 248 el.each(function () { 249 if ($(this).hasClass('more_events')) { 250 obj = $(this); 251 return; 252 } 253 }); 254 } 255 $(calendar).closest('.ecwd_calendar').find('.ecwd-events-day-details').html(obj.find('.event-details').clone().css('display', 'block')); 256 } else if (el.parent().parent().parent().parent().attr('class').indexOf("mini") != -1) { 257 $(calendar).closest('.ecwd_calendar').find('.ecwd-events-day-details').html(el.clone()); 258 } 259 $(calendar).closest('.ecwd_calendar').find('.ecwd-events-day-details').find('li').each(function(){ 260 $(this).css('background','none'); 261 262 }); 263 add_single_events_popup(); 264 } 265 266 function showFullCalendarEventOnHover() { 267 if (parseInt(jQuery(window).width()) >= 768) { 268 jQuery('div.ecwd-page-full .has-events ul.events:not(.more_events) > li:not(.ecwd-calendar-more-event)').on('mouseover', function (e) { 269 jQuery(this).find('ul.events').show(); 270 var show_event_hover_info = jQuery(".show_event_hover_info"); 271 if(show_event_hover_info.length>0){ 272 jQuery(this).find('div.event-details-container').show(); 273 } 274 }); 275 276 jQuery('div.ecwd-page-full .has-events ul.events:not(.more_events) > li:not(.ecwd-calendar-more-event)').on('mouseout', function (e) { 277 jQuery(this).find('div.event-details-container').css('display', 'none'); 278 }); 279 } 280 281 jQuery('div.ecwd-page-full .has-events ul.more_events > li').on('click', function (e) { 282 jQuery('div.ecwd-page-full .has-events ul.more_events > li').find('.event-details-container').slideUp(); 283 if (jQuery(this).find('.event-details-container').is(":visible")) 284 jQuery(this).find('.event-details-container').slideUp(); 285 else 286 jQuery(this).find('.event-details-container').slideDown(); 287 }); 288 } 289 290 291 292 jQuery('.ecwd-show-map-span').click(function () { 293 jQuery('.ecwd-show-map').show(); 294 }); 295 296 297 function doMasonry() { 298 var $container = jQuery('.ecwd-poster-board'); 299 if ($container.length && jQuery('.ecwd-poster-board').find('.ecwd-poster-item').length > 0) { 300 $container.imagesLoaded(function () { 301 $container.masonry({ 302 itemSelector: '.ecwd-poster-item' 303 }); 304 }); 305 } 306 307 } 308 309 function showFilterSliderArrow() { 310 var li_position, li_width, last_child; 311 $(".calendar_main:not([class^='ecwd_widget'] .calendar_main) .ecwd_calendar_view_tabs").each(function (key, element) { 312 var cwidth = $(element).closest('.ecwd_calendar').outerWidth(); 313 if (cwidth == 0) 314 cwidth = 600; 315 if ($(this).find('.ecwd-search').length != 0) 316 var ecwd_calendar_view_tabs_width = parseInt(cwidth) - 50; 317 else 318 var ecwd_calendar_view_tabs_width = parseInt(cwidth);
319 if (parseInt(jQuery('body').width()) <= 768 || $(".calendar_full_content .ecwd_calendar").width() < 600) { 320 var ecwd_calendar_view_visible_count = parseInt(ecwd_calendar_view_tabs_width / 110); 321 } else if (parseInt(jQuery('body').width()) <= 500 || $(".calendar_full_content .ecwd_calendar").width() < 400) { 322 var ecwd_calendar_view_visible_count = parseInt(ecwd_calendar_view_tabs_width / 90); 323 } else { 324 var ecwd_calendar_view_visible_count = parseInt(ecwd_calendar_view_tabs_width / 150); 325 } 326 $(element).find('.filter-container').width(ecwd_calendar_view_tabs_width); 327 $(element).find('ul li').each(function (keyli, elementli) { 328 if ($(elementli).hasClass('ecwd-selected-mode')) { 329 li_position = keyli; 330 li_width = $(elementli).outerWidth(); 331 } 332 }); 333 if ($(element).find(".filter-arrow-right").css("display") == "block" || last_child == 1) 334 $(element).find('.filter-container ul li').width((ecwd_calendar_view_tabs_width - 30) / ecwd_calendar_view_visible_count); 335 else 336 $(element).find('.filter-container ul li').width((ecwd_calendar_view_tabs_width) / ecwd_calendar_view_visible_count); 337 var ecwd_view_item_width = $(element).find('.filter-container ul li').eq(0).innerWidth() - 1; 338 if (!(ecwd_calendar_view_tabs_width < ecwd_view_item_width * parseInt($(element).find('.filter-container ul li').length) && !($(element).find("ul li:last-child").hasClass("ecwd-selected-mode")))) 339 $(element).find('.filter-arrow-right').hide(); 340 if (ecwd_calendar_view_tabs_width < ecwd_view_item_width * parseInt($(element).find('.filter-container ul li').length) && !($(element).find("ul li:last-child").hasClass("ecwd-selected-mode"))) { 341 $(element).find('.filter-arrow-right').show(); 342 } else if ($(element).find("ul li:last-child").hasClass("ecwd-selected-mode")) { 343 last_child = 1; 344 } 345 if (ecwd_calendar_view_visible_count <= li_position && li_position != 0) { 346 $(element).find('ul li').css({left: "-" + ((li_position + 1 - ecwd_calendar_view_visible_count) * ecwd_view_item_width) + "px"}); 347 $(element).find('.filter-arrow-left').show(); 348 } else 349 $(element).find('ul li').css({left: "0px"}); 350 }); 351 352 $('.ecwd_calendar_view_tabs .filter-arrow-right').click(function () { 353 var view_filter_width = $(this).parent().find('ul li').eq(0).outerWidth(); 354 var cwidth = $(this).closest('.ecwd_calendar').outerWidth(); 355 if (cwidth == 0) 356 cwidth = 600; 357 if ($(this).find('.ecwd-search').length != 0) 358 var view_filter_container_width = parseInt(cwidth) - 50; 359 else 360 var view_filter_container_width = parseInt(cwidth); 361 var view_filter_count = parseInt($(this).parent().find('ul li').length); 362 $(this).parent().find('.filter-arrow-left').show(); 363 if (parseInt($(this).parent().find('ul li').css('left')) <= -((view_filter_width * view_filter_count) - view_filter_container_width) + view_filter_width) 364 $(this).hide(); 365 if (click && view_filter_container_width < view_filter_width * view_filter_count && parseInt($(this).parent().find('ul li').css('left')) >= -(view_filter_width * (view_filter_count) - view_filter_container_width)) { 366 click = 0; 367 $(this).parent().find('ul li').animate({left: "-=" + view_filter_width}, 400, function () { 368 click = 1 369 }); 370 } 371 }); 372 $('.ecwd_calendar_view_tabs .filter-arrow-left').click(function () { 373 var view_filter_width = $(this).parent().find('ul li').eq(0).outerWidth(); 374 if ($(this).parent().find('.filter-arrow-right').css('display') == 'none') 375 $(this).parent().find('.filter-arrow-right').show(); 376 if (parseInt($(this).parent().find('ul li').css('left')) == -view_filter_width) 377 $(this).hide(); 378 if (click && parseInt($(this).parent().find('ul li').css('left')) < 0) { 379 click = 0; 380 $(this).parent().find('ul li').animate({left: "+=" + view_filter_width}, 400, function () { 381 click = 1 382 }); 383 } 384 }); 385 } 386 387 function upcomingEventsSlider() { 388 var current_date = Date.parse(Date()); 389 390 var upcoming_events_slider_main = jQuery('.upcoming_events_slider').width(); 391 jQuery('.upcoming_events_slider .upcoming_events_item').width(upcoming_events_slider_main); 392 393 394 jQuery('.upcoming_events_slider .upcoming_event_container').width(parseInt(upcoming_events_slider_main) - 80); 395 jQuery('.upcoming_events_slider > ul').width(upcoming_events_slider_main * jQuery('.upcoming_events_slider .upcoming_events_item').length); 396 397 if (jQuery(".upcoming_events_slider").width() < jQuery('.upcoming_events_slider > ul').width()) { 398 jQuery('.upcoming_events_slider .upcoming_events_slider-arrow-right').show(); 399 } 400 401 402 var min = 0; 403 jQuery('.upcoming_events_slider .upcoming_events_item').each(function () { 404 var item_date = Date.parse(jQuery(this).data('date')); 405 if (item_date < current_date) { 406 min++; 407 } else { 408 return false;
409 } 410 }); 411 412 if (min && min == jQuery('.upcoming_events_slider .upcoming_events_item').length) { 413 min--; 414 } 415 416 jQuery('.upcoming_events_slider .upcoming_events_item').css('left', -upcoming_events_slider_main * min); 417 418 if (parseInt(jQuery('.upcoming_events_slider .upcoming_events_item').css('left')) < 0) { 419 jQuery('.upcoming_events_slider').parent().find('.upcoming_events_slider-arrow-left').show(); 420 } 421 if (parseInt(jQuery('.upcoming_events_slider .upcoming_events_item').css('left')) == -(jQuery('.upcoming_events_slider > ul').width() - upcoming_events_slider_main)) { 422 jQuery('.upcoming_events_slider').parent().find('.upcoming_events_slider-arrow-right').hide(); 423 } 424 425 jQuery('.upcoming_events_slider .upcoming_events_slider-arrow-right').click(function () { 426 var events_item_width = jQuery(this).parent().find('ul li').eq(0).width(); 427 428 var events_item_count = parseInt(jQuery(this).parent().find('ul li').length); 429 if (jQuery(this).parent().find('.upcoming_events_slider-arrow-left').css('display') == 'none') 430 jQuery(this).parent().find('.upcoming_events_slider-arrow-left').show(); 431 if (click && upcoming_events_slider_main < events_item_width * events_item_count && parseInt(j
431Query(this).parent().find('ul li').css('left')) >= -(events_item_width * (events_item_count) - upcoming_events_slider_main)) { 432 click = 0; 433 jQuery(this).parent().find('ul li').animate({left: "-=" + events_item_width}, 400, function () { 434 click = 1 435 }); 436 } 437 if (parseInt(jQuery(this).parent().find('ul li').css('left')) <= -(jQuery('.upcoming_events_slider > ul').width() - (2 * events_item_width))) 438 jQuery(this).hide(); 439 }); 440 jQuery('.upcoming_events_slider .upcoming_events_slider-arrow-left').click(function () { 441 var events_item_width = jQuery(this).parent().find('ul li').eq(0).width(); 442 if (jQuery(this).parent().find('.upcoming_events_slider-arrow-right').css('display') == 'none') 443 jQuery(this).parent().find('.upcoming_events_slider-arrow-right').show(); 444 if (parseInt(jQuery(this).parent().find('ul li').css('left')) == -events_item_width) 445 jQuery(this).hide();
446 if (click && parseInt(jQuery(this).parent().find('ul li').css('left')) < 0) { 447 click = 0; 448 jQuery(this).parent().find('ul li').animate({left: "+=" + events_item_width}, 400, function () { 449 click = 1 450 }); 451 } 452 453 }); 454 } 455 function showWidgetEventDesc() { 456 jQuery('.ecwd-widget-mini .event-container, .ecwd-widget-mini .ecwd_list .event-main-content').each(function () { 457 if (jQuery(this).find('.arrow-down').length == 0) { 458 jQuery(this).find('.ecwd-list-date-cont').append("<span class='arrow-down'> </span>"); 459 jQuery(this).find('.ecwd-list-date-cont').after("<div class='event_dropdown_cont'></div>"); 460 jQuery(this).find('.event_dropdown_cont').append(jQuery(this).children(".event-venue,.event-content, .event-organizers")); 461 462 jQuery(this).find('.arrow-down').click(function () { 463 if (jQuery(this).hasClass('open')) { 464 jQuery(this).parent().parent().find('.event_dropdown_cont').slideUp(400); 465 jQuery(this).removeClass('open'); 466 } else { 467 jQuery(this).parent().parent().find('.event_dropdown_cont').slideDown(400); 468 jQuery(this).addClass('open'); 469 } 470 }); 471 } 472 }) 473 } 474 475 function calendarFullResponsive() { 476 if (jQuery(window).width() <= 500) { 477 jQuery('div[class^="ecwd-page"] .event-container, div[class^="ecwd-page"] .ecwd_list .event-main-content').each(function () { 478 if (jQuery(this).find('.arrow-down').length == 0) { 479 var content = jQuery(this).find('.event-content').html(); 480 if (jQuery(this).hasClass("event-container")) { 481 jQuery(this).find('.event-content').html(jQuery(this).find('.ecwd-list-img').html() + content); 482 jQuery(this).find('.ecwd-list-img').remove(); 483 } else { 484 var content = jQuery(this).find('.event-content').html(); 485 jQuery(this).find('.event-content').html(jQuery(this).prev().html() + content); 486 jQuery(this).prev().remove(); 487 488 } 489 jQuery(this).find('.ecwd-list-date-cont').append("<span class='arrow-down'> </span>"); 490 jQuery(this).find('.ecwd-list-date-cont').after("<div class='event_dropdown_cont'></div>"); 491 jQuery(this).find('.event_dropdown_cont').append(jQuery(this).children(".event-venue,.event-content, .event-organizers")); 492 jQuery(this).find('.arrow-down').each(function () { 493 jQuery(this).click(function () { 494 if (jQuery(this).hasClass('open')) { 495 jQuery(this).parent().parent().find('.event_dropdown_cont').slideUp(400); 496 jQuery(this).removeClass('open'); 497 } else { 498 jQuery(this).parent().parent().find('.event_dropdown_cont').slideDown(400); 499 jQuery(this).addClass('open'); 500 } 501 }); 502 }) 503 } 504 }) 505 } else if (jQuery(window).width() > 500) { 506 jQuery('div[class^="ecwd-page"] .event-container, div[class^="ecwd-page"] .ecwd_list .event-main-content').each(function () { 507 if (jQuery(this).find('.arrow-down').length != 0) { 508 // jQuery(this).css('height','auto'); 509 if (jQuery(this).hasClass("event-container")) { 510 jQuery(this).find('.event-title').before('<div class="ecwd-list-img"><div class="ecwd-list-img-container">' + jQuery(this).find('.ecwd-list-img-container').html() + '</div></div>'); 511 jQuery(this).find('.event-content .ecwd-list-img-container').remove(); 512 jQuery(this).find('.ecwd-list-date-cont').after(jQuery(this).find('.event_dropdown_cont').html()); 513 jQuery(this).find('.event_dropdown_cont').remove(); 514 } else { 515 jQuery(this).parent().find('.ecwd-list-date.resp').after('<div class="ecwd-list-img"><div class="ecwd-list-img-container">' + jQuery(this).find('.ecwd-list-img-container').html() + '</div></div>'); 516 jQuery(this).find('.event-content .ecwd-list-img-container').remove(); 517 jQuery(this).find('.ecwd-list-date-cont').after(jQuery(this).find('.event_dropdown_cont').html()); 518 jQuery(this).find('.event_dropdown_cont').remove(); 519 } 520 521 jQuery(this).find('.arrow-down').remove(); 522 } 523 }) 524 525 } 526 527 } 528 function add_single_events_popup() { 529 if(jQuery('.ecwd_open_event_popup').length == 0){ 530 return; 531 } 532 jQuery('.single_event_popup').ecwd_popup({ 533 button: jQuery('.ecwd_open_event_popup'), 534 body_class: "ecwd-excluded-events ecwd_popup_body_scroll", 535 title: ecwd.event_popup_title_text, 536 get_ajax_data: function (el) { 537 var start_date = el.attr('start-date-data'); 538 var end_date = el.attr('end-date-data'); 539 if (start_date && end_date) { 540 var data = { 541 action: 'ecwd_event_popup_ajax', 542 id: el.attr('class').split('event')[2], 543 start_date: start_date, 544 end_date: end_date 545 }; 546 return data; 547 } else { 548 return {}; 549 } 550 } 551 }); 552 } 553 554 setTimeout(function () {
555 if (parseInt(jQuery('body').width()) <= 768 || jQuery(".calendar_full_content").width() <= 550) { 556 jQuery('.calendar_main').each(function (k, v) { 557 jQuery(this).find('.ecwd_show_filters').click(function () { 558 if (jQuery(this).find('span').hasClass('open')) { 559 jQuery(this).find('span').html(jQuery('.ecwd_show_filters_text').val()); 560 jQuery(this).next().hide(); 561 jQuery(this).find('span').removeClass('open'); 562 } else { 563 jQuery(this).find('span').html(jQuery('.ecwd_hide_filters_text').val()); 564 jQuery(this).next().show(); 565 jQuery(this).find('span').addClass('open'); 566 } 567 }); 568 }); 569 } else { 570 jQuery('.calendar_main').each(function () { 571 jQuery(this).find('.ecwd_show_filters span').click(function () { 572 if (jQuery(this).hasClass('open')) { 573 jQuery(this).html(jQuery('.ecwd_show_filters_text').val()); 574 jQuery(this).closest(".calendar_full_content").find(".ecwd_calendar").css({ 575 "max-width": "100%", 576 "width": "100%" 577 }); 578 jQuery(this).parent().next().hide(); 579 jQuery(this).removeClass('open'); 580 showFilterSliderArrow(); 581 if (jQuery('.ecwd-poster-board').length > 0) { 582 doMasonry(); 583 } 584 } else { 585 jQuery(this).html(jQuery('.ecwd_hide_filters_text').val()); 586 jQuery(this).closest(".calendar_full_content").find(".ecwd_filters").css({ 587 "max-width": "27%", 588 "width": "27%", 589 "float": "left" 590 }); 591 jQuery(this).closest(".calendar_full_content").find(".ecwd_calendar").css({ 592 "max-width": "71%", 593 "float": "left" 594 }); 595 jQuery(this).parent().next().show(); 596 jQuery(this).addClass('open'); 597 showFilterSliderArrow(); 598 if (jQuery('.ecwd-poster-board').length > 0) { 599 doMasonry(); 600 } 601 } 602 }); 603 }); 604 jQuery(".month-name").show(); 605 } 606 jQuery('.ecwd_filter_item').each(function () { 607 jQuery(this).find('.ecwd_filter_heading').click(function () { 608 if (jQuery(this).hasClass('open')) { 609 jQuery(this).next().slideUp(400); 610 jQuery(this).removeClass('open'); 611 } else { 612 jQuery(this).next().slideDown(400); 613 jQuery(this).addClass('open'); 614 } 615 }); 616 }); 617 }, 100); 618 619 function show_filters(main_div) { 620 621 if (parseInt(jQuery('body').width()) <= 768 || jQuery(".calendar_full_content").width() <= 550) { 622 jQuery(".calendar_full_content .ecwd_calendar").css("max-width", "100%"); 623 jQuery(".calendar_full_content .ecwd_filters, .calendar_full_content .ecwd_calendar").css({ 624 "max-width": "100%", 625 "width": "100%", 626 "float": "none" 627 }); 628 jQuery(".ecwd_show_filters").removeClass('ecwd_show_filters_left').addClass('ecwd_show_filters_top'); 629 if (!main_div) { 630 jQuery(".ecwd_show_filters span").html(jQuery('.ecwd_show_filters_text').val()); 631 jQuery(".ecwd_show_filters span").removeClass("open"); 632 jQuery(".ecwd_filters").hide(); 633 } 634 } else { 635 636 if (!main_div) { 637 jQuery(".ecwd_show_filters").removeClass('ecwd_show_filters_top').addClass('ecwd_show_filters_left'); 638 } else { 639 if (main_div.find(".ecwd_calendar").hasClass('ecwd-widget-mini') === false) { 640 if (main_div.find(".ecwd_show_filters span").hasClass('open')) {
641 main_div.find(".ecwd_calendar").css({"max-width": "71%", "float": "left"}); 642 main_div.find(".ecwd_filters").css({"max-width": "27%", "width": "27%", "float": "left"}); 643 } else { 644 645 main_div.find(".ecwd_filters").css({"max-width": "100%", "width": "100%", "float": "none"}); 646 647 main_div.find(".ecwd_calendar").css({"max-width": "100%", "width": "100%", "float": "none"}); 648 } 649 } 650 } 651 } 652 653 } 654 this.showMap = function () { 655 if (ecwd.gmap_key == "") { 656 jQuery(".ecwd_map_div").each(function (k, v) { 657 var $this = jQuery(this); 658 if ($this.closest('.ecwd-show-map').length == 1) { 659 $this.closest('.ecwd-show-map').hide(); 660 } 661 $this.hide(); 662 }); 663 return; 664 } 665 666 if (typeof google == 'undefined' || typeof google.maps == "undefined") { 667 var script = document.createElement('script'); 668 script.type = 'text/javascript'; 669 script.src = 'https://maps.googleapis.com/maps/api/js?v=3.exp&libraries=places&callback=ecwd_js_init_call.showMap&key='+ecwd.gmap_key; 670 document.body.appendChild(script); 671 } else { 672 var maps = []; 673 jQuery(".ecwd_map_div").each(function (k, v) { 674 maps[k] = this; 675 var locations = JSON.parse(jQuery(maps[k]).next('textarea').val()); 676 var locations_len = Object.keys(locations).length; 677 678 jQuery(maps[k]).gmap3(); 679 680 var markers = []; 681 var zoom = 17; 682 if (locations_len > 0 && typeof locations[0] != 'undefined' && typeof locations[0]['zoom'] != 'undefined') { 683 zoom = parseInt(locations[0]['zoom']); 684 } else { 685 zoom = 2; 686 } 687 688 var center = {lat: 0, lng: 0} 689 690 for (var i = 0; i < locations_len; i++) { 691 if (locations[i]) { 692 693 var marker = new Object(); 694 marker.lat = locations[i].latlong[0]; 695 marker.lng = locations[i].latlong[1]; 696 marker.data = locations[i].infow; 697 marker.options = new Object(); 698 markers.push(marker); 699 center.lat += parseFloat(locations[i].latlong[0]); 700 center.lng += parseFloat(locations[i].latlong[1]); 701 } 702 703 } 704 if(locations_len > 0) { 705 center.lat = center.lat / locations_len; 706 center.lng = center.lng / locations_len; 707 } 708 709 jQuery(maps[k]).gmap3({ 710 map: { 711 options: { 712 zoom: zoom, 713 zoomControl: true, 714 styles: (ecwd.gmap_style !== "") ? JSON.parse(ecwd.gmap_style) : null, 715 center: center 716 }, 717 center: center 718 }, 719 marker: { 720 values: markers, 721 options: { 722 draggable: false 723 }, 724 events: { 725 click: function (marker, event, context) { 726 var map = jQuery(maps[k]).gmap3("get"), 727 infowindow = jQuery(maps[k]).gmap3({get: {name: "infowindow"}}); 728 if (infowindow) { 729 infowindow.open(map, marker); 730 infowindow.setContent(context.data); 731 } else { 732 jQuery(maps[k]).gmap3({ 733 infowindow: { 734 anchor: marker, 735 options: {content: context.data} 736 } 737 }); 738 } 739 } 740 741 } 742 }, 743 //autofit: {maxZoom: zoom} 744 }); 745 746 }); 747 } 748 } 749 // $('#ecwd_back_link').on('click', function (e) { 750 // e.preventDefault(); 751 // window.history.back(); 752 // }); 753 754 if (jQuery('.ecwd_map_div').length > 0) { 755 this.showMap(); 756 } 757 } 758
759 ecwd_js_init_call = new ecwd_js_init(); 760}(jQuery)); 761function ecwd_eventsOff() { 762 jQuery(".calendar_main,.ecwd-event,.ecwd-organizer,.ecwd-venue").find("*").off(); 763 jQuery(".calendar_main,.ecwd-event,.ecwd-organizer,.ecwd-venue").children().off(); 764} 765 766jQuery(window).resize(function () { 767 var window_width = jQuery(window).width(); 768 if (typeof checkw == 'undefined') 769 checkw = window_width; 770 if (window_width != checkw) { 771 ecwd_js_init_call = new ecwd_js_init(); 772 checkw = window_width; 773 } 774});
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.