• I’ve added images to a post, then added the OSM widget. In both Chrome and FireFox, I get the following error – and the map doesn’t display.

    Uncaught SyntaxError: Unexpected token ,
    Line 143

    Line 143 is particularly long. None of the images have special characters in the file names.

    Any ideas?

    https://wordpress.org/plugins/osm/

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter Terence Eden

    (@edent)

    Looking further into it, the error appears to be

    var ll = new OpenLayers.LonLat(,).transform(map_1.displayProjection, map_1.projection);

    “Unexpected ‘,’.”

    Thread Starter Terence Eden

    (@edent)

    Well, I’ve partially solved it 🙂

    In osm-oljs2.php change

    From:
    $Layer .= 'var ll = new OpenLayers.LonLat('.$a_MarkerArray[$row][lon].','.$a_MarkerArray[

    To:
    $Layer .= 'var ll = new OpenLayers.LonLat('.$a_MarkerArray[$row][lon].'\',\''.$a_MarkerArray[

    I’m now getting a different set of errors, but at least the map is displaying!

    Plugin Author MiKa

    (@photoweblog)

    Hi edent,

    could you post the osm shortcode of your map to reproduce the error?

    Thx, photoweblog

    Thread Starter Terence Eden

    (@edent)

    Sorry for the delay. The OSM shortcode is
    [osm_map lat="51.745" lon="-1.262" zoom="10" width="600" height="450" marker="51.75353,-1.25342" marker_name="wpttemp-green.png" import="exif_m"]

    This generates the code

    var ll = new OpenLayers.LonLat(,).transform(map_1.displayProjection, map_1.projection);var feature = new OpenLayers.Feature(MarkerLayer, ll, data);feature.closeBox = true;feature.popupClass = OpenLayers.Class(OpenLayers.Popup.FramedCloud, {"autoSize": true, minSize: new OpenLayers.Size(310,227),"keepInMap": true } );feature.data.popupContentHTML = "<img width=\"290\" height=\"217\" src=\"http://shkspr.mobi/blog/wp-content/uploads/2014/06/IMG_20140625_194228-290x217.jpg\" class=\"attachment-thumbnail\" alt=\"IMG_20140625_194228\" data-attachment-id=\"10599\" data-orig-file=\"http://shkspr.mobi/blog/wp-content/uploads/2014/06/IMG_20140625_194228.jpg\" data-orig-size=\"4128,3096\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;}\" data-image-title=\"IMG_20140625_194228\" data-image-description=\"\" data-medium-file=\"http://shkspr.mobi/blog/wp-content/uploads/2014/06/IMG_20140625_194228-300x225.jpg\" data-large-file=\"http://shkspr.mobi/blog/wp-content/uploads/2014/06/IMG_20140625_194228-1024x768.jpg\" />";feature.data.overflow = "hidden";var marker = new OpenLayers.Marker(ll,data.icon.clone());marker.feature = feature;marker.events.register("mousedown", feature, osm_map_1MarkerPopUpClick);MarkerLayer.addMarker(marker);map_1.addPopup(feature.createPopup(feature.closeBox));var MarkerLayer = new OpenLayers.Layer.Markers("Marker");map_1.addLayer(MarkerLayer);
Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Syntax Error’ is closed to new replies.