Aliexpress sort by price

Sort by price by one click

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         Aliexpress sort by price
// @namespace    https://greasyfork.org/scripts/29524-aliexpress-sort-by-price
// @version      0.0.5
// @description  Sort by price by one click
// @author       Mateusz Kula
// @match        *.aliexpress.com/*
// @run-at context-menu
// @homepageURL     https://kulam.pl
// @supportURL      https://kulam.pl/kontakt
// @icon            https://i.imgur.com/R5IP5KN.png
// ==/UserScript==

var targethost = "aliexpress.com"; //mozesz zmienic na "pl.aliexpress.com"
var freeshipping= "no";  //wyszukiwanie z darmowa wysylka, wartosci "yes" lub "no"
var pa=window.location.pathname;
var number=0;
if(pa.slice(0,7)=="/store/")
number=pageConfig.storeId;
    if(!(number>1))
    {number=pa.slice(7);}

if(pa.slice(0,6)=="/item/")
number=hid_storeId.value;

     var locationPathname = location.pathname.split('/');
if(number>1)
{
if(freeshipping=="yes")
    window.location.href= window.location.protocol+'//'+targethost+"/store/"+number+'/search?SortType=price_asc&isFreeShip=y&'+window.location.search+window.location.hash;
else
    window.location.href= window.location.protocol+'//'+targethost+"/store/"+number+'/search?SortType=price_asc&'+window.location.search+window.location.hash;
}
else
    alert("Wrong page.");