Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name Dzielniki
- // @version 2.1
- // @include *hegira.com.pl/*
- // @author Thing
- // @updateURL https://pastebin.com/raw/fpPaaiW9
- // @downloadURL https://pastebin.com/raw/fpPaaiW9
- // @copyright free
- // ==/UserScript==
- "use strict";
- const dzielnikiKotwica = function (formName) {
- const form =
- formName === "move_station"
- ? $('input[name="station_move_to_ob"]').parent()
- : $(`form[name=${formName}]`);
- form.before(
- '<p>Rozdzielanie współrzędnych</p><input type="text" value size="12" /><button type="button" class="dzielnik" title="Rozdziel współrzędne." >RW</button>'
- );
- };
- const formList = [
- "odpal_sonde",
- "kurs_floty",
- "organizer_add",
- "move_station",
- ];
- $("button.dzielnik").click(function () {
- const kordy = $(this)
- .prev()
- .val()
- .replace(/-\d\D|.*w1|w[23]|speed.*|[^-\d]/g, ",")
- .replace(/^[,]*/g, "")
- .replace(/,+/g, "w")
- .split("w");
- const output = $(this).next().find('input[type="text"]');
- for (let i = 0; i < 3; i++) {
- output[i].value = kordy[i];
- }
- });
Add Comment
Please, Sign In to add comment