NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript== // @name ROBLOX - Sales Count // @version 1.1.0 // @description Puts sales count back on items. // @author ClockworkSquirrel // @match https://*.roblox.com/library/*/* // @match https://*.roblox.com/catalog/*/* // @connect api.roblox.com // @require https://code.jquery.com/jquery-3.1.1.min.js // @require https://pastebin.com/raw/nEq3ZVCM // @icon http://svgshare.com/i/a9.svg // @run-at document-start // @grant GM_xmlhttpRequest // ==/UserScript== (function() { 'use strict'; function create(Element){return $(document.createElement(Element));} var urlParams = location.pathname.split("/"); var locale = navigator.languages[1] || navigator.languages[0]; var localeDateOptions = {hour12: false, year: "numeric", month: "short", day: "2-digit", hour: "2-digit", minute: "2-digit"}; var displayScriptRunning = false; function displaySalesCount(){ if (displayScriptRunning) return; displayScriptRunning = true; var assetId = urlParams[2], pageType = urlParams[1]; GM_xmlhttpRequest({ method: "GET", url: "https://api.roblox.com/marketplace/productinfo?assetId="+assetId, onload: function(response){ if (response.status === 200){ var parentDiv = $("div#item-details"); var updatedDiv = parentDiv.children().find(":contains('Updated')").eq(0).parent(); var data = JSON.parse(response.responseText); var salesCount = data.Sales.toLocaleString(locale); var updatedDate = new Date(data.Updated).toLocaleDateString(locale, localeDateOptions); updatedDiv.find(".field-content").text(updatedDate); var saleDiv = create("div").addClass("clearfix").addClass("item-field-container"); var saleLabel = create("div").addClass("text-label").addClass("field-label").text("Sales").appendTo(saleDiv); var saleText = create("div").addClass("field-content").text(salesCount).appendTo(saleDiv); saleDiv.insertBefore(updatedDiv); var createdDate = new Date(data.Created).toLocaleDateString(locale, localeDateOptions); var createdDiv = create("div").addClass("clearfix").addClass("item-field-container"); var createdLabel = create("div").addClass("text-label").addClass("field-label").text("Created").appendTo(createdDiv); var createdText = create("div").addClass("field-content").text(createdDate).appendTo(createdDiv); createdDiv.insertBefore(updatedDiv); } } }); } $("div#item-details").waitUntilExists(displaySalesCount); $(document).ready(displaySalesCount); })();