1. Log in now to remove adverts - no adverts at all to registered members!

tweet fix

Discussion in 'General Chat' started by Benvenuto Cellini, Oct 9, 2025 at 3:44 AM.

  1. Benvenuto Cellini

    Benvenuto Cellini 1 of the top judges in Europe

    Joined:
    Jun 12, 2012
    Messages:
    44,607
    Likes Received:
    59,713
    got fed up having to manually change x to twitter so got some AI slop to fix it because brb wont

    all it does is change the url from x to twitter when you paste it in the media popup or if you just paste the tweet url in the comment box it will change to this sites format



    install violentmonkey addon

    add this script

    Code:
    // ==UserScript==
    // @name		fix tweet
    // @match	   *://not606.com/*
    // @grant	   none
    // @version	 1.5
    // ==/UserScript==
    (async () => {
    	"use strict";
    
    	function attachListener(input) {
    		if (input.dataset.vmBound) return;
    		input.dataset.vmBound = "1";
    		input.addEventListener("input", () => {
    			if (input.value.includes("//x.com/")) {
    				input.value = input.value.replace("//x.com/", "//twitter.com/");
    			}
    		});
    		console.log("Listener attached to #redactor_media_link input");
    	}
    
    	function attachIframeListener(iframe) {
    		if (iframe.dataset.vmBound) return;
    		iframe.dataset.vmBound = "1";
    
    		const onLoad = () => {
    			const doc = iframe.contentDocument || iframe.contentWindow.document;
    			if (!doc) {
    				console.warn("Could not access iframe document");
    				return;
    			}
    
    			const editor =
    				doc.querySelector('[contenteditable="true"]') ||
    				doc.querySelector(".redactor_textCtrl") ||
    				doc.querySelector(".redactor_MessageEditor") ||
    				doc.querySelector(".redactor_BbCodeWysiwygEditor") ||
    				doc.querySelector("textarea") ||
    				doc.querySelector('div[class*="redactor"]') ||
    				doc.body;
    
    			if (!editor) {
    				console.warn("Could not find editor element in iframe");
    				console.log(
    					"Available elements:",
    					doc.body.innerHTML.substring(0, 500),
    				);
    				return;
    			}
    
    			const tweetRegex =
    				/https?:\/\/(?:www\.)?(?:x|twitter)\.com\/[^/]+\/status\/(\d+)/;
    
    			const handlePaste = (e) => {
    				const pasted = (
    					e.clipboardData || window.clipboardData
    				).getData("text");
    
    				const match = pasted.match(tweetRegex);
    				if (!match) {
    					console.log("No tweet URL found in paste");
    					return;
    				}
    
    				e.preventDefault();
    				e.stopPropagation();
    
    				const id = match[1];
    				const tag = `[MEDIA=twitter]${id}[/MEDIA]`;
    
    				if (editor.tagName === "TEXTAREA") {
    					const start = editor.selectionStart;
    					const end = editor.selectionEnd;
    					const text = editor.value;
    					editor.value =
    						text.substring(0, start) + tag + text.substring(end);
    					editor.selectionStart = editor.selectionEnd =
    						start + tag.length;
    				} else if (
    					editor.isContentEditable ||
    					editor.contentEditable === "true"
    				) {
    					const selection = doc.getSelection();
    
    					if (selection.rangeCount > 0) {
    						const range = selection.getRangeAt(0);
    						range.deleteContents();
    
    						const textNode = doc.createTextNode(tag);
    						range.insertNode(textNode);
    
    						range.setStartAfter(textNode);
    						range.setEndAfter(textNode);
    						selection.removeAllRanges();
    						selection.addRange(range);
    					} else {
    						editor.innerHTML += tag;
    					}
    				} else {
    					editor.textContent += tag;
    				}
    
    				editor.dispatchEvent(new Event("input", { bubbles: true }));
    				editor.dispatchEvent(new Event("change", { bubbles: true }));
    
    				console.log("Replaced tweet URL →", tag);
    			};
    
    			editor.addEventListener("paste", handlePaste);
    
    			console.log("Iframe paste listener attached to:", editor.tagName);
    		};
    
    		if (iframe.contentDocument?.readyState === "complete") {
    			onLoad();
    		} else {
    			iframe.addEventListener("load", onLoad, { once: true });
    		}
    	}
    
    	const existingInput = document.getElementById("redactor_media_link");
    	if (existingInput) attachListener(existingInput);
    
    	const existingIframe = document.querySelector(
    		"iframe.redactor_BbCodeWysiwygEditor",
    	);
    	if (existingIframe) attachIframeListener(existingIframe);
    
    	const observer = new MutationObserver((mutations) => {
    		for (const m of mutations) {
    			for (const node of m.addedNodes) {
    				if (node.nodeType !== 1) continue;
    
    				if (node.id === "redactor_media_link") {
    					attachListener(node);
    				} else {
    					const el = node.querySelector?.("#redactor_media_link");
    					if (el) attachListener(el);
    				}
    
    				if (
    					node.tagName === "IFRAME" &&
    					(node.classList.contains("redactor_BbCodeWysiwygEditor") ||
    						node.classList.contains("redactor_MessageEditor") ||
    						node.classList.contains("redactor_textCtrl"))
    				) {
    					attachIframeListener(node);
    				} else {
    					const iframe = node.querySelector?.(
    						'iframe[class*="redactor"]',
    					);
    					if (iframe) attachIframeListener(iframe);
    				}
    			}
    		}
    	});
    
    	observer.observe(document.body, { childList: true, subtree: true });
    })();
    
     
    #1
  2. Toley Fart

    Toley Fart not606's best fighter

    Joined:
    May 12, 2017
    Messages:
    45,433
    Likes Received:
    55,728
    No thanks. Prefer the just seeing the link rather than embedded tweet.
     
    #2
  3. EDGE.

    EDGE. Official POTY 2011, 2014, 2015, 2018 & 2023

    Joined:
    Jun 8, 2011
    Messages:
    36,095
    Likes Received:
    48,225
    Noticed on his screen, there were no notification ergo, no likes. :emoticon-0136-giggl

    Now he knows how Gambol feels :emoticon-0148-yes:
     
    #3
  4. Gambol

    Gambol George Clooney's wee brother

    Joined:
    Jan 22, 2010
    Messages:
    60,679
    Likes Received:
    18,395
  5. DUNCAN DONUTS

    DUNCAN DONUTS SOCIAL JUSTICE WARRIOR

    Joined:
    Dec 18, 2015
    Messages:
    69,075
    Likes Received:
    55,802
    Will there be jugs ?
     
    #5
  6. Benvenuto Cellini

    Benvenuto Cellini 1 of the top judges in Europe

    Joined:
    Jun 12, 2012
    Messages:
    44,607
    Likes Received:
    59,713
    was recorded just after checking a mammoth 30 noty haul

    dopamine receptors were flooded iirc
     
    #6
    EDGE., Toley Fart and Toby like this.

  7. DUNCAN DONUTS

    DUNCAN DONUTS SOCIAL JUSTICE WARRIOR

    Joined:
    Dec 18, 2015
    Messages:
    69,075
    Likes Received:
    55,802
  8. Benvenuto Cellini

    Benvenuto Cellini 1 of the top judges in Europe

    Joined:
    Jun 12, 2012
    Messages:
    44,607
    Likes Received:
    59,713
    thursday jugs
     
    #8
  9. DUNCAN DONUTS

    DUNCAN DONUTS SOCIAL JUSTICE WARRIOR

    Joined:
    Dec 18, 2015
    Messages:
    69,075
    Likes Received:
    55,802
    Tit's & fanny is illegal now on the Internet just ****** tranny stuff on the BBC
     
    #9
    Benvenuto Cellini likes this.
  10. DUNCAN DONUTS

    DUNCAN DONUTS SOCIAL JUSTICE WARRIOR

    Joined:
    Dec 18, 2015
    Messages:
    69,075
    Likes Received:
    55,802
    Just opened a Maltesers fun size & counted them .


    13 balls coincidence
     
    #10
  11. DUNCAN DONUTS

    DUNCAN DONUTS SOCIAL JUSTICE WARRIOR

    Joined:
    Dec 18, 2015
    Messages:
    69,075
    Likes Received:
    55,802
    If you have a midwit I.Q you can probably get a gig at the 77th Brigade

    The 88 Brigade is different
     
    #11
  12. Toley Fart

    Toley Fart not606's best fighter

    Joined:
    May 12, 2017
    Messages:
    45,433
    Likes Received:
    55,728
    • Sugar
    • Glucose syrup
    • Cocoa butter, skimmed milk powder, milk fat
    • Palm oil
    • Barley malt extract
    • Emulsifiers (e.g., soy lecithin, E442)
    • Artificial or natural flavorings

    Bro’s eating poison and enjoying it.
     
    #12
    Benvenuto Cellini and Toby like this.
  13. DUNCAN DONUTS

    DUNCAN DONUTS SOCIAL JUSTICE WARRIOR

    Joined:
    Dec 18, 2015
    Messages:
    69,075
    Likes Received:
    55,802
    I stamped on them because I'm not a k8ke
     
    #13
  14. DUNCAN DONUTS

    DUNCAN DONUTS SOCIAL JUSTICE WARRIOR

    Joined:
    Dec 18, 2015
    Messages:
    69,075
    Likes Received:
    55,802
  15. DUNCAN DONUTS

    DUNCAN DONUTS SOCIAL JUSTICE WARRIOR

    Joined:
    Dec 18, 2015
    Messages:
    69,075
    Likes Received:
    55,802
    Whenever I'm running around in the back field naked other than my crocks , I wake up after a fool moon
     
    #15

Share This Page