Fixed a bug where button Cancel could look infinately (or a lot)

This commit is contained in:
Anders Betnér 2006-05-26 20:22:21 +00:00
parent 6ea05929ee
commit 0f27d923a5
2 changed files with 12 additions and 8 deletions

View File

@ -96,7 +96,6 @@ var ConfigInitialValues = {
}; };
var Config = { var Config = {
configPath: '', configPath: '',
configOptionValues: '',
init: function () { init: function () {
new Ajax.Request('/config.xml',{method: 'get',onComplete: Config.storeConfigLayout}); new Ajax.Request('/config.xml',{method: 'get',onComplete: Config.storeConfigLayout});
}, },
@ -114,7 +113,6 @@ var Config = {
}, },
showConfig: function (request) { showConfig: function (request) {
ConfigInitialValues.parseXML(request.responseXML); ConfigInitialValues.parseXML(request.responseXML);
Config.configOptionValues = request.responseXML;
var sections = ConfigXML.getSections(); var sections = ConfigXML.getSections();
sections.each(function (section) { sections.each(function (section) {
var head = document.createElement('div'); var head = document.createElement('div');
@ -264,9 +262,15 @@ var Config = {
} }
Config._removeItem(div); Config._removeItem(div);
}, },
_removeItem: function(div) { _removeItem: function(div,noAnimation) {
if (div.parentNode.childNodes.length > 1) { if (div.parentNode.childNodes.length > 1) {
Effect.BlindUp(div,{duration: 0.2, afterFinish: function (){Element.remove(div);}}); if (noAnimation) {
// cancelForm uses a loop to delete elements, the loop can't wait
// for Effect.BlindUp to finish
Element.remove(div);
} else {
Effect.BlindUp(div,{duration: 0.2, afterFinish: function (){Element.remove(div);}});
}
} else { } else {
div.getElementsByTagName('input')[0].value=''; div.getElementsByTagName('input')[0].value='';
} }
@ -372,10 +376,10 @@ var i=0;
while (initialValuesCount < currentElements.length) { while (initialValuesCount < currentElements.length) {
i++; i++;
if (i > 10) { if (i > 10) {
alert('Getting dizy; too many turns in this loop (silly errormessage 1'); alert('Getting dizzy; too many turns in this loop (silly errormessage 1)');
return; return;
} }
Config._removeItem(currentElements[0].parentNode); Config._removeItem(currentElements[0].parentNode,'noAnimation');
} }
while (initialValuesCount > currentElements.length) { while (initialValuesCount > currentElements.length) {
i++; i++;

View File

@ -81,7 +81,7 @@
</item> </item>
</section> </section>
<section name="Music_Files"> <section name="Music Files">
<item id="mp3_dir" config_section="general" required="true"> <item id="mp3_dir" config_section="general" required="true">
<name>MP3 Directory</name> <name>MP3 Directory</name>
<short_description></short_description> <short_description></short_description>