Graphics Reference
In-Depth Information
try {
//---------------
// Parameters
//---------------
var title = sym.getVariable("title");
if (!title) { console.warn("MapContainer: Please set
variable 'title'"); return; }
var map = sym.getVariable("map");
if (!map) { console.warn("MapContainer: Please
set variable 'map'"); return; }
//---------------
// Creation
//---------------
// title
sym.$("title").html(title);
// map
var mapContainer = sym.$("mapContainer");
map = map.replace(/width="[0-9]*"/,
'width="'+mapContainer.width()+'"');
map = map.replace(/height="[0-9]*"/,
'height="'+mapContainer.height()+'"');
mapContainer.html(map);
}
catch (error) {
if (console && console.error) {
console.error("Error: ", error.toString());
}
}
In the Parameters section, we first get the symbol variables title and map .
Since both parameters are compulsory, we query the values to output an error,
when necessary.
In the Creation section, we can then set the title and modify the embed code
using regular expressions so that it has the correct width and height. Finally,
we add back the iframe of the map to the target container with the html()
function. We can then export the finished symbol through the Library in order
to import it into other projects.
 
Search WWH ::




Custom Search