protip, when posting a reddit url with profanity in the subreddit name, just replace the subreddit name with a subreddit that exists.
a$$holedesign -> design
the subreddit name isn't important for the embed functionality to work, it's the thread ID that is "14s19fw"
ever since thecoli upgraded, hyperlinks are no longer underlined, even in old threads. I used ChatGPT to create a bookmarklet to underline hyperlinks in posts in edit mode. for it to work the bbcode editor must be enabled instead of the default html editor.
this is the bookmarklet code.
Code:javascript:(function() { var textarea = document.querySelector('textarea.input[name="message"]'); var text = textarea.value; var pattern = /\[URL=(.*?)\[\/URL\]/g; var replacedText = text.replace(pattern, %27[U][URL=$1[/URL][/U]%27); textarea.value = replacedText;})();
** you can follow the instructions below or just highlight the code(doubleclick) and drag and drop it to the bookmark bar, then right-click edit it.
To use this bookmarklet:
- Create a new bookmark in your Chromium browser.
- Right-click on the bookmarks bar and choose "Add Page" or "Add Bookmark" (the option may vary depending on your browser version).
- Enter a name for the bookmarklet (e.g., "Format Text").
- In the "URL" or "Address" field, paste the above JavaScript code.
- Save the bookmark.
- Navigate to the page with the <textarea> element you want to edit.
- Click on the bookmarklet you created.
- The desired find and replace action will be applied to the content of the specified <textarea> element.
copy paste the text into the "html editor" , switch to "bb code", click bookmarklet and switch back to the html editor.
Toggle the "BB code" button and then the buttons to the left should turn grey.
click the newly created bb code underline bookmarklet, I named mines "bb_" but you can name it anyway you want.
example:
javascript:(function() {
var textareas = document.querySelectorAll('textarea.input');
textareas.forEach(function(textarea) {
var text = textarea.value;
var pattern1 = /\[URL=(.*?)\[\/URL\]/g;
var pattern2 = /(\n)([A-Z"]|\d)/g;
var replacedText = text.replace(pattern1, '[U][URL=$1[/URL][/U]');
replacedText = replacedText.replace(pattern2, '$1\n$2');
replacedText = replacedText.replace(/\n{4,}/g, '\n\n');
replacedText = replacedText.replace(/\[U\]\[U\]\[URL=(.*?)\[\/URL\]\[\/U\]\[\/U\]/g, '[U][URL=$1[/URL][/U]');
replacedText = replacedText.replace(/\[\/HEADING\]\n/g, '[/HEADING]');
replacedText = replacedText.replace(/\[\/IMG\]\n/g, '[/IMG]');
textarea.value = replacedText;
});
})();
[URL='http://']...[/URL]
tags and replaces them with [U][URL='http://']...[/URL][/U]
, effectively underlining all URLs.[/HEADING]
or [/IMG]
, and inserts an additional newline character before it.[U][U][URL='http://']...[/URL][/U][/U]
and replaces them with [U][URL='http://']...[/URL][/U]
, effectively removing the extra underline.[/HEADING]
or [/IMG]
tags. This will help to format the content of the textareas in a more readable and organized way. Is there anything else you would like to know? javascript: (function() {
var textareas = document.querySelectorAll('textarea.input');
textareas.forEach(function(textarea) {
var text = textarea.value;
var pattern1 = /\[URL=(.*?)\[\/URL\]/g;
var pattern2 = /(\n)([A-Z"]|\d|\[B\]|\[I\]|\[IMG\])/g;
var replacedText = text.replace(pattern1, '[U][URL=$1[/URL][/U]');
replacedText = replacedText.replace(pattern2, '$1\n$2');
replacedText = replacedText.replace(/\n{4,}/g, '\n\n');
replacedText = replacedText.replace(/\[U\]\[U\]\[URL=(.*?)\[\/URL\]\[\/U\]\[\/U\]/g, '[U][URL=$1[/URL][/U]');
replacedText = replacedText.replace(/\[\/HEADING\]\n/g, '[/HEADING]');
replacedText = replacedText.replace(/\[\/IMG\]\n/g, '[/IMG]');
textarea.value = replacedText;
});
})();
[B], [I], or [IMG].
For example, if you have a block of text that contains the following lines:This is some text.
[B]This text will be bold[/B].
[I]This text will be italicized[/I].
[IMG]http://example.com/image.jpg[/IMG]
And here is some more text.
After running the bookmarklet on this block of text, it will look like this:
This is some text.
[B]This text will be bold[/B].
[I]This text will be italicized[/I].
[IMG]http://example.com/image.jpg[/IMG]
And here is some more text.
X.com
with twitter.com
]https://x.com/PBS/status/1642240482813042688
and as you can see it automatically changed to twitter.com.// ==UserScript==
// @name Replace X.com URLs with Twitter.com URLs
// @namespace http://tampermonkey.net/
// @description Replaces URLs containing "https://twitter.com" or "https://twitter.com" with "https://twitter.com".
// @author Author Name
// @version 1.0
// @match https://www.thecoli.com/threads/*
// @match https://thecoli.com/threads/*
// @match https://xenforo.com/community/forums/*
// @grant none
// ==/UserScript==
(function() {
'use strict';
// Function to get the current cursor position in a text input field
function getCursorPosition(input) {
let position = 0;
if ('selectionStart' in input) {
position = input.selectionStart;
} else if (document.selection) {
input.focus();
let selection = document.selection.createRange();
selection.moveStart('character', -input.value.length);
position = selection.text.length;
}
return position;
}
// Function to set the cursor position in a text input field
function setCursorPosition(input, position) {
if (input.setSelectionRange) {
input.focus();
input.setSelectionRange(position, position);
} else if (input.createTextRange) {
let range = input.createTextRange();
range.collapse(true);
range.moveEnd('character', position);
range.moveStart('character', position);
range.select();
}
}
// Function to replace URLs in text input fields
function replaceURLs(event) {
// Get all editable fields on the page
let editableFields = document.querySelectorAll('[contenteditable="true"], .fr-element.fr-view.fr-element-scroll-visible');
// Get the target element of the event
let target = event.target;
// Check if the target is a text input field or an editable field
if (target.matches('textarea.input') || editableFields.includes(target)) {
// Save the current cursor position
let cursorPosition = getCursorPosition(target);
// Replace URLs in the value or innerHTML of the target element
let lines = target.value ? target.value.split('\n') : target.innerHTML.split('\n');
for (let i = 0; i < lines.length; i++) {
lines[i] = lines[i].replace(/https:\/\/(www\.)?x\.com/g, 'https://twitter.com');
if (i === cursorPosition.line) {
cursorPosition.column = lines[i].length;
}
}
target.value ? target.value = lines.join('\n') : target.innerHTML = lines.join('\n');
// Restore the cursor position
setCursorPosition(target, cursorPosition);
}
}
// Function to prevent cursor movement by arrow keys
// function preventCursorMovement(event) {
// Check if the key pressed is left or right arrow
// if (event.keyCode == 37 || event.keyCode == 39) {
// Prevent the default behavior of the key
event.preventDefault();
// }
// }
// Add event listeners for input and keydown events on the document
document.addEventListener('input', replaceURLs);
// document.addEventListener('keydown', preventCursorMovement);
})();
// ==UserScript==
// @name Mastodon Embed Links
// @version 1.1.3
// @description Embed Mastodon posts in Xenforo-compatible forums
// @match https://www.thecoli.com/threads/*
// @match https://thecoli.com/threads/*
// ==/UserScript==
(function() {
'use strict';
// Regex pattern to match Mastodon and x.com links
const mastodonRegex = /^https?:\/\/([a-z\d-_]+\.)*([a-z\d-_]+)\.([a-z]{2,})(\/@[a-zA-Z0-9-_]+(@[a-zA-Z0-9-_]+)?\/\d+|\/@[a-zA-Z0-9-_]+\/post\/\w+|\/t\/\w+)/;
const xcomRegex = /^https?:\/\/(www\.)?x\.com\/.*\/status\/(\d+)/;
// Find all links on the page
const links = document.getElementsByTagName("a");
for (let i = 0; i < links.length; i++) {
const link = links[i];
let href = link.getAttribute("href");
// Check if the link matches the Mastodon regex pattern
if (mastodonRegex.test(href)) {
const match = href.match(mastodonRegex);
const username = match[4].split("/")[1];
let domain = match[2];
const postID = match[4].split("/")[2];
// Check if there are two "@" symbols in the URL
if ((username.match(/@/g) || []).length === 2) {
// Rewrite the URL
domain = username.split("@")[2];
href = `https://${domain}/@${username.split("@")[1]}/${postID}`;
}
// Create the iframe embed code
const embedUrl = `${href}/embed`;
const scriptSrc = `https://${domain}/embed.js`;
const iframe = document.createElement("iframe");
iframe.src = embedUrl;
iframe.classList.add("mastodon-embed", "gh-fit");
iframe.style.maxWidth = '550px';
iframe.style.border = "0";
iframe.style.width = '100%';
iframe.style.height = '620px';
iframe.style.maxHeight = '650px';
iframe.style.overflow = 'hidden';
iframe.setAttribute("allowfullscreen", "allowfullscreen");
const script = document.createElement("script");
script.src = scriptSrc;
script.async = true;
iframe.appendChild(script);
// Replace the link with the embedded post
link.parentNode.replaceChild(iframe, link);
}
// Check if the link matches the x.com regex pattern
else if (xcomRegex.test(href)) {
const match = href.match(xcomRegex);
const postID = match[2];
// Create the iframe embed code
const embedUrl = `https://s9e.github.io/iframe/2/twitter.min.html#${postID}`;
const iframe = document.createElement("iframe");
iframe.setAttribute("data-s9e-mediaembed", "twitter");
iframe.setAttribute("allow", "autoplay *");
iframe.setAttribute("allowfullscreen", "");
iframe.setAttribute("scrolling", "no");
iframe.style.height = '1210px';
iframe.style.width = '550px';
iframe.src = embedUrl;
iframe.setAttribute("loading", "eager");
// Replace the link with the embedded post
link.parentNode.replaceChild(iframe, link);
}
}
function fit() {
var iframes = document.querySelectorAll("iframe.gh-fit")
for(var id = 0; id < iframes.length; id++) {
var win = iframes[id].contentWindow
var doc = win.document
var html = doc.documentElement
var body = doc.body
if(body) {
body.style.overflowX = "scroll"; // scrollbar-jitter fix
body.style.overflowY = "hidden";
}
if(html) {
html.style.overflowX = "scroll"; // scrollbar-jitter fix
html.style.overflowY = "hidden";
var style = win.getComputedStyle(html);
iframes[id].width = parseInt(style.getPropertyValue("width")); // round value
iframes[id].height = parseInt(style.getPropertyValue("height"));
}
}
requestAnimationFrame(fit);
}
addEventListener("load", requestAnimationFrame.bind(this, fit));
})();
https://mstdn.social/@theseeduneed@mastodon.social/111259225096817564
https://mastodon.social/@theseeduneed/111259225096817564
instead.https://twitter.com/BaldyNFL/status/1709212004026548631
: This URL matches the x.com regex pattern in the userscript. The script will replace this link with an embedded post from x.com. The embedded post will be displayed in an iframe with a height of 693px and a width of 550px.https://mstdn.social/@noelreports/111275312521478534
: This URL matches the Mastodon regex pattern in the userscript. The script will replace this link with an embedded post from Mastodon. The embedded post will be displayed in an iframe with a height of 620px and a width of 100% (up to a maximum width of 550px).https://twitter.com/SamAdlerBell/status/1715800138273226959
`, it will match the URL with the `xcomRegex` regular expression pattern. This pattern is designed to match URLs from x.com that contain a status ID.https://www.thecoli.com/threads/*
` and `https://thecoli.com/threads/*
` as specified in the `@match` metadata. If you want this script to run on different pages, you would need to modify these match patterns accordingly.javascript:(function() {
var textareas = document.querySelectorAll('textarea.input');
textareas.forEach(function(textarea) {
var text = textarea.value;
var pattern1 = /\[URL=(.*?)\[\/URL\]/g;
var pattern2 = /(\n)([A-Z"]|\d|\[B\]|\[I\]|\[IMG\])/g;
var pattern3 = /\[IMG alt="([^"]*)"/g;
var pattern4 = /\n/g;
var pattern5 = /(\[HEADING=2\]|\[LIST\]|\[\*\)|\[\/LIST\]|\[IMG\])/g;
var replacedText = text.replace(pattern1, '[U][URL=\$1[/URL][/U]');
replacedText = replacedText.replace(pattern2, '\$1\n\$2');
replacedText = replacedText.replace(pattern3, '\n[IMG alt="$1"');
replacedText = replacedText.replace(pattern4, '\n\n');
replacedText = replacedText.replace(pattern5, '\n\$1');
replacedText = replacedText.replace(/\n{4,}/g, '\n\n');
replacedText = replacedText.replace(/\[U\]\[U\]\[URL=(.*?)\[\/URL\]\[\/U\]\[\/U\]/g, '[U][URL=\$1[/URL][/U]');
replacedText = replacedText.replace(/\[\/HEADING\]\n/g, '[/HEADING]');
replacedText = replacedText.replace(/\[\/IMG\]\n/g, '[/IMG]');
textarea.value = replacedText;
});
})();
textarea.value
variable./\*)"/g
to/\[IMG alt="([^"]*)"/g
. This pattern matches any text that starts with[IMG alt="
and ends with"]
. The([^"]*)
part is a capturing group that matches any character except a double quote (`"`), repeated any number of times. Theg
at the end of the pattern indicates that this pattern should be applied globally, i.e., it should match all occurrences in the string, not just the first one.'\n[IMG alt="$1"'
to'\n[IMG alt="$1"'
. This means that for each match of the pattern in the text, it will be replaced with a newline character followed by[IMG alt="
, followed by the captured group (represented by$1
), and ending with"]
.[URL=
and ends with[/URL]
. The([^"]*)
part is a capturing group that matches any character except a double quote (`"`), repeated any number of times. Theg
at the end of the pattern indicates that this pattern should be applied globally.[U][URL=$1[/URL][/U]
. Here, $1
represents the captured group in the pattern, which is the URL inside the[URL=
and[/URL]
tags.$1
), followed by another newline character.$1
).[U][U][URL=
and[/URL][/U][/U]
tags.g
flag at the end of each regular expression ensures that the replace operation is performed globally, i.e., all occurrences of the pattern in the string are replaced, not just the first onejavascript:(function() {
var textareas = document.querySelectorAll('textarea.input');
textareas.forEach(function(textarea) {
var text = textarea.value;
var pattern1 = /\[URL=(.*?)\[\/URL\]/g;
var pattern2 = /(\n)([A-Z"]|\d|\[B\]|\[I\]|\[IMG\])/g;
var pattern3 = /\[IMG alt="([^"]*)"/g;
var pattern4 = /\n/g;
var pattern5 = /(\[HEADING=2\]|\[LIST\]|\[\*\)|\[\/LIST\]|\[IMG\])/g;
var pattern6 = /\[\/?FONT(=.*?)?\]/g;
var pattern7 = /\[\/?COLOR(=.*?)?\]/g;
var replacedText = text.replace(pattern1, '[U][URL=\$1[/URL][/U]');
replacedText = replacedText.replace(pattern2, '\$1\n\$2');
replacedText = replacedText.replace(pattern3, '\n[IMG alt="$1"');
replacedText = replacedText.replace(pattern4, '\n\n');
replacedText = replacedText.replace(pattern5, '\n\$1');
replacedText = replacedText.replace(pattern6, '');
replacedText = replacedText.replace(pattern7, '');
replacedText = replacedText.replace(/\n{4,}/g, '\n\n');
replacedText = replacedText.replace(/\[U\]\[U\]\[URL=(.*?)\[\/URL\]\[\/U\]\[\/U\]/g, '[U][URL=\$1[/URL][/U]');
replacedText = replacedText.replace(/\[\/HEADING\]\n/g, '[/HEADING]');
replacedText = replacedText.replace(/\[\/IMG\]\n/g, '[/IMG]');
textarea.value = replacedText;
});
})();
This bookmarklet is designed to extract URLs from web pages. It does this by searching for elements that might contain URLs, such as iframe sources, data attributes, and hyperlink href attributes. It then decodes these URLs, checks if they start with certain patterns, and if so, modifies them.
The bookmarklet then sorts the URLs by domain name, prioritizing URLs from 'uni-sonia.com'. It opens a new window (popup) with two textareas, one for a space-separated list of URLs and one for a newline-separated list.
The bookmarklet is designed to handle a variety of URL formats and transforms, such as:
The bookmarklet also filters out URLs that start with '/', are data images, or are '#top'. It also filters out URLs that start with 'https://www.thecoli.com', 'https://www.googletagmanager.com', 'https://www.thecoli.com', 'javascript:', 'url=', or 'https://ajax.googleapis.com'.
- It transforms a URL from the s9e.github.io/iframe/2/twitter.min.html format to a URL from Twitter's nitter instance.
- It adds 'https:' to URLs that start with '//streamable.com/e/'.
- It transforms a URL from the sendvid.com/embed/ format to the direct sendvid.com URL.
- It transforms a URL from the s9e.github.io/iframe/2/reddit.min.html format to a URL from Reddit.
In summary, this bookmarklet is designed to extract and organize URLs from web pages, prioritizing URLs from 'uni-sonia.com', and then displaying the URLs in a new window.
javascript:(function() {
var urls = new Set();
var urlElements = document.querySelectorAll('iframe[src], [data-s9e-mediaembed-iframe], [data-src], [src], a[href]');
urlElements.forEach(function(element) {
var url = element.getAttribute('src') || (element.getAttribute('data-s9e-mediaembed-iframe') && JSON.parse(element.getAttribute('data-s9e-mediaembed-iframe'))[7]) || element.getAttribute('data-src') || element.getAttribute('href');
if (url) {
var decodedUrl = decodeURIComponent(url);
if (decodedUrl.startsWith('https://s9e.github.io/iframe/2/twitter.min.html')) {
decodedUrl = 'https://twitter.com/anyuser/status/' + decodedUrl.split('#')[1];
} else if (decodedUrl.startsWith('//streamable.com/e/')) {
decodedUrl = 'https:' + decodedUrl;
} else if (decodedUrl.startsWith('//sendvid.com/embed/')) {
decodedUrl = 'https://sendvid.com/' + decodedUrl.split('/embed/')[1];
} else if (decodedUrl.startsWith('https://s9e.github.io/iframe/2/reddit.min.html')) {
var redditUrl = decodedUrl.split('#')[1].split('#theme')[0];
decodedUrl = 'https://reddit.com/' + redditUrl;
} else if (decodedUrl.startsWith('/') || decodedUrl.startsWith('data:image') || decodedUrl.startsWith('#top') || decodedUrl.startsWith('https://www.thecoli.com') || decodedUrl.startsWith('http://www.thecoli.com') || decodedUrl.startsWith('https://thecoli.com') || decodedUrl.startsWith('http://thecoli.com') || decodedUrl.startsWith('#post-') || decodedUrl.startsWith('no') || decodedUrl.startsWith('mailto:') || decodedUrl.startsWith('https://www.googletagmanager.com/')) {
return;
}
if (!decodedUrl.startsWith('javascript:') && !decodedUrl.startsWith('https://ajax.googleapis.com')) {
if (decodedUrl.startsWith('https://www.youtube.com/embed/')) {
var videoId = decodedUrl.split('/embed/')[1];
decodedUrl = 'https://www.youtube.com/watch?v=' + videoId;
}
if (decodedUrl.startsWith('url=http')) {
decodedUrl = decodedUrl.replace('url=', '');
}
urls.add(decodedUrl);
if (decodedUrl.startsWith('https://twitter.com')) {
var nitterUrl = decodedUrl.replace('https://twitter.com', 'https://nitter.uni-sonia.com');
urls.add(nitterUrl);
}
}
}
});
var sortedUrls = Array.from(urls).sort(function(a, b) {
var domainA = a.split('/');
var domainB = b.split('/');
if (domainA.length >= 3 && domainB.length >= 3) {
var domainA = domainA[2];
var domainB = domainB[2];
if (domainA.includes('uni-sonia.com') && !domainB.includes('uni-sonia.com')) {
return 1;
} else if (!domainA.includes('uni-sonia.com') && domainB.includes('uni-sonia.com')) {
return -1;
} else {
return domainA.localeCompare(domainB);
}
}
});
var popup = window.open('', 'popup', 'width=800,height=600');
var urlText = sortedUrls.join(' ');
var urlTextWithLinks = sortedUrls.map(function(url) {
return '<a href="' + url + '">' + url + '</a>';
}).join('<br>');
var urlTextWithNewLine = sortedUrls.join('\n');
popup.document.write('<textarea style="width: 100%; height: 50%">' + urlText + '</textarea><br><textarea style="width: 100%; height: 50%">' + urlTextWithNewLine + '</textarea><br><div style="width: 100%; height: 50%">' + urlTextWithLinks + '</div>');
})();
@bnew do you know a workaround to the error when changing avi? Can’t upload a new one.
I don't use avatars but I have run in issues trying to upload media files to the site gallery which i was never able to resolve.
Just tried it out since the QR code I had now redirects somewhere else
It looks like it doesn't accept files above a certain file size (possibly 9KB? A file at 8.94KB was rejected but ones at slightly over 8KB were fine.)
It accepts .gifs but makes them static, though they work correctly on the avatar page and when viewed in Imagus.
Thx but it's still not working. Tried to isolate it by browser/device, but it seems to be an issue on the server end.try using this site to see if the above workaround helps.
ResizePixel - online image editor
Free image editor to crop, resize, flip, rotate, convert and compress image onlinewww.resizepixel.com
Image Resizer | Easily Resize Images Online for FREE
Image Resizer. Quickly resize image files online at the highest image quality. No software to install and easy to use.imageresizer.com
Compress images online - Reduce your image size online and for free
Your image is too big when it comes to file size? Use this image compression service to reduce the size of an image. Online, free, and easy to use – compress an image using Img2Go.www.img2go.com
Thx but it's still not working. Tried to isolate it by browser/device, but it seems to be an issue on the server end.