The Official Power User Tips, Tricks & Productivity Thread

bnew

Veteran
Joined
Nov 1, 2015
Messages
63,201
Reputation
9,642
Daps
172,879
updated the image collector v1.2.4
now also toggles to 'show only images' .
de-duplicate images.
undo/redo functionality.
download button.
resizable window.
click image to scroll option


zrOqYxN.png


 

bnew

Veteran
Joined
Nov 1, 2015
Messages
63,201
Reputation
9,642
Daps
172,879
The provided JavaScript code is a bookmarklet designed to copy Reddit post content to BBCode format, which is commonly used in forums like XenForo. Here's a detailed summary of what it does and how it works on both new.reddit.com and old.reddit.com:

Functionality Overview​

  1. BBCode Conversion: The script converts HTML content from Reddit posts into BBCode format. This includes converting links, images, bold, italic, and strikethrough text into their respective BBCode equivalents.
  2. Code Block Handling: It handles code blocks by converting them into BBCode [code] or [icode] tags based on the content's complexity.
  3. Image Link Handling: The script identifies links that end with image file extensions and handles them appropriately.
  4. Copy Button Creation: For each post or comment, it creates a copy button. When clicked, this button copies the post content in BBCode format, along with a permalink to the comment, to the clipboard.
  5. Spoiler Tags: The copied content is wrapped in spoiler tags to conceal it until clicked.

Detailed Explanation​

BBCode Conversion​

  • Links: Converts HTML links (<a href="link">text</a>) to BBCode format ([u][url]link[/url][/u]).
  • Images: Converts HTML images (<img src="image_url">) to BBCode format ([img]image_url[/img]).
  • Bold, Italic, Strikethrough: Converts HTML bold (<b>text</b>), italic (<i>text</i>), and strikethrough (<s>text</s>) to BBCode (text, [i]text[/i], [s]text[/s]).

Code Block Handling​

  • Identifies code blocks within the HTML content.
  • If a code block is short or contains no newline characters, it is converted to content; otherwise, it is converted to [code]content[/code].

Image Link Handling​

  • Checks links for image file extensions (e.g., .jpg, .png, .jpeg, .webp, .gif, .pnj).
  • If a link ends with these extensions, it is handled as an image link.

Copy Button Creation​

  • Creates a green copy button (📋) next to each post or comment.
  • When clicked, it extracts the post content, converts it to BBCode, and copies it to the clipboard along with the permalink.

Spoiler Tags​

  • Wraps the copied content in spoiler tags ([spoiler="text"]content[/spoiler]) to hide it until clicked.

Compatibility with New and Old Reddit​

The script should work on both new.reddit.com and old.reddit.com, as it targets generic HTML elements that are present in both versions. However, the exact functionality might vary slightly depending on differences in HTML structure between the two versions.
  • New Reddit: The script should work seamlessly, as new Reddit uses modern HTML structures that the script is designed to handle.
  • Old Reddit: The script might require slight adjustments if old Reddit uses significantly different HTML structures for posts and comments. However, the core functionality should remain intact.
Overall, this bookmarklet simplifies the process of copying Reddit content into a format suitable for forums that use BBCode, making it easier to share content across platforms.

edit:
update fix image links inside of img bbcode tags.


[/cpoiler]


update:
2/23/2025

What the Code Does on Reddit:​

The updated bookmarklet code is designed to help users copy content from Reddit posts and comments into a BBCode format. Here's what it does in simple terms:
  1. Submission Posts:
    • Extracts the post title and any flair (like "Discussion").
    • Includes the URL of the post.
    • Extracts images from the post's gallery.
    • Copies the text content of the post.
    • Formats all this information into BBCode, which is a markup language used in forums.
  2. Comments:
    • Extracts the URL of the comment.
    • Copies the text content of the comment, including any links or images.
    • Converts the content into BBCode format.
    • Handles code blocks and inline images correctly.
  3. Copy Button:
    • Creates a button next to each post or comment.
    • When clicked, it copies the formatted content to the clipboard.
    • Displays a toast notification to confirm the copy action.

Updates from Original/Old Code:​

  1. Improved URL Extraction:
    • The new code correctly extracts the URL for submission posts by using the data-permalink attribute or the title link if necessary.
    • For comments, it uses the same logic as before but ensures the URL is correctly formatted.
  2. Gallery Image Handling:
    • The code now properly extracts images from submission post galleries without duplication.
    • It maintains the order of images as they appear in the post.
  3. Comment Processing:
    • Adopted the original logic for processing comments, which includes extracting links and images correctly.
    • Ensures that images within links are handled properly to avoid duplication.
  4. BBCode Conversion:
    • Maintains the original BBCode conversion functions but ensures they work correctly with the updated logic.
    • Handles code blocks and inline images as before.
  5. Notification System:
    • Reverted to using a non-intrusive toast notification instead of alerts.
    • This provides a more user-friendly experience by not interrupting the user with a modal dialog.
  6. Button Positioning:
    • For comments, the copy button is now positioned next to the comment content, similar to the original code.
    • For submission posts, it remains next to the post's timestamp.
Overall, the updated code improves upon the original by fixing issues with URL extraction, image handling, and notification style, while maintaining the core functionality of copying Reddit content into BBCode format.

* i deleted the link on 2/25/25 because i shared the wrong bookmarklet, this one works.


update​

3/5/10

works on www.reddit.com / new.reddit.com as well as old.reddit.com




iq40Hn5.png
 
Last edited:

bnew

Veteran
Joined
Nov 1, 2015
Messages
63,201
Reputation
9,642
Daps
172,879

Detailed Explanation of the Code’s Functionality on YouTube​


This JavaScript code is a bookmarklet designed to work on YouTube video pages. When you visit a YouTube video and activate this code, it performs a series of actions to gather specific details about the video and its associated content. After gathering this information, it formats it into a BBCode format, which is often used for forum posts or other platforms that support BBCode tags. The code then automatically copies the formatted BBCode to your clipboard, so you can easily paste it elsewhere (e.g., in a forum post).


Here’s a step-by-step breakdown of what the code does:


1. Selectors for Extracting YouTube Metadata:


The code starts by defining a set of selectors. These are CSS-style rules that target specific elements on a YouTube video page to extract data such as:


  • Title: The title of the video.
  • Channel Name: The name of the channel that uploaded the video.
  • Channel URL: A link to the channel.
  • Subscribers: The number of subscribers the channel has.
  • Likes: The number of likes the video has.
  • Description: The description text of the video.

The selectors are an array of possible CSS selectors because YouTube’s page layout might change over time, so there are different possible locations for the information.


2. Functions to Extract Data:


The code defines various functions to gather the required data:


  • getElement(selectors): This function takes a selector (or an array of selectors) and tries to find the matching element on the page. If it finds the element, it returns it.
  • getText(selectors): This function retrieves the text content of the element(s) found by getElement().
  • getNumber(text): This function extracts and cleans up numbers from a string (used to extract things like the number of subscribers or likes).
  • getVideoId(): This function grabs the video ID from the URL (which is needed to construct the video’s URL in BBCode format).
  • getDescription(): This function retrieves the video description from the page. If the description is not available, it attempts to find it from a backup source (YouTube's internal data).

3. Watching for Dynamic Content:


YouTube pages are often dynamically loaded (content is updated as you interact with the page), so the script uses a MutationObserver. This keeps an eye on changes in the page and automatically runs the script to extract metadata whenever the page’s elements (like the video title) are loaded or updated.


4. Format Data into BBCode:


Once the data is gathered, it is formatted into BBCode, a simple markup language used for formatting text. The BBCode string includes:


  • The video title inside [b] (bold) tags.
  • A URL to the video inside [url] tags.
  • The channel name and a link to the channel inside [u] (underlined) and [url] tags.
  • Subscriber count and like count are also included.
  • The description is included inside a [spoiler] tag, so it’s hidden by default (spoiler tags allow you to hide content until the user decides to reveal it).

5. Copying to Clipboard:


After creating the BBCode string, the code automatically copies it to your clipboard using a temporary <textarea> element (instead of an <input>, which would flatten newlines into spaces). This allows you to paste the BBCode anywhere, preserving the structure and line breaks.


6. Displaying a Toast Notification:


After the BBCode is copied, a small toast notification appears on the screen, telling you that the data has been copied successfully. This message typically disappears after a few seconds.


7. Conditions:


The code checks if you are on a YouTube video page (window.location.hostname === 'www.youtube.com'). If you’re not on a YouTube page, it will show an alert prompting you to use the bookmarklet on a valid YouTube video.


8. Fallback for Missing Description:


If the video description is missing or the primary method of extracting it fails, the code tries to fetch the description from YouTube’s internal JSON response (ytInitialPlayerResponse). This ensures that even if the normal description is unavailable, the code still has a chance to get it.




What Does the Code Do?​


  • Collects Metadata from YouTube Video:
    • The script looks for the title, channel name, channel URL, number of subscribers, likes, and description of the video.
  • Formats Information in BBCode:
    • It then puts all of this information into a pre-defined BBCode format. This includes bold and underlined tags, URLs, and a spoiler tag for the description.
  • Copies to Clipboard:
    • After formatting the data, the script automatically copies it to your clipboard so that you can paste it into a forum, chat, or anywhere else that supports BBCode.
  • Notifications & Feedback:
    • A small notification (toast) tells you when the data has been successfully copied.



Example Output (BBCode):​


Assuming you run the bookmarklet on a YouTube video page, the BBCode generated would look like this:

Code:
[b]Video Title[/b]
[url=https://www.youtube.com/watch?v=abcd1234]https://www.youtube.com/watch?v=abcd1234[/url]

[b]Channel Info[/b]
[u][url=https://www.youtube.com/channel/xyz]Channel Name[/url][/u]
Subscribers: 1,234

[b]Engagement[/b]
👍 Likes: 5,678

[b]Description[/b]
[spoiler]First paragraph of description.

Second paragraph of description.

Third paragraph of description.[/spoiler]


Summary:​


This script is a helpful tool for quickly extracting detailed metadata from a YouTube video page and formatting it in a BBCode format. It simplifies the process of collecting and sharing information about YouTube videos, particularly useful for forums or online platforms that use BBCode for post formatting. By wrapping the description in a [spoiler] tag, it ensures that long descriptions are hidden by default and only revealed when the user clicks to view them.

2/21/2025


edit:
3/23/2025

UPDATE to V2​


Here's a changelog detailing the differences between V1 and V2 of the bookmarklet:
  1. getElement function:
    • Changed from using Array.from().reduce() to a simple for loop for better readability and potentially better performance.
  2. Added new utility functions:
    • sanitizeBBCode: Removes dollar signs from text to prevent BBCode formatting issues.
    • truncate: Limits text length to prevent overly long descriptions.
  3. getDescription function:
    • Changed line break handling to replace multiple consecutive line breaks with a single double line break.
    • Added trim() to remove leading/trailing whitespace.
    • Applied truncate function to the final description.
  4. Added getChannelUrl function:
    • Provides a more robust method to extract and validate channel URLs.
  5. Added waitForElement function:
    • Replaces observeElement with a more flexible function that includes a timeout.
  6. processMetadata function:
    • Wrapped in a try-catch block for better error handling.
    • Applied sanitizeBBCode to title, channel name, and description.
    • Used getChannelUrl function for channel URL extraction.
    • Added fallback "Not available" for subscribers if not found.
    • Changed BBCode formatting:
      • Removed extra spaces and newlines for cleaner output.
      • Stopped splitting and rejoining description lines, using the cleaned-up description directly.
  7. Main execution:
    • Replaced observeElement with waitForElement for title detection.
    • Added error handling if the title element fails to load.
These changes aim to improve the robustness, error handling, and output formatting of the bookmarklet, addressing potential issues with different YouTube page layouts and content types.



edit:
update
V2.1

doesn't truncate title or description to 500 characters

 
Last edited:

bnew

Veteran
Joined
Nov 1, 2015
Messages
63,201
Reputation
9,642
Daps
172,879
made a version of the script i was using to add x.com / twitter mirrors to search results to work on Reddit:
* used deepseek-R1 - perplexity finetune R1 1776


Purpose​

The userscript and bookmarklet are designed to enhance your Reddit browsing experience by adding mirror links next to Twitter and X (formerly Twitter) URLs found in comments on Old Reddit.

Functionality​

  1. Detection of Twitter/X URLs: Both tools scan through the text of Reddit comments to find links pointing to Twitter or X. They look for URLs that contain "twitter.com" or "x.com" in them.
  2. Adding Mirror Links: Once a Twitter/X URL is detected, the tools create additional links next to it. These mirror links point to alternative platforms that mirror the content of the original Twitter/X post. The mirror platforms used are:
    • Twiiit
    • Nitter (hosted at nitter.poast.org)
    • Xcancel
    • Twstalker
  3. Mirror Link Display: The mirror links are displayed in a small text format next to the original link. They are styled to be less prominent than the original link but are easily clickable. Each mirror link opens in a new tab when clicked.
  4. Handling Dynamic Content: Both the userscript and bookmarklet use a technique called MutationObserver to automatically detect and process new comments that are loaded dynamically. This means that even if you scroll down and more comments load, the tool will automatically add mirror links to any new Twitter/X URLs it finds.
  5. Compatibility and Usage:
    • Userscript: This is a script that runs automatically on Old Reddit pages that match the specified pattern (https://old.reddit.com/r/*/comments/*). It requires a userscript manager like Tampermonkey or Greasemonkey to be installed in your browser.
    • Bookmarklet: This is a bookmark that contains JavaScript code. When clicked, it runs the same functionality as the userscript but only once per click. It does not require any additional browser extensions to work.

Benefits​

  • Enhanced Accessibility: Provides alternative ways to view Twitter/X content without leaving Reddit.
  • Privacy and Tracking: Using mirror sites can help reduce tracking by Twitter/X.
  • Convenience: Quickly access mirrored content without navigating away from Reddit.

Limitations​

  • Manual Invocation (Bookmarklet): Unlike the userscript, which runs automatically, the bookmarklet requires manual clicking to activate.
  • Observer Behavior: In the bookmarklet, if clicked multiple times, it might add multiple observers, which could lead to performance issues. However, this is less likely to be a problem in practice.
Overall, these tools aim to make it easier for Reddit users to engage with Twitter/X content through alternative platforms directly from within Reddit comments.


7VOpJgD.png


edit:
updated it to support nested links as text with image hyperlinks and better processing of large threads.


2/2/05
 
Last edited:

bnew

Veteran
Joined
Nov 1, 2015
Messages
63,201
Reputation
9,642
Daps
172,879
* used deepseek-R1 - perplexity finetune R1 1776

RESTORE Missing or broken Scrollbar on webpages.


Here's a detailed summary of what the bookmarklet code does on webpages, explained in simple terms:

What is a Bookmarklet?​

A bookmarklet is a special kind of bookmark that contains JavaScript code instead of a website URL. When you click on it, the JavaScript code runs on the current webpage, allowing you to modify or interact with the page in various ways123.

What Does the Code Do?​

The specific bookmarklet code you're using is designed to restore scrolling functionality on webpages where scrolling might be disabled or hidden. Here's a breakdown of its actions:

1. Injects CSS Styles

  • The code adds new CSS styles to the webpage. These styles are designed to override existing styles that might be preventing scrolling.
  • It sets overflow: auto on the <html> and <body> elements, which means if there's more content than fits on the screen, scrollbars should appear.
  • It also targets other common container elements (like .container, .wrapper, .content) to ensure they allow scrolling if needed.

2. Resets Element Positions

  • Some elements might be positioned outside the normal flow (e.g., position: fixed or position: absolute). The code resets these elements to position: static, which means they will contribute to the page's scroll height.

3. Forces Layout Recalculation

  • After making these changes, the code forces the browser to recalculate the layout of the page. This ensures that any changes to element positions or sizes are properly updated.

4. Adds Event Listeners

  • The code adds event listeners to prevent JavaScript on the webpage from interfering with scrolling. It listens for wheel and touchmove events and stops them from propagating if they might block scrolling.

5. Provides Debugging Information

  • The code logs messages to the browser console to help diagnose issues. It shows whether the CSS was injected, dimensions of the body, and other useful information.

Why It Might Not Work

Even with these actions, the code might not work if:
  • The webpage uses complex JavaScript to dynamically alter styles or layout after the bookmarklet runs.
  • There are nested iframes or shadow DOMs that the bookmarklet doesn't target.
  • The site's CSS uses important rules that override the bookmarklet's styles.

Conclusion

In summary, this bookmarklet is a tool to help restore scrolling functionality on webpages by overriding problematic CSS styles and ensuring elements contribute to the page's scroll height. However, its effectiveness can vary depending on the complexity of the webpage's design and JavaScript interactions.

 
Last edited:

bnew

Veteran
Joined
Nov 1, 2015
Messages
63,201
Reputation
9,642
Daps
172,879
TikTok Metadata Extractor

The userscript for TikTok is designed to enhance the user experience by adding a convenient feature to extract and copy video metadata. Here's a detailed summary of what it does:

What the Userscript Does​

  1. Adds a Button: The script inserts a new button labeled "Copy Metadata" next to the existing "Follow" button on a TikTok video page.
  2. Extracts Video Metadata: When you click the button, it extracts several key pieces of information from the video page:
    • Video Title: The title of the video.
    • Creator's Name: The username of the person who posted the video.
    • Creator's URL: A link to the creator's TikTok profile.
    • Like Count: The number of likes the video has received.
    • Comment Count: The number of comments on the video.
    • Share Count: The number of times the video has been shared.
  3. Formats Metadata: The extracted metadata is formatted into a structured text format, often using BBCode, which is commonly used in forums and other online platforms.
  4. Copies to Clipboard: Once the metadata is formatted, it is copied to your clipboard. This allows you to easily paste the information into a message, document, or anywhere else you need it.
  5. Displays a Notification: After copying the metadata, the script shows a brief notification to confirm that the data has been copied successfully.

How It Works​

  1. Automatic Button Insertion: The script uses a MutationObserver to wait for the necessary elements to load on the page before inserting the button. This ensures the button appears even if the page content loads dynamically.
  2. Dynamic Content Handling: The script is designed to handle TikTok's dynamic content loading, ensuring that the button is added correctly even if the page updates after initial load.
  3. Selector Verification: The script uses specific CSS selectors to target elements on the page. If TikTok updates their class names, these selectors might need to be updated to ensure the script continues working.
  4. Error Handling: The script includes basic error handling, such as displaying notifications, but does not handle complex errors like network issues or API rate limits.

Benefits​

  • Convenience: Saves time by automatically extracting and formatting metadata.
  • Sharing: Makes it easy to share video information in forums or social media platforms that support BBCode.
  • Organization: Helps organize metadata efficiently for documentation or tracking purposes.

Limitations​

  • TikTok API Integration: Does not use the TikTok API, so it does not require an access token or API setup.
  • Dynamic Content Issues: May not work if TikTok significantly changes their page structure or class names.
  • Browser Compatibility: Should work in most modern browsers but might require adjustments for older browsers.
Overall, the userscript provides a convenient way to extract and share TikTok video metadata without needing to manually copy and format the information.


PB8fw90.png


example output:
Code:
[b]sing along while we play a game[/b]

[url=https://www.tiktok.com/@squidgamenetflix/video/7454352415546952990]https://www.tiktok.com/@squidgamenetflix/video/7454352415546952990[/url]

[b]Creator Info[/b]
[u][url=https://www.tiktok.com/@squidgamenetflix]squidgamenetflix[/url][/u]

[b]Engagement[/b]
Likes: 16.2M
Comments: 7.4M
Shares: 467.5K

Bookmarklet:




userscript:

This updated version will now properly maintain your custom "Copy Metadata" button even when navigating between videos through TikTok's dynamic page updates.



2/22/2025
 
Last edited:

bnew

Veteran
Joined
Nov 1, 2015
Messages
63,201
Reputation
9,642
Daps
172,879
* used deepseek-R1 - perplexity finetune R1 1776

**doesn't get the replies to comments :(

The bookmarklet you're referring to is designed to extract comments from a TikTok video page and format them into a specific BBCode structure. Here's a detailed summary of what it does:

What the Bookmarklet Does:​

  1. Extracts Comments: The bookmarklet scans the TikTok video page for comments. It looks for elements with specific classes that contain comment text, usernames, timestamps, and other relevant information.
  2. Formats Comments into BBCode: It takes the extracted information and formats it into a BBCode structure. This includes:
    • Username: The username of the commenter is linked to their TikTok profile.
    • Comment Text: The actual text of the comment.
    • Timestamp: The time when the comment was posted.
    • Replies: If a comment has replies, they are indented under the parent comment.
  3. Copies to Clipboard: Once all comments are formatted, the bookmarklet copies the BBCode output to your clipboard. This allows you to easily paste the comments into a forum or chat platform that supports BBCode.
  4. Progress Indicator: While processing comments, a progress bar appears at the top of the page, showing how many comments have been processed out of the total. This helps you track the progress.
  5. Toast Notification: After the process is complete, a small notification appears briefly at the top of the page, confirming that the comments have been copied to your clipboard.
  6. Character Limit: The bookmarklet has a character limit (default is 7,000 characters) to prevent extremely long outputs. If the total character count exceeds this limit, the output is truncated with a "[TRUNCATED]" indicator.
  7. Handles Nested Replies: The bookmarklet can handle nested replies, meaning it will correctly indent replies to comments and replies to those replies, maintaining a clear hierarchical structure.
  8. API Fetching for Hidden Replies: If a comment has a "View X replies" button, the bookmarklet attempts to fetch those hidden replies using TikTok's API. However, this requires authentication and might not work if you're not logged in or if TikTok restricts API access.

Summary in Simple Terms:​

  • Extracts comments from a TikTok video page.
  • Formats them into BBCode with usernames linked, comment text, timestamps, and indented replies.
  • Copies the output to your clipboard.
  • Shows progress with a bar at the top.
  • Notifies completion with a brief toast message.
  • Handles nested replies and attempts to fetch hidden replies via API.
  • Truncates output if it exceeds a certain character limit.
This bookmarklet is useful for users who want to easily share or save comments from TikTok videos in a structured format.

Version 1 (With Hyperlinks):




Version 2 (No Hyperlinks):




Example Output Format:

Code:
[SPOILER="tiktok comments"]
1/30
[url=https://www.tiktok.com/@beckabravo]@Becka Bravo[/url]
“It is easier to fool a man… than it is to convince a man… that he…. has been… fooled......” 🫥 how...
2-6

   [url=https://www.tiktok.com/@blaine.star.moon]@Moonlight[/url]
   I saw the best response...
   3/12/2024

2/30  
[url=https://www.tiktok.com/@ohwejo]@Wesley Kramer-Jones[/url]
“Cognitive negotiations with reality!” Speak on it 👏👏👏
 
   [url=https://www.tiktok.com/@user819806061684]@user819806061684[/url]
   What is her thought on everything now?
   3/14/2024
[/SPOILER]
 

bnew

Veteran
Joined
Nov 1, 2015
Messages
63,201
Reputation
9,642
Daps
172,879
Since you enjoy Notepad++ for its macro, plugin, and Python scripting support via the PythonScript plugin, and you’re looking for free, lightweight alternatives with similar features, here are some text editors that might suit your needs. These options are selected for their ability to offer extensibility, macro-like functionality, and scripting support while keeping resource usage low.
  1. Sublime Text
    • Why It Fits: Sublime Text is renowned for being lightweight and fast, with a small memory footprint similar to Notepad++. It supports macros, a robust plugin ecosystem, and Python scripting via its built-in Python API. You can record macros natively and extend functionality with plugins like those available through Package Control.
    • Features:
      • Macro recording and playback (simpler than Notepad++ but extensible with Python).
      • Python-based plugin system for custom scripts (comparable to PythonScript).
      • Highly customizable with JSON configuration files and a Python console for advanced scripting.
    • Lightweight: Starts quickly and uses minimal resources, even with plugins.
    • Free Aspect: It’s technically a paid tool ($99 license), but the evaluation version is free to use indefinitely with no feature restrictions—just an occasional nag screen.
    • Platforms: Windows, macOS, Linux.
  2. Geany
    • Why It Fits: Geany is a free, open-source, lightweight text editor with IDE-like features. It supports plugins (including Python-based ones), basic macro-like automation via keybindings, and a "Send Selection to" feature that can pipe code to Python scripts.
    • Features:
      • Plugin system includes support for custom tools and commands (less extensive than Notepad++ but functional).
      • No native macro recording, but you can script repetitive tasks with external tools or plugins.
      • Built-in terminal and support for executing Python scripts directly.
    • Lightweight: Extremely low resource usage, often lighter than Notepad++.
    • Platforms: Windows, macOS, Linux.
  3. Atom
    • Why It Fits: Atom is a free, open-source editor built by GitHub. It’s highly extensible with a package system that supports JavaScript, CoffeeScript, and limited Python scripting. While it’s not as lightweight as Notepad++, it offers similar plugin and scripting capabilities.
    • Features:
      • Packages can replicate macro functionality (e.g., "script" package for running code, "macros" package for automation).
      • Custom scripts can be written in JavaScript or integrated with Python via external tools.
      • Extensive community packages (comparable to Notepad++ plugins).
    • Lightweight: Heavier than Notepad++ (built on Electron), but still reasonable for modern systems.
    • Platforms: Windows, macOS, Linux.
  4. Visual Studio Code (VS Code)
    • Why It Fits: VS Code is free, open-source, and supports a massive extension ecosystem, including Python scripting via extensions like "Python" and "Code Runner." It’s lightweight for what it offers, though slightly more resource-intensive than Notepad++.
    • Features:
      • No native macro recording, but extensions like "Macros" or "Multi-Command" enable automation.
      • Extensive Python support with debugging, linting, and scripting capabilities.
      • Plugin-like extensions rival Notepad++’s flexibility.
    • Lightweight: Built on Electron, so it’s not as lean as Notepad++, but optimized to run efficiently.
    • Platforms: Windows, macOS, Linux.
  5. CudaText
    • Why It Fits: CudaText is a free, open-source, lightweight editor designed as a Notepad++ alternative. It supports Python scripting natively via plugins and has a macro recording feature.
    • Features:
      • Macro recording and playback (similar to Notepad++).
      • Python plugin API for custom scripts (akin to PythonScript).
      • Over 200 syntax lexers and a minimal interface.
    • Lightweight: Very low resource usage, often lighter than Notepad++.
    • Platforms: Windows, macOS, Linux.

Recommendations​

  • Best Match: CudaText is the closest match to Notepad++ in terms of being free, lightweight, and offering macro recording plus Python scripting out of the box. It’s a lesser-known gem but highly capable.
  • Most Powerful: Sublime Text (evaluation mode) if you’re okay with the nag screen—it’s lightweight and has a mature Python API for scripting.
  • Middle Ground: Geany if you prioritize minimal resource use and don’t mind simpler plugin/scripting options.
Each of these editors is free (or has a free tier), supports extensibility, and can handle scripting or automation in some form. CudaText and Geany are the lightest, while Sublime Text and VS Code offer more polish and features at a slight resource cost. Give CudaText a try first if you want a direct Notepad++ replacement!
 

Heimdall

Under His Eye
Joined
Dec 13, 2019
Messages
539
Reputation
341
Daps
1,201
Trying out this userscript on YouTube atm because that site has been running like :trash: lately


(They have put some of their userscripts on GreasyFork but I went to their full collection on GitHub)
Revisiting YouTube's memory usage, I think the memory leaks in my case were due to this userscript: Login reminder popup remover (developement ceased - not up to date)

which I have now disabled (Google Shut Up! should suffice if I am ever not logged in, and I now have redirects for the other sites not covered)

edit: actually I was still seeing high memory usage on playlist pages. I think this was caused by an old version of this userscript which I have now updated: Suppress YouTube Playlist links

The one in the quote is still necessary... maybe? I'm still using it atm anyway

edit2: actually no, I'm now using these two userscripts from the same person:


Another userscript I have been enjoying:

Lazy Embedded Video​


(I actually didn't know it worked beyond YouTube until I went to get the link.) Very useful when @matched to specific domains, like this site.
 
Last edited:

Heimdall

Under His Eye
Joined
Dec 13, 2019
Messages
539
Reputation
341
Daps
1,201
Tenuously linked:

uBlock Origin dev filter​


Filters to block and remove copycat-websites from DuckDuckGo, Google and other search engines. Specific to dev websites like StackOverflow or GitHub.

There is a range of filterlists in the repo, covering multiple sites and single sites.

Pairs nicely with this userscript to hide or remove search results of your choosing:

 

bnew

Veteran
Joined
Nov 1, 2015
Messages
63,201
Reputation
9,642
Daps
172,879
*generated with perplexity R1-1776 based on deepseek-R1

.gif to webm python script

**test on a duplicate folder/files first to ensure it doesn't delete files that can't be restored**

Core Function​

Converts animated GIF files to WebM video format using efficient VP9 encoding while preserving visual quality and significantly reducing file sizes.

Key Features​

  1. Batch Conversion
    • Processes multiple GIFs simultaneously
    • Handles files from multiple locations:
      • All GIFs in a folder (including subfolders)
      • Specific GIFs listed in a text file
  2. Space Optimization
    • Automatically deletes WebM files if they're larger than originals
    • Tracks total storage saved across all conversions
    • Shows compression ratio statistics
  3. File Management
    • Options for original GIF handling:
      • Keep untouched (default)
      • Delete after successful conversion
      • Replace with empty placeholder file
    • Preserves original filenames (supports special characters/emojis)
  4. Smart Error Handling
    • Auto-retry failed conversions (customizable attempts)
    • Cleanup of incomplete/corrupted files
    • Separate error logging for troubleshooting
  5. Custom Encoding
    • Override default FFmpeg settings:
      • Adjust video quality
      • Modify encoding speed
      • Apply filters/effects
      • Tune compression parameters
  6. Transparency & Reporting
    • Real-time progress bar with live statistics
    • Detailed conversion logs:
      • Timestamps
      • File size comparisons
      • Success/failure statuses
      • Used encoding parameters
    • Separate error log for problem files
  7. Safety Features
    • Never overwrites existing WebM files
    • Maintains original files until conversion succeeds
    • Handles system interruptions gracefully

Technical Benefits​

  • Uses modern VP9 codec for better compression than GIF
  • Lossless option preserves exact visual quality
  • Multi-threaded encoding for faster processing
  • Cross-platform compatibility (Windows/macOS/Linux)

Typical Usage Examples​

  1. Basic Folder Conversion

    bash
    python gif2webm.py -d "/path/to/gifs"
    Converts all GIFs in a folder and subfolders
  2. Current Directory Only

    bash
    python gif2webm.py -d . --no-subfolders
    Processes files in current folder only
  3. List-Based Processing

    bash
    python gif2webm.py -i filelist.txt
    Converts specific GIFs from a text file
  4. Aggressive Space Saving

    bash
    python gif2webm.py -d "/media/gifs" --delete-original --delete-larger
    Removes originals and rejects inefficient conversions
  5. Custom Quality Settings

    bash
    python gif2webm.py -d "/project/assets" --ffmpeg-flags "-speed 4 -crf 30"
    Faster encoding with adjusted quality parameters
  6. Troubleshooting Mode

    bash
    python gif2webm.py -d "/archive" --retry 5 --failure-log
    Retries failures 5x and generates error report

Ideal For​

  • Reducing storage costs for web assets
  • Modernizing legacy animation collections
  • Preparing social media/video content
  • Batch processing design team deliverables
  • Archiving GIFs in future-proof format
This script combines industrial-strength media conversion with user-friendly automation, making it equally valuable for casual users and IT professionals managing large media libraries.

Code:
usage: gif2webm.py [-h] (-i INPUT_FILE | -d DIRECTORY) [--delete-original | --replace-with-zero] [--no-subfolders]
                    [--delete-larger] [--retry RETRY] [--failure-log] [--ffmpeg-flags FFMPEG_FLAGS]

📹 GIF to WebM Converter with Directory Control

options:
  -h, --help            show this help message and exit
  -i INPUT_FILE, --input-file INPUT_FILE
                        📄 Text file containing list of GIF paths (default: None)
  -d DIRECTORY, --directory DIRECTORY
                        📁 Directory to search for GIFs (default: None)
  --delete-original     🗑️ Delete original GIF after successful conversion (default: False)
  --replace-with-zero   💾 Replace original GIF with 0-byte file after success (default: False)
  --no-subfolders       🔍 Only process files in specified directory (no recursion) (default: False)
  --delete-larger       🚮 Auto-delete WebM if larger than original GIF (default: False)
  --retry RETRY         🔄 Number of retry attempts for failed conversions (default: 0)
  --failure-log         📂 Create separate log file for failed conversions (default: False)
  --ffmpeg-flags FFMPEG_FLAGS
                        🚩 Custom FFmpeg flags (space-separated, use quotes for complex values) (default: )



Here are some terminal output examples of the script in action:

Basic Conversion Example​


bash
$ python gif2webm.py -d "/path/to/gifs"
✅ Conversion complete Main log: gif-to-webm-2023-10-05-14-30-00.log.txt
🏆 Final space saved: 1.2 GB
📊 Efficiency ratio: 23% of original size

Custom FFmpeg Flags Example​


bash
$ python gif2webm.py -d "/path/to/gifs" --ffmpeg-flags "-speed 4 -crf 30"
✅ Conversion complete Main log: gif-to-webm-2023-10-05-14-31-00.log.txt
🏆 Final space saved: 1.1 GB
📊 Efficiency ratio: 25% of original size

Failure Log Example​


bash
$ python gif2webm.py -d "/path/to/gifs" --failure-log
✅ Conversion complete Main log: gif-to-webm-2023-10-05-14-32-00.log.txt
⚠️ Failure log: gif-to-webm-2023-10-05-14-32-00.failures.log.txt
🏆 Final space saved: 1.0 GB
📊 Efficiency ratio: 26% of original size

Progress Bar Example​


bash
⏳ Converting (Recursive): 50%|█████ | 10/20 [00:05<00:05, 2.00s/file, Saved=500 MB, Ratio=25%]

Error Handling Example​


bash
$ python gif2webm.py -d "/non/existent/path"
🔍 No GIF files found!

Retry Example​


bash
$ python gif2webm.py -d "/path/to/gifs" --retry 3
✅ Conversion complete Main log: gif-to-webm-2023-10-05-14-33-00.log.txt
🏆 Final space saved: 1.2 GB
📊 Efficiency ratio: 23% of original size

No Subfolders Example​


bash
$ python gif2webm.py -d "/path/to/gifs" --no-subfolders
✅ Conversion complete Main log: gif-to-webm-2023-10-05-14-34-00.log.txt
🏆 Final space saved: 500 MB
📊 Efficiency ratio: 25% of original size
These examples demonstrate how the script handles different scenarios and provides feedback to the user through the terminal.
 
Last edited:

bnew

Veteran
Joined
Nov 1, 2015
Messages
63,201
Reputation
9,642
Daps
172,879
update to gif to webm since the default sometimes lead to larger webm files.

i set preset to balanced and compact

Changelog from v4 to v6:
  1. Preset System Introduction 🎚️
    • v4 used a single lossless conversion with custom FFmpeg flags.
    • v6 introduces a preset system allowing users to choose between 'lossless', 'balanced', and 'compact' presets.
  2. Argument Parsing Updates 📝
    • v4 used basic arguments for input/output handling and custom FFmpeg flags.
    • v6 adds --preset argument for selecting multiple presets, enhancing flexibility.
  3. Multiple Output Files 📁
    • v4 generated a single output file per GIF.
    • v6 can generate multiple WebM files per GIF based on selected presets.
  4. Enhanced Logging 📊
    • v4 had basic logging.
    • v6 includes detailed logging for each preset, showing parameters used and results.
  5. Progress Bar Improvements 📈
    • v4 had a basic progress bar.
    • v6 updates the progress bar to reflect the number of presets being processed.
  6. Failure Logging 📂
    • v4 had a basic failure log.
    • v6 includes an option for a separate failure log, improving error tracking.
  7. Recursive Search Options 🔍
    • v4 allowed recursive search.
    • v6 adds an option (--no-subfolders) to disable recursive search.
Summary for End-Users:
The latest version of the GIF to WebM converter (v6) offers significant improvements over the earlier version (v4). Key enhancements include:
  • Preset Selection: Users can now choose between 'lossless', 'balanced', and 'compact' presets for different quality and size trade-offs.
  • Multiple Output Files: Each GIF can be converted into multiple WebM files based on the selected presets, allowing for easy comparison.
  • Custom FFmpeg Flags: Users can add custom FFmpeg flags to fine-tune the encoding process.
  • Enhanced Logging: Detailed logs are generated for each preset, including parameters used and conversion results.
  • Improved Progress Bar: The progress bar now reflects the number of presets being processed, providing better feedback.
  • Separate Failure Log: An option to create a separate log for failed conversions makes error tracking easier.
Overall, v6 provides more flexibility, control, and detailed feedback compared to v4, making it a more powerful tool for converting GIFs to WebM.

Code:
usage: gif2webm6.py [-h] (-i INPUT_FILE | -d DIRECTORY) [--delete-original | --replace-with-zero] [--no-subfolders]
                    [--delete-larger] [--retry RETRY] [--failure-log] [--ffmpeg-flags FFMPEG_FLAGS]
                    [--preset {lossless,balanced,compact} [{lossless,balanced,compact} ...]]

📹 GIF to WebM Converter with Preset Selection

options:
  -h, --help            show this help message and exit
  -i INPUT_FILE, --input-file INPUT_FILE
                        📄 Text file containing list of GIF paths (default: None)
  -d DIRECTORY, --directory DIRECTORY
                        📁 Directory to search for GIFs (default: None)
  --delete-original     🗑️ Delete original GIF after successful conversion (default: False)
  --replace-with-zero   💾 Replace original GIF with 0-byte file after success (default: False)
  --no-subfolders       🔍 Only process files in specified directory (no recursion) (default: False)
  --delete-larger       🚮 Auto-delete WebM if larger than original GIF (default: False)
  --retry RETRY         🔄 Number of retry attempts for failed conversions (default: 0)
  --failure-log         📂 Create separate log file for failed conversions (default: False)
  --ffmpeg-flags FFMPEG_FLAGS
                        🚩 Custom FFmpeg flags (space-separated) (default: )
  --preset {lossless,balanced,compact} [{lossless,balanced,compact} ...]
                        🎚️ Output presets (choose multiple: lossless balanced compact) (default: None)

 

bnew

Veteran
Joined
Nov 1, 2015
Messages
63,201
Reputation
9,642
Daps
172,879









Free and customizable image viewer​



PicView is a fast, free and fully customizable image viewer for Windows 10 and 11.

It supports a vast range of image file types, including WEBP, GIF, SVG, PNG, JXL, HEIC, PSD and many others.

Additional features includes viewing EXIF metadata, image compression, batch resizing, viewing images within archives and comic books, image effects, image galleries, and more.

Enjoy a clean, free, and fast experience with no bloated UI or annoying pop-ups.

Available in portable and installable versions.

Download

Why use PicView​

Fast​

Quick to start up & uses a built-in preloader to instantly switch to the next image.

Clean Design​

Compact and neatly organized UI, that can be conveniently hidden when not needed.

Archive loading​

View pictures inside archives such as ZIP, RAR, CBR, etc (.7z .cb7 and requires 7-Zip or WinRAR to be installed).

Adapts to Screen​

The application can automatically fit itself to best fit on your screen.

PicView scroll picture dark theme

An overview of the UI

Customizable Interface​

Switch between a dark and a light theme and toggle between hiding the UI.

Feature box

Want to just show the image with no UI?​


Toggle the UI by pressing Alt + Z. Hold shift down to drag window.

The hover buttons can be turned on/off in the settings window.

 

bnew

Veteran
Joined
Nov 1, 2015
Messages
63,201
Reputation
9,642
Daps
172,879
* new code gnerated with o3-mini and grok3

updated the gif2webm script(v11 internally) better qQSV support for older versions of ffmpeg with libmfx enabled.

Let’s break down what the gif2webm.py v11 script does in simple terms, then provide a detailed summary, usage examples, and sample outputs. I’ll assume this is an evolution of the previous gif2webm10.py script with the fixes and structure intact, and I’ll avoid referencing specific paths or filenames from earlier.


What Does​

This Python script takes GIF files (animated images) and converts them into WebM or MP4 video files using a tool called FFmpeg. It’s like a video converter that makes your GIFs into smaller, more modern video formats. You can choose how good the quality is or how small the file size gets with options called "presets" (like "lossless," "balanced," or "compact"). It can process one GIF or a whole folder of them, and it lets you decide what happens to the original GIFs afterward—like deleting them or replacing them with empty files. The script also keeps a log of what it does and can retry if something goes wrong.


Detailed Summary in Simple Terms​

Here’s a step-by-step explanation of what the script does, why it’s useful, and how it works:

  1. Purpose:
    • Converts GIFs (animated images) into WebM (a web-friendly video format) or MP4 (a common video format).
    • Helps save space (WebM/MP4 can be smaller than GIFs) or improve quality for sharing online.
  2. How It Finds GIFs:
    • You tell it either:
      • A folder to look in (e.g., "search this folder for GIFs").
      • A text file listing GIF paths (e.g., "convert these specific GIFs").
    • It can search just one folder or dig into subfolders too.
  3. Conversion Options:
    • Presets: You pick how the output looks:
      • lossless: Best quality, bigger files.
      • balanced: Medium quality, medium size.
      • compact: Lower quality, smallest files.
      • You can pick one, two, or all three at once, and it makes a file for each.
    • Codec Choices: How the video is made:
      • libvpx-vp9: Software-based, makes WebM files (default for your setup).
      • h264_qsv: Hardware-based, makes MP4 files (faster if your computer supports it).
      • vp9_qsv: Hardware-based, makes WebM files.
    • Extra Settings: You can add custom FFmpeg flags (like tweaking video settings).
  4. What Happens to Original GIFs:
    • You choose:
      • Keep them as is.
      • Delete them after conversion.
      • Replace them with empty (0-byte) files to save space but keep the name.
  5. Smart Features:
    • Size Check: If the new file is bigger than the GIF, it can delete the new file automatically.
    • Retries: If conversion fails (e.g., FFmpeg glitches), it tries again (up to a number you set).
    • Logs: Writes a report of what happened—successes, failures, file sizes—to a text file.
  6. Progress Bar:
    • Shows how many files are done, how much space you’ve saved, and a percentage of size reduction.
  7. Safety Checks:
    • Makes sure FFmpeg is installed and supports the right codecs before starting.
    • Handles interruptions (like pressing Ctrl+C) gracefully.
  8. Technical Stuff:
    • Uses FFmpeg (a free video tool) behind the scenes.
    • Avoids crashes from weird file names or FFmpeg errors by handling text output carefully.
    • Names output files with the preset (e.g., dance_balanced.webm, dance_compact.webm).

Why Use It?​

  • Space Saving: GIFs can be huge; WebM/MP4 files are often smaller.
  • Flexibility: You control quality vs. size and can batch-process many files.
  • Automation: Great for converting lots of GIFs without manual work.
  • Debugging: Logs and debug mode help if something goes wrong.

Usage Examples​

Here’s how to run the script with different options (assuming it’s saved as gif2webm.py and FFmpeg is installed):

Example 1: Convert All GIFs in a Folder to WebM with Two Presets​

bash
Code:
python gif2webm.py -d my_folder --preset balanced compact --use-libvpx-vp9
  • What It Does: Looks in "my_folder" for GIFs, makes two WebM files per GIF (one "balanced," one "compact") using software encoding.
  • Output Files: For a GIF named funny.gif, you get funny_balanced.webm and funny_compact.webm.

Example 2: Convert Specific GIFs from a List, Delete Originals​

bash
Code:
python gif2webm.py -i gif_list.txt --preset compact --delete-original
  • gif_list.txt: A text file with paths like:

    path/to/cat.gifpath/to/dog.gif
  • What It Does: Converts each GIF to a compact WebM, deletes the original GIFs.
  • Output Files: cat_compact.webm, dog_compact.webm.

Example 3: Convert with Debug and Retries, Replace GIFs with Empty Files​

bash
Code:
python gif2webm.py -d gifs_here --preset balanced --use-libvpx-vp9 --delete-larger
  • What It Does: Converts GIFs in "animations" to lossless WebM, replaces originals with 0-byte files, retries twice on failure, shows detailed FFmpeg output.
  • Output Files: jump_lossless.webm, and jump.gif becomes 0 bytes.

Example 4: Convert One Preset, Delete Larger Outputs​

bash

python gif2webm.py -d gifs_here --preset balanced --use-libvpx-vp9 --delete-larger
  • What It Does: Makes balanced WebM files, deletes them if they’re bigger than the original GIF.
  • Output Files: spin_balanced.webm (only if smaller than spin.gif).

Sample Output​

Here’s what you might see when running Example 1:

bash
Code:
⏳ Converting [balanced + compact]: 100%|██████████| 3/3 [00:15<00:00, 5.00s/file, Saved=12.3 MiB, Ratio=30%, Presets=2]

✅ Conversion complete! Main log: gif-to-webm-20250317-123456.log.txt
🏆 Final space saved: 12.3 MiB
📊 Efficiency ratio: 30%
Log File (gif-to-webm-20250317-123456.log.txt):


Code:
Conversion Log - 2025-03-17 12:34:56 (Software, libvpx-vp9 (WebM))

Status   | Preset     | Attempts | Original Size | Output Size | Saved    | Parameters Used      | Action Taken      | Path
--------------------------------------------------------------------------------------------------------------------------------------------
SUCCESS  | balanced   |       1 |     5.0 MiB |   1.5 MiB |   3.5 MiB | -crf 20 -b:v 0       | None             | my_folder/dance.gif
SUCCESS  | compact    |       1 |     5.0 MiB |   0.8 MiB |   4.2 MiB | -crf 35 -b:v 0       | None             | my_folder/dance.gif
SUCCESS  | balanced   |       1 |     3.2 MiB |   1.0 MiB |   2.2 MiB | -crf 20 -b:v 0       | None             | my_folder/run.gif
SUCCESS  | compact    |       1 |     3.2 MiB |   0.6 MiB |   2.6 MiB | -crf 35 -b:v 0       | None             | my_folder/run.gif
SUCCESS  | balanced   |       1 |     4.1 MiB |   1.2 MiB |   2.9 MiB | -crf 20 -b:v 0       | None             | my_folder/jump.gif
SUCCESS  | compact    |       1 |     4.1 MiB |   0.7 MiB |   3.4 MiB | -crf 35 -b:v 0       | None             | my_folder/jump.gif

FINAL STATISTICS:
Total GIF files processed: 3
Total conversion attempts: 6
Successfully converted: 6
Reverted conversions: 0
Failed conversions: 0
Total original size: 12.3 MiB
Total output size: 3.8 MiB
Total space saved: 8.5 MiB
Storage efficiency: 31% of original size
Files Created:

  • my_folder/dance_balanced.webm
  • my_folder/dance_compact.webm
  • my_folder/run_balanced.webm
  • my_folder/run_compact.webm
  • my_folder/jump_balanced.webm
  • my_folder/jump_compact.webm

Tips​

  • Install FFmpeg: Download from ffmpeg.org and add to your system PATH, or set FFMPEG_PATH in the script.
  • Test Small: Start with a few GIFs to see how presets affect size and quality.
  • Debug Mode: Use --debug if something fails to see FFmpeg’s full output.
This script is a powerful, customizable tool for anyone dealing with lots of GIFs—hope this makes it clear and easy to use! Let me know if you need more examples or tweaks!

 

bnew

Veteran
Joined
Nov 1, 2015
Messages
63,201
Reputation
9,642
Daps
172,879

Prevue Popup​


Browser Extension allowing users to preview links and images in-page. Get it from the official Chrome Web Store or from Mozilla Add-ons.

Demo​


Click to View Demo

Suggestions Welcome​


This extension is still in early stage development, so if you have suggestions on how to improve it, but you can't contribute the changes yourself, please send me a message following the contact link from the extension's options page.

Options Page​


When you first install the extension, the options page will open automatically.

You can re-open the options page by right clicking the extension from within the extensions menu, and clicking "Options" to open them in a new tab. Simply clicking the extension will also open the options page, but in a popup instead of a new tab.

In there, you will find a bunch of options to customise the extension based on your needs. I encourage you to play around with them until you find something that works for you.

The options will be synced to your Chrome Sync account, if you use it. Meaning that once you edit them on one machine, they'll be available on all the others as well




Preview of Prevue Popup


Prevue Popup​


Prevue Popup aims at increasing your productivity by allowing you to preview any URL inside the current page, without opening it in a different tab, or changing the current URL.

Extension Metadata​


About this extension

Prevue Popup aims at increasing your productivity by allowing you to preview any URL inside the current page, without opening it in a different tab, or changing the current URL.

The way it works is fairly straight forward, it simply opens an iframe element as a popup inside the current site.

The extension features and extensive options page which allows you to customise it to your liking.

More information

Version 0.4.8

Size 75.72 KB

Last updated a year ago (Apr 6, 2024)

License GNU General Public License v3.0 only





==================


I also use this in combination with customscripts that add wayback machine and archive.is archive urls and quickly save links without having to open a new tab.
 
Top