NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript== // @name koma.tv download and watch buttons // @namespace Violentmonkey Scripts // @match *://video.koma.tv/#content* // @grant none // @copyright 2019, ArmagedOFF (https://openuserjs.org/users/ArmagedOFF) // @license MIT // @version 1.0.1 // @updateURL https://openuserjs.org/meta/ArmagedOFF/koma.tv_download_and_watch_buttons.meta.js // ==/UserScript== +function() { window.addEventListener('load', addButtons); function addButtons() { var downloadLink = document.getElementById("download_link"); var downloadBotton = document.getElementsByClassName("btn_down")[0].parentNode; var href; if (downloadBotton.onclick) { href = downloadBotton.onclick.toString().split("'")[3]; } else { href = downloadBotton.parentNode.getAttribute('href'); downloadBotton.parentNode.removeAttribute('href'); } var num = href.split('/').pop(); downloadBotton.setAttribute('onclick', 'location.href = \'' + location.origin + '/getUrl/1/' + num + '/0\''); var downloadBotton1 = downloadBotton.cloneNode(true); downloadBotton1.setAttribute('onclick', 'location.href = \'' + location.origin + '/getUrl/1/' + num + '/1\''); var td = downloadBotton.closest('td'); var td1 = td.cloneNode(); td1.appendChild(downloadBotton1); td.parentNode.insertBefore(td1, td); var copyButton = downloadBotton.cloneNode(true); copyButton.removeAttribute('onclick') copyButton.onclick = copyLink; var textarea = document.createElement('textarea'); textarea.style = 'display: none;'; textarea.innerHTML = location.origin + '/getUrl/1/' + num + '/0'; copyButton.appendChild(textarea); var copyButton1 = copyButton.cloneNode(true); copyButton1.onclick = copyLink; var textarea1 = copyButton1.getElementsByTagName('textarea')[0]; textarea1.innerHTML = location.origin + '/getUrl/1/' + num + '/1'; var td2 = td.cloneNode(); td2.appendChild(copyButton); td2.getElementsByTagName('span')[0].innerHTML = 'Copy'; var td3 = td.cloneNode(); td3.appendChild(copyButton1); td3.getElementsByTagName('span')[0].innerHTML = 'Copy'; td.parentNode.appendChild(td2); td.parentNode.appendChild(td3); var buttons = td.parentNode.getElementsByClassName('btn33'); for (var i = 0; i < buttons.length; i++) { buttons[i].style.width = '100px'; } } function copyLink(event) { // debugger; var el = event.target.nextElementSibling; el.style = 'display: inline;'; el.select(); document.execCommand('copy'); el.style = 'display: none;'; } }();