Created
October 10, 2012 11:24
-
-
Save larsemil/3864915 to your computer and use it in GitHub Desktop.
ddeventz frontend
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
var theFeed = 0; | |
var pointer = -1; | |
$(document).ready(function() | |
{ | |
$.getJSON('http://events.daladevelop.se/index.php?callback=?&eventId=1', function(data) { | |
theFeed = data; | |
interval = window.setInterval("swapFeed()", 4000); | |
}); | |
}); | |
function swapFeed() | |
{ | |
if(typeof theFeed[pointer + 1] != 'undefined') | |
{ | |
pointer = pointer + 1; | |
} | |
else | |
pointer = 0; | |
$('div#content').hide("slow",function(){ | |
content = getContent(theFeed[pointer]); | |
$('div#content').html(content); | |
$('div#content').show("slow"); | |
}); | |
console.log(content); | |
} | |
function getContent(feedItem) | |
{ | |
console.log(feedItem); | |
var content = ''; | |
if(feedItem.metadata.service == 'instagram') | |
{ | |
content ='<h1>'+feedItem.content.text+'</h1>'; | |
content+='<img src="'+feedItem.content.media[0].hires_url+'"/>'; | |
} | |
else if(feedItem.metadata.service == 'twitter') | |
{ | |
content = '<img src="http://twitter.com/api/users/profile_image/'+feedItem.metadata.handle+'" class="avatar"/>'; | |
content+= feedItem.content.text; | |
console.log(feedItem.metadata.handle); | |
} | |
else if(feedItem.metadata.service == 'RSS') | |
{ | |
content = "<h1>RSS</h1>" | |
content += feedItem.content; | |
} | |
return content; | |
} |
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
<html> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> | |
<title>DDEVENT</title> | |
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js" type="text/javascript"></script> | |
<script src="ddevent.js" type="text/javascript"></script> | |
<link href="style.css" rel="stylesheet" type="text/css"> | |
</head> | |
<body> | |
<div id="wrapper"> | |
<div id="content"> | |
</div> | |
</div> | |
</body> | |
</html> |
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
body{background-color: #F6F4F2; } | |
div#wrapper{ | |
background-color: #fff; | |
padding: 30px; | |
width: 1024px; | |
margin: 100px auto; | |
height: 700px; | |
} | |
div#wrapper div#content | |
{ | |
text-align: center; | |
} | |
div#wrapper div#content h1 | |
{ | |
margin-top: 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment