Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save libraplanet/0f39b999820d0db7ff2e7e0f861b452b to your computer and use it in GitHub Desktop.
Save libraplanet/0f39b999820d0db7ff2e7e0f861b452b to your computer and use it in GitHub Desktop.
!set default for amazon deliver to device.
Amazon Kindle Fire (デバイス) などを買うと、
Amazon Kindle (電子書籍) などのデフォルトの配信先が
Amazon Kindle Fire (デバイス) になってしまう。
変更することが出来ず、無視して購入していると
Amazon Fire (デバイス) がいっぱいになっていまい、
fxxxxxxxxxxxxk!!!
という状態になる。
送信先を任意のデバイスに自動で変更し、
Amazon Kindle Fire (デバイス)に
うっかり行ってしまうことを防ぎます。
デバイスIDはHTMLのoptionのから確認してください。
document.querySelectorAll('select#deliverTo option');
※なお、ついでに、他の選択肢も削除しているけど、特に意味はなし。
// ==UserScript==
// @name amazon deliver to device
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match https://www.amazon.co.jp/*
// @grant none
// ==/UserScript==
(function() {
'use strict';
var elmList;
var deviceId = 'XXXXXXXXXXXXXX';
document.querySelectorAll('select#deliverTo').forEach(function(e) {
e.value = deviceId;
});
document.querySelectorAll('span.a-dropdown-prompt').forEach(function(span) {
document.querySelectorAll('select#deliverTo option[data-a-id="' + deviceId + '"]').forEach(function(option) {
span.textContent = option.textContent;
return;
});
return;
});
document.querySelectorAll('select#deliverTo option:not([data-a-id="' + deviceId + '"])').forEach(function(e){
e.parentNode.removeChild(e);
});
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment