// ==UserScript== // @name Mercari To Zenmarket // @namespace http://artemisdev.moe/ // @version 1.2 // @description Add button to quickly open zenmarket page from mercari // @author Artemis // @match https://jp.mercari.com/item/* // @icon https://www.google.com/s2/favicons?sz=64&domain=mercari.com // @grant none // @run-at document-idle // @license MIT // @downloadURL none // ==/UserScript== (function() { 'use strict'; function onClick (e) { var path = window.location.pathname; var id = path.substring(path.lastIndexOf('/') + 1); window.open("https://zenmarket.jp/en/mercariproduct.aspx?itemCode=" + id); } window.addEventListener ("load", function() { var button = document.createElement ('div'); button.setAttribute("class", "merNavigationTopMenuItem default__1c6d4605"); button.innerHTML = '
'; button.addEventListener("click", onClick, false); var parent = document.getElementsByClassName("merNavigationTop")[0].children[0].children[3]; var sibling = parent.children[0]; parent.insertBefore(button, sibling); }); })();