Skip to content

Instantly share code, notes, and snippets.

@yogasw
Last active April 27, 2021 14:49
Show Gist options
  • Save yogasw/58eb47557c683fbab01d53ce81694203 to your computer and use it in GitHub Desktop.
Save yogasw/58eb47557c683fbab01d53ce81694203 to your computer and use it in GitHub Desktop.
Endorse 5CC Erepublik
// ==UserScript==
// @name Endorse 5CC
// @namespace https://github.com/arioki1
// @version 0.1
// @description try to take over the world!
// @author Arioki
// @match https://www.erepublik.com/*/article/*
// @icon https://www.google.com/s2/favicons?domain=erepublik.com
// @grant none
// ==/UserScript==
(function() {
'use strict';
let endorseValue = 5
$j.post('/en/main/donate-article', {
_token: SERVER_DATA.csrfToken,
articleId: $j('#article_id').val(),
amount: endorseValue
}, function(response) {
if(!response.error) {
setTimeout(function() {
animateEndorseBtn(endorseValue);
appendEndorser(1,{citizen_id:erepublik.citizen.citizenId, amount:endorseValue, name: $j('.user_section .user_name').text()},'prepend');
},300);
} else {
if(response.message === "Not enough money") {
animateEndorseError(endorseValue, erepublik.i18n.articleEndorsement.not_enough_currency);
} else if(response.message === "You cannot endorse yourself") {
animateEndorseError(endorseValue, erepublik.i18n.articleEndorsement.own_article);
} else if(response.message === "Already donated") {
animateEndorseError(endorseValue, erepublik.i18n.articleEndorsement.already_endorsed);
} else if(response.message === "Article is too old") {
animateEndorseError(endorseValue, erepublik.i18n.articleEndorsement.article_too_old);
}
}
}, 'json');
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment