Created
April 17, 2012 20:17
-
-
Save nate8684/2408732 to your computer and use it in GitHub Desktop.
Events Page
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" | |
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | |
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> | |
<head> | |
<!-- =========== META =============================== --> | |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" /> | |
<title></title> | |
<!-- =========== STYLES =============================== --> | |
<link rel="stylesheet" href="styles/jquery.mobile-1.0.1.css" /> | |
<link rel="stylesheet" media="all and (orientation:landscape)" href="styles/iphone-lan.css"> | |
<link type="text/css" rel="stylesheet" href="styles/iphone.css" /> | |
<!-- =========== EXTERNAL SCRIPTS =============================== --> | |
<script src="http://jquerymobile.com/test/js/jquery.js"></script> | |
<script type="text/javascript" src="scripts/phonegap.js"></script> | |
<script> | |
$(document).bind("mobileinit", function(){ | |
$.mobile.defaultPageTransition = 'none'; | |
}); | |
</script> | |
<script src="http://jquerymobile.com/test/js/jquery.mobile.js"></script> | |
</head> | |
<body> | |
<!-- ========== PAGE 1 CONTENT ========================== --> | |
<div class="page-wrapper" id="events" data-role="page"> | |
<div data-role="content" class="content"> | |
<div class="page-header">Events</div> | |
<script type="text/javascript"> | |
$('#events').live( 'pageshow',function(event, ui){ | |
$('.pics').css('display', 'inline-block'); | |
}); | |
function picsHide() { | |
$('.loading-wrapper').append('<div class="loading">Your page is loading…</div>'); | |
$('.pics').css('display', 'none'); | |
} | |
</script> | |
<div id="event-images"> </div> | |
<script> | |
// ---------- AJAX JSON CALL ---------------- | |
$('.loading-wrapper').append('<div class="loading">Your page is loading…</div>'); | |
$.ajax({ | |
url: "http://www.lcbcchurch.com/mobileJSON/events", | |
dataType: "json", | |
success:function(data){ | |
eventResults(data); | |
} | |
}); | |
function eventResults(data) { | |
for(var i = 0; i<data.length;i++){ | |
// this will log all of the images url | |
console.log(data[i]["event-image"]); | |
// just access the part you want by it's name. | |
$("#event-images").append("<a href='#"+data[i]["url_title"]+"' id='event-button' rel='external' onClick='picsHide();'><img class='pics' src='"+data[i]["event-image"]+"' width='156' height='74'></a>"); | |
$("body").prepend("<div id='"+data[i]["url_title"]+"' class='event-detail' data-role='page'><div id='back"+data[i]["url_title"]+"' class='back-header' data-role='header'><a href='events.html' data-icon='delete' iconpos='notext' id='close'>Cancel</a><h1></h1>"); | |
// --- EVENT REGISTRATION ---------------------------------- | |
if(data[i]["event-registration"] != "") { | |
$("#back"+data[i]["url_title"]+"").append("<a href='"+data[i]["event-registration"]+"' data-icon='arrow-r' data-iconpos='right' data-theme='b' rel='external' >Register</a>"); | |
} | |
$("body").prepend("</div>"); | |
// --- EVENT IMAGE ---------------------------------- | |
if(data[i]["event-image"] != "") { | |
$("#"+data[i]["url_title"]+"").append("<img src='"+data[i]["event-image"]+"' />"); | |
} | |
// --- EVENT DATE ---------------------------------- | |
if(data[i]["event-date"] != "") { | |
$("#"+data[i]["url_title"]+"").append("<strong>DATE: "+data[i]["event-date"]+"</strong>"); | |
} | |
// --- EVENT LOCATION ---------------------------------- | |
if(data[i]["event-location"] != "") { | |
$("#"+data[i]["url_title"]+"").append("<strong>LOCATION: "+data[i]["event-location"]+"</strong>"); | |
} | |
// --- EVENT DEADLINE ---------------------------------- | |
if(data[i]["event-deadline"] != "") { | |
$("#"+data[i]["url_title"]+"").append("<strong>LOCATION: "+data[i]["event-deadline"]+"</strong>"); | |
} | |
// --- EVENT DESCRIPTION ---------------------------------- | |
if(data[i]["event-description"] != "") { | |
$("#"+data[i]["url_title"]+"").append(""+data[i]["event-description"]+""); | |
} | |
$("body").prepend("</div>"); | |
} | |
$('.loading-wrapper').empty(); | |
// Call the pics ready function | |
} | |
</script> | |
<div class="loading-wrapper"></div> | |
</div> <!-- /content --> | |
<!-- ========== NAVIGATION ========================== --> | |
<div data-role="footer" data-id="foo1" data-position="fixed" class="navigation"> | |
<div data-role="navbar"> | |
<ul> | |
<li><a href="index.html" id="home" data-iconpos="top" data-icon="custom" >Home</a></li> | |
<li><a href="where.html" data-iconpos="top" data-icon="custom" id="where" >Where</a></li> | |
<li><a href="series.html" data-iconpos="top" data-icon="custom" id="series" >Series</a></li> | |
<li><a href="events.html" class="ui-btn-active ui-state-persist" data-iconpos="top" data-icon="custom" id="events-icon" >Events</a></li> | |
<li><a href="more.html" data-iconpos="top" data-icon="custom" id="more" >More</a></li> | |
</ul> | |
</div><!-- /navbar --> | |
</div><!-- /footer --> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment