WIP getting values back into client

This commit is contained in:
Leon 2017-03-07 13:59:55 +13:00
parent d279786f39
commit c7b9731d0a
2 changed files with 32 additions and 0 deletions

View file

@ -119,6 +119,37 @@ jQuery(document).ready(function($){
$('.options-form:last').clone().insertAfter('.options-form:last');
});
// load existing settings
if (settings != 'banana') {
console.log('existing settings found, lets use those');
archives = settings.split('baseUrl=');
// remove crufty first element
archives.shift();
console.log(archives);
// iterate each saved settings chunk and create forms for them
$.each(archives, function(index, value) {
// add back in the 'baseUrl='
archive = 'baseUrl=' + value;
// trim trailing field
//archive = archive.substring(0, archive.indexOf('&staticExportSettings=&'));
archive = archive.substring(0, archive.indexOf('&staticExportSettings='));
//archive = archive.substring(0, archive.indexOf('staticExportSettings='));
console.log(archive);
settingsBlock = JSON.parse('{"' + decodeURI(archive).replace(/\n/g, ",").replace(/\r/g, ",").replace(/"/g, '\\"').replace(/&/g, '","').replace(/=/g,'":"') + '"}');
console.log(settingsBlock);
});
}
});
</script>