AskfmForHumans/1coin

Restore 1 click = 1 coin (not 5 coins) behavior on ASKfm

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey, το Greasemonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

You will need to install an extension such as Tampermonkey to install this script.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Userscripts για να εγκαταστήσετε αυτόν τον κώδικα.

You will need to install an extension such as Tampermonkey to install this script.

Θα χρειαστεί να εγκαταστήσετε μια επέκταση διαχείρισης κώδικα χρήστη για να εγκαταστήσετε αυτόν τον κώδικα.

(Έχω ήδη έναν διαχειριστή κώδικα χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Έχω ήδη έναν διαχειριστή στυλ χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

// ==UserScript==
// @name         AskfmForHumans/1coin
// @name:ru      AskfmForHumans/1coin
// @version      1.1.1
// @namespace    https://github.com/AskfmForHumans
// @author       https://github.com/AskfmForHumans
// @homepage     https://afh.snowwm.ml/userjs/1coin
// @license      MIT
//
// @description    Restore 1 click = 1 coin (not 5 coins) behavior on ASKfm
// @description:ru Возвращает отправку 1 монеты (а не 5) при клике по "огоньку"
//
// @grant        none
// @match        https://ask.fm/*
// @run-at       document-end
// @noframes
// ==/UserScript==

(function() {
    'use strict'

    const logPrefix = 'AskfmForHumans/1coin:'
    const oldPost = window.Ajax.post.bind(window.Ajax)

    window.Ajax.post = (elems, req) => {
        if (elems[0] && elems[0].className == 'fire-coin') {
            const oldAmount = req.data.amount
            const newAmount = Math.floor(oldAmount / 5)
            console.info(`${logPrefix} sending ${newAmount} instead of ${oldAmount} coins`)
            req.data.amount = newAmount
        }

        return oldPost(elems, req)
    }

    console.info(`${logPrefix} finished initialization`)
})()