您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Conceal 'out of stock' items from Amazon search results
- // ==UserScript==
- // @name Amazon in-stock only
- // @namespace http://tampermonkey.net/
- // @version 0.1
- // @description Conceal 'out of stock' items from Amazon search results
- // @author Matt Miller
- // @match http*://www.amazon.com/*
- // @grant none
- // @require http://code.jquery.com/jquery-latest.min.js
- // ==/UserScript==
- (function() {
- 'use strict';
- var $ = window.jQuery;
- var phantomKiller = function() {
- var items = $('div.a-row.a-size-base.a-color-secondary:contains("Out of Stock")');
- var hiddenItems = 0;
- items.each(function(index, element){
- var itemContainer = $(this).parent().parent().parent().parent().parent().parent();
- if ( $(itemContainer).is( ":visible" ) ) {
- itemContainer.hide();
- hiddenItems = hiddenItems + 1;
- //console.log("out of stock item concealed");
- }
- });
- if (hiddenItems > 0) {
- console.log("" + hiddenItems + " out of stock items concealed");
- }
- setTimeout(phantomKiller, 1000);
- };
- setTimeout(phantomKiller, 100);
- })();