NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript== // @name Top Reviews // @version 1.0.1 // @description Count reviews for each topic // @author you // @license NASA-1.3 // @copyright 2020, nincognito (https://openuserjs.org/users/nincognito) // @require http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js // @match *://top-modals.com/* // ==/UserScript== /* globals $ */ (function() { 'use strict'; console.log = function(){}; let currUrl = window.location.href; let urlParams = window.location.search; console.log("URL, params: %s, %s", currUrl, urlParams); if (urlParams.length == 0 || /^\?[sp]=/.test(urlParams)) { let putana_boards = $("td.brd table"); let putana_urls = putana_boards.find("a.nl").map( (_, e) => e.href).toArray(); for (var i in putana_urls) { let url = putana_urls[i].split("#")[0]; $.ajax({ url: url, async: true, cache: false, dataType: "html", timeout: 5000, pboard: $(putana_boards[i]), error: () => {console.log("ajax error")}, success: function(htmlData, status, xhr) { let reviewsCount = $(htmlData).find("#blockAdvProfile1 tbody").length; console.log("Profile (count): %s (%s)", url, reviewsCount); let textEl = this.pboard.find("div.si"); textEl.text(`(${reviewsCount}) ${textEl.text()}`); textEl.css({ "text-align": "left", "padding-top": "15px" }); }, }); } } })();