Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save eplord/636db649daee51979aa92dfc6022e88e to your computer and use it in GitHub Desktop.

Select an option

Save eplord/636db649daee51979aa92dfc6022e88e to your computer and use it in GitHub Desktop.
all tampermonkey scripts
// ==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