Skip to content

Instantly share code, notes, and snippets.

View nikhilatjumpcut's full-sized avatar
👻
straight to the ramp

Nikhil Arora nikhilatjumpcut

👻
straight to the ramp
View GitHub Profile
# mutation updateHTMLTag {
# updateHtmlTag(where:{
# htmlTagId:"7ad81c67-9c73-4c92-b1ab-0ad7c0b8915d"
# },
# data:{
# position: APPEND_TO
# selector: "head"
# html: "<script>var gtmScript=document.querySelector(\"script#gtm\");if(!gtmScript){for(var searchParams=Array.from(new URLSearchParams(window.location.search).entries()),searchParamsObject={},pair=searchParams.pop();pair;pair=searchParams.pop())searchParamsObject[pair[0]]=pair[1];dataLayer=[{visitorId:window.__TSUNAMI__&&window.__TSUNAMI__.visitorId?window.__TSUNAMI__.visitorId:null,leadSource:searchParamsObject.opted_from?searchParamsObject.opted_from:null,variationPath:window.__TSUNAMI__&&window.__TSUNAMI__.sourceUrl?window.__TSUNAMI__.sourceUrl:null}],function(r,a,e,t,o){r[t]=r[t]||[],r[t].push({\"gtm.start\":(new Date).getTime(),event:\"gtm.js\"});var s=a.getElementsByTagName(e)[0],i=a.createElement(e);i.async=!0,i.src=\"https://www.googletagmanager.com/gtm.js?id=GTM-T4XS7N4\",s.parentNode.insertBefore(i,s)}(window,document,\"scrip
@nikhilatjumpcut
nikhilatjumpcut / replaceCTAAction.js
Last active August 7, 2019 03:25
replaceCTAAction.js
(function replaceCTAAction() {
var FUNNEL_URL = 'https://jumpcut.com/t';
var funnelAccess = window.__TSUNAMI__.funnelAccess;
var funnelSlug = window.__TSUNAMI__.funnelSlug;
var currentStepIndex = funnelAccess.findIndex(function(access) {
if (access.isCurrentStep) {
return true;
}
@nikhilatjumpcut
nikhilatjumpcut / setFBCommentOptions.js
Created August 5, 2019 05:21
setFBCommentOptions.js
# mutation createHtmlTag{
# createHtmlTag(data: {
# title: "FB_OPTIONS"
# isGlobal: false
# position: PREPEND_TO
# selector: "head"
# html: "<script>$(document).ready(function setFBCommentOptions() {\n $fbCommentSection = document.querySelector('.fb-comments');\n\n $fbCommentSection.setAttribute('data-order-by', 'reverse_time');\n $fbCommentSection.setAttribute('data-width', '100%');\n\n // Forcing fb comments iframe to have 100% width because facebook just won't fix\n // their own bug https: //developers.facebook.com/support/bugs/256568534516879/#_=_\n $fbCommentsWidthStyleTag = '<style>.fb-comments iframe {width: 100% !important;}</style>';\n $('head').append($fbCommentsWidthStyleTag);\n});</script>"
# }) {
# htmlTagId
# }
@nikhilatjumpcut
nikhilatjumpcut / vaCTADelayScript.js
Last active August 5, 2019 11:30
vaCTADelayScript.js
(function vaCTADelayScript() {
var funnelAccess = window.__TSUNAMI__.funnelAccess;
var currentStep = funnelAccess.find(function(access) {
if (access.isCurrentStep) {
return true;
}
return false;
});
@nikhilatjumpcut
nikhilatjumpcut / replaceEnrollmentEnds.js
Last active August 8, 2019 06:33
replaceEnrollmentEnds.js
function getExpiryDate(timewaitValue) {
if (!timewaitValue || !spacetime) {
return 'soon';
}
return spacetime(timewaitValue)
.subtract(1, 'day')
.format('{month-short} {date-ordinal}');
}
@nikhilatjumpcut
nikhilatjumpcut / replaceReleaseDatesAndWrapperLinks.js
Last active August 7, 2019 03:26
replaceReleaseDatesAndWrapperLinks.js
function fixCFHeaders() {
var $head = document.getElementsByTagName('head')[0];
var $firstMeta = document.getElementsByTagName('meta')[0];
var $node = document.createElement('meta');
$node.setAttribute('property', 'fb:app_id');
$node.setAttribute('content', '1688345434786806');
$head.insertBefore($node, $firstMeta);
}
@nikhilatjumpcut
nikhilatjumpcut / replaceReleaseDates.js
Created August 3, 2019 14:32
replaceReleaseDates.js
function getElementByTagAndText(tag, text) {
var xPath = "//" + tag + "[contains(text(), '" + text + "')]";
return document.evaluate(xPath, document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;
}
function getDate(timewaitValue) {
if (!timewaitValue || !spacetime) {
return 'soon';
}
@nikhilatjumpcut
nikhilatjumpcut / submitOptin.js
Last active August 6, 2019 12:44
submitOptin.js
# mutation createHtmlTag{
# createHtmlTag(data: {
# title: "SUBMIT_OPTIN"
# isGlobal: false
# selector: "head"
# position: APPEND_TO
# html: "<script>function validateEmail(e){return new RegExp(\"[a-z0-9._%+-]+@[a-z0-9.-]+\\.[a-z]{2,3}\",\"i\").test(e)}function validateUUID(e){return new RegExp(\"^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$\",\"i\").test(e)}function once(e){var a;if(\"function\"!=typeof e)return function(){};var t=2;return function(){return--t>0&&(a=e.apply(this,arguments)),t<=1&&(e=void 0),a}}var submitLink=null,nameInput=null,emailInput=null;$(document).ready(function(){submitLink=$(\"a[href=#submit-form]\"),nameInput=$(\"input[name=first_name]\"),emailInput=$(\"input[name=email]\"),submitLink.click(function(e){console.log(\"hello\"),e.preventDefault(),e.stopPropagation();var a=nameInput.val(),t=emailInput.val().replace(/s/g,\"\"),r=!1;if(\"\"==a?(nameInput.css({\"border-color\":\"#B91517\",\"border-width\":\"3px\"}),r=!0):nameInput.css({\
mutation createHtmlTag{
createHtmlTag(data: {
title: "JQUERY"
isGlobal: true
selector: "head"
position: PREPEND_TO
html: "<script\n src=\"https://code.jquery.com/jquery-1.11.2.min.js\"\n crossorigin=\"anonymous\"></script>"
}) {
htmlTagId
}