2150 |
mathias |
1 |
window.onload = function(){
|
|
|
2 |
// get the app name from our URL
|
|
|
3 |
var href = window.location.href;
|
|
|
4 |
var matches = href.match(/appName=([a-z0-9 \%]*)/i);
|
|
|
5 |
var appName = "Application";
|
|
|
6 |
if(matches && matches.length > 0){
|
|
|
7 |
appName = decodeURIComponent(matches[1]);
|
|
|
8 |
}
|
|
|
9 |
|
|
|
10 |
// set it in our UI
|
|
|
11 |
var appNameSpan = document.getElementById("dot-learn-how-app-name");
|
|
|
12 |
appNameSpan.innerHTML = "";
|
|
|
13 |
appNameSpan.appendChild(document.createTextNode(appName));
|
|
|
14 |
|
|
|
15 |
// if we need an offline cache, and we already have one installed,
|
|
|
16 |
// update the UI
|
|
|
17 |
matches = href.match(/hasOfflineCache=(true|false)/);
|
|
|
18 |
var hasOfflineCache = false;
|
|
|
19 |
if(matches && matches.length > 0){
|
|
|
20 |
hasOfflineCache = matches[1];
|
|
|
21 |
// convert to boolean
|
|
|
22 |
hasOfflineCache = (hasOfflineCache == "true") ? true : false;
|
|
|
23 |
}
|
|
|
24 |
if(hasOfflineCache == true){
|
|
|
25 |
// delete the download and install steps
|
|
|
26 |
var downloadStep = document.getElementById("dot-download-step");
|
|
|
27 |
var installStep = document.getElementById("dot-install-step");
|
|
|
28 |
downloadStep.parentNode.removeChild(downloadStep);
|
|
|
29 |
installStep.parentNode.removeChild(installStep);
|
|
|
30 |
}
|
|
|
31 |
|
|
|
32 |
// get our run link info and update the UI
|
|
|
33 |
matches = href.match(/runLink=([^\&]*)\&runLinkText=([^\&]*)/);
|
|
|
34 |
if(matches && matches.length > 0){
|
|
|
35 |
var runLink = decodeURIComponent(matches[1]);
|
|
|
36 |
var runLinkElem = document.getElementById("dot-learn-how-run-link");
|
|
|
37 |
runLinkElem.setAttribute("href", runLink);
|
|
|
38 |
|
|
|
39 |
var runLinkText = decodeURIComponent(matches[2]);
|
|
|
40 |
runLinkElem.innerHTML = "";
|
|
|
41 |
runLinkElem.appendChild(document.createTextNode(runLinkText));
|
|
|
42 |
}
|
|
|
43 |
}
|