-
Notifications
You must be signed in to change notification settings - Fork 0
/
1coin.user.js
37 lines (32 loc) · 1.17 KB
/
1coin.user.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
// ==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`)
})()