NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript== // @name BG market enhancements // @namespace http://tampermonkey.net/ // @version 0.1 // @description try to take over the world! // @author alrick // @copyright 2019, alrick (https://openuserjs.org/users/alrick) // @license MIT // @match https://businessgame.be/market // @grant none // @require https://cdn.jsdelivr.net/npm/tooltipster@4.2.7/dist/js/tooltipster.bundle.min.js // ==/UserScript== (function($) { 'use strict'; $('.marketSet').css('padding-bottom',0).css('margin-bottom',0); $('head').append( $('<link rel="stylesheet" type="text/css" />').attr('href', 'https://cdn.jsdelivr.net/npm/tooltipster@4.2.7/src/css/tooltipster.css') ); function preload(arrayOfImages) { $(arrayOfImages).each(function(){ $('<img/>')[0].src = this; // Alternatively you could use: // (new Image()).src = this; }); } $(document).ready(function() { $("a[href^='/product']").tooltipster({ animation: 'fade', delay: 200, theme: 'tooltipster-punk', trigger: 'hover', contentAsHTML: true, side: 'top', functionInit: function(instance, helper) { var date = new Date(); date.setMinutes(0); date.setHours(date.getHours()); var timestamp = Math.floor(date.getTime()/1000).toString().replace(/\d\d$/,'00'); var graph = "https://businessgame.be/renderer/graphs/history/price/"+$(helper.origin).attr('href').substr(9)+"/"+timestamp+".png"; preload([graph]); var content = "<div style='border:1px solid black'><img width='850' height='250' src='"+graph+"' /></div>"; instance.content(content); } }); }); })(jQuery);