@sdetweil Hey sean, But then I need to have a ‘server’ running to pull this in. I would prefer just to keep it in another node file in the project. any thoughts on how to do that?
A New Chapter for MagicMirror: The Community Takes the Lead
Read the statement by Michael Teeuw here.
Read the statement by Michael Teeuw here.
A
Latest posts made by AdamBD
-
RE: Help with inserting a script into a <div> element
-
RE: Help with inserting a script into a <div> element
Hi Sean, thanks for answering!
tag.src = “EXTERNAL_SCRIPT_URL”;
What should this point to? A local file on my machine?
-
Help with inserting a script into a <div> element
Hi!
I am working to create a custom module for the moovit transit service. Moovit has an out-of-the-box widget, which is a simple div with a script in it. The issue I am having is that the widget they provide is something thats supposed to be placed in the HTML directly:
<div class="mv-wtp" data-metro="1" data-lang="en" style="width:900px; height:900px;" data-from="hakerem+4+tel" data-to="sarona" > <script>(function(d, s, id) { let js, fjs = d.getElementsByTagName(s)[0]; js = d.createElement(s); js.id = id; js.src = "https://widgets.moovit.com/wtp/en"; fjs.parentNode.insertBefore(js, fjs); }(document, 'script', 'moovit-jsw')); </script> </div>
I dont know how to get a script to run if I am creating a div element from the document object in the module, for example:
getDom: function() { var element = document.createElement("div") element.className = "myContent" element.innerHTML = "Hello, World! " return element },
I understand that if you set innerHTML to be a script it will never evaluate in the browser.
Anyone have suggestions on how to do this?