src/js/editPara.js
//use the URL data if it exists to define the answers
use the URL data if it exists to define the answers
use the URL data if it exists to define the answers
function populateAnswersFromURL(){
	readURLdata();
	var keys = Object.keys(params.URLInputValues);
	var aPara= {}
	var aSDC = {}
	keys.forEach(function(k){
		if (k.substring(0,3) == 'SDC'){
			var startWords = k.substring(3,k.length);
			var endWords = decodeURI(params.URLInputValues[k]).split(' ');
			var blanks = getAllIndices(endWords,"");
			blanks.forEach(function(b){endWords.splice(b, 1)});
			aSDC[startWords] = endWords
		} else {
			aPara[k] = decodeURI(params.URLInputValues[k])
		}
	});
	params.answers.forEach(function(a){
		if (params.cleanString(a.groupname) == params.cleanString(params.groupname)){
			if (a.task == 'para'){
				Object.keys(aPara).forEach(function(k){
					a[k] = aPara[k];
				})
			}
			if (a.task == 'SDC'){
				Object.keys(aSDC).forEach(function(k){
					a[k] = aSDC[k];
				})
			}
		}
	})
	params.answersGroupnames = [params.cleanString(params.groupname)];
}
function populateAnswersFromURL ( ) { readURLdata ( ) ; var keys = Object . keys ( params . URLInputValues ) ; var aPara = { } var aSDC = { } keys . forEach ( function ( k ) { if ( k . substring ( 0 , 3 ) == 'SDC' ) { var startWords = k . substring ( 3 , k . length ) ; var endWords = decodeURI ( params . URLInputValues [ k ] ) . split ( ' ' ) ; var blanks = getAllIndices ( endWords , "" ) ; blanks . forEach ( function ( b ) { endWords . splice ( b , 1 ) } ) ; aSDC [ startWords ] = endWords } else { aPara [ k ] = decodeURI ( params . URLInputValues [ k ] ) } } ) ; params . answers . forEach ( function ( a ) { if ( params . cleanString ( a . groupname ) == params . cleanString ( params . groupname ) ) { if ( a . task == 'para' ) { Object . keys ( aPara ) . forEach ( function ( k ) { a [ k ] = aPara [ k ] ; } ) } if ( a . task == 'SDC' ) { Object . keys ( aSDC ) . forEach ( function ( k ) { a [ k ] = aSDC [ k ] ; } ) } } } ) params . answersGroupnames = [ params . cleanString ( params . groupname ) ] ; }
use the URL data if it exists to define the answers
use the URL data if it exists to define the answers
//not sure if this is correct