Created
May 5, 2016 19:41
-
-
Save martindrapeau/761114231e357e92f926ff228eaf6e5f to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| $(document).ready(function() { | |
| getActivities('992572', gotCategory); | |
| }); | |
| function gotCategory(data) { | |
| console.log(data); | |
| var tbody = document.getElementById('tb_activity'); | |
| for (var i = 0; i < data.Activities.length; i++) { | |
| var act = data.Activities[i]; | |
| var row = tbody.insertRow(-1); | |
| var cell = row.insertCell(-1); | |
| addText(cell, act.Name); | |
| cell = row.insertCell(-1); | |
| if (act.Schedule.TimePeriod.StartDate) { | |
| var d = new Date(act.Schedule.TimePeriod.StartDate); | |
| //addText(cell, d.getFullYear() + "-" + d.get | |
| addText(cell, d.toLocaleDateString("fr")); | |
| } | |
| cell = row.insertCell(-1); | |
| addText(cell, act.Location); | |
| cell = row.insertCell(-1); | |
| addText(cell, act.Schedule.TimePeriod.NbOccurences + " séances"); | |
| cell = row.insertCell(-1); | |
| addText(cell, act.Price + ' $'); | |
| cell = row.insertCell(-1); | |
| var a = document.createElement("a"); | |
| var img = document.createElement("img"); | |
| img.src = "/images/inscription-cpm.png"; | |
| a.href = act.Url; | |
| a.target = "_new"; | |
| a.appendChild(img); | |
| cell.appendChild(a); | |
| } | |
| } | |
| function showYoutube(i, id) { | |
| var div = document.getElementById('youtube_player_' + i); | |
| if (div.innerHTML != "") { div.innerHTML = ""; return; } | |
| $.getJSON('http://noembed.com/embed?url=http://www.youtube.com/watch?v=' + id, function(data, status, xhr) { | |
| if (data.error) { return; } | |
| div.innerHTML = data.html; | |
| // console.log(data); | |
| }); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment