Skip to content

Instantly share code, notes, and snippets.

@munen
Last active October 21, 2018 18:48
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save munen/b8a8549a2b3a4648b46b6b59f26deaca to your computer and use it in GitHub Desktop.
Greasemonkey script which finds the articles which actually can be shipped to your country
// ==UserScript==
// @name Check Amazon for ability to ship to CH
// @version 1
// @grant none
// @include https://www.amazon.de/*
// @require https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js
// ==/UserScript==
// BEGIN: Logic Article Page
// Check if article cannot be sent to CH and if so, close the tab
// This is where "Dieser Artikel kann nicht in die Schweiz geliefert
// werden." will be written
var notAvailable = $("#ddmDeliveryMessage .a-color-error").length != 0
if(notAvailable) {
window.close()
}
// END: Logic Article Page
// BEGIN: Logic Index/Search Page
// When on a search index page, ask if all results should be opened
// in a tab and checked for ability to ship to CH
if($(".s-result-list").length != 0) {
if(confirm("Open all links in tabs and check for CH shippability?")) {
$(".s-result-item a.s-access-detail-page").each(function(index, link) {
window.open($(link).attr("href"), '_blank');
})
}
}
// END: Logic Index/Search Page
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment