-
Notifications
You must be signed in to change notification settings - Fork 2.1k
/
main.js
35 lines (31 loc) · 1.04 KB
/
main.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
// Copyright (c) Microsoft. All rights reserved. Licensed under the MIT license. See LICENSE file in the project root for full license information.
function createSharedTags()
{
// get web root path
var scripts = document.getElementsByTagName("script");
var scriptPath = scripts[scripts.length-1].src;
var versionIndex = scriptPath.lastIndexOf('version/');
var rootDir = scriptPath;
if (versionIndex > 0)
{
rootDir = scriptPath.substring(0, versionIndex);
}
else
{
rootDir = scriptPath.substring(0, scriptPath.lastIndexOf('styles/'));
}
// include dropdown script
var imported = document.createElement('script');
imported.src = rootDir+'web/version.js';
imported.id = 'dropdownScript';
document.head.appendChild(imported);
// include dropdown css
var head = document.getElementsByTagName('head')[0];
var link = document.createElement('link');
link.rel = 'stylesheet';
link.type = 'text/css';
link.href = rootDir+'web/version.css';
link.media = 'all';
head.appendChild(link);
}
createSharedTags();