anduril.js
// (i.e. "add" or "generate"). Here's where we string everything together.
. Here's where we string everything together.
. Here ' s where we string everything together .
function postMovie(e){
	resetFilmNumbers();
	var target = e.target;
	if(target.id === "generator" && data.genStory){
		data.dark = ageApp(data.filmData);
		explode();
		get("theButton").innerHTML = ""; 
	}
	else if(target.id === "adder"){
		var yearInt = parseInt(elYear.value);
		if(elMovie.value !== "Title" && elMovie.value && elYear.value !== "Year" && 2016 > yearInt && yearInt > 1890){
			var movieTitle = elMovie.value;
			var year = elYear.value;
			var urlToCall = urlBuild(titleSmoother(movieTitle), year);
			mrSulu(urlToCall);
		}
		else{
			if((elMovie.value === "Title" || !elMovie.value) && (isNaN(parseInt(elYear.value)) || typeof parseInt(elYear.value) !== "number" || 2016 < parseInt(elYear.value) || parseInt(elYear.value) < 1890)){
				get("feedback").innerHTML = "";
				domMan("p", tNode("Valid movie title and year required"), get("feedback"));
				get("movie").focus();
			}
			else if(isNaN(parseInt(elYear.value)) || typeof parseInt(elYear.value) !== "number" || 2016 < parseInt(elYear.value) || parseInt(elYear.value) < 1890){
				get("feedback").innerHTML = "";
				domMan("p", tNode("Please enter valid year between 1890 and 2015"), get("feedback"));
				get("year").focus();
			}
			else{
				get("feedback").innerHTML = "";
				domMan("p", tNode("Movie title required"), get("feedback"));
				get("movie").focus();
			}
		}
	}
}
function postMovie ( e ) { resetFilmNumbers ( ) ; var target = e . target ; if ( target . id === "generator" && data . genStory ) { data . dark = ageApp ( data . filmData ) ; explode ( ) ; get ( "theButton" ) . innerHTML = "" ; } else if ( target . id === "adder" ) { var yearInt = parseInt ( elYear . value ) ; if ( elMovie . value !== "Title" && elMovie . value && elYear . value !== "Year" && 2016 > yearInt && yearInt > 1890 ) { var movieTitle = elMovie . value ; var year = elYear . value ; var urlToCall = urlBuild ( titleSmoother ( movieTitle ) , year ) ; mrSulu ( urlToCall ) ; } else { if ( ( elMovie . value === "Title" || ! elMovie . value ) && ( isNaN ( parseInt ( elYear . value ) ) || typeof parseInt ( elYear . value ) !== "number" || 2016 < parseInt ( elYear . value ) || parseInt ( elYear . value ) < 1890 ) ) { get ( "feedback" ) . innerHTML = "" ; domMan ( "p" , tNode ( "Valid movie title and year required" ) , get ( "feedback" ) ) ; get ( "movie" ) . focus ( ) ; } else if ( isNaN ( parseInt ( elYear . value ) ) || typeof parseInt ( elYear . value ) !== "number" || 2016 < parseInt ( elYear . value ) || parseInt ( elYear . value ) < 1890 ) { get ( "feedback" ) . innerHTML = "" ; domMan ( "p" , tNode ( "Please enter valid year between 1890 and 2015" ) , get ( "feedback" ) ) ; get ( "year" ) . focus ( ) ; } else { get ( "feedback" ) . innerHTML = "" ; domMan ( "p" , tNode ( "Movie title required" ) , get ( "feedback" ) ) ; get ( "movie" ) . focus ( ) ; } } } }
(i.e.
( i . e .
//Get the 'target'; the element that the user clicks on //Checking for a "generator" case and 'explode()'s if yes //checking for age appropriateness //explosion //clear button //If it's an "add" case... //get the year //if input is okay... //smooth out the title to make it easy for the API, build the request URL // from there //request the data, mrSulu!  //With the logic of Spock, we can determine if the fields filled out in the  //form are okay or not.  //Basically, this tests for acceptable data entered into the form field.  //If not, it will update the "feedback" tag right above the form, so the  //user can read it and act accordingly. Live long and prosper! //clear the feedback paragraph //update with error //clear the feedback paragraph //update with error //clear the feedback paragraph //update with error