Skip to content

Instantly share code, notes, and snippets.

@WinterSilence
Created August 19, 2019 01:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save WinterSilence/9a11108e26afe74cce637aa8bb0f6b22 to your computer and use it in GitHub Desktop.
Save WinterSilence/9a11108e26afe74cce637aa8bb0f6b22 to your computer and use it in GitHub Desktop.
Greasemonkey/Tampermonkey script: multi add coupons to litres.ru
// ==UserScript==
// @name litresCoupons
// @namespace litres.ru
// @version 0.1
// @description Add coupons
// @author info@ensostudio.ru
// @include https://www.litres.ru/pages/put_money_on_account/*
// @include https://litres.ru/pages/put_money_on_account/*
// @require https://code.jquery.com/jquery-3.4.1.min.js
// @grant unsafeWindow
// @run-at document-body
// ==/UserScript==
$(function() {
$('#code1').remove();
$('#putmoney .code').append('<textarea name="code1" id="code1" rows="3" placeholder="Коды по одному в строку"></textarea>');
$('#master_page_div form').on('submit', function (event) {
event.preventDefault();
let $form = $(this),
$code = $('#code1');
$.each($code.val().split(/\n/), function (index, code) {
console.log(code, $form.attr('action'), $form.serialize());
$.post($form.attr('action'), $form.serialize());
$code.val('');
});
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment