portail/site/js/crapaud-fou.js

140 lines
4.9 KiB
JavaScript
Raw Normal View History

2019-08-16 21:39:08 +00:00
$(document).ready(function() {
2019-08-17 14:27:32 +00:00
// chat
2019-08-16 21:39:08 +00:00
$.getJSON("data/chat.json", function(data) {
$(".chat .total .crapauds").text(data.crapauds.total);
$(".chat .total .canaux").text(data.canaux.total);
$(".chat .total .messages").text(data.messages.total);
$(".chat .recent .crapauds").text(data.crapauds.recent);
$(".chat .recent .canaux").text(data.canaux.recent);
$(".chat .recent .messages").text(data.messages.recent);
$(".chat ul").text("");
$.each(data.canaux.liste, function(i, canal) {
var link = $("<a>")
.attr("href", "https://coa.crapaud-fou.org/channel/" + canal)
.attr("class", "list-item")
.text(canal);
var li = $("<li>").append(link);
$(".chat ul").append(li);
});
2019-08-20 15:38:55 +00:00
$.each(data.cohortes, function(i, canal) {
var links = $("<a>")
.attr("href", "https://coa.crapaud-fou.org/channel/cohorte-" + canal)
.attr("class", "badge badge-success mr-1")
.text(canal);
$(".cohortes").append(links);
});
2019-08-16 21:39:08 +00:00
});
2019-08-17 14:27:32 +00:00
// idees
$.getJSON("data/idees.json", function(data) {
$(".idees .total .crapauds").text(data.crapauds.total);
$(".idees .total .idees").text(data.idees.total);
$(".idees .total .commentaires").text(data.commentaires.total);
$(".idees .recent .crapauds").text(data.crapauds.recent);
$(".idees .recent .idees").text(data.idees.recent);
$(".idees .recent .commentaires").text(data.commentaires.recent);
$(".idees ul").text("");
$.each(data.idees.liste, function(index, idee) {
var link = $("<a>")
2019-08-27 02:52:46 +00:00
.attr("href", "https://idees.crapaud-fou.org" + index)
2019-08-17 14:27:32 +00:00
.attr("class", "list-item")
2019-08-18 06:33:08 +00:00
.attr("title", idee)
2019-08-17 14:27:32 +00:00
.text(idee);
var li = $("<li>").append(link);
$(".idees ul").append(li);
});
2019-08-16 21:39:08 +00:00
});
2019-08-17 14:27:32 +00:00
// tiki
$.getJSON("data/wiki.json", function(data) {
$(".wiki .total .crapauds").text(data.crapauds.total);
$(".wiki .total .pages").text(data.pages.total);
$(".wiki .total .photos").text(data.photos.total);
$(".wiki .recent .crapauds").text(data.crapauds.recent);
$(".wiki .recent .pages").text(data.pages.recent);
$(".wiki .recent .photos").text(data.photos.recent);
$(".wiki ul").text("");
2019-08-20 15:38:55 +00:00
$.each(data.pages.liste, function(index, page) {
var link = $("<a>")
.attr("href", "https://wiki.crapaud-fou.org/" + index)
.attr("class", "list-item")
2019-08-20 15:38:55 +00:00
.attr("title", page)
.text(page);
var li = $("<li>").append(link);
$(".wiki ul").append(li);
});
});
2019-08-26 18:56:05 +00:00
// rencontres
$.getJSON("data/rencontres.json", function(data) {
$.each(data.avenir, function(index, rencontre) {
var quand = $("<span>")
.attr("class", "date")
.text(rencontre.date);
var ou = $("<span>")
.attr("class", "lieu float-right")
.text(rencontre.lieu);
if (rencontre.wikipage === "") {
rencontre.wikipage = "tiki-view_tracker_item.php?itemId=" + rencontre.id + "&from=Agenda";
}
var titre = $("<a>")
.attr("href", "https://wiki.crapaud-fou.org/" + rencontre.wikipage)
.attr("class", "list-item")
.attr("title", rencontre.titre)
.text(rencontre.titre);
var div = $("<div>").append(quand).append(ou).append($("<br>")).append(titre);
$(".avenir ul").append(div);
});
$.each(data.passe, function(index, rencontre) {
var quand = $("<span>")
.attr("class", "date")
.text(rencontre.date);
var ou = $("<span>")
.attr("class", "lieu float-right")
.text(rencontre.lieu);
if (rencontre.wikipage === "") {
rencontre.wikipage = "tiki-view_tracker_item.php?itemId=" + rencontre.id + "&from=Agenda";
}
var titre = $("<a>")
.attr("href", "https://wiki.crapaud-fou.org/" + rencontre.wikipage)
.attr("class", "list-item")
.attr("title", rencontre.titre)
.text(rencontre.titre);
var div = $("<div>").append(quand).append(ou).append($("<br>")).append(titre);
$(".passe ul").append(div);
});
});
2019-08-20 16:05:17 +00:00
// cratube
$.getJSON("data/tube.json", function(data) {
2022-07-19 14:54:41 +00:00
$.each(data.data.slice(0, 10), function(index, video) {
2019-08-20 16:05:17 +00:00
var link = $("<a>")
2022-07-19 14:54:41 +00:00
.attr("href", "https://tube.crapaud-fou.org/w/" + video.shortUUID)
2019-08-20 16:05:17 +00:00
.attr("class", "list-item")
2022-07-19 14:54:41 +00:00
.attr("title", video.name)
.text(video.name);
2019-08-20 16:05:17 +00:00
var li = $("<li>").append(link);
$(".tube ul").append(li);
2019-08-21 01:43:43 +00:00
$(".lastvideo")
2022-07-19 14:54:41 +00:00
.attr("src", "https://tube.crapaud-fou.org/" + data.data[0].embedPath)
.attr("title", data.data[0].name);
2019-08-20 16:05:17 +00:00
});
});
2019-09-09 05:52:07 +00:00
// link coastats
$(".coastats").on("click", function() {
window.location.href = "coastats.html";
});
2019-08-30 19:07:25 +00:00
// global
$.getJSON("data/global.json", function(data) {
2019-08-30 22:09:35 +00:00
$("#lastupdate").text(data.lastupdate);
2019-08-30 19:07:25 +00:00
});
2019-08-28 15:29:12 +00:00
// hash navigation
var hash = window.location.hash.substr(1);
if ($("#help" + hash).length) {
$("#help" + hash).modal('show');
}
2019-08-16 21:39:08 +00:00
});