Skip to content

Instantly share code, notes, and snippets.

@sarog sarog/applist.txt

Last active Mar 14, 2019
Embed
What would you like to do?
MobiControl Dynamic Kiosk HTML Template
Package 1|launch://com.company.package1|data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAAZElEQVR42u3QAQ0AAAQAMPpoLSg5zB/hWRMdj6UAAQIECBAgQIAAAQIECBAgQIAAAQIECBAgQIAAAQIECBAgQIAAAQIECBAgQIAAAQIECBAgQIAAAQIECBAgQIAAAQIECBBw3wKB4HPBZxtNLQAAAABJRU5ErkJggg==
Title 2|file://mnt/sdcard/report.pdf|file:///SDCard/images/Title2.jpg
Browse Website|browse://www.example.com|file:///SDCard/images/Website.jpg
Package 4|launch://com.company.package4|data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAAABCAYAAABubagXAAAAEElEQVR42mNk+P+/nmEEAwB6pgJ/X9KuVAAAAABJRU5ErkJggg==
Notepad Demo|intent://com.google.provider.NotePad/notes/1#Intent;scheme=content;action=android.intent.action.EDIT;component=com.example.android.notepad/.NoteEditor;end|data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAAZElEQVR42u3QAQ0AAAQAMGLILyg5zB/hGTUdj6UAAQIECBAgQIAAAQIECBAgQIAAAQIECBAgQIAAAQIECBAgQIAAAQIECBAgQIAAAQIECBAgQIAAAQIECBAgQIAAAQIECBBw3wI9K28BURnnnAAAAABJRU5ErkJggg==
Title 6|launchalways://com.company.package6|file:///SDCard/images/CompanyLogo.jpg
Example URL|http://example.com|file:///SDCard/images/Example.jpg
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Company Apps</title>
<style type="text/css">
html,
body {
height: 99.3%;
}
body {
margin: 4px 4px 0px 4px;
background: #000;
}
#wrapper {
min-height: 100%;
height: auto !important;
height: 100%;
margin: 0 auto -4em;
}
#header {
height: 71px;
width: 100%;
border-bottom: 1px solid #fff;
}
#header .lockicon {
width: 69px;
height: 71px;
float: left;
position: absolute;
}
#header .title {
font: bold 30px arial, sans-serif;
text-align: center;
line-height: 71px;
color: #fff;
/*margin-left: 69px;*/
display: block;
}
#main {
text-align: center;
margin: 4px 0 100px;
}
#main .row {
display: table;
white-space: nowrap;
margin: 0px auto;
}
#main .row ul {
list-style: none;
margin: 0;
padding: 0;
display: table-row;
white-space: nowrap;
}
#main .row ul br {
clear: both;
}
#main .row ul li {
width: 149px;
height: 153px;
padding: 2px;
margin: 2px 4px 2px 0px;
vertical-align: middle;
text-align: center;
background-color: #CCC;
position: relative;
display: table-cell;
float: left
}
#main .row ul li img {
border: 0;
width: 86px;
height: 86px;
padding: 12px;
}
#main .row ul li .txt {
color: #666666;
font: bold 16px arial, sans-serif;
}
#footer {
font: bold 30px arial, sans-serif;
color: #fff;
position: fixed;
bottom: 0;
margin: 0;
padding: 0;
width: 100%;
height: 57px;
}
.mc-notification-on {
position: absolute;
top: 5px;
right: 25px;
text-align: center;
color: white;
border-radius: 10px;
background-color: red;
width: 20px;
font-weight: bold;
}
/* IE7+ fix */
html>body #footer {
margin: 0 0 0 -4px;
padding: 0 4px;
}
#footer .footerContainer {
margin: 0;
display: block;
overflow: hidden;
height: 57px;
line-height: 57px;
}
/* IE7+ fix */
html>body #footer .footerContainer {
margin: 0 8px 0 0;
}
#footer .footerContainer .footerBg {
width: 426px;
height: 57px;
float: right;
}
#footer,
.push {
height: 2em;
height: 57px \0/;
}
</style>
</head>
<body>
<!-- <body onload="myFunction()"> -->
<div id="wrapper">
<div id="header">
<span class="title">Company Apps</span>
</div>
<div id="main">
<div id="output"></div>
</div>
<div class="push"></div>
</div>
<div id="footer">
<div class="footerContainer">
<div class="footerBg"></div>
</div>
</div>
<script language="JavaScript" type="text/javascript">
var divoutput = document.getElementById("output");
var maxCols = 2;
function readTextFile(file) {
var rawFile = new XMLHttpRequest();
rawFile.open("GET", file, true);
rawFile.onreadystatechange = function() {
if (rawFile.readyState === 4) {
if (rawFile.status === 200 || rawFile.status == 0) {
var allText = rawFile.responseText;
var lines = allText.split('\n');
// alert(allText);
var currentCol = 0;
var divRow = document.createElement('div');
divRow.setAttribute('class', 'row');
var ulist = document.createElement('ul');
divRow.appendChild(ulist);
var listItem;
divoutput.appendChild(divRow);
for (var line = 0; line < lines.length; line++) {
item = lines[line].split('|');
// console.log(lines[line]);
newlink = document.createElement('a');
// newlink.setAttribute('class', 'my-custom-class');
newlink.setAttribute('href', item[1]);
linkImg = document.createElement('img');
linkImg.setAttribute('src', item[2]);
linkImg.setAttribute('onError', "this.style.display='none'");
divText = document.createElement('div');
divText.setAttribute('class', 'txt');
divText.innerHTML = item[0];
newlink.appendChild(linkImg);
newlink.appendChild(divText);
// Create a new list item
listItem = document.createElement('li');
// Add to list item (<li>)
listItem.appendChild(newlink);
// Add to list (<ul>)
ulist.appendChild(listItem);
console.log(currentCol);
currentCol++;
if (currentCol >= maxCols) {
// Start a new row
divRow = document.createElement('div');
divRow.setAttribute('class', 'row');
divoutput.appendChild(divRow);
ulist = document.createElement('ul');
divRow.appendChild(ulist);
// Reset
currentCol = 0;
}
}
}
}
}
rawFile.send(null);
}
readTextFile("file:///sdcard/applist.txt");
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.