From 67cb78c42d388849401fb1b6dd54c8570a5aedf2 Mon Sep 17 00:00:00 2001 From: warmans Date: Sun, 28 Aug 2022 18:59:10 +0200 Subject: [PATCH] Added host for scrimpton.com --- lib/modules/hosts/scrimpton.js | 43 ++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 lib/modules/hosts/scrimpton.js diff --git a/lib/modules/hosts/scrimpton.js b/lib/modules/hosts/scrimpton.js new file mode 100644 index 0000000000..f6962d9204 --- /dev/null +++ b/lib/modules/hosts/scrimpton.js @@ -0,0 +1,43 @@ +/* @flow */ + +import { Host } from '../../core/host'; + +/* + * Scrimpton.com is a transcription viewer for a series of radio shows that aired in the mid-2000s. + * This host module allows sharing of snippets of text/audio. + */ +export default new Host('scrimpton', { + name: 'Scrimpton', + logo: 'https://scrimpton.com/assets/android-chrome-192x192.png', + domains: [ + 'scrimpton.com', + 'karltakesasneakylookatmenscocks.com', + ], + detect: ({ href, pathname }) => { + if (pathname.startsWith('/embed')) { + return [href, href]; + } + if (pathname.startsWith('/ep') && href.indexOf('#pos') > -1) { + const [, epid, start, end] = (/.+\/ep\/([^#]+)\#pos-(\d+)(-\d+)?/i).exec(href); + if (!epid || start === undefined) { + return false; + } + if (end === undefined) { + return [href, `https://scrimpton.com/embed?epid=${epid}&start=${start || 0}`]; + } else { + return [href, `https://scrimpton.com/embed?epid=${epid}&start=${start || 0}&end=${end.replace('-', '')}`]; + } + } + return false; + }, + handleLink(href, [, embedHref]) { + return { + type: 'IFRAME', + expandoClass: 'selftext', + muted: true, + embed: embedHref, + width: '800px', + height: '500px', + }; + }, +});