Test JSON feed viewer
by elektrorl
HTML
<html>
<head>
<meta charset="utf-8">
<title></title>
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.css" />
<script src="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.js"></script>
<script>
var TITLE = "Saison";
var RSS = "http://www.letheatredelorient.fr/saison/data.jsonp?callback=";
//Stores entries
var entries = [];
var selectedEntry = "";
//listen for detail links
$(".contentLink").live("click", function () {
selectedEntry = $(this).data("entryid");
});
function renderEntries(entries) {
var s = '';
$.each(entries, function (i, item) {
s += '<li data-theme="c"><a href="#contentPage" class="contentLink" data-entryid="' + i + '"><img src="' + item.image + '"/><h3 class="ui-li-heading">' + item.title + '</h3></a></li>';
});
$("#linksList").html(s);
$("#linksList").listview("refresh");
$.mobile.loading('hide');
$('body').removeClass('ui-loading');
}
//Listen for main page
$("#mainPage").live("pageinit", function () {
//Set the title
$("h1", this).text(TITLE);
$('body').addClass('ui-loading');
$.mobile.loading('show', {
text: 'Patientez …',
textVisible: true,
theme: 'd'
});
$.getJSON(RSS, function (data) {
entries = [];
$.each(data.Items, function (i, sps) {
$.each(sps.node.representation, function (key, value) {
console.log(value);
});
entry = {
representation1: sps.node.representation["1"],
representation2: sps.node.representation["2"],
representation3: sps.node.representation["3"],
title: sps.node.titre,
image: sps.node.image,
acteurs: sps.node.acteurs,
acteursuite: sps.node.acteurs_suite,
lien: sps.node.lien,
description: sps.node.corps,
pics:...
CSS
.generique { font-size: .75em;
margin-top: 1em;
padding-top: 1em;
border-top-style: solid;
border-top-width: 1px;
font-style: italic;
padding-bottom: 1em;
text-align: justify;}
.link a{
color: #E54314;}
.suite{
font-size: .75em;
margin-bottom: 1em;
text-align: justify;}
.corpsTexte{
text-align: justify;
}