Skip to content

Instantly share code, notes, and snippets.

@ten9miq
Last active November 15, 2023 03:57
Show Gist options
  • Save ten9miq/9ed4287f1f10231abaa8633de5adc790 to your computer and use it in GitHub Desktop.
Save ten9miq/9ed4287f1f10231abaa8633de5adc790 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/ten9miq/9ed4287f1f10231abaa8633de5adc790/raw/amazon_page_add_keepa.user.js
// @downloadURL https://gist.github.com/ten9miq/9ed4287f1f10231abaa8633de5adc790/raw/amazon_page_add_keepa.user.js
// @author ten9miq
// @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