NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript== // @name XTM Metadata Copy // @namespace http://tampermonkey.net/ // @version 0.1 // @description try to take over the world! // @author You // @match https://*.xtm-intl.com/* // @license MIT // @icon https://www.google.com/s2/favicons?domain=xtm-intl.com // @grant GM_setClipboard // ==/UserScript== (function () { 'use strict'; var observer = new MutationObserver(function (mutations) { mutations.forEach(function (mutation) { if (mutation.addedNodes && mutation.addedNodes.length > 0) { var hasClass = [].some.call(mutation.addedNodes, function (el) { return el.classList.contains('metadata-modal') }); if (hasClass) { var metadataObject = {}; $('<button type="button" class="btn btn-xtm btn-primary ng-binding">Copy</button>').prependTo($('.metadata-modal .modal-footer')).click(function () { $('.metadata-modal .json-tree__table tbody').children().each(function (index, row) { metadataObject[$(row).children().eq(0).text().replace(': ', '')] = $(row).children().eq(1).text(); }); GM_setClipboard(JSON.stringify(metadataObject)); alert('Metadata in JSON format is copied to clipboard.'); }); } } }); }); observer.observe(document.body, { attributes: true, childList: true, characterData: true }); })();