40 lines
1.0 KiB
JavaScript
40 lines
1.0 KiB
JavaScript
/**
|
|
* Created by Denis on 04/03/14.
|
|
*/
|
|
function addMetaFunction(name, content)
|
|
{
|
|
var meta=document.createElement('meta');
|
|
meta.name=name;
|
|
meta.content=content;
|
|
document.getElementsByTagName('head')[0].appendChild(meta);
|
|
}
|
|
|
|
function addLinkFunction(rel, href)
|
|
{
|
|
var link=document.createElement('link');
|
|
link.rel=rel;
|
|
link.href=href;
|
|
document.getElementsByTagName('head')[0].appendChild(link);
|
|
}
|
|
|
|
function addLinkIconFunction(rel, href, size)
|
|
{
|
|
var link=document.createElement('link');
|
|
link.rel=rel;
|
|
link.setAttribute('sizes', size);
|
|
link.href=href;
|
|
document.getElementsByTagName('head')[0].appendChild(link);
|
|
}
|
|
|
|
function addScriptFunction(scriptFile, version)
|
|
{
|
|
var head=document.getElementsByTagName('head')[0];
|
|
var thisScript = head.getElementsByTagName('script')[1];
|
|
var sc=document.createElement('script');
|
|
sc.type='text/javascript';
|
|
sc.async=true;
|
|
sc.src= scriptFile
|
|
if(version!="")
|
|
sc.src += '?v' + version;
|
|
thisScript.parentNode.insertBefore(sc,thisScript);
|
|
} |