Version 5.0.13

This commit is contained in:
Neo committed 2025-12-19 19:04:57 -08:00
1 parent b89858b2ff
commit 5efe744c5f
1407 files changed
+69690 -30177

No files matched your search

+3 -3
View File
@@ -1,6 +1,6 @@
ips.templates.set("eventLoading",`
<li class='ipsData__item ipsData__item--loading'>
<div class="ipsData__image"></div>
<div class="ipsData__image" aria-hidden="true"></div>
<div class="ipsData__content">
<div class="ipsData__main">
<div class="ipsData__title"></div>
@@ -39,7 +39,7 @@ this.googleMap.panTo(mostMiddleMarker);}}).bind(this);window.setTimeout(cb,0);}}
markersGroup.addTo(this._map);this._map.fitBounds(markersGroup.getBounds(),{maxZoom:5});}},getDistance:function(lat1,lat2,lng1,lng2){lng1=lng1*Math.PI/180;lng2=lng2*Math.PI/180;lat1=lat1*Math.PI/180;lat2=lat2*Math.PI/180;let dlng=lng2-lng1;let dlat=lat2-lat1;let a=Math.pow(Math.sin(dlat/2),2)
+Math.cos(lat1)*Math.cos(lat2)*Math.pow(Math.sin(dlng/2),2);let c=Math.asin(Math.sqrt(a));return c;},_markerMouseOver:function(e){var eventId=e.target.options.eventId;this.scope.find('[data-eventid]').stop(false,true);this.scope.find('[data-eventid]:not([data-eventid="'+eventId+'"])').animate({opacity:0.4},'fast');},_markerMouseOut:function(e){this.scope.find('[data-eventid]').stop(false,true);this.scope.find('[data-eventid]').animate({opacity:1},'fast');},showPlaceholders:function(count){var events=[];for(var i=0;i<6;i++){events.push(ips.templates.render('eventLoading'));}
this.scope.find('[data-role="locationEvents"]').removeClass('ipsJS_hide').html(ips.templates.render('nearMe',{events:events.join('')}));}});}(jQuery,_));;
;(function($,_,undefined){"use strict";ips.controller.register('calendar.front.overview.search',{initialize(){this.on('click','[data-action="useMyLocation"]',this.useMyLocation);this.on('click','[data-action="cancelLocation"]',this.cancelLocation);this.on('submit',this.doSearch);this.on(document,'click','[data-action="backToOverview"]',this.backToOverview);this.on(document,'click','[data-action="loadMoreSearch"]',this.loadMore);this.on(document,'menuItemSelected','#elSortMenu',this.changeSort);this.on(document,'click','[data-action="moreNearMe"]',this.moreNearMe);this.on(document,'click','[data-action="moreExhibitions"]',this.moreExhibitions);this.on(window,'historychange:calendarSearch',this.stateChange);this.setup();},setup(){this._gotCoords=false;this._offset=0;this._limit=20;this._currentSort=$('body').find('#elSortMenu_menu .ipsMenu_itemChecked').attr('data-ipsMenuValue');this._baseURL=this.scope.attr('action');this._initialURL=window.location.href;this._cancelledLookup=false;this._searchBox=this.scope.find('input[name="location"]');this._previousValue=this._searchBox.val();this._originalPlaceholder=this.scope.attr('data-placeholder');this._locationLink=this.scope.find('[data-action="useMyLocation"]');this._cancelLocationLink=this.scope.find('[data-action="cancelLocation"]');this._page=this.scope.closest('[data-role="eventsPage"]');this._resultsContainer=$('body').find('[data-role="searchResults"]');this._noResults=$('body').find('[data-role="noSearchResults"]');this._loadMore=$('body').find('[data-action="loadMoreSearch"]');this._noMore=$('body').find('[data-role="noMoreSearchResults"]');this._map=null;this._mapContainer=$('body').find('[data-role="searchResultsMap"]');this._markers={};this.getInitialLocation();if(ips.getSetting('mapProvider')==='google'){this.setupGoogle();}else if(ips.getSetting('mapProvider')==='mapbox'){this.setupMapbox();}else{this._mapContainer.hide();}},setupGoogle(){this._mapReady=true;Debug.log(this._resultsContainer.find('[data-eventid]'));Debug.log(this._mapContainer.attr('data-markers'));if(this._resultsContainer.find('[data-eventid]').length&&this._mapContainer.attr('data-markers')){Debug.log('here');try{var markers=JSON.parse(this._mapContainer.attr('data-markers'));Debug.log(markers);this._updateGoogleMap(markers);}catch(err){Debug.log("Invalid marker JSON");Debug.log(err);}}},setupMapbox(){$('head').append`
;(function($,_,undefined){"use strict";ips.controller.register('calendar.front.overview.search',{initialize(){this.on('click','[data-action="useMyLocation"]',this.useMyLocation);this.on('click','[data-action="cancelLocation"]',this.cancelLocation);this.on('submit',this.doSearch);this.on(document,'click','[data-action="backToOverview"]',this.backToOverview);this.on(document,'click','[data-action="loadMoreSearch"]',this.loadMore);this.on(document,'menuItemSelected','#elSortMenu',this.changeSort);this.on(document,'click','[data-action="moreNearMe"]',this.moreNearMe);this.on(document,'click','[data-action="moreExhibitions"]',this.moreExhibitions);this.on(window,'historychange:calendarSearch',this.stateChange);this.setup();},setup(){this._gotCoords=false;this._offset=0;this._limit=20;this._currentSort=$('body').find('#elSortMenu_menu [aria-selected="true"]').attr('data-ipsMenuValue');this._baseURL=this.scope.attr('action');this._initialURL=window.location.href;this._cancelledLookup=false;this._searchBox=this.scope.find('input[name="location"]');this._previousValue=this._searchBox.val();this._originalPlaceholder=this.scope.attr('data-placeholder');this._locationLink=this.scope.find('[data-action="useMyLocation"]');this._cancelLocationLink=this.scope.find('[data-action="cancelLocation"]');this._page=this.scope.closest('[data-role="eventsPage"]');this._resultsContainer=$('body').find('[data-role="searchResults"]');this._noResults=$('body').find('[data-role="noSearchResults"]');this._loadMore=$('body').find('[data-action="loadMoreSearch"]');this._noMore=$('body').find('[data-role="noMoreSearchResults"]');this._map=null;this._mapContainer=$('body').find('[data-role="searchResultsMap"]');this._markers={};this.getInitialLocation();if(ips.getSetting('mapProvider')==='google'){this.setupGoogle();}else if(ips.getSetting('mapProvider')==='mapbox'){this.setupMapbox();}else{this._mapContainer.hide();}},setupGoogle(){this._mapReady=true;Debug.log(this._resultsContainer.find('[data-eventid]'));Debug.log(this._mapContainer.attr('data-markers'));if(this._resultsContainer.find('[data-eventid]').length&&this._mapContainer.attr('data-markers')){Debug.log('here');try{var markers=JSON.parse(this._mapContainer.attr('data-markers'));Debug.log(markers);this._updateGoogleMap(markers);}catch(err){Debug.log("Invalid marker JSON");Debug.log(err);}}},setupMapbox(){$('head').append`
<link rel='stylesheet' type='text/css' media='all' href='https://api.mapbox.com/mapbox.js/v3.3.1/mapbox.css'>
<link href='https://api.mapbox.com/mapbox.js/plugins/leaflet-markercluster/v1.0.0/MarkerCluster.css' rel='stylesheet' />
<link href='https://api.mapbox.com/mapbox.js/plugins/leaflet-markercluster/v1.0.0/MarkerCluster.Default.css' rel='stylesheet' />
@@ -48,7 +48,7 @@ this.setSearchToLocation();this._locationLink.attr('hidden',true);this._cancelLo
const url=this._getUrlFromData();ips.utils.history.replaceState({controller:'calendar.front.overview.search',url},'calendarSearch',url);},getPlaceholders(count){let events='';count=typeof count==='number'?10:count;for(let i=0;i<count;i++){events+=ips.templates.render('eventLoading');}
return events;},stateChange(){if(!('calendarSearch'in ips.utils.history.getState())&&this._initialURL!==window.location.href){return;}
const state=ips.utils.history.getState('calendarSearch')
if(this._initialURL===state?.url){this.hideResults();}else if(this._initialURL===window.location.href&&state?.url===undefined){this._loadResults(this._getUrlFromData(this._initialData));}else{this._loadResults(state?.url);}},changeSort(e,data){e.preventDefault();this._currentSort=data.selectedItemID;const title=data.menuElem.find('[data-ipsMenuValue="'+this._currentSort+'"]').text();$('body').find('[data-role="searchOrder"]').text(title);this.doSearch();},_getUrlFromData(){const formData=this.scope.serializeArray();const params=[];_.each(formData,function(item){if($.trim(item.value)!==''){params.push(item.name+"="+encodeURIComponent(item.value));}});params.push("sortBy="+this._currentSort);if(this._baseURL.match(/\?/)){if(!this._baseURL.endsWith('?')){this._baseURL+='&';}}else{this._baseURL+='?';}
if(this._initialURL===state?.url){this.hideResults();}else if(this._initialURL===window.location.href&&state?.url===undefined){this._loadResults(this._getUrlFromData(this._initialData));}else{this._loadResults(state?.url);}},changeSort(e,data=e.detail){e.preventDefault();this._currentSort=data.selectedItemID;const title=$(data.menuElem).find('[data-ipsMenuValue="'+this._currentSort+'"]').text();$('body').find('[data-role="searchOrder"]').text(title);this.doSearch();},_getUrlFromData(){const formData=this.scope.serializeArray();const params=[];_.each(formData,function(item){if($.trim(item.value)!==''){params.push(item.name+"="+encodeURIComponent(item.value));}});params.push("sortBy="+this._currentSort);if(this._baseURL.match(/\?/)){if(!this._baseURL.endsWith('?')){this._baseURL+='&';}}else{this._baseURL+='?';}
return this._baseURL+params.join('&');},async _loadResults(url){if(this._page.length){this._page.find('[data-role="eventsOverview"]').hide();this._page.find('[data-role="searchResultsWrapper"]').show();}
this._resultsContainer.removeClass('ipsHide').html(this.getPlaceholders(6));if(ips.getSetting('mapProvider')!=='none'){this._mapContainer.addClass('cEvents__searchMap--loading').show();}
this._currentUrl=url;const response=await ips.fetch(url);if(response.count){this._resultsContainer.html(response.content);this._noResults.addClass('ipsHide');this._updateMap(_.extend({},this._markers,response.markers));if(response.totalCount>(response.count+this._offset)){this._loadMore.show();this._noMore.hide();}else{this._loadMore.hide();this._noMore.hide();}}else{this._resultsContainer.html('').addClass('ipsHide');this._noResults.removeClass('ipsHide');this._loadMore.hide();this._noMore.hide();this._mapContainer.hide();}
+2 -4
View File
@@ -10,14 +10,12 @@ if((endDate.getMonth()-startDate.getMonth()+(12*(endDate.getFullYear()-startDate
if(dayDifference>365){$('#elSelect_event_repeats').find('option[value="yearly"]').prop('selected',false);this.disableRecurring();$('#elRepeatRow_hidden').hide();}
else
{$('#elRepeatRow_hidden').show();}
this._updateSummary();},finishRepeat:function(){this._updateSummary();$('#elRecurEdit_menu').trigger('closeMenu');},setup:function(){this._updateSummary();this.toggleFields();this.updateTimezone();},toggleEndtimeFields:function(e){if(this.scope.find('#check_no_end_time').is(':checked')){this.scope.find('#end_time').prop('disabled',true);}
this._updateSummary();},finishRepeat:function(){this._updateSummary();},setup:function(){this._updateSummary();this.toggleFields();this.updateTimezone();},toggleEndtimeFields:function(e){if(this.scope.find('#check_no_end_time').is(':checked')){this.scope.find('#end_time').prop('disabled',true);}
else
{this.scope.find('#end_time').prop('disabled',false);}},toggleFields:function(e){this.toggleEndtimeFields();var singleDay=this.scope.find('#check_single_day');var allDay=this.scope.find('#check_all_day');var self=this;var toggles={start_time_wrap:true,end_time_wrap:true,event_end_date_wrap:true,elDateGrid_arrow:true,elDateGrid_end:true,end_date_controls:true};if(singleDay.is(':checked')&&!allDay.is(':checked')){toggles.event_end_date_wrap=false;}else if(singleDay.is(':checked')&&allDay.is(':checked')){toggles.elDateGrid_arrow=false;toggles.elDateGrid_end=false;toggles.start_time_wrap=false;}else if(!singleDay.is(':checked')&&allDay.is(':checked')){toggles.start_time_wrap=false;toggles.end_time_wrap=false;toggles.end_date_controls=false;}
else
{toggles.end_date_controls=false;this.scope.find('#end_time').prop('disabled',false);}
_.each(toggles,function(val,key){self.scope.find('#'+key).toggle(val);});},checkForSummaryChange:function(e){if($(e.currentTarget).attr('name').startsWith('event_dates[')){this._updateSummary();}},updateTimezone:function(e){if(e){e.preventDefault();}
this.scope.find('[data-role="timezone_display"]').text($('#event_timezone option:selected').data('abbreviated')).trigger('closeMenu');},disableRecurring:function(e){if(e){e.preventDefault();}
this.scope.find('#elRepeatCb').prop('checked',false);this._updateSummary();},finishRepeatConfiguration:function(e,data){e.preventDefault();this.scope.find('[data-role="recur_summary_final"]').text(this.scope.find('[data-role="recur_summary"]').text());this.scope.find('#elRecurEdit').trigger('closeMenu');},_updateSummary:function(){var summary=this.scope.find('[data-role="recurringSummary"]');if(this.scope.find('#elRepeatCb').is(':checked')){summary.text(this._getSummary());this.scope.find('#elRepeatRow_hidden').hide();this.scope.find('#elRepeatRow_shown').show();}else{summary.html("<em class='i-color_soft'>"+ips.getString('doesnt_repeat')+"</em>");this.scope.find('#elRepeatRow_hidden').show();this.scope.find('#elRepeatRow_shown').hide();}
_.each(toggles,function(val,key){self.scope.find('#'+key).toggle(val);});},checkForSummaryChange:function(e){if($(e.currentTarget).attr('name').startsWith('event_dates[')){this._updateSummary();}},updateTimezone:function(e){this.scope.find('[data-role="timezone_display"]').text($('#event_timezone option:selected').data('abbreviated'));},disableRecurring:function(e){this._updateSummary();},_updateSummary:function(){var summary=this.scope.find('[data-role="recurringSummary"]');if(this.scope.find('#elRepeatCb').is(':checked')){summary.text(this._getSummary());this.scope.find('#elRepeatRow_hidden').hide();this.scope.find('#elRepeatRow_shown').show();}else{summary.html("<em class='i-color_soft'>"+ips.getString('doesnt_repeat')+"</em>");this.scope.find('#elRepeatRow_hidden').show();this.scope.find('#elRepeatRow_shown').hide();}
this.scope.find('[data-role="dateSummary"]').html(this._dateSummary());},_dateSummary:function(){var startDate=ips.utils.time.getDateFromInput(this.scope.find('input[name="event_dates[start_date]"]'));var singleDay=this.scope.find('#check_single_day');var allDay=this.scope.find('#check_all_day');if(!ips.utils.time.isValidDateObj(startDate)||startDate.getFullYear()<1900){return'';}
ips.utils.time.removeTimezone(startDate);var startDateString=ips.utils.time.localeDateString(startDate,{weekday:'short',month:'short',day:'numeric',year:'numeric',timeZone:'UTC'});var startTime=this._getTime(this.scope.find('input[name="event_dates[start_time]"]').val());var endTime=this._getTime(this.scope.find('input[name="event_dates[end_time]"]').val());var endDate=ips.utils.time.getDateFromInput(this.scope.find('input[name="event_dates[end_date]"]'));var endDateString='';if(!singleDay.is(':checked')&&ips.utils.time.isValidDateObj(endDate)){ips.utils.time.removeTimezone(endDate);endDateString=ips.utils.time.localeDateString(endDate,{weekday:'short',month:'short',day:'numeric',year:'numeric',timeZone:'UTC'});}
var finalString='';if(singleDay.is(':checked')&&!allDay.is(':checked')){if(this.scope.find('#check_no_end_time').is(':checked')){finalString=ips.getString('single_not_allday_noendtime',{startDate:startDateString,startTime:startTime});}