Last active
June 21, 2024 10:04
-
-
Save agran/6671a63fc52b6d2eca7f1ef386d1692c to your computer and use it in GitHub Desktop.
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 ЖёлтоЗелёные анкеты | |
// @namespace Violentmonkey Scripts | |
// @match https://docs.google.com/forms/d/e/1FAIpQLScY9lMBFn9OD6UcgQDQCCrFFPR_s0eBcYYRm_D-iJ26FDzvxA/viewform* | |
// @require https://cdn.jsdelivr.net/npm/cash-dom/dist/cash.min.js | |
// @grant none | |
// @version 1.0 | |
// ==/UserScript== | |
var name1 = 'Иванов'; | |
var name2 = 'Иван'; | |
var name3 = 'Иванович'; | |
var tel = '+79180008892'; | |
var dr = '18.05.1994'; | |
var pasp = '0215 232023'; | |
var mestoPosadki = 1; // от 0 и выше, подбирайте ваше; | |
var whatsappChat; | |
function pad(num, size) { | |
num = Number(num).toString(); | |
while (num.length < size) num = "0" + num; | |
return num; | |
} | |
(function() { | |
'use strict'; | |
$( document ).ready(function() { | |
whatsappChat = prompt('Введите, пожалуйста, имя WhatsApp чата:', ''); | |
if(whatsappChat != null){ | |
setTimeout(function(){ | |
const regex = /([0-9\-]{1,5})\.([0-9]{1,2})\.([0-9]{1,4})([\w|\W]*)/gm; | |
var result = regex.exec(whatsappChat); | |
console.dir(result); | |
var day = result[1]; | |
if(day.includes('-')){ | |
day = day.split('-')[0]; | |
} | |
var month = result[2]; | |
var god = result[3]; | |
if(god.length == 2){ | |
god = '20' + god; | |
} | |
var pohodDate = god + '-' + pad(month, 2) +'-' + pad(day, 2); | |
var pohodName = result[4].replace(/[^a-zа-я0-9\s\-]/gi, '') | |
console.log(pohodName); | |
var inputs = $('input.whsOnd.zHQkBf'); | |
inputs.eq(0).val(pohodName); | |
inputs.eq(0).trigger("input"); | |
inputs.eq(1).val(pohodDate); | |
inputs.eq(1).trigger("input"); | |
inputs.eq(2).val(name1); | |
inputs.eq(2).trigger("input"); | |
inputs.eq(3).val(name2); | |
inputs.eq(3).trigger("input"); | |
inputs.eq(4).val(name3); | |
inputs.eq(4).trigger("input"); | |
inputs.eq(5).val(tel); | |
inputs.eq(5).trigger("input"); | |
inputs.eq(6).val(dr); | |
inputs.eq(6).trigger("input"); | |
inputs.eq(7).val(pasp); | |
inputs.eq(7).trigger("input"); | |
inputs.eq(8).val('Заполнено автоматически'); | |
inputs.eq(8).trigger("input"); | |
$('.Qr7Oae').eq(8).find('label').eq(mestoPosadki).trigger( "click" ); | |
$('.Qr7Oae').eq(10).find('label').eq(0).trigger( "click" ); | |
$('.Qr7Oae').eq(11).find('label').eq(0).trigger( "click" ); | |
}, 100); | |
} | |
}); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment