Skip to content

Instantly share code, notes, and snippets.

@nikjft
nikjft / toggleGoogleCalendarEvents.js
Last active November 3, 2022 20:42
Toggle Google Calendar event visibility by color
/*
This toggles GA event visibility based on the color of the event.
It should be injected into the JS of the site using an extension
like TamperMonkey or User JS and CSS Chrome plugin
https://chrome.google.com/webstore/detail/user-javascript-and-css/nbhcbdghjpllgmfilhnhkllmkecfmpld?hl=en
Edit the array of colors where commented to determine which events show/hide.
javascript:%28function %28%29 %7B %09var newUser %3D 1%3B %09var newURL%3B %09url %3D window.location.href%3B %09var match1 %3D url.match%28%2F%5C%2Fu%5C%2F%28%5Cd%29%5C%2F%2Fi%29%3B %09var match2 %3D url.match%28%2Fauthuser%3D%28%5Cd%29%2Fi%29%3B %09var match3 %3D url.match%28%2F%5C%2Fb%5C%2F%28%5Cd%29%5C%2F%2Fi%29%3B %09var match4 %3D url.match%28%2F%5Ehttps%3A%5C%2F%5C%2Fdocs%5C.google%5C.com%5C%2F%28%5B%5E%5C%2F%5D%2B%29%5C%2Fd%5C%2F%2Fi%29%3B %09if %28match1%29 %7B %09%09console.log%28%27match1%27%29%3B %09%09if %28match1%5B1%5D %3D%3D 1%29 %7B %09%09%09newUser %3D 0%3B %09%09%7D %09%09newURL %3D window.location.href.replace%28%2F%5C%2Fu%5C%2F%5Cd%5C%2F%2Fi%2C "%2Fu%2F" %2B newUser %2B "%2F"%29%3B %09%7D %09else if %28match2%29 %7B %09%09console.log%28%27match2%27%29%3B %09%09if %28match2%5B1%5D %3D%3D 1%29 %7B %09%09%09newUser %3D 0%3B %09%09%7D %09%09newURL %3D window.location.href.replace%28%2Fauthuser%3D%5Cd%2Fi%2C "authuser%3D" %2B newUser%29%3B %09%7D %09else if %28match3%29 %7B %09%09console.log%2
@nikjft
nikjft / mkto.form.listener.html
Last active March 17, 2020 13:33 — forked from keithws/mkto.form.listener.html
Marketo Form Listener for Google Tag Manager (GTM)
(function marketoFormListener () {
"use strict";
/**
* poll for global MktoForms2 variable to be defined
* @returns {undefined}
*/
function pollForMktoForms2 (delay) {
@nikjft
nikjft / zapier_webhook_bookmarklet.js
Last active August 20, 2019 08:24 — forked from brunohq/zapier_webhook_bookmarklet.js
Bookmarklet to trigger a Zapier Webhook from any web page. Any selected text as well as the page title and URL are passed to Zapier.
javascript:(function()
{
var webhookURL = '[your webhook URL from Zapier]';
var selectedText = encodeURIComponent(window.getSelection().toString());
var iframe = document.createElement('iframe');
iframe.name = 'response';
iframe.style.visibility = 'hidden';
document.body.appendChild(iframe);
var form = document.createElement('form');
@nikjft
nikjft / Keyboard Maestro HTML Prompt Timeout
Last active January 8, 2017 13:07
JS routine to give Keyboard Maestro custom HTML prompts a timeout function. The timeout is automatically paused as soon as a key in pressed in a text input field so that it won't time out while someone's typing.
<script>
var timeout;
function KMInit() {
var dialogTimeout = 10000
timeout = setTimeout(function(){ window.KeyboardMaestro.Submit('Timeout'); }, dialogTimeout);