Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save Protoneer/c54c3429a9698eab44ac77163cc80529 to your computer and use it in GitHub Desktop.
Save Protoneer/c54c3429a9698eab44ac77163cc80529 to your computer and use it in GitHub Desktop.
Return the Quantity Search on Aliexpress
// ==UserScript==
// @name Return the Quantity Search
// @namespace https://gist.github.com/sleemanj/95035bf2c0141ac72420
// @updateURL https://gist.github.com/sleemanj/95035bf2c0141ac72420/raw/aliexpress-qty-search-fix.js
// @downloadURL https://gist.github.com/sleemanj/95035bf2c0141ac72420/raw/aliexpress-qty-search-fix.js
// @version 0.1
// @description Put the quantity search fields back into the search interface on Aliexpress when they are not present.
// @author You
// @match http://*.aliexpress.com/*
// @grant none
// ==/UserScript==
(function(){
if(document.getElementById('filter-quantity-c')) return;
if(!document.getElementById('filter')) return;
var d = document.createElement('div');
d.innerHTML = '<div class="filter-quantity-c" data-widget-cid="widget-25" style="-webkit-user-select: text;">'
+ '<span id="filter-quantity-c" style="-webkit-user-select: text;"><span class="ui-label">Quantity:</span>'
+ ' <input class="ui-textfield ui-textfield-system" value="" autocomplete="off" id="filter-quantity-from" name="minQuantity" tabindex="22" style="-webkit-user-select: text;"> '
+ ' <span>-</span> '
+ ' <input class="ui-textfield ui-textfield-system" value="" autocomplete="off" id="filter-quantity-to" name="maxQuantity" tabindex="23">'
+ '<input type="submit" value="OK" />'
+ ' </span> '
+ '</div>';
document.getElementById('filter').appendChild(d);
if(document.location.search.match(/minQuantity=([0-9]+)/))
{
document.getElementById('filter-quantity-from').value = RegExp.$1;
}
if(document.location.search.match(/maxQuantity=([0-9]+)/))
{
document.getElementById('filter-quantity-to').value = RegExp.$1;
}
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment