Coded & Hosted Website

Web Development for Coded&Hosted

Coded&Hosted

Lynsey Weatherspoon Photography Newsletter Vol 1

Newsletter coded and delivered for Lynsey Weatherspoon Photography

Inquiries? Visit Coded&Hosted

Launched! http://www.lenoxlounge.com
Built with: 
HAML
PHP
SASS
JQuery
MySQL
Thanks to Sharron Cannon for choosing me to build this site. Thanks to Asjai Lou for enduring my many questions about the details. Thanks to Mary & the team at the Studio for their awesome design prowess.

Launched! http://www.lenoxlounge.com

Built with: 

Thanks to Sharron Cannon for choosing me to build this site. Thanks to Asjai Lou for enduring my many questions about the details. Thanks to Mary & the team at the Studio for their awesome design prowess.

Strikeback

Strikeback

Tasked w creating a quiz for Cinemax’s Strikeback I came up with this in about 2hrs. Wish I were faster. Should have been one hour.


$(function(){
	var question;
	var prob;
	var answers = [];
	
	$('div .next').click(function(){	
		question = $(this).parent().parent().parent().parent().attr('id');
		answer(question);
	});
	
	$('div .prev').click(function(){	
		question = $(this).parent().parent().parent().parent().attr('id');
		answers.pop();
		prev(question);
	});	
	
	function answer(question)
	{
		prob = false;
		
		var option = $("input[name=" + question + "]:checked").val();
		
		if (!option)
		{
			alert('Please choose an option');
			prob = true;
		}
		
		if(!prob)
		{
			answers.push(option);
			next(question);
		}
		
		if (answers.length == 5){
			compute(answers);
		}
	}
	
	function compute(answers)
	{
		var a_count = 0, b_count = 0;
		
		for (x in answers)
		{
			if (answers[x] == "A")
			{
				a_count++;
			}
			if(answers[x] == "B")
			{
				b_count++;						
			}
		}
		
		if (a_count > b_count)
		{
			window.location = 'msresults.php';
		}
		else
		{
			window.location = 'dsresults.php';
		}
	}
	
	function next(question)
	{
		switch(question)
		{
			case 'q1':
			$('#q1').hide();
			$('#q2').show();
			$('#qswitch').attr('src','images/strikeback_hub_002.jpg');
			break;
			case 'q2':
			$('#q2').hide();
			$('#q3').show();
			$('#qswitch').attr('src','images/strikeback_hub_003.jpg');
			break;
			case 'q3':
			$('#q3').hide();
			$('#q4').show();
			$('#qswitch').attr('src','images/strikeback_hub_004.jpg');
			break;
			case 'q4':
			$('#q4').hide();
			$('#q5').show();
			$('#qswitch').attr('src','images/strikeback_hub_005.jpg');
			break;
			case 'q5':
			$('#q5').hide();
			$('#results').show();	
			break;
			default: '';
		}
	}
	
	function prev(question)
	{
		switch(question)
		{
			case 'q2':
			$('#q2').hide();
			$('#q1').show();
			$('#qswitch').attr('src','images/strikeback_hub_001.jpg');
			break;
			case 'q3':
			$('#q3').hide();
			$('#q2').show();
			$('#qswitch').attr('src','images/strikeback_hub_002.jpg');
			break;
			case 'q4':
			$('#q4').hide();
			$('#q3').show();
			$('#qswitch').attr('src','images/strikeback_hub_003.jpg');
			break;
			case 'q5':
			$('#q5').hide();
			$('#q4').show();
			$('#qswitch').attr('src','images/strikeback_hub_004.jpg');
			break;
			default: '';
		}
	}
	
	/* twitter link */
	var text = "Visit the Strike Back Adrenaline Hub and Enter for a Chance to Win";
	var link = "http://maximonline.com/strikeback";
	var url = "http://twitter.com/share?url=" + encodeURIComponent(link) + "&text=" + encodeURIComponent(text);
	$('#twitter').attr('href', url).attr('target','_blank');;

	
	/* facebook link */
	u = "http://maximonline.com/strikeback/";
	t = "Visit the Strike Back Adrenaline Hub and Enter for a Chance to Win";
	url = 'http://www.facebook.com/sharer.php?u='+encodeURIComponent(u)+'&t='+encodeURIComponent(t);
	$('#facebook').attr('href', url).attr('target','_blank');

	/* clear submit button text */
	$('#Submit').attr('value','');
	
	$('#caspioform table td:eq(2)').css('padding-right','60px');
	$('#caspioform table td:eq(10)').css('padding-right','60px');
	$('#caspioform table td:eq(30)').css('padding-right','25px');
	$('#caspioform table td:eq(33)').css('padding-right','25px');
});