mirror of
https://github.com/owntone/owntone-server.git
synced 2025-04-07 13:15:45 -04:00
Remove the "saved" alert on config.html closes #160
This commit is contained in:
parent
c9cdd06240
commit
e3842fe73e
@ -32,19 +32,24 @@ select {
|
|||||||
padding-left: 1.5em;
|
padding-left: 1.5em;
|
||||||
margin-bottom: .5em;
|
margin-bottom: .5em;
|
||||||
}
|
}
|
||||||
#config_not_writable_warning {
|
.message_div {
|
||||||
background-color: yellow;
|
background-color: yellow;
|
||||||
padding: 1em;
|
padding: 1em;
|
||||||
border: 1px solid #8CACBB;
|
border: 1px solid #8CACBB;
|
||||||
}
|
}
|
||||||
.warning_color {
|
#messages {
|
||||||
background-color: yellow;
|
background-color: yellow;
|
||||||
|
padding: 1em;
|
||||||
|
border: 1px solid #8CACBB;
|
||||||
|
width: 40em;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
<h1>Configuration</span></h1><span id="toggle_basic_advanced"></span>
|
<h1>Configuration</span></h1><span id="toggle_basic_advanced"></span>
|
||||||
<div id="config_not_writable_warning" style="display: none;">Your config file is not writable, you can not change anything using this webpage</div>
|
<div id="config_not_writable_warning" class="message_div" style="display: none;">Your config file is not writable, you can not change anything using this webpage</div>
|
||||||
|
|
||||||
<form id="theform" method="get" action="#">
|
<form id="theform" method="get" action="#">
|
||||||
</form>
|
</form>
|
||||||
<div id="buttons"></div>
|
<div id="buttons"></div>
|
||||||
|
<br />
|
||||||
|
<div id="messages" class="message_div" style="display: none;"></div>
|
||||||
@include ftr.html@
|
@include ftr.html@
|
||||||
|
@ -10,6 +10,7 @@ Event.observe(window,'load',init);
|
|||||||
// I could have put it below Config = ... but I want all window.load events
|
// I could have put it below Config = ... but I want all window.load events
|
||||||
// at the start of the file
|
// at the start of the file
|
||||||
var DEBUG = window.location.toString().match(/debug.*/);
|
var DEBUG = window.location.toString().match(/debug.*/);
|
||||||
|
var g_messageTimeout;
|
||||||
if ('debug=validate' == DEBUG) {
|
if ('debug=validate' == DEBUG) {
|
||||||
DEBUG = 'validate';
|
DEBUG = 'validate';
|
||||||
}
|
}
|
||||||
@ -117,7 +118,7 @@ var ConfigInitialValues = {
|
|||||||
frag.appendChild(document.createTextNode(el));
|
frag.appendChild(document.createTextNode(el));
|
||||||
frag.appendChild(document.createElement('br'));
|
frag.appendChild(document.createElement('br'));
|
||||||
});
|
});
|
||||||
var outerDiv = Builder.node('div',{id: ConfigXML.getSectionId('missing_items'),className: 'warning_color'});
|
var outerDiv = Builder.node('div',{id: ConfigXML.getSectionId('missing_items')});
|
||||||
outerDiv.appendChild(Builder.node('div',{className: 'naviheader'},'Options missing from config.xml'));
|
outerDiv.appendChild(Builder.node('div',{className: 'naviheader'},'Options missing from config.xml'));
|
||||||
var contentDiv = Builder.node('div',{className: 'navibox'});
|
var contentDiv = Builder.node('div',{className: 'navibox'});
|
||||||
contentDiv.appendChild(document.createTextNode('The options below are in your mt-daapd.conf and Firefly uses them,'));
|
contentDiv.appendChild(document.createTextNode('The options below are in your mt-daapd.conf and Firefly uses them,'));
|
||||||
@ -452,10 +453,18 @@ var BuildElement = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
function saved(req) {
|
function saved(req) {
|
||||||
|
if (g_messageTimeout) {
|
||||||
|
window.clearTimeout(g_messageTimeout);
|
||||||
|
}
|
||||||
if ('200' == Element.textContent(req.responseXML.getElementsByTagName('status')[0])) {
|
if ('200' == Element.textContent(req.responseXML.getElementsByTagName('status')[0])) {
|
||||||
alert('Saved');
|
$('messages').innerHTML = 'Saved';
|
||||||
|
Effect.Appear('messages',{duration: 0.2});
|
||||||
|
g_messageTimeout = window.setTimeout(function(){
|
||||||
|
Effect.Fade('messages',{duration: 0.2});
|
||||||
|
},3000);
|
||||||
} else {
|
} else {
|
||||||
alert("Couldn't save and if this weren't a beta I'd tell you why");
|
$('messages').innerHTML = 'Error: ' + req.responseText;
|
||||||
|
Effect.Appear('messages',{duration: 0.2});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function saveForm() {
|
function saveForm() {
|
||||||
@ -578,6 +587,16 @@ var i=0;
|
|||||||
//###TODO potential error a select without a default value
|
//###TODO potential error a select without a default value
|
||||||
$(item.id).value = ConfigInitialValues.getValue(item.id) || item.default_value || '';
|
$(item.id).value = ConfigInitialValues.getValue(item.id) || item.default_value || '';
|
||||||
}
|
}
|
||||||
|
$('messages').innerHTML = 'Cancelled';
|
||||||
|
if (g_messageTimeout) {
|
||||||
|
window.clearTimeout(g_messageTimeout);
|
||||||
|
}
|
||||||
|
Effect.Appear('messages',{duration: 0.2});
|
||||||
|
g_messageTimeout = window.setTimeout(function(){
|
||||||
|
Effect.Fade('messages',{duration: 0.2});
|
||||||
|
},3000);
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user