AliExpress Review Fix

fixes the 'review' button function and if a product has reviews, they will automatically be displayed on page load

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name         AliExpress Review Fix
// @namespace    https://greasyfork.org/en/users/10118-drhouse
// @version      1.1
// @description  fixes the 'review' button function and if a product has reviews, they will automatically be displayed on page load
// @match        https://www.aliexpress.com/*
// @require      https://code.jquery.com/jquery-3.7.0.min.js
// @grant        GM_info
// @author       drhouse
// @license      CC-BY-NC-SA-4.0
// @icon         https://www.google.com/s2/favicons?sz=64&domain=aliexpress.com
// ==/UserScript==
/* global jQuery, $ */
this.$ = this.jQuery = jQuery.noConflict(true);
(function($){
    
    var numReviews = $("#root > div.pdp-wrap.pdp-body > div.pdp-body-left > div.pdp-info > div.pdp-info-right > div > a").text()
    numReviews = parseInt(numReviews.match(/\d+/)[0]);

    if (numReviews > 0){
            $('html, body').animate({scrollTop:$(document).height()}, 'fast');
            setTimeout(function(){
                $("#nav-review > div.ae-evaluation-list > div.ae-evaluation-view-more > button")[0].click()
                $('html, body').animate({scrollTop:0}, 'fast');
            }, 1000);
    }

    var review = $("#root > div.pdp-wrap.pdp-body > div.pdp-body-left > div.pdp-info > div.pdp-info-right > div.product-reviewer > a")

    $(review).click(function(event){
        event.preventDefault();
        $("#nav-review > div.ae-evaluation-list > div.ae-evaluation-view-more > button").click()
    });

})(jQuery);