{"id":3172,"date":"2023-10-23T10:47:35","date_gmt":"2023-10-23T08:47:35","guid":{"rendered":"https:\/\/www.piher.net\/configurator\/?p=3172"},"modified":"2023-10-25T10:59:23","modified_gmt":"2023-10-25T08:59:23","slug":"test-guide","status":"publish","type":"post","link":"https:\/\/www.piher.net\/configurator\/test-guide\/","title":{"rendered":"test guide"},"content":{"rendered":"\n<p><code>\n<div class=\"open-user-map\">\n\n  \n  \n<div class=\"box-wrap map-size-default map-size-mobile-square oum-regions-layout-1 \">\n      <div class=\"tab-wrap\">\n      <div class=\"oum-tabs\" id=\"nav-tab-20210929\" role=\"tablist\">\n                \n                    <div class=\"nav-item nav-link  change_region\" data-lat=\"43.005741210177\" data-lng=\"84.901818046862\" data-zoom=\"1.5\" data-toggle=\"tab\">Asia<\/div>\n\n        \n                    <div class=\"nav-item nav-link  change_region\" data-lat=\"49.339567796073\" data-lng=\"13.031864856335\" data-zoom=\"3.5\" data-toggle=\"tab\">Europe<\/div>\n\n        \n                    <div class=\"nav-item nav-link  change_region\" data-lat=\"47.560552595252\" data-lng=\"-93.333165691615\" data-zoom=\"1.5\" data-toggle=\"tab\">North America<\/div>\n\n              <\/div>\n    <\/div>\n  \n  <div class=\"map-wrap\">\n    <div id=\"map-20210929\" class=\"leaflet-map map-style_Custom1\"><\/div>\n    \n    \n        \n      \n      \n        <div id=\"open-add-location-overlay\" class=\"open-add-location-overlay\" style=\"background-color: #e02aaf\"><span class=\"btn_icon\">+<\/span><span class=\"btn_text\">Add location<\/span><\/div>\n\n      \n    \n    \n      <div class=\"oum-attribution\">made with <a href=\"https:\/\/www.open-user-map.com\/?ref=map\" title=\"Open User Map | Everybody can add locations\" target=\"_blank\">OUM<\/a><\/div>\n\n    \n    <script type=\"text\/javascript\" data-category=\"functional\" class=\"cmplz-native\" id=\"oum-inline-js\">\n      var map_el = `map-20210929`;\n\n      if(document.getElementById(map_el)) {\n\n        var mapStyle = `Custom1`;\n        var oum_tile_provider_mapbox_key = ``;\n        var marker_icon_url = `https:\/\/www.piher.net\/configurator\/wp-content\/plugins\/open-user-map\/src\/leaflet\/images\/marker-icon_custom1-2x.png`;\n        var marker_shadow_url = `https:\/\/www.piher.net\/configurator\/wp-content\/plugins\/open-user-map\/src\/leaflet\/images\/marker-shadow.png`;\n        var oum_enable_scrollwheel_zoom_map = false;\n        var oum_enable_cluster = true;\n        var oum_enable_fullscreen = true;\n\n        var oum_enable_searchbar = false;\n        var oum_searchbar_type = `address`;\n\n        var oum_geosearch_selected_provider = ``; \n        var oum_geosearch_provider = `osm`;\n        var oum_geosearch_provider_geoapify_key = ``;\n        var oum_geosearch_provider_here_key = ``;\n        var oum_geosearch_provider_mapbox_key = ``;\n        \n        var oum_enable_searchaddress_button = false;\n        var oum_searchaddress_label = `Search for address`;\n\n        var oum_enable_searchmarkers_button = true;\n        var oum_searchmarkers_label = `Find distributor`;\n        var oum_searchmarkers_zoom = `8`;\n\n        var oum_enable_currentlocation = false;\n        var oum_collapse_filter = false;\n        var oum_action_after_submit = `text`;\n        var thankyou_redirect = ``;\n        var start_lat = `32.57903815`;\n        var start_lng = `-97.146802106158`;\n        var start_zoom = `8`;\n        var oum_enable_fixed_map_bounds = ``;\n        var oum_minimum_zoom_level = `1`;\n        var oum_use_settings_start_location = false;\n        var oum_has_regions = true;\n\n        var oum_location = {};\n        var locations_without_type = [];\n        var locations_by_type = [];\n        var oum_custom_css = '';\n        var oum_custom_script = '';\n        var oumMap;\n        var oumMap2;\n\n        var oumPrepareLocations = (location) => {\n          \/\/console.log(location, 'location');\n          if(location.type) {\n            \/\/ add new marker category to array if not exists\n            if(!locations_by_type.find(markercategory => markercategory.id === location.type)) {\n              let newmarkercategory = {\n                id: location.type,\n                name: location.type_name,\n                icon: location.icon,\n                locations : []\n              }\n              locations_by_type.push(newmarkercategory);\n            }\n\n            \/\/ add location to marker category\n            let markercategory = locations_by_type.find(markercategory => markercategory.id === location.type);\n            markercategory.locations.push(location);\n\n          }else{\n            locations_without_type.push(location);\n          }\n        };\n\n        var oumConditionalField = (sourceField, targetField, condShow, condHide) => {\n          const sourceElement = document.querySelector(sourceField);\n          const targetElement = document.querySelector(targetField).parentElement; \/* works with custom fields only *\/\n\n          \/* trigger on change *\/\n          sourceElement.onchange = function(e) {\n            const val = this.value;\n            \n            console.log('OUM: run condition', {val, sourceField, targetField, condShow, condHide});\n            \n            if(condShow.includes(val)) {\n              targetElement.style.display = 'block';\n            }else if(condHide.includes(this.value)) {\n              targetElement.style.display = 'none';\n            }\n          }\n\n          \/* trigger initially *\/\n          let changeEvent = new Event('change');\n          sourceElement.dispatchEvent(changeEvent);\n        };\n\n        \/* Transfer PHP array to JS array *\/\n        var oum_all_locations = [{\"title\":\"Mouser Electronics\",\"lat\":\"32.57903815\",\"lng\":\"-97.146802106158\",\"content\":\"<div class=\\\"oum_location_image\\\"><img class=\\\"skip-lazy\\\" src=\\\"https:\\\/\\\/www.piher.net\\\/configurator\\\/wp-content\\\/uploads\\\/2023\\\/10\\\/Logo_Mouser-300x104.jpg\\\"><\\\/div><div class=\\\"oum_location_text\\\"><div class=\\\"oum_location_address\\\"><a title=\\\"go to Google Maps\\\" href=\\\"https:\\\/\\\/www.google.com\\\/maps\\\/search\\\/?api=1&amp;query=32.57903815%2C-97.146802106158\\\" target=\\\"_blank\\\">Distributor<\\\/a><\\\/div><h3 class=\\\"oum_location_name\\\">Mouser Electronics<\\\/h3><div class=\\\"oum_location_custom_fields\\\"><\\\/div><div class=\\\"oum_location_description\\\">Mouser Electronics<br>Parque de Negocios MAS BLAU I<br>Edificio Muntadas, Esc. A<br>C\\\/ Bergued\\u00e0 n\\u00ba 1, Planta 1, Local 5<br>08820 El Prat de Llobregat, Barcelona<br><br>Tel: 93 6455263<br>espana@mouser.com<br>www.mouser.es\\\/amphenol\\\/<\\\/div><\\\/div>\",\"icon\":\"https:\\\/\\\/www.piher.net\\\/configurator\\\/wp-content\\\/plugins\\\/open-user-map\\\/src\\\/leaflet\\\/images\\\/marker-icon_custom1-2x.png\",\"type\":\"\",\"type_name\":\"\",\"post_id\":\"3178\"}];\n\n        \/* Group Locations by marker categories (if exist) for further processing *\/\n        oum_all_locations.forEach(oumPrepareLocations);\n\n\n        \/**\n         * Add Custom Styles\n         *\/\n        \n        \n          \/* custom color *\/\n          oum_custom_css += `\n            .open-user-map .add-location #close-add-location-overlay:hover {color: #e02aaf !important}\n            .open-user-map input.oum-switch[type=\"checkbox\"]:checked + label::before {background-color: #e02aaf !important}\n            .open-user-map .add-location .location-overlay-content #oum_add_location_thankyou h3 {color: #e02aaf !important}\n            .open-user-map .oum_location_text a {color: #e02aaf !important}\n            .open-user-map .oum-tabs {border-color: #e02aaf !important}\n            .open-user-map .oum-tabs .nav-item:hover {color: #e02aaf !important; border-color: #e02aaf !important}\n            .open-user-map .oum-tabs .nav-item.active {color: #e02aaf !important; border-color: #e02aaf !important}\n            .open-user-map .box-wrap .map-wrap .oum-attribution a {color: #e02aaf !important;}`;\n\n        \n        \n        \n        var custom_style = document.createElement('style');\n\n        if (custom_style.styleSheet) {\n          custom_style.styleSheet.cssText = oum_custom_css;\n        } else {\n          custom_style.appendChild(document.createTextNode(oum_custom_css));\n        }\n\n        document.getElementsByTagName('head')[0].appendChild(custom_style);\n\n      }\n    <\/script>\n\n  <\/div>\n\n  <\/div>\n<\/div><\/code><\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"_links":{"self":[{"href":"https:\/\/www.piher.net\/configurator\/wp-json\/wp\/v2\/posts\/3172"}],"collection":[{"href":"https:\/\/www.piher.net\/configurator\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.piher.net\/configurator\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.piher.net\/configurator\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.piher.net\/configurator\/wp-json\/wp\/v2\/comments?post=3172"}],"version-history":[{"count":4,"href":"https:\/\/www.piher.net\/configurator\/wp-json\/wp\/v2\/posts\/3172\/revisions"}],"predecessor-version":[{"id":3177,"href":"https:\/\/www.piher.net\/configurator\/wp-json\/wp\/v2\/posts\/3172\/revisions\/3177"}],"wp:attachment":[{"href":"https:\/\/www.piher.net\/configurator\/wp-json\/wp\/v2\/media?parent=3172"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.piher.net\/configurator\/wp-json\/wp\/v2\/categories?post=3172"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.piher.net\/configurator\/wp-json\/wp\/v2\/tags?post=3172"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}