NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript==
// @name GB counter
// @namespace http://tampermonkey.net/
// @version 0.1
// @description count needed votes and calc reached percentage
// @author O B
// @grant none
// @match https://gb.kyivcity.gov.ua/projects/*/*
// @match https://gb.kyivcity.gov.ua/projects/archive/*/show/*
// @license MIT
// ==/UserScript==
(function() {
'use strict';
$(document).ready(()=> {
$(".votes-count").css('line-height', '2rem');
const votesEl= $(".votes-count > strong");
const currVotes = parseInt(votesEl.text().split(' ').join(''));
const budget = parseInt($(".amount > strong").text().replace(' грн', '').split(' ').join(''))
const multiplier = budget >= 1000000 ? 1.3 : 2.5;
const neededVotes = budget*multiplier/1000;
const donePercentage = currVotes / neededVotes * 100;
votesEl.text(currVotes+ ' / ' + Math.round(neededVotes) + '\n('+Math.round(donePercentage)+'%)');
});
// Your code here...
})();