Commit 07d13b3a authored by Adrien Dorsaz's avatar Adrien Dorsaz

panel: use default css classes and use classes to dis/enable panels

parent 02655800
div.panel{
body {
padding: 0.5rem 1rem;
}
div.panel.disabled{
display: none;
}
div.panel.enabled{
display: block;
}
#firstrunpanel>object {
width: 100%;
height: 50vh;
padding:0;
margin:0;
}
......@@ -6,27 +6,27 @@
</head>
<body>
<div id="errorpanel" class="panel" style="padding:1rem;background-color:red;">
<div id="errorpanel" class="panel disabled" style="padding:1rem;background-color:red;">
</div>
<div id="infopanel" class="panel" style="padding:1rem;background-color:orange;">
<div id="infopanel" class="panel disabled" style="padding:1rem;background-color:orange;">
</div>
<div id="firstrunpanel" class="panel">
<p>Welcome to XMPP Pane!</p>
<p>First, you'll have to <a href="../options/options.html">configure</a> first your XMPP account.</p>
<p>Then, <button class="connectClient">connect</button> and enjoy!</p>
<div id="firstrunpanel" class="panel disabled">
<p>Welcome to XMPP Pane !</p>
<p>To begin, configure, your XMPP account:</p>
<object data="../options/options.html"></object>
</div>
<div id="connectpanel" class="panel">
<p>You are disconnected, please <button class="connectClient">connect</button></p>
<div id="connectpanel" class="panel disabled">
<p>You are disconnected, please <button class="connectClient browser-style">connect</button></p>
</div>
<div id="pubsubpanel" class="panel">
<div id="pubsubpanel" class="panel disabled">
<h1>Communities</h1>
<form id='explore'>
<label for="exploreServer">Server:</label><input id="exploreServer" type="text"></input>
<button type="send">explore</button>
<form id='explore' class="browser-style">
<label class="browser-style-labelh" for="exploreServer">Server:</label><input id="exploreServer" type="text"></input>
<button type="send" class="browser-style">explore</button>
</form>
<div id="xmppNet"></div>
......
......@@ -7,20 +7,20 @@ panel = {
}
for (let pane in panel) {
panel[pane].style.display = 'none';
pane.className = 'panel disabled';
}
function displayFirstRun(response) {
if (response.configured == true) {
panel['firstrun'].style.display = 'none';
panel['firstrun'].className = 'panel disabled';
chrome.runtime.sendMessage({
'from': 'panel',
'subject': 'isConnected'
}, displayConnect);
}
else {
panel['firstrun'].style.display = 'block';
panel['connect'].style.display = 'none';
panel['firstrun'].className = 'panel enabled';
panel['connect'].className = 'panel disabled';
}
}
......@@ -31,27 +31,27 @@ function displayConnect(response) {
});
}
else {
panel['connect'].style.display = 'block';
panel['connect'].className = 'panel enabled';
}
}
function clientConnected(response) {
panel['info'].style.display = 'none';
panel['firstrun'].style.display = 'none';
panel['connect'].style.display = 'none';
panel['info'].className = 'panel disabled'
panel['firstrun'].className = 'panel disabled'
panel['connect'].className = 'panel disabled'
if (response.step == 'initialized') {
panel['info'].style.display = 'block';
panel['info'].className = 'panel enabled';
panel['info'].innerHTML = 'Client initiated connection with server. Waiting for authentication…'
checkConnection();
}
else if (response.connected == true) {
panel['error'].style.display = 'none';
panel['info'].style.display = 'none';
panel['pubsub'].style.display = 'block';
panel['error'].className = 'panel disabled'
panel['info'].className = 'panel disabled'
panel['pubsub'].className = 'panel enabled';
}
else if (response.connected == false) {
panel['error'].style.display = 'block';
panel['error'].className = 'panel enabled';
panel['error'].innerHTML = response.error + '<br/>You could try to <a href="../options/options.html">modify</a> your settings';
}
}
......@@ -76,7 +76,7 @@ function refreshNetwork(response) {
xmppNet.innerHTML = response.toString();
}
else {
panel['error'].style.display = 'block';
panel['error'].className = 'panel enabled';
panel['error'].innerHTML = response.error.message + '(' + response.error.code + ')';
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment