NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript== // @name Take Over(cast) // @version 0.11 // @namespace https://davegoesthedistance.com // @description Convert Apple Podcast links to Overcast links. // @author David Millar // @match * // @license MIT // @run-at document-end // @run-at document-idle // @author David Millar <dave@davegoesthedistance.com> // @updateURL https://openuserjs.org/meta/davmillar/Take_Over(cast).user.js // ==/UserScript== (function () { 'use strict'; document.addEventListener("DOMContentLoaded", replaceLinks, false); if (document.readyState === "complete") { replaceLinks(); } function checkLink(a) { var linkCheck = a.href.toString().match(/itunes\.apple\..*\/(.*\/)?podcast\/.*\/?id(\d+)/i); if (linkCheck && linkCheck[2]) { a.href = 'https://overcast.fm/itunes' + linkCheck[2]; if (a.textContent.match(/itunes|apple/ig)) { a.textContent = a.textContent.replace(/itunes|apple/ig, 'Overcast'); } } } function replaceLinks() { Array.forEach(document.links, checkLink); } document.body.addEventListener('mousedown', function (e) { if (e.target.tagName != "A") return; checkLink(e.target); }); })();