Skip to content

Instantly share code, notes, and snippets.

@dleavitt
Last active August 29, 2015 14:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dleavitt/439940021b3493e699d1 to your computer and use it in GitHub Desktop.
Save dleavitt/439940021b3493e699d1 to your computer and use it in GitHub Desktop.
<html>
<head>
<style type="text/css">
body {
margin: 0;
}
img {
cursor: pointer;
}
.back {
position: fixed;
left: 0;
top: 0;
width: 100%;
height: 100%;
cursor: pointer;
}
.background {
position: fixed;
width: 1920px;
height: 1080px;
top: 0;
bottom: 0;
left: 0;
right: 0;
background-image: url('down.jpg');
}
</style>
</head>
<body>
<script>
/* eslint-disable */
setTimeout(function() {
var image = new Image();
image.onerror = function() {
showOffline();
return;
}
image.onload = function() {
// launchApp()
showOffline();
return;
}
image.src = "https://inventory-kiosk.s3.amazonaws.com/videos/i.gif";
function showOffline() {
var background = document.createElement('div');
background.className = 'background';
var back = document.createElement('div');
back.className = 'back';
back.onclick = function() {
window.external.RunScript('Player.PlayTemplate("Lexus TV - Interactive (LEXUS VEHICLES)")');
};
background.appendChild(back);
document.body.appendChild(background);
}
function launchApp() {
var xmlURL = 'C:\\Users\\Public\\Documents\\Four Winds Interactive\\Signage\\Channels\\(default)\\DeploymentLite.xml';
var appURL = 'http://staging.lexus.com/DealerInventory/';
var parameterMap = {
dealercode: 'dealerCode',
INVnew: 'new',
INVused: 'used',
INVlcert: 'lcert'
};
var xmlDoc = new ActiveXObject('Microsoft.XMLDOM');
xmlDoc.load(xmlURL);
var parameters = getQueryParameters(xmlDoc);
parameters.skipintro = true;
window.location = appURL + '?' + param(parameters);
}
}, 500);
function mapParameters(values) {
var key;
var obj = {};
for (key in values) {
if (!values.hasOwnProperty(key)) {
return;
}
obj[parameterMap[key]] = values[key];
}
return obj;
}
function param(obj) {
var key;
var string = '';
for (key in obj) {
if (!obj.hasOwnProperty(key)) {
return;
}
string += key + '=' + encodeURIComponent(obj[key]) + '&';
}
string = string.substr(0, string.length - 1);
return string;
}
function getQueryParameters(xmlDoc) {
var arrayOfStrings = xmlDoc.getElementsByTagName('ArrayOfString');
var lookFor = {
dealercode: true,
INVnew: true,
INVused: true,
INVlcert: true
};
var values = {};
for (var i = 0; i < arrayOfStrings.length; i++) {
var strings = arrayOfStrings[i].getElementsByTagName('string');
var value;
var key = strings[0].childNodes[0].nodeValue;
if (lookFor[key]) {
values[key] = strings[1].childNodes[0].nodeValue;
}
}
return mapParameters(values);
}
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment