Trambambaj

Kasowanie flot, obiektów, reskaler Autoupdate

Feb 19th, 2022 (edited)
601
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // ==UserScript==
  2. // @name        Kasowanie flot, obiektów, reskaler
  3. // @require     http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js
  4. // @version     2.1
  5. // @include     *hegira.com.pl/*
  6. // @author      Thing
  7. // @updateURL   https://pastebin.com/43pZHcbA
  8. // @downloadURL https://pastebin.com/43pZHcbA
  9. // @copyright   free
  10. // ==/UserScript==
  11. ("use strict");
  12.  
  13.   //funkcja kasujaca
  14.   const kasownik = function (a) {
  15.     $(`img[${a}]`).parent().remove();
  16.   };
  17.   //html guzików
  18.   $('button[name="show_g"]')
  19.     ?.parent()
  20.     ?.after(
  21.       `<td><button type ="button" id ="kas_fl" title ="Kasuj ikony flot z podglądu.">KF</button></td>><td><button type ="button" id ="kas_orb_strz" title ="Kasuj ikony budynków orbitalnych i strzałki.">KOS</button></td><td><button type="button" id ="scale" title ="Reskaluj duże obiekty kosmiczne. ${
  22.        localStorage.AUTOScale === "1" ? "WŁĄCZONE" : "WYŁĄCZONE"
  23.      }" style = "color:${
  24.        localStorage.AUTOScale === "1" ? "red" : "green"
  25.      }">SK</button></td>`
  26.     );
  27.   //kasownik floty
  28.   $("button#kas_fl").click(function () {
  29.     kasownik('name*="przyciskja2"');
  30.   });
  31.   //kasownik obikety
  32.   $("button#kas_orb_strz").click(function () {
  33.     kasownik('title*="rbitaln"');
  34.     kasownik('title*="osmiczny"');
  35.     kasownik('title*="UL Zebren"');
  36.     kasownik('src ="img/bud/orbitalna_plat_ob_80px.png"');
  37.     $('img[title*="obiekt jest"]').remove();
  38.   });
  39.   //reskaler
  40.   $("button#scale").click(function () {
  41.     if (localStorage.AUTOScale === "0" || !localStorage.AUTOScale) {
  42.       this.style.color = "red";
  43.       this.title = this.title.replace("WYŁĄCZONE", "WŁĄCZONE");
  44.       localStorage.AUTOScale = 1;
  45.       skaler();
  46.     } else {
  47.       this.style.color = "green";
  48.       this.title = this.title.replace("WŁĄCZONE", "WYŁĄCZONE");
  49.       localStorage.AUTOScale = 0;
  50.       location.reload();
  51.     }
  52.   });
  53.   //funkcja reskalująca
  54.   const skaler = function () {
  55.     if (localStorage.AUTOScale === "1") {
  56.       $('img[src*="img/ico_p/NowySol"]')
  57.         .parent()
  58.         .parent()
  59.         .each(function () {
  60.           this.style.transformOrigin = "top left";
  61.           if (
  62.             $(this)
  63.               .find('img[src*="img/ico_p/NowySol"]')[0]
  64.               .title.includes("Gwiazda")
  65.           ) {
  66.             console.log($(this).find('img[src*="img/ico_p/NowySol"]')[0].src);
  67.             const img = new Image();
  68.             img.src = $(this).find('img[src*="img/ico_p/NowySol"]')[0].src;
  69.             const sizeX = img.width;
  70.             const sizeY = img.height;
  71.             this.style.transform = `scale(${75 / sizeX} , ${75 / sizeY})`;
  72.             $(this).children('div[id*="Menujaa"]')[0].style.transformOrigin =
  73.               "top left";
  74.             $(this).children(
  75.               'div[id*="Menujaa"]'
  76.             )[0].style.transform = `Scale(${sizeX / 75},${sizeY / 75})`;
  77.           } else {
  78.             this.style.transform = "scale(0.2 , 0.2)";
  79.             $(this).children('div[id*="Menujaa"]')[0].style.transformOrigin =
  80.               "top left";
  81.             $(this).children('div[id*="Menujaa"]')[0].style.transform =
  82.               "Scale(5,5)";
  83.           }
  84.         });
  85.     }
  86.   };
  87.   skaler();
Add Comment
Please, Sign In to add comment