Skip to content

Instantly share code, notes, and snippets.

@joziahg
joziahg / interceptForm.html
Last active May 15, 2024 00:36
Javascript code to intercept hubspot forms on drag and drop builder websites
<!-- Header Code -->
<script charset="utf-8" type="text/javascript" src="//js.hsforms.net/forms/shell.js"></script>
<!-- Footer Code -->
<!-- Minified use this in production -->
<script>
$('form[action^="https://api.hsforms.com"]').each((function(e){$(this).find("input[type=checkbox]").val("true"),$(this).submit((function(e){e.preventDefault();const n=[...new FormData(e.target).entries()].map((e=>({name:e[0],value:e[1]}))),t=n.find((e=>"goToWebinarWebinarKey"===e.name))?.value,i=n.find((e=>"sfdcCampaignId"===e.name))?.value,o=document.cookie.replace(/(?:(?:^|.*;\s*)hubspotutk\s*\=\s*([^;]*).*$)|^.*$/,"$1")||void 0;console.log(o);const s=$(this).find("[id*='gdpr-processing-prompt']"),a=n.filter((e=>e.name.includes("LEGAL_CONSENT"))).map((e=>{const n=$(`#${e.name.replace(/(:|\.|\[|\]|,|=|@)/g,"\\$1")}`)[0],t=$("span[for='"+$(n).attr("id").replace(/(:|\.|\[|\]|,|=|@)/g,"\\$1")+"']");return{value:n.checked,text:t.text(),subscriptionTypeId:parseInt(e.name.split("LEGAL_CONSENT.subscription_type_")[1])}})),r=["cc-n
const softballTeams = [ // Array of teams
'Ottumwa', 'Benton', 'Bettendorf', 'IC Regina', 'CR Kennedy',
'Cedar Falls', 'Dub. Senior', 'Dub. Hempstead', 'North Scott',
'CR Prairie', 'IC West', 'Pleasant Valley', 'Linn-Mar', 'CCA',
'Lisbon', 'CR Jeff Blue', 'CR Jeff White', 'CR Xavier', 'Waterloo West'
]
Array.prototype.getPairs = function (returnedPairs) { // We can define ourselves a new Array function here with the Array.protptype method
var pairs = [] // new pairs array
/**
* This is a simple template for bug reproductions. It contains three models `Person`, `Animal` and `Movie`.
* They create a simple IMDB-style database. Try to add minimal modifications to this file to reproduce
* your bug.
*
* install:
* npm install objection knex sqlite3 chai
*
* run:
* node reproduction-template