Created
August 19, 2019 01:43
-
-
Save WinterSilence/9a11108e26afe74cce637aa8bb0f6b22 to your computer and use it in GitHub Desktop.
Greasemonkey/Tampermonkey script: multi add coupons to litres.ru
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name litresCoupons | |
// @namespace litres.ru | |
// @version 0.1 | |
// @description Add coupons | |
// @author [email protected] | |
// @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