Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save giladbarnea/302893ad36e9c2c81958543f61ffcf17 to your computer and use it in GitHub Desktop.

Select an option

Save giladbarnea/302893ad36e9c2c81958543f61ffcf17 to your computer and use it in GitHub Desktop.
all tampermonkey scripts
// ==UserScript==
// @name ChatGPT
// @namespace http://tampermonkey.net/
// @version 2025-08-01
// @description try to take over the world!
// @author You
// @match https://chatgpt.com/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=chatgpt.com
// @grant none
// ==/UserScript==
(function() {
'use strict';
function injectCss() {
const style = document.createElement("style")
style.textContent = `
/* --- Chat Styles --- */
html {
font-family: "Google Sans Display", sans-serif;
}
strong {
font-family: "Google Sans Regular", sans-serif;
}
`;
document.head.appendChild(style);
}
injectCss();
function adjustHebrewTextDirection(element) {
const text = element.textContent || '';
// Count Hebrew letters vs English/Latin letters
const hebrewMatches = text.match(/[\u0590-\u05FF]/g);
const latinMatches = text.match(/[a-zA-Z]/g);
const hebrewCount = hebrewMatches ? hebrewMatches.length : 0;
const latinCount = latinMatches ? latinMatches.length : 0;
const totalLetters = hebrewCount + latinCount;
if (totalLetters === 0) return;
const hebrewRatio = hebrewCount / totalLetters;
// Set to RTL if more than 90% of the alphabetical characters are Hebrew
if (hebrewRatio > 0.9) {
element.setAttribute('dir', 'rtl');
element.style.textAlign = 'right';
} else {
element.setAttribute('dir', 'ltr');
element.style.textAlign = 'left';
}
}
// Target viewers, custom viewer classes, and blockquotes
const selector = '#code-block-viewer, .q9tKkq_viewer, blockquote';
// 1. Process existing elements
document.querySelectorAll(selector).forEach(adjustHebrewTextDirection);
// 2. Observe the DOM for dynamically loaded content
const observer = new MutationObserver((mutations) => {
for (const mutation of mutations) {
mutation.addedNodes.forEach((node) => {
if (node.nodeType === Node.ELEMENT_NODE) {
if (node.matches(selector)) {
adjustHebrewTextDirection(node);
}
node.querySelectorAll(selector).forEach(adjustHebrewTextDirection);
}
});
}
});
observer.observe(document.body, {
childList: true,
subtree: true
});
})();
// ==UserScript==
// @name Google AI Studio: Full-width reasoning
// @namespace http://tampermonkey.net/
// @version 2024-09-24
// @description try to take over the world!
// @author You
// @match https://aistudio.google.com/*
// @icon https://www.gstatic.com/aistudio/watermark/watermark.png
// @grant none
// ==/UserScript==
const sleep = (ms) => new Promise(resolve => setTimeout(resolve, ms));
const loop = async() => {
while(true){
const thoughtElements = [...document.getElementsByClassName('thought-container')];
if (thoughtElements.length) {
thoughtElements.forEach(thoughtElement => {
thoughtElement.style['maxWidth'] = '100%';
});
}
await sleep(100);
}
}
(async function() {
await loop();
})();
// ==UserScript==
// @name Google Forms RTL
// @namespace http://tampermonkey.net/
// @version 2024-11-27
// @description try to take over the world!
// @author You
// @match https://docs.google.com/forms/d*
// @icon https://www.google.com/s2/favicons?sz=64&domain=google.com
// @grant none
// ==/UserScript==
(function() {
'use strict';
function containsHebrew(text) {
// Hebrew Unicode range: \u0590-\u05F
return /[\u0590-\u05FF]/.test(text);
}
function setRtlForHebrewInputs() {
// Select both input elements and editable divs
const inputs = document.querySelectorAll('input[type="text"], div[contenteditable="true"][g_editable="true"]');
inputs.forEach(element => {
// For regular inputs, check value
// For contenteditable divs, check textContent
const content = element.tagName === 'INPUT' ? element.value : element.textContent;
if (containsHebrew(content)) {
element.setAttribute('dir', 'rtl');
// element.style.direction = 'rtl';
// element.style.textAlign = 'right';
}
});
}
// Run on page load
document.addEventListener('DOMContentLoaded', setRtlForHebrewInputs);
// Also run periodically to catch dynamically added elements
setInterval(setRtlForHebrewInputs, 1000);
// Optional: Run when content changes
/*
document.addEventListener('input', function(e) {
if (e.target.matches('input[type="text"], div[contenteditable="true"][g_editable="true"]')) {
const content = e.target.tagName === 'INPUT' ? e.target.value : e.target.textContent;
if (containsHebrew(content)) {
e.setAttribute('dir', 'rtl');
// e.target.style.direction = 'rtl';
// e.target.style.textAlign = 'right';
}
}
});
*/
})();
// ==UserScript==
// @name Perplexity: hide sidbar
// @namespace http://tampermonkey.net/
// @version 2024-09-24
// @description try to take over the world!
// @author You
// @match https://www.perplexity.ai/*
// @exclude https://www.perplexity.ai/library
// @icon https://www.google.com/s2/favicons?sz=64&domain=perplexity.ai
// @grant none
// ==/UserScript==
const sleep = (ms) => new Promise(resolve => setTimeout(resolve, ms));
const findSidebar = async (verbose = false, maxRetries = 500, retryInterval = 10) => {
let sidebar;
let retries = 0;
while (!(sidebar = document.querySelector('.col-span-4'))) {
retries++;
if (retries > maxRetries) {
verbose && console.warn('Sidebar not found');
return null;
}
await sleep(retryInterval);
}
return sidebar;
};
const removeSidebar = async (verbose = false) => {
const sidebar = await findSidebar(verbose);
if (!sidebar) {
return
}
const mainThing = sidebar.previousSibling;
sidebar.remove();
mainThing.className = 'col-span-12';
verbose && console.log('Sidebar removed');
};
const updateCodeElements = async (verbose = false, maxRetries = 5, retryInterval = 50) => {
let codeElems;
for (let i = 0; i < maxRetries; i++) {
codeElems = [...document.getElementsByTagName('code')];
if (codeElems.length) {
codeElems.forEach(codeElement => {
codeElement.style['fontFamily'] = '"Fira Code", "Fira Mono", Menlo, Consolas, "DejaVu Sans Mono", monospace';
});
verbose && console.log('Changed code font family to Fira');
return;
}
await sleep(retryInterval);
}
verbose && console.warn(`Did not find any 'code' elements after ${maxRetries * retryInterval}ms`);
};
const loop = async() => {
await removeSidebar(true);
await updateCodeElements(true);
while(true){
await sleep(2000);
await removeSidebar(false);
await updateCodeElements(false);
}
}
(async function() {
await loop();
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment