Force badges to be green and not blue

WTF shields.io? Why did the default change?
This commit is contained in:
Robert Miles 2018-12-21 15:40:03 -05:00
parent 651a4e733d
commit 5bca40e11d
1 changed files with 2 additions and 2 deletions

View File

@ -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";