'inject javascript method on demand
Sub InjectJavaScriptFile(jsURL As String)
Dim sFile As String = $"./scripts/${jsURL}"$
BANano.RunJavascriptMethod("loadjscssfile",Array As String(sFile,"js"))
End Sub
'inject javascript method on demand
Sub InjectCSSFile(jsURL As String)
Dim sFile As String = $"./styles/${jsURL}"$
BANano.RunJavascriptMethod("loadjscssfile",Array As String(sFile,"css"))
End Sub
#if javascript
function loadjscssfile(filename, filetype){
if (filetype=="js"){
var fileref=document.createElement('script');
fileref.setAttribute("type","text/javascript");
fileref.setAttribute("src", filename);
}
else if (filetype=="css"){
var fileref=document.createElement("link");
fileref.setAttribute("rel", "stylesheet");
fileref.setAttribute("type", "text/css");
fileref.setAttribute("href", filename);
}
if (typeof fileref!="undefined"){
var head = document.getElementsByTagName('head')[0];
var lastChild = head.lastChild;
head.insertBefore(fileref, lastChild);
}
}
#End If