Skip to content

Instantly share code, notes, and snippets.

@glenjamin
Last active February 26, 2025 09:23
Show Gist options
  • Save glenjamin/186888638a0044eea11a05a51ad546ba to your computer and use it in GitHub Desktop.
Save glenjamin/186888638a0044eea11a05a51ad546ba to your computer and use it in GitHub Desktop.
Honeycomb E&S Environment toggle bookmarklet

Honeycomb env-switching bookmarklet

Save the following bookmarklet as a bookmark

Honeycomb Environment Switcher

(() => {
const f = (tag, text) =>
Array.from(document.querySelectorAll(tag)).find(
(el) => el.textContent === text,
);
f('button', 'Share').click();
setTimeout(() => {
f('button', 'Get Template Link').click();
setTimeout(() => {
const h = f('h4', 'Query Template Link');
let url = h.closest('section').querySelector('textarea').value;
const swap = ['/production/', '/staging/'];
if (url.includes('/staging/')) swap.reverse();
url = url.replace(...swap);
location.href = url;
}, 10);
}, 10);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment