forked from tildeverse/tilde.chat
Force badges to be green and not blue
WTF shields.io? Why did the default change?
This commit is contained in:
parent
651a4e733d
commit
5bca40e11d
@ -1,14 +1,14 @@
|
||||
<?php
|
||||
function get_badge($channel_name=FALSE) {
|
||||
if ($channel_name==FALSE) {
|
||||
return "https://img.shields.io/badge/dynamic/json.svg?url=https://tilde.chat/stats.json&label=~chat&query=$.usercount&suffix=%20online&link=https:%2F%2Ftilde.chat&link=https:%2F%2Fweb.tilde.chat";
|
||||
return "https://img.shields.io/badge/dynamic/json.svg?url=https://tilde.chat/stats.json&label=~chat&query=$.usercount&suffix=%20online&link=https:%2F%2Ftilde.chat&link=https:%2F%2Fweb.tilde.chat&colorB=%2300cc00";
|
||||
}
|
||||
$name_url = urlencode($channel_name);
|
||||
$name_link = urlencode(substr($channel_name,1));
|
||||
$stats = json_decode(file_get_contents("https://tilde.chat/stats.json")) ?? array("channels"=>[]);
|
||||
foreach ($stats->channels as $key=>$channel) {
|
||||
if ($channel->name==$channel_name) {
|
||||
return "https://img.shields.io/badge/dynamic/json.svg?url=https://tilde.chat/stats.json&label=~chat&query=$.channels[$key].usercount&suffix=%20online%20on%20{$name_url}&link=https:%2F%2Ftilde.chat&link=https:%2F%2Fweb.tilde.chat%2F%3Fjoin%3D{$name_link}";
|
||||
return "https://img.shields.io/badge/dynamic/json.svg?url=https://tilde.chat/stats.json&label=~chat&query=$.channels[$key].usercount&suffix=%20online%20on%20{$name_url}&link=https:%2F%2Ftilde.chat&link=https:%2F%2Fweb.tilde.chat%2F%3Fjoin%3D{$name_link}&colorB=%2300cc00";
|
||||
}
|
||||
}
|
||||
return "https://img.shields.io/badge/~chat-invalid%20channel-red.svg";
|
||||
|
Loading…
Reference in New Issue
Block a user