Skip to content

Instantly share code, notes, and snippets.

Avatar

Nic Jansma nicjansma

View GitHub Profile
@nicjansma
nicjansma / add_to_cart.user.js
Created Nov 23, 2020 — forked from beporter/add_to_cart.user.js
Greasemonkey script to repeatedly refresh a given page, look for specific "Add to Cart" buttons, click them if present, and make a lot of noise on success.
View add_to_cart.user.js
// ==UserScript==
// @name Add Saved Items to Cart
// @namespace https://gist.github.com/beporter/ce76204bcba35d9edb66b395bb5e9305
// @version 0.5
// @description Repeatedly refresh a given "saved items" page (Amazon, Walmart, BestBuy), look for specific "Add to Cart" buttons, click them if present, and make a lot of noise on success.
// @author https://github.com/beporter
// @match https://www.amazon.com/gp/registry/wishlist/*
// @match https://www.amazon.com/hz/wishlist/ls/*
// @match https://www.bestbuy.com/cart
// @match https://www.bestbuy.com/site/customer/lists/manage/saveditems
View boomerang-wait-after-onload-plugin.js
/**
* The `WaitAfterOnload` Boomerang plugin waits for the specified number of seconds after
* onload before a beacon is sent.
*
* It does not affect the Page Load time (`t_done`) -- it just delays a beacon
* for the specified number of seconds. This allows the beacon to contain additional
* ResourceTiming data and other metrics/timers that might happen after page load.
*
* NOTE: Any plugin like this that delays a beacon from being sent after onload
* will have an effect on total number of beacons captured (due to the visitor
@nicjansma
nicjansma / fiddler-boomerang-helpers.js
Last active Jan 17, 2021
Fiddler FiddlerScript helpers for Boomerang
View fiddler-boomerang-helpers.js
//
// Helper Functions
//
// Gets a parameter from the URL
static function extractGetParameter(name, query) {
return decodeURIComponent((new RegExp('[?|&]' + name + '=' + '([^&;]+?)(&|#|;|$)').exec(query) || [,""])[1].replace(/\+/g, '%20')) || null;
}
// Gets a POST or GET parameter
View boomerang-beaconrepeater.js
/**
* Repeats all beacons to a second URL.
*
* To configure, update BEACON_URL.
*
* This code repeats some code from Boomerang. If you only need to send
* XHR beacons, or only image beacons, or not sendBeacon(), it could be trimmed down.
*
* @class BOOMR.plugins.BeaconRepeater
*/
View boomerang-eventtiming.js
/**
* The EventTiming plugin collects paint metrics exposed by the WICG
* [Event Timing]{@link https://github.com/WICG/event-timing/} proposal.
*
* For information on how to include this plugin, see the {@tutorial building} tutorial.
*
* ## Beacon Parameters
*
* All beacon parameters are prefixed with `et.`.
*
@nicjansma
nicjansma / resourcetiming-iframe.js
Last active May 30, 2020
ResourceTiming leak to parent frames
View resourcetiming-iframe.js
//
// Placed in any cross-origin IFRAMEs
//
if (window !== window.top) {
if (typeof window.PerformanceObserver !== "function") {
return;
}
// Listen for all ResourceTimings, repeating them to the parent window
var observer = new PerformanceObserver(function(entries) {
@nicjansma
nicjansma / resourcetiming-crawl.js
Last active Jul 23, 2018
Naive ResourceTiming crawl of all IFRAMEs
View resourcetiming-crawl.js
//
// Naive ResourceTiming crawl of all IFRAMEs.
//
// Based on https://github.com/SOASTA/boomerang/blob/master/plugins/restiming.js
// which you should use to deal with all of the caveats (e.g. startTime adjusting)
//
function isFrameAccessible(frame) {
var dummy;
View boomerang-duplicate-custom-timers-to-beacon.js
/**
* The `DuplicateTimersToBeacon` Boomerang plugin duplicates any mPulse Custom Timers
* that are logged in the beacon's `t_other` parameter into distinct beacon parameters.
*
* e.g:
*
* t_other=boomerang|17,boomr_fb|2516,boomr_ld|2351,boomr_lat|165,custom5|2112,custom0|27
*
* Will add two more beacon parameters:
*
View boomerang-waitforjsvar-plugin.js
/**
* The `WaitForJsVar` Boomerang plugin waits for the specified JavaScript variable
* to exist on the page before a beacon is sent.
*
* It does not affect the Page Load time (`t_done`) -- it just delays a beacon
* until the variable exists. This allows the beacon to contain additional
* ResourceTiming data and other metrics/timers that might happen after page load.
*
* NOTE: Any plugin like this that delays a beacon from being sent after onload
* will have an effect on total number of beacons captured (due to the visitor
View boomerang-waitformark-plugin.js
/**
* The `WaitForMark` Boomerang plugin waits for the specified UserTiming Mark
* (or Measure) to exist on the page before a beacon is sent.
*
* It does not affect the Page Load time (`t_done`) -- it just delays a beacon
* until the Mark exists. This allows the beacon to contain additional
* ResourceTiming data and other metrics/timers that might happen after page load.
*
* NOTE: Any plugin like this that delays a beacon from being sent after onload
* will have an effect on total number of beacons captured (due to the visitor