Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name Kolobok Alternative Decoder
- // @namespace http://tampermonkey.net/
- // @version 0.1
- // @description View Kolobok parameters on simplemarket
- // @author Nobody
- // @match https://wax.simplemarket.io/*
- // @icon https://www.google.com/s2/favicons?domain=simplemarket.io
- // @require https://ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js
- // @require https://gist.github.com/raw/2625891/waitForKeyElements.js
- // @grant GM_addStyle
- // @grant GM.getValue
- // ==/UserScript==
- //- The @grant directives are needed to restore the proper sandbox.
- waitForKeyElements ("img[src*='kolobok']", loadHandling);
- //waitForKeyElements ("img.mat-card-image.ng-lazyloaded[src*='kolobok']", loadHandling);
- //waitForKeyElements ("img.ng-lazyloaded[src*='kolobok']", loadHandling);
- function loadHandling (jNode) {
- if (jNode[0].complete) {
- handleImgTag (jNode);
- }
- else {
- jNode.on ('load', handleImgTag);
- }
- }
- function handleImgTag (jNodeOrEvent) {
- var newImg;// will be jQuery node
- if (jNodeOrEvent instanceof jQuery) {
- newImg = jNodeOrEvent;
- }
- else {
- newImg = $(jNodeOrEvent.target);
- }
- console.log ("Found new image with width ", newImg.width () );
- let hashString = newImg.attr('src').split("/").slice(-1).join("/").split(".").slice(0,-1).join(".");
- let kolobok = calc(hashString);
- let speed_text = kolobok[0] > 100 ? "<font color=red>"+kolobok[0]+"</font>" : kolobok[0];
- let stealth_text = kolobok[1] > 0.5 ? "<font color=red>"+kolobok[1]+"</font>" : kolobok[1];
- newImg.parent().parent().append("SPEED: ",speed_text," STEALTH: ",stealth_text);
- }
- function calc(url) {
- var e = url;
- console.log(e)
- const t = e.length;
- const n = e.length / 2;
- const l = [e.slice(0, 2), e.slice(t - 2, t)];
- const r = [e.slice(n - 2, n), e.slice(n, n + 2)];
- var speed = Math.abs(parseInt(l[0], 16) - parseInt(l[1], 16));
- var stealth = ((255 - Math.abs(parseInt(r[0], 16) - parseInt(r[1], 16))) / 255).toFixed(2);
- // console.log('stealth, speed =',stealth,', ',speed);
- // let genome_info = 'Genome '+ e
- // let speed_stealth = 'STEALTH: ' + stealth + ' SPEED: ' + speed
- // let message = genome_info + ' ' + speed_stealth
- return [speed, stealth]
- // return message
- }
Add Comment
Please, Sign In to add comment