NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript== // @name Chaturbate Add Hyperlink // @description Adds a chaturbate:// Hyperlink to CAMS // @version 0.1 // @namespace taratuna // @include https://chaturbate.com/* // @include https://*.chaturbate.com/* // @noframes // @license MIT // @grant none // @run-at document-end // ==/UserScript== (function () { "use strict"; waitForElm(".cardTitle.title").then((elm) => { console.log("Element is ready"); // console.log(elm.childElementCount); if (elm.childElementCount <= 2) { AddButtontoALL(); } }); waitForElm("#user_information > div.bottom > table > tbody").then((elm) => { console.log("Element is ready"); // var target = document.querySelector(".sub-nav.genderTabs"); var target = document.querySelector( "#user_information > div.bottom > table > tbody" ); // console.log(genderTab); // var genderTab = response[0]; var newli = document.createElement("div"); // newli.setAttribute("class", "gender-tab"); // newli.setAttribute( // "style", // "display: inline-block; position: relative; font: 13.0029px / 16px UbuntuMedium, Arial, Helvetica, sans-serif;" // ); newli.setAttribute("style", "display: block;"); var button = document.createElement("button"); button.innerHTML = "Refresh"; button.onclick = function () { AddButtontoALL(); }; newli.appendChild(button); target.appendChild(newli); }); function waitForElm(selector) { return new Promise((resolve) => { if (document.querySelector(selector)) { return resolve(document.querySelector(selector)); } const observer = new MutationObserver((mutations) => { if (document.querySelector(selector)) { observer.disconnect(); resolve(document.querySelector(selector)); } }); observer.observe(document.body, { childList: true, subtree: true, }); }); } function AddButtontoALL() { var camtitles = document.getElementsByClassName("title"); [].forEach.call(camtitles, function (item) { var URL = item.getElementsByTagName("A")[0].getAttribute("href"); // console.log(URL); var newlink = document.createElement("a"); newlink.setAttribute("class", "signature"); newlink.setAttribute("href", "chaturbate://chaturbate.com" + URL); newlink.innerHTML = "Record"; item.appendChild(newlink); }); } })();