fanex

Kolobok Finder

May 18th, 2021 (edited)
1,093
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // ==UserScript==
  2. // @name         Kolobok Alternative Decoder
  3. // @namespace    http://tampermonkey.net/
  4. // @version      0.1
  5. // @description  View Kolobok parameters on simplemarket
  6. // @author       Nobody
  7. // @match        https://wax.simplemarket.io/*
  8. // @icon         https://www.google.com/s2/favicons?domain=simplemarket.io
  9. // @require  https://ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js
  10. // @require  https://gist.github.com/raw/2625891/waitForKeyElements.js
  11. // @grant    GM_addStyle
  12. // @grant    GM.getValue
  13. // ==/UserScript==
  14. //- The @grant directives are needed to restore the proper sandbox.
  15.  
  16. waitForKeyElements ("img[src*='kolobok']", loadHandling);
  17. //waitForKeyElements ("img.mat-card-image.ng-lazyloaded[src*='kolobok']", loadHandling);
  18. //waitForKeyElements ("img.ng-lazyloaded[src*='kolobok']", loadHandling);
  19.  
  20. function loadHandling (jNode) {
  21.     if (jNode[0].complete) {
  22.         handleImgTag (jNode);
  23.     }
  24.     else {
  25.         jNode.on ('load', handleImgTag);
  26.     }
  27. }
  28. function handleImgTag (jNodeOrEvent) {
  29.     var newImg;//  will be jQuery node
  30.     if (jNodeOrEvent instanceof jQuery) {
  31.         newImg = jNodeOrEvent;
  32.     }
  33.     else {
  34.         newImg = $(jNodeOrEvent.target);
  35.     }
  36.     console.log ("Found new image with width ", newImg.width () );
  37.     let hashString = newImg.attr('src').split("/").slice(-1).join("/").split(".").slice(0,-1).join(".");
  38.     let kolobok = calc(hashString);
  39.     let speed_text = kolobok[0] > 100 ? "<font color=red>"+kolobok[0]+"</font>" : kolobok[0];
  40.     let stealth_text = kolobok[1] > 0.5 ? "<font color=red>"+kolobok[1]+"</font>" : kolobok[1];
  41.     newImg.parent().parent().append("SPEED: ",speed_text," STEALTH: ",stealth_text);
  42.  
  43. }
  44.  
  45. function calc(url) {
  46.     var e = url;
  47.     console.log(e)
  48.     const t = e.length;
  49.     const n = e.length / 2;
  50.     const l = [e.slice(0, 2), e.slice(t - 2, t)];
  51.     const r = [e.slice(n - 2, n), e.slice(n, n + 2)];
  52.  
  53.     var speed = Math.abs(parseInt(l[0], 16) - parseInt(l[1], 16));
  54.     var stealth = ((255 - Math.abs(parseInt(r[0], 16) - parseInt(r[1], 16))) / 255).toFixed(2);
  55.  
  56. //    console.log('stealth, speed =',stealth,', ',speed);
  57. //    let genome_info = 'Genome '+ e
  58. //    let speed_stealth = 'STEALTH: ' + stealth + ' SPEED: ' + speed
  59. //    let message = genome_info + ' ' + speed_stealth
  60.     return [speed, stealth]
  61. //    return message
  62. }
  63.  
Add Comment
Please, Sign In to add comment