diff --git a/Waymark.php b/Waymark.php index 43c08984..2ac43138 100644 --- a/Waymark.php +++ b/Waymark.php @@ -4,7 +4,7 @@ Plugin Name: Waymark Plugin URI: https://www.waymark.dev/ Description: Mapping with WordPress made easy. With Waymark enabled, click on the "Maps" link in the sidebar to create and edit Maps. Once you are happy with your Map, copy the Waymark shortcode and add it to your content. -Version: 1.4.2 +Version: 1.4.3 Text Domain: waymark Author: Joe Hawes Author URI: https://www.morehawes.ca/ diff --git a/assets/js/admin.min.js b/assets/js/admin.min.js index 37e1511b..b85d3f10 100644 --- a/assets/js/admin.min.js +++ b/assets/js/admin.min.js @@ -1 +1 @@ -function waymark_setup_map_export(){jQuery(".waymark-map-export, .waymark-collection-export").each((function(){var a=jQuery(this);if(a){var e=a.parents(".waymark-shortcode");if(e.length)var t=jQuery(".waymark-map",e);else t=jQuery(".waymark-map");var r=a.parents(".waymark-meta-export_data");if(r.length||(r=a.parent("div")),"FORM"!=a.get(0).tagName){for(var n=jQuery("
").append(a.contents()),i=a.get(0).attributes,o=i.length-1;o>=0;o--)n.attr(i[o].name,i[o].value);a.replaceWith(n),a=n}var s=jQuery('input[name="map_data"]',a),u=t.data("Waymark");void 0!==u&&u.map.on("layerremove layeradd",(function(){var a=0;u.map_data.eachLayer((function(e){u.map.hasLayer(e)&&a++})),a>0?r.show():r.hide()})),a.on("submit",(function(e){var r=jQuery("select",a),n=r.val()?r.val():"geojson",i=Waymark_L.layerGroup();(u=t.data("Waymark")).map_data.eachLayer((function(a){for(key in a.feature.properties)if(void 0!==a.feature.properties[key]?"title"==key&&"kml"==n&&(a.feature.properties.name=a.feature.properties[key],delete a.feature.properties[key]):delete a.feature.properties[key],"description"==key&&void 0!==a.feature.properties.description){var e=a.feature.properties.description,t=e.indexOf('

').text(e).appendTo("body").fadeIn("slow")},mouseleave:function(a){jQuery("#waymark-tooltip-active").remove()},mousemove:function(a){if(waymark_is_touch_device())var e=a.pageX-250;else e=a.pageX-220;var t=a.pageY+5;jQuery("#waymark-tooltip-active").css({top:t,left:e})}})}function waymark_is_touch_device(){var a=" -webkit- -moz- -o- -ms- ".split(" ");return!!("ontouchstart"in window||window.DocumentTouch&&document instanceof DocumentTouch)||function(a){return window.matchMedia(a).matches}(["(",a.join("touch-enabled),("),"heartz",")"].join(""))}function waymark_setup_accordions(){var a=jQuery(".waymark-accordion-container");a.length&&(a.addClass("waymark-self-clear"),a.each((function(){var a=0;jQuery(".waymark-accordion-group",jQuery(this)).each((function(){jQuery(this).addClass("waymark-self-clear"),jQuery(this).data("waymark-index",a);var e=jQuery(".waymark-accordion-group-content",jQuery(this));0==a?(jQuery(this).addClass("waymark-first"),e.show().addClass(a)):e.hide().addClass(a),jQuery("legend",jQuery(this)).each((function(){var a=jQuery(this).html();-1==a.indexOf("[+]")&&jQuery(this).html(a+" [+]"),jQuery(this).click((function(){var a=jQuery(this).parents(".waymark-accordion-group").data("waymark-index");jQuery(".waymark-accordion-group",jQuery(this).parents(".waymark-accordion-container")).each((function(){jQuery(this).data("waymark-index")==a?jQuery(".waymark-accordion-group-content",jQuery(this)).slideDown():jQuery(".waymark-accordion-group-content",jQuery(this)).slideUp()}))}))})),a++}))})))}function waymark_setup_map_editor(a={}){if(!a.map||!wp.editor||!wp.media)return void a.message("waymark_editor.map/wp.editor/wp.media not available","error");a.debug("Admin Editor Integrations"),jQuery(".waymark-edit-toolbar a.waymark-edit-upload").removeClass("waymark-hidden");const e=jQuery(".waymark-edit-toolbar a.waymark-edit-image");e.length&&void 0!==wp.media&&(a.debug("Enabling Media Library for Image Uploads"),e.removeClass("waymark-hidden"),e.on("click",(function(a){return a.preventDefault(),wp.media.editor.send.attachment=function(a,e){if(void 0===e.url)return!1;var t=new FormData;t.append("waymark_security",waymark_security),t.append("action","waymark_get_attatchment_meta"),t.append("attachment_id",e.id),jQuery.ajax({type:"POST",url:waymark_js.ajaxurl,data:t,dataType:"json",processData:!1,contentType:!1,success:function(a){if(Waymark.debug("waymark_get_attatchment_meta"),null!==a){var t=Waymark.map.getCenter();(latlng=Waymark.get_exif_latlng(a))&&(t=latlng,Waymark.map.setView(t));var r=Waymark.get_image_sizes(e.sizes,e.url),n=Waymark.create_marker_json(t,r);Waymark.map_data.addData(n),Waymark.map_was_edited()}else Waymark.message(waymark_js.lang.error_photo_meta,"error")}})},wp.media.editor.open(),!1}))),a.map.on("popupopen",(function(e){const t=e.popup._source.feature,r=jQuery(".waymark-map .waymark-info").first(),n=jQuery(".waymark-info-image_large_url .button",r);n.length&&(a.debug("Popup Media Library Integration"),n.removeClass("waymark-hidden"),n.on("click",(function(e){return e.preventDefault(),wp.media.editor.send.attachment=function(e,n){if(void 0===n.url)return!1;var i=Waymark.get_image_sizes(n.sizes,n.url);t.properties=Object.assign({},t.properties,i),jQuery(".waymark-info-image_large_url",r).find("a").attr("href",t.properties.image_large_url).end().find("img").attr("src",t.properties.image_thumbnail_url).end().find("input").val(t.properties.image_large_url),a.map_was_edited()},wp.media.editor.open(),!1}))),setTimeout((function(){a.debug("Popup Rich Text Editor Integration"),wp.editor.initialize("waymark-info-description",{tinymce:{toolbar1:"styleselect | bullist numlist | link image",setup:function(e){e.on("change",(function(e){t.properties.description=wp.editor.getContent("waymark-info-description"),a.map_was_edited()}))}}})}),200)})),a.map.on("popupclose",(function(a){wp.editor.remove("waymark-info-description"),jQuery("#waymark-info-description").show()}))}function waymark_setup_colour_pickers(){jQuery(".waymark-colour-picker .waymark-input").wpColorPicker()}function waymark_setup_repeatable_settings(){jQuery(".waymark-settings-tab .waymark-repeatable").each((function(){var a=jQuery(this);jQuery(".form-table",a).each((function(){var e=jQuery(this),t=[];for(e.remove(),jQuery(".waymark-input",e).each((function(){var a=jQuery(this);if(a.addClass("waymark-"+a.data("id")),"SELECT"!=a.get(0).nodeName)var e=a.val();else e=a.data("multi-value");for(i in"string"!=typeof e&&(e=e.toString()),e=e.split(waymark_multi_value_seperator))"object"!=typeof t[i]&&(t[i]={}),t[i][a.data("id")]=e[i]})),i=0;i").text("x").attr("title",waymark_php_lang.repeatable_delete_title).addClass("waymark-delete").on("click",(function(a){return a.preventDefault(),jQuery(this).parents(".form-table").remove(),!1}));r.append(u),a.append(r),a.attr("data-count",i),waymark_setup_parameter_tooltips()}var y=jQuery("