Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name TT for endchan
- // @version 1
- // @description Adds quick TT button for endchan
- // @author (You)
- // @match https://endchan.net/bbg/*
- // @grant none
- // @icon https://2chen.org/assets/favicons/default.ico
- // ==/UserScript==
- (function() {
- 'use strict';
- function render() {
- var i, href, match, articles = document.querySelectorAll('a[download]:not(.ttFinalised)');
- if (!articles) return;
- for(i = 0; i < articles.length; i++) {
- if (match = articles[i].parentNode.innerHTML.match(/6\d{18}/g)) {
- href = document.createElement("a"); href.target = "_blank";
- href.href = `https://www.tiktok.com/share/video/${match[0]}`;
- href.innerHTML = "<br/>» TikTok «";
- articles[i]
- .parentNode
- .appendChild(href);
- }
- articles[i].classList.add("ttFinalised");
- }
- }
- const root = document.getElementById("thread-container");
- const threadObserver = new MutationObserver(render);
- render();
- threadObserver.observe(root, {
- childList: true,
- subtree: true,
- attributes: false
- });
- })();
Add Comment
Please, Sign In to add comment