Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name Amazon Video ASIN Display
- // @namespace nyuszika7h@gmail.com
- // @version 0.2.1
- // @description Show ASINs for episodes and movies/seasons on Amazon Prime Video
- // @author nyuszika7h
- // @match https://www.amazon.com/*
- // @match https://www.amazon.co.uk/*
- // @match https://www.amazon.de/*
- // @match https://www.amazon.co.jp/*
- // @match https://www.primevideo.com/*
- // @grant none
- // ==/UserScript==
- (function() {
- 'use strict';
- let style = document.createElement('style');
- let styleText = document.createTextNode(`
- .x-episode-asin {
- margin: 0.5em 0;
- color: #ff0000;
- }
- .x-page-asin {
- margin: 0.5em 0 1em 0;
- color: #ff0000;
- }`);
- style.appendChild(styleText);
- document.head.appendChild(style);
- // Amazon old style
- document.querySelectorAll('.dv-episode-container').forEach(el => {
- let asins = el.dataset.aliases.replace(/,/g, ' / ');
- let asinEl = document.createElement('div');
- let text = document.createTextNode(asins);
- asinEl.className = 'x-episode-asin';
- asinEl.appendChild(text);
- let parent = el.querySelector('.dv-el-title-data');
- let before = parent.querySelector('.dv-el-synopsis-wrapper');
- parent.insertBefore(asinEl, before);
- });
- // Amazon new style + PrimeVideo
- document.querySelectorAll('.js-node-episode-container > input, .avu-context-card > input').forEach(el => {
- let asin = el.id.replace(/^(?:selector|av-episode-expand-toggle)-/, '');
- let asinEl = document.createElement('div');
- let text = document.createTextNode(asin);
- asinEl.className = 'x-episode-asin';
- asinEl.appendChild(text);
- el.parentNode.querySelector('.js-eplist-episode, .av-episode-playback, .js-ep-playback-wrapper').appendChild(asinEl);
- });
- // Amazon new style + PrimeVideo movies
- let el = document.querySelector('[data-page-title-id]');
- if (el) {
- let asin = el.dataset.pageTitleId;
- let asinEl = document.createElement('div');
- let text = document.createTextNode(asin);
- asinEl.className = 'x-page-asin';
- asinEl.appendChild(text);
- let after = document.querySelector('.dv-dp-node-synopsis, .av-synopsis');
- after.parentNode.insertBefore(asinEl, after.nextSibling);
- }
- }());
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement