show app icon in menu

master
adbenitez 2022-01-06 20:41:49 -05:00
parent dc12bce134
commit 44ed7ab519
1 changed files with 19 additions and 4 deletions

View File

@ -61,8 +61,9 @@ window.clearXdcStorage = () => {
}
window.alterXdcApp = () => {
var styleControlPanel = 'position: fixed; bottom:1em; left:1em; background-color: #000; opacity:0.8; padding:.5em; font-family: sans-serif; width: 50%;color:#fff;';
var styleMenuLink = 'color:#fff; text-decoration: none;';
var styleControlPanel = 'position: fixed; bottom:1em; left:1em; background-color: #000; opacity:0.8; padding:.5em; font-family: sans-serif; color:#fff;';
var styleMenuLink = 'color:#fff; text-decoration: none; vertical-align: middle';
var styleAppIcon = 'height: 1.5em; width: 1.5em; margin-right: 0.5em; border-radius:10%; vertical-align: middle';
var title = document.getElementsByTagName('title')[0];
if (typeof title == 'undefined') {
title = document.createElement('title');
@ -74,10 +75,24 @@ window.alterXdcApp = () => {
var div = document.createElement('div');
div.innerHTML =
'<div style="' + styleControlPanel + '">' +
'<a href="javascript:window.addXdcPeer();" style="' + styleMenuLink + '">Add Peer</a> | ' +
'<a href="javascript:window.addXdcPeer();" style="' + styleMenuLink + '">Add Peer</a>' +
'<span style="' + styleMenuLink + '"> | </span>' +
'<a href="javascript:window.clearXdcStorage();" style="' + styleMenuLink + '">Clear Storage</a>' +
'<div>';
document.getElementsByTagName('body')[0].append(div.firstChild);
var controlPanel = div.firstChild;
function loadIcon(name) {
var tester = new Image();
tester.onload = () => {
div.innerHTML = '<img src="' + name + '" style="' + styleAppIcon +'">';
controlPanel.insertBefore(div.firstChild, controlPanel.firstChild);
};
tester.src = name;
}
loadIcon("icon.png");
loadIcon("icon.jpg");
document.getElementsByTagName('body')[0].append(controlPanel);
}
}