Skip to content

Instantly share code, notes, and snippets.

@arbal
Forked from ten9miq/amazon_page_add_keepa.user.js
Created December 22, 2020 08:37
Show Gist options
  • Save arbal/0ea5728d84d16f3426d0d03dd19cb67c to your computer and use it in GitHub Desktop.
Save arbal/0ea5728d84d16f3426d0d03dd19cb67c to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name amazon page add keepa
// @version 0.1
// @description sakura checker frame to amazon page add.
// @updateURL https://gist.github.com/53JIlLenWe11/9ed4287f1f10231abaa8633de5adc790/raw/amazon_page_add_keepa.user.js
// @downloadURL https://gist.github.com/53JIlLenWe11/9ed4287f1f10231abaa8633de5adc790/raw/amazon_page_add_keepa.user.js
// @author 53JIlLenWe11
// @include /^https://(www\.|smile\.)amazon\.co\.jp/(.*/)?[d-g]p//
// @run-at document-end
// @grant none
// ==/UserScript==
(function() {
'use strict';
function getAmazonPath() {
const matches = /((?:.*)amazon.(?:[.\w]+))\/(?:.*)?([a-z]p)\/(?:product\/)?([^\/\?&]+)(?:.*|$)/.exec(document.URL);
if (matches === null) {
return null;
}
return matches[3];
}
const div = document.createElement('div');
div.style="min-width: 935px; max-width: 971px; display: flex; height: 417px; border: 0px none; margin: 10px 0px 0px;";
div.id="keepaContainer";
const frame = document.createElement('iframe');
const amazon_path = getAmazonPath();
frame.src=`https://keepa.com/iframe_addon.html#5-0-${amazon_path}`;
frame.id='keepa';
frame.scrolling='no';
frame.style="width: 100%; height: 100%; border:0 none;overflow: hidden;";
div.appendChild(frame);
document.querySelector('#bottomRow').appendChild(div);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment