I have external javascript files that I uploaded using macro below. Since updating sugarcube none of them are working and I'm panicking!
<<silently>>
<script>
macros =
{
handler: function(place, object, parameters)
{
var se = document.createElement("script");
se.type = 'text/javascript';
se.src = "
http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js";
var hT = document.getElementsByTagName("HEAD")[0];
hT.appendChild(se);
if(se.innerText) {eval(se.innerText);}
else {eval(se.textContent);}
}
}
</script>
<script type="text/javascript" src="lib/sweet-alert.min.js"></script>
<link rel="stylesheet" type="text/css" href="./lib/sweet-alert.css"/>
<script type="text/javascript" src="onclick.js"></script>
<script>
window.fbAsyncInit = function() {
FB.init({
appId : '895302790553250',
xfbml : true,
version : 'v2.4'
});
};
(function(d, s, id){
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) {return;}
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/en_US/sdk.js";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
</script>
<<endsilently>>
Comments
In the future, when posting code, please use the code tag.
What story format, and version, were you using before? When you say you "updated" SugarCube, updated it to what version? Also, where you placing this code at?
A note about your shown code as I await your answers to the above. Your sole "macro" isn't. Jamming a method named handler directly onto the legacy macros object does not a macro make. You are, at the very least, missing the macro body itself. In other words, your "macro", as shown here, is, and has always been, completely non-functional.
It's also a moot point, however, since your non-functional "macro" is attempting to load jQuery, which is something that SugarCube already includes, thus rendering your broken "macro" pointless in the first place.
Also, thanks for the update on the code, it's well and truly thrown in the bin. Sorry about not using the code tag, clearly my first time on the forums. I'll remember next time, thanks for much for your help!