<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Call external function from JavaScript file - XML dashboard in All Apps and Add-ons</title>
    <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/Call-external-function-from-JavaScript-file-XML-dashboard/m-p/253344#M29082</link>
    <description>&lt;P&gt;Hello,&lt;BR /&gt;
I'm trying to use an external javasript library (&lt;A href="https://github.com/manuelbieh/Geolib"&gt;https://github.com/manuelbieh/Geolib&lt;/A&gt;) within the javascript that is called from the XML Dashboard.&lt;BR /&gt;
code of javascript included directly in XML dashboard:&lt;BR /&gt;
var polygon2 = [&lt;BR /&gt;
        {"latitude": 51.513357512, "longitude": 7.45574331, "elevation":523.92},&lt;BR /&gt;
        {"latitude": 51.515400598, "longitude": 7.45518541, "elevation":524.54},&lt;BR /&gt;
    ];&lt;BR /&gt;
require(['Geolib-master/src/geolib'], function($){&lt;BR /&gt;
    box = geolib.getCenterOfBounds(polygon2);&lt;BR /&gt;
    alert ("center Lat: " + box.latitude + "Lon: "+box.longitude );&lt;BR /&gt;
});&lt;/P&gt;

&lt;P&gt;I get the error: ReferenceError: Can't find variable: geolib&lt;BR /&gt;
the geolib.js file is stored in the path Splunk/share/splunk/search_mrsparkle/exposed/js/Geolib-master/src&lt;BR /&gt;
Thank you in advance for your help!&lt;/P&gt;</description>
    <pubDate>Thu, 13 Oct 2016 12:44:30 GMT</pubDate>
    <dc:creator>SP987541</dc:creator>
    <dc:date>2016-10-13T12:44:30Z</dc:date>
    <item>
      <title>Call external function from JavaScript file - XML dashboard</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/Call-external-function-from-JavaScript-file-XML-dashboard/m-p/253344#M29082</link>
      <description>&lt;P&gt;Hello,&lt;BR /&gt;
I'm trying to use an external javasript library (&lt;A href="https://github.com/manuelbieh/Geolib"&gt;https://github.com/manuelbieh/Geolib&lt;/A&gt;) within the javascript that is called from the XML Dashboard.&lt;BR /&gt;
code of javascript included directly in XML dashboard:&lt;BR /&gt;
var polygon2 = [&lt;BR /&gt;
        {"latitude": 51.513357512, "longitude": 7.45574331, "elevation":523.92},&lt;BR /&gt;
        {"latitude": 51.515400598, "longitude": 7.45518541, "elevation":524.54},&lt;BR /&gt;
    ];&lt;BR /&gt;
require(['Geolib-master/src/geolib'], function($){&lt;BR /&gt;
    box = geolib.getCenterOfBounds(polygon2);&lt;BR /&gt;
    alert ("center Lat: " + box.latitude + "Lon: "+box.longitude );&lt;BR /&gt;
});&lt;/P&gt;

&lt;P&gt;I get the error: ReferenceError: Can't find variable: geolib&lt;BR /&gt;
the geolib.js file is stored in the path Splunk/share/splunk/search_mrsparkle/exposed/js/Geolib-master/src&lt;BR /&gt;
Thank you in advance for your help!&lt;/P&gt;</description>
      <pubDate>Thu, 13 Oct 2016 12:44:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/Call-external-function-from-JavaScript-file-XML-dashboard/m-p/253344#M29082</guid>
      <dc:creator>SP987541</dc:creator>
      <dc:date>2016-10-13T12:44:30Z</dc:date>
    </item>
    <item>
      <title>Re: Call external function from JavaScript file - XML dashboard</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/Call-external-function-from-JavaScript-file-XML-dashboard/m-p/253345#M29083</link>
      <description>&lt;P&gt;I tried different things, and this finally worked out for me:&lt;BR /&gt;
1. copied the geolib.js file to Splunk/share/splunk/search_mrsparkle/exposed/js&lt;BR /&gt;
2. changed the code from: require(['Geolib-master/src/geolib'], function($){&lt;BR /&gt;
to: require(['geolib'], function(geolib){&lt;/P&gt;

&lt;P&gt;I don't fully understand, but it is working &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 13 Oct 2016 14:09:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/Call-external-function-from-JavaScript-file-XML-dashboard/m-p/253345#M29083</guid>
      <dc:creator>SP987541</dc:creator>
      <dc:date>2016-10-13T14:09:14Z</dc:date>
    </item>
  </channel>
</rss>

