Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name przełączanie aktywnej floty w przód lub tył
- // @version 2.0
- // @include *hegira.com.pl/*
- // @copyright free
- // ==/UserScript==
- "use strict";
- const listaFlot = document.getElementsByName("change_flagship");
- const ile = listaFlot.length;
- const listaId = [];
- for (let i = 0; i < ile; i++) {
- listaId.push(listaFlot[i].value);
- }
- const html = "[style*='text-shadow: 1px 1px 6px #13AFC8;background:#728992;']"
- const aktywId = $(
- `${html}`
- )[0].attributes[0].ownerElement.childNodes[0].firstChild[0].value;
- const nrAkt = listaId.indexOf(aktywId);
- const pUpId = nrAkt === 0 ? false : listaId[nrAkt - 1];
- const pDownId = nrAkt === ile - 1 ? false : listaId[nrAkt + 1];
- if (pUpId) {
- $('h3:contains("Flota:")').append(
- '<button type= "button" title = "Przełącz aktywną flotę w górę" id = "gora"><--</button>'
- );
- }
- if (pDownId) {
- $('h3:contains("Flota:")').append(
- '<button type= "button" title = "Przełącz aktywną flotę w dół" id = "dol">--></button>'
- );
- }
- $("button#gora").click(function () {
- $(`${html}`)
- .prev()
- .children("td")
- .children("form")[0]
- .submit();
- });
- $("button#dol").click(function () {
- $(`${html}`)
- .next()
- .children("td")
- .children("form")[0]
- .submit();
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement