The Official Power User Tips, Tricks & Productivity Thread

Heimdall

Pro
Joined
Dec 13, 2019
Messages
424
Reputation
281
Daps
942
i need to figure out how to incorporate blocking popups on that site.
I had to use uBlock Origin to block a particular script with a rule. I can't even remember how I did it, I think with the logger, and it shows up under My rules
as
Code:
twstalker.com https://twstalker.com/popunderufasssssk9.js script block

rather than under My filters... I think the filter equivalent would just be
Code:
||https://twstalker.com/popunderufasssssk9.js
 

bnew

Veteran
Joined
Nov 1, 2015
Messages
57,175
Reputation
8,456
Daps
159,745
I had to use uBlock Origin to block a particular script with a rule. I can't even remember how I did it, I think with the logger, and it shows up under My rules
as
Code:
twstalker.com https://twstalker.com/popunderufasssssk9.js script block

rather than under My filters... I think the filter equivalent would just be
Code:
||https://twstalker.com/popunderufasssssk9.js

that link has a 404 error:

I used llama 3-sonar-large-32k-chat to generate this addition.

Code:
  // Add the script-blocking functionality
  var scriptTags = document.querySelectorAll('script[src*="popunderufasssssk9.js"]');
  scriptTags.forEach(function(scriptTag) {
    scriptTag.remove();
  });
 

Heimdall

Pro
Joined
Dec 13, 2019
Messages
424
Reputation
281
Daps
942
that link has a 404 error:

I used llama 3-sonar-large-32k-chat to generate this addition.

Code:
  // Add the script-blocking functionality
  var scriptTags = document.querySelectorAll('script[src*="popunderufasssssk9.js"]');
  scriptTags.forEach(function(scriptTag) {
    scriptTag.remove();
  });
Yes :jbhmm:

The source now contains a reference to a script at https://goomaphy.com/401/7287189 (blocked by the EasyList filters) - changing the src to this may work. There's also a long inline script and I am not sure what it does!
 

bnew

Veteran
Joined
Nov 1, 2015
Messages
57,175
Reputation
8,456
Daps
159,745
Yes :jbhmm:

The source now contains a reference to a script at https://goomaphy.com/401/7287189 (blocked by the EasyList filters) - changing the src to this may work. There's also a long inline script and I am not sure what it does!

i tried this but it doesn't seem to work.. may need a different llm to find a working solution.

Code:
var scriptTags = document.querySelectorAll('script[src*="goomaphy.com"], script[src*="gossishauphy.com"], script[src*="//"][src*="/tag.min.js"]');
scriptTags.forEach(function(scriptTag) {
  scriptTag.remove();
});
 

bnew

Veteran
Joined
Nov 1, 2015
Messages
57,175
Reputation
8,456
Daps
159,745
generated another userscript for use on the coli to basically replace .mp4 , .webm and m3u8 video links and embed a html5 video player that plays those links. the @match coul be modified to support any other site too.

used llama-3-sonar-large-32k-chat

Code:
// ==UserScript==
// @name         Replace Video Links with HTML5 Player
// @namespace    http://tampermonkey.net/
// @version      1.0
// @description  Replace video links with HTML5 player on XenForo.com
// @author       Your Name
// @match https://www.thecoli.com/threads/*
// @match https://thecoli.com/threads/*
// @match https://www.thecoli.com/forums/*/post-thread
// @match https://thecoli.com/forums/*/post-thread
// @match https://www.thecoli.com/conversations/*
// @grant        none
// ==/UserScript==

(function() {
  'use strict';
  var replacedLinks = {};
  function replaceVideoLinks() {
    var links = document.querySelectorAll('a[href*=".mp4"], a[href*=".m3u8"], a[href*=".webm"]');
    links.forEach(function(link) {
      if (!replacedLinks[link.href]) {
        var videoUrl = link.href;
        var videoElement = document.createElement('video');
        videoElement.src = videoUrl;
        videoElement.controls = true;
        videoElement.style.width = '100%';
        videoElement.style.height = '100%';
        videoElement.style.objectFit = 'contain';
        link.parentNode.replaceChild(videoElement, link);
        replacedLinks[link.href] = true;
      }
    });
    requestAnimationFrame(replaceVideoLinks);
  }
  replaceVideoLinks();
})();

heres a bookmarklet version:
Code:
javascript:(function(){
  'use strict';
  var links = document.querySelectorAll('a[href*=".mp4"], a[href*=".m3u8"], a[href*=".webm"]');
  links.forEach(function(link) {
    var videoUrl = link.href;
    var videoElement = document.createElement('video');
    videoElement.src = videoUrl;
    videoElement.controls = true;
    videoElement.style.width = '100%';
    videoElement.style.height = '100%';
    videoElement.style.objectFit = 'contain';
    link.parentNode.replaceChild(videoElement, link);
  });
})();

test this link: https://www.thecoli.com/threads/large-language-models-news-discussions.952923/post-53321309
i didn't test it extensively.

before:
9KjRCK6.png


after:
0EYwsr2.png

`
edit:
8/7/24
didn't fully test the initial code, m3u8 link didn't work so i modified the code to make video.js work with .m3u8 links.


test:

 
Last edited:

Heimdall

Pro
Joined
Dec 13, 2019
Messages
424
Reputation
281
Daps
942
i tried this but it doesn't seem to work.. may need a different llm to find a working solution.

Code:
var scriptTags = document.querySelectorAll('script[src*="goomaphy.com"], script[src*="gossishauphy.com"], script[src*="//"][src*="/tag.min.js"]');
scriptTags.forEach(function(scriptTag) {
  scriptTag.remove();
});
From a cursory search, to block JS with JS, a MutationObserver is required
johnwall.png


but! It looks like one of the inline scripts pulls the content of another script from gossishauphy and then creates the script with document.createElement.

Though I'm not sure how to apply this to a script that is essentially generated on the fly (or on page load). I don't even use Twstalker any more but this is annoying me :russ:
 

Heimdall

Pro
Joined
Dec 13, 2019
Messages
424
Reputation
281
Daps
942
ChatGPT broke it down for me :mjgrin: but I just could not post with this text in there:
This script essentially does the following:

  • Dynamically loads a JavaScript file from gossishauphy.com.
  • Sends an XMLHttpRequest to gossishauphy.com with specific query parameters.
  • Handles the response by parsing it as JSON and potentially calling a global function with the parsed data if that function exists.
  • Includes error handling to manage failed script loading or request errors.

If you do not trust the source or need to block this script, you can use a MutationObserver as mentioned earlier to prevent it from running.
This says it blocks the script in the console as expected, but popunders still happen.
Code:
// Create a MutationObserver to observe changes in the DOM
const observer = new MutationObserver((mutationsList) => {
    for (let mutation of mutationsList) {
        if (mutation.type === 'childList') {
            // Check for added script elements
            mutation.addedNodes.forEach((node) => {
                if (node.tagName === 'SCRIPT' && node.src.includes('gossishauphy.com', 'goomaphy.com')) {
                    // Remove the script element to prevent it from executing
                    node.remove();
                    console.log('Blocked script from:', node.src);
                }
            });
        }
    }
});

// Start observing the document for changes
observer.observe(document, { childList: true, subtree: true });

This is the (second) offending script (I can't post when I copy it so I'll screenshot), maybe you could just modify the HTML to remove the variables at the start or something? :p
uznFiP.jpg
 
Last edited:

bnew

Veteran
Joined
Nov 1, 2015
Messages
57,175
Reputation
8,456
Daps
159,745
I used llama-3.1-sonar-large-128k-chat LLM to create a userscript that redirects urls on urlex.org in tandem with the redirector addon/extension. urlex.org is a url-unshortner/url-expander website and resolves short urls etc. i no longer wanted to have to manually click the unshortened url so thats why this userscript exists. you can use it as an example for a similar url shortening service. i didn't do indepth research into url-unshortners. this was just the first result i got and i created a redirector rule for it which i have been using for 2 weeks now.


A.I generated explanation:
This script is designed to work on the website urlex.org. When you visit a page on this site, it automatically checks for links in the table cells. It ignores the first link (which is usually a shortened URL like t.co / Twitter) and finds the second link. Once it finds this second link, it loads that URL in your browser window. In short, it helps you skip over shortened URLs and directly load the actual URL you're interested in.

Code:
// ==UserScript==
// @name         Load Second Column URL on urlex.org
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  Load Second Column URL on urlex.org
// @author       You
// @match        https://urlex.org/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    // Function to check if element is present and execute replacement logic
    function checkAndLoad() {
        // Select all anchor tags within table cells
        var links = document.querySelectorAll('td a');

        if (links.length > 1) {
            console.log("Found", links.length, "anchor tags within table cells");

            // Loop through each link and find second column URL
            for (var i = 0; i < links.length; i++) {
                var link = links[i];
                console.log("Processing link:", link.href);

                // Ignore first column URL (typically https://t.co)
                if (i === 1) {
                    console.log("Found second column URL:", link.href);
                   
                    // Load this second column URL in same window's address bar
                    window.location.href = link.href;
                    console.log("Redirecting to second column URL:", link.href);

                    // Remove interval since we've found and processed elements
                    clearInterval(interval);
                    break;
                }
            }
        }
    }

    // Check every second for presence of required elements
    var interval = setInterval(checkAndLoad, 1000);
})();

this was my redirector rule because i didn't want to unblock in my hosts file, only on one browser.

Edit Redirect

Description:https://t.co/ to https://urlex.org
Example URL:https://t.co/ocBSKTQjyF
Include pattern:^(https://t.co/.*)
Redirect to:https://urlex.org/$1
Pattern type:
Regular Expression
Pattern Description:
Example result:
https://urlex.org/https://t.co/ocBSKTQjyF

edit:
just created a second similar userscript for another url-unshortner called based on the first since that service has 100/day request limit

Code:
// ==UserScript==
// @name         Open Destination URL on unshorten.it
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  Open Destination URL on unshorten.it
// @author       You
// @match        https://unshorten.it/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    // Function to check if element is present and execute replacement logic
    function checkAndLoad() {
        // Select the destination URL paragraph
        var destinationUrlElement = document.querySelector('#destination-url p.data');

        if (destinationUrlElement) {
            console.log("Found destination URL element");

            // Extract the destination URL from the paragraph text content
            var destinationUrl = destinationUrlElement.textContent.trim();

            console.log("Destination URL:", destinationUrl);

            // Check if it's a valid URL with protocol (http or https)
            if (/^https?:\/\//i.test(destinationUrl)) {
                console.log("Valid protocol found in destination URL:", destinationUrl);

                // Load this destination URL in same window's address bar
                window.location.href = destinationUrl;

                console.log("Redirecting to valid protocol-based destination URL:", destinationUrl);

                // Remove interval since we've found and processed elements
                clearInterval(interval);
            } else {
                console.log("Invalid protocol found in destination URL:", destinationUrl);
            }
        }
    }

    // Check every second for presence of required elements
    var interval = setInterval(checkAndLoad, 1000);
})();

image.png

edit 2: wasn't able to create a redirector rule for the second service :(
 
Last edited:

bnew

Veteran
Joined
Nov 1, 2015
Messages
57,175
Reputation
8,456
Daps
159,745
made another bookmarklet for a huggingface.co repo.. started off with llama 3.1 sonar large 129K chat but the final code couldn't generate commands for inks found in folders.. gave it to sonnet 3.5 to fix and it did so on the first try. i use this instead of git on really large repos for better resume support.

Here's a layman's explanation of what this code does when run on a Hugging Face repository:

1. Link Finding:
The code searches the webpage for links to files and folders in the Hugging Face repository.

2. Folder Exploration:
When it finds a folder, it looks inside that folder for more files and subfolders.

3. Comprehensive Search:
It keeps searching through all folders and subfolders until it has found all the downloadable files.

4. List Creation:
As it finds files, it adds them to a list.

5. Command Writing:
Once it has all the files, it writes download commands for two programs: wget and aria2c.
a
6. URL Cleaning:
It removes unnecessary parts from the file URLs to make the download process smoother.

7. Folder Structure Preservation:
The commands it creates will download files into the same folder structure as on the website.

8. Clipboard Copy:
After creating all the commands, it copies them to your computer's clipboard.

9. User Notification:
It tells you when it's done and if there were any problems.

In summary, this code automates the process of finding all downloadable files in a Hugging Face repository, including those in subfolders, and creates easy-to-use download commands for you.



```
Found direct download link: /black-forest-labs/FLUX.1-dev/resolve/main/.gitattributes?download=true
VM1492:10 Found direct download link: /black-forest-labs/FLUX.1-dev/resolve/main/LICENSE.md?download=true
VM1492:10 Found direct download link: /black-forest-labs/FLUX.1-dev/resolve/main/README.md?download=true
VM1492:10 Found direct download link: /black-forest-labs/FLUX.1-dev/resolve/main/ae.sft?download=true
VM1492:10 Found direct download link: /black-forest-labs/FLUX.1-dev/resolve/main/dev_grid.jpg?download=true
VM1492:10 Found direct download link: /black-forest-labs/FLUX.1-dev/resolve/main/flux1-dev.sft?download=true
VM1492:10 Found direct download link: /black-forest-labs/FLUX.1-dev/resolve/main/model_index.json?download=true
VM1492:21 Fetching folder links from: /black-forest-labs/FLUX.1-dev/tree/main/scheduler
VM1492:21 Fetching folder links from: /black-forest-labs/FLUX.1-dev/tree/main/text_encoder
VM1492:21 Fetching folder links from: /black-forest-labs/FLUX.1-dev/tree/main/text_encoder_2
VM1492:21 Fetching folder links from: /black-forest-labs/FLUX.1-dev/tree/main/tokenizer
VM1492:21 Fetching folder links from: /black-forest-labs/FLUX.1-dev/tree/main/tokenizer_2
VM1492:21 Fetching folder links from: /black-forest-labs/FLUX.1-dev/tree/main/transformer
VM1492:21 Fetching folder links from: /black-forest-labs/FLUX.1-dev/tree/main/vae
undefined
VM1492:34 Received HTML for: /black-forest-labs/FLUX.1-dev/tree/main/tokenizer
VM1492:43 Found direct download link in folder: /black-forest-labs/FLUX.1-dev/resolve/main/tokenizer/merges.txt?download=true
VM1492:43 Found direct download link in folder: /black-forest-labs/FLUX.1-dev/resolve/main/tokenizer/special_tokens_map.json?download=true
VM1492:43 Found direct download link in folder: /black-forest-labs/FLUX.1-dev/resolve/main/tokenizer/tokenizer_config.json?download=true
VM1492:43 Found direct download link in folder: /black-forest-labs/FLUX.1-dev/resolve/main/tokenizer/vocab.json?download=true
VM1492:34 Received HTML for: /black-forest-labs/FLUX.1-dev/tree/main/text_encoder
VM1492:34 Received HTML for: /black-forest-labs/FLUX.1-dev/tree/main/transformer
VM1492:43 Found direct download link in folder: /black-forest-labs/FLUX.1-dev/resolve/main/transformer/config.json?download=true
VM1492:43 Found direct download link in folder: /black-forest-labs/FLUX.1-dev/resolve/main/transformer/diffusion_pytorch_model-00001-of-00003.safetensors?download=true
VM1492:43 Found direct download link in folder: /black-forest-labs/FLUX.1-dev/resolve/main/transformer/diffusion_pytorch_model-00002-of-00003.safetensors?download=true
VM1492:43 Found direct download link in folder: /black-forest-labs/FLUX.1-dev/resolve/main/transformer/diffusion_pytorch_model-00003-of-00003.safetensors?download=true
VM1492:43 Found direct download link in folder: /black-forest-labs/FLUX.1-dev/resolve/main/transformer/diffusion_pytorch_model.safetensors.index.json?download=true

VM1492:93 All links fetched. Generating commands...
VM1492:80 Generated command for: /black-forest-labs/FLUX.1-dev/resolve/main/.gitattributes?download=true
VM1492:80 Generated command for: /black-forest-labs/FLUX.1-dev/resolve/main/LICENSE.md?download=true
VM1492:80 Generated command for: /black-forest-labs/FLUX.1-dev/resolve/main/README.md?download=true
VM1492:80 Generated command for: /black-forest-labs/FLUX.1-dev/resolve/main/ae.sft?download=true
VM1492:80 Generated command for: /black-forest-labs/FLUX.1-dev/resolve/main/dev_grid.jpg?download=true
VM1492:80 Generated command for: /black-forest-labs/FLUX.1-dev/resolve/main/flux1-dev.sft?download=true
VM1492:80 Generated command for: /black-forest-labs/FLUX.1-dev/resolve/main/model_index.json?download=true
VM1492:80 Generated command for: /black-forest-labs/FLUX.1-dev/resolve/main/tokenizer/merges.txt?download=true
VM1492:80 Generated command for: /black-forest-labs/FLUX.1-dev/resolve/main/tokenizer/special_tokens_map.json?download=true
VM1492:80 Generated command for: /black-forest-labs/FLUX.1-dev/resolve/main/tokenizer/tokenizer_config.json?download=true
VM1492:80 Generated command for: /black-forest-labs/FLUX.1-dev/resolve/main/tokenizer/vocab.json?download=true
VM1492:80 Generated command for: /black-forest-labs/FLUX.1-dev/resolve/main/transformer/config.json?download=true
VM1492:80 Generated command for: /black-forest-labs/FLUX.1-dev/resolve/main/transformer/diffusion_pytorch_model-00001-of-00003.safetensors?download=true
VM1492:80 Generated command for: /black-forest-labs/FLUX.1-dev/resolve/main/transformer/diffusion_pytorch_model-00002-of-00003.safetensors?download=true
VM1492:80 Generated command for: /black-forest-labs/FLUX.1-dev/resolve/main/transformer/diffusion_pytorch_model-00003-of-00003.safetensors?download=true
VM1492:80 Generated command for: /black-forest-labs/FLUX.1-dev/resolve/main/transformer/diffusion_pytorch_model.safetensors.index.json?download=true
VM1492:98 Commands generated. Copying to clipboard...

output:
wget -c "https://huggingface.co/black-forest-labs/FLUX.1-dev/resolve/main/.gitattributes" -O ".gitattributes"
wget -c "https://huggingface.co/black-forest-labs/FLUX.1-dev/resolve/main/LICENSE.md" -O "LICENSE.md"
wget -c "https://huggingface.co/black-forest-labs/FLUX.1-dev/resolve/main/README.md" -O "README.md"
wget -c "https://huggingface.co/black-forest-labs/FLUX.1-dev/resolve/main/ae.sft" -O "ae.sft"
wget -c "https://huggingface.co/black-forest-labs/FLUX.1-dev/resolve/main/dev_grid.jpg" -O "dev_grid.jpg"
wget -c "https://huggingface.co/black-forest-labs/FLUX.1-dev/resolve/main/flux1-dev.sft" -O "flux1-dev.sft"
wget -c "https://huggingface.co/black-forest-labs/FLUX.1-dev/resolve/main/model_index.json" -O "model_index.json"
wget -c "https://huggingface.co/black-forest-labs/FLUX.1-dev/resolve/main/tokenizer/merges.txt" -O "tokenizer/merges.txt"
wget -c "https://huggingface.co/black-forest-labs/FLUX.1-dev/resolve/main/tokenizer/special_tokens_map.json" -O "tokenizer/special_tokens_map.json"
wget -c "https://huggingface.co/black-forest-labs/FLUX.1-dev/resolve/main/tokenizer/tokenizer_config.json" -O "tokenizer/tokenizer_config.json"
wget -c "https://huggingface.co/black-forest-labs/FLUX.1-dev/resolve/main/tokenizer/vocab.json" -O "tokenizer/vocab.json"
wget -c "https://huggingface.co/black-forest-labs/FLUX.1-dev/resolve/main/transformer/config.json" -O "transformer/config.json"
wget -c "https://huggingface.co/black-forest...sion_pytorch_model-00001-of-00003.safetensors" -O "transformer/diffusion_pytorch_model-00001-of-00003.safetensors"
wget -c "https://huggingface.co/black-forest...sion_pytorch_model-00002-of-00003.safetensors" -O "transformer/diffusion_pytorch_model-00002-of-00003.safetensors"
wget -c "https://huggingface.co/black-forest...sion_pytorch_model-00003-of-00003.safetensors" -O "transformer/diffusion_pytorch_model-00003-of-00003.safetensors"
wget -c "https://huggingface.co/black-forest...iffusion_pytorch_model.safetensors.index.json" -O "transformer/diffusion_pytorch_model.safetensors.index.json"
wget -c "https://huggingface.co/black-forest-labs/FLUX.1-dev/resolve/main/vae/config.json" -O "vae/config.json"
wget -c "https://huggingface.co/black-forest.../main/vae/diffusion_pytorch_model.safetensors" -O "vae/diffusion_pytorch_model.safetensors"
wget -c "https://huggingface.co/black-forest-labs/FLUX.1-dev/resolve/main/scheduler/scheduler_config.json" -O "scheduler/scheduler_config.json"


aria2c -c -x15 "https://huggingface.co/black-forest-labs/FLUX.1-dev/resolve/main/.gitattributes" -o ".gitattributes"
aria2c -c -x15 "https://huggingface.co/black-forest-labs/FLUX.1-dev/resolve/main/LICENSE.md" -o "LICENSE.md"
aria2c -c -x15 "https://huggingface.co/black-forest-labs/FLUX.1-dev/resolve/main/README.md" -o "README.md"
aria2c -c -x15 "https://huggingface.co/black-forest-labs/FLUX.1-dev/resolve/main/ae.sft" -o "ae.sft"
aria2c -c -x15 "https://huggingface.co/black-forest-labs/FLUX.1-dev/resolve/main/dev_grid.jpg" -o "dev_grid.jpg"
aria2c -c -x15 "https://huggingface.co/black-forest-labs/FLUX.1-dev/resolve/main/flux1-dev.sft" -o "flux1-dev.sft"
aria2c -c -x15 "https://huggingface.co/black-forest-labs/FLUX.1-dev/resolve/main/model_index.json" -o "model_index.json"
aria2c -c -x15 "https://huggingface.co/black-forest-labs/FLUX.1-dev/resolve/main/tokenizer/merges.txt" -o "tokenizer/merges.txt"
aria2c -c -x15 "https://huggingface.co/black-forest-labs/FLUX.1-dev/resolve/main/tokenizer/special_tokens_map.json" -o "tokenizer/special_tokens_map.json"
aria2c -c -x15 "https://huggingface.co/black-forest-labs/FLUX.1-dev/resolve/main/tokenizer/tokenizer_config.json" -o "tokenizer/tokenizer_config.json"
aria2c -c -x15 "https://huggingface.co/black-forest-labs/FLUX.1-dev/resolve/main/tokenizer/vocab.json" -o "tokenizer/vocab.json"
aria2c -c -x15 "https://huggingface.co/black-forest-labs/FLUX.1-dev/resolve/main/transformer/config.json" -o "transformer/config.json"
aria2c -c -x15 "https://huggingface.co/black-forest...sion_pytorch_model-00001-of-00003.safetensors" -o "transformer/diffusion_pytorch_model-00001-of-00003.safetensors"
aria2c -c -x15 "https://huggingface.co/black-forest...sion_pytorch_model-00002-of-00003.safetensors" -o "transformer/diffusion_pytorch_model-00002-of-00003.safetensors"
aria2c -c -x15 "https://huggingface.co/black-forest...sion_pytorch_model-00003-of-00003.safetensors" -o "transformer/diffusion_pytorch_model-00003-of-00003.safetensors"
aria2c -c -x15 "https://huggingface.co/black-forest...iffusion_pytorch_model.safetensors.index.json" -o "transformer/diffusion_pytorch_model.safetensors.index.json"
aria2c -c -x15 "https://huggingface.co/black-forest-labs/FLUX.1-dev/resolve/main/vae/config.json" -o "vae/config.json"
aria2c -c -x15 "https://huggingface.co/black-forest.../main/vae/diffusion_pytorch_model.safetensors" -o "vae/diffusion_pytorch_model.safetensors"
aria2c -c -x15 "https://huggingface.co/black-forest-labs/FLUX.1-dev/resolve/main/scheduler/scheduler_config.json" -o "scheduler/scheduler_config.json"
 
Last edited:

bnew

Veteran
Joined
Nov 1, 2015
Messages
57,175
Reputation
8,456
Daps
159,745
found a usersript here and decided to fork it for use on thecoli using llama-3.1-sonar-large-128k-chat and claude sonnet 3.5


or



default:
1lyBEDq.png


after you click on the button:
MB2ZSFU.gif


after you open the smiley menu, you have to click inside the form field to get the blinking cursor than click on the smiley to insert.


you can add your own preferred urls to the userscript too using the same url format thats easy to follow .. use chatgpt/LLM if you want to add multiple smilie urls and format it the way as seen in the userscript.


A.I generated:

Summary​

  1. Smiley Collection:
    • The script gathers a list of URLs for various smiley images.
  2. Container Creation:
    • It creates a container (a div element) where these smiley images will be displayed.
    • This container is initially hidden and can be toggled on and off using a "Show/hide Smilies" button.
  3. Display Settings:
    • The container is set to display at least three rows of smileys by default.
    • It is also made scrollable if there are more than three rows of smileys.
  4. Lazy Loading:
    • Instead of loading all the smiley images immediately, they are loaded only when the container becomes visible.
      • Initially, placeholder images are used.
      • When you click the "Show/hide Smilies" button to show the container, the actual smiley images are loaded.
  5. Insertion Functionality:
    • When you click on a smiley image, it inserts that image into the editable text area where you are typing.
  6. Toggle Button:
    • The "Show/hide Smilies" button allows you to show or hide the smiley container.
      • When you click this button to show the container, it loads the actual smiley images.
  7. Integration:
    • The script inserts the toggle button and the smiley container above or below the first editable field on the page, ensuring it does not interfere with the content editable area.

Key Points​

  • Lazy Loading: Smiley images are loaded only when needed (when you show the container), improving performance.
  • Rows and Scrollability: The container maintains its initial height and allows scrolling if there are many smileys.
  • Toggle Button: Easily show or hide the smiley container using a button.
  • Insertion: Clicking on a smiley image inserts it into your editable text area.
This setup enhances user experience by providing an easy way to insert various smileys while optimizing performance through lazy loading.

edit:

YIKES! I didn't do a thorough enough bug test. I think it's looks to insert the show/hide button under the first input field it finds. 😬

X4ueeIJ.png
 
Last edited:

bnew

Veteran
Joined
Nov 1, 2015
Messages
57,175
Reputation
8,456
Daps
159,745
generated another userscript for use on the coli to basically replace .mp4 , .webm and m3u8 video links and embed a html5 video player that plays those links. the @match coul be modified to support any other site too.

used llama-3-sonar-large-32k-chat

TEXT IN ORIGINAL POST...


updated the script using Llama 3.1 405B on to improve the video fitting into the screen,before some video dimension made it so that you needed to scroll the video.




screenshot:
fhJcduv.png


test:

 
Last edited:

Macallik86

Superstar
Supporter
Joined
Dec 4, 2016
Messages
6,571
Reputation
1,468
Daps
21,503
Probably one of the few groups of posters that will notice, but the website is now inserting trackers into outgoing links in a way that isn't noticeable when hovering on a link. Case in point I made this post with a CNN article:
The link has a clean URL when I hover over it:
GclZxzY.png

Yet has the complete thread URL inserted into it when clicked on it:
Gvkan2o.png


Someone suddenly tracking engagement on which threads get the most outgoing websites visits during political season seems questionable... The conspiracy theorist in me is wondering whether that's why there's so much pro-Trump/anti-Kamala content in TLR :jbhmm:
 

Macallik86

Superstar
Supporter
Joined
Dec 4, 2016
Messages
6,571
Reputation
1,468
Daps
21,503
Dug deeper. It's called link cloaking... using javascript to intercepts clicks and redirect to a website that at the least has an affiliate code.

Many companies got blowback for it back in the day:

Inserting JavaScript into clean links means I literally can't verify any outgoing links across the entire website. The intrusive pop ups were never an issue for me due to ad blockers, but now it's veering into privacy territory imo.

Even all the links in this post have trackers in them smh. I tried right clicking and pasting in a new tab, as well as using the clearURLs extension but neither work. @bnew let me know if you know anything that strips this bullsh1t or if I should start winding down and looking for greener pastures.
 

bnew

Veteran
Joined
Nov 1, 2015
Messages
57,175
Reputation
8,456
Daps
159,745
took me a while to figure this out because a domain(bluesky.lol) I was using in my main userscript for this site broke/redirected so maybe someone will stumble upon this and find it helpful. converts bluesky/bksy username to DID and detects DID links. uses a CORS proxy https://api.allorigins.win/raw?url= too
used llama 3.1 sonar large to create a bookmarklet and a userscript that only embeds Bluesky posts, you can simplify the code significantly. Here are the two versions:

Bookmarklet​

A bookmarklet is a small piece of JavaScript code that can be saved as a bookmark in your browser. When clicked, it will execute the code on the current page.

** updated on 9/13/24 to fix/adjust height of iframe dynamically.


Userscript​

A userscript is a script that runs on specific web pages, usually managed by extensions like Tampermonkey or Greasemonkey.

** updated to fix/adjust height of iframe dynamically.


How to Use​


  1. Bookmarklet:
    • Copy the bookmarklet code.
    • Create a new bookmark in your browser.
    • Paste the code into the URL field of the bookmark.
    • Save it and click on it whenever you want to embed Bluesky posts on a page.
  2. Userscript:
    • Install Tampermonkey or Greasemonkey extension in your browser.
    • Create a new script by clicking on the extension icon and selecting "Create a new script".
    • Paste the userscript code into the editor.
    • Save it and reload any page where you want to embed Bluesky posts.
Both versions will automatically detect links to Bluesky posts and replace them with embedded iframes.

Bookmarklet and Userscript: Bluesky Post Embedder
  1. Purpose:
    • These tools help you embed Bluesky social media posts directly into web pages, making them easier to view without leaving the page.
  2. How it Works:
    • Bookmarklet: You save a small piece of code as a bookmark. When you click this bookmark on any webpage, it scans for links to Bluesky posts and replaces those links with embedded versions of the posts.
    • Userscript: You install a script using an extension like Tampermonkey or Greasemonkey. This script automatically detects and embeds Bluesky posts on any webpage you visit.
  3. What it Does:
    • Detects Links: It finds links to Bluesky posts on the webpage.
    • Embeds Posts: It replaces these links with interactive iframes that display the full content of the Bluesky post right on the page.
    • Handles Dynamic Content: If new content is loaded dynamically (like when you scroll down), it continues to detect and embed new Bluesky post links.
  4. Benefits:
    • You can see Bluesky posts directly within your forum or discussion board without having to open a new tab.
    • It enhances your browsing experience by integrating social media content seamlessly into your current page.
In simple terms, these tools make it easy to view Bluesky social media content directly within web pages, saving you time and effort.
 
Last edited:

Kamikaze Revy

Bwana ni mwokozi wangu
Supporter
Joined
Sep 4, 2012
Messages
29,806
Reputation
9,425
Daps
76,404
Reppin
Outer Heaven
Dug deeper. It's called link cloaking... using javascript to intercepts clicks and redirect to a website that at the least has an affiliate code.

Many companies got blowback for it back in the day:

Inserting JavaScript into clean links means I literally can't verify any outgoing links across the entire website. The intrusive pop ups were never an issue for me due to ad blockers, but now it's veering into privacy territory imo.

Even all the links in this post have trackers in them smh. I tried right clicking and pasting in a new tab, as well as using the clearURLs extension but neither work. @bnew let me know if you know anything that strips this bullsh1t or if I should start winding down and looking for greener pastures.
:wtf:What in the blue hell is going on here?
 
Top